types

package
v0.0.1-rc-1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArithmeticErrorUnderflow sc.U8 = iota
	ArithmeticErrorOverflow
	ArithmeticErrorDivisionByZero
)
View Source
const (
	BalanceStatusFree sc.U8 = iota
	BalanceStatusReserved
)
View Source
const (
	InherentErrorInherentDataExists sc.U8 = iota
	InherentErrorDecodingFailed
	InherentErrorFatalErrorReported
	InherentErrorApplication
)
View Source
const (
	DecRefStatusReaped sc.U8 = iota
	DecRefStatusExists
)
View Source
const (
	DigestTypeConsensusMessage           = 4
	DigestTypeSeal                       = 5
	DigestTypePreRuntime                 = 6
	DigestTypeRuntimeEnvironmentUpgraded = 8
)
View Source
const (
	// DispatchClassNormal A normal dispatch.
	DispatchClassNormal sc.U8 = iota

	// DispatchClassOperational An operational dispatch.
	DispatchClassOperational

	// DispatchClassMandatory A mandatory dispatch. These kinds of dispatch are always included regardless of their
	// weight, therefore it is critical that they are separately validated to ensure that a
	// malicious validator cannot craft a valid but impossibly heavy block. Usually this just
	// means ensuring that the extrinsic can only be included once and that it is always very
	// light.
	//
	// Do *NOT* use it for extrinsics that can be heavy.
	//
	// The only real use case for this is inherent extrinsics that are required to execute in a
	// block for the block to be valid, and it solves the issue in the case that the block
	// initialization is sufficiently heavy to mean that those inherents do not fit into the
	// block. Essentially, we assume that in these exceptional circumstances, it is better to
	// allow an overweight block to be created than to not allow any block at all to be created.
	DispatchClassMandatory
)
View Source
const (
	DispatchErrorOther sc.U8 = iota
	DispatchErrorCannotLookup
	DispatchErrorBadOrigin
	DispatchErrorModule
	DispatchErrorConsumerRemaining
	DispatchErrorNoProviders
	DispatchErrorTooManyConsumers
	DispatchErrorToken
	DispatchErrorArithmetic
	DispatchErrorTransactional
	DispatchErrorExhausted
	DispatchErrorCorruption
	DispatchErrorUnavailable
)
View Source
const (
	MetadataReserved sc.U32 = 0x6174656d // "meta"
	MetadataVersion  sc.U8  = 14
)
View Source
const (
	MetadataModuleStorageEntryDefinitionPlain sc.U8 = iota
	MetadataModuleStorageEntryDefinitionMap
)
View Source
const (
	MetadataTypeDefinitionComposite sc.U8 = iota
	MetadataTypeDefinitionVariant
	MetadataTypeDefinitionSequence
	MetadataTypeDefinitionFixedSequence
	MetadataTypeDefinitionTuple
	MetadataTypeDefinitionPrimitive
	MetadataTypeDefinitionCompact
	MetadataTypeDefinitionBitSequence
)
View Source
const (
	MultiAddressId sc.U8 = iota
	MultiAddressIndex
	MultiAddressRaw
	MultiAddress32
	MultiAddress20
)
View Source
const (
	MultiSignatureEd25519 sc.U8 = iota
	MultiSignatureSr25519
	MultiSignatureEcdsa
)
View Source
const (
	// PaysYes Transactor will pay related fees.
	PaysYes sc.U8 = iota

	// PaysNo Transactor will NOT pay related fees.
	PaysNo
)
View Source
const (
	// PhaseApplyExtrinsic Applying an extrinsic.
	PhaseApplyExtrinsic sc.U8 = iota

	// PhaseFinalization Finalizing the block.
	PhaseFinalization

	// PhaseInitialization Initializing the block.
	PhaseInitialization
)
View Source
const (
	RawOriginRoot sc.U8 = iota
	RawOriginSigned
	RawOriginNone
)
View Source
const (
	TimestampErrorTooEarly sc.U8 = iota
	TimestampErrorTooFarInFuture
)
View Source
const (
	TokenErrorNoFunds sc.U8 = iota
	TokenErrorWouldDie
	TokenErrorBelowMinimum
	TokenErrorCannotCreate
	TokenErrorUnknownAsset
	TokenErrorFrozen
	TokenErrorUnsupported
)
View Source
const (
	TransactionValidityErrorInvalidTransaction sc.U8 = iota
	TransactionValidityErrorUnknownTransaction
)
View Source
const (
	// The call of the transaction is not expected. Reject
	InvalidTransactionCall sc.U8 = iota

	// General error to do with the inability to pay some fees (e.g. account balance too low). Reject
	InvalidTransactionPayment

	// General error to do with the transaction not yet being valid (e.g. nonce too high). Don't Reject
	InvalidTransactionFuture

	// General error to do with the transaction being outdated (e.g. nonce too low). Reject
	InvalidTransactionStale

	// General error to do with the transaction's proofs (e.g. signature). Reject
	//
	// # Possible causes
	//
	// When using a signed extension that provides additional data for signing, it is required
	// that the signing and the verifying side use the same additional data. Additional
	// data will only be used to generate the signature, but will not be part of the transaction
	// itself. As the verifying side does not know which additional data was used while signing
	// it will only be able to assume a bad signature and cannot express a more meaningful error.
	InvalidTransactionBadProof

	// The transaction birth block is ancient. Reject
	//
	// # Possible causes
	//
	// For `FRAME`-based runtimes this would be caused by `current block number
	// - Era::birth block number > BlockHashCount`. (e.g. in Polkadot `BlockHashCount` = 2400, so
	//   a
	// transaction with birth block number 1337 would be valid up until block number 1337 + 2400,
	// after which point the transaction would be considered to have an ancient birth block.)
	InvalidTransactionAncientBirthBlock

	// The transaction would exhaust the resources of the current block. Don't Reject
	//
	// The transaction might be valid, but there are not enough resources
	// left in the current block.
	InvalidTransactionExhaustsResources

	// Any other custom invalid validity that is not covered by this enum. Reject
	InvalidTransactionCustom // + sc.U8

	// An extrinsic with mandatory dispatch resulted in an error. Reject
	// This is indicative of either a malicious validator or a buggy `provide_inherent`.
	// In any case, it can result in dangerously overweight blocks and therefore if
	// found, invalidates the block.
	InvalidTransactionBadMandatory

	// An extrinsic with a mandatory dispatch tried to be validated.
	// This is invalid; only inherent extrinsics are allowed to have mandatory dispatches.
	InvalidTransactionMandatoryValidation

	// The sending address is disabled or known to be invalid.
	InvalidTransactionBadSigner
)
View Source
const (
	// Could not lookup some information that is required to validate the transaction. Reject
	UnknownTransactionCannotLookup sc.U8 = iota

	// No validator found for the given unsigned transaction. Reject
	UnknownTransactionNoUnsignedValidator

	// Any other custom unknown validity that is not covered by this type. Reject
	UnknownTransactionCustomUnknownTransaction // + sc.U8
)
View Source
const (
	// Transaction is already included in block.
	//
	// This means that we can't really tell where the transaction is coming from,
	// since it's already in the received block. Note that the custom validation logic
	// using either `Local` or `External` should most likely just allow `InBlock`
	// transactions as well.
	TransactionSourceInBlock sc.U8 = iota

	// Transaction is coming from a local source.
	//
	// This means that the transaction was produced internally by the node
	// (for instance an Off-Chain Worker, or an Off-Chain Call), as opposed
	// to being received over the network.
	TransactionSourceLocal

	// Transaction has been received externally.
	//
	// This means the transaction has been received from (usually) "untrusted" source,
	// for instance received over the network or RPC.
	TransactionSourceExternal
)

The source of the transaction.

Depending on the source we might apply different validation schemes. For instance, we can disallow specific kinds of transactions if they were not produced by our local node (for instance off-chain workers).

View Source
const (
	// Too many transactional layers have been spawned.
	TransactionalErrorLimitReached sc.U8 = iota
	// A transactional layer was expected, but does not exist.
	TransactionalErrorNoLayer
)
View Source
const (
	// Commit the transaction.
	TransactionOutcomeCommit sc.U8 = iota
	// Rollback the transaction.
	TransactionOutcomeRollback
)
View Source
const (
	WithdrawReasonsTransactionPayment = 1 << iota
	WithdrawReasonsTransfer
	WithdrawReasonsReserve
	WithdrawReasonsFee
	WithdrawReasonsTip
)

Variables

This section is empty.

Functions

func DecodeBalanceStatus

func DecodeBalanceStatus(buffer *bytes.Buffer) sc.U8

func EraTypeDefinition

func EraTypeDefinition() sc.Sequence[MetadataDefinitionVariant]

func LookupAddress

func LookupAddress(a MultiAddress) sc.Option[Address32]

LookupAddress Lookup an address to get an Id, if there's one there.

func LookupIndex

func LookupIndex(index AccountIndex) sc.Option[Address32]

LookupIndex Lookup an T::AccountIndex to get an Id, if there's one there.

Types

type AccountData

type AccountData struct {
	Free       Balance
	Reserved   Balance
	MiscFrozen Balance
	FeeFrozen  Balance
}

func DecodeAccountData

func DecodeAccountData(buffer *bytes.Buffer) AccountData

func (AccountData) Bytes

func (ad AccountData) Bytes() []byte

func (AccountData) Encode

func (ad AccountData) Encode(buffer *bytes.Buffer)

func (AccountData) Total

func (ad AccountData) Total() *big.Int

type AccountId

type AccountId struct {
	Address32 // TODO: Varies depending on Signature (32 for ed25519 and sr25519, 33 for ecdsa)
}

AccountId It's an account ID (pubkey).

func DecodeAccountId

func DecodeAccountId(buffer *bytes.Buffer) AccountId

type AccountIdExtra

type AccountIdExtra struct {
	Address32
	SignedExtra
}

func DecodeAccountIdExtra

func DecodeAccountIdExtra(buffer *bytes.Buffer) AccountIdExtra

func (AccountIdExtra) Bytes

func (ae AccountIdExtra) Bytes() []byte

func (AccountIdExtra) Encode

func (ae AccountIdExtra) Encode(buffer *bytes.Buffer)

type AccountIdLookup

type AccountIdLookup struct {
}

AccountIdLookup A lookup implementation returning the `AccountId` from a `MultiAddress`.

func DefaultAccountIdLookup

func DefaultAccountIdLookup() AccountIdLookup

func (AccountIdLookup) Lookup

TODO: MultiAddress[AccountId, AccountIndex]

type AccountIndex

type AccountIndex = sc.U32

AccountIndex It's an account index.

type AccountInfo

type AccountInfo struct {
	Nonce       AccountIndex
	Consumers   RefCount
	Providers   RefCount
	Sufficients RefCount
	Data        AccountData
}

func DecodeAccountInfo

func DecodeAccountInfo(buffer *bytes.Buffer) AccountInfo

func (AccountInfo) Bytes

func (ai AccountInfo) Bytes() []byte

func (AccountInfo) Encode

func (ai AccountInfo) Encode(buffer *bytes.Buffer)

func (AccountInfo) Frozen

func (ai AccountInfo) Frozen(reasons Reasons) *big.Int

type AccountRaw

type AccountRaw struct {
	sc.Sequence[sc.U8]
}

AccountRaw It's some arbitrary raw bytes.

func DecodeAccountRaw

func DecodeAccountRaw(buffer *bytes.Buffer) AccountRaw

func (AccountRaw) Encode

func (a AccountRaw) Encode(buffer *bytes.Buffer)

type AdditionalSigned

type AdditionalSigned struct {
	SpecVersion sc.U32

	// Hh(G): a 32-byte array containing the genesis hash.
	GenesisHash H256 // size 32

	// Hh(B): a 32-byte array containing the hash of the block which starts the mortality period, as described in
	BlockHash H256 // size 32

	TransactionVersion sc.U32
}

type Address20

type Address20 struct {
	sc.FixedSequence[sc.U8] // size 20
}

Address20 It's a 20 byte representation.

func DecodeAddress20

func DecodeAddress20(buffer *bytes.Buffer) Address20

func NewAddress20

func NewAddress20(values ...sc.U8) Address20

type Address32

type Address32 struct {
	sc.FixedSequence[sc.U8] // size 32
}

Address32 It's a 32 byte representation.

func DecodeAddress32

func DecodeAddress32(buffer *bytes.Buffer) Address32

func NewAddress32

func NewAddress32(values ...sc.U8) Address32

type ApiItem

type ApiItem struct {
	Name    sc.FixedSequence[sc.U8] // size 8
	Version sc.U32
}

func DecodeApiItem

func DecodeApiItem(buffer *bytes.Buffer) ApiItem

func (ApiItem) Bytes

func (ai ApiItem) Bytes() []byte

func (ApiItem) Encode

func (ai ApiItem) Encode(buffer *bytes.Buffer)

type ApplyExtrinsicResult

type ApplyExtrinsicResult sc.VaryingData // = sc.Result[DispatchOutcome, TransactionValidityError]

ApplyExtrinsicResult The result of applying of an extrinsic.

This type is typically used in the context of `BlockBuilder` to signal that the extrinsic in question cannot be included.

A block containing extrinsics that have a negative inclusion outcome is invalid. A negative result can only occur during the block production, where such extrinsics are detected and removed from the block that is being created and the transaction pool.

To rehash: every extrinsic in a valid block must return a positive `ApplyExtrinsicResult`.

Examples of reasons preventing inclusion in a block:

  • More block weight is required to process the extrinsic than is left in the block being built. This doesn't necessarily mean that the extrinsic is invalid, since it can still be included in the next block if it has enough spare weight available.
  • The sender doesn't have enough funds to pay the transaction inclusion fee. Including such a transaction in the block doesn't make sense.
  • The extrinsic supplied a bad signature. This transaction won't become valid ever.

func DecodeApplyExtrinsicResult

func DecodeApplyExtrinsicResult(buffer *bytes.Buffer) ApplyExtrinsicResult

func NewApplyExtrinsicResult

func NewApplyExtrinsicResult(value sc.Encodable) ApplyExtrinsicResult

func (ApplyExtrinsicResult) Bytes

func (r ApplyExtrinsicResult) Bytes() []byte

func (ApplyExtrinsicResult) Encode

func (r ApplyExtrinsicResult) Encode(buffer *bytes.Buffer)

type ArithmeticError

type ArithmeticError = sc.VaryingData

func DecodeArithmeticError

func DecodeArithmeticError(buffer *bytes.Buffer) ArithmeticError

func NewArithmeticErrorDivisionByZero

func NewArithmeticErrorDivisionByZero() ArithmeticError

func NewArithmeticErrorOverflow

func NewArithmeticErrorOverflow() ArithmeticError

func NewArithmeticErrorUnderflow

func NewArithmeticErrorUnderflow() ArithmeticError

type Authority

type Authority struct {
	Id     PublicKey
	Weight sc.U64
}

func DecodeAuthority

func DecodeAuthority(buffer *bytes.Buffer) Authority

func (Authority) Bytes

func (a Authority) Bytes() []byte

func (Authority) Encode

func (a Authority) Encode(buffer *bytes.Buffer)

type Balance

type Balance = sc.U128

type BalanceStatus

type BalanceStatus = sc.U8

type Blake2bHash

type Blake2bHash struct {
	sc.FixedSequence[sc.U8] // size 32
}

func DecodeBlake2bHash

func DecodeBlake2bHash(buffer *bytes.Buffer) Blake2bHash

func NewBlake2bHash

func NewBlake2bHash(values ...sc.U8) Blake2bHash

func (Blake2bHash) Bytes

func (h Blake2bHash) Bytes() []byte

func (Blake2bHash) Encode

func (h Blake2bHash) Encode(buffer *bytes.Buffer)

type BlockNumber

type BlockNumber = sc.U32

type Call

type Call interface {
	sc.Encodable

	ModuleIndex() sc.U8
	FunctionIndex() sc.U8
	Args() sc.VaryingData
	Dispatch(origin RuntimeOrigin, args sc.VaryingData) DispatchResultWithPostInfo[PostDispatchInfo]
	IsInherent() bool
	BaseWeight(...any) Weight
	ClassifyDispatch(baseWeight Weight) DispatchClass
	PaysFee(baseWeight Weight) Pays
	WeightInfo(baseWeight Weight) Weight
	DecodeArgs(buffer *bytes.Buffer) Call
}

type Callable

type Callable struct {
	ModuleId   sc.U8
	FunctionId sc.U8
	Arguments  sc.VaryingData
}

func (Callable) Args

func (c Callable) Args() sc.VaryingData

func (Callable) Bytes

func (c Callable) Bytes() []byte

func (Callable) Encode

func (c Callable) Encode(buffer *bytes.Buffer)

func (Callable) FunctionIndex

func (c Callable) FunctionIndex() sc.U8

func (Callable) ModuleIndex

func (c Callable) ModuleIndex() sc.U8

type CheckInherentsResult

type CheckInherentsResult struct {
	Okay       sc.Bool
	FatalError sc.Bool
	Errors     InherentData
}

func DecodeCheckInherentsResult

func DecodeCheckInherentsResult(buffer *bytes.Buffer) CheckInherentsResult

func NewCheckInherentsResult

func NewCheckInherentsResult() CheckInherentsResult

func (CheckInherentsResult) Encode

func (cir CheckInherentsResult) Encode(buffer *bytes.Buffer)

func (CheckInherentsResult) PutError

func (cir CheckInherentsResult) PutError(inherentIdentifier [8]byte, error IsFatalError) error

type ConstantMultiplier

type ConstantMultiplier struct {
	Multiplier Balance
}

func NewConstantMultiplier

func NewConstantMultiplier(multiplier Balance) ConstantMultiplier

func (ConstantMultiplier) WeightToFee

func (cm ConstantMultiplier) WeightToFee(weight Weight) Balance

type ConsumedWeight

type ConsumedWeight PerDispatchClass[Weight]

An object to track the currently used extrinsic weight in a block.

func DecodeConsumedWeight

func DecodeConsumedWeight(buffer *bytes.Buffer) ConsumedWeight

func (*ConsumedWeight) Accrue

func (cw *ConsumedWeight) Accrue(weight Weight, class DispatchClass)

Accrue Increase the weight of the given class. Saturates at the numeric bounds.

func (ConsumedWeight) Bytes

func (cw ConsumedWeight) Bytes() []byte

func (*ConsumedWeight) CheckedAccrue

func (cw *ConsumedWeight) CheckedAccrue(weight Weight, class DispatchClass) (ok sc.Empty, err error)

CheckedAccrue Try to increase the weight of the given class. Saturates at the numeric bounds.

func (ConsumedWeight) Encode

func (cw ConsumedWeight) Encode(buffer *bytes.Buffer)

func (*ConsumedWeight) Get

func (cw *ConsumedWeight) Get(class DispatchClass) *Weight

Get current value for given class.

func (*ConsumedWeight) Reduce

func (cw *ConsumedWeight) Reduce(weight Weight, class DispatchClass)

Reduce the weight of the given class. Saturates at the numeric bounds.

func (*ConsumedWeight) SaturatingAdd

func (cw *ConsumedWeight) SaturatingAdd(weight Weight, class DispatchClass)

SaturatingAdd Increase the weight of the given class. Saturates at the numeric bounds.

func (ConsumedWeight) Total

func (cw ConsumedWeight) Total() Weight

Returns the total weight consumed by all extrinsics in the block.

Saturates on overflow.

type CustomModuleError

type CustomModuleError struct {
	Index   sc.U8             // Module index matching the metadata module index.
	Error   sc.U32            // Module specific error value.
	Message sc.Option[sc.Str] // Varying data type Option (Definition 190). The optional value is a SCALE encoded byte array containing a valid UTF-8 sequence.
}

CustomModuleError A custom error in a module.

func DecodeCustomModuleError

func DecodeCustomModuleError(buffer *bytes.Buffer) CustomModuleError

func (CustomModuleError) Bytes

func (e CustomModuleError) Bytes() []byte

func (CustomModuleError) Encode

func (e CustomModuleError) Encode(buffer *bytes.Buffer)

type DecRefStatus

type DecRefStatus = sc.U8

type Digest

func DecodeDigest

func DecodeDigest(buffer *bytes.Buffer) Digest

type DigestItem

type DigestItem struct {
	Engine  sc.FixedSequence[sc.U8]
	Payload sc.Sequence[sc.U8]
}

func DecodeDigestItem

func DecodeDigestItem(buffer *bytes.Buffer) DigestItem

func (DigestItem) Bytes

func (di DigestItem) Bytes() []byte

func (DigestItem) Encode

func (di DigestItem) Encode(buffer *bytes.Buffer)

type DispatchClass

type DispatchClass struct {
	sc.VaryingData
}

A generalized group of dispatch types.

func DecodeDispatchClass

func DecodeDispatchClass(buffer *bytes.Buffer) DispatchClass

func DispatchClassAll

func DispatchClassAll() []DispatchClass

Returns an array containing all dispatch classes.

func NewDispatchClassMandatory

func NewDispatchClassMandatory() DispatchClass

func NewDispatchClassNormal

func NewDispatchClassNormal() DispatchClass

func NewDispatchClassOperational

func NewDispatchClassOperational() DispatchClass

func (DispatchClass) Is

func (dc DispatchClass) Is(value sc.U8) sc.Bool

type DispatchError

type DispatchError = sc.VaryingData

func DecodeDispatchError

func DecodeDispatchError(buffer *bytes.Buffer) DispatchError

func NewDispatchErrorArithmetic

func NewDispatchErrorArithmetic(arithmeticError ArithmeticError) DispatchError

func NewDispatchErrorBadOrigin

func NewDispatchErrorBadOrigin() DispatchError

func NewDispatchErrorCannotLookup

func NewDispatchErrorCannotLookup() DispatchError

func NewDispatchErrorConsumerRemaining

func NewDispatchErrorConsumerRemaining() DispatchError

func NewDispatchErrorCorruption

func NewDispatchErrorCorruption() DispatchError

func NewDispatchErrorExhausted

func NewDispatchErrorExhausted() DispatchError

func NewDispatchErrorModule

func NewDispatchErrorModule(customModuleError CustomModuleError) DispatchError

func NewDispatchErrorNoProviders

func NewDispatchErrorNoProviders() DispatchError

func NewDispatchErrorOther

func NewDispatchErrorOther(str sc.Str) DispatchError

func NewDispatchErrorToken

func NewDispatchErrorToken(tokenError TokenError) DispatchError

func NewDispatchErrorTooManyConsumers

func NewDispatchErrorTooManyConsumers() DispatchError

func NewDispatchErrorTransactional

func NewDispatchErrorTransactional(transactionalError TransactionalError) DispatchError

func NewDispatchErrorUnavailable

func NewDispatchErrorUnavailable() DispatchError

type DispatchErrorWithPostInfo

type DispatchErrorWithPostInfo[T sc.Encodable] struct {
	// Additional information about the `Dispatchable` which is only known post dispatch.
	PostInfo T

	// The actual `DispatchResult` indicating whether the dispatch was successful.
	Error DispatchError
}

DispatchErrorWithPostInfo Result of a `Dispatchable` which contains the `DispatchResult` and additional information about the `Dispatchable` that is only known post dispatch.

func (DispatchErrorWithPostInfo[PostDispatchInfo]) Bytes

func (e DispatchErrorWithPostInfo[PostDispatchInfo]) Bytes() []byte

func (DispatchErrorWithPostInfo[PostDispatchInfo]) Encode

func (e DispatchErrorWithPostInfo[PostDispatchInfo]) Encode(buffer *bytes.Buffer)

type DispatchInfo

type DispatchInfo struct {
	// Weight of this transaction.
	Weight Weight

	// Class of this transaction.
	Class DispatchClass

	// Does this transaction pay fees.
	PaysFee Pays
}

DispatchInfo A bundle of static information collected from the `#[pallet::weight]` attributes.

func DecodeDispatchInfo

func DecodeDispatchInfo(buffer *bytes.Buffer) DispatchInfo

func GetDispatchInfo

func GetDispatchInfo(call Call) DispatchInfo

func (DispatchInfo) Bytes

func (di DispatchInfo) Bytes() []byte

func (DispatchInfo) Encode

func (di DispatchInfo) Encode(buffer *bytes.Buffer)

type DispatchOutcome

type DispatchOutcome sc.VaryingData //  = sc.Result[sc.Empty, DispatchError]

DispatchOutcome This type specifies the outcome of dispatching a call to a module.

In case of failure an error specific to the module is returned.

Failure of the module call dispatching doesn't invalidate the extrinsic and it is still included in the block, therefore all state changes performed by the dispatched call are still persisted.

For example, if the dispatching of an extrinsic involves inclusion fee payment then these changes are going to be preserved even if the call dispatched failed.

func DecodeDispatchOutcome

func DecodeDispatchOutcome(buffer *bytes.Buffer) DispatchOutcome

func NewDispatchOutcome

func NewDispatchOutcome(value sc.Encodable) DispatchOutcome

func (DispatchOutcome) Bytes

func (o DispatchOutcome) Bytes() []byte

func (DispatchOutcome) Encode

func (o DispatchOutcome) Encode(buffer *bytes.Buffer)

type DispatchResult

type DispatchResult sc.VaryingData

func NewDispatchResult

func NewDispatchResult(value sc.Encodable) DispatchResult

type DispatchResultWithPostInfo

type DispatchResultWithPostInfo[T sc.Encodable] struct {
	HasError sc.Bool
	Ok       T
	Err      DispatchErrorWithPostInfo[T]
}

type Ecdsa

type Ecdsa struct {
	sc.FixedSequence[sc.U8] // size 65
}

func DecodeEcdsa

func DecodeEcdsa(buffer *bytes.Buffer) Ecdsa

func NewEcdsa

func NewEcdsa(values ...sc.U8) Ecdsa

func (Ecdsa) Bytes

func (s Ecdsa) Bytes() []byte

func (Ecdsa) Encode

func (s Ecdsa) Encode(buffer *bytes.Buffer)

func (Ecdsa) Verify

func (s Ecdsa) Verify(msg sc.Sequence[sc.U8], signer Address32) sc.Bool

type Ed25519

type Ed25519 struct {
	H512 // size 64
}

func DecodeEd25519

func DecodeEd25519(buffer *bytes.Buffer) Ed25519

func NewEd25519

func NewEd25519(values ...sc.U8) Ed25519

func (Ed25519) Bytes

func (s Ed25519) Bytes() []byte

func (Ed25519) Encode

func (s Ed25519) Encode(buffer *bytes.Buffer)

func (Ed25519) Verify

func (s Ed25519) Verify(msg sc.Sequence[sc.U8], signer Address32) sc.Bool

type Era

type Era struct {
	IsImmortal sc.Bool
	EraPeriod  sc.U64
	EraPhase   sc.U64
}

Era An era to describe the longevity of a transaction.

func DecodeEra

func DecodeEra(buffer *bytes.Buffer) Era

func NewImmortalEra

func NewImmortalEra() Era

The transaction is valid forever. The genesis hash must be present in the signed content.

func NewMortalEra

func NewMortalEra(period sc.U64, current sc.U64) Era

NewMortalEra Create a new era based on a period (which should be a power of two between 4 and 65536 inclusive) and a block number on which it should start (or, for long periods, be shortly after the start).

If using `Era` in the context of `FRAME` runtime, make sure that `period` does not exceed `BlockHashCount` parameter passed to `system` module, since that prunes old blocks and renders transactions immediately invalid.

func (Era) Birth

func (e Era) Birth(current sc.U64) sc.U64

Get the block number of the start of the era whose properties this object describes that `current` belongs to.

func (Era) Bytes

func (e Era) Bytes() []byte

func (Era) Death

func (e Era) Death(current sc.U64) sc.U64

Get the block number of the first block at which the era has ended.

func (Era) Encode

func (e Era) Encode(buffer *bytes.Buffer)

type Event

type Event = sc.VaryingData

func NewEvent

func NewEvent(module sc.U8, event sc.U8, values ...sc.Encodable) Event

type EventRecord

type EventRecord struct {
	Phase  ExtrinsicPhase
	Event  Event
	Topics sc.Sequence[H256]
}

func (EventRecord) Bytes

func (er EventRecord) Bytes() []byte

func (EventRecord) Encode

func (er EventRecord) Encode(buffer *bytes.Buffer)

type ExistenceRequirement

type ExistenceRequirement sc.U8
const (
	ExistenceRequirementKeepAlive ExistenceRequirement = iota
	ExistenceRequirementAllowDeath
)

type ExtrinsicPhase

type ExtrinsicPhase = sc.VaryingData

func DecodeExtrinsicPhase

func DecodeExtrinsicPhase(buffer *bytes.Buffer) ExtrinsicPhase

func NewExtrinsicPhaseApply

func NewExtrinsicPhaseApply(index sc.U32) ExtrinsicPhase

func NewExtrinsicPhaseFinalization

func NewExtrinsicPhaseFinalization() ExtrinsicPhase

func NewExtrinsicPhaseInitialization

func NewExtrinsicPhaseInitialization() ExtrinsicPhase

type ExtrinsicSignature

type ExtrinsicSignature struct {
	// is the 32-byte address of the sender of the extrinsic
	// as described in https://docs.substrate.io/reference/address-formats/
	Signer    MultiAddress
	Signature MultiSignature
	Extra     SignedExtra
}

ExtrinsicSignature The signature is a varying data type indicating the used signature type, followed by the signature created by the extrinsic author (the sender).

func DecodeExtrinsicSignature

func DecodeExtrinsicSignature(buffer *bytes.Buffer) ExtrinsicSignature

func (ExtrinsicSignature) Bytes

func (s ExtrinsicSignature) Bytes() []byte

func (ExtrinsicSignature) Encode

func (s ExtrinsicSignature) Encode(buffer *bytes.Buffer)

type FeeDetails

type FeeDetails struct {
	InclusionFee sc.Option[InclusionFee]

	Tip Balance // not serializable
}

func DecodeFeeDetails

func DecodeFeeDetails(buffer *bytes.Buffer) FeeDetails

func (FeeDetails) Bytes

func (fd FeeDetails) Bytes() []byte

func (FeeDetails) Encode

func (fd FeeDetails) Encode(buffer *bytes.Buffer)

func (FeeDetails) FinalFee

func (fd FeeDetails) FinalFee() Balance

type H256

type H256 struct {
	sc.FixedSequence[sc.U8] // size 32
}

func DecodeH256

func DecodeH256(buffer *bytes.Buffer) H256

func NewH256

func NewH256(values ...sc.U8) H256

func (H256) Bytes

func (h H256) Bytes() []byte

func (H256) Encode

func (h H256) Encode(buffer *bytes.Buffer)

type H512

type H512 struct {
	sc.FixedSequence[sc.U8] // size 64
}

func DecodeH512

func DecodeH512(buffer *bytes.Buffer) H512

func NewH512

func NewH512(values ...sc.U8) H512

func (H512) Bytes

func (h H512) Bytes() []byte

func (H512) Encode

func (h H512) Encode(buffer *bytes.Buffer)
type Header struct {
	ParentHash     Blake2bHash
	Number         BlockNumber
	StateRoot      H256
	ExtrinsicsRoot H256
	Digest         Digest
}

func DecodeHeader

func DecodeHeader(buffer *bytes.Buffer) Header

func (Header) Bytes

func (h Header) Bytes() []byte

func (Header) Encode

func (h Header) Encode(buffer *bytes.Buffer)

type IdentityFee

type IdentityFee struct {
}

IdentityFee implements WeightToFee and maps one unit of weight to one unit of fee.

func (IdentityFee) WeightToFee

func (i IdentityFee) WeightToFee(weight Weight) Balance

type IncRefStatus

type IncRefStatus = sc.U8
const (
	IncRefStatusCreated IncRefStatus = iota
	IncRefStatusExisted
)

type InclusionFee

type InclusionFee struct {
	BaseFee           Balance
	LenFee            Balance
	AdjustedWeightFee Balance
}

func DecodeInclusionFee

func DecodeInclusionFee(buffer *bytes.Buffer) InclusionFee

func NewInclusionFee

func NewInclusionFee(baseFee, lenFee, adjustedWeightFee Balance) InclusionFee

func (InclusionFee) Bytes

func (i InclusionFee) Bytes() []byte

func (InclusionFee) Encode

func (i InclusionFee) Encode(buffer *bytes.Buffer)

func (InclusionFee) InclusionFee

func (i InclusionFee) InclusionFee() Balance

type InherentData

type InherentData struct {
	Data map[[8]byte]sc.Sequence[sc.U8]
}

func DecodeInherentData

func DecodeInherentData(buffer *bytes.Buffer) (*InherentData, error)

func NewInherentData

func NewInherentData() *InherentData

func (*InherentData) Bytes

func (id *InherentData) Bytes() []byte

func (*InherentData) Clear

func (id *InherentData) Clear()

func (*InherentData) Encode

func (id *InherentData) Encode(buffer *bytes.Buffer)

func (*InherentData) Put

func (id *InherentData) Put(key [8]byte, value sc.Encodable) error

type InherentError

type InherentError struct {
	sc.VaryingData
}

func NewInherentErrorApplication

func NewInherentErrorApplication() InherentError

func NewInherentErrorDecodingFailed

func NewInherentErrorDecodingFailed(inherentIdentifier sc.Sequence[sc.U8]) InherentError

func NewInherentErrorFatalErrorReported

func NewInherentErrorFatalErrorReported() InherentError

func NewInherentErrorInherentDataExists

func NewInherentErrorInherentDataExists(inherentIdentifier sc.Sequence[sc.U8]) InherentError

func (InherentError) Error

func (ie InherentError) Error() string

func (InherentError) IsFatal

func (ie InherentError) IsFatal() sc.Bool

type InvalidTransaction

type InvalidTransaction struct {
	sc.VaryingData
}

func DecodeInvalidTransaction

func DecodeInvalidTransaction(buffer *bytes.Buffer) InvalidTransaction

func NewInvalidTransactionAncientBirthBlock

func NewInvalidTransactionAncientBirthBlock() InvalidTransaction

func NewInvalidTransactionBadMandatory

func NewInvalidTransactionBadMandatory() InvalidTransaction

func NewInvalidTransactionBadProof

func NewInvalidTransactionBadProof() InvalidTransaction

func NewInvalidTransactionBadSigner

func NewInvalidTransactionBadSigner() InvalidTransaction

func NewInvalidTransactionCall

func NewInvalidTransactionCall() InvalidTransaction

func NewInvalidTransactionCustom

func NewInvalidTransactionCustom(customError sc.U8) InvalidTransaction

func NewInvalidTransactionExhaustsResources

func NewInvalidTransactionExhaustsResources() InvalidTransaction

func NewInvalidTransactionFuture

func NewInvalidTransactionFuture() InvalidTransaction

func NewInvalidTransactionMandatoryValidation

func NewInvalidTransactionMandatoryValidation() InvalidTransaction

func NewInvalidTransactionPayment

func NewInvalidTransactionPayment() InvalidTransaction

func NewInvalidTransactionStale

func NewInvalidTransactionStale() InvalidTransaction

func (InvalidTransaction) Bytes

func (e InvalidTransaction) Bytes() []byte

type IsFatalError

type IsFatalError interface {
	goscale.Encodable
	IsFatal() goscale.Bool
}

type LastRuntimeUpgradeInfo

type LastRuntimeUpgradeInfo struct {
	SpecVersion sc.Compact
	SpecName    sc.Str
}

func DecodeLastRuntimeUpgradeInfo

func DecodeLastRuntimeUpgradeInfo(buffer *bytes.Buffer) (value LastRuntimeUpgradeInfo)

func (LastRuntimeUpgradeInfo) Bytes

func (lrui LastRuntimeUpgradeInfo) Bytes() []byte

func (LastRuntimeUpgradeInfo) Encode

func (lrui LastRuntimeUpgradeInfo) Encode(buffer *bytes.Buffer)

type Metadata

type Metadata struct {
	Data RuntimeMetadataV14
}

func DecodeMetadata

func DecodeMetadata(buffer *bytes.Buffer) (Metadata, error)

func NewMetadata

func NewMetadata(data RuntimeMetadataV14) Metadata

func (Metadata) Bytes

func (m Metadata) Bytes() []byte

func (Metadata) Encode

func (m Metadata) Encode(buffer *bytes.Buffer)

type MetadataDefinitionPrimitive

type MetadataDefinitionPrimitive = sc.U8
const (
	MetadataDefinitionPrimitiveBoolean MetadataDefinitionPrimitive = iota
	MetadataDefinitionPrimitiveChar
	MetadataDefinitionPrimitiveString
	MetadataDefinitionPrimitiveU8
	MetadataDefinitionPrimitiveU16
	MetadataDefinitionPrimitiveU32
	MetadataDefinitionPrimitiveU64
	MetadataDefinitionPrimitiveU128
	MetadataDefinitionPrimitiveU256
	MetadataDefinitionPrimitiveI8
	MetadataDefinitionPrimitiveI16
	MetadataDefinitionPrimitiveI32
	MetadataDefinitionPrimitiveI64
	MetadataDefinitionPrimitiveI128
	MetadataDefinitionPrimitiveI256
)

func DecodeMetadataDefinitionPrimitive

func DecodeMetadataDefinitionPrimitive(buffer *bytes.Buffer) MetadataDefinitionPrimitive

type MetadataDefinitionVariant

type MetadataDefinitionVariant struct {
	Name   sc.Str
	Fields sc.Sequence[MetadataTypeDefinitionField]
	Index  sc.U8
	Docs   sc.Sequence[sc.Str]
}

func DecodeMetadataTypeDefinitionVariant

func DecodeMetadataTypeDefinitionVariant(buffer *bytes.Buffer) MetadataDefinitionVariant

func NewMetadataDefinitionVariant

func NewMetadataDefinitionVariant(name string, fields sc.Sequence[MetadataTypeDefinitionField], index sc.U8, docs string) MetadataDefinitionVariant

func (MetadataDefinitionVariant) Bytes

func (mdv MetadataDefinitionVariant) Bytes() []byte

func (MetadataDefinitionVariant) Encode

func (mdv MetadataDefinitionVariant) Encode(buffer *bytes.Buffer)

type MetadataExtrinsic

type MetadataExtrinsic struct {
	Type             sc.Compact
	Version          sc.U8
	SignedExtensions sc.Sequence[MetadataSignedExtension]
}

func DecodeMetadataExtrinsic

func DecodeMetadataExtrinsic(buffer *bytes.Buffer) MetadataExtrinsic

func (MetadataExtrinsic) Bytes

func (me MetadataExtrinsic) Bytes() []byte

func (MetadataExtrinsic) Encode

func (me MetadataExtrinsic) Encode(buffer *bytes.Buffer)

type MetadataModule

type MetadataModule struct {
	Name      sc.Str
	Storage   sc.Option[MetadataModuleStorage]
	Call      sc.Option[sc.Compact]
	Event     sc.Option[sc.Compact]
	Constants sc.Sequence[MetadataModuleConstant]
	Error     sc.Option[sc.Compact]
	Index     sc.U8
}

func DecodeMetadataModule

func DecodeMetadataModule(buffer *bytes.Buffer) MetadataModule

func (MetadataModule) Bytes

func (mm MetadataModule) Bytes() []byte

func (MetadataModule) Encode

func (mm MetadataModule) Encode(buffer *bytes.Buffer)

type MetadataModuleConstant

type MetadataModuleConstant struct {
	Name  sc.Str
	Type  sc.Compact
	Value sc.Sequence[sc.U8]
	Docs  sc.Sequence[sc.Str]
}

func DecodeMetadataModuleConstant

func DecodeMetadataModuleConstant(buffer *bytes.Buffer) MetadataModuleConstant

func NewMetadataModuleConstant

func NewMetadataModuleConstant(name string, id sc.Compact, value sc.Sequence[sc.U8], docs string) MetadataModuleConstant

func (MetadataModuleConstant) Bytes

func (mmc MetadataModuleConstant) Bytes() []byte

func (MetadataModuleConstant) Encode

func (mmc MetadataModuleConstant) Encode(buffer *bytes.Buffer)

type MetadataModuleStorage

type MetadataModuleStorage struct {
	Prefix sc.Str
	Items  sc.Sequence[MetadataModuleStorageEntry]
}

func DecodeMetadataModuleStorage

func DecodeMetadataModuleStorage(buffer *bytes.Buffer) MetadataModuleStorage

func (MetadataModuleStorage) Bytes

func (mms MetadataModuleStorage) Bytes() []byte

func (MetadataModuleStorage) Encode

func (mms MetadataModuleStorage) Encode(buffer *bytes.Buffer)

type MetadataModuleStorageEntry

type MetadataModuleStorageEntry struct {
	Name       sc.Str
	Modifier   MetadataModuleStorageEntryModifier
	Definition MetadataModuleStorageEntryDefinition
	Fallback   sc.Sequence[sc.U8]
	Docs       sc.Sequence[sc.Str]
}

func DecodeMetadataModuleStorageEntry

func DecodeMetadataModuleStorageEntry(buffer *bytes.Buffer) MetadataModuleStorageEntry

func (MetadataModuleStorageEntry) Bytes

func (mmse MetadataModuleStorageEntry) Bytes() []byte

func (MetadataModuleStorageEntry) Encode

func (mmse MetadataModuleStorageEntry) Encode(buffer *bytes.Buffer)

type MetadataModuleStorageEntryDefinition

type MetadataModuleStorageEntryDefinition = sc.VaryingData

func DecodeMetadataModuleStorageEntryDefinition

func DecodeMetadataModuleStorageEntryDefinition(buffer *bytes.Buffer) MetadataModuleStorageEntryDefinition

func NewMetadataModuleStorageEntryDefinitionMap

func NewMetadataModuleStorageEntryDefinitionMap(storageHashFuncs sc.Sequence[MetadataModuleStorageHashFunc], key, value sc.Compact) MetadataModuleStorageEntryDefinition

func NewMetadataModuleStorageEntryDefinitionPlain

func NewMetadataModuleStorageEntryDefinitionPlain(key sc.Compact) MetadataModuleStorageEntryDefinition

type MetadataModuleStorageEntryModifier

type MetadataModuleStorageEntryModifier = sc.U8
const (
	MetadataModuleStorageEntryModifierOptional MetadataModuleStorageEntryModifier = iota
	MetadataModuleStorageEntryModifierDefault                                     = 1
)

func DecodeMetadataModuleStorageEntryModifier

func DecodeMetadataModuleStorageEntryModifier(buffer *bytes.Buffer) MetadataModuleStorageEntryModifier

type MetadataModuleStorageHashFunc

type MetadataModuleStorageHashFunc = sc.U8
const (
	MetadataModuleStorageHashFuncBlake128 MetadataModuleStorageHashFunc = iota
	MetadataModuleStorageHashFuncBlake256
	MetadataModuleStorageHashFuncMultiBlake128Concat
	MetadataModuleStorageHashFuncXX128
	MetadataModuleStorageHashFuncXX256
	MetadataModuleStorageHashFuncMultiXX64
	MetadataModuleStorageHashFuncIdentity
)

func DecodeMetadataModuleStorageHashFunc

func DecodeMetadataModuleStorageHashFunc(buffer *bytes.Buffer) MetadataModuleStorageHashFunc

type MetadataSignedExtension

type MetadataSignedExtension struct {
	Identifier       sc.Str
	Type             sc.Compact
	AdditionalSigned sc.Compact
}

func DecodeMetadataSignedExtension

func DecodeMetadataSignedExtension(buffer *bytes.Buffer) MetadataSignedExtension

func NewMetadataSignedExtension

func NewMetadataSignedExtension(identifier sc.Str, typeIndex, additionalSigned int) MetadataSignedExtension

func (MetadataSignedExtension) Bytes

func (mse MetadataSignedExtension) Bytes() []byte

func (MetadataSignedExtension) Encode

func (mse MetadataSignedExtension) Encode(buffer *bytes.Buffer)

type MetadataType

type MetadataType struct {
	Id         sc.Compact
	Path       sc.Sequence[sc.Str]
	Params     sc.Sequence[MetadataTypeParameter]
	Definition MetadataTypeDefinition
	Docs       sc.Sequence[sc.Str]
}

func DecodeMetadataType

func DecodeMetadataType(buffer *bytes.Buffer) MetadataType

func NewMetadataType

func NewMetadataType(id int, docs string, definition MetadataTypeDefinition) MetadataType

func NewMetadataTypeWithParam

func NewMetadataTypeWithParam(id int, docs string, path sc.Sequence[sc.Str], definition MetadataTypeDefinition, param MetadataTypeParameter) MetadataType

func NewMetadataTypeWithParams

func NewMetadataTypeWithParams(id int, docs string, path sc.Sequence[sc.Str], definition MetadataTypeDefinition, params sc.Sequence[MetadataTypeParameter]) MetadataType

func NewMetadataTypeWithPath

func NewMetadataTypeWithPath(id int, docs string, path sc.Sequence[sc.Str], definition MetadataTypeDefinition) MetadataType

func (MetadataType) Bytes

func (mt MetadataType) Bytes() []byte

func (MetadataType) Encode

func (mt MetadataType) Encode(buffer *bytes.Buffer)

type MetadataTypeDefinition

type MetadataTypeDefinition = sc.VaryingData

func DecodeMetadataTypeDefinition

func DecodeMetadataTypeDefinition(buffer *bytes.Buffer) MetadataTypeDefinition

func NewMetadataTypeDefinitionBitSequence

func NewMetadataTypeDefinitionBitSequence(storeOrder, orderType sc.Compact) MetadataTypeDefinition

func NewMetadataTypeDefinitionCompact

func NewMetadataTypeDefinitionCompact(compact sc.Compact) MetadataTypeDefinition

func NewMetadataTypeDefinitionFixedSequence

func NewMetadataTypeDefinitionFixedSequence(length sc.U32, typeId sc.Compact) MetadataTypeDefinition

func NewMetadataTypeDefinitionPrimitive

func NewMetadataTypeDefinitionPrimitive(primitive MetadataDefinitionPrimitive) MetadataTypeDefinition

func NewMetadataTypeDefinitionSequence

func NewMetadataTypeDefinitionSequence(compact sc.Compact) MetadataTypeDefinition

func NewMetadataTypeDefinitionTuple

func NewMetadataTypeDefinitionTuple(compacts sc.Sequence[sc.Compact]) MetadataTypeDefinition

func NewMetadataTypeDefinitionVariant

func NewMetadataTypeDefinitionVariant(variants sc.Sequence[MetadataDefinitionVariant]) MetadataTypeDefinition

type MetadataTypeDefinitionField

type MetadataTypeDefinitionField struct {
	Name     sc.Option[sc.Str]
	Type     sc.Compact
	TypeName sc.Option[sc.Str]
	Docs     sc.Sequence[sc.Str]
}

func DecodeMetadataTypeDefinitionField

func DecodeMetadataTypeDefinitionField(buffer *bytes.Buffer) MetadataTypeDefinitionField

func NewMetadataTypeDefinitionField

func NewMetadataTypeDefinitionField(id int) MetadataTypeDefinitionField

func NewMetadataTypeDefinitionFieldWithName

func NewMetadataTypeDefinitionFieldWithName(id int, idName sc.Str) MetadataTypeDefinitionField

func NewMetadataTypeDefinitionFieldWithNames

func NewMetadataTypeDefinitionFieldWithNames(id int, name sc.Str, idName sc.Str) MetadataTypeDefinitionField

func (MetadataTypeDefinitionField) Bytes

func (mtdf MetadataTypeDefinitionField) Bytes() []byte

func (MetadataTypeDefinitionField) Encode

func (mtdf MetadataTypeDefinitionField) Encode(buffer *bytes.Buffer)

type MetadataTypeParameter

type MetadataTypeParameter struct {
	Text sc.Str
	Type sc.Option[sc.Compact]
}

func DecodeMetadataTypeParameter

func DecodeMetadataTypeParameter(buffer *bytes.Buffer) MetadataTypeParameter

func NewMetadataEmptyTypeParameter

func NewMetadataEmptyTypeParameter(text string) MetadataTypeParameter

func NewMetadataTypeParameter

func NewMetadataTypeParameter(id int, text string) MetadataTypeParameter

func (MetadataTypeParameter) Bytes

func (mtp MetadataTypeParameter) Bytes() []byte

func (MetadataTypeParameter) Encode

func (mtp MetadataTypeParameter) Encode(buffer *bytes.Buffer)

type Module

type Module interface {
	Functions() map[sc.U8]Call
	PreDispatch(call Call) (sc.Empty, TransactionValidityError)
	ValidateUnsigned(source TransactionSource, call Call) (ValidTransaction, TransactionValidityError)
	Metadata() (sc.Sequence[MetadataType], MetadataModule)
}

type MultiAddress

type MultiAddress struct {
	sc.VaryingData
}

func DecodeMultiAddress

func DecodeMultiAddress(buffer *bytes.Buffer) MultiAddress

func NewMultiAddress20

func NewMultiAddress20(address Address20) MultiAddress

func NewMultiAddress32

func NewMultiAddress32(address Address32) MultiAddress

func NewMultiAddressId

func NewMultiAddressId(id AccountId) MultiAddress

func NewMultiAddressIndex

func NewMultiAddressIndex(index AccountIndex) MultiAddress

func NewMultiAddressRaw

func NewMultiAddressRaw(accountRaw AccountRaw) MultiAddress

func (MultiAddress) AsAccountId

func (a MultiAddress) AsAccountId() AccountId

func (MultiAddress) AsAccountIndex

func (a MultiAddress) AsAccountIndex() AccountIndex

func (MultiAddress) AsAddress20

func (a MultiAddress) AsAddress20() Address20

func (MultiAddress) AsAddress32

func (a MultiAddress) AsAddress32() Address32

func (MultiAddress) AsRaw

func (a MultiAddress) AsRaw() AccountRaw

func (MultiAddress) IsAccountId

func (a MultiAddress) IsAccountId() sc.Bool

func (MultiAddress) IsAccountIndex

func (a MultiAddress) IsAccountIndex() sc.Bool

func (MultiAddress) IsAddress20

func (a MultiAddress) IsAddress20() sc.Bool

func (MultiAddress) IsAddress32

func (a MultiAddress) IsAddress32() sc.Bool

func (MultiAddress) IsRaw

func (a MultiAddress) IsRaw() sc.Bool

type MultiSignature

type MultiSignature struct {
	sc.VaryingData
}

func DecodeMultiSignature

func DecodeMultiSignature(buffer *bytes.Buffer) MultiSignature

func NewMultiSignatureEcdsa

func NewMultiSignatureEcdsa(signature Ecdsa) MultiSignature

func NewMultiSignatureEd25519

func NewMultiSignatureEd25519(signature Ed25519) MultiSignature

func NewMultiSignatureSr25519

func NewMultiSignatureSr25519(signature Sr25519) MultiSignature

func (MultiSignature) AsEcdsa

func (s MultiSignature) AsEcdsa() Ecdsa

func (MultiSignature) AsEd25519

func (s MultiSignature) AsEd25519() Ed25519

func (MultiSignature) AsSr25519

func (s MultiSignature) AsSr25519() Sr25519

func (MultiSignature) IsEcdsa

func (s MultiSignature) IsEcdsa() sc.Bool

func (MultiSignature) IsEd25519

func (s MultiSignature) IsEd25519() sc.Bool

func (MultiSignature) IsSr25519

func (s MultiSignature) IsSr25519() sc.Bool

func (MultiSignature) Verify

func (s MultiSignature) Verify(msg sc.Sequence[sc.U8], signer Address32) sc.Bool

type Pays

type Pays = sc.VaryingData

func DecodePays

func DecodePays(buffer *bytes.Buffer) Pays

func ExtractActualPaysFee

func ExtractActualPaysFee(result *DispatchResultWithPostInfo[PostDispatchInfo], info *DispatchInfo) Pays

ExtractActualPaysFee Extract the actual pays_fee from a dispatch result if any or fall back to the default weight.

func NewPaysNo

func NewPaysNo() Pays

func NewPaysYes

func NewPaysYes() Pays

type PerDispatchClass

type PerDispatchClass[T sc.Encodable] struct {
	// Value for `Normal` extrinsics.
	Normal T
	// Value for `Operational` extrinsics.
	Operational T
	// Value for `Mandatory` extrinsics.
	Mandatory T
}

A struct holding value for each `DispatchClass`.

func DecodePerDispatchClass

func DecodePerDispatchClass[T sc.Encodable](buffer *bytes.Buffer, decodeFunc func(buffer *bytes.Buffer) T) PerDispatchClass[T]

func (PerDispatchClass[T]) Bytes

func (pdc PerDispatchClass[T]) Bytes() []byte

func (PerDispatchClass[T]) Encode

func (pdc PerDispatchClass[T]) Encode(buffer *bytes.Buffer)

func (*PerDispatchClass[T]) Get

func (pdc *PerDispatchClass[T]) Get(class DispatchClass) *T

Get current value for given class.

type Perbill

type Perbill struct {
	Percentage sc.U32
}

func DecodePerbill

func DecodePerbill(buffer *bytes.Buffer) Perbill

func (Perbill) Bytes

func (p Perbill) Bytes() []byte

func (Perbill) Encode

func (p Perbill) Encode(buffer *bytes.Buffer)

func (Perbill) Mul

func (p Perbill) Mul(v sc.Encodable) sc.Encodable

type PostDispatchInfo

type PostDispatchInfo struct {
	// Actual weight consumed by a call or `None` which stands for the worst case static weight.
	ActualWeight sc.Option[Weight]

	// Whether this transaction should pay fees when all is said and done.
	PaysFee sc.U8
}

PostDispatchInfo Weight information that is only available post dispatch. NOTE: This can only be used to reduce the weight or fee, not increase it.

func DecodePostDispatchInfo

func DecodePostDispatchInfo(buffer *bytes.Buffer) PostDispatchInfo

func (PostDispatchInfo) Bytes

func (pdi PostDispatchInfo) Bytes() []byte

func (PostDispatchInfo) CalcActualWeight

func (pdi PostDispatchInfo) CalcActualWeight(info *DispatchInfo) Weight

CalcActualWeight Calculate how much weight was actually spent by the `Dispatchable`.

func (PostDispatchInfo) CalcUnspent

func (pdi PostDispatchInfo) CalcUnspent(info *DispatchInfo) Weight

CalcUnspent Calculate how much (if any) weight was not used by the `Dispatchable`.

func (PostDispatchInfo) Encode

func (pdi PostDispatchInfo) Encode(buffer *bytes.Buffer)

func (PostDispatchInfo) Pays

func (pdi PostDispatchInfo) Pays(info *DispatchInfo) Pays

Pays Determine if user should actually pay fees at the end of the dispatch.

type Pre

type Pre struct {
	Tip       Balance
	Who       Address32
	Imbalance sc.Option[Balance]
}

Pre is the type that encodes information that can be passed from pre_dispatch to post-dispatch.

func (Pre) Bytes

func (p Pre) Bytes() []byte

func (Pre) Encode

func (p Pre) Encode(buffer *bytes.Buffer)

type PublicKey

type PublicKey = sc.FixedSequence[sc.U8]

TODO: Extend for different types (ecdsa, ed25519, sr25519)

func DecodePublicKey

func DecodePublicKey(buffer *bytes.Buffer) PublicKey

type RawOrigin

type RawOrigin struct {
	sc.VaryingData // [T AccountId]
}

func NewRawOriginNone

func NewRawOriginNone() RawOrigin

func NewRawOriginRoot

func NewRawOriginRoot() RawOrigin

func NewRawOriginSigned

func NewRawOriginSigned(account Address32) RawOrigin

func RawOriginFrom

func RawOriginFrom(a sc.Option[Address32]) RawOrigin

func (RawOrigin) AsSigned

func (o RawOrigin) AsSigned() Address32

func (RawOrigin) IsNoneOrigin

func (o RawOrigin) IsNoneOrigin() sc.Bool

func (RawOrigin) IsRootOrigin

func (o RawOrigin) IsRootOrigin() sc.Bool

func (RawOrigin) IsSignedOrigin

func (o RawOrigin) IsSignedOrigin() sc.Bool

type Reasons

type Reasons sc.U8
const (
	ReasonsFee Reasons = iota
	ReasonsMisc
	ReasonsAll
)

type RefCount

type RefCount = sc.U32

type RuntimeDbWeight

type RuntimeDbWeight struct {
	Read  sc.U64
	Write sc.U64
}

RuntimeDbWeight The weight of database operations that the runtime can invoke.

NOTE: This is currently only measured in computational time, and will probably be updated all together once proof size is accounted for.

func (RuntimeDbWeight) Bytes

func (dbw RuntimeDbWeight) Bytes() []byte

func (RuntimeDbWeight) Encode

func (dbw RuntimeDbWeight) Encode(buffer *bytes.Buffer)

func (RuntimeDbWeight) Reads

func (dbw RuntimeDbWeight) Reads(r sc.U64) Weight

func (RuntimeDbWeight) ReadsWrites

func (dbw RuntimeDbWeight) ReadsWrites(r, w sc.U64) Weight

func (RuntimeDbWeight) Writes

func (dbw RuntimeDbWeight) Writes(w sc.U64) Weight

type RuntimeDispatchInfo

type RuntimeDispatchInfo struct {
	Weight     Weight
	Class      DispatchClass
	PartialFee Balance
}

func DecodeRuntimeDispatchInfo

func DecodeRuntimeDispatchInfo(buffer *bytes.Buffer) RuntimeDispatchInfo

func (RuntimeDispatchInfo) Bytes

func (rdi RuntimeDispatchInfo) Bytes() []byte

func (RuntimeDispatchInfo) Encode

func (rdi RuntimeDispatchInfo) Encode(buffer *bytes.Buffer)

type RuntimeMetadataV14

type RuntimeMetadataV14 struct {
	Types     sc.Sequence[MetadataType]
	Modules   sc.Sequence[MetadataModule]
	Extrinsic MetadataExtrinsic
	Type      sc.Compact
}

func DecodeRuntimeMetadataV14

func DecodeRuntimeMetadataV14(buffer *bytes.Buffer) RuntimeMetadataV14

func (RuntimeMetadataV14) Bytes

func (rm RuntimeMetadataV14) Bytes() []byte

func (RuntimeMetadataV14) Encode

func (rm RuntimeMetadataV14) Encode(buffer *bytes.Buffer)

type RuntimeOrigin

type RuntimeOrigin = RawOrigin

type RuntimeVersion

type RuntimeVersion struct {
	SpecName           sc.Str
	ImplName           sc.Str
	AuthoringVersion   sc.U32
	SpecVersion        sc.U32
	ImplVersion        sc.U32
	Apis               sc.Sequence[ApiItem]
	TransactionVersion sc.U32
	StateVersion       sc.U8
}

func DecodeRuntimeVersion

func DecodeRuntimeVersion(buffer *bytes.Buffer) RuntimeVersion

func (RuntimeVersion) Bytes

func (rv RuntimeVersion) Bytes() []byte

func (RuntimeVersion) Encode

func (rv RuntimeVersion) Encode(buffer *bytes.Buffer)

type SessionKey

type SessionKey struct {
	Key    sc.Sequence[sc.U8]
	TypeId sc.FixedSequence[sc.U8]
}

func DecodeSessionKey

func DecodeSessionKey(buffer *bytes.Buffer) SessionKey

func NewSessionKey

func NewSessionKey(key []byte, typeId [4]byte) SessionKey

func (SessionKey) Bytes

func (sk SessionKey) Bytes() []byte

func (SessionKey) Encode

func (sk SessionKey) Encode(buffer *bytes.Buffer)

type SignedExtra

type SignedExtra struct {
	Era Era

	// a compact integer containing the nonce of the sender.
	// The nonce must be incremented by one for each extrinsic created,
	// otherwise the Polkadot network will reject the extrinsic.
	Nonce sc.U32 // encode as Compact

	// a compact integer containing the transactor pay including tip.
	Fee sc.U128 // encode as Compact
}

SignedExtra implements SignedExtension Extra data, E, is a tuple containing additional metadata about the extrinsic and the system it is meant to be executed in.

func DecodeExtra

func DecodeExtra(buffer *bytes.Buffer) SignedExtra

func (SignedExtra) Bytes

func (e SignedExtra) Bytes() []byte

func (SignedExtra) Encode

func (e SignedExtra) Encode(buffer *bytes.Buffer)

type SignedPayload

type SignedPayload struct {
	Call  Call
	Extra SignedExtra
	AdditionalSigned
}

SignedPayload A payload that has been signed for an unchecked extrinsics.

Note that the payload that we sign to produce unchecked extrinsic signature is going to be different than the `SignaturePayload` - so the thing the extrinsic actually contains.

TODO: make it generic generic::SignedPayload<RuntimeCall, SignedExtra>;

func (SignedPayload) Bytes

func (sp SignedPayload) Bytes() []byte

func (SignedPayload) Encode

func (sp SignedPayload) Encode(buffer *bytes.Buffer)

func (SignedPayload) UsingEncoded

func (sp SignedPayload) UsingEncoded() sc.Sequence[sc.U8]

type Sr25519

type Sr25519 struct {
	H512 // size 64
}

func DecodeSr25519

func DecodeSr25519(buffer *bytes.Buffer) Sr25519

func NewSr25519

func NewSr25519(values ...sc.U8) Sr25519

func (Sr25519) Bytes

func (s Sr25519) Bytes() []byte

func (Sr25519) Encode

func (s Sr25519) Encode(buffer *bytes.Buffer)

func (Sr25519) Verify

func (s Sr25519) Verify(msg sc.Sequence[sc.U8], signer Address32) sc.Bool

type TimestampError

type TimestampError struct {
	sc.VaryingData
}

func NewTimestampErrorTooEarly

func NewTimestampErrorTooEarly() TimestampError

func NewTimestampErrorTooFarInFuture

func NewTimestampErrorTooFarInFuture() TimestampError

func (TimestampError) Error

func (te TimestampError) Error() string

func (TimestampError) IsFatal

func (te TimestampError) IsFatal() sc.Bool

type TokenError

type TokenError = sc.VaryingData

func DecodeTokenError

func DecodeTokenError(buffer *bytes.Buffer) TokenError

func NewTokenErrorBelowMinimum

func NewTokenErrorBelowMinimum() TokenError

func NewTokenErrorCannotCreate

func NewTokenErrorCannotCreate() TokenError

func NewTokenErrorFrozen

func NewTokenErrorFrozen() TokenError

func NewTokenErrorNoFounds

func NewTokenErrorNoFounds() TokenError

func NewTokenErrorUnknownAsset

func NewTokenErrorUnknownAsset() TokenError

func NewTokenErrorUnsupported

func NewTokenErrorUnsupported() TokenError

func NewTokenErrorWouldDie

func NewTokenErrorWouldDie() TokenError

type TransactionLongevity

type TransactionLongevity = sc.U64

type TransactionOutcome

type TransactionOutcome = sc.VaryingData

TransactionOutcome Describes on what should happen with a storage transaction.

func NewTransactionOutcomeCommit

func NewTransactionOutcomeCommit(res sc.Encodable) TransactionOutcome

func NewTransactionOutcomeRollback

func NewTransactionOutcomeRollback(res sc.Encodable) TransactionOutcome

type TransactionPriority

type TransactionPriority = sc.U64

type TransactionSource

type TransactionSource = sc.VaryingData

func DecodeTransactionSource

func DecodeTransactionSource(buffer *bytes.Buffer) TransactionSource

func NewTransactionSourceExternal

func NewTransactionSourceExternal() TransactionSource

func NewTransactionSourceInBlock

func NewTransactionSourceInBlock() TransactionSource

func NewTransactionSourceLocal

func NewTransactionSourceLocal() TransactionSource

type TransactionTag

type TransactionTag = sc.Sequence[sc.U8]

type TransactionValidityError

type TransactionValidityError sc.VaryingData

TransactionValidityError Errors that can occur while checking the validity of a transaction.

func DecodeTransactionValidityError

func DecodeTransactionValidityError(buffer *bytes.Buffer) TransactionValidityError

func NewTransactionValidityError

func NewTransactionValidityError(value sc.Encodable) TransactionValidityError

func (TransactionValidityError) Bytes

func (e TransactionValidityError) Bytes() []byte

func (TransactionValidityError) Encode

func (e TransactionValidityError) Encode(buffer *bytes.Buffer)

type TransactionValidityResult

type TransactionValidityResult sc.VaryingData

TransactionValidityResult Information on a transaction's validity and, if valid, on how it relates to other transactions.

func DecodeTransactionValidityResult

func DecodeTransactionValidityResult(buffer *bytes.Buffer) TransactionValidityResult

func NewTransactionValidityResult

func NewTransactionValidityResult(value sc.Encodable) TransactionValidityResult

func (TransactionValidityResult) AsValidTransaction

func (r TransactionValidityResult) AsValidTransaction() ValidTransaction

func (TransactionValidityResult) Bytes

func (r TransactionValidityResult) Bytes() []byte

func (TransactionValidityResult) Encode

func (r TransactionValidityResult) Encode(buffer *bytes.Buffer)

func (TransactionValidityResult) IsValidTransaction

func (r TransactionValidityResult) IsValidTransaction() sc.Bool

type TransactionalError

type TransactionalError = sc.VaryingData

func DecodeTransactionalError

func DecodeTransactionalError(buffer *bytes.Buffer) TransactionalError

func NewTransactionalErrorLimitReached

func NewTransactionalErrorLimitReached() TransactionalError

func NewTransactionalErrorNoLayer

func NewTransactionalErrorNoLayer() TransactionalError

type UnknownTransaction

type UnknownTransaction struct {
	sc.VaryingData
}

func DecodeUnknownTransaction

func DecodeUnknownTransaction(buffer *bytes.Buffer) UnknownTransaction

func NewUnknownTransactionCannotLookup

func NewUnknownTransactionCannotLookup() UnknownTransaction

func NewUnknownTransactionCustomUnknownTransaction

func NewUnknownTransactionCustomUnknownTransaction(unknown sc.U8) UnknownTransaction

func NewUnknownTransactionNoUnsignedValidator

func NewUnknownTransactionNoUnsignedValidator() UnknownTransaction

type ValidTransaction

type ValidTransaction struct {
	// Priority of the transaction.
	//
	// Priority determines the ordering of two transactions that have all
	// their dependencies (required tags) satisfied.
	Priority TransactionPriority

	// Transaction dependencies
	//
	// A non-empty list signifies that some other transactions which provide
	// given tags are required to be included before that one.
	Requires sc.Sequence[TransactionTag]

	// Provided tags
	//
	// A list of tags this transaction provides. Successfully importing the transaction
	// will enable other transactions that depend on (require) those tags to be included as well.
	// Provided and required tags allow Substrate to build a dependency graph of transactions
	// and import them in the right (linear) order.
	Provides sc.Sequence[TransactionTag]

	// Transaction longevity
	//
	// Longevity describes minimum number of blocks the validity is correct.
	// After this period transaction should be removed from the pool or revalidated.
	Longevity TransactionLongevity

	// A flag indicating if the transaction should be propagated to other peers.
	//
	// By setting `false` here the transaction will still be considered for
	// including in blocks that are authored on the current node, but will
	// never be sent to other peers.
	Propagate sc.Bool
}

ValidTransaction Contains information concerning a valid transaction.

func DecodeValidTransaction

func DecodeValidTransaction(buffer *bytes.Buffer) ValidTransaction

func DefaultValidTransaction

func DefaultValidTransaction() ValidTransaction

func (ValidTransaction) Bytes

func (tx ValidTransaction) Bytes() []byte

func (ValidTransaction) CombineWith

func (vt ValidTransaction) CombineWith(otherVt ValidTransaction) ValidTransaction

Combine two instances into one, as a best effort. This will take the superset of each of the `provides` and `requires` tags, it will sum the priorities, take the minimum longevity and the logic *And* of the propagate flags.

func (ValidTransaction) Encode

func (tx ValidTransaction) Encode(buffer *bytes.Buffer)

type VersionedAuthorityList

type VersionedAuthorityList struct {
	Version       sc.U8
	AuthorityList sc.Sequence[Authority]
}

func DecodeVersionedAuthorityList

func DecodeVersionedAuthorityList(buffer *bytes.Buffer) VersionedAuthorityList

func (VersionedAuthorityList) Bytes

func (val VersionedAuthorityList) Bytes() []byte

func (VersionedAuthorityList) Encode

func (val VersionedAuthorityList) Encode(buffer *bytes.Buffer)

type Weight

type Weight struct {
	// The weight of computational time used based on some reference hardware.
	RefTime sc.U64

	// The weight of storage space used by proof of validity.
	ProofSize sc.U64
}

func DecodeWeight

func DecodeWeight(buffer *bytes.Buffer) Weight

func ExtractActualWeight

func ExtractActualWeight(result *DispatchResultWithPostInfo[PostDispatchInfo], info *DispatchInfo) Weight

ExtractActualWeight Extract the actual weight from a dispatch result if any or fall back to the default weight.

func WeightFromParts

func WeightFromParts(refTime sc.U64, proofSize sc.U64) Weight

Construct [`Weight`] from weight parts, namely reference time and proof size weights.

func WeightZero

func WeightZero() Weight

Return a [`Weight`] where all fields are zero.

func (Weight) Add

func (w Weight) Add(rhs Weight) Weight

func (Weight) AllGt

func (w Weight) AllGt(rhs Weight) sc.Bool

AllGt Returns true if all of `self`'s constituent weights is strictly greater than that of the `other`'s, otherwise returns false.

func (Weight) AnyGt

func (w Weight) AnyGt(otherW Weight) sc.Bool

AnyGt Returns true if any of `self`'s constituent weights is strictly greater than that of the `other`'s, otherwise returns false.

func (Weight) Bytes

func (w Weight) Bytes() []byte

func (Weight) CheckedAdd

func (w Weight) CheckedAdd(rhs Weight) sc.Option[Weight]

Checked [`Weight`] addition. Computes `self + rhs`, returning `None` if overflow occurred.

func (Weight) Encode

func (w Weight) Encode(buffer *bytes.Buffer)

func (Weight) Max

func (w Weight) Max(rhs Weight) Weight

Max Get the aggressive max of `self` and `other` weight.

func (Weight) Min

func (w Weight) Min(rhs Weight) Weight

Min Get the conservative min of `self` and `other` weight.

func (Weight) Mul

func (w Weight) Mul(b sc.U64) Weight

func (*Weight) SaturatingAccrue

func (w *Weight) SaturatingAccrue(amount Weight)

Increment [`Weight`] by `amount` via saturating addition.

func (Weight) SaturatingAdd

func (w Weight) SaturatingAdd(rhs Weight) Weight

func (Weight) SaturatingMul

func (w Weight) SaturatingMul(b sc.U64) Weight

func (*Weight) SaturatingReduce

func (w *Weight) SaturatingReduce(amount Weight)

Reduce [`Weight`] by `amount` via saturating subtraction.

func (Weight) SaturatingSub

func (w Weight) SaturatingSub(rhs Weight) Weight

Saturating [`Weight`] subtraction. Computes `self - rhs`, saturating at the numeric bounds of all fields instead of overflowing.

func (Weight) Sub

func (w Weight) Sub(rhs Weight) Weight

type WeightToFee

type WeightToFee interface {
	WeightToFee(weight Weight) Balance
}

Jump to

Keyboard shortcuts

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