Skip to main content

Utility

Calls

asDerivative

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.

Namespace

api.tx.utility.asDerivative

Type

function asDerivative(
index: u16,
call: Call
)

batch

Send a batch of dispatch calls.

May be called from any origin.

  • 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 call are dispatch without checking origin filter. (This includes bypassing frame_system::Config::BaseCallFilter).

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.

Namespace

api.tx.utility.batch

Type

function batch(
calls: Vec<Call>
)

batchAll

Send 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.

  • 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 call are dispatch without checking origin filter. (This includes bypassing frame_system::Config::BaseCallFilter).

Namespace

api.tx.utility.batchAll

Type

function batchAll(
calls: Vec<Call>
)

dispatchAs

Dispatches a function call with a provided origin.

The dispatch origin for this call must be Root.

Namespace

api.tx.utility.dispatchAs

Type

function dispatchAs(
as_origin: SeedRuntimeOriginCaller,
call: Call
)

forceBatch

Send a batch of dispatch calls. Unlike batch, it allows errors and won't interrupt.

May be called from any origin.

  • 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 call are dispatch without checking origin filter. (This includes bypassing frame_system::Config::BaseCallFilter).

Namespace

api.tx.utility.forceBatch

Type

function forceBatch(
calls: Vec<Call>
)

undefined## Events

BatchCompleted

Batch of dispatches completed fully with no error.

Namespace

api.events.utility.BatchCompleted

Type

type BatchCompleted = {

}

BatchCompletedWithErrors

Batch of dispatches completed but has errors.

Namespace

api.events.utility.BatchCompletedWithErrors

Type

type BatchCompletedWithErrors = {

}

BatchInterrupted

Batch of dispatches did not complete fully. Index of first failing dispatch given, as well as the error.

Namespace

api.events.utility.BatchInterrupted

Type

type BatchInterrupted = {
index: u32,
error: SpRuntimeDispatchError
}

DispatchedAs

A call was dispatched.

Namespace

api.events.utility.DispatchedAs

Type

type DispatchedAs = {
result: Result<Null, SpRuntimeDispatchError>
}

ItemCompleted

A single item within a Batch of dispatches has completed with no error.

Namespace

api.events.utility.ItemCompleted

Type

type ItemCompleted = {

}

ItemFailed

A single item within a Batch of dispatches has completed with error.

Namespace

api.events.utility.ItemFailed

Type

type ItemFailed = {
error: SpRuntimeDispatchError
}

Errors

TooManyCalls

Too many calls batched.

Namespace

api.errors.utility.TooManyCalls

Constants

batchedCallsLimit

The limit on the number of batched calls.

Namespace

api.consts.utility.batchedCallsLimit

Type

type batchedCallsLimit = u32