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.
batch method provides developers with capabilities to addExtrinsic, addExtrinsics, batch, batchAll, batchAllWithExtrinsics, and batchWithExtrinsics.
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.
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.
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.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.
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.
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.More examples of the methods above can be found in guides.