Documentation ¶
Index ¶
- Constants
- type BoradcastTxSyncResult
- type BroadcastTxCommitResult
- type Contract
- type DAppChainRPCClient
- func (c *DAppChainRPCClient) CloseIdleConnections()
- func (c *DAppChainRPCClient) CommitCallTx(caller diadem.Address, contract diadem.Address, signer auth.Signer, ...) ([]byte, error)
- func (c *DAppChainRPCClient) CommitCallTxWithValue(caller diadem.Address, contract diadem.Address, signer auth.Signer, ...) ([]byte, error)
- func (c *DAppChainRPCClient) CommitDeployTx(from diadem.Address, signer auth.Signer, vmType vm.VMType, code []byte, ...) ([]byte, error)
- func (c *DAppChainRPCClient) CommitDeployTxWithValue(from diadem.Address, signer auth.Signer, vmType vm.VMType, code []byte, ...) ([]byte, error)
- func (c *DAppChainRPCClient) CommitMigrationTx(from diadem.Address, signer auth.Signer, id uint32, input []byte) ([]byte, error)
- func (c *DAppChainRPCClient) CommitTx(signer auth.Signer, tx proto.Message) ([]byte, error)
- func (c *DAppChainRPCClient) CommitTx2(from diadem.Address, signer auth.Signer, tx proto.Message) ([]byte, error)
- func (c *DAppChainRPCClient) GetBlockHeight() (uint64, error)
- func (c *DAppChainRPCClient) GetChainID() string
- func (c *DAppChainRPCClient) GetContractEvents(fromBlock, toBlock uint64, contractName string) (ptypes.ContractEventsResult, error)
- func (c *DAppChainRPCClient) GetContractRecord(contract diadem.Address) (ptypes.ContractRecordResponse, error)
- func (c *DAppChainRPCClient) GetEvmBlockByHash(hash []byte, full bool) (ptypes.EthBlockInfo, error)
- func (c *DAppChainRPCClient) GetEvmBlockByNumber(number string, full bool) (ptypes.EthBlockInfo, error)
- func (c *DAppChainRPCClient) GetEvmCode(contract string) ([]byte, error)
- func (c *DAppChainRPCClient) GetEvmFilterChanges(id string) ([]byte, error)
- func (c *DAppChainRPCClient) GetEvmLogs(filter string) (ptypes.EthFilterLogList, error)
- func (c *DAppChainRPCClient) GetEvmTransactionByHash(hash []byte) (ptypes.EvmTxObject, error)
- func (c *DAppChainRPCClient) GetEvmTxReceipt(txHash []byte) (ptypes.EvmTxReceipt, error)
- func (c *DAppChainRPCClient) GetNonce(signer auth.Signer) (uint64, error)
- func (c *DAppChainRPCClient) GetNonce2(caller diadem.Address, signer auth.Signer) (uint64, error)
- func (c *DAppChainRPCClient) NewBlockEvmFilter() (string, error)
- func (c *DAppChainRPCClient) NewEvmFilter(filter string) (string, error)
- func (c *DAppChainRPCClient) NewPendingTransactionEvmFilter() (string, error)
- func (c *DAppChainRPCClient) Query(caller diadem.Address, contractAddr diadem.LocalAddress, query proto.Message) ([]byte, error)
- func (c *DAppChainRPCClient) QueryEvm(caller diadem.Address, contractAddr diadem.LocalAddress, query []byte) ([]byte, error)
- func (c *DAppChainRPCClient) Resolve(name string) (diadem.Address, error)
- func (c *DAppChainRPCClient) UninstallEvmFilter(id string) (bool, error)
- type EvmContract
- type JSONRPCClient
- type RPCError
- type RPCRequest
- type RPCResponse
- type TxHandlerResult
- type TxQueryResult
Constants ¶
const ( ShortPollLimit = 10 ShortPollDelay = 1 * time.Second CodeTypeOK = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoradcastTxSyncResult ¶
type BroadcastTxCommitResult ¶
type BroadcastTxCommitResult struct { CheckTx TxHandlerResult `json:"check_tx"` DeliverTx TxHandlerResult `json:"deliver_tx"` Hash string `json:"hash"` Height string `json:"height"` }
type Contract ¶
type Contract struct { Address diadem.Address Name string // contains filtered or unexported fields }
Contract provides a thin abstraction over DAppChainClient that makes it easier to perform read & write operations on a contract running on a diadem DAppChain.
func NewContract ¶
func NewContract(client *DAppChainRPCClient, contractAddr diadem.LocalAddress) *Contract
type DAppChainRPCClient ¶
type DAppChainRPCClient struct {
// contains filtered or unexported fields
}
Implements the DAppChainClient interface
func NewDAppChainRPCClient ¶
func NewDAppChainRPCClient(chainID, writeURI, readURI string) *DAppChainRPCClient
NewDAppChainRPCClient creates a new dumb client that can be used to commit txs and query contract state via RPC. URI parameters should be specified as "tcp://<host>:<port>", writeURI the host that txs will be submitted to (port 46657 by default), readURI is the host that will be queried for current app state (47000 by default).
func NewDAppChainRPCClientShareTransport ¶
func NewDAppChainRPCClientShareTransport(chainID, writeURI, readURI string, transport *http.Transport) *DAppChainRPCClient
func (*DAppChainRPCClient) CloseIdleConnections ¶
func (c *DAppChainRPCClient) CloseIdleConnections()
func (*DAppChainRPCClient) CommitCallTx ¶
func (*DAppChainRPCClient) CommitCallTxWithValue ¶
func (*DAppChainRPCClient) CommitDeployTx ¶
func (*DAppChainRPCClient) CommitDeployTxWithValue ¶
func (*DAppChainRPCClient) CommitMigrationTx ¶
func (*DAppChainRPCClient) CommitTx ¶
CommitTx signs a tx with the given signer and sends it to the chain.
func (*DAppChainRPCClient) CommitTx2 ¶
func (c *DAppChainRPCClient) CommitTx2(from diadem.Address, signer auth.Signer, tx proto.Message) ([]byte, error)
CommitTx2 signs a tx with the given signer and sends it to the chain, the from address is used to query the chain for a tx nonce (this address may have a different chain ID to the client).
func (*DAppChainRPCClient) GetBlockHeight ¶
func (c *DAppChainRPCClient) GetBlockHeight() (uint64, error)
func (*DAppChainRPCClient) GetChainID ¶
func (c *DAppChainRPCClient) GetChainID() string
func (*DAppChainRPCClient) GetContractEvents ¶
func (c *DAppChainRPCClient) GetContractEvents(fromBlock, toBlock uint64, contractName string) (ptypes.ContractEventsResult, error)
func (*DAppChainRPCClient) GetContractRecord ¶
func (c *DAppChainRPCClient) GetContractRecord(contract diadem.Address) (ptypes.ContractRecordResponse, error)
func (*DAppChainRPCClient) GetEvmBlockByHash ¶
func (c *DAppChainRPCClient) GetEvmBlockByHash(hash []byte, full bool) (ptypes.EthBlockInfo, error)
func (*DAppChainRPCClient) GetEvmBlockByNumber ¶
func (c *DAppChainRPCClient) GetEvmBlockByNumber(number string, full bool) (ptypes.EthBlockInfo, error)
func (*DAppChainRPCClient) GetEvmCode ¶
func (c *DAppChainRPCClient) GetEvmCode(contract string) ([]byte, error)
GetCode returns the runtime byte-code of a contract running on a DAppChain's EVM. Gives an error for non-EVM contracts. contract - address of the contract in the form of a string. (Use diadem.Address.String() to convert) return []byte - runtime bytecode of the contract.
func (*DAppChainRPCClient) GetEvmFilterChanges ¶
func (c *DAppChainRPCClient) GetEvmFilterChanges(id string) ([]byte, error)
Get logs since last poll https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges could return protbuf of EthFilterLogList, EthBlockHashList or EthTxHashList
func (*DAppChainRPCClient) GetEvmLogs ¶
func (c *DAppChainRPCClient) GetEvmLogs(filter string) (ptypes.EthFilterLogList, error)
func (*DAppChainRPCClient) GetEvmTransactionByHash ¶
func (c *DAppChainRPCClient) GetEvmTransactionByHash(hash []byte) (ptypes.EvmTxObject, error)
func (*DAppChainRPCClient) GetEvmTxReceipt ¶
func (c *DAppChainRPCClient) GetEvmTxReceipt(txHash []byte) (ptypes.EvmTxReceipt, error)
func (*DAppChainRPCClient) GetNonce ¶
func (c *DAppChainRPCClient) GetNonce(signer auth.Signer) (uint64, error)
GetNonce queries the chain for the nonce of the last commited tx signed by the the given signer.
func (*DAppChainRPCClient) GetNonce2 ¶
func (c *DAppChainRPCClient) GetNonce2(caller diadem.Address, signer auth.Signer) (uint64, error)
GetNonce2 queries the chain for the nonce of the last commited tx sent by the given account.
func (*DAppChainRPCClient) NewBlockEvmFilter ¶
func (c *DAppChainRPCClient) NewBlockEvmFilter() (string, error)
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter
func (*DAppChainRPCClient) NewEvmFilter ¶
func (c *DAppChainRPCClient) NewEvmFilter(filter string) (string, error)
Sets up new filter for polling https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter
func (*DAppChainRPCClient) NewPendingTransactionEvmFilter ¶
func (c *DAppChainRPCClient) NewPendingTransactionEvmFilter() (string, error)
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter
func (*DAppChainRPCClient) Query ¶
func (c *DAppChainRPCClient) Query(caller diadem.Address, contractAddr diadem.LocalAddress, query proto.Message) ([]byte, error)
func (*DAppChainRPCClient) QueryEvm ¶
func (c *DAppChainRPCClient) QueryEvm(caller diadem.Address, contractAddr diadem.LocalAddress, query []byte) ([]byte, error)
func (*DAppChainRPCClient) Resolve ¶
func (c *DAppChainRPCClient) Resolve(name string) (diadem.Address, error)
func (*DAppChainRPCClient) UninstallEvmFilter ¶
func (c *DAppChainRPCClient) UninstallEvmFilter(id string) (bool, error)
Forget filter https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter
type EvmContract ¶
type EvmContract struct { Address diadem.Address Name string // contains filtered or unexported fields }
Contract provides a thin abstraction over DAppChainClient that makes it easier to perform read & write operations on a contract running the EVM of a diadem DAppChain.
func DeployContract ¶
func DeployContract(client *DAppChainRPCClient, byteCode []byte, signer auth.Signer, name string) (*EvmContract, []byte, error)
func NewEvmContract ¶
func NewEvmContract(client *DAppChainRPCClient, contractAddr diadem.LocalAddress) *EvmContract
func (*EvmContract) StaticCall ¶
func (c *EvmContract) StaticCall(input []byte, caller diadem.Address) ([]byte, error)
type JSONRPCClient ¶
type JSONRPCClient struct {
// contains filtered or unexported fields
}
func NewJSONRPCClient ¶
func NewJSONRPCClient(host string) *JSONRPCClient
func NewJSONRPCClientShareTransport ¶
func NewJSONRPCClientShareTransport(host string, transport *http.Transport) *JSONRPCClient
type RPCError ¶
type RPCRequest ¶
type RPCRequest struct { Version string `json:"jsonrpc"` Method string `json:"method"` Params json.RawMessage `json:"params"` // map[string]interface{} or []interface{} ID string `json:"id"` }
func NewRPCRequest ¶
func NewRPCRequest(method string, params json.RawMessage, id string) RPCRequest
type RPCResponse ¶
type RPCResponse struct { Version string `json:"jsonrpc"` ID string `json:"id"` Result json.RawMessage `json:"result,omitempty"` Error *RPCError `json:"error,omitempty"` }
type TxHandlerResult ¶
type TxQueryResult ¶
type TxQueryResult struct {
TxResult TxHandlerResult `json:"tx_result"`
}