v0

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputePrincipal

func ComputePrincipal(template core.Address, args scale.Encodable) address.Address

ComputePrincipal address as the last 20 bytes from blake3(scale(template || args)).

func ParseTransaction

func ParseTransaction(rawTx *bytes.Buffer, method uint8, template *core.Address) (*transaction.TransactionData, error)

ParseTransaction parses a transaction encoded in version 0. possible two types of transaction: 1. spawn transaction - `&sdk.TxVersion, &principal, &sdk.MethodSpawn, &wallet.TemplateAddress, &wallet.SpawnPayload` 2. spend transaction - `&sdk.TxVersion, &principal, &sdk.MethodSpend, &wallet.SpendPayload. every transaction can be multisig also.

Types

type DrainVaultArguments added in v1.7.2

type DrainVaultArguments struct {
	Vault core.Address
	SpendArguments
}

DrainVaultArguments is the arguments of the drain vault transaction.

func (*DrainVaultArguments) DecodeScale added in v1.7.2

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

func (*DrainVaultArguments) EncodeScale added in v1.7.2

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

type DrainVaultPayload added in v1.7.2

type DrainVaultPayload struct {
	Nonce     core.Nonce
	GasPrice  uint64
	Arguments DrainVaultArguments
}

DrainVaultPayload provides arguments for drain vault transaction.

func (*DrainVaultPayload) DecodeScale added in v1.7.2

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

func (*DrainVaultPayload) EncodeScale added in v1.7.2

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

type DrainVaultTransaction added in v1.7.2

type DrainVaultTransaction struct {
	Type      uint8
	Principal address.Address
	Method    uint8
	Payload   DrainVaultPayload
}

DrainVaultTransaction initial transaction for vault.

func (*DrainVaultTransaction) DecodeScale added in v1.7.2

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

func (*DrainVaultTransaction) EncodeScale added in v1.7.2

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

func (*DrainVaultTransaction) GetAmount added in v1.7.2

func (t *DrainVaultTransaction) GetAmount() uint64

GetAmount returns amount of the transaction. Always zero for spawn transaction.

func (*DrainVaultTransaction) GetCounter added in v1.7.2

func (t *DrainVaultTransaction) GetCounter() uint64

GetCounter returns counter of the transaction. Always zero for spawn transaction.

func (*DrainVaultTransaction) GetGasPrice added in v1.7.2

func (t *DrainVaultTransaction) GetGasPrice() uint64

GetGasPrice returns gas price of the transaction.

func (*DrainVaultTransaction) GetInitialUnlockAmount added in v1.7.2

func (t *DrainVaultTransaction) GetInitialUnlockAmount() uint64

func (*DrainVaultTransaction) GetOwner added in v1.7.2

func (t *DrainVaultTransaction) GetOwner() core.Address

func (*DrainVaultTransaction) GetPrincipal added in v1.7.2

func (t *DrainVaultTransaction) GetPrincipal() address.Address

GetPrincipal returns the principal address who pay for gas for this transaction.

func (*DrainVaultTransaction) GetPublicKeys added in v1.7.2

func (t *DrainVaultTransaction) GetPublicKeys() [][]byte

GetPublicKeys returns public keys of the transaction.

func (*DrainVaultTransaction) GetReceiver added in v1.7.2

func (t *DrainVaultTransaction) GetReceiver() address.Address

GetReceiver returns receiver address of the transaction.

func (*DrainVaultTransaction) GetTotalAmount added in v1.7.2

func (t *DrainVaultTransaction) GetTotalAmount() uint64

func (*DrainVaultTransaction) GetType added in v1.7.2

func (t *DrainVaultTransaction) GetType() uint8

GetType returns type of the transaction.

func (*DrainVaultTransaction) GetVault added in v1.7.2

func (t *DrainVaultTransaction) GetVault() core.Address

func (*DrainVaultTransaction) GetVestingEnd added in v1.7.2

func (t *DrainVaultTransaction) GetVestingEnd() core.LayerID

func (*DrainVaultTransaction) GetVestingStart added in v1.7.2

func (t *DrainVaultTransaction) GetVestingStart() core.LayerID

type PublicKey

type PublicKey [32]byte

PublicKey is a public key of the transaction.

func (*PublicKey) DecodeScale

func (h *PublicKey) DecodeScale(d *scale.Decoder) (int, error)

DecodeScale implements scale codec interface.

func (*PublicKey) EncodeScale

func (h *PublicKey) EncodeScale(e *scale.Encoder) (int, error)

EncodeScale implements scale codec interface.

type SpawnArguments

type SpawnArguments struct {
	PublicKey PublicKey
}

SpawnArguments is the arguments of the spawn transaction.

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 SpawnMultisigArguments

type SpawnMultisigArguments struct {
	Required   uint8
	PublicKeys []PublicKey `scale:"max=10"`
}

SpawnMultisigArguments arguments for multisig spawn transaction.

func (*SpawnMultisigArguments) DecodeScale

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

func (*SpawnMultisigArguments) EncodeScale

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

type SpawnMultisigPayload

type SpawnMultisigPayload struct {
	Nonce     core.Nonce
	GasPrice  uint64
	Arguments SpawnMultisigArguments
}

SpawnMultisigPayload payload of the multisig spawn transaction.

func (*SpawnMultisigPayload) DecodeScale

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

func (*SpawnMultisigPayload) EncodeScale

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

type SpawnMultisigTransaction

type SpawnMultisigTransaction struct {
	Type      uint8
	Principal address.Address
	Method    uint8
	Template  address.Address
	Payload   SpawnMultisigPayload
}

SpawnMultisigTransaction initial transaction for multisig wallet.

func (*SpawnMultisigTransaction) DecodeScale

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

func (*SpawnMultisigTransaction) EncodeScale

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

func (*SpawnMultisigTransaction) GetAmount

func (t *SpawnMultisigTransaction) GetAmount() uint64

GetAmount returns amount of the transaction. Always zero for spawn transaction.

func (*SpawnMultisigTransaction) GetCounter

func (t *SpawnMultisigTransaction) GetCounter() uint64

GetCounter returns counter of the transaction. Always zero for spawn transaction.

func (*SpawnMultisigTransaction) GetGasPrice

func (t *SpawnMultisigTransaction) GetGasPrice() uint64

GetGasPrice returns gas price of the transaction.

func (*SpawnMultisigTransaction) GetPrincipal

func (t *SpawnMultisigTransaction) GetPrincipal() address.Address

GetPrincipal returns the principal address who pay for gas for this transaction.

func (*SpawnMultisigTransaction) GetPublicKeys

func (t *SpawnMultisigTransaction) GetPublicKeys() [][]byte

GetPublicKeys returns all public keys of the multisig transaction.

func (*SpawnMultisigTransaction) GetReceiver

func (t *SpawnMultisigTransaction) GetReceiver() address.Address

GetReceiver returns receiver address of the transaction.

func (*SpawnMultisigTransaction) GetType

func (t *SpawnMultisigTransaction) GetType() uint8

GetType returns type of the transaction.

type SpawnPayload

type SpawnPayload struct {
	Nonce     core.Nonce
	GasPrice  uint64
	Arguments SpawnArguments
}

SpawnPayload provides arguments for spawn transaction.

func (*SpawnPayload) DecodeScale

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

func (*SpawnPayload) EncodeScale

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

type SpawnTransaction

type SpawnTransaction struct {
	Type      uint8
	Principal address.Address
	Method    uint8
	Template  address.Address
	Payload   SpawnPayload
}

SpawnTransaction initial transaction for wallet.

func (*SpawnTransaction) DecodeScale

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

func (*SpawnTransaction) EncodeScale

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

func (*SpawnTransaction) GetAmount

func (t *SpawnTransaction) GetAmount() uint64

GetAmount returns amount of the transaction. Always zero for spawn transaction.

func (*SpawnTransaction) GetCounter

func (t *SpawnTransaction) GetCounter() uint64

GetCounter returns counter of the transaction. Always zero for spawn transaction.

func (*SpawnTransaction) GetGasPrice

func (t *SpawnTransaction) GetGasPrice() uint64

GetGasPrice returns gas price of the transaction.

func (*SpawnTransaction) GetPrincipal

func (t *SpawnTransaction) GetPrincipal() address.Address

GetPrincipal returns the principal address who pay for gas for this transaction.

func (*SpawnTransaction) GetPublicKeys

func (t *SpawnTransaction) GetPublicKeys() [][]byte

GetPublicKeys returns public keys of the transaction.

func (*SpawnTransaction) GetReceiver

func (t *SpawnTransaction) GetReceiver() address.Address

GetReceiver returns receiver address of the transaction.

func (*SpawnTransaction) GetType

func (t *SpawnTransaction) GetType() uint8

GetType returns type of the transaction.

type SpawnVaultArguments added in v1.7.2

type SpawnVaultArguments struct {
	Owner               core.Address
	TotalAmount         uint64
	InitialUnlockAmount uint64
	VestingStart        core.LayerID
	VestingEnd          core.LayerID
}

SpawnVaultArguments is the arguments of the spawn vault transaction.

func (*SpawnVaultArguments) DecodeScale added in v1.7.2

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

func (*SpawnVaultArguments) EncodeScale added in v1.7.2

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

type SpawnVaultPayload added in v1.7.2

type SpawnVaultPayload struct {
	Nonce     core.Nonce
	GasPrice  uint64
	Arguments SpawnVaultArguments
}

SpawnVaultPayload provides arguments for spawn vault transaction.

func (*SpawnVaultPayload) DecodeScale added in v1.7.2

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

func (*SpawnVaultPayload) EncodeScale added in v1.7.2

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

type SpawnVaultTransaction added in v1.7.2

type SpawnVaultTransaction struct {
	Type      uint8
	Principal address.Address
	Method    uint8
	Template  address.Address
	Payload   SpawnVaultPayload
}

SpawnVaultTransaction initial transaction for vault.

func (*SpawnVaultTransaction) DecodeScale added in v1.7.2

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

func (*SpawnVaultTransaction) EncodeScale added in v1.7.2

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

func (*SpawnVaultTransaction) GetAmount added in v1.7.2

func (t *SpawnVaultTransaction) GetAmount() uint64

GetAmount returns amount of the transaction. Always zero for spawn transaction.

func (*SpawnVaultTransaction) GetCounter added in v1.7.2

func (t *SpawnVaultTransaction) GetCounter() uint64

GetCounter returns counter of the transaction. Always zero for spawn transaction.

func (*SpawnVaultTransaction) GetGasPrice added in v1.7.2

func (t *SpawnVaultTransaction) GetGasPrice() uint64

GetGasPrice returns gas price of the transaction.

func (*SpawnVaultTransaction) GetInitialUnlockAmount added in v1.7.2

func (t *SpawnVaultTransaction) GetInitialUnlockAmount() uint64

func (*SpawnVaultTransaction) GetOwner added in v1.7.2

func (t *SpawnVaultTransaction) GetOwner() core.Address

func (*SpawnVaultTransaction) GetPrincipal added in v1.7.2

func (t *SpawnVaultTransaction) GetPrincipal() address.Address

GetPrincipal returns the principal address who pay for gas for this transaction.

func (*SpawnVaultTransaction) GetPublicKeys added in v1.7.2

func (t *SpawnVaultTransaction) GetPublicKeys() [][]byte

GetPublicKeys returns public keys of the transaction.

func (*SpawnVaultTransaction) GetReceiver added in v1.7.2

func (t *SpawnVaultTransaction) GetReceiver() address.Address

GetReceiver returns receiver address of the transaction.

func (*SpawnVaultTransaction) GetTotalAmount added in v1.7.2

func (t *SpawnVaultTransaction) GetTotalAmount() uint64

func (*SpawnVaultTransaction) GetType added in v1.7.2

func (t *SpawnVaultTransaction) GetType() uint8

GetType returns type of the transaction.

func (*SpawnVaultTransaction) GetVault added in v1.7.2

func (t *SpawnVaultTransaction) GetVault() core.Address

func (*SpawnVaultTransaction) GetVestingEnd added in v1.7.2

func (t *SpawnVaultTransaction) GetVestingEnd() core.LayerID

func (*SpawnVaultTransaction) GetVestingStart added in v1.7.2

func (t *SpawnVaultTransaction) GetVestingStart() core.LayerID

type SpendArguments

type SpendArguments struct {
	Destination address.Address
	Amount      uint64
}

SpendArguments arguments of the spend transaction.

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 SpendPayload

type SpendPayload struct {
	Nonce     core.Nonce
	GasPrice  uint64
	Arguments SpendArguments
}

SpendPayload payload of the spend transaction.

func (*SpendPayload) DecodeScale

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

func (*SpendPayload) EncodeScale

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

type SpendTransaction

type SpendTransaction struct {
	Type      uint8
	Principal address.Address
	Method    uint8
	Payload   SpendPayload
}

SpendTransaction coin transfer transaction. also includes multisig.

func (*SpendTransaction) DecodeScale

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

func (*SpendTransaction) EncodeScale

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

func (*SpendTransaction) GetAmount

func (t *SpendTransaction) GetAmount() uint64

GetAmount returns the amount of the transaction.

func (*SpendTransaction) GetCounter

func (t *SpendTransaction) GetCounter() uint64

GetCounter returns the counter of the transaction.

func (*SpendTransaction) GetGasPrice

func (t *SpendTransaction) GetGasPrice() uint64

GetGasPrice returns gas price of the transaction.

func (*SpendTransaction) GetPrincipal

func (t *SpendTransaction) GetPrincipal() address.Address

GetPrincipal return address which spend gas.

func (*SpendTransaction) GetPublicKeys

func (t *SpendTransaction) GetPublicKeys() [][]byte

GetPublicKeys returns nil.

func (*SpendTransaction) GetReceiver

func (t *SpendTransaction) GetReceiver() address.Address

GetReceiver returns receiver address.

func (*SpendTransaction) GetType

func (t *SpendTransaction) GetType() uint8

GetType returns transaction type.

Jump to

Keyboard shortcuts

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