NeoLine
English
English
  • Welcome to NeoLine
  • 🌵Download NeoLine Wallet
    • Mobile
      • Download iOS Version
      • Download Android Version
    • Google Chrome Extension
      • Download Google Chrome Extension
  • 🧩Create and Manage Neo X Wallet
    • Create Neo X (EVM) Wallet
    • Import Neo X (EVM) wallet
    • How to Bridge GAS Using the NeoLine Chrome Extension?
    • How to add and switch networks?
    • About NeoLine Activity
  • 🙂N3 Wallet
    • Neo N3 Wallet User Guide
      • Neo N3 Wallet | Mobile
      • Neo N3 Wallet | NeoLine Chrome Extension
    • Neo N3 Migration Guide
      • Neo N3 Migration Guide | Mobile
      • Neo N3 Migration Guide | NeoLine Chrome Extension
  • 🔒Hardware Wallet
    • Ledger Hardware Wallet
  • 🌈Getting Started
    • How to Securely and Correctly Backup Your Wallet?
    • One Pass Setting for NeoLine Extension Wallet
    • How to Use the Address Book?
    • How to Speed Up or Cancel a Pending Transaction?
    • How to Delete Unused Wallet Accounts in the NeoLine Wallet?
    • Manage Assets
      • How to Add/Manage Assets?
      • How to Add NFTs
      • How to Use NeoLine Wallet for Transfer and Receive
      • How to Transfer to Other Wallets/Exchanges
    • FAQ
  • Reference
    • Neo3 provider API
      • Read Methods
        • getProvider
        • getBalance
        • getStorage
        • invokeRead
        • invokeReadMulti
        • verifyMessage
        • verifyMessageV2
        • getBlock
        • getTransaction
        • getApplicationLog
        • pickAddress
        • AddressToScriptHash
        • ScriptHashToAddress
      • Write Methods
        • send
        • invoke
        • invokeMultiple
        • signMessage
        • signMessageV2
        • signMessageWithoutSalt
        • signMessageWithoutSaltV2
        • signTransaction
        • switchWalletNetwork
        • switchWalletAccount
      • Common Methods
        • getNetworks
        • getAccount
        • getPublicKey
      • Common Events
        • READY
        • ACCOUNT_CHANGED
        • CONNECTED
        • DISCONNECTED
        • NETWORK_CHANGED
        • BLOCK_HEIGHT_CHANGED
        • TRANSACTION_CONFIRMED
      • Event Methods
        • addEventListener
        • removeEventListener
      • Errors
        • Errors
    • Neo2 provider API
      • Read Methods
        • getProvider
        • getNetworks
        • getAccount
        • getPublicKey
        • getBalance
        • getStorage
        • invokeRead
        • verifyMessage
        • getBlock
        • getTransaction
        • getApplicationLog
      • Write Methods
        • send
        • invoke
        • invokeMulti
        • signMessage
        • deploy
        • switchWalletNetwork
        • switchWalletAccount
      • Events
        • READY
        • ACCOUNT_CHANGED
        • CONNECTED
        • DISCONNECTED
        • NETWORK_CHANGED
        • BLOCK_HEIGHT_CHANGED
        • TRANSACTION_CONFIRMED
      • Event Methods
        • addEventListener
        • removeEventListener
      • Errors
        • Errors
    • Ethereum provider API
    • JSON-RPC API
      • eth_requestAccounts
      • eth_accounts
      • eth_chainId
      • personal_sign
      • eth_signTypedData_v4
      • eth_sendTransaction
      • wallet_addEthereumChain
      • wallet_switchEthereumChain
      • wallet_watchAsset
  • 💬Contact Us
    • Contact Us
由 GitBook 提供支持
在本页
  • Input Arguments
  • Success Response
  • Argument
  • Signer
  • Scopes
  • WitnessRule
  • WitnessCondition
  • BooleanWitnessCondition
  • AndWitnessCondition
  • NotWitnessCondition
  • OrWitnessCondition
  • ScriptHashWitnessCondition
  • GroupWitnessCondition
  • CalledByEntryWitnessCondition
  • CalledByContractWitnessCondition
  • CalledByGroupWitnessCondition
  • Error Response
  • Example
  • Request
  • Response

这有帮助吗?

  1. Reference
  2. Neo3 provider API
  3. Read Methods

invokeRead

Execute a contract invocation in read-only mode.

Input Arguments

Parameter
Description

scriptHash: string

Script hash of the smart contract to invoke a read on

operation: string

Operation on the smart contract to call

Any input arguments for the operation

Sender and the effective scope of signature

Success Response

The wallet will return the direct response from the RPC node.

Parameter
Description

script: string

The script which was run

state: string

Status of the executeion

gas_consumed: string

Estimated amount of GAS to be used to execute the invocation. (Up to 10 free per transaction)

An array of response arguments

Argument

Parameter
Description

type: 'String' | 'Boolean' | 'Hash160' | 'Hash256' | 'Integer' | 'ByteArray' | 'Array' | 'Address'

The type of the argument with you are using. The type is an array, please see the example for the value.

value: string

String representation of the argument which you are using

Signer

Parameter
Description

account: string

scriptHash of the address

Effective range of the signature

allowedContracts?: Array

Contracts of the signature can take effect, if scopes is CustomContracts

allowedGroups?: Array

Pubkeys of the signature can take effect, if scopes is CustomGroups

Custom rules for witness to adhere by, if scopes is WitnessRules

Scopes

Field
Description

0

Only transactions are signed and no contracts are allowed to use this signature.

1

It only applies to the chain call entry. That is, if the user invokes contract A, and then contract A calls contract B, only contract A can use the signature. It is recommended as the default value for the wallet.

16

Custom contract. The signature can be used in the specified contract. It can be used in conjunction with CalledByEntry.

32

Custom contract groups that can be used in a specified contract group. It can be used in conjunction with CalledByEntry.

64

Indicates that the current context must satisfy the specified rules.

128

Global. The risk is extremely high because the contract may transfer all assets in the address. Only choose it when the contract is extremely trusted.

WitnessRule

Parameter
Description

action: 'Deny' | 'Allow'

Represents the action of a WitnessRule.

Represents the condition of a WitnessRule.

WitnessCondition

Field
Description

Indicates that the condition will always be met or not met.

Indicates that all conditions must be met.

Reverse another condition.

Indicates that any of the conditions meets.

Indicates that the condition is met when the current context has the specified script hash.

Indicates that the condition is met when the current context has the specified group.

Indicates that the condition is met when the current context is the entry point or is called by the entry point.

Indicates that the condition is met when the current context is called by the specified contract.

Indicates that the condition is met when the current context is called by the specified group.

BooleanWitnessCondition

Parameter
Description

type: 'Boolean'

The type of the BooleanWitnessCondition.

expression: boolean

The expression of the BooleanWitnessCondition.

AndWitnessCondition

Parameter
Description

type: 'And'

The type of the AndWitnessCondition.

The expressions of the AndWitnessCondition.

NotWitnessCondition

Parameter
Description

type: 'Not'

The type of the NotWitnessCondition.

The expression of the NotWitnessCondition.

OrWitnessCondition

Parameter
Description

type: 'Or'

The type of the OrWitnessCondition.

The expressions of the OrWitnessCondition.

ScriptHashWitnessCondition

Parameter
Description

type: 'ScriptHash'

The type of the ScriptHashWitnessCondition.

hash: string

The hash of the ScriptHashWitnessCondition.

GroupWitnessCondition

Parameter
Description

type: 'Group'

The type of the GroupWitnessCondition.

group: string

The group of the GroupWitnessCondition.

CalledByEntryWitnessCondition

Parameter
Description

type: 'CalledByEntry'

The type of the CalledByEntryWitnessCondition.

CalledByContractWitnessCondition

Parameter
Description

type: 'CalledByContract'

The type of the CalledByContractWitnessCondition.

hash: string

The hash of the CalledByContractWitnessCondition.

CalledByGroupWitnessCondition

Parameter
Description

type: 'CalledByGroup'

The type of the CalledByGroupWitnessCondition.

group: string

The group of the CalledByGroupWitnessCondition.

Error Response

Parameter
Description

type: string

The type of error which has occured

description: string

A description of the error which has occured

data: string

Any raw data associated with the error

Example

Request

neolineN3.invokeRead({
    scriptHash: 'd2a4cff31913016155e38e474a2c06d08be276cf',
    operation: 'transfer',
    args: [
        {
            "type": "Hash160",
            "value": "0xebae4ab3f21765e5f604dfdd590fdf142cfb89fa"
        },
        {
            "type": "Hash160",
            "value": "0xebae4ab3f21765e5f604dfdd590fdf142cfb89fa"
        },
        {
            "type": "Integer",
            "value": "10000"
        },
        {
            "type": "String",
            "value": ""
        }
    ],
    signers: [
        {
            account: "2cab903ff032ac693f8514581665be534beac39f",
            scopes: 1
        }
    ],
})
.then(result => {
  console.log('Read invocation result: ' + JSON.stringify(result));
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'NO_PROVIDER':
        console.log('No provider available.');
        break;
    case 'CONNECTION_REFUSED':
        console.log('Connection dApp not connected. Please call the "connect" function.');
        break;
    case 'RPC_ERROR':
        console.log('There was an error when broadcasting this transaction to the network.');
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});

Response

{
    script: "DAABECcMFPqJ+ywU3w9Z3d8E9uVlF/KzSq7rDBT6ifssFN8PWd3fBPblZRfys0qu6xTAHwwIdHJhbnNmZXIMFM924ovQBixKR47jVWEBExnzz6TSQWJ9W1I=",
    state:"HALT",
    stack:[
        {
            type:"Boolean",
            value:false
        }
    ]
}
/* Example, Type is array */
args: [
        {
            type: "Array",
            value: [
              {
                type: "String",
                value: "0x576f726c64"
              }, {
                type: "String",
                value: "0x576f726c64"
              }
            ]
        }
    ]
上一页getStorage下一页invokeReadMulti

最后更新于7个月前

这有帮助吗?

args: Argument[]

signers: Signers[]

stack: Argument[]

scopes: number

rules?: WitnessRule[]

condition: WitnessCondition

BooleanWitnessCondition

AndWitnessCondition

NotWitnessCondition

OrWitnessCondition

ScriptHashWitnessCondition

GroupWitnessCondition

CalledByEntryWitnessCondition

CalledByContractWitnessCondition

CalledByGroupWitnessCondition

expressions: WitnessCondition[]

expression: WitnessCondition

expressions: WitnessCondition[]