Batch
batch()
batch()
Creates a BatchBuilder
class instance, which provides methods to build transactions for utility pallet batch extrinsics. It expects three parameters:
api
: the trnApi to use for interaction.signer
: the signer to use for signing transactions.walletAddress
: the wallet address to use for interaction. Note: It should be the EOA address for the signer, not the FuturePass address.
Example:
The batch
method provides developers with capabilities to addExtrinsic
, addExtrinsics
, batch
, batchAll
, batchAllWithExtrinsics
, and batchWithExtrinsics
.
addExtrinsic()
addExtrinsic()
Adds an extrinsic to be used in a batch()
or batchAll()
call. It expects one parameter:
extrinsic
: the extrinsic to add to the batch.
Example:
addExtrinsics()
addExtrinsics()
Adds multiple extrinsics to be used in a batch()
or batchAll()
call. It expects one parameter:
extrinsics
: an array of extrinsics to add to the batch.
Example:
batch()
batch()
Batch all extrinsics set into a single transaction and sets the base extrinsic to the batch. It has no parameters.
This method will return Ok
in all circumstances. It will batch all extrinsics into a single transaction. It will finalize and succeed regardless of whether any extrinsic in the batch fails.
Example:
batchAll()
batchAll()
Batch all extrinsics set into a single transaction and sets the base extrinsic to the batch all extrinsic (e.g: individually added by addExtrinsic
). It has no parameters.
This method will batch all extrinsics into a single transaction. If any extrinsic fails, the entire transaction will fail.
Example:
batchAllWithExtrinsics()
batchAllWithExtrinsics()
Builds a batch with the provided extrinsics and sets the base extrinsic to the batchAll()
extrinsic. It expects one parameter:
extrinsics
: an array of extrinsics to include in the single transaction.
This method will batch all extrinsics into a single transaction. If any extrinsic fails, the entire transaction will fail.
Example:
batchWithExtrinsics()
batchWithExtrinsics()
Builds a batch with the provided extrinsics and sets the base extrinsic to the batch. It expects one parameter:
extrinsics
: an array of extrinsics to include in the single transaction.
This method will return Ok
in all circumstances. It will batch all extrinsics into a single transaction. It will finalize and succeed regardless of whether any extrinsic in the batch fails.
Example:
More examples of the methods above can be found in Guides.
Last updated