Biconomy SDK

Sending a Batch of Transactions

one click batching with atomicity
With batching functionality, you can send multiple user actions in a single native transaction on Smart Account.
// Init Smart account instance
const usdcAddress = <USDC TOKEN>
const hyphenLiquidityPoolAddress = <LP_ADDRESS> // spender
// create an array of txs
const txs = []
const erc20Interface = new ethers.utils.Interface([
'function approve(address _to, uint256 _value)'
// Encode an ERC-20 token transfer to recipient of the specified amount
const data = erc20Interface.encodeFunctionData(
'approve', [hyphenLiquidityPoolAddress, amount]
const tx1 = {
to: usdcAddress
data: data
const hyphenLPTx =
await hyphenContract.populateTransaction.addTokenLiquidity(
ethers.BigNumber.from("1000000") // providing liquidity for 1 USDC
const tx2 = {
to: hyphenLiquidityPoolAddress,
// Fee Abstraction and Dispatching
// 1. Gasless
const response = await smartAccount.sendGaslessTransactionBatch({ transactions: txs });
showSuccessMessage(`Transaction sent: ${response.hash}`);
// 2. User Self Refund (Native / ERC20)
const feeQuotes = await smartAccount.prepareRefundTransactionBatch({
transactions: txs,
// Choose a fee quote of your choice provided by the relayer
const transaction = await smartAccount.createRefundTransactionBatch({
transactions: txnArray,
feeQuote: feeQuotes[1],
// optional
let gasLimit: GasLimit = {
hex: "0x1E8480",
type: "hex",
// send transaction internally calls signTransaction and sends it to connected relayer
const txHash = await smartAccount.sendTransaction({
tx: transaction,