oasis

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

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 Block

type Block 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.
	Epoch        uint64 // Epoch.
}

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

type Client

type Client 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) (*Block, error)

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

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

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

	// GetDelegations returns the staking active delegations where the given
	// owner address is the delegator, as of given height.
	GetDelegations(
		ctx context.Context, height int64, owner staking.Address,
	) (map[staking.Address]*staking.Delegation, error)

	// GetDebondingDelegations returns the staking debonding delegations where
	// the given owner address is the delegator, as of given height.
	GetDebondingDelegations(
		ctx context.Context, height int64, owner staking.Address,
	) (map[staking.Address][]*staking.DebondingDelegation, error)

	// GetTransactions returns Oasis consensus transactions at given height.
	GetTransactionsWithResults(
		ctx context.Context, height int64,
	) (*consensus.TransactionsWithResults, error)

	// GetUnconfirmedTransactions returns a list of transactions currently in
	// the local node's mempool. These have not yet been included in a block.
	GetUnconfirmedTransactions(ctx context.Context) ([][]byte, error)

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

	// SubmitTxNoWait submits the given signed transaction to the node.
	SubmitTxNoWait(ctx context.Context, tx *transaction.SignedTransaction) error

	// GetNextNonce returns the nonce that should be used when signing the next
	// transaction for the given account address at given height.
	GetNextNonce(ctx context.Context, addr staking.Address, height int64) (uint64, error)

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

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

func New

func New() (Client, 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