client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observability

type Observability interface {
	TracerProvider() trace.TracerProvider
}

type TokenBackend

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

func New

func New(abAddr url.URL, observe Observability) *TokenBackend

New creates REST API client for token wallet backend. The "abAddr" is address of the backend, Scheme and Host fields must be assigned.

func (*TokenBackend) GetFeeCreditBill

func (tb *TokenBackend) GetFeeCreditBill(ctx context.Context, unitID types.UnitID) (*sdk.Bill, error)

func (*TokenBackend) GetInfo

func (tb *TokenBackend) GetInfo(ctx context.Context) (*sdk.InfoResponse, error)

func (*TokenBackend) GetRoundNumber

func (tb *TokenBackend) GetRoundNumber(ctx context.Context) (*sdk.RoundNumber, error)

func (*TokenBackend) GetToken

func (tb *TokenBackend) GetToken(ctx context.Context, id backend.TokenID) (*backend.TokenUnit, error)

func (*TokenBackend) GetTokenTypes

func (tb *TokenBackend) GetTokenTypes(ctx context.Context, kind backend.Kind, creator sdk.PubKey, offset string, limit int) ([]*backend.TokenUnitType, string, error)

GetTokenTypes returns token types of particular kind (may be Any, ie all kinds), the optional "creator" parameter allows to further filter the types by it's creator public key. The "offsetKey" and "limit" parameters are for batched / paginated query support.

Returns:

  • token types matching the query;
  • offset for the next batch (if empty then there is no more data to query);
  • non-nil error when something failed;

func (*TokenBackend) GetTokens

func (tb *TokenBackend) GetTokens(ctx context.Context, kind backend.Kind, owner sdk.PubKey, offset string, limit int) ([]*backend.TokenUnit, string, error)

GetTokens returns tokens owned by "owner" and matching "kind" (may be Any, ie all kinds). For batched querying "offsetKey" must be set to the value returned by previous batch, empty string means "start from the beginning of the dataset". The "limit" parameter allows to set the max batch size (but smaller result set might be returned even when there is more data in the backend ie the "offsetKey" returned is not empty).

Returns:

  • tokens matching the query;
  • offset for the next batch (if empty then there is no more data to query);
  • non-nil error when something failed;

func (*TokenBackend) GetTxProof

func (tb *TokenBackend) GetTxProof(ctx context.Context, unitID types.UnitID, txHash sdk.TxHash) (*sdk.Proof, error)

func (*TokenBackend) GetTypeHierarchy

func (tb *TokenBackend) GetTypeHierarchy(ctx context.Context, id backend.TokenTypeID) ([]*backend.TokenUnitType, error)

func (*TokenBackend) PostTransactions

func (tb *TokenBackend) PostTransactions(ctx context.Context, pubKey sdk.PubKey, txs *sdk.Transactions) error

Jump to

Keyboard shortcuts

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