wallet

package
v0.2.22-beta.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 6 Imported by: 4

Documentation

Overview

nolint

nolint

Index

Constants

View Source
const (
	// BaseGas is a cost of Parse and Verify methods.
	BaseGas = 100
	// FixedGasSpawn is consumed from principal in case of successful spawn.
	FixedGasSpawn = 100
	// FixedGasSpend is consumed from principal in case of successful spend.
	FixedGasSpend = 100
)

Variables

View Source
var (

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

Functions

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) 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) 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