Documentation ¶
Index ¶
- type Client
- func (c *Client) Bridge_GetMinted(id int64) (common.Hash, error)
- func (c *Client) CalculateGas(tx *transaction.NeoTx) (uint64, error)
- func (c *Client) Eth_Accounts() ([]common.Address, error)
- func (c *Client) Eth_BlockNumber() (uint64, error)
- func (c *Client) Eth_Call(tx *result.TransactionObject) ([]byte, error)
- func (c *Client) Eth_ChainId() (uint64, error)
- func (c *Client) Eth_Coinbase() (common.Address, error)
- func (c *Client) Eth_EstimateGas(tx *result.TransactionObject) (uint64, error)
- func (c *Client) Eth_GasPrice() (*big.Int, error)
- func (c *Client) Eth_GetBalance(addr common.Address) (*big.Int, error)
- func (c *Client) Eth_GetBlockByHash(blockHash common.Hash) (*result.Block, error)
- func (c *Client) Eth_GetBlockByNumber(height uint32) (*result.Block, error)
- func (c *Client) Eth_GetBlockTransactionCountByHash(blockHash common.Hash) (uint64, error)
- func (c *Client) Eth_GetBlockTransactionCountByNumber(height uint32) (uint64, error)
- func (c *Client) Eth_GetCode(address common.Address) ([]byte, error)
- func (c *Client) Eth_GetLogs(filter *filters.LogFilter) ([]*types.Log, error)
- func (c *Client) Eth_GetStorageAt(address common.Address, key common.Hash) (common.Hash, error)
- func (c *Client) Eth_GetTransactionByBlockHashAndIndex(blockHash common.Hash, index int) (*result.TransactionOutputRaw, error)
- func (c *Client) Eth_GetTransactionByBlockNumberAndIndex(height uint32, index int) (*result.TransactionOutputRaw, error)
- func (c *Client) Eth_GetTransactionByHash(txHash common.Hash) (*result.TransactionOutputRaw, error)
- func (c *Client) Eth_GetTransactionCount(address common.Address) (uint64, error)
- func (c *Client) Eth_GetTransactionReceipt(txHash common.Hash) (*types.Receipt, error)
- func (c *Client) Eth_ProtocolVersion() (string, error)
- func (c *Client) Eth_SendRawTransaction(raw []byte) (common.Hash, error)
- func (c *Client) Eth_SendTransaction(tx *result.TransactionObject) (common.Hash, error)
- func (c *Client) Eth_Sign(address common.Address, msg []byte) ([]byte, error)
- func (c *Client) Eth_SignTransaction(tx *result.TransactionObject) ([]byte, error)
- func (c *Client) Eth_Syncing() (*result.Syncing, error)
- func (c *Client) FindStates(stateroot common.Hash, historicalContractHash common.Address, ...) (result.FindStates, error)
- func (c *Client) GetBestBlockHash() (common.Hash, error)
- func (c *Client) GetBlockByHash(hash common.Hash) (*block.Block, error)
- func (c *Client) GetBlockByHashVerbose(hash common.Hash) (*result.Block, error)
- func (c *Client) GetBlockByIndex(index uint32) (*block.Block, error)
- func (c *Client) GetBlockByIndexVerbose(index uint32) (*result.Block, error)
- func (c *Client) GetBlockCount() (uint32, error)
- func (c *Client) GetBlockGas(index uint32) (uint64, error)
- func (c *Client) GetBlockHash(index uint32) (common.Hash, error)
- func (c *Client) GetBlockHeader(hash common.Hash) (*block.Header, error)
- func (c *Client) GetBlockHeaderCount() (uint32, error)
- func (c *Client) GetBlockHeaderVerbose(hash common.Hash) (*result.Header, error)
- func (c *Client) GetConnectionCount() (int, error)
- func (c *Client) GetConsensusAddress() (common.Address, error)
- func (c *Client) GetContractStateByAddressOrName(addressOrName string) (*state.Contract, error)
- func (c *Client) GetContractStateByHash(hash common.Address) (*state.Contract, error)
- func (c *Client) GetContractStateByID(id int32) (*state.Contract, error)
- func (c *Client) GetERC20Balances(address common.Address) (*result.ERC20Balances, error)
- func (c *Client) GetERC20Transfers(address common.Address, start, stop *uint64, limit, page *int) (*result.ERC20Transfers, error)
- func (c *Client) GetERC721Balances(address common.Address) (*result.ERC721Balances, error)
- func (c *Client) GetERC721Properties(asset common.Address, token []byte) (map[string]interface{}, error)
- func (c *Client) GetERC721Transfers(address common.Address, start, stop *uint64, limit, page *int) (*result.ERC721Transfers, error)
- func (c *Client) GetFeePerByte() (uint64, error)
- func (c *Client) GetNativeContractHash(name string) (common.Address, error)
- func (c *Client) GetNativeContracts() ([]state.NativeContract, error)
- func (c *Client) GetNetwork() (uint64, error)
- func (c *Client) GetNextBlockValidators() ([]result.Validator, error)
- func (c *Client) GetNextValidators() (keys.PublicKeys, error)
- func (c *Client) GetPeers() (*result.GetPeers, error)
- func (c *Client) GetRawMemPool() ([]common.Hash, error)
- func (c *Client) GetRawTransaction(hash common.Hash) (*transaction.Transaction, error)
- func (c *Client) GetRawTransactionVerbose(hash common.Hash) (*result.TransactionOutputRaw, error)
- func (c *Client) GetState(stateroot common.Hash, historicalContractHash common.Address, ...) ([]byte, error)
- func (c *Client) GetStateHeight() (*result.StateHeight, error)
- func (c *Client) GetStateRootByBlockHash(hash common.Hash) (*state.MPTRoot, error)
- func (c *Client) GetStateRootByHeight(height uint32) (*state.MPTRoot, error)
- func (c *Client) GetStorageByHash(hash common.Address, key []byte) ([]byte, error)
- func (c *Client) GetStorageByID(id int32, key []byte) ([]byte, error)
- func (c *Client) GetTransactionHeight(hash common.Hash) (uint32, error)
- func (c *Client) GetUnclaimedGas(address string) (result.UnclaimedGas, error)
- func (c *Client) GetValidators(index uint32) (keys.PublicKeys, error)
- func (c *Client) GetVersion() (*result.Version, error)
- func (c *Client) Init() error
- func (c *Client) IsBlocked(address common.Address) (bool, error)
- func (c *Client) Net_Listening() (bool, error)
- func (c *Client) Net_PeerCount() (uint64, error)
- func (c *Client) Net_Version() (string, error)
- func (c *Client) Ping() error
- func (c *Client) SendRawTransaction(rawTX []byte) (common.Hash, error)
- func (c *Client) SignAndPushTx(tx *transaction.Transaction, acc *wallet.Account) (common.Hash, error)
- func (c *Client) SubmitBlock(b block.Block) (common.Hash, error)
- func (c *Client) ValidateAddress(address string) error
- func (c *Client) Web3_ClientVersion() (string, error)
- func (c *Client) Web3_Sha3(data []byte) (common.Hash, error)
- type Notification
- type Options
- type WSClient
- func (c *WSClient) Close()
- func (c *WSClient) SubscribeForExecutionNotifications(contract *common.Address, name *string) (string, error)
- func (c *WSClient) SubscribeForNewBlocks(primary *int) (string, error)
- func (c *WSClient) SubscribeForNewTransactions(sender *common.Address) (string, error)
- func (c *WSClient) SubscribeForTransactionExecutions(state uint64) (string, error)
- func (c *WSClient) Unsubscribe(id string) error
- func (c *WSClient) UnsubscribeAll() error
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
}
func New ¶
New returns a new Client ready to use. You should call Init method to initialize network magic the client is operating on.
func (*Client) CalculateGas ¶
func (c *Client) CalculateGas(tx *transaction.NeoTx) (uint64, error)
func (*Client) Eth_BlockNumber ¶
func (*Client) Eth_ChainId ¶
func (*Client) Eth_EstimateGas ¶
func (c *Client) Eth_EstimateGas(tx *result.TransactionObject) (uint64, error)
func (*Client) Eth_GetBalance ¶
func (*Client) Eth_GetBlockByHash ¶
func (*Client) Eth_GetBlockByNumber ¶
func (*Client) Eth_GetBlockTransactionCountByHash ¶
func (*Client) Eth_GetBlockTransactionCountByNumber ¶
func (*Client) Eth_GetLogs ¶
func (*Client) Eth_GetStorageAt ¶
func (*Client) Eth_GetTransactionByBlockHashAndIndex ¶
func (*Client) Eth_GetTransactionByBlockNumberAndIndex ¶
func (*Client) Eth_GetTransactionByHash ¶
func (*Client) Eth_GetTransactionCount ¶
func (*Client) Eth_GetTransactionReceipt ¶
func (*Client) Eth_ProtocolVersion ¶
func (*Client) Eth_SendRawTransaction ¶
func (*Client) Eth_SendTransaction ¶
func (*Client) Eth_SignTransaction ¶
func (c *Client) Eth_SignTransaction(tx *result.TransactionObject) ([]byte, error)
func (*Client) FindStates ¶
func (c *Client) FindStates(stateroot common.Hash, historicalContractHash common.Address, historicalPrefix []byte, start []byte, maxCount *int) (result.FindStates, error)
FindStates returns historical contract storage item states by the given stateroot, historical contract hash and historical prefix. If `start` path is specified, then items starting from `start` path are being returned (excluding item located at the start path). If `maxCount` specified, then maximum number of items to be returned equals to `maxCount`.
func (*Client) GetBestBlockHash ¶
GetBestBlockHash returns the hash of the tallest block in the main chain.
func (*Client) GetBlockByHash ¶
GetBlockByHash returns a block by its hash. You should initialize network magic with Init before calling GetBlockByHash.
func (*Client) GetBlockByHashVerbose ¶
GetBlockByHashVerbose returns a block wrapper with additional metadata by its hash. You should initialize network magic with Init before calling GetBlockByHashVerbose.
func (*Client) GetBlockByIndex ¶
GetBlockByIndex returns a block by its height. You should initialize network magic with Init before calling GetBlockByIndex.
func (*Client) GetBlockByIndexVerbose ¶
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 ¶
GetBlockCount returns the number of blocks in the main chain.
func (*Client) GetBlockGas ¶
GetBlockSysFee returns the system fees of the block, based on the specified index.
func (*Client) GetBlockHash ¶
GetBlockHash returns the hash value of the corresponding block, based on the specified index.
func (*Client) GetBlockHeader ¶
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 ¶
GetBlockHeaderCount returns the number of headers in the main chain.
func (*Client) GetBlockHeaderVerbose ¶
GetBlockHeaderVerbose returns the corresponding block header information from Json format string according to the specified script hash.
func (*Client) GetConnectionCount ¶
GetConnectionCount returns the current number of connections for the node.
func (*Client) GetContractStateByAddressOrName ¶
GetContractStateByAddressOrName queries contract information, according to the contract address or name.
func (*Client) GetContractStateByHash ¶
GetContractStateByHash queries contract information, according to the contract script hash.
func (*Client) GetContractStateByID ¶
GetContractStateByID queries contract information, according to the contract ID.
func (*Client) GetERC20Balances ¶
GetERC20Balances is a wrapper for getERC20balances RPC.
func (*Client) GetERC20Transfers ¶
func (*Client) GetERC721Balances ¶
GetERC721Balances is a wrapper for getERC721balances RPC.
func (*Client) GetERC721Properties ¶
func (c *Client) GetERC721Properties(asset common.Address, token []byte) (map[string]interface{}, error)
GetERC721Properties is a wrapper for getERC721properties RPC. We recommend using ERC721Properties method instead of this to receive and work with proper VM types, this method is provided mostly for the sake of completeness. For well-known attributes like "description", "image", "name" and "tokenURI" it returns strings, while for all other ones []byte (which can be nil).
func (*Client) GetERC721Transfers ¶
func (*Client) GetFeePerByte ¶
func (*Client) GetNativeContractHash ¶
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 ¶
GetNetwork returns the network magic of the RPC node client connected to.
func (*Client) GetNextBlockValidators ¶
func (*Client) GetNextValidators ¶
func (c *Client) GetNextValidators() (keys.PublicKeys, error)
func (*Client) GetPeers ¶
GetPeers returns the list of nodes that the node is currently connected/disconnected from.
func (*Client) GetRawMemPool ¶
GetRawMemPool returns the list of unconfirmed transactions in memory.
func (*Client) GetRawTransaction ¶
func (c *Client) GetRawTransaction(hash common.Hash) (*transaction.Transaction, error)
GetRawTransaction returns a transaction by hash.
func (*Client) GetRawTransactionVerbose ¶
GetRawTransactionVerbose returns a transaction wrapper with additional metadata by transaction's hash. NOTE: to get transaction.ID and transaction.Size, use t.Hash() and io.GetVarSize(t) respectively.
func (*Client) GetState ¶
func (c *Client) GetState(stateroot common.Hash, historicalContractHash common.Address, historicalKey []byte) ([]byte, error)
GetState returns historical contract storage item state by the given stateroot, historical contract hash and historical item key.
func (*Client) GetStateHeight ¶
func (c *Client) GetStateHeight() (*result.StateHeight, error)
GetStateHeight returns current validated and local node state height.
func (*Client) GetStateRootByBlockHash ¶
GetStateRootByBlockHash returns state root for block with specified hash.
func (*Client) GetStateRootByHeight ¶
GetStateRootByHeight returns state root for the specified height.
func (*Client) GetStorageByHash ¶
GetStorageByHash returns the stored value, according to the contract script hash and the stored key.
func (*Client) GetStorageByID ¶
GetStorageByID returns the stored value, according to the contract ID and the stored key.
func (*Client) GetTransactionHeight ¶
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) GetValidators ¶
func (c *Client) GetValidators(index uint32) (keys.PublicKeys, error)
func (*Client) GetVersion ¶
GetVersion returns the version information about the queried node.
func (*Client) Net_Listening ¶
func (*Client) Net_PeerCount ¶
func (*Client) Net_Version ¶
func (*Client) Ping ¶
Ping attempts to create a connection to the endpoint. and returns an error if there is one.
func (*Client) SendRawTransaction ¶
func (*Client) SignAndPushTx ¶
func (c *Client) SignAndPushTx(tx *transaction.Transaction, acc *wallet.Account) (common.Hash, error)
SignAndPushTx signs given transaction using given wif and cosigners and pushes it to the chain. It returns a hash of the transaction and an error. If one of the cosigners accounts is neither contract-based nor unlocked an error is returned.
func (*Client) ValidateAddress ¶
func (*Client) Web3_ClientVersion ¶
type Notification ¶
Notification represents server-generated notification for client subscriptions. Value can be one of block.Block, state.AppExecResult, subscriptions.NotificationEvent transaction.Transaction or subscriptions.NotaryRequestEvent 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 // Limit total number of connections per host. No limit by default. MaxConnsPerHost int }
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 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). WSClient is thread-safe and can be used from multiple goroutines to perform RPC requests.
func NewWS ¶
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 *common.Address, 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 ¶
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 ¶
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 ¶
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 ¶
Unsubscribe removes subscription for given event stream.
func (*WSClient) UnsubscribeAll ¶
UnsubscribeAll removes all active subscriptions of current client.