Documentation

Index

Constants

const GenesisHeight = int64(1)

GenesisHeight is the height of the genesis block.


const GrpcAddrEnvVar = "OASIS_NODE_GRPC_ADDR"

GrpcAddrEnvVar is the name of the environment variable that specifies the gRPC host address of the Oasis node that the client should connect to.


const LatestHeight = consensus.HeightLatest

LatestHeight can be used as the height in queries to specify the latest height.


Variables

This section is empty.

Functions

This section is empty.

Types

type OasisBlock

type OasisBlock struct {
	Height       int64  // Block height.
	Hash         string // Block hash.
	Timestamp    int64  // UNIX time, converted to milliseconds.
	ParentHeight int64  // Height of parent block.
	ParentHash   string // Hash of parent block.
}

OasisBlock is a representation of the Oasis block metadata, converted to be more compatible with the Rosetta API.

type OasisClient

type OasisClient interface {
	// GetChainID returns the network chain context, derived from the
	// genesis document.
	GetChainID(ctx context.Context) (string, error)

	// GetBlock returns the Oasis block at given height.
	GetBlock(ctx context.Context, height int64) (*OasisBlock, error)

	// GetLatestBlock returns latest Oasis block.
	GetLatestBlock(ctx context.Context) (*OasisBlock, error)

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

	// GetAccount returns the Oasis staking account for given owner
	// at given height.
	GetAccount(ctx context.Context, height int64, owner signature.PublicKey) (*staking.Account, error)

	// GetStakingEvents returns Oasis staking events at given height.
	GetStakingEvents(ctx context.Context, height int64) ([]staking.Event, error)

	// SubmitTx submits the given JSON-encoded transaction to the node.
	SubmitTx(ctx context.Context, txRaw string) error

	// GetNextNonce returns the nonce that should be used when signing the
	// next transaction for the given account ID at given height.
	GetNextNonce(ctx context.Context, id signature.PublicKey, height int64) (uint64, error)

	// GetStatus returns the status overview of the node.
	GetStatus(ctx context.Context) (*control.Status, error)
}

OasisClient can be used to query an Oasis node for information and to submit transactions.

func New

func New() (OasisClient, error)

New creates a new Oasis gRPC client.

Source Files