diff --git a/src/swap/defi/uni-v2-based/plugins/spookySwap.ts b/src/swap/defi/uni-v2-based/plugins/spookySwap.ts index 033d1b69..138f73b9 100644 --- a/src/swap/defi/uni-v2-based/plugins/spookySwap.ts +++ b/src/swap/defi/uni-v2-based/plugins/spookySwap.ts @@ -104,14 +104,17 @@ export function makeSpookySwapPlugin( const fromAddress = (await fromWallet.getReceiveAddress()).publicAddress // toEdgeUnsignedTxs - const edgeSpendInfos = swapTxs.map(swapTx => { + const edgeSpendInfos = swapTxs.map((swapTx, i) => { // Convert to our spendInfo const edgeSpendInfo: EdgeSpendInfo = { currencyCode: request.fromCurrencyCode, // what is being sent out, only if token. Blank if not token spendTargets: [ { memo: swapTx.data, - nativeAmount: swapTx.value != null ? swapTx.value.toString() : '0', // biggy/number string integer + nativeAmount: + swapTxs.length === 2 && i === 0 + ? '0' // approval transactions don't have a value + : amountToSwap, publicAddress: swapTx.to } ], diff --git a/src/swap/defi/uni-v2-based/plugins/tombSwap.ts b/src/swap/defi/uni-v2-based/plugins/tombSwap.ts index 1cfe0df5..420aaec0 100644 --- a/src/swap/defi/uni-v2-based/plugins/tombSwap.ts +++ b/src/swap/defi/uni-v2-based/plugins/tombSwap.ts @@ -104,14 +104,17 @@ export function makeTombSwapPlugin( const fromAddress = (await fromWallet.getReceiveAddress()).publicAddress // toEdgeUnsignedTxs - const edgeSpendInfos = swapTxs.map(swapTx => { + const edgeSpendInfos = swapTxs.map((swapTx, i) => { // Convert to our spendInfo const edgeSpendInfo: EdgeSpendInfo = { currencyCode: request.fromCurrencyCode, // what is being sent out, only if token. Blank if not token spendTargets: [ { memo: swapTx.data, - nativeAmount: swapTx.value != null ? swapTx.value.toString() : '0', // biggy/number string integer + nativeAmount: + swapTxs.length === 2 && i === 0 + ? '0' // approval transactions don't have a value + : amountToSwap, publicAddress: swapTx.to } ], diff --git a/src/swap/defi/uni-v2-based/plugins/velodrome.ts b/src/swap/defi/uni-v2-based/plugins/velodrome.ts index 950e08b0..c09929fc 100644 --- a/src/swap/defi/uni-v2-based/plugins/velodrome.ts +++ b/src/swap/defi/uni-v2-based/plugins/velodrome.ts @@ -117,14 +117,17 @@ export function makeVelodromePlugin( ) const fromAddress = (await fromWallet.getReceiveAddress()).publicAddress // toEdgeUnsignedTxs - const edgeSpendInfos = swapTxs.map(swapTx => { + const edgeSpendInfos = swapTxs.map((swapTx, i) => { // Convert to our spendInfo const edgeSpendInfo: EdgeSpendInfo = { currencyCode: request.fromCurrencyCode, // what is being sent out, only if token. Blank if not token spendTargets: [ { memo: swapTx.data, - nativeAmount: swapTx.value != null ? swapTx.value.toString() : '0', // biggy/number string integer + nativeAmount: + swapTxs.length === 2 && i === 0 + ? '0' // approval transactions don't have a value + : amountToSwap, publicAddress: swapTx.to } ],