Documentation
¶
Index ¶
- func SerializeBatches(batches []*Batch) []byte
- func SerializeTransactions(transactions []*Transaction) []byte
- type Batch
- type Client
- func (c *Client) CreateContractAccount(priv []byte, init []byte, perms *EvmPermissions, nonce uint64, gas uint64, ...) (*ClientResult, error)
- func (c *Client) CreateExternalAccount(priv, moderator []byte, perms *EvmPermissions, nonce uint64, wait int) (*ClientResult, error)
- func (c *Client) Get(address []byte) (*EvmEntry, error)
- func (c *Client) GetEvents(txnID string) (*ClientResult, error)
- func (c *Client) GetSethReceipt(txnID string) (*ClientResult, error)
- func (c *Client) LookupAccountNonce(priv []byte) (uint64, error)
- func (c *Client) MessageCall(priv, to, data []byte, nonce uint64, gas uint64, wait int, ...) (*ClientResult, error)
- func (c *Client) SetPermissions(priv, to []byte, permissions *EvmPermissions, nonce uint64, wait int) error
- type ClientResult
- type Encoder
- type ErrorBody
- type Event
- type ReceiptRespBody
- type RespBody
- type Transaction
- type TransactionParams
- type TransactionReceipt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeBatches ¶
SerializeBatches serializes the given batches to bytes in the form expected by the REST API.
func SerializeTransactions ¶
func SerializeTransactions(transactions []*Transaction) []byte
SerializeTransactions serializes the given transactions to bytes for transmission to a separate batcher.
Types ¶
type Batch ¶
func ParseBatches ¶
ParseBatches deserializes the given bytes into a list of batches. The bytes are assumed to be in the format returned by SerializeBatches.
type Client ¶
type Client struct {
Url string
}
func (*Client) CreateContractAccount ¶
func (c *Client) CreateContractAccount( priv []byte, init []byte, perms *EvmPermissions, nonce uint64, gas uint64, wait int) (*ClientResult, error)
CreateContractAccount creates a new contract associated with the account associated with the given private key. The account is initialized with the data in init. If permissions are passed, the account is created with those permissions.
Returns the address of the new account, transaction ID, and receipt.
func (*Client) CreateExternalAccount ¶
func (c *Client) CreateExternalAccount( priv, moderator []byte, perms *EvmPermissions, nonce uint64, wait int) (*ClientResult, error)
CreateExternalAccount submits a transaction to create the account with the given private key. If moderator is not nil, the account associated with that key will be used to create the new account. If perms is not nil, the new account is created with the given permissions.
Returns the address of the new account, transaction ID, and receipt.
func (*Client) Get ¶
Get retrieves all data in state associated with the given address. If there isn't anything at the address, returns nil.
func (*Client) GetSethReceipt ¶
func (c *Client) GetSethReceipt(txnID string) (*ClientResult, error)
func (*Client) LookupAccountNonce ¶
func (*Client) MessageCall ¶
func (c *Client) MessageCall( priv, to, data []byte, nonce uint64, gas uint64, wait int, chaining_enabled bool) (*ClientResult, error)
MessageCall sends a message call from the account associated with the given private key to the account at the address to. data is used as the input to the contract call.
Returns the output from the EVM call.
type ClientResult ¶
type ClientResult struct { TransactionID string `json:",omitempty"` Address []byte `json:",omitempty"` GasUsed uint64 `json:",omitempty"` ReturnValue []byte `json:",omitempty"` Events []Event `json:",omitempty"` }
func (*ClientResult) MarshalJSON ¶
func (r *ClientResult) MarshalJSON() ([]byte, error)
Allows address bytes to be encoded to hex for CLI output
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func NewEncoder(private_key []byte, defaults TransactionParams) *Encoder
NewTransactionEncoder constructs a new encoder which can be used to generate transactions and batches, and to serialize batches for submitting to the REST API.
func (*Encoder) NewBatch ¶
func (self *Encoder) NewBatch(transactions []*Transaction) *Batch
NewBatch creates a new batch from the given transactions created by NewTransaction. It handles the construction and signing of the batch header.
func (*Encoder) NewTransaction ¶
func (self *Encoder) NewTransaction(payload []byte, p TransactionParams) *Transaction
NewTransaction Creates a new transaction and handles the construction and signing of the transaction header.
type ReceiptRespBody ¶
type ReceiptRespBody struct { Data []TransactionReceipt Link string Head string Error ErrorBody }
func ParseReceiptBody ¶
func ParseReceiptBody(resp *http.Response) (*ReceiptRespBody, error)
func ParseReceiptBodyData ¶
func ParseReceiptBodyData(buf []byte) (*ReceiptRespBody, error)
type RespBody ¶
func ParseBodyData ¶
type Transaction ¶
type Transaction transaction_pb2.Transaction
Wrap the protobuf types so that they do not need to be imported separately.
func ParseTransactions ¶
func ParseTransactions(b []byte) ([]*Transaction, error)
ParseTransactions deserializes the given bytes into a list of transactions. The bytes are assumed to be in the format returned by SerializeTransactions.
func (*Transaction) Id ¶
func (t *Transaction) Id() string
GetId Returns the Transaction ID which can be used to specify this transaction as a dependency for other transactions.
func (*Transaction) ToPb ¶
func (t *Transaction) ToPb() *transaction_pb2.Transaction