avmwallet

package
v0.0.0-...-538a9bf Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UTXOSet

type UTXOSet struct {

	// List of UTXOs in this set
	// This can be used to iterate over. It should not be modified externally.
	UTXOs []*djtx.UTXO
	// contains filtered or unexported fields
}

func (*UTXOSet) Get

func (us *UTXOSet) Get(id ids.ID) *djtx.UTXO

func (*UTXOSet) PrefixedString

func (us *UTXOSet) PrefixedString(prefix string) string

PrefixedString returns a string with each new line prefixed with [prefix]

func (*UTXOSet) Put

func (us *UTXOSet) Put(utxo *djtx.UTXO)

func (*UTXOSet) Remove

func (us *UTXOSet) Remove(id ids.ID) *djtx.UTXO

func (*UTXOSet) String

func (us *UTXOSet) String() string

type Wallet

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

Wallet is a holder for keys and UTXOs for the Avalanche DAG.

func NewWallet

func NewWallet(log logging.Logger, networkID uint32, chainID ids.ID, txFee uint64) (*Wallet, error)

NewWallet returns a new Wallet

func (*Wallet) AddUTXO

func (w *Wallet) AddUTXO(utxo *djtx.UTXO)

AddUTXO adds a new UTXO to this wallet if this wallet may spend it The UTXO's output must be an OutputPayment

func (*Wallet) Balance

func (w *Wallet) Balance(assetID ids.ID) uint64

Balance returns the amount of the assets in this wallet

func (*Wallet) Codec

func (w *Wallet) Codec() codec.Manager

Codec returns the codec used for serialization

func (*Wallet) CreateAddress

func (w *Wallet) CreateAddress() (ids.ShortID, error)

CreateAddress returns a new address. It also saves the address and the private key that controls it so the address can be used later

func (*Wallet) CreateTx

func (w *Wallet) CreateTx(assetID ids.ID, amount uint64, destAddr ids.ShortID) (*avm.Tx, error)

CreateTx returns a tx that sends [amount] of [assetID] to [destAddr]

func (*Wallet) GenerateTxs

func (w *Wallet) GenerateTxs(numTxs int, assetID ids.ID) error

GenerateTxs generates the transactions that will be sent during the test Generate them all on test initialization so tx generation is not bottleneck in testing

func (*Wallet) GetAddress

func (w *Wallet) GetAddress() (ids.ShortID, error)

GetAddress returns one of the addresses this wallet manages. If no address exists, one will be created.

func (*Wallet) ImportKey

func (w *Wallet) ImportKey(sk *crypto.PrivateKeySECP256K1R)

ImportKey imports a private key into this wallet

func (*Wallet) NextTx

func (w *Wallet) NextTx() *avm.Tx

NextTx returns the next tx to be sent as part of xput test

func (*Wallet) RemoveUTXO

func (w *Wallet) RemoveUTXO(utxoID ids.ID)

RemoveUTXO from this wallet

func (*Wallet) String

func (w *Wallet) String() string

Jump to

Keyboard shortcuts

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