component will auto-batch these if the wallet supports it.
+ const calls = [
+ {
+ to: USDC_ADDRESS,
+ abi: erc20Abi,
+ functionName: 'approve',
+ args: [VAULT_ADDRESS, amountBigInt],
+ },
+ {
+ to: VAULT_ADDRESS,
+ abi: VAULT_ABI,
+ functionName: 'deposit',
+ args: [amountBigInt],
+ }
+ ];
+
+ // 2. Off-chain Sync Logic
+ const handleSuccess = async (response: any) => {
+ console.log("Onchain Success:", response);
+
+ // Trigger your backend to re-index immediately
+ await fetch('/api/user/refresh-balance', {
+ method: 'POST',
+ body: JSON.stringify({ txHash: response.transactionReceipts[0].transactionHash })
+ });
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+```
+
+---