const approveInfo = await sdk.checkApprove({
blockchain: 'ETH',
tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
walletAddress: '0xYourWallet',
spenderAddress: swapData.transaction.approvalAddress!,
amount: '500', // 500 USDC
});
if (approveInfo.needApprove) {
console.log('Approval needed:', approveInfo.message);
// Send the approval transaction
const approveTx = await signer.sendTransaction({
to: approveInfo.transaction!.to,
data: approveInfo.transaction!.data,
});
await approveTx.wait();
console.log('Approved. Now proceed with the swap.');
} else {
console.log('No approval needed:', approveInfo.message);
}