Documentation
¶
Overview ¶
Provides Diem JSON-RPC API client, see https://github.com/diem/diem/blob/master/json-rpc/json-rpc-spec.md for more details.
Index ¶
- Constants
- type Account
- type AccountRole
- type AccountStateProof
- type AccountStateWithProof
- type Amount
- type Client
- type CurrencyInfo
- type Event
- type EventData
- type InvalidTransactionError
- type LedgerState
- type Metadata
- type Script
- type StaleResponseError
- type StateProof
- type Transaction
- type TransactionData
- type VmStatus
Constants ¶
const ( GetCurrencies jsonrpc.Method = "get_currencies" GetMetadata jsonrpc.Method = "get_metadata" GetAccount jsonrpc.Method = "get_account" GetAccountTransaction jsonrpc.Method = "get_account_transaction" GetAccountTransactions jsonrpc.Method = "get_account_transactions" GetTransactions jsonrpc.Method = "get_transactions" GetEvents jsonrpc.Method = "get_events" Submit jsonrpc.Method = "submit" VmStatusExecuted = "executed" )
List of supported methods
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountRole ¶
type AccountRole = diemjsonrpctypes.AccountRole
AccountRole represents role specific data for account
type AccountStateProof ¶
type AccountStateProof = diemjsonrpctypes.AccountStateProof
AccountStateProof represents account state blob proof
type AccountStateWithProof ¶
type AccountStateWithProof = diemjsonrpctypes.AccountStateWithProof
AccountStateWithProof is get_account_state_with_proof response
type Client ¶
type Client interface { GetCurrencies() ([]*CurrencyInfo, error) GetMetadata() (*Metadata, error) GetMetadataByVersion(uint64) (*Metadata, error) GetAccount(diemtypes.AccountAddress) (*Account, error) GetAccountTransaction(diemtypes.AccountAddress, uint64, bool) (*Transaction, error) GetAccountTransactions(diemtypes.AccountAddress, uint64, uint64, bool) ([]*Transaction, error) GetTransactions(uint64, uint64, bool) ([]*Transaction, error) GetEvents(string, uint64, uint64) ([]*Event, error) Submit(signedTxnHex string) error SubmitTransaction(txn *diemtypes.SignedTransaction) error WaitForTransaction( address diemtypes.AccountAddress, seq uint64, hash string, expirationTimeSec uint64, timeout time.Duration, ) (*Transaction, error) WaitForTransaction2( txn *diemtypes.SignedTransaction, timeout time.Duration, ) (*Transaction, error) WaitForTransaction3( signedTxnHex string, timeout time.Duration, ) (*Transaction, error) LastResponseLedgerState() LedgerState UpdateLastResponseLedgerState(state LedgerState) error WithRetryOptions(opts ...retry.Option) Client }
Client is Diem client implements high level APIs
func New ¶
New creates a `DiemClient` connect to given server URL. It creates default jsonrpc client `http.Transport` config, if you need to customize `http.Transport` config (for better connection pool production usage), call `NewWithJsonRpcClient` with `jsonrpc.NewClientWithTransport(url, <your http.Transport>)`
type CurrencyInfo ¶
type CurrencyInfo = diemjsonrpctypes.CurrencyInfo
CurrencyInfo is get_currencies response
type InvalidTransactionError ¶
type InvalidTransactionError struct { Transaction Transaction Msg string }
InvalidTransactionError is error for get a transaction with unexpected details (e.g. vm status is failure)
func (*InvalidTransactionError) Error ¶
func (e *InvalidTransactionError) Error() string
Error implements error interface
type LedgerState ¶
LedgerState represents response DiemLedgerTimestampusec & DiemLedgerVersion
type Script ¶
type Script = diemjsonrpctypes.Script
Script represents decoded transaction script arguments
type StaleResponseError ¶
type StaleResponseError struct { Client LedgerState Server LedgerState }
StaleResponseError is error for the case server response latest ledger state is older than client knows
func (*StaleResponseError) Error ¶
func (e *StaleResponseError) Error() string
Error implements error interface
type StateProof ¶
type StateProof = diemjsonrpctypes.StateProof
StateProof is get_state_proof response
type Transaction ¶
type Transaction = diemjsonrpctypes.Transaction
Transaction represents executed / failed transaction
type TransactionData ¶
type TransactionData = diemjsonrpctypes.TransactionData
TransactionData include specific type transaction details
type VmStatus ¶
type VmStatus = diemjsonrpctypes.VMStatus
VmStatus represents transaction execution result and error info
Directories
¶
Path | Synopsis |
---|---|
Provides builders for creating JSON-RPC response result in test.
|
Provides builders for creating JSON-RPC response result in test. |