- module structure
- libra
- jsonrpc: Libra JSON-RPC client
- utils:
- AccountAddressUtils: convert AccountAddress from / to hex, bytes.
- CurrenyCode: utils for creating currency TypeTag for move script.
- HashUtils: utils for creating hash from RawTransaction, SignedTransaction.
- Hex: utils for converting bytes to / from hex-encoded string.
- TransactionUtils: util functions for generated transaction data object.
- TransactionMetadata: utils for creating peer to peer transaction metadata. (LIP-4)
- AccountIdentifier: encoding & decoding Libra Account Identifier. (LIP-5)
- IntentIdentifier: encoding & decoding Libra Intent Identifier. (LIP-5)
- Testnet: testnet utils, should include FaucetService for handling testnet mint.
- stdlib: generated code, move stdlib script encoder & decoder.
- types: generated code, Libra on-chain data structure types.
- jsonrpctypes: JSON-RPC response data types.
- libra
- JSON-RPC client error handling should distinguish the following 3 type errors:
- Transport layer error, e.g. HTTP call failure.
- JSON-RPC protocol error: e.g. server responds to non json data, or can't be parsed into Libra JSON-RPC SPEC defined data structure, or missing result & error field.
- JSON-RPC error: error returned from server.
- https
- Handle stale responses:
- client tracks latest server response block version and timestamp, raise error when received server response contains stale version / timestamp.
- parse and use libra_chain_id, libra_ledger_version and libra_ledger_tiemstamp in the JSONRPC response.
- raise StaleResponseException, so that caller can retry on the error (most of the cases we should retry).
- language specific standard release publish: java maven central repo
- Multi-network: initialize Client with chain id, JSON-RPC server URL
- Validate server chain id: client should be initialized with chain id and validate server response chain id is the same.
- Handle unsigned int64 data type properly
- Transaction hash: for a given signed transaction, produce hash of the transaction executed.
- hex-encode(sha3-256([]byte("Transaction")) + []byte {0} + signed transaction bytes)
LIP-4 support
- Non-custodial to custodial transaction
- Custodial to non-custodial transaction
- Custodial to Custodial transaction
- Refund
LIP-5 support
- Encode and decode account identifier
- Encode and decode intent identifier
- Get metadata
- Get currencies
- Get events
- Get transactions
- Get account
- Get account transaction
- Get account transactions
- Handle error response
- Serialize result JSON to typed data structure
- Submit p2p transfer transaction
- Submit other Move Stdlib scripts
- waitForTransaction(accountAddress, sequence, transcationHash, expirationTimeSec, timeout):
- for given signed transaction sender address, sequence number, expiration time (or 5 sec timeout) to wait and validate execution result is executed, otherwise return/raise an error / flag to tell it is not executed.
- when signedTransactionHash validation failed, it should return / raise TransactionSequenceNumberConflictError
- when transaction execution vm_status is not "executed", it should return / raise TransactionExecutionFailure
- when transaction expired, it should return / raise TransactionExpiredError: compare the transaction expirationTimeSec with response latest ledger timestamp. If response latest ledger timestamp >= transaction expirationTimeSec, then we are sure the transaction will never be executed successfully.
- Note: response latest ledger timestamp unit is microsecond, expirationTimeSec's unit is second.
- Generate ed25519 private key, derive ed25519 public keys from private key.
- Generate Single auth-keys
- Mint coins through Faucet service
See doc for above concepts.
- Multi-signatures support
- JSON-RPC 2.0 Client:
- spec version validation.
- Batch requests and responses handling.
- Async client
- CLI connects to testnet for trying out features.
- Client connection pool.
- Work under Android environment
- p2p transfer examples
- refund p2p transfer example
- create childVASP example
- Intent identifier encoding, decoding example