Documentation

Overview

Package client implements NEO-specific JSON-RPC 2.0 client. This package is currently in alpha and is subject to change.

Client

After creating a client instance with or without a ClientConfig you can interact with the NEO blockchain by its exposed methods.

Some of the methods also allow to pass a verbose bool. This will return a more pretty printed response from the server instead of a raw hex string.

TODO:

Add missing methods to client.
Allow client to connect using client cert.
More in-depth examples.

Supported methods

getapplicationlog
getbestblockhash
getblock
getblockcount
getblockhash
getblockheader
getblocksysfee
getconnectioncount
getcontractstate
getnep17balances
getnep17transfers
getpeers
getrawmempool
getrawtransaction
getstorage
gettransactionheight
getunclaimedgas
getvalidators
getversion
invoke
invokefunction
invokescript
sendrawtransaction
submitblock
validateaddress

Unsupported methods

claimgas
dumpprivkey
getbalance
getmetricblocktimestamp
getnewaddress
getwalletheight
importprivkey
listaddress
listplugins
sendfrom
sendmany
sendtoaddress
Example
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

    Client represents the middleman for executing JSON RPC calls to remote NEO RPC nodes.

    func New

    func New(ctx context.Context, endpoint string, opts Options) (*Client, error)

      New returns a new Client ready to use. You should call Init method to initialize network magic the client is operating on.

      func (*Client) AddNetworkFee

      func (c *Client) AddNetworkFee(tx *transaction.Transaction, extraFee int64, accs ...*wallet.Account) error

        AddNetworkFee adds network fee for each witness script and optional extra network fee to transaction. `accs` is an array signer's accounts.

        func (*Client) CalculateNetworkFee

        func (c *Client) CalculateNetworkFee(tx *transaction.Transaction) (int64, error)

          CalculateNetworkFee calculates network fee for transaction. The transaction may have empty witnesses for contract signers and may have only verification scripts filled for standard sig/multisig signers.

          func (*Client) CalculateNotaryFee

          func (c *Client) CalculateNotaryFee(nKeys uint8) (int64, error)

            CalculateNotaryFee calculates network fee for one dummy Notary witness and NotaryAssisted attribute with NKeys specified. The result should be added to the transaction's net fee for successful verification.

            func (*Client) CalculateValidUntilBlock

            func (c *Client) CalculateValidUntilBlock() (uint32, error)

              CalculateValidUntilBlock calculates ValidUntilBlock field for tx as current blockchain height + number of validators. Number of validators is the length of blockchain validators list got from GetNextBlockValidators() method. Validators count is being cached and updated every 100 blocks.

              func (*Client) CreateNEP17MultiTransferTx

              func (c *Client) CreateNEP17MultiTransferTx(acc *wallet.Account, gas int64, recipients []TransferTarget, data []interface{}) (*transaction.Transaction, error)

                CreateNEP17MultiTransferTx creates an invocation transaction for performing NEP17 transfers from a single sender to multiple recipients with the given data.

                func (*Client) CreateNEP17TransferTx

                func (c *Client) CreateNEP17TransferTx(acc *wallet.Account, to util.Uint160, token util.Uint160, amount int64, gas int64, data interface{}) (*transaction.Transaction, error)

                  CreateNEP17TransferTx creates an invocation transaction for the 'transfer' method of a given contract (token) to move specified amount of NEP17 assets (in FixedN format using contract's number of decimals) to given account and returns it. The returned transaction is not signed.

                  func (*Client) CreateTxFromScript

                  func (c *Client) CreateTxFromScript(script []byte, acc *wallet.Account, sysFee, netFee int64,
                  	cosigners []SignerAccount) (*transaction.Transaction, error)

                    CreateTxFromScript creates transaction and properly sets cosigners and NetworkFee. If sysFee <= 0, it is determined via result of `invokescript` RPC. You should initialize network magic with Init before calling CreateTxFromScript.

                    func (*Client) GetApplicationLog

                    func (c *Client) GetApplicationLog(hash util.Uint256, trig *trigger.Type) (*result.ApplicationLog, error)

                      GetApplicationLog returns the contract log based on the specified txid.

                      func (*Client) GetBestBlockHash

                      func (c *Client) GetBestBlockHash() (util.Uint256, error)

                        GetBestBlockHash returns the hash of the tallest block in the main chain.

                        func (*Client) GetBlockByHash

                        func (c *Client) GetBlockByHash(hash util.Uint256) (*block.Block, error)

                          GetBlockByHash returns a block by its hash. You should initialize network magic with Init before calling GetBlockByHash.

                          func (*Client) GetBlockByHashVerbose

                          func (c *Client) GetBlockByHashVerbose(hash util.Uint256) (*result.Block, error)

                            GetBlockByHashVerbose returns a block wrapper with additional metadata by its hash. You should initialize network magic with Init before calling GetBlockByHashVerbose.

                            func (*Client) GetBlockByIndex

                            func (c *Client) GetBlockByIndex(index uint32) (*block.Block, error)

                              GetBlockByIndex returns a block by its height. You should initialize network magic with Init before calling GetBlockByIndex.

                              func (*Client) GetBlockByIndexVerbose

                              func (c *Client) GetBlockByIndexVerbose(index uint32) (*result.Block, error)

                                GetBlockByIndexVerbose returns a block wrapper with additional metadata by its height. You should initialize network magic with Init before calling GetBlockByIndexVerbose. NOTE: to get transaction.ID and transaction.Size, use t.Hash() and io.GetVarSize(t) respectively.

                                func (*Client) GetBlockCount

                                func (c *Client) GetBlockCount() (uint32, error)

                                  GetBlockCount returns the number of blocks in the main chain.

                                  func (*Client) GetBlockHash

                                  func (c *Client) GetBlockHash(index uint32) (util.Uint256, error)

                                    GetBlockHash returns the hash value of the corresponding block, based on the specified index.

                                    func (*Client) GetBlockHeader

                                    func (c *Client) GetBlockHeader(hash util.Uint256) (*block.Header, error)

                                      GetBlockHeader returns the corresponding block header information from serialized hex string according to the specified script hash. You should initialize network magic // with Init before calling GetBlockHeader.

                                      func (*Client) GetBlockHeaderCount

                                      func (c *Client) GetBlockHeaderCount() (uint32, error)

                                        GetBlockHeaderCount returns the number of headers in the main chain.

                                        func (*Client) GetBlockHeaderVerbose

                                        func (c *Client) GetBlockHeaderVerbose(hash util.Uint256) (*result.Header, error)

                                          GetBlockHeaderVerbose returns the corresponding block header information from Json format string according to the specified script hash.

                                          func (*Client) GetBlockSysFee

                                          func (c *Client) GetBlockSysFee(index uint32) (fixedn.Fixed8, error)

                                            GetBlockSysFee returns the system fees of the block, based on the specified index.

                                            func (*Client) GetCommittee

                                            func (c *Client) GetCommittee() (keys.PublicKeys, error)

                                              GetCommittee returns the current public keys of NEO nodes in committee.

                                              func (*Client) GetConnectionCount

                                              func (c *Client) GetConnectionCount() (int, error)

                                                GetConnectionCount returns the current number of connections for the node.

                                                func (*Client) GetContractStateByAddressOrName

                                                func (c *Client) GetContractStateByAddressOrName(addressOrName string) (*state.Contract, error)

                                                  GetContractStateByAddressOrName queries contract information, according to the contract address or name.

                                                  func (*Client) GetContractStateByHash

                                                  func (c *Client) GetContractStateByHash(hash util.Uint160) (*state.Contract, error)

                                                    GetContractStateByHash queries contract information, according to the contract script hash.

                                                    func (*Client) GetContractStateByID

                                                    func (c *Client) GetContractStateByID(id int32) (*state.Contract, error)

                                                      GetContractStateByID queries contract information, according to the contract ID.

                                                      func (*Client) GetDesignatedByRole

                                                      func (c *Client) GetDesignatedByRole(role noderoles.Role, index uint32) (keys.PublicKeys, error)

                                                        GetDesignatedByRole invokes `getDesignatedByRole` method on a native RoleManagement contract.

                                                        func (*Client) GetExecFeeFactor

                                                        func (c *Client) GetExecFeeFactor() (int64, error)

                                                          GetExecFeeFactor invokes `getExecFeeFactor` method on a native Policy contract.

                                                          func (*Client) GetFeePerByte

                                                          func (c *Client) GetFeePerByte() (int64, error)

                                                            GetFeePerByte invokes `getFeePerByte` method on a native Policy contract.

                                                            func (*Client) GetGasPerBlock

                                                            func (c *Client) GetGasPerBlock() (int64, error)

                                                              GetGasPerBlock invokes `getGasPerBlock` method on a native NEO contract.

                                                              func (*Client) GetMaxNotValidBeforeDelta

                                                              func (c *Client) GetMaxNotValidBeforeDelta() (int64, error)

                                                                GetMaxNotValidBeforeDelta invokes `getMaxNotValidBeforeDelta` method on a native Notary contract.

                                                                func (*Client) GetNEP17Balances

                                                                func (c *Client) GetNEP17Balances(address util.Uint160) (*result.NEP17Balances, error)

                                                                  GetNEP17Balances is a wrapper for getnep17balances RPC.

                                                                  func (*Client) GetNEP17Transfers

                                                                  func (c *Client) GetNEP17Transfers(address string, start, stop *uint32, limit, page *int) (*result.NEP17Transfers, error)

                                                                    GetNEP17Transfers is a wrapper for getnep17transfers RPC. Address parameter is mandatory, while all the others are optional. Start and stop parameters are supported since neo-go 0.77.0 and limit and page since neo-go 0.78.0. These parameters are positional in the JSON-RPC call, you can't specify limit and not specify start/stop for example.

                                                                    func (*Client) GetNNSPrice

                                                                    func (c *Client) GetNNSPrice() (int64, error)

                                                                      GetNNSPrice invokes `getPrice` method on a native NameService contract.

                                                                      func (*Client) GetNativeContractHash

                                                                      func (c *Client) GetNativeContractHash(name string) (util.Uint160, error)

                                                                        GetNativeContractHash returns native contract hash by its name.

                                                                        func (*Client) GetNativeContracts

                                                                        func (c *Client) GetNativeContracts() ([]state.NativeContract, error)

                                                                          GetNativeContracts queries information about native contracts.

                                                                          func (*Client) GetNetwork

                                                                          func (c *Client) GetNetwork() netmode.Magic

                                                                            GetNetwork returns the network magic of the RPC node client connected to.

                                                                            func (*Client) GetNextBlockValidators

                                                                            func (c *Client) GetNextBlockValidators() ([]result.Validator, error)

                                                                              GetNextBlockValidators returns the current NEO consensus nodes information and voting status.

                                                                              func (*Client) GetOraclePrice

                                                                              func (c *Client) GetOraclePrice() (int64, error)

                                                                                GetOraclePrice invokes `getPrice` method on a native Oracle contract.

                                                                                func (*Client) GetPeers

                                                                                func (c *Client) GetPeers() (*result.GetPeers, error)

                                                                                  GetPeers returns the list of nodes that the node is currently connected/disconnected from.

                                                                                  func (*Client) GetRawMemPool

                                                                                  func (c *Client) GetRawMemPool() ([]util.Uint256, error)

                                                                                    GetRawMemPool returns the list of unconfirmed transactions in memory.

                                                                                    func (*Client) GetRawTransaction

                                                                                    func (c *Client) GetRawTransaction(hash util.Uint256) (*transaction.Transaction, error)

                                                                                      GetRawTransaction returns a transaction by hash. You should initialize network magic with Init before calling GetRawTransaction.

                                                                                      func (*Client) GetRawTransactionVerbose

                                                                                      func (c *Client) GetRawTransactionVerbose(hash util.Uint256) (*result.TransactionOutputRaw, error)

                                                                                        GetRawTransactionVerbose returns a transaction wrapper with additional metadata by transaction's hash. You should initialize network magic with Init before calling GetRawTransactionVerbose. NOTE: to get transaction.ID and transaction.Size, use t.Hash() and io.GetVarSize(t) respectively.

                                                                                        func (*Client) GetStorageByHash

                                                                                        func (c *Client) GetStorageByHash(hash util.Uint160, key []byte) ([]byte, error)

                                                                                          GetStorageByHash returns the stored value, according to the contract script hash and the stored key.

                                                                                          func (*Client) GetStorageByID

                                                                                          func (c *Client) GetStorageByID(id int32, key []byte) ([]byte, error)

                                                                                            GetStorageByID returns the stored value, according to the contract ID and the stored key.

                                                                                            func (*Client) GetStoragePrice

                                                                                            func (c *Client) GetStoragePrice() (int64, error)

                                                                                              GetStoragePrice invokes `getStoragePrice` method on a native Policy contract.

                                                                                              func (*Client) GetTransactionHeight

                                                                                              func (c *Client) GetTransactionHeight(hash util.Uint256) (uint32, error)

                                                                                                GetTransactionHeight returns the block index in which the transaction is found.

                                                                                                func (*Client) GetUnclaimedGas

                                                                                                func (c *Client) GetUnclaimedGas(address string) (result.UnclaimedGas, error)

                                                                                                  GetUnclaimedGas returns unclaimed GAS amount for the specified address.

                                                                                                  func (*Client) GetVersion

                                                                                                  func (c *Client) GetVersion() (*result.Version, error)

                                                                                                    GetVersion returns the version information about the queried node.

                                                                                                    func (*Client) Init

                                                                                                    func (c *Client) Init() error

                                                                                                      Init sets magic of the network client connected to and native NEO and GAS contracts scripthashes. This method should be called before any transaction-, header- or block-related requests in order to deserialize responses properly.

                                                                                                      func (*Client) InvokeContractVerify

                                                                                                      func (c *Client) InvokeContractVerify(contract util.Uint160, params []smartcontract.Parameter, signers []transaction.Signer, witnesses ...transaction.Witness) (*result.Invoke, error)

                                                                                                        InvokeContractVerify returns the results after calling `verify` method of the smart contract with the given parameters under verification trigger type. NOTE: this is test invoke and will not affect the blockchain.

                                                                                                        func (*Client) InvokeFunction

                                                                                                        func (c *Client) InvokeFunction(contract util.Uint160, operation string, params []smartcontract.Parameter, signers []transaction.Signer) (*result.Invoke, error)

                                                                                                          InvokeFunction returns the results after calling the smart contract scripthash with the given operation and parameters. NOTE: this is test invoke and will not affect the blockchain.

                                                                                                          func (*Client) InvokeScript

                                                                                                          func (c *Client) InvokeScript(script []byte, signers []transaction.Signer) (*result.Invoke, error)

                                                                                                            InvokeScript returns the result of the given script after running it true the VM. NOTE: This is a test invoke and will not affect the blockchain.

                                                                                                            func (*Client) IsBlocked

                                                                                                            func (c *Client) IsBlocked(hash util.Uint160) (bool, error)

                                                                                                              IsBlocked invokes `isBlocked` method on native Policy contract.

                                                                                                              func (*Client) MultiTransferNEP17

                                                                                                              func (c *Client) MultiTransferNEP17(acc *wallet.Account, gas int64, recipients []TransferTarget, data []interface{}) (util.Uint256, error)

                                                                                                                MultiTransferNEP17 is similar to TransferNEP17, buf allows to have multiple recipients.

                                                                                                                func (*Client) NEP11BalanceOf

                                                                                                                func (c *Client) NEP11BalanceOf(tokenHash, owner util.Uint160) (int64, error)

                                                                                                                  NEP11BalanceOf invokes `balanceOf` NEP11 method on a specified contract.

                                                                                                                  func (*Client) NEP11DBalanceOf

                                                                                                                  func (c *Client) NEP11DBalanceOf(tokenHash, owner util.Uint160, tokenID string) (int64, error)

                                                                                                                    NEP11DBalanceOf invokes `balanceOf` divisible NEP11 method on a specified contract.

                                                                                                                    func (*Client) NEP11Decimals

                                                                                                                    func (c *Client) NEP11Decimals(tokenHash util.Uint160) (int64, error)

                                                                                                                      NEP11Decimals invokes `decimals` NEP11 method on a specified contract.

                                                                                                                      func (*Client) NEP11NDOwnerOf

                                                                                                                      func (c *Client) NEP11NDOwnerOf(tokenHash util.Uint160, tokenID string) (util.Uint160, error)

                                                                                                                        NEP11NDOwnerOf invokes `ownerOf` non-devisible NEP11 method with the specified token ID on a specified contract.

                                                                                                                        func (*Client) NEP11Properties

                                                                                                                        func (c *Client) NEP11Properties(tokenHash util.Uint160, tokenID string) (*stackitem.Map, error)

                                                                                                                          NEP11Properties invokes `properties` optional NEP11 method on a specified contract.

                                                                                                                          func (*Client) NEP11Symbol

                                                                                                                          func (c *Client) NEP11Symbol(tokenHash util.Uint160) (string, error)

                                                                                                                            NEP11Symbol invokes `symbol` NEP11 method on a specified contract.

                                                                                                                            func (*Client) NEP11TotalSupply

                                                                                                                            func (c *Client) NEP11TotalSupply(tokenHash util.Uint160) (int64, error)

                                                                                                                              NEP11TotalSupply invokes `totalSupply` NEP11 method on a specified contract.

                                                                                                                              func (*Client) NEP17BalanceOf

                                                                                                                              func (c *Client) NEP17BalanceOf(tokenHash, acc util.Uint160) (int64, error)

                                                                                                                                NEP17BalanceOf invokes `balanceOf` NEP17 method on a specified contract.

                                                                                                                                func (*Client) NEP17Decimals

                                                                                                                                func (c *Client) NEP17Decimals(tokenHash util.Uint160) (int64, error)

                                                                                                                                  NEP17Decimals invokes `decimals` NEP17 method on a specified contract.

                                                                                                                                  func (*Client) NEP17Symbol

                                                                                                                                  func (c *Client) NEP17Symbol(tokenHash util.Uint160) (string, error)

                                                                                                                                    NEP17Symbol invokes `symbol` NEP17 method on a specified contract.

                                                                                                                                    func (*Client) NEP17TokenInfo

                                                                                                                                    func (c *Client) NEP17TokenInfo(tokenHash util.Uint160) (*wallet.Token, error)

                                                                                                                                      NEP17TokenInfo returns full NEP17 token info.

                                                                                                                                      func (*Client) NEP17TotalSupply

                                                                                                                                      func (c *Client) NEP17TotalSupply(tokenHash util.Uint160) (int64, error)

                                                                                                                                        NEP17TotalSupply invokes `totalSupply` NEP17 method on a specified contract.

                                                                                                                                        func (*Client) NNSIsAvailable

                                                                                                                                        func (c *Client) NNSIsAvailable(name string) (bool, error)

                                                                                                                                          NNSIsAvailable invokes `isAvailable` method on a native NameService contract.

                                                                                                                                          func (*Client) NNSResolve

                                                                                                                                          func (c *Client) NNSResolve(name string, typ nnsrecords.Type) (string, error)

                                                                                                                                            NNSResolve invokes `resolve` method on a native NameService contract.

                                                                                                                                            func (*Client) Ping

                                                                                                                                            func (c *Client) Ping() error

                                                                                                                                              Ping attempts to create a connection to the endpoint. and returns an error if there is one.

                                                                                                                                              func (*Client) SendRawTransaction

                                                                                                                                              func (c *Client) SendRawTransaction(rawTX *transaction.Transaction) (util.Uint256, error)

                                                                                                                                                SendRawTransaction broadcasts a transaction over the NEO network. The given hex string needs to be signed with a keypair. When the result of the response object is true, the TX has successfully been broadcasted to the network.

                                                                                                                                                func (*Client) SignAndPushInvocationTx

                                                                                                                                                func (c *Client) SignAndPushInvocationTx(script []byte, acc *wallet.Account, sysfee int64, netfee fixedn.Fixed8, cosigners []SignerAccount) (util.Uint256, error)

                                                                                                                                                  SignAndPushInvocationTx signs and pushes given script as an invocation transaction using given wif to sign it and spending the amount of gas specified. It returns a hash of the invocation transaction and an error.

                                                                                                                                                  func (*Client) SignAndPushP2PNotaryRequest

                                                                                                                                                  func (c *Client) SignAndPushP2PNotaryRequest(mainTx *transaction.Transaction, fallbackScript []byte, fallbackSysFee int64, fallbackNetFee int64, fallbackValidFor uint32, acc *wallet.Account) (*payload.P2PNotaryRequest, error)

                                                                                                                                                    SignAndPushP2PNotaryRequest creates and pushes P2PNotary request constructed from the main and fallback transactions using given wif to sign it. It returns the request and an error. Fallback transaction is constructed from the given script using the amount of gas specified. For successful fallback transaction validation at least 2*transaction.NotaryServiceFeePerKey GAS should be deposited to Notary contract. Main transaction should be constructed by the user. Several rules need to be met for successful main transaction acceptance: 1. Native Notary contract should be a signer of the main transaction. 2. Notary signer should have None scope. 3. Main transaction should have dummy contract witness for Notary signer. 4. Main transaction should have NotaryAssisted attribute with NKeys specified. 5. NotaryAssisted attribute and dummy Notary witness (as long as the other incomplete witnesses)

                                                                                                                                                    should be paid for. Use CalculateNotaryWitness to calculate the amount of network fee to pay
                                                                                                                                                    for the attribute and Notary witness.
                                                                                                                                                    

                                                                                                                                                    6. Main transaction either shouldn't have all witnesses attached (in this case none of them

                                                                                                                                                    can be multisignature), or it only should have a partial multisignature.
                                                                                                                                                    

                                                                                                                                                    Note: client should be initialized before SignAndPushP2PNotaryRequest call.

                                                                                                                                                    func (*Client) StateRootInHeader

                                                                                                                                                    func (c *Client) StateRootInHeader() bool

                                                                                                                                                      StateRootInHeader returns true if state root is contained in block header.

                                                                                                                                                      func (*Client) SubmitBlock

                                                                                                                                                      func (c *Client) SubmitBlock(b block.Block) (util.Uint256, error)

                                                                                                                                                        SubmitBlock broadcasts a raw block over the NEO network.

                                                                                                                                                        func (*Client) SubmitP2PNotaryRequest

                                                                                                                                                        func (c *Client) SubmitP2PNotaryRequest(req *payload.P2PNotaryRequest) (util.Uint256, error)

                                                                                                                                                          SubmitP2PNotaryRequest submits given P2PNotaryRequest payload to the RPC node.

                                                                                                                                                          func (*Client) SubmitRawOracleResponse

                                                                                                                                                          func (c *Client) SubmitRawOracleResponse(ps request.RawParams) error

                                                                                                                                                            SubmitRawOracleResponse submits raw oracle response to the oracle node. Raw params are used to avoid excessive marshalling.

                                                                                                                                                            func (*Client) TransferNEP11

                                                                                                                                                            func (c *Client) TransferNEP11(acc *wallet.Account, to util.Uint160,
                                                                                                                                                            	tokenHash util.Uint160, tokenID string, gas int64) (util.Uint256, error)

                                                                                                                                                              TransferNEP11 creates an invocation transaction that invokes 'transfer' method on a given token to move the whole NEP11 token with the specified token ID to given account and sends it to the network returning just a hash of it.

                                                                                                                                                              func (*Client) TransferNEP11D

                                                                                                                                                              func (c *Client) TransferNEP11D(acc *wallet.Account, to util.Uint160,
                                                                                                                                                              	tokenHash util.Uint160, amount int64, tokenID string, gas int64) (util.Uint256, error)

                                                                                                                                                                TransferNEP11D creates an invocation transaction that invokes 'transfer' method on a given token to move specified amount of divisible NEP11 assets (in FixedN format using contract's number of decimals) to given account and sends it to the network returning just a hash of it.

                                                                                                                                                                func (*Client) TransferNEP17

                                                                                                                                                                func (c *Client) TransferNEP17(acc *wallet.Account, to util.Uint160, token util.Uint160, amount int64, gas int64, data interface{}) (util.Uint256, error)

                                                                                                                                                                  TransferNEP17 creates an invocation transaction that invokes 'transfer' method on a given token to move specified amount of NEP17 assets (in FixedN format using contract's number of decimals) to given account with data specified and sends it to the network returning just a hash of it.

                                                                                                                                                                  func (*Client) ValidateAddress

                                                                                                                                                                  func (c *Client) ValidateAddress(address string) error

                                                                                                                                                                    ValidateAddress verifies that the address is a correct NEO address.

                                                                                                                                                                    type Notification

                                                                                                                                                                    type Notification struct {
                                                                                                                                                                    	Type  response.EventID
                                                                                                                                                                    	Value interface{}
                                                                                                                                                                    }

                                                                                                                                                                      Notification represents server-generated notification for client subscriptions. Value can be one of block.Block, result.ApplicationLog, result.NotificationEvent or transaction.Transaction based on Type.

                                                                                                                                                                      type Options

                                                                                                                                                                      type Options struct {
                                                                                                                                                                      	// Cert is a client-side certificate, it doesn't work at the moment along
                                                                                                                                                                      	// with the other two options below.
                                                                                                                                                                      	Cert           string
                                                                                                                                                                      	Key            string
                                                                                                                                                                      	CACert         string
                                                                                                                                                                      	DialTimeout    time.Duration
                                                                                                                                                                      	RequestTimeout time.Duration
                                                                                                                                                                      }

                                                                                                                                                                        Options defines options for the RPC client. All values are optional. If any duration is not specified a default of 4 seconds will be used.

                                                                                                                                                                        type SignerAccount

                                                                                                                                                                        type SignerAccount struct {
                                                                                                                                                                        	Signer  transaction.Signer
                                                                                                                                                                        	Account *wallet.Account
                                                                                                                                                                        }

                                                                                                                                                                          SignerAccount represents combination of the transaction.Signer and the corresponding wallet.Account.

                                                                                                                                                                          type TransferTarget

                                                                                                                                                                          type TransferTarget struct {
                                                                                                                                                                          	Token   util.Uint160
                                                                                                                                                                          	Address util.Uint160
                                                                                                                                                                          	Amount  int64
                                                                                                                                                                          }

                                                                                                                                                                            TransferTarget represents target address and token amount for transfer.

                                                                                                                                                                            type WSClient

                                                                                                                                                                            type WSClient struct {
                                                                                                                                                                            	Client
                                                                                                                                                                            	// Notifications is a channel that is used to send events received from
                                                                                                                                                                            	// server. Client's code is supposed to be reading from this channel if
                                                                                                                                                                            	// it wants to use subscription mechanism, failing to do so will cause
                                                                                                                                                                            	// WSClient to block even regular requests. This channel is not buffered.
                                                                                                                                                                            	// In case of protocol error or upon connection closure this channel will
                                                                                                                                                                            	// be closed, so make sure to handle this.
                                                                                                                                                                            	Notifications chan Notification
                                                                                                                                                                            	// contains filtered or unexported fields
                                                                                                                                                                            }

                                                                                                                                                                              WSClient is a websocket-enabled RPC client that can be used with appropriate servers. It's supposed to be faster than Client because it has persistent connection to the server and at the same time is exposes some functionality that is only provided via websockets (like event subscription mechanism).

                                                                                                                                                                              func NewWS

                                                                                                                                                                              func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error)

                                                                                                                                                                                NewWS returns a new WSClient ready to use (with established websocket connection). You need to use websocket URL for it like `ws://1.2.3.4/ws`. You should call Init method to initialize network magic the client is operating on.

                                                                                                                                                                                func (*WSClient) Close

                                                                                                                                                                                func (c *WSClient) Close()

                                                                                                                                                                                  Close closes connection to the remote side rendering this client instance unusable.

                                                                                                                                                                                  func (*WSClient) SubscribeForExecutionNotifications

                                                                                                                                                                                  func (c *WSClient) SubscribeForExecutionNotifications(contract *util.Uint160, name *string) (string, error)

                                                                                                                                                                                    SubscribeForExecutionNotifications adds subscription for notifications generated during transaction execution to this instance of client. It can be filtered by contract's hash (that emits notifications), nil value puts no such restrictions.

                                                                                                                                                                                    func (*WSClient) SubscribeForNewBlocks

                                                                                                                                                                                    func (c *WSClient) SubscribeForNewBlocks(primary *int) (string, error)

                                                                                                                                                                                      SubscribeForNewBlocks adds subscription for new block events to this instance of client. It can filtered by primary consensus node index, nil value doesn't add any filters.

                                                                                                                                                                                      func (*WSClient) SubscribeForNewTransactions

                                                                                                                                                                                      func (c *WSClient) SubscribeForNewTransactions(sender *util.Uint160, signer *util.Uint160) (string, error)

                                                                                                                                                                                        SubscribeForNewTransactions adds subscription for new transaction events to this instance of client. It can be filtered by sender and/or signer, nil value is treated as missing filter.

                                                                                                                                                                                        func (*WSClient) SubscribeForTransactionExecutions

                                                                                                                                                                                        func (c *WSClient) SubscribeForTransactionExecutions(state *string) (string, error)

                                                                                                                                                                                          SubscribeForTransactionExecutions adds subscription for application execution results generated during transaction execution to this instance of client. Can be filtered by state (HALT/FAULT) to check for successful or failing transactions, nil value means no filtering.

                                                                                                                                                                                          func (*WSClient) Unsubscribe

                                                                                                                                                                                          func (c *WSClient) Unsubscribe(id string) error

                                                                                                                                                                                            Unsubscribe removes subscription for given event stream.

                                                                                                                                                                                            func (*WSClient) UnsubscribeAll

                                                                                                                                                                                            func (c *WSClient) UnsubscribeAll() error

                                                                                                                                                                                              UnsubscribeAll removes all active subscriptions of current client.