nft-swap-sdk icon indicating copy to clipboard operation
nft-swap-sdk copied to clipboard

[v0.32.0] loadApprovalStatusForOrder still forcing user to choose custom spending cap

Open tyh-dev opened this issue 2 years ago • 2 comments

I just upgraded to v0.32.0 and read the release notes. I thought it was supposed to now set the minimal viable approval now but I still get MetaMask asking to set a custom spending cap for WETH or choose max.

Screenshot 2023-06-29 at 4 11 18 AM

Here is part of my code for V4 SDK:

const approvalStatusForTaker = await swapSdkV4?.loadApprovalStatusForOrder(order_data, 'TAKER');

if (!approvalStatusForTaker?.contractApproved) {
    const approvalTx = await swapSdkV4?.approveTokenOrNftByAsset(ethToSwapTaker, walletAddressTaker);
    const approvalTxReceipt = await approvalTx?.wait();
}

Is this supposed to happen? It seems the same as the previous release. Thanks!

tyh-dev avatar Jun 29 '23 08:06 tyh-dev

Facing the same issue here, although i'm using V3 of the SDK. It looks like if the user approves anything other than default i.e. a custom amount or using MAX, the return value from loadApprovalStatus still returns false.

wizardlabsxyz avatar Aug 09 '23 20:08 wizardlabsxyz

which ERC20 are you guys using? I had this issue, with USDT, and I notice that they have a different way to manage approval, with a spending cap and the allowance returns a number instead of a flag, for this case I used the contract directly to check the remaining spending cap

castrolol avatar Aug 16 '23 11:08 castrolol