Web3 sdk
Batching

You can call several contracts at one using batching

const { address } = useAccount();
 
const batchData = batch({
    contracts: [
        {
            address: payToken.address,
            abi: ERC20,
            functionName: 'approve',
            args: [PAYMENTS_GATEWAY_ADDRESS, cartItemsInfos[0].price],
        },
        {
            address: PAYMENTS_GATEWAY_ADDRESS,
            abi: PAYMENTS_GATEWAY_ABI,
            functionName: 'buy',
            args: [
                recipientAddress,
                payToken.address,
                cartItemsInfos,
                [1],
                userId
            ],
        },
    ],
});
 
const { wait } = await writeContract({
    mode: 'recklesslyUnprepared',
    address: address!,
    abi: BatchFacetABI,
    functionName: 'batch',
    args: [batchData],
});
 

This call triggers batch transaction request window in user wallet. After user approve, contract calls are executed in one transaction