oasis_client

package
v0.0.0-...-3ec5011 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const GenesisHeight = int64(1)

GenesisHeight is the height of the genesis block.

View Source
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.

View Source
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.

Jump to

Keyboard shortcuts

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