Documentation ¶
Overview ¶
nolint
Index ¶
- Variables
- func ComputePrincipal(template address.Address, args scale.Encodable) address.Address
- func ParseTransaction(rawTx []byte, method uint32) (transaction.DecodedTransactioner, error)
- type Nonce
- type PublicKey
- type Signature
- type SpawnArguments
- type SpawnMultisigArguments
- type SpawnMultisigPayload
- type SpawnMultisigTransaction
- func (t *SpawnMultisigTransaction) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *SpawnMultisigTransaction) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (t *SpawnMultisigTransaction) GetAmount() uint64
- func (t *SpawnMultisigTransaction) GetCounter() uint64
- func (t *SpawnMultisigTransaction) GetGasPrice() uint64
- func (t *SpawnMultisigTransaction) GetPrincipal() address.Address
- func (t *SpawnMultisigTransaction) GetPublicKeys() [][]byte
- func (t *SpawnMultisigTransaction) GetReceiver() address.Address
- func (t *SpawnMultisigTransaction) GetSignature() []byte
- func (t *SpawnMultisigTransaction) GetType() uint8
- type SpawnPayload
- type SpawnTransaction
- func (t *SpawnTransaction) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *SpawnTransaction) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (t *SpawnTransaction) GetAmount() uint64
- func (t *SpawnTransaction) GetCounter() uint64
- func (t *SpawnTransaction) GetGasPrice() uint64
- func (t *SpawnTransaction) GetPrincipal() address.Address
- func (t *SpawnTransaction) GetPublicKeys() [][]byte
- func (t *SpawnTransaction) GetReceiver() address.Address
- func (t *SpawnTransaction) GetSignature() []byte
- func (t *SpawnTransaction) GetType() uint8
- type SpendArguments
- type SpendPayload
- type SpendTransaction
- func (t *SpendTransaction) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *SpendTransaction) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (t *SpendTransaction) GetAmount() uint64
- func (t *SpendTransaction) GetCounter() uint64
- func (t *SpendTransaction) GetGasPrice() uint64
- func (t *SpendTransaction) GetPrincipal() address.Address
- func (t *SpendTransaction) GetPublicKeys() [][]byte
- func (t *SpendTransaction) GetReceiver() address.Address
- func (t *SpendTransaction) GetSignature() []byte
- func (t *SpendTransaction) GetType() uint8
Constants ¶
This section is empty.
Variables ¶
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 ¶
ComputePrincipal address as the last 20 bytes from sha256(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 Nonce ¶
Nonce returns nonce of the transaction.
func (*Nonce) DecodeScale ¶
func (*Nonce) EncodeScale ¶
type PublicKey ¶
type PublicKey [32]byte
PublicKey is a public key of the transaction.
func (*PublicKey) DecodeScale ¶
DecodeScale implements scale codec interface.
func (*PublicKey) EncodeScale ¶
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 {
PublicKeys []PublicKey
}
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 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 ¶
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 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.