fix don't check allowance when token is native

This commit is contained in:
Steam Deck User
2023-12-13 19:15:50 +04:00
parent 661cce707d
commit 1af36a83ca
2 changed files with 2 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.31",
"version": "0.20.32",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -357,7 +357,7 @@ async function shouldUseExchangeBalance(
additionalTransferAmount = amount;
} else {
additionalTransferAmount = exchangeBalance >= amount ? 0n : amount - exchangeBalance;
if (additionalTransferAmount > exchangeAllowance) {
if (srcToken !== ZeroAddress && additionalTransferAmount > exchangeAllowance) {
throw new Error(
`Not enough allowance to make swap, allowance - ${exchangeAllowance} needed allowance - ${additionalTransferAmount}`
);