accounts

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 15

Documentation

Index

Constants

View Source
const (
	// TransferEventCode is the event code for the transfer event.
	TransferEventCode = 1
	// BurnEventCode is the event code for the burn event.
	BurnEventCode = 2
	// MintEventCode is the event code for the mint event.
	MintEventCode = 3
)
View Source
const ModuleName = "accounts"

ModuleName is the accounts module name.

Variables

View Source
var (
	// CommonPoolAddress is the address of the internal common pool account in the accounts module.
	CommonPoolAddress = types.NewAddressForModule(ModuleName, []byte("common-pool"))
	// FeeAccumulatorAddress is the address of the internal fee accumulator account in the accounts module.
	FeeAccumulatorAddress = types.NewAddressForModule(ModuleName, []byte("fee-accumulator"))
)

Functions

func DecodeEvent added in v0.2.0

func DecodeEvent(event *types.Event) ([]client.DecodedEvent, error)

DecodeEvent decodes an accounts event.

func NewTransferTx

func NewTransferTx(fee *types.Fee, body *Transfer) *types.Transaction

NewTransferTx generates a new accounts.Transfer transaction.

Types

type AccountBalances

type AccountBalances struct {
	Balances map[types.Denomination]types.Quantity `json:"balances"`
}

AccountBalances are the balances in an account.

type Addresses added in v0.2.0

type Addresses []types.Address

Addresses is the response of the accounts.Addresses query.

type AddressesQuery added in v0.2.0

type AddressesQuery struct {
	Denomination types.Denomination `json:"denomination"`
}

AddressesQuery are the arguments for the accounts.Addresses query.

type BalancesQuery

type BalancesQuery struct {
	Address types.Address `json:"address"`
}

BalancesQuery are the arguments for the accounts.Balances query.

type BurnEvent added in v0.2.0

type BurnEvent struct {
	Owner  types.Address   `json:"owner"`
	Amount types.BaseUnits `json:"amount"`
}

BurnEvent is the burn event.

type DenominationInfo added in v0.2.0

type DenominationInfo struct {
	// Decimals is the number of decimals that the denomination is using.
	Decimals uint8 `json:"decimals"`
}

DenominationInfo represents information about a denomination.

type DenominationInfoQuery added in v0.2.0

type DenominationInfoQuery struct {
	Denomination types.Denomination `json:"denomination"`
}

DenominationInfoQuery are the arguments for the accounts.DenominationInfo query.

type Event added in v0.2.0

type Event struct {
	Transfer *TransferEvent
	Burn     *BurnEvent
	Mint     *MintEvent
}

Event is an account event.

type GasCosts added in v0.2.0

type GasCosts struct {
	TxTransfer uint64 `json:"tx_transfer"`
}

GasCosts are the accounts module gas costs.

type MintEvent added in v0.2.0

type MintEvent struct {
	Owner  types.Address   `json:"owner"`
	Amount types.BaseUnits `json:"amount"`
}

MintEvent is the mint event.

type NonceQuery

type NonceQuery struct {
	Address types.Address `json:"address"`
}

NonceQuery are the arguments for the accounts.Nonce query.

type Parameters added in v0.2.0

type Parameters struct {
	TransfersDisabled      bool                                    `json:"transfers_disabled"`
	GasCosts               GasCosts                                `json:"gas_costs"`
	DebugDisableNonceCheck bool                                    `json:"debug_disable_nonce_check,omitempty"`
	DenominationInfos      map[types.Denomination]DenominationInfo `json:"denomination_infos,omitempty"`
}

Parameters are the parameters for the accounts module.

type Transfer

type Transfer struct {
	To     types.Address   `json:"to"`
	Amount types.BaseUnits `json:"amount"`
}

Transfer is the body for the accounts.Transfer call.

func (*Transfer) PrettyPrint added in v0.4.0

func (f *Transfer) PrettyPrint(ctx context.Context, prefix string, w io.Writer)

PrettyPrint writes a pretty-printed representation of the transaction to the given writer.

func (*Transfer) PrettyType added in v0.4.0

func (f *Transfer) PrettyType() (interface{}, error)

PrettyType returns a representation of the type that can be used for pretty printing.

type TransferEvent added in v0.2.0

type TransferEvent struct {
	From   types.Address   `json:"from"`
	To     types.Address   `json:"to"`
	Amount types.BaseUnits `json:"amount"`
}

TransferEvent is the transfer event.

type V1

type V1 interface {
	client.EventDecoder

	// Transfer generates an accounts.Transfer transaction.
	Transfer(to types.Address, amount types.BaseUnits) *client.TransactionBuilder

	// Parameters queries the accounts module parameters.
	Parameters(ctx context.Context, round uint64) (*Parameters, error)

	// Nonce queries the given account's nonce.
	Nonce(ctx context.Context, round uint64, address types.Address) (uint64, error)

	// Balances queries the given account's balances.
	Balances(ctx context.Context, round uint64, address types.Address) (*AccountBalances, error)

	// Addresses queries all account addresses.
	Addresses(ctx context.Context, round uint64, denomination types.Denomination) (Addresses, error)

	// DenominationInfo queries the information about a given denomination.
	DenominationInfo(ctx context.Context, round uint64, denomination types.Denomination) (*DenominationInfo, error)

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

V1 is the v1 accounts module interface.

func NewV1

func NewV1(rc client.RuntimeClient) V1

NewV1 generates a V1 client helper for the accounts module.

Jump to

Keyboard shortcuts

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