Skip to content
solidity
import "solidity-scale-codec/src/Xcm/v5/Instruction/InstructionCodec.sol";

InstructionCodec

Kind: library

Functions

encode(struct Instruction instruction)

solidity
function encode(struct Instruction instruction) internal pure returns (bytes)

Encodes an `Instruction` into SCALE bytes.

encodedSizeAt(bytes data, uint256 offset)

solidity
function encodedSizeAt(bytes data, uint256 offset) internal pure returns (uint256)

Returns the number of bytes that an `Instruction` occupies when SCALE-encoded.

decode(bytes data)

solidity
function decode(bytes data) internal pure returns (struct Instruction, uint256)

Decodes an `Instruction` from SCALE bytes starting at the beginning.

decodeAt(bytes data, uint256 offset)

solidity
function decodeAt(bytes data, uint256 offset) internal pure returns (struct Instruction, uint256)

Decodes an `Instruction` from SCALE bytes starting at a given offset.

asWithdrawAsset(struct Instruction instruction)

solidity
function asWithdrawAsset(struct Instruction instruction) internal pure returns (struct WithdrawAssetParams)

Extracts the decoded `WithdrawAssetParams` from a `WithdrawAsset` instruction. Reverts if the instruction is not of type `WithdrawAsset`.

asReserveAssetDeposited(struct Instruction instruction)

solidity
function asReserveAssetDeposited(struct Instruction instruction) internal pure returns (struct ReserveAssetDepositedParams)

Extracts the decoded `ReserveAssetDepositedParams` from a `ReserveAssetDeposited` instruction. Reverts if the instruction is not of type `ReserveAssetDeposited`.

asReceiveTeleportedAsset(struct Instruction instruction)

solidity
function asReceiveTeleportedAsset(struct Instruction instruction) internal pure returns (struct ReceiveTeleportedAssetParams)

Extracts the decoded `ReceiveTeleportedAssetParams` from a `ReceiveTeleportedAsset` instruction. Reverts if the instruction is not of type `ReceiveTeleportedAsset`.

asQueryResponse(struct Instruction instruction)

solidity
function asQueryResponse(struct Instruction instruction) internal pure returns (struct QueryResponseParams)

Extracts the decoded `QueryResponseParams` from a `QueryResponse` instruction. Reverts if the instruction is not of type `QueryResponse`.

asTransferAsset(struct Instruction instruction)

solidity
function asTransferAsset(struct Instruction instruction) internal pure returns (struct TransferAssetParams)

Extracts the decoded `TransferAssetParams` from a `TransferAsset` instruction. Reverts if the instruction is not of type `TransferAsset`.

asTransferReserveAsset(struct Instruction instruction)

solidity
function asTransferReserveAsset(struct Instruction instruction) internal pure returns (struct TransferReserveAssetParams)

Extracts the decoded `TransferReserveAssetParams` from a `TransferReserveAsset` instruction. Reverts if the instruction is not of type `TransferReserveAsset`.

asTransact(struct Instruction instruction)

solidity
function asTransact(struct Instruction instruction) internal pure returns (struct TransactParams)

Extracts the decoded `TransactParams` from a `Transact` instruction. Reverts if the instruction is not of type `Transact`.

asHrmpNewChannelOpenRequest(struct Instruction instruction)

solidity
function asHrmpNewChannelOpenRequest(struct Instruction instruction) internal pure returns (struct HrmpNewChannelOpenRequestParams)

Extracts the decoded `HrmpNewChannelOpenRequestParams` from a `HrmpNewChannelOpenRequest` instruction. Reverts if the instruction is not of type `HrmpNewChannelOpenRequest`.

asHrmpChannelAccepted(struct Instruction instruction)

solidity
function asHrmpChannelAccepted(struct Instruction instruction) internal pure returns (struct HrmpChannelAcceptedParams)

Extracts the decoded `HrmpChannelAcceptedParams` from a `HrmpChannelAccepted` instruction. Reverts if the instruction is not of type `HrmpChannelAccepted`.

asHrmpChannelClosing(struct Instruction instruction)

solidity
function asHrmpChannelClosing(struct Instruction instruction) internal pure returns (struct HrmpChannelClosingParams)

Extracts the decoded `HrmpChannelClosingParams` from a `HrmpChannelClosing` instruction. Reverts if the instruction is not of type `HrmpChannelClosing`.

asClearOrigin(struct Instruction instruction)

solidity
function asClearOrigin(struct Instruction instruction) internal pure

Validates a `ClearOrigin` instruction payload. Reverts if the instruction is not of type `ClearOrigin` or the payload is invalid.

asDescendOrigin(struct Instruction instruction)

solidity
function asDescendOrigin(struct Instruction instruction) internal pure returns (struct DescendOriginParams)

Extracts the decoded `DescendOriginParams` from a `DescendOrigin` instruction. Reverts if the instruction is not of type `DescendOrigin`.

asReportError(struct Instruction instruction)

solidity
function asReportError(struct Instruction instruction) internal pure returns (struct ReportErrorParams)

Extracts the decoded `ReportErrorParams` from a `ReportError` instruction. Reverts if the instruction is not of type `ReportError`.

asDepositAsset(struct Instruction instruction)

solidity
function asDepositAsset(struct Instruction instruction) internal pure returns (struct DepositAssetParams)

Extracts the decoded `DepositAssetParams` from a `DepositAsset` instruction. Reverts if the instruction is not of type `DepositAsset`.

asDepositReserveAsset(struct Instruction instruction)

solidity
function asDepositReserveAsset(struct Instruction instruction) internal pure returns (struct DepositReserveAssetParams)

Extracts the decoded `DepositReserveAssetParams` from a `DepositReserveAsset` instruction. Reverts if the instruction is not of type `DepositReserveAsset`.

asExchangeAsset(struct Instruction instruction)

solidity
function asExchangeAsset(struct Instruction instruction) internal pure returns (struct ExchangeAssetParams)

Extracts the decoded `ExchangeAssetParams` from a `ExchangeAsset` instruction. Reverts if the instruction is not of type `ExchangeAsset`.

asInitiateReserveWithdraw(struct Instruction instruction)

solidity
function asInitiateReserveWithdraw(struct Instruction instruction) internal pure returns (struct InitiateReserveWithdrawParams)

Extracts the decoded `InitiateReserveWithdrawParams` from a `InitiateReserveWithdraw` instruction. Reverts if the instruction is not of type `InitiateReserveWithdraw`.

asInitiateTeleport(struct Instruction instruction)

solidity
function asInitiateTeleport(struct Instruction instruction) internal pure returns (struct InitiateTeleportParams)

Extracts the decoded `InitiateTeleportParams` from a `InitiateTeleport` instruction. Reverts if the instruction is not of type `InitiateTeleport`.

asReportHolding(struct Instruction instruction)

solidity
function asReportHolding(struct Instruction instruction) internal pure returns (struct ReportHoldingParams)

Extracts the decoded `ReportHoldingParams` from a `ReportHolding` instruction. Reverts if the instruction is not of type `ReportHolding`.

asBuyExecution(struct Instruction instruction)

solidity
function asBuyExecution(struct Instruction instruction) internal pure returns (struct BuyExecutionParams)

Extracts the decoded `BuyExecutionParams` from a `BuyExecution` instruction. Reverts if the instruction is not of type `BuyExecution`.

asRefundSurplus(struct Instruction instruction)

solidity
function asRefundSurplus(struct Instruction instruction) internal pure

Validates a `RefundSurplus` instruction payload. Reverts if the instruction is not of type `RefundSurplus` or the payload is invalid.

asSetErrorHandler(struct Instruction instruction)

solidity
function asSetErrorHandler(struct Instruction instruction) internal pure returns (struct SetErrorHandlerParams)

Extracts the decoded `SetErrorHandlerParams` from a `SetErrorHandler` instruction. Reverts if the instruction is not of type `SetErrorHandler`.

asSetAppendix(struct Instruction instruction)

solidity
function asSetAppendix(struct Instruction instruction) internal pure returns (struct SetAppendixParams)

Extracts the decoded `SetAppendixParams` from a `SetAppendix` instruction. Reverts if the instruction is not of type `SetAppendix`.

asClearError(struct Instruction instruction)

solidity
function asClearError(struct Instruction instruction) internal pure

Validates a `ClearError` instruction payload. Reverts if the instruction is not of type `ClearError` or the payload is invalid.

asClaimAsset(struct Instruction instruction)

solidity
function asClaimAsset(struct Instruction instruction) internal pure returns (struct ClaimAssetParams)

Extracts the decoded `ClaimAssetParams` from a `ClaimAsset` instruction. Reverts if the instruction is not of type `ClaimAsset`.

asTrap(struct Instruction instruction)

solidity
function asTrap(struct Instruction instruction) internal pure returns (struct TrapParams)

Extracts the decoded `TrapParams` from a `Trap` instruction. Reverts if the instruction is not of type `Trap`.

asSubscribeVersion(struct Instruction instruction)

solidity
function asSubscribeVersion(struct Instruction instruction) internal pure returns (struct SubscribeVersionParams)

Extracts the decoded `SubscribeVersionParams` from a `SubscribeVersion` instruction. Reverts if the instruction is not of type `SubscribeVersion`.

asUnsubscribeVersion(struct Instruction instruction)

solidity
function asUnsubscribeVersion(struct Instruction instruction) internal pure

Validates a `UnsubscribeVersion` instruction payload. Reverts if the instruction is not of type `UnsubscribeVersion` or the payload is invalid.

asBurnAsset(struct Instruction instruction)

solidity
function asBurnAsset(struct Instruction instruction) internal pure returns (struct BurnAssetParams)

Extracts the decoded `BurnAssetParams` from a `BurnAsset` instruction. Reverts if the instruction is not of type `BurnAsset`.

asExpectAsset(struct Instruction instruction)

solidity
function asExpectAsset(struct Instruction instruction) internal pure returns (struct ExpectAssetParams)

Extracts the decoded `ExpectAssetParams` from a `ExpectAsset` instruction. Reverts if the instruction is not of type `ExpectAsset`.

asExpectOrigin(struct Instruction instruction)

solidity
function asExpectOrigin(struct Instruction instruction) internal pure returns (struct ExpectOriginParams)

Extracts the decoded `ExpectOriginParams` from a `ExpectOrigin` instruction. Reverts if the instruction is not of type `ExpectOrigin`.

asExpectError(struct Instruction instruction)

solidity
function asExpectError(struct Instruction instruction) internal pure returns (struct ExpectErrorParams)

Extracts the decoded `ExpectErrorParams` from a `ExpectError` instruction. Reverts if the instruction is not of type `ExpectError`.

asExpectTransactStatus(struct Instruction instruction)

solidity
function asExpectTransactStatus(struct Instruction instruction) internal pure returns (struct ExpectTransactStatusParams)

Extracts the decoded `ExpectTransactStatusParams` from a `ExpectTransactStatus` instruction. Reverts if the instruction is not of type `ExpectTransactStatus`.

asQueryPallet(struct Instruction instruction)

solidity
function asQueryPallet(struct Instruction instruction) internal pure returns (struct QueryPalletParams)

Extracts the decoded `QueryPalletParams` from a `QueryPallet` instruction. Reverts if the instruction is not of type `QueryPallet`.

asExpectPallet(struct Instruction instruction)

solidity
function asExpectPallet(struct Instruction instruction) internal pure returns (struct ExpectPalletParams)

Extracts the decoded `ExpectPalletParams` from a `ExpectPallet` instruction. Reverts if the instruction is not of type `ExpectPallet`.

asReportTransactStatus(struct Instruction instruction)

solidity
function asReportTransactStatus(struct Instruction instruction) internal pure returns (struct ReportTransactStatusParams)

Extracts the decoded `ReportTransactStatusParams` from a `ReportTransactStatus` instruction. Reverts if the instruction is not of type `ReportTransactStatus`.

asClearTransactStatus(struct Instruction instruction)

solidity
function asClearTransactStatus(struct Instruction instruction) internal pure

Validates a `ClearTransactStatus` instruction payload. Reverts if the instruction is not of type `ClearTransactStatus` or the payload is invalid.

asUniversalOrigin(struct Instruction instruction)

solidity
function asUniversalOrigin(struct Instruction instruction) internal pure returns (struct UniversalOriginParams)

Extracts the decoded `UniversalOriginParams` from a `UniversalOrigin` instruction. Reverts if the instruction is not of type `UniversalOrigin`.

asExportMessage(struct Instruction instruction)

solidity
function asExportMessage(struct Instruction instruction) internal pure returns (struct ExportMessageParams)

Extracts the decoded `ExportMessageParams` from a `ExportMessage` instruction. Reverts if the instruction is not of type `ExportMessage`.

asLockAsset(struct Instruction instruction)

solidity
function asLockAsset(struct Instruction instruction) internal pure returns (struct LockAssetParams)

Extracts the decoded `LockAssetParams` from a `LockAsset` instruction. Reverts if the instruction is not of type `LockAsset`.

asUnlockAsset(struct Instruction instruction)

solidity
function asUnlockAsset(struct Instruction instruction) internal pure returns (struct UnlockAssetParams)

Extracts the decoded `UnlockAssetParams` from a `UnlockAsset` instruction. Reverts if the instruction is not of type `UnlockAsset`.

asNoteUnlockable(struct Instruction instruction)

solidity
function asNoteUnlockable(struct Instruction instruction) internal pure returns (struct NoteUnlockableParams)

Extracts the decoded `NoteUnlockableParams` from a `NoteUnlockable` instruction. Reverts if the instruction is not of type `NoteUnlockable`.

asRequestUnlock(struct Instruction instruction)

solidity
function asRequestUnlock(struct Instruction instruction) internal pure returns (struct RequestUnlockParams)

Extracts the decoded `RequestUnlockParams` from a `RequestUnlock` instruction. Reverts if the instruction is not of type `RequestUnlock`.

asSetFeesMode(struct Instruction instruction)

solidity
function asSetFeesMode(struct Instruction instruction) internal pure returns (struct SetFeesModeParams)

Extracts the decoded `SetFeesModeParams` from a `SetFeesMode` instruction. Reverts if the instruction is not of type `SetFeesMode`.

asSetTopic(struct Instruction instruction)

solidity
function asSetTopic(struct Instruction instruction) internal pure returns (struct SetTopicParams)

Extracts the decoded `SetTopicParams` from a `SetTopic` instruction. Reverts if the instruction is not of type `SetTopic`.

asClearTopic(struct Instruction instruction)

solidity
function asClearTopic(struct Instruction instruction) internal pure

Validates a `ClearTopic` instruction payload. Reverts if the instruction is not of type `ClearTopic` or the payload is invalid.

asAliasOrigin(struct Instruction instruction)

solidity
function asAliasOrigin(struct Instruction instruction) internal pure returns (struct AliasOriginParams)

Extracts the decoded `AliasOriginParams` from a `AliasOrigin` instruction. Reverts if the instruction is not of type `AliasOrigin`.

asUnpaidExecution(struct Instruction instruction)

solidity
function asUnpaidExecution(struct Instruction instruction) internal pure returns (struct UnpaidExecutionParams)

Extracts the decoded `UnpaidExecutionParams` from a `UnpaidExecution` instruction. Reverts if the instruction is not of type `UnpaidExecution`.

asPayFees(struct Instruction instruction)

solidity
function asPayFees(struct Instruction instruction) internal pure returns (struct PayFeesParams)

Extracts the decoded `PayFeesParams` from a `PayFees` instruction. Reverts if the instruction is not of type `PayFees`.

asInitiateTransfer(struct Instruction instruction)

solidity
function asInitiateTransfer(struct Instruction instruction) internal pure returns (struct InitiateTransferParams)

Extracts the decoded `InitiateTransferParams` from a `InitiateTransfer` instruction. Reverts if the instruction is not of type `InitiateTransfer`.

asExecuteWithOrigin(struct Instruction instruction)

solidity
function asExecuteWithOrigin(struct Instruction instruction) internal pure returns (struct ExecuteWithOriginParams)

Extracts the decoded `ExecuteWithOriginParams` from a `ExecuteWithOrigin` instruction. Reverts if the instruction is not of type `ExecuteWithOrigin`.

asSetHints(struct Instruction instruction)

solidity
function asSetHints(struct Instruction instruction) internal pure returns (struct SetHintsParams)

Extracts the decoded `SetHintsParams` from a `SetHints` instruction. Reverts if the instruction is not of type `SetHints`.