types

package
v0.0.3-rc-1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArithmeticErrorUnderflow sc.U8 = iota
	ArithmeticErrorOverflow
	ArithmeticErrorDivisionByZero
)
View Source
const (
	InherentErrorInherentDataExists sc.U8 = iota
	InherentErrorDecodingFailed
	InherentErrorFatalErrorReported
	InherentErrorApplication
)
View Source
const (
	DigestItemOther                      sc.U8 = 0
	DigestItemConsensusMessage           sc.U8 = 4
	DigestItemSeal                       sc.U8 = 5
	DigestItemPreRuntime                 sc.U8 = 6
	DigestItemRuntimeEnvironmentUpgraded sc.U8 = 8
)
View Source
const (
	DispatchErrorOther sc.U8 = iota
	DispatchErrorCannotLookup
	DispatchErrorBadOrigin
	DispatchErrorModule
	DispatchErrorConsumerRemaining
	DispatchErrorNoProviders
	DispatchErrorTooManyConsumers
	DispatchErrorToken
	DispatchErrorArithmetic
	DispatchErrorTransactional
	DispatchErrorExhausted
	DispatchErrorCorruption
	DispatchErrorUnavailable
)
View Source
const (
	EcdsaVerifyErrorBadRS sc.U8 = iota
	EcdsaVerifyErrorBadV
	EcdsaVerifyErrorBadSignature
)
View Source
const (
	// PhaseApplyExtrinsic Applying an extrinsic.
	PhaseApplyExtrinsic sc.U8 = iota

	// PhaseFinalization Finalizing the block.
	PhaseFinalization

	// PhaseInitialization Initializing the block.
	PhaseInitialization
)
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 (
	MetadataReserved  sc.U32 = 0x6174656d // "meta"
	MetadataVersion14 sc.U8  = 14
	MetadataVersion15 sc.U8  = 15
)
View Source
const (
	ModuleVersion14 sc.U8 = 14
	ModuleVersion15 sc.U8 = 15
)
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 (
	RawOriginRoot sc.U8 = iota
	RawOriginSigned
	RawOriginNone
)
View Source
const (
	TimestampErrorTooEarly sc.U8 = iota
	TimestampErrorTooFarInFuture
	TimestampErrorInvalid
)
View Source
const (
	TokenErrorFundsUnavailable sc.U8 = iota
	TokenErrorOnlyProvider
	TokenErrorBelowMinimum
	TokenErrorCannotCreate
	TokenErrorUnknownAsset
	TokenErrorFrozen
	TokenErrorUnsupported
	TokenErrorCannotCreateHold
	TokenErrorNotExpendable
	TokenErrorBlocked
)
View Source
const (
	// Commit the transaction.
	TransactionOutcomeCommit sc.U8 = iota
	// Rollback the transaction.
	TransactionOutcomeRollback
)
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 (
	TransactionValidityErrorInvalidTransaction sc.U8 = iota
	TransactionValidityErrorUnknownTransaction
)
View Source
const (
	TransactionValidityResultValid sc.U8 = iota
	TransactionValidityResultError
)
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 (
	// 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 (
	WithdrawReasonsTransactionPayment = iota
	WithdrawReasonsTransfer
	WithdrawReasonsReserve
	WithdrawReasonsFee
	WithdrawReasonsTip
)

Variables

View Source
var (
	FlagsNewLogic, _  = new(big.Int).SetString("80000000000000000000000000000000", 16)
	DefaultExtraFlags = ExtraFlags{sc.NewU128(FlagsNewLogic)}
)

Functions

func AttachInput

func AttachInput(output [sr25519VRFOutputLength]byte, pub *PubKey, t *merlin.Transcript) (vrfInOut *sr25519.VrfInOut, err error)

func AuthoritiesFrom

func AuthoritiesFrom(validators sc.Sequence[Validator]) sc.Sequence[Authority]

func BuildMetadataTypesIdsMap

func BuildMetadataTypesIdsMap() map[string]int

func DecodeAuthorityList

func DecodeAuthorityList(buffer *bytes.Buffer) (sc.Sequence[Authority], error)

func DecodeSequenceAccountId

func DecodeSequenceAccountId(buffer *bytes.Buffer) (sc.Sequence[AccountId], error)

func DecodeSequenceSr25519PublicKey

func DecodeSequenceSr25519PublicKey(buffer *bytes.Buffer) (sc.Sequence[Sr25519PublicKey], error)

func EraTypeDefinition

func EraTypeDefinition() sc.Sequence[MetadataDefinitionVariant]

func NewTransactionValidityError

func NewTransactionValidityError(value sc.Encodable) error

Types

type AccountData

type AccountData struct {
	Free     Balance
	Reserved Balance
	Frozen   Balance
	Flags    ExtraFlags
}

func DecodeAccountData

func DecodeAccountData(buffer *bytes.Buffer) (AccountData, error)

func DefaultAccountData

func DefaultAccountData() AccountData

func (AccountData) Bytes

func (ad AccountData) Bytes() []byte

func (AccountData) Encode

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

func (AccountData) Total

func (ad AccountData) Total() sc.U128

type AccountId

type AccountId Address32

func DecodeAccountId

func DecodeAccountId(buffer *bytes.Buffer) (AccountId, error)

func Lookup

func Lookup(a MultiAddress) (AccountId, error)

func NewAccountId

func NewAccountId(values ...sc.U8) (AccountId, error)

func NewAccountIdFromAddress32

func NewAccountIdFromAddress32(address Address32) AccountId

func (AccountId) Bytes

func (a AccountId) Bytes() []byte

func (AccountId) Encode

func (a AccountId) Encode(buffer *bytes.Buffer) error

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, error)

func DefaultAccountInfo

func DefaultAccountInfo() AccountInfo

func (AccountInfo) Bytes

func (ai AccountInfo) Bytes() []byte

func (AccountInfo) Encode

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

type AccountRaw

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

AccountRaw It's some arbitrary raw bytes.

func DecodeAccountRaw

func DecodeAccountRaw(buffer *bytes.Buffer) (AccountRaw, error)

func (AccountRaw) Encode

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

type AdditionalSigned

type AdditionalSigned = sc.VaryingData

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, error)

func NewAddress20

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

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, error)

func NewAddress32

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

type ApiItem

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

func DecodeApiItem

func DecodeApiItem(buffer *bytes.Buffer) (ApiItem, error)

func NewApiItem

func NewApiItem(name [8]byte, version sc.U32) ApiItem

func (ApiItem) Bytes

func (ai ApiItem) Bytes() []byte

func (ApiItem) Encode

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

type ApiModule

type ApiModule interface {
	Name() string
	Item() ApiItem
}

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, error)

func NewApplyExtrinsicResult

func NewApplyExtrinsicResult(value sc.Encodable) (ApplyExtrinsicResult, error)

func (ApplyExtrinsicResult) Bytes

func (r ApplyExtrinsicResult) Bytes() []byte

func (ApplyExtrinsicResult) Encode

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

type ArithmeticError

type ArithmeticError sc.VaryingData

func DecodeArithmeticError

func DecodeArithmeticError(buffer *bytes.Buffer) (ArithmeticError, error)

func NewArithmeticErrorDivisionByZero

func NewArithmeticErrorDivisionByZero() ArithmeticError

func NewArithmeticErrorOverflow

func NewArithmeticErrorOverflow() ArithmeticError

func NewArithmeticErrorUnderflow

func NewArithmeticErrorUnderflow() ArithmeticError

func (ArithmeticError) Bytes

func (err ArithmeticError) Bytes() []byte

func (ArithmeticError) Encode

func (err ArithmeticError) Encode(buffer *bytes.Buffer) error

func (ArithmeticError) Error

func (err ArithmeticError) Error() string

type Authority

type Authority struct {
	Id     AccountId
	Weight sc.U64
}

func DecodeAuthority

func DecodeAuthority(buffer *bytes.Buffer) (Authority, error)

func (Authority) Bytes

func (a Authority) Bytes() []byte

func (Authority) Encode

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

type Balance

type Balance = sc.U128

type Blake2bHash

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

func Blake2bHash69

func Blake2bHash69() Blake2bHash

func DecodeBlake2bHash

func DecodeBlake2bHash(buffer *bytes.Buffer) (Blake2bHash, error)

func NewBlake2bHash

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

func (Blake2bHash) Bytes

func (h Blake2bHash) Bytes() []byte

func (Blake2bHash) Encode

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

type Block

type Block interface {
	sc.Encodable

	Header() Header
	Extrinsics() sc.Sequence[UncheckedExtrinsic]
}

type BlockHashCount

type BlockHashCount struct {
	sc.U32
}

func (BlockHashCount) Docs

func (rv BlockHashCount) Docs() string

type BlockLength

type BlockLength struct {
	//  Maximal total length in bytes for each extrinsic class.
	//
	// In the worst case, the total block length is going to be:
	// `MAX(max)`
	Max PerDispatchClassU32
}

func (BlockLength) Bytes

func (bl BlockLength) Bytes() []byte

func (BlockLength) Docs

func (bl BlockLength) Docs() string

func (BlockLength) Encode

func (bl BlockLength) Encode(buffer *bytes.Buffer) error

type BlockWeights

type BlockWeights struct {
	// Base weight of block execution.
	BaseBlock Weight
	// Maximal total weight consumed by all kinds of extrinsics (without `reserved` space).
	MaxBlock Weight
	// Weight limits for extrinsics of given dispatch class.
	PerClass PerDispatchClassWeightsPerClass
}

func (BlockWeights) Bytes

func (bw BlockWeights) Bytes() []byte

func (BlockWeights) Docs

func (bw BlockWeights) Docs() string

func (BlockWeights) Encode

func (bw BlockWeights) Encode(buffer *bytes.Buffer) error

func (BlockWeights) Get

func (bw BlockWeights) Get(class DispatchClass) (*WeightsPerClass, error)

Get per-class weight settings.

type Call

type Call interface {
	sc.Encodable

	ModuleIndex() sc.U8
	FunctionIndex() sc.U8
	Args() sc.VaryingData
	Dispatch(origin RuntimeOrigin, args sc.VaryingData) (PostDispatchInfo, error)
	BaseWeight() Weight
	ClassifyDispatch(baseWeight Weight) DispatchClass
	PaysFee(baseWeight Weight) Pays
	WeighData(baseWeight Weight) Weight
	DecodeArgs(buffer *bytes.Buffer) (Call, error)
	Docs() string
}

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

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, error)

func NewCheckInherentsResult

func NewCheckInherentsResult() CheckInherentsResult

func (CheckInherentsResult) Bytes

func (cir CheckInherentsResult) Bytes() []byte

func (CheckInherentsResult) Encode

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

func (*CheckInherentsResult) PutError

func (cir *CheckInherentsResult) PutError(inherentIdentifier [8]byte, fatalError FatalError) error

type CheckedExtrinsic

type CheckedExtrinsic interface {
	Apply(validator UnsignedValidator, info *DispatchInfo, length sc.Compact) (PostDispatchInfo, error)
	Function() Call
	Validate(validator UnsignedValidator, source TransactionSource, info *DispatchInfo, length sc.Compact) (ValidTransaction, error)
}

type ConsumedWeight

type ConsumedWeight PerDispatchClassWeight

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

func DecodeConsumedWeight

func DecodeConsumedWeight(buffer *bytes.Buffer) (ConsumedWeight, error)

func (*ConsumedWeight) Accrue

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

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

func (*ConsumedWeight) Get

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

Get current value for given class.

func (*ConsumedWeight) Reduce

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

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

func (*ConsumedWeight) SaturatingAdd

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

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

func (ConsumedWeight) Total

func (cw ConsumedWeight) Total() (Weight, error)

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

Saturates on overflow.

type CurrencyAdapter

type CurrencyAdapter interface {
	// DepositIntoExisting adds free balance to `who`.
	// Returns an error if `who` is a new account.
	// Deposits an event and returns `value`.
	DepositIntoExisting(who AccountId, value sc.U128) (Balance, error)
	// Withdraw removes free balance from `who` based on `reasons`.
	// If `liveness` is ExistenceRequirementKeepAlive, the remaining value must not be less than the existential deposit.
	// Checks `who` for liquidity restrictions and returns an error if they are not met.
	// Deposits a withdrawal event and returns `value`.
	Withdraw(who AccountId, value sc.U128, reasons sc.U8, liveness ExistenceRequirement) (Balance, error)
}

CurrencyAdapter provides an abstraction over accounts balances manipulation.

type CustomMetadata

type CustomMetadata struct {
	Map sc.Dictionary[sc.Str, CustomValueMetadata]
}

func DecodeCustomMetadata

func DecodeCustomMetadata(buffer *bytes.Buffer) (CustomMetadata, error)

func (CustomMetadata) Bytes

func (cm CustomMetadata) Bytes() []byte

func (CustomMetadata) Encode

func (cm CustomMetadata) Encode(buffer *bytes.Buffer) error

type CustomModuleError

type CustomModuleError struct {
	Index   sc.U8             // Module index matching the metadata module index.
	Err     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, error)

func (CustomModuleError) Bytes

func (err CustomModuleError) Bytes() []byte

func (CustomModuleError) Encode

func (err CustomModuleError) Encode(buffer *bytes.Buffer) error

func (CustomModuleError) Error

func (err CustomModuleError) Error() string

type CustomValueMetadata

type CustomValueMetadata struct {
	Type  sc.Compact
	Value sc.Sequence[sc.U8]
}

func (CustomValueMetadata) Bytes

func (cvm CustomValueMetadata) Bytes() []byte

func (CustomValueMetadata) Encode

func (cvm CustomValueMetadata) Encode(buffer *bytes.Buffer) error

type DecRefStatus

type DecRefStatus sc.U8
const (
	DecRefStatusReaped DecRefStatus = iota
	DecRefStatusExists
)

func (DecRefStatus) Bytes

func (drs DecRefStatus) Bytes() []byte

func (DecRefStatus) Encode

func (drs DecRefStatus) Encode(buffer *bytes.Buffer) error

type DefaultInherentProvider

type DefaultInherentProvider struct {
}

DefaultProvideInherent is an implementation of ProvideInherent and is used by modules, which do not have an implementation of ProvideInherent.

func NewDefaultProvideInherent

func NewDefaultProvideInherent() DefaultInherentProvider

func (DefaultInherentProvider) CheckInherent

func (dp DefaultInherentProvider) CheckInherent(call Call, data InherentData) error

func (DefaultInherentProvider) CreateInherent

func (dp DefaultInherentProvider) CreateInherent(inherent InherentData) (sc.Option[Call], error)

func (DefaultInherentProvider) InherentIdentifier

func (dp DefaultInherentProvider) InherentIdentifier() [8]byte

func (DefaultInherentProvider) IsInherent

func (dp DefaultInherentProvider) IsInherent(call Call) bool

type Describer

type Describer interface {
	Docs() string
}

type Digest

type Digest struct {
	sc.Sequence[DigestItem]
}

func DecodeDigest

func DecodeDigest(buffer *bytes.Buffer) (Digest, error)

func NewDigest

func NewDigest(items sc.Sequence[DigestItem]) Digest

func (Digest) OnlyPreRuntimes

func (d Digest) OnlyPreRuntimes() Digest

OnlyPreRuntimes returns a new Digest, containing only PreRuntime digest items

func (Digest) PreRuntimes

func (d Digest) PreRuntimes() (sc.Sequence[DigestPreRuntime], error)

PreRuntimes returns a sequence of DigestPreRuntime, containing only DigestItemPreRuntime items

type DigestItem

type DigestItem struct {
	sc.VaryingData
}

func DecodeDigestItem

func DecodeDigestItem(buffer *bytes.Buffer) (DigestItem, error)

func NewDigestItemConsensusMessage

func NewDigestItemConsensusMessage(consensusEngineId sc.FixedSequence[sc.U8], message sc.Sequence[sc.U8]) DigestItem

func NewDigestItemOther

func NewDigestItemOther(message sc.Sequence[sc.U8]) DigestItem

func NewDigestItemPreRuntime

func NewDigestItemPreRuntime(consensusEngineId sc.FixedSequence[sc.U8], message sc.Sequence[sc.U8]) DigestItem

func NewDigestItemRuntimeEnvironmentUpgrade

func NewDigestItemRuntimeEnvironmentUpgrade() DigestItem

func NewDigestItemSeal

func NewDigestItemSeal(consensusEngineId sc.FixedSequence[sc.U8], message sc.Sequence[sc.U8]) DigestItem

func (DigestItem) AsPreRuntime

func (di DigestItem) AsPreRuntime() (DigestPreRuntime, error)

func (DigestItem) AsSeal

func (di DigestItem) AsSeal() (DigestSeal, error)

TODO: has the same fields as DigestPreRuntime, merge at some point

func (DigestItem) IsPreRuntime

func (di DigestItem) IsPreRuntime() bool

func (DigestItem) IsSeal

func (di DigestItem) IsSeal() bool

type DigestPreRuntime

type DigestPreRuntime struct {
	ConsensusEngineId sc.FixedSequence[sc.U8]
	Message           sc.Sequence[sc.U8]
}

func NewDigestPreRuntime

func NewDigestPreRuntime(consensusEngineId sc.FixedSequence[sc.U8], message sc.Sequence[sc.U8]) DigestPreRuntime

func (DigestPreRuntime) Bytes

func (dpr DigestPreRuntime) Bytes() []byte

func (DigestPreRuntime) Encode

func (dpr DigestPreRuntime) Encode(buffer *bytes.Buffer) error

type DigestSeal

type DigestSeal struct {
	ConsensusEngineId sc.FixedSequence[sc.U8]
	Message           sc.Sequence[sc.U8]
}

func NewDigestSeal

func NewDigestSeal(consensusEngineId sc.FixedSequence[sc.U8], message sc.Sequence[sc.U8]) DigestSeal

func (DigestSeal) Bytes

func (ds DigestSeal) Bytes() []byte

func (DigestSeal) Encode

func (ds DigestSeal) Encode(buffer *bytes.Buffer) error

type DisabledValidators

type DisabledValidators interface {
	IsDisabled(index sc.U32) (bool, error)
}

type DispatchClass

type DispatchClass struct {
	sc.VaryingData
}

A generalized group of dispatch types.

func DecodeDispatchClass

func DecodeDispatchClass(buffer *bytes.Buffer) (DispatchClass, error)

func DispatchClassAll

func DispatchClassAll() []DispatchClass

DispatchClassAll Returns a slice, 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 DispatchClassType) (sc.Bool, error)

type DispatchClassType

type DispatchClassType sc.U8
const (
	// DispatchClassNormal A normal dispatch.
	DispatchClassNormal DispatchClassType = 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
)

func (DispatchClassType) Bytes

func (dct DispatchClassType) Bytes() []byte

func (DispatchClassType) Encode

func (dct DispatchClassType) Encode(buffer *bytes.Buffer) error

type DispatchError

type DispatchError sc.VaryingData

func DecodeDispatchError

func DecodeDispatchError(buffer *bytes.Buffer) (DispatchError, error)

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

func (DispatchError) Bytes

func (err DispatchError) Bytes() []byte

func (DispatchError) Encode

func (err DispatchError) Encode(buffer *bytes.Buffer) error

func (DispatchError) Error

func (err DispatchError) Error() string

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, error)

func GetDispatchInfo

func GetDispatchInfo(call Call) DispatchInfo

GetDispatchInfo returns the DispatchInfo of the given call. Uses call's BaseWeight to calculate all the information in DispatchInfo

func (DispatchInfo) Bytes

func (di DispatchInfo) Bytes() []byte

func (DispatchInfo) Encode

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

func (DispatchInfo) IsMandatory

func (di DispatchInfo) IsMandatory() (sc.Bool, error)

type DispatchModule

type DispatchModule interface {
	OnInitialize
	OnRuntimeUpgrade
	OnFinalize(n sc.U64) error
	OnIdle(n sc.U64, remainingWeight Weight) Weight
	OffchainWorker(n sc.U64)
}

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, error)

func NewDispatchOutcome

func NewDispatchOutcome(value sc.Encodable) (DispatchOutcome, error)

func (DispatchOutcome) Bytes

func (o DispatchOutcome) Bytes() []byte

func (DispatchOutcome) Encode

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

type EcdsaPublicKey

type EcdsaPublicKey struct {
	sc.FixedSequence[sc.U8] // size 33
}

func DecodeEcdsaPublicKey

func DecodeEcdsaPublicKey(buffer *bytes.Buffer) (EcdsaPublicKey, error)

func NewEcdsaPublicKey

func NewEcdsaPublicKey(values ...sc.U8) (EcdsaPublicKey, error)

func (EcdsaPublicKey) Bytes

func (s EcdsaPublicKey) Bytes() []byte

func (EcdsaPublicKey) Encode

func (s EcdsaPublicKey) Encode(buffer *bytes.Buffer) error

func (EcdsaPublicKey) SignatureType

func (s EcdsaPublicKey) SignatureType() sc.U8

type EcdsaVerifyError

type EcdsaVerifyError sc.VaryingData

func DecodeEcdsaVerifyError

func DecodeEcdsaVerifyError(buffer *bytes.Buffer) (EcdsaVerifyError, error)

func NewEcdsaVerifyErrorBadRS

func NewEcdsaVerifyErrorBadRS() EcdsaVerifyError

func NewEcdsaVerifyErrorBadSignature

func NewEcdsaVerifyErrorBadSignature() EcdsaVerifyError

func NewEcdsaVerifyErrorBadV

func NewEcdsaVerifyErrorBadV() EcdsaVerifyError

func (EcdsaVerifyError) Bytes

func (err EcdsaVerifyError) Bytes() []byte

func (EcdsaVerifyError) Encode

func (err EcdsaVerifyError) Encode(buffer *bytes.Buffer) error

func (EcdsaVerifyError) Error

func (err EcdsaVerifyError) Error() string

type Ed25519PublicKey

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

func DecodeEd25519PublicKey

func DecodeEd25519PublicKey(buffer *bytes.Buffer) (Ed25519PublicKey, error)

func NewEd25519PublicKey

func NewEd25519PublicKey(values ...sc.U8) (Ed25519PublicKey, error)

func (Ed25519PublicKey) Bytes

func (s Ed25519PublicKey) Bytes() []byte

func (Ed25519PublicKey) Encode

func (s Ed25519PublicKey) Encode(buffer *bytes.Buffer) error

func (Ed25519PublicKey) SignatureType

func (s Ed25519PublicKey) SignatureType() sc.U8

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, error)

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

type Event

type Event struct {
	sc.VaryingData
}

func NewEvent

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

type EventDepositor

type EventDepositor interface {
	DepositEvent(event Event)
}

type EventRecord

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

func DecodeEventRecord

func DecodeEventRecord(
	moduleIndex sc.U8,
	decodeEvent func(moduleIndex sc.U8, buffer *bytes.Buffer) (Event, error),
	buffer *bytes.Buffer,
) (EventRecord, error)

func (EventRecord) Bytes

func (er EventRecord) Bytes() []byte

func (EventRecord) Encode

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

type ExistenceRequirement

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

type ExistentialDeposit

type ExistentialDeposit struct {
	sc.U128
}

func (ExistentialDeposit) Docs

func (ed ExistentialDeposit) Docs() string

type ExtraFlags

type ExtraFlags struct {
	sc.U128
}

func (ExtraFlags) Bytes

func (ef ExtraFlags) Bytes() []byte

func (ExtraFlags) Encode

func (ef ExtraFlags) Encode(buffer *bytes.Buffer) error

func (ExtraFlags) IsNewLogic

func (ef ExtraFlags) IsNewLogic() bool

func (ExtraFlags) OldLogic

func (ef ExtraFlags) OldLogic() ExtraFlags

func (ExtraFlags) SetNewLogic

func (ef ExtraFlags) SetNewLogic() ExtraFlags

type ExtrinsicPhase

type ExtrinsicPhase struct {
	sc.VaryingData
}

func DecodeExtrinsicPhase

func DecodeExtrinsicPhase(buffer *bytes.Buffer) (ExtrinsicPhase, error)

func NewExtrinsicPhaseApply

func NewExtrinsicPhaseApply(index sc.U32) ExtrinsicPhase

func NewExtrinsicPhaseFinalization

func NewExtrinsicPhaseFinalization() ExtrinsicPhase

func NewExtrinsicPhaseInitialization

func NewExtrinsicPhaseInitialization() ExtrinsicPhase

func (*ExtrinsicPhase) MetadataDefinition

func (p *ExtrinsicPhase) MetadataDefinition() *MetadataTypeDefinition

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(extra SignedExtra, buffer *bytes.Buffer) (ExtrinsicSignature, error)

func (ExtrinsicSignature) Bytes

func (s ExtrinsicSignature) Bytes() []byte

func (ExtrinsicSignature) Encode

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

type FatalError

type FatalError interface {
	sc.Encodable
	IsFatal() sc.Bool
	Error() string
}

type FindAuthor

type FindAuthor[T sc.Encodable] interface {
	FindAuthor(digests sc.Sequence[DigestPreRuntime]) (sc.Option[T], error)
}

type H256

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

func DecodeH256

func DecodeH256(buffer *bytes.Buffer) (H256, error)

func NewH256

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

func (H256) Bytes

func (h H256) Bytes() []byte

func (H256) Encode

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

type H512

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

func DecodeH512

func DecodeH512(buffer *bytes.Buffer) (H512, error)

func NewH512

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

func (H512) Bytes

func (h H512) Bytes() []byte

func (H512) Encode

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

func DecodeHeader

func DecodeHeader(buffer *bytes.Buffer) (Header, error)

func (Header) Bytes

func (h Header) Bytes() []byte

func (Header) Encode

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

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
)

func (IncRefStatus) Bytes

func (irs IncRefStatus) Bytes() []byte

func (IncRefStatus) Encode

func (irs IncRefStatus) Encode(buffer *bytes.Buffer) error

type InherentData

type InherentData struct {
	// contains filtered or unexported fields
}

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

func (InherentData) Get

func (id InherentData) Get(key [8]byte) sc.Sequence[sc.U8]

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(error sc.Str) InherentError

func NewInherentErrorDecodingFailed

func NewInherentErrorDecodingFailed(error sc.Str, inherentIdentifier sc.FixedSequence[sc.U8]) InherentError

func NewInherentErrorFatalErrorReported

func NewInherentErrorFatalErrorReported() InherentError

func NewInherentErrorInherentDataExists

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

func (InherentError) Error

func (ie InherentError) Error() string

func (InherentError) IsFatal

func (ie InherentError) IsFatal() sc.Bool

type InherentProvider

type InherentProvider interface {
	// CreateInherent creates an inherent call based on InherentData.
	CreateInherent(inherent InherentData) (sc.Option[Call], error)
	// CheckInherent validates if the provided call is valid and exists in InherentData.
	CheckInherent(call Call, data InherentData) error
	// InherentIdentifier returns the identifier for the specific inherent call. Must be included in InherentData.
	InherentIdentifier() [8]byte
	// IsInherent checks if the call is from the given module.
	IsInherent(call Call) bool
}

ProvideInherent is an interface, implemented by modules in order to create and validate inherent calls/extrinsics.

type InvalidTransaction

type InvalidTransaction struct {
	sc.VaryingData
}

func DecodeInvalidTransaction

func DecodeInvalidTransaction(buffer *bytes.Buffer) (InvalidTransaction, error)

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

func (err InvalidTransaction) Error() string

func (InvalidTransaction) MetadataDefinition

func (err InvalidTransaction) MetadataDefinition() *MetadataTypeDefinition

type LastRuntimeUpgradeInfo

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

func DecodeLastRuntimeUpgradeInfo

func DecodeLastRuntimeUpgradeInfo(buffer *bytes.Buffer) (LastRuntimeUpgradeInfo, error)

func (LastRuntimeUpgradeInfo) Bytes

func (lrui LastRuntimeUpgradeInfo) Bytes() []byte

func (LastRuntimeUpgradeInfo) Encode

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

type MaxLocks

type MaxLocks struct {
	sc.U32
}

func (MaxLocks) Docs

func (ml MaxLocks) Docs() string

type MaxReserves

type MaxReserves struct {
	sc.U32
}

func (MaxReserves) Docs

func (mr MaxReserves) Docs() string

type Metadata

type Metadata struct {
	Version sc.U8
	DataV14 RuntimeMetadataV14
	DataV15 RuntimeMetadataV15
}

func DecodeMetadata

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

func (Metadata) Bytes

func (m Metadata) Bytes() []byte

func (Metadata) Encode

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

type Metadata14

type Metadata14 struct {
	Data RuntimeMetadataV14
}

func NewMetadataV14

func NewMetadataV14(data RuntimeMetadataV14) Metadata14

func (Metadata14) Bytes

func (m Metadata14) Bytes() []byte

func (Metadata14) Encode

func (m Metadata14) Encode(buffer *bytes.Buffer) error

type Metadata15

type Metadata15 struct {
	Data RuntimeMetadataV15
}

func NewMetadataV15

func NewMetadataV15(data RuntimeMetadataV15) Metadata15

func (Metadata15) Bytes

func (m Metadata15) Bytes() []byte

func (Metadata15) Encode

func (m Metadata15) Encode(buffer *bytes.Buffer) error

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, error)

func (MetadataDefinitionPrimitive) Bytes

func (mdp MetadataDefinitionPrimitive) Bytes() []byte

func (MetadataDefinitionPrimitive) Encode

func (mdp MetadataDefinitionPrimitive) Encode(buffer *bytes.Buffer) error

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, error)

func NewMetadataDefinitionVariant

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

func NewMetadataDefinitionVariantStr

func NewMetadataDefinitionVariantStr(name sc.Str, 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) error

type MetadataExtrinsicV14

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

func DecodeMetadataExtrinsicV14

func DecodeMetadataExtrinsicV14(buffer *bytes.Buffer) (MetadataExtrinsicV14, error)

func (MetadataExtrinsicV14) Bytes

func (me MetadataExtrinsicV14) Bytes() []byte

func (MetadataExtrinsicV14) Encode

func (me MetadataExtrinsicV14) Encode(buffer *bytes.Buffer) error

type MetadataExtrinsicV15

type MetadataExtrinsicV15 struct {
	Version          sc.U8
	Address          sc.Compact
	Call             sc.Compact
	Signature        sc.Compact
	Extra            sc.Compact
	SignedExtensions sc.Sequence[MetadataSignedExtension]
}

func DecodeMetadataExtrinsicV15

func DecodeMetadataExtrinsicV15(buffer *bytes.Buffer) (MetadataExtrinsicV15, error)

func (MetadataExtrinsicV15) Bytes

func (me MetadataExtrinsicV15) Bytes() []byte

func (MetadataExtrinsicV15) Encode

func (me MetadataExtrinsicV15) Encode(buffer *bytes.Buffer) error

type MetadataModule

type MetadataModule struct {
	Version   sc.U8
	ModuleV14 MetadataModuleV14
	ModuleV15 MetadataModuleV15
}

func (MetadataModule) Bytes

func (mm MetadataModule) Bytes() []byte

func (MetadataModule) Encode

func (m MetadataModule) Encode(buffer *bytes.Buffer) error

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, error)

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

type MetadataModuleStorage

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

func DecodeMetadataModuleStorage

func DecodeMetadataModuleStorage(buffer *bytes.Buffer) (MetadataModuleStorage, error)

func (MetadataModuleStorage) Bytes

func (mms MetadataModuleStorage) Bytes() []byte

func (MetadataModuleStorage) Encode

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

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, error)

func (MetadataModuleStorageEntry) Bytes

func (mmse MetadataModuleStorageEntry) Bytes() []byte

func (MetadataModuleStorageEntry) Encode

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

type MetadataModuleStorageEntryDefinition

type MetadataModuleStorageEntryDefinition struct {
	sc.VaryingData
}

func DecodeMetadataModuleStorageEntryDefinition

func DecodeMetadataModuleStorageEntryDefinition(buffer *bytes.Buffer) (MetadataModuleStorageEntryDefinition, error)

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, error)

func (MetadataModuleStorageEntryModifier) Bytes

func (mmsem MetadataModuleStorageEntryModifier) Bytes() []byte

func (MetadataModuleStorageEntryModifier) Encode

func (mmsem MetadataModuleStorageEntryModifier) Encode(buffer *bytes.Buffer) error

type MetadataModuleStorageHashFunc

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

func DecodeMetadataModuleStorageHashFunc

func DecodeMetadataModuleStorageHashFunc(buffer *bytes.Buffer) (MetadataModuleStorageHashFunc, error)

func (MetadataModuleStorageHashFunc) Bytes

func (mmshf MetadataModuleStorageHashFunc) Bytes() []byte

func (MetadataModuleStorageHashFunc) Encode

func (mmshf MetadataModuleStorageHashFunc) Encode(buffer *bytes.Buffer) error

type MetadataModuleV14

type MetadataModuleV14 struct {
	Name      sc.Str
	Storage   sc.Option[MetadataModuleStorage]
	Call      sc.Option[sc.Compact]
	CallDef   sc.Option[MetadataDefinitionVariant] // not encoded
	Event     sc.Option[sc.Compact]
	EventDef  sc.Option[MetadataDefinitionVariant] // not encoded
	Constants sc.Sequence[MetadataModuleConstant]
	Error     sc.Option[sc.Compact]
	ErrorDef  sc.Option[MetadataDefinitionVariant] // not encoded
	Index     sc.U8
}

func DecodeMetadataModuleV14

func DecodeMetadataModuleV14(buffer *bytes.Buffer) (MetadataModuleV14, error)

func (MetadataModuleV14) Bytes

func (mm MetadataModuleV14) Bytes() []byte

func (MetadataModuleV14) Encode

func (mm MetadataModuleV14) Encode(buffer *bytes.Buffer) error

type MetadataModuleV15

type MetadataModuleV15 struct {
	Name      sc.Str
	Storage   sc.Option[MetadataModuleStorage]
	Call      sc.Option[sc.Compact]
	CallDef   sc.Option[MetadataDefinitionVariant] // not encoded
	Event     sc.Option[sc.Compact]
	EventDef  sc.Option[MetadataDefinitionVariant] // not encoded
	Constants sc.Sequence[MetadataModuleConstant]
	Error     sc.Option[sc.Compact]
	ErrorDef  sc.Option[MetadataDefinitionVariant] // not encoded
	Index     sc.U8
	Docs      sc.Sequence[sc.Str]
}

func DecodeMetadataModuleV15

func DecodeMetadataModuleV15(buffer *bytes.Buffer) (MetadataModuleV15, error)

func (MetadataModuleV15) Bytes

func (mm MetadataModuleV15) Bytes() []byte

func (MetadataModuleV15) Encode

func (mm MetadataModuleV15) Encode(buffer *bytes.Buffer) error

type MetadataSignedExtension

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

func DecodeMetadataSignedExtension

func DecodeMetadataSignedExtension(buffer *bytes.Buffer) (MetadataSignedExtension, error)

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

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, error)

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

type MetadataTypeDefinition

type MetadataTypeDefinition struct {
	sc.VaryingData
}

func DecodeMetadataTypeDefinition

func DecodeMetadataTypeDefinition(buffer *bytes.Buffer) (MetadataTypeDefinition, error)

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, error)

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

type MetadataTypeGenerator

type MetadataTypeGenerator struct {
	// contains filtered or unexported fields
}

func NewMetadataTypeGenerator

func NewMetadataTypeGenerator() *MetadataTypeGenerator

func (*MetadataTypeGenerator) AppendMetadataTypes

func (g *MetadataTypeGenerator) AppendMetadataTypes(types sc.Sequence[MetadataType])

func (*MetadataTypeGenerator) BuildCallsMetadata

func (g *MetadataTypeGenerator) BuildCallsMetadata(moduleName string, moduleFunctions map[sc.U8]Call, params *sc.Sequence[MetadataTypeParameter]) int

BuildCallsMetadata returns metadata calls type of a module

func (*MetadataTypeGenerator) BuildErrorsMetadata

func (g *MetadataTypeGenerator) BuildErrorsMetadata(moduleName string, definition *MetadataTypeDefinition) int

BuildErrorsMetadata returns metadata errors type of a module

func (*MetadataTypeGenerator) BuildExtraMetadata

func (g *MetadataTypeGenerator) BuildExtraMetadata(extraValue reflect.Value, extensions *sc.Sequence[MetadataSignedExtension]) int

BuildExtraMetadata generates the metadata for a signed extension. Returns the metadata id for the extra

func (*MetadataTypeGenerator) BuildMetadataTypeRecursively

func (g *MetadataTypeGenerator) BuildMetadataTypeRecursively(v reflect.Value, path *sc.Sequence[sc.Str], def *MetadataTypeDefinition, params *sc.Sequence[MetadataTypeParameter]) int

BuildMetadataTypeRecursively Builds the metadata type (recursively) if it does not exist

func (*MetadataTypeGenerator) BuildModuleConstants

func (g *MetadataTypeGenerator) BuildModuleConstants(config reflect.Value) sc.Sequence[MetadataModuleConstant]

func (*MetadataTypeGenerator) ClearMetadata

func (g *MetadataTypeGenerator) ClearMetadata()

func (*MetadataTypeGenerator) GetId

func (g *MetadataTypeGenerator) GetId(typeName string) (int, bool)

func (*MetadataTypeGenerator) GetIdsMap

func (g *MetadataTypeGenerator) GetIdsMap() map[string]int

func (*MetadataTypeGenerator) GetLastAvailableIndex

func (g *MetadataTypeGenerator) GetLastAvailableIndex() int

func (*MetadataTypeGenerator) GetMetadataTypes

func (g *MetadataTypeGenerator) GetMetadataTypes() sc.Sequence[MetadataType]

type MetadataTypeParameter

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

func DecodeMetadataTypeParameter

func DecodeMetadataTypeParameter(buffer *bytes.Buffer) (MetadataTypeParameter, error)

func NewMetadataEmptyTypeParameter

func NewMetadataEmptyTypeParameter(text string) MetadataTypeParameter

func NewMetadataTypeParameter

func NewMetadataTypeParameter(id int, text string) MetadataTypeParameter

func NewMetadataTypeParameterCompactId

func NewMetadataTypeParameterCompactId(id sc.Compact, text string) MetadataTypeParameter

func (MetadataTypeParameter) Bytes

func (mtp MetadataTypeParameter) Bytes() []byte

func (MetadataTypeParameter) Encode

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

type Module

type Module interface {
	InherentProvider
	DispatchModule
	GetIndex() sc.U8
	Functions() map[sc.U8]Call
	PreDispatch(call Call) (sc.Empty, error)
	ValidateUnsigned(source TransactionSource, call Call) (ValidTransaction, error)
	Metadata() MetadataModule
}

func GetModule

func GetModule(moduleIndex sc.U8, modules []Module) (Module, error)

func MustGetModule

func MustGetModule(moduleIndex sc.U8, modules []Module) Module

type MultiAddress

type MultiAddress struct {
	sc.VaryingData
}

func DecodeMultiAddress

func DecodeMultiAddress(buffer *bytes.Buffer) (MultiAddress, error)

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, error)

func (MultiAddress) AsAccountIndex

func (a MultiAddress) AsAccountIndex() (AccountIndex, error)

func (MultiAddress) AsAddress20

func (a MultiAddress) AsAddress20() (Address20, error)

func (MultiAddress) AsAddress32

func (a MultiAddress) AsAddress32() (Address32, error)

func (MultiAddress) AsRaw

func (a MultiAddress) AsRaw() (AccountRaw, error)

func (MultiAddress) IsAccountId

func (a MultiAddress) IsAccountId() bool

func (MultiAddress) IsAccountIndex

func (a MultiAddress) IsAccountIndex() bool

func (MultiAddress) IsAddress20

func (a MultiAddress) IsAddress20() bool

func (MultiAddress) IsAddress32

func (a MultiAddress) IsAddress32() bool

func (MultiAddress) IsRaw

func (a MultiAddress) IsRaw() bool

type MultiSignature

type MultiSignature struct {
	sc.VaryingData
}

func DecodeMultiSignature

func DecodeMultiSignature(buffer *bytes.Buffer) (MultiSignature, error)

func NewMultiSignatureEcdsa

func NewMultiSignatureEcdsa(signature SignatureEcdsa) MultiSignature

func NewMultiSignatureEd25519

func NewMultiSignatureEd25519(signature SignatureEd25519) MultiSignature

func NewMultiSignatureSr25519

func NewMultiSignatureSr25519(signature SignatureSr25519) MultiSignature

func (MultiSignature) AsEcdsa

func (s MultiSignature) AsEcdsa() (SignatureEcdsa, error)

func (MultiSignature) AsEd25519

func (s MultiSignature) AsEd25519() (SignatureEd25519, error)

func (MultiSignature) AsSr25519

func (s MultiSignature) AsSr25519() (SignatureSr25519, error)

func (MultiSignature) IsEcdsa

func (s MultiSignature) IsEcdsa() bool

func (MultiSignature) IsEd25519

func (s MultiSignature) IsEd25519() bool

func (MultiSignature) IsSr25519

func (s MultiSignature) IsSr25519() bool

type OnInitialize

type OnInitialize interface {
	OnInitialize(n sc.U64) (Weight, error)
}

type OnRuntimeUpgrade

type OnRuntimeUpgrade interface {
	OnRuntimeUpgrade() Weight
}

type OuterEnums

type OuterEnums struct {
	CallEnumType  sc.Compact
	EventEnumType sc.Compact
	ErrorEnumType sc.Compact
}

func DecodeOuterEnums

func DecodeOuterEnums(buffer *bytes.Buffer) (OuterEnums, error)

func (OuterEnums) Bytes

func (oe OuterEnums) Bytes() []byte

func (OuterEnums) Encode

func (oe OuterEnums) Encode(buffer *bytes.Buffer) error

type Pays

type Pays sc.U8
const (
	// PaysYes Transactor will pay related fees.
	PaysYes Pays = iota

	// PaysNo Transactor will NOT pay related fees.
	PaysNo
)

func DecodePays

func DecodePays(buffer *bytes.Buffer) (Pays, error)

func (Pays) Bytes

func (p Pays) Bytes() []byte

func (Pays) Encode

func (p Pays) Encode(buffer *bytes.Buffer) error

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, error)) (PerDispatchClass[T], error)

func (PerDispatchClass[T]) Bytes

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

func (PerDispatchClass[T]) Encode

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

func (*PerDispatchClass[T]) Get

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

Get current value for given class.

type PerDispatchClassU32

type PerDispatchClassU32 struct {
	// Value for `Normal` extrinsics.
	Normal sc.U32
	// Value for `Operational` extrinsics.
	Operational sc.U32
	// Value for `Mandatory` extrinsics.
	Mandatory sc.U32
}

func DecodePerDispatchClassU32

func DecodePerDispatchClassU32(buffer *bytes.Buffer, decodeU32 func(buffer *bytes.Buffer) (sc.U32, error)) (PerDispatchClassU32, error)

func (PerDispatchClassU32) Bytes

func (pdc PerDispatchClassU32) Bytes() []byte

func (PerDispatchClassU32) Encode

func (pdc PerDispatchClassU32) Encode(buffer *bytes.Buffer) error

func (*PerDispatchClassU32) Get

func (pdc *PerDispatchClassU32) Get(class DispatchClass) (*sc.U32, error)

Get current value for given class.

type PerDispatchClassWeight

type PerDispatchClassWeight struct {
	// Value for `Normal` extrinsics.
	Normal Weight
	// Value for `Operational` extrinsics.
	Operational Weight
	// Value for `Mandatory` extrinsics.
	Mandatory Weight
}

func DecodePerDispatchClassWeight

func DecodePerDispatchClassWeight(buffer *bytes.Buffer, decodeWeight func(buffer *bytes.Buffer) (Weight, error)) (PerDispatchClassWeight, error)

func (PerDispatchClassWeight) Bytes

func (pdcw PerDispatchClassWeight) Bytes() []byte

func (PerDispatchClassWeight) Encode

func (pdcw PerDispatchClassWeight) Encode(buffer *bytes.Buffer) error

func (*PerDispatchClassWeight) Get

func (pdcw *PerDispatchClassWeight) Get(class DispatchClass) (*Weight, error)

Get current value for given class.

type PerDispatchClassWeightsPerClass

type PerDispatchClassWeightsPerClass struct {
	// Value for `Normal` extrinsics.
	Normal WeightsPerClass
	// Value for `Operational` extrinsics.
	Operational WeightsPerClass
	// Value for `Mandatory` extrinsics.
	Mandatory WeightsPerClass
}

func DecodePerDispatchClassWeightPerClass

func DecodePerDispatchClassWeightPerClass(buffer *bytes.Buffer, decodeWeightPerClass func(buffer *bytes.Buffer) (WeightsPerClass, error)) (PerDispatchClassWeightsPerClass, error)

func (PerDispatchClassWeightsPerClass) Bytes

func (pdc PerDispatchClassWeightsPerClass) Bytes() []byte

func (PerDispatchClassWeightsPerClass) Encode

func (pdc PerDispatchClassWeightsPerClass) Encode(buffer *bytes.Buffer) error

func (*PerDispatchClassWeightsPerClass) Get

Get current value for given class.

type Perbill

type Perbill struct {
	Percentage sc.U32
}

func DecodePerbill

func DecodePerbill(buffer *bytes.Buffer) (Perbill, error)

func (Perbill) Bytes

func (p Perbill) Bytes() []byte

func (Perbill) Encode

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

func (Perbill) Mul

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

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 Pays
}

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, error)

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

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 = sc.VaryingData

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

type PubKey

type PubKey struct {
	// contains filtered or unexported fields
}

func NewPublicKey

func NewPublicKey(in []byte) (*PubKey, error)

type PublicKey

type PublicKey interface {
	sc.Encodable
	SignatureType() sc.U8
}

type PublicKeyType

type PublicKeyType = sc.U8
const (
	PublicKeyEd25519 PublicKeyType = iota
	PublicKeySr25519
	PublicKeyEcdsa
)

type RawOrigin

type RawOrigin struct {
	sc.VaryingData
}

func DecodeRawOrigin

func DecodeRawOrigin(buffer *bytes.Buffer) (RawOrigin, error)

func NewRawOriginNone

func NewRawOriginNone() RawOrigin

func NewRawOriginRoot

func NewRawOriginRoot() RawOrigin

func NewRawOriginSigned

func NewRawOriginSigned(address AccountId) RawOrigin

func RawOriginFrom

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

func (RawOrigin) AsSigned

func (o RawOrigin) AsSigned() (AccountId, error)

func (RawOrigin) IsNoneOrigin

func (o RawOrigin) IsNoneOrigin() bool

func (RawOrigin) IsRootOrigin

func (o RawOrigin) IsRootOrigin() bool

func (RawOrigin) IsSignedOrigin

func (o RawOrigin) IsSignedOrigin() bool

type Reasons

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

type RefCount

type RefCount = sc.U32

type RuntimeApiMetadata

type RuntimeApiMetadata struct {
	Name    sc.Str
	Methods sc.Sequence[RuntimeApiMethodMetadata]
	Docs    sc.Sequence[sc.Str]
}

func DecodeRuntimeApiMetadata

func DecodeRuntimeApiMetadata(buffer *bytes.Buffer) (RuntimeApiMetadata, error)

func (RuntimeApiMetadata) Bytes

func (ram RuntimeApiMetadata) Bytes() []byte

func (RuntimeApiMetadata) Encode

func (ram RuntimeApiMetadata) Encode(buffer *bytes.Buffer) error

type RuntimeApiMethodMetadata

type RuntimeApiMethodMetadata struct {
	Name   sc.Str
	Inputs sc.Sequence[RuntimeApiMethodParamMetadata]
	Output sc.Compact
	Docs   sc.Sequence[sc.Str]
}

func DecodeRuntimeApiMethodMetadata

func DecodeRuntimeApiMethodMetadata(buffer *bytes.Buffer) (RuntimeApiMethodMetadata, error)

func (RuntimeApiMethodMetadata) Bytes

func (ramm RuntimeApiMethodMetadata) Bytes() []byte

func (RuntimeApiMethodMetadata) Encode

func (ramm RuntimeApiMethodMetadata) Encode(buffer *bytes.Buffer) error

type RuntimeApiMethodParamMetadata

type RuntimeApiMethodParamMetadata struct {
	Name sc.Str
	Type sc.Compact
}

func DecodeRuntimeApiMethodParamMetadata

func DecodeRuntimeApiMethodParamMetadata(buffer *bytes.Buffer) (RuntimeApiMethodParamMetadata, error)

func (RuntimeApiMethodParamMetadata) Bytes

func (rampm RuntimeApiMethodParamMetadata) Bytes() []byte

func (RuntimeApiMethodParamMetadata) Encode

func (rampm RuntimeApiMethodParamMetadata) Encode(buffer *bytes.Buffer) error

type RuntimeApiModule

type RuntimeApiModule interface {
	Metadata() RuntimeApiMetadata
}

type RuntimeDbWeight

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

RuntimeDbWeight is 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) Docs

func (dbw RuntimeDbWeight) Docs() string

func (RuntimeDbWeight) Encode

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

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, error)

func (RuntimeDispatchInfo) Bytes

func (rdi RuntimeDispatchInfo) Bytes() []byte

func (RuntimeDispatchInfo) Encode

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

type RuntimeMetadataV14

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

func DecodeRuntimeMetadataV14

func DecodeRuntimeMetadataV14(buffer *bytes.Buffer) (RuntimeMetadataV14, error)

func (RuntimeMetadataV14) Bytes

func (rm RuntimeMetadataV14) Bytes() []byte

func (RuntimeMetadataV14) Encode

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

type RuntimeMetadataV15

type RuntimeMetadataV15 struct {
	Types      sc.Sequence[MetadataType]
	Modules    sc.Sequence[MetadataModuleV15]
	Extrinsic  MetadataExtrinsicV15
	Type       sc.Compact
	Apis       sc.Sequence[RuntimeApiMetadata]
	OuterEnums OuterEnums
	Custom     CustomMetadata
}

func DecodeRuntimeMetadataV15

func DecodeRuntimeMetadataV15(buffer *bytes.Buffer) (RuntimeMetadataV15, error)

func (RuntimeMetadataV15) Bytes

func (rm RuntimeMetadataV15) Bytes() []byte

func (RuntimeMetadataV15) Encode

func (rm RuntimeMetadataV15) Encode(buffer *bytes.Buffer) error

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, error)

func (RuntimeVersion) Bytes

func (rv RuntimeVersion) Bytes() []byte

func (RuntimeVersion) Docs

func (rv RuntimeVersion) Docs() string

func (RuntimeVersion) Encode

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

func (*RuntimeVersion) SetApis

func (rv *RuntimeVersion) SetApis(apis sc.Sequence[ApiItem])

type Session

type Session interface {
	KeyType() PublicKeyType
	KeyTypeId() [4]byte
}

Session provides the key type and id of a module, which has a session.

type SessionKey

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

func DecodeSessionKey

func DecodeSessionKey(buffer *bytes.Buffer) (SessionKey, error)

func NewSessionKey

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

func NewSessionKeyFromBytes

func NewSessionKeyFromBytes(key []byte, typeId sc.FixedSequence[sc.U8]) SessionKey

func (SessionKey) Bytes

func (sk SessionKey) Bytes() []byte

func (SessionKey) Encode

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

type SignatureEcdsa

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

func DecodeSignatureEcdsa

func DecodeSignatureEcdsa(buffer *bytes.Buffer) (SignatureEcdsa, error)

func NewSignatureEcdsa

func NewSignatureEcdsa(values ...sc.U8) SignatureEcdsa

func (SignatureEcdsa) Bytes

func (s SignatureEcdsa) Bytes() []byte

func (SignatureEcdsa) Encode

func (s SignatureEcdsa) Encode(buffer *bytes.Buffer) error

type SignatureEd25519

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

func DecodeSignatureEd25519

func DecodeSignatureEd25519(buffer *bytes.Buffer) (SignatureEd25519, error)

func NewSignatureEd25519

func NewSignatureEd25519(values ...sc.U8) SignatureEd25519

func (SignatureEd25519) Bytes

func (s SignatureEd25519) Bytes() []byte

func (SignatureEd25519) Encode

func (s SignatureEd25519) Encode(buffer *bytes.Buffer) error

type SignatureSr25519

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

func DecodeSignatureSr25519

func DecodeSignatureSr25519(buffer *bytes.Buffer) (SignatureSr25519, error)

func NewSignatureSr25519

func NewSignatureSr25519(values ...sc.U8) SignatureSr25519

func (SignatureSr25519) Bytes

func (s SignatureSr25519) Bytes() []byte

func (SignatureSr25519) Encode

func (s SignatureSr25519) Encode(buffer *bytes.Buffer) error

type SignedExtension

type SignedExtension interface {
	sc.Encodable

	Decode(buffer *bytes.Buffer) error

	DeepCopy() SignedExtension

	// Construct any additional data that should be in the signed payload of the transaction. Can
	// also perform any pre-signature-verification checks and return an error if needed.
	AdditionalSigned() (AdditionalSigned, error)

	// Validate a signed transaction for the transaction queue.
	//
	// This function can be called frequently by the transaction queue,
	// to obtain transaction validity against current state.
	// It should perform all checks that determine a valid transaction,
	// that can pay for its execution and quickly eliminate ones
	// that are stale or incorrect.
	//
	// Make sure to perform the same checks in `pre_dispatch` function.
	Validate(who AccountId, call Call, info *DispatchInfo, length sc.Compact) (ValidTransaction, error)

	// Do any pre-flight stuff for a signed transaction.
	//
	// Make sure to perform the same checks as in [`Self::validate`].
	PreDispatch(who AccountId, call Call, info *DispatchInfo, length sc.Compact) (Pre, error)

	// Validate an unsigned transaction for the transaction queue.
	//
	// This function can be called frequently by the transaction queue
	// to obtain transaction validity against current state.
	// It should perform all checks that determine a valid unsigned transaction,
	// and quickly eliminate ones that are stale or incorrect.
	//
	// Make sure to perform the same checks in `pre_dispatch_unsigned` function.
	ValidateUnsigned(call Call, info *DispatchInfo, length sc.Compact) (ValidTransaction, error)

	// Do any pre-flight stuff for a unsigned transaction.
	//
	// Note this function by default delegates to `validate_unsigned`, so that
	// all checks performed for the transaction queue are also performed during
	// the dispatch phase (applying the extrinsic).
	//
	// If you ever override this function, you need to make sure to always
	// perform the same validation as in `validate_unsigned`.
	PreDispatchUnsigned(call Call, info *DispatchInfo, length sc.Compact) error

	// Do any post-flight stuff for an extrinsic.
	//
	// If the transaction is signed, then `_pre` will contain the output of `pre_dispatch`,
	// and `None` otherwise.
	//
	// This gets given the `DispatchResult` `_result` from the extrinsic and can, if desired,
	// introduce a `TransactionValidityError`, causing the block to become invalid for including
	// it.
	//
	// WARNING: It is dangerous to return an error here. To do so will fundamentally invalidate the
	// transaction and any block that it is included in, causing the block author to not be
	// compensated for their work in validating the transaction or producing the block so far.
	//
	// It can only be used safely when you *know* that the extrinsic is one that can only be
	// introduced by the current block author; generally this implies that it is an inherent and
	// will come from either an offchain-worker or via `InherentData`.(
	PostDispatch(pre sc.Option[Pre], info *DispatchInfo, postInfo *PostDispatchInfo, length sc.Compact, dispatchErr error) error

	// ModulePath Returns the path of the module where the extension is located in. E.g. frame_system, frame_transaction_payment
	ModulePath() string
}

SignedExtension - Means by which a transaction may be extended. This type embodies both the data and the logic that should be additionally associated with the transaction. It should be plain old data.

type SignedExtra

type SignedExtra interface {
	sc.Encodable

	Decode(buffer *bytes.Buffer)
	DeepCopy() SignedExtra

	AdditionalSigned() (AdditionalSigned, error)
	Validate(who AccountId, call Call, info *DispatchInfo, length sc.Compact) (ValidTransaction, error)
	ValidateUnsigned(call Call, info *DispatchInfo, length sc.Compact) (ValidTransaction, error)
	PreDispatch(who AccountId, call Call, info *DispatchInfo, length sc.Compact) (sc.Sequence[Pre], error)
	PreDispatchUnsigned(call Call, info *DispatchInfo, length sc.Compact) error
	PostDispatch(pre sc.Option[sc.Sequence[Pre]], info *DispatchInfo, postInfo *PostDispatchInfo, length sc.Compact, dispatchErr error) error

	Metadata() sc.Sequence[MetadataSignedExtension]
}

func NewSignedExtra

func NewSignedExtra(checks []SignedExtension, mdGenerator *MetadataTypeGenerator) SignedExtra

type SignedPayload

type SignedPayload interface {
	sc.Encodable

	AdditionalSigned() AdditionalSigned
	Call() Call
	Extra() SignedExtra
}

func NewSignedPayload

func NewSignedPayload(call Call, extra SignedExtra) (SignedPayload, error)

NewSignedPayload creates a new `SignedPayload`. It may fail if `additional_signed` of `Extra` is not available.

type Sr25519PublicKey

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

func DecodeSr25519PublicKey

func DecodeSr25519PublicKey(buffer *bytes.Buffer) (Sr25519PublicKey, error)

func NewSr25519PublicKey

func NewSr25519PublicKey(values ...sc.U8) (Sr25519PublicKey, error)

func (Sr25519PublicKey) Bytes

func (s Sr25519PublicKey) Bytes() []byte

func (Sr25519PublicKey) Encode

func (s Sr25519PublicKey) Encode(buffer *bytes.Buffer) error

func (Sr25519PublicKey) SignatureType

func (s Sr25519PublicKey) SignatureType() sc.U8

type StoredMap

type StoredMap interface {
	EventDepositor
	Get(key AccountId) (AccountInfo, error)
	CanDecProviders(who AccountId) (bool, error)
	DecConsumers(who AccountId) error
	DecProviders(who AccountId) (DecRefStatus, error)
	IncConsumers(who AccountId) error
	IncConsumersWithoutLimit(who AccountId) error
	IncProviders(who AccountId) (IncRefStatus, error)
	Insert(who AccountId, data AccountData) (sc.Encodable, error)
	TryMutateExists(who AccountId, f func(who *AccountData) (sc.Encodable, error)) (sc.Encodable, error)
}

type TimestampError

type TimestampError struct {
	sc.VaryingData
}

func NewTimestampErrorInvalid

func NewTimestampErrorInvalid() TimestampError

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, error)

func NewTokenErrorBelowMinimum

func NewTokenErrorBelowMinimum() TokenError

func NewTokenErrorBlocked

func NewTokenErrorBlocked() TokenError

func NewTokenErrorCannotCreate

func NewTokenErrorCannotCreate() TokenError

func NewTokenErrorCannotCreateHold

func NewTokenErrorCannotCreateHold() TokenError

func NewTokenErrorFrozen

func NewTokenErrorFrozen() TokenError

func NewTokenErrorFundsUnavailable

func NewTokenErrorFundsUnavailable() TokenError

func NewTokenErrorNotExpendable

func NewTokenErrorNotExpendable() TokenError

func NewTokenErrorOnlyProvider

func NewTokenErrorOnlyProvider() TokenError

func NewTokenErrorUnknownAsset

func NewTokenErrorUnknownAsset() TokenError

func NewTokenErrorUnsupported

func NewTokenErrorUnsupported() TokenError

func (TokenError) Bytes

func (err TokenError) Bytes() []byte

func (TokenError) Encode

func (err TokenError) Encode(buffer *bytes.Buffer) error

func (TokenError) Error

func (err TokenError) Error() string

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, error)

func NewTransactionSourceExternal

func NewTransactionSourceExternal() TransactionSource

func NewTransactionSourceInBlock

func NewTransactionSourceInBlock() TransactionSource

func NewTransactionSourceLocal

func NewTransactionSourceLocal() TransactionSource

func (TransactionSource) Bytes

func (ts TransactionSource) Bytes() []byte

func (TransactionSource) Encode

func (ts TransactionSource) Encode(buffer *bytes.Buffer) error

func (TransactionSource) MetadataDefinition

func (ts TransactionSource) MetadataDefinition() *MetadataTypeDefinition

type TransactionTag

type TransactionTag = sc.Sequence[sc.U8]

type TransactionValidityError

type TransactionValidityError struct {
	sc.VaryingData
}

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

func DecodeTransactionValidityError

func DecodeTransactionValidityError(buffer *bytes.Buffer) (TransactionValidityError, error)

func (TransactionValidityError) Encode

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

func (TransactionValidityError) Error

func (err TransactionValidityError) Error() string

func (TransactionValidityError) MetadataDefinition

func (e TransactionValidityError) MetadataDefinition(typesInvalidTxId int, typesUnknownTxId int) *MetadataTypeDefinition

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, error)

func NewTransactionValidityResult

func NewTransactionValidityResult(value sc.Encodable) (TransactionValidityResult, error)

func (TransactionValidityResult) AsValidTransaction

func (r TransactionValidityResult) AsValidTransaction() (ValidTransaction, error)

func (TransactionValidityResult) Bytes

func (r TransactionValidityResult) Bytes() []byte

func (TransactionValidityResult) Encode

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

func (TransactionValidityResult) IsValidTransaction

func (r TransactionValidityResult) IsValidTransaction() bool

func (TransactionValidityResult) MetadataDefinition

func (r TransactionValidityResult) MetadataDefinition(typesValidTransactionId int, typesValidityErrorId int) *MetadataTypeDefinition

type TransactionalError

type TransactionalError sc.VaryingData

func DecodeTransactionalError

func DecodeTransactionalError(buffer *bytes.Buffer) (TransactionalError, error)

func NewTransactionalErrorLimitReached

func NewTransactionalErrorLimitReached() TransactionalError

func NewTransactionalErrorNoLayer

func NewTransactionalErrorNoLayer() TransactionalError

func (TransactionalError) Bytes

func (err TransactionalError) Bytes() []byte

func (TransactionalError) Encode

func (err TransactionalError) Encode(buffer *bytes.Buffer) error

func (TransactionalError) Error

func (err TransactionalError) Error() string

type Tuple2U64

type Tuple2U64 struct {
	First  sc.U64
	Second sc.U64
}

func DecodeTuple2U64

func DecodeTuple2U64(buffer *bytes.Buffer) (Tuple2U64, error)

func (Tuple2U64) Bytes

func (t Tuple2U64) Bytes() []byte

func (Tuple2U64) Encode

func (t Tuple2U64) Encode(buffer *bytes.Buffer) error

type UncheckedExtrinsic

type UncheckedExtrinsic interface {
	sc.Encodable

	Signature() sc.Option[ExtrinsicSignature]
	Function() Call
	Extra() SignedExtra

	IsSigned() bool
	Check() (CheckedExtrinsic, error)
}

type UnknownTransaction

type UnknownTransaction struct {
	sc.VaryingData
}

func DecodeUnknownTransaction

func DecodeUnknownTransaction(buffer *bytes.Buffer) (UnknownTransaction, error)

func NewUnknownTransactionCannotLookup

func NewUnknownTransactionCannotLookup() UnknownTransaction

func NewUnknownTransactionCustomUnknownTransaction

func NewUnknownTransactionCustomUnknownTransaction(unknown sc.U8) UnknownTransaction

func NewUnknownTransactionNoUnsignedValidator

func NewUnknownTransactionNoUnsignedValidator() UnknownTransaction

func (UnknownTransaction) Error

func (err UnknownTransaction) Error() string

func (UnknownTransaction) MetadataDefinition

func (err UnknownTransaction) MetadataDefinition() *MetadataTypeDefinition

type UnsignedValidator

type UnsignedValidator interface {
	// PreDispatch validates the call right before dispatch.
	//
	// This method should be used to prevent transactions already in the pool
	// (i.e. passing [`validate_unsigned`](Self::validate_unsigned)) from being included in blocks
	// in case they became invalid since being added to the pool.
	//
	// By default it's a good idea to call [`validate_unsigned`](Self::validate_unsigned) from
	// within this function again to make sure we never include an invalid transaction. Otherwise
	// the implementation of the call or this method will need to provide proper validation to
	// ensure that the transaction is valid.
	//
	// Changes made to storage *WILL* be persisted if the call returns `Ok`.
	PreDispatch(call Call) (ok sc.Empty, err error)

	// ValidateUnsigned returns the validity of the call
	//
	// This method has no side-effects. It merely checks whether the call would be rejected
	// by the runtime in an unsigned extrinsic.
	//
	// The validity checks should be as lightweight as possible because every node will execute
	// this code before the unsigned extrinsic enters the transaction pool and also periodically
	// afterwards to ensure the validity. To prevent dos-ing a network with unsigned
	// extrinsics, these validity checks should include some checks around uniqueness, for example,
	// like checking that the unsigned extrinsic was send by an authority in the active set.
	//
	// Changes made to storage should be discarded by caller.
	ValidateUnsigned(source TransactionSource, call Call) (ok ValidTransaction, err error)
}

UnsignedValidator provides validation for unsigned extrinsics.

This trait provides two functions [`pre_dispatch`](Self::pre_dispatch) and [`validate_unsigned`](Self::validate_unsigned). The [`pre_dispatch`](Self::pre_dispatch) function is called right before dispatching the call wrapped by an unsigned extrinsic. The [`validate_unsigned`](Self::validate_unsigned) function is mainly being used in the context of the transaction pool to check the validity of the call wrapped by an unsigned extrinsic.

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, error)

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

type Validator

type Validator struct {
	AccountId   AccountId
	AuthorityId Sr25519PublicKey
}

func DecodeValidator

func DecodeValidator(buffer *bytes.Buffer) (Validator, error)

func (Validator) Bytes

func (v Validator) Bytes() []byte

func (Validator) Encode

func (v Validator) Encode(buffer *bytes.Buffer) error

type VrfSignature

type VrfSignature struct {
	PreOutput sc.FixedSequence[sc.U8]
	Proof     sc.FixedSequence[sc.U8]
}

VRF signature data

func DecodeVrfSignature

func DecodeVrfSignature(buffer *bytes.Buffer) (VrfSignature, error)

func NewVrfSignature

func NewVrfSignature(output, proof sc.FixedSequence[sc.U8]) (VrfSignature, error)

func (VrfSignature) Bytes

func (s VrfSignature) Bytes() []byte

func (VrfSignature) Encode

func (s VrfSignature) Encode(buffer *bytes.Buffer) error

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, error)

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

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
}

type WeightsPerClass

type WeightsPerClass struct {
	// Base weight of single extrinsic of given class.
	BaseExtrinsic Weight

	// Maximal weight of single extrinsic. Should NOT include `base_extrinsic` cost.
	//
	// `None` indicates that this class of extrinsics doesn't have a limit.
	MaxExtrinsic sc.Option[Weight]

	// Block maximal total weight for all extrinsics of given class.
	//
	// `None` indicates that weight sum of this class of extrinsics is not
	// restricted. Use this value carefully, since it might produce heavily oversized
	// blocks.
	//
	// In the worst case, the total weight consumed by the class is going to be:
	// `MAX(max_total) + MAX(reserved)`.
	MaxTotal sc.Option[Weight]

	// Block reserved allowance for all extrinsics of a particular class.
	//
	// Setting to `None` indicates that extrinsics of that class are allowed
	// to go over total block weight (but at most `max_total` for that class).
	// Setting to `Some(x)` guarantees that at least `x` weight of particular class
	// is processed in every block.
	Reserved sc.Option[Weight]
}

WeightsPerClass `DispatchClass`-specific weight configuration.

func DecodeWeightsPerClass

func DecodeWeightsPerClass(buffer *bytes.Buffer) (WeightsPerClass, error)

func (WeightsPerClass) Bytes

func (cl WeightsPerClass) Bytes() []byte

func (WeightsPerClass) Encode

func (cl WeightsPerClass) Encode(buffer *bytes.Buffer) error

Source Files

Jump to

Keyboard shortcuts

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