Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountResource ¶ added in v0.2.0
type AccountResource struct { AuthKey []byte Balance uint64 ReceivedEvents uint64 SentEvents uint64 SequenceNo uint64 }
AccountResource represents an account with its balance etc.
func FromAccountResourceBlob ¶ added in v0.2.0
func FromAccountResourceBlob(accountResourceBlob []byte) (AccountResource, error)
FromAccountResourceBlob converts an account resource blob into an object of the AccountState struct.
func (AccountResource) String ¶ added in v0.2.0
func (ar AccountResource) String() string
String formats the account state similarly to the Libra CLI. Numbers are formatted as string because the numbers are uint64, whose max value exceeds JSON's "safe integer", which can lead to parsing errors.
Info about JSON's "safe integer": https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
type AccountState ¶ added in v0.2.0
type AccountState struct { // The whole account state as raw bytes Blob []byte // The account resource with balance etc. AccountResource AccountResource }
AccountState represents the state of an account.
func FromAccountStateBlob ¶ added in v0.2.0
func FromAccountStateBlob(accountStateBlob []byte) (AccountState, error)
FromAccountStateBlob converts an account state blob into an object of the AccountState struct.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a libra client that's connected to a validator node via gRPC. It allows you to query the account state, send transactions etc.
func NewClient ¶
NewClient creates a new Libra client. It connects to the given validator node via gRPC. The connection is kept open until Close() is called on the client.
func (Client) GetAccountState ¶
func (c Client) GetAccountState(accountAddr string) (AccountState, error)
GetAccountState requests the state of the given account.
func (Client) SendTx ¶
func (c Client) SendTx(tx Transaction) error
SendTx sends a transaction to the connected validator node.
type Transaction ¶
Transaction is a transaction of Libra Coins.