client

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 28

Documentation

Index

Constants

View Source
const RoundLatest = coreClient.RoundLatest

RoundLatest is a special round number always referring to the latest round.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Module string
	Code   uint32
	TxHash hash.Hash
	Value  cbor.RawMessage
}

Event is an event emitted by a runtime in the form of a runtime transaction tag.

Key and value semantics are runtime-dependent. TODO: More high-level wrapper for SDK events.

type RuntimeClient

type RuntimeClient interface {
	// GetInfo returns information about the runtime.
	GetInfo(ctx context.Context) (*types.RuntimeInfo, error)

	// SubmitTx submits a transaction to the runtime transaction scheduler and waits
	// for transaction execution results.
	SubmitTx(ctx context.Context, tx *types.UnverifiedTransaction) (cbor.RawMessage, error)

	// SubmitTxNoWait submits a transaction to the runtime transaction scheduler but does
	// not wait for transaction execution.
	SubmitTxNoWait(ctx context.Context, tx *types.UnverifiedTransaction) error

	// GetGenesisBlock returns the genesis block.
	GetGenesisBlock(ctx context.Context) (*block.Block, error)

	// GetBlock fetches the given runtime block.
	GetBlock(ctx context.Context, round uint64) (*block.Block, error)

	// GetTransactions returns all transactions that are part of a given block.
	GetTransactions(ctx context.Context, round uint64) ([]*types.UnverifiedTransaction, error)

	// GetEvents returns all events emitted in a given block.
	GetEvents(ctx context.Context, round uint64) ([]*coreClient.Event, error)

	// WatchBlocks subscribes to blocks for a specific runtimes.
	WatchBlocks(ctx context.Context) (<-chan *roothash.AnnotatedBlock, pubsub.ClosableSubscription, error)

	// Query makes a runtime-specific query.
	Query(ctx context.Context, round uint64, method string, args, rsp interface{}) error
}

RuntimeClient is a client interface for runtimes based on the Oasis Runtime SDK.

func New

func New(conn *grpc.ClientConn, runtimeID common.Namespace) RuntimeClient

New creates a new runtime client for the specified runtime.

type TransactionBuilder

type TransactionBuilder struct {
	// contains filtered or unexported fields
}

TransactionBuilder is a helper for building and submitting transactions.

func NewTransactionBuilder

func NewTransactionBuilder(rc RuntimeClient, method string, body interface{}) *TransactionBuilder

NewTransactionBuilder creates a new transaction builder.

func (*TransactionBuilder) AppendAuthMultisig

func (tb *TransactionBuilder) AppendAuthMultisig(config *types.MultisigConfig, nonce uint64) *TransactionBuilder

AppendAuthMultisig appends a new transaction signer information with a multisig address specification to the transaction.

func (*TransactionBuilder) AppendAuthSignature

func (tb *TransactionBuilder) AppendAuthSignature(pk signature.PublicKey, nonce uint64) *TransactionBuilder

AppendAuthSignature appends a new transaction signer information with a signature address specification to the transaction.

func (*TransactionBuilder) AppendSign

func (tb *TransactionBuilder) AppendSign(ctx context.Context, signer signature.Signer) error

AppendSign signs the transaction and appends the signature.

The signer must be specified in the AuthInfo.

func (*TransactionBuilder) GetTransaction

func (tb *TransactionBuilder) GetTransaction() *types.Transaction

GetTransaction returns the underlying unsigned transaction.

func (*TransactionBuilder) SetFeeAmount

func (tb *TransactionBuilder) SetFeeAmount(amount types.BaseUnits) *TransactionBuilder

SetFeeAmount configures the fee amount to be paid by the caller.

func (*TransactionBuilder) SetFeeGas

func (tb *TransactionBuilder) SetFeeGas(gas uint64) *TransactionBuilder

SetFeeGas configures the maximum gas amount that can be used by the transaction.

func (*TransactionBuilder) SubmitTx

func (tb *TransactionBuilder) SubmitTx(ctx context.Context, rsp interface{}) error

SubmitTx submits a transaction to the runtime transaction scheduler and waits for transaction execution results.

func (*TransactionBuilder) SubmitTxNoWait

func (tb *TransactionBuilder) SubmitTxNoWait(ctx context.Context) error

SubmitTxNoWait submits a transaction to the runtime transaction scheduler but does not wait for transaction execution.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL