Utility::Call

Variant 158 v393

pallet_subtensor_utility::pallet::Call

Contains a variant per dispatchable extrinsic that this pallet has.

About This Type

Call enum for the Call pallet.

Contains all dispatchable functions (extrinsics) for the Call pallet. Each variant represents a different callable function with its parameters.

Variants (8)

IndexNameFieldsDocs
0batchSend a batch of dispatch calls. May be called from any origin except `None`. - `calls`: The calls to be dispatched from the same origin. The number of call must not exceed the constant: `batched_calls_limit` (available in constant metadata). If origin is root then the calls are dispatched without checking origin filter. (This includes bypassing `frame_system::Config::BaseCallFilter`). ## Complexity - O(C) where C is the number of calls to be batched. This will return `Ok` in all circumstances. To determine the success of the batch, an event is deposited. If a call failed and the batch was interrupted, then the `BatchInterrupted` event is deposited, along with the number of successful calls made and the error of the failed call. If all were successful, then the `BatchCompleted` event is deposited.
1as_derivative
index: u16
Send a call through an indexed pseudonym of the sender. Filter from origin are passed along. The call will be dispatched with an origin which use the same filter as the origin of this call. NOTE: If you need to ensure that any account-based filtering is not honored (i.e. because you expect `proxy` to have been used prior in the call stack and you do not want the call restrictions to apply to any sub-accounts), then use `as_multi_threshold_1` in the Multisig pallet instead. NOTE: Prior to version *12, this was called `as_limited_sub`. The dispatch origin for this call must be _Signed_.
2batch_allSend a batch of dispatch calls and atomically execute them. The whole transaction will rollback and fail if any of the calls failed. May be called from any origin except `None`. - `calls`: The calls to be dispatched from the same origin. The number of call must not exceed the constant: `batched_calls_limit` (available in constant metadata). If origin is root then the calls are dispatched without checking origin filter. (This includes bypassing `frame_system::Config::BaseCallFilter`). ## Complexity - O(C) where C is the number of calls to be batched.
3dispatch_as
as_origin: OriginCaller
Dispatches a function call with a provided origin. The dispatch origin for this call must be _Root_. ## Complexity - O(1).
4force_batchSend a batch of dispatch calls. Unlike `batch`, it allows errors and won't interrupt. May be called from any origin except `None`. - `calls`: The calls to be dispatched from the same origin. The number of call must not exceed the constant: `batched_calls_limit` (available in constant metadata). If origin is root then the calls are dispatch without checking origin filter. (This includes bypassing `frame_system::Config::BaseCallFilter`). ## Complexity - O(C) where C is the number of calls to be batched.
5with_weight
weight: Weight
Dispatch a function call with a specified weight. This function does not check the weight of the call, and instead allows the Root origin to specify the weight of the call. The dispatch origin for this call must be _Root_.
6if_else
fallback: RuntimeCall
Dispatch a fallback call in the event the main call fails to execute. May be called from any origin except `None`. This function first attempts to dispatch the `main` call. If the `main` call fails, the `fallback` is attemted. if the fallback is successfully dispatched, the weights of both calls are accumulated and an event containing the main call error is deposited. In the event of a fallback failure the whole call fails with the weights returned. - `main`: The main call to be dispatched. This is the primary action to execute. - `fallback`: The fallback call to be dispatched in case the `main` call fails. ## Dispatch Logic - If the origin is `root`, both the main and fallback calls are executed without applying any origin filters. - If the origin is not `root`, the origin filter is applied to both the `main` and `fallback` calls. ## Use Case - Some use cases might involve submitting a `batch` type call in either main, fallback or both.
7dispatch_as_fallible
as_origin: OriginCaller
Dispatches a function call with a provided origin. Almost the same as [`Pallet::dispatch_as`] but forwards any error of the inner call. The dispatch origin for this call must be _Root_.

SCALE Encoding

Rule
1-byte variant index followed by variant-specific field data. 8 possible variants.
Size
variable (1+ bytes)

Examples

batch = batch(calls)
0x00<field0>
00 Variant index 0 = batch
field 0 calls: Vec<RuntimeCall>
as_derivative = as_derivative(index, call)
0x01<field0><field1>
01 Variant index 1 = as_derivative
field 0 index: u16
field 1 call: RuntimeCall
batch_all = batch_all(calls)
0x02<field0>
02 Variant index 2 = batch_all
field 0 calls: Vec<RuntimeCall>

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode Utility::Call — variant "batch"
const value = registry.createType("Utility::Call", { batch: { calls: 0 } });
console.log("Hex:", value.toHex());

Type Parameters

T

Referenced By (23)

and 3 more...

Also See

Type Information

Type ID
158
Kind
Variant
Path
pallet_subtensor_utility::pallet::Call
Runtime
v393