wallet

package
v1.6.3-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 7 Imported by: 6

Documentation

Overview

nolint

nolint

Index

Constants

This section is empty.

Variables

View Source
var (

	// TemplateAddress is an address of the Wallet template.
	TemplateAddress core.Address
)

Functions

func BaseGas

func BaseGas(method uint8) uint64

func ExecGas

func ExecGas(method uint8) uint64

func LoadGas

func LoadGas() uint64

func Register

func Register(registry *registry.Registry)

Register Wallet template.

Types

type SpawnArguments

type SpawnArguments struct {
	PublicKey core.PublicKey
}

SpawnArguments ...

func (*SpawnArguments) DecodeScale

func (t *SpawnArguments) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*SpawnArguments) EncodeScale

func (t *SpawnArguments) EncodeScale(enc *scale.Encoder) (total int, err error)

type SpendArguments

type SpendArguments struct {
	Destination core.Address
	Amount      uint64
}

SpendArguments ...

func (*SpendArguments) DecodeScale

func (t *SpendArguments) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*SpendArguments) EncodeScale

func (t *SpendArguments) EncodeScale(enc *scale.Encoder) (total int, err error)

type Wallet

type Wallet struct {
	PublicKey core.PublicKey
}

Wallet is a single-key wallet.

func New

func New(args *SpawnArguments) *Wallet

New returns Wallet instance with SpawnArguments.

func (*Wallet) BaseGas

func (s *Wallet) BaseGas(method uint8) uint64

func (*Wallet) DecodeScale

func (t *Wallet) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*Wallet) EncodeScale

func (t *Wallet) EncodeScale(enc *scale.Encoder) (total int, err error)

func (*Wallet) ExecGas

func (s *Wallet) ExecGas(method uint8) uint64

func (*Wallet) LoadGas

func (s *Wallet) LoadGas() uint64

func (*Wallet) MaxSpend

func (s *Wallet) MaxSpend(method uint8, args any) (uint64, error)

MaxSpend returns amount specified in the SpendArguments for Spend method.

func (*Wallet) Spend

func (s *Wallet) Spend(host core.Host, args *SpendArguments) error

Spend transfers an amount to the address specified in SpendArguments.

func (*Wallet) Verify

func (s *Wallet) Verify(host core.Host, raw []byte, dec *scale.Decoder) bool

Verify that transaction is signed by the owner of the PublicKey using ed25519.

Jump to

Keyboard shortcuts

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