v0

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

View Source
var (
	// TemplateAddress is an address of the Wallet template.
	TemplateAddress address.Address
	// TemplateAddress1 is an address of the 1/N multisig template.
	TemplateAddress1 address.Address
	// TemplateAddress2 is an address of the 2/N multisig template.
	TemplateAddress2 address.Address
	// TemplateAddress3 is an address of the 3/N multisig template.
	TemplateAddress3 address.Address
)

Functions

func ComputePrincipal

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

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

func ParseTransaction

func ParseTransaction(rawTx []byte, method uint32) (transaction.DecodedTransactioner, 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 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 Signature

type Signature [64]byte

Signature returns the signature of the transaction.

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 {
	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 {
	Arguments SpawnMultisigArguments
	GasPrice  uint64
}

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
	Sign      Signature
}

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

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

GetSignature returns the signature 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
	Sign      Signature
}

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

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

GetSignature returns signature of the transaction.

func (*SpawnTransaction) GetType

func (t *SpawnTransaction) GetType() uint8

GetType returns type of the transaction.

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
	Sign      Signature
}

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

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

GetSignature returns signature.

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