extrinsic

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtrinsicBitSigned      = 0x80
	ExtrinsicBitUnsigned    = 0
	ExtrinsicUnmaskVersion  = 0x7f
	ExtrinsicDefaultVersion = 1
	ExtrinsicVersionUnknown = 0 // v0 is unknown
	ExtrinsicVersion1       = 1
	ExtrinsicVersion2       = 2
	ExtrinsicVersion3       = 3
	ExtrinsicVersion4       = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Extrinsic

type Extrinsic struct {
	// Version is the encoded version flag (which encodes the raw transaction version and signing information in one byte)
	Version byte
	// Signature is the ExtrinsicSignatureV4, it's presence depends on the Version flag
	Signature ExtrinsicSignatureV4
	// Method is the call this extrinsic wraps
	Method types.Call
}

Extrinsic is a piece of Args bundled into a block that expresses something from the "external" (i.e. off-chain) world. There are, broadly speaking, two types of extrinsic: transactions (which tend to be signed) and inherents (which don't).

func NewExtrinsic

func NewExtrinsic(c types.Call) Extrinsic

NewExtrinsic creates a new Extrinsic from the provided Call

func (*Extrinsic) Decode

func (e *Extrinsic) Decode(decoder scale.Decoder) error

func (Extrinsic) Encode

func (e Extrinsic) Encode(encoder scale.Encoder) error

func (Extrinsic) IsSigned

func (e Extrinsic) IsSigned() bool

IsSigned returns true if the extrinsic is signed

func (Extrinsic) MarshalJSON

func (e Extrinsic) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of Extrinsic

func (*Extrinsic) Sign

Sign adds a signature to the extrinsic

func (Extrinsic) Type

func (e Extrinsic) Type() uint8

Type returns the raw transaction version (not flagged with signing information)

func (*Extrinsic) UnmarshalJSON

func (e *Extrinsic) UnmarshalJSON(bz []byte) error

UnmarshalJSON fills Extrinsic with the JSON encoded byte array given by bz

type ExtrinsicEra

type ExtrinsicEra struct {
	IsImmortalEra bool
	// AsImmortalEra ImmortalEra
	IsMortalEra bool
	AsMortalEra MortalEra
}

ExtrinsicEra indicates either a mortal or immortal extrinsic

func (*ExtrinsicEra) Decode

func (e *ExtrinsicEra) Decode(decoder scale.Decoder) error

func (ExtrinsicEra) Encode

func (e ExtrinsicEra) Encode(encoder scale.Encoder) error

type ExtrinsicPayloadV3

type ExtrinsicPayloadV3 struct {
	Method             types.BytesBare
	Era                ExtrinsicEra   // extra via system::CheckEra
	Nonce              types.UCompact // extra via system::CheckNonce (Compact<Index> where Index is u32)
	Tip                types.UCompact // extra via balances::TakeFees (Compact<Balance> where Balance is u128)
	AppID              types.UCompact
	SpecVersion        types.U32 // additional via system::CheckVersion
	TransactionVersion types.U32
	GenesisHash        types.Hash // additional via system::CheckGenesis
	BlockHash          types.Hash // additional via system::CheckEra
}

func (*ExtrinsicPayloadV3) Decode

func (e *ExtrinsicPayloadV3) Decode(decoder scale.Decoder) error

Decode does nothing and always returns an error. ExtrinsicPayloadV3 is only used for encoding, not for decoding

func (ExtrinsicPayloadV3) Encode

func (e ExtrinsicPayloadV3) Encode(encoder scale.Encoder) error

Encode implements encoding for ExtrinsicPayloadV3, which just unwraps the bytes of ExtrinsicPayloadV3 without adding a compact length prefix

func (ExtrinsicPayloadV3) Sign

Sign the extrinsic payload with the given derivation path

type ExtrinsicPayloadV4

type ExtrinsicPayloadV4 struct {
	ExtrinsicPayloadV3
	TransactionVersion types.U32
	AppID              types.UCompact
}

func (*ExtrinsicPayloadV4) Decode

func (e *ExtrinsicPayloadV4) Decode(decoder scale.Decoder) error

Decode does nothing and always returns an error. ExtrinsicPayloadV4 is only used for encoding, not for decoding

func (ExtrinsicPayloadV4) Encode

func (e ExtrinsicPayloadV4) Encode(encoder scale.Encoder) error

func (ExtrinsicPayloadV4) Sign

Sign the extrinsic payload with the given derivation path

type ExtrinsicSignatureV4

type ExtrinsicSignatureV4 struct {
	Signer    types.MultiAddress
	Signature types.MultiSignature
	Era       ExtrinsicEra   // extra via system::CheckEra
	Nonce     types.UCompact // extra via system::CheckNonce (Compact<Index> where Index is u32))
	Tip       types.UCompact // extra via balances::TakeFees (Compact<Balance> where Balance is u128))
	AppID     types.UCompact // Avail specific AppID
}

type MortalEra

type MortalEra struct {
	First  types.U64
	Second types.U64
}

MortalEra for an extrinsic, indicating period and phase

func NewMortalEra

func NewMortalEra(currentBlock types.BlockNumber, blockHashCount types.U64) MortalEra

type SignatureOptions

type SignatureOptions struct {
	Era                ExtrinsicEra
	Nonce              types.UCompact
	Tip                types.UCompact
	SpecVersion        types.U32
	GenesisHash        types.Hash
	BlockHash          types.Hash
	AppID              types.UCompact
	TransactionVersion types.U32
}

Jump to

Keyboard shortcuts

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