From 5b2e403b697625fef06ee35aefd2e3ed699030a4 Mon Sep 17 00:00:00 2001 From: Don Mosites Date: Tue, 1 Oct 2024 10:49:55 +0200 Subject: [PATCH 1/4] delegate to libraries --- tools/libraries/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libraries/package.json b/tools/libraries/package.json index 7afffdee6..b050a65c9 100644 --- a/tools/libraries/package.json +++ b/tools/libraries/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/libraries", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Libraries for Developers", "repository": { "type": "git", @@ -24,6 +24,7 @@ "dependencies": { "@airswap/batch-call": "5.0.0", "@airswap/jsonrpc-client-websocket": "0.0.1", + "@airswap/delegate": "5.0.0", "@airswap/pool": "5.0.0", "@airswap/registry": "5.0.0", "@airswap/staking": "5.0.0", From 28156e5115218a444d35f35162162f643e5ccb91 Mon Sep 17 00:00:00 2001 From: Don Mosites Date: Tue, 1 Oct 2024 14:55:17 +0200 Subject: [PATCH 2/4] add swap event helper to @airswap/utils --- source/batch-call/package.json | 2 +- source/delegate/package.json | 2 +- source/pool/package.json | 2 +- source/registry/package.json | 2 +- source/staking/package.json | 2 +- source/swap-erc20/package.json | 2 +- source/swap/package.json | 2 +- source/wrapper/package.json | 2 +- tools/libraries/package.json | 2 +- tools/stores/package.json | 2 +- tools/utils/package.json | 2 +- tools/utils/src/swap-erc20.ts | 80 ++++++++++++++++++++-------------- tools/utils/src/types.ts | 7 +++ 13 files changed, 65 insertions(+), 44 deletions(-) diff --git a/source/batch-call/package.json b/source/batch-call/package.json index fab0337e8..fa3e481c7 100644 --- a/source/batch-call/package.json +++ b/source/batch-call/package.json @@ -24,7 +24,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@airswap/swap": "5.0.0", "@airswap/swap-erc20": "5.0.0", "@openzeppelin/contracts": "^4.8.3" diff --git a/source/delegate/package.json b/source/delegate/package.json index 58591e0e1..56be71843 100644 --- a/source/delegate/package.json +++ b/source/delegate/package.json @@ -24,7 +24,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@airswap/swap-erc20": "5.0.0" }, "publishConfig": { diff --git a/source/pool/package.json b/source/pool/package.json index 7917886b6..e4e1ff60a 100644 --- a/source/pool/package.json +++ b/source/pool/package.json @@ -25,7 +25,7 @@ "balances": "hardhat run ./scripts/balances.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@airswap/merkle": "0.0.2", "@openzeppelin/contracts": "^4.8.3" }, diff --git a/source/registry/package.json b/source/registry/package.json index fa86a7429..15ca93fa8 100644 --- a/source/registry/package.json +++ b/source/registry/package.json @@ -24,7 +24,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@openzeppelin/contracts": "^4.8.3" }, "publishConfig": { diff --git a/source/staking/package.json b/source/staking/package.json index 04564049f..c313805dc 100644 --- a/source/staking/package.json +++ b/source/staking/package.json @@ -24,7 +24,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@openzeppelin/contracts": "^4.8.3" }, "publishConfig": { diff --git a/source/swap-erc20/package.json b/source/swap-erc20/package.json index 5b1375967..f08e71c3b 100644 --- a/source/swap-erc20/package.json +++ b/source/swap-erc20/package.json @@ -25,7 +25,7 @@ }, "devDependencies": { "@airswap/staking": "5.0.0", - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "solady": "0.0.173" }, "publishConfig": { diff --git a/source/swap/package.json b/source/swap/package.json index c328403a1..0cf02aaa4 100644 --- a/source/swap/package.json +++ b/source/swap/package.json @@ -26,7 +26,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@nomicfoundation/hardhat-network-helpers": "^1.0.7", "@openzeppelin/contracts": "^4.8.3" }, diff --git a/source/wrapper/package.json b/source/wrapper/package.json index 6a38cf7b3..7c91b70c9 100644 --- a/source/wrapper/package.json +++ b/source/wrapper/package.json @@ -24,7 +24,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@airswap/swap-erc20": "5.0.0", "@openzeppelin/contracts": "^4.8.3", "@uniswap/v2-periphery": "^1.1.0-beta.0" diff --git a/tools/libraries/package.json b/tools/libraries/package.json index b050a65c9..e8be538f5 100644 --- a/tools/libraries/package.json +++ b/tools/libraries/package.json @@ -30,7 +30,7 @@ "@airswap/staking": "5.0.0", "@airswap/swap": "5.0.0", "@airswap/swap-erc20": "5.0.0", - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "@airswap/wrapper": "5.0.0", "browser-or-node": "^2.1.1", "ethers": "^5.7.2", diff --git a/tools/stores/package.json b/tools/stores/package.json index 8fa6dbc16..57b3d82cd 100644 --- a/tools/stores/package.json +++ b/tools/stores/package.json @@ -22,7 +22,7 @@ "test": "REDISCLOUD_URL=redis://localhost:6379 TS_NODE_COMPILER_OPTIONS='{\"strict\":false}' yarn mocha -r ts-node/esm test/*.ts" }, "dependencies": { - "@airswap/utils": "5.0.0", + "@airswap/utils": "5.0.1", "redis": "^4.6.13" }, "devDependencies": { diff --git a/tools/utils/package.json b/tools/utils/package.json index 6bf6bd8df..95658e987 100644 --- a/tools/utils/package.json +++ b/tools/utils/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/utils", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Utilities for Developers", "repository": { "type": "git", diff --git a/tools/utils/src/swap-erc20.ts b/tools/utils/src/swap-erc20.ts index 98568fece..9fc30291d 100644 --- a/tools/utils/src/swap-erc20.ts +++ b/tools/utils/src/swap-erc20.ts @@ -18,7 +18,7 @@ import { DOMAIN_NAME_SWAP_ERC20, } from './constants' -import { Signature, Settlement } from './types' +import { Signature, Settlement, Transfer } from './types' export const EIP712SwapERC20 = { EIP712Domain: [ @@ -332,7 +332,7 @@ export function decompressFullOrderERC20(str: string): FullOrderERC20 { return paramsToFullOrderERC20(lzString.decompressFromEncodedURIComponent(str)) } -const parseTransfer = (log: any) => { +const parseTransfer = (log: any): Transfer | null => { let parsed let transfer try { @@ -351,33 +351,20 @@ const parseTransfer = (log: any) => { return transfer } -export const getFullSwapERC20 = async ( +export const getFullSwapERC20FromTransfers = ( nonce: string, signerWallet: string, feeReceiver: string, - logs: ethers.providers.Log[] -): Promise => { - const transfers = [] - let transfer: any - let length = logs.length - - feeReceiver = feeReceiver.toLowerCase() - signerWallet = signerWallet.toLowerCase() - - while (length--) { - if ((transfer = parseTransfer(logs[length]))) { - transfers.push(transfer) - } - } - - let fee: any - let signer: any - let sender: any + transfers: Transfer[] +): FullSwapERC20 => { + let feeTransfer: Transfer | null + let signerTransfer: Transfer | null + let senderTransfer: Transfer | null let i = transfers.length while (i--) { if (transfers[i].to === feeReceiver) { - fee = transfers[i] + feeTransfer = transfers[i] } else { let j = transfers.length while (j--) { @@ -386,26 +373,53 @@ export const getFullSwapERC20 = async ( transfers[i].from === transfers[j].to && transfers[i].to == transfers[j].from ) { - signer = transfers[i] - sender = transfers[j] + signerTransfer = transfers[i] + senderTransfer = transfers[j] break } } } } - if (!signer || !sender) { - throw new Error('getFullSwapERC20: Swap not found') + if (!signerTransfer || !senderTransfer) { + throw new Error('getFullSwapERC20: Either signer or sender not found') } return { nonce: nonce.toString(), - signerWallet: signer.from, - signerToken: signer.token, - signerAmount: signer.amount.toString(), - senderWallet: sender.from, - senderToken: sender.token, - senderAmount: sender.amount.toString(), - feeAmount: fee.amount.toString(), + signerWallet: signerTransfer.from, + signerToken: signerTransfer.token, + signerAmount: signerTransfer.amount.toString(), + senderWallet: senderTransfer.from, + senderToken: senderTransfer.token, + senderAmount: senderTransfer.amount.toString(), + feeAmount: feeTransfer.amount.toString(), } } + +export const getFullSwapERC20 = ( + nonce: string, + signerWallet: string, + feeReceiver: string, + logs: ethers.providers.Log[] +): FullSwapERC20 => { + const allTransfers: Transfer[] = [] + let transfer: Transfer | null + let length = logs.length + + feeReceiver = feeReceiver.toLowerCase() + signerWallet = signerWallet.toLowerCase() + + while (length--) { + if ((transfer = parseTransfer(logs[length]))) { + allTransfers.push(transfer) + } + } + + return getFullSwapERC20FromTransfers( + nonce, + signerWallet, + feeReceiver, + allTransfers + ) +} diff --git a/tools/utils/src/types.ts b/tools/utils/src/types.ts index 79cac8b43..f27c1a11f 100644 --- a/tools/utils/src/types.ts +++ b/tools/utils/src/types.ts @@ -15,6 +15,13 @@ export type Token = { decimals: number } +export type Transfer = { + from: string + to: string + token: string + amount: string +} + export type { TokenInfo } from '@uniswap/token-lists' export interface CollectionTokenAttribute { From 6ce3c6ba142c27f4a9966df4756ceb22f65c1857 Mon Sep 17 00:00:00 2001 From: don mosites Date: Tue, 19 Nov 2024 08:39:55 +0100 Subject: [PATCH 3/4] ensure ethers@^5.7.2 is distributed with contract packages (#1343) --- source/batch-call/package.json | 11 ++++++++--- source/delegate/package.json | 9 +++++++-- source/pool/package.json | 7 ++++++- source/registry/package.json | 7 ++++++- source/staking/package.json | 7 ++++++- source/swap-erc20/package.json | 9 +++++++-- source/swap/package.json | 7 ++++++- source/wrapper/package.json | 6 ++++-- tools/libraries/package.json | 18 +++++++++--------- 9 files changed, 59 insertions(+), 22 deletions(-) diff --git a/source/batch-call/package.json b/source/batch-call/package.json index fa3e481c7..879694f3f 100644 --- a/source/batch-call/package.json +++ b/source/batch-call/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/batch-call", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Balance, Allowance, Validity Checks", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -23,10 +25,13 @@ "verify": "hardhat run ./scripts/verify.js", "owners": "hardhat run ./scripts/owner.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { "@airswap/utils": "5.0.1", - "@airswap/swap": "5.0.0", - "@airswap/swap-erc20": "5.0.0", + "@airswap/swap": "5.0.1", + "@airswap/swap-erc20": "5.0.1", "@openzeppelin/contracts": "^4.8.3" }, "publishConfig": { diff --git a/source/delegate/package.json b/source/delegate/package.json index 56be71843..de826b636 100644 --- a/source/delegate/package.json +++ b/source/delegate/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/delegate", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Delegated On-chain Trading Rules", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -23,9 +25,12 @@ "verify": "hardhat run ./scripts/verify.js", "owners": "hardhat run ./scripts/owner.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { "@airswap/utils": "5.0.1", - "@airswap/swap-erc20": "5.0.0" + "@airswap/swap-erc20": "5.0.1" }, "publishConfig": { "access": "public" diff --git a/source/pool/package.json b/source/pool/package.json index e4e1ff60a..6661e2f4f 100644 --- a/source/pool/package.json +++ b/source/pool/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/pool", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Withdrawable Token Pool", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -24,6 +26,9 @@ "owners": "hardhat run ./scripts/owner.js", "balances": "hardhat run ./scripts/balances.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { "@airswap/utils": "5.0.1", "@airswap/merkle": "0.0.2", diff --git a/source/registry/package.json b/source/registry/package.json index 15ca93fa8..4ea8cdf90 100644 --- a/source/registry/package.json +++ b/source/registry/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/registry", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Server Registry", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -23,6 +25,9 @@ "verify": "hardhat run ./scripts/verify.js", "owners": "hardhat run ./scripts/owner.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { "@airswap/utils": "5.0.1", "@openzeppelin/contracts": "^4.8.3" diff --git a/source/staking/package.json b/source/staking/package.json index c313805dc..01e79e18c 100644 --- a/source/staking/package.json +++ b/source/staking/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/staking", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Stake Tokens", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -23,6 +25,9 @@ "verify": "hardhat run ./scripts/verify.js", "owners": "hardhat run ./scripts/owner.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { "@airswap/utils": "5.0.1", "@openzeppelin/contracts": "^4.8.3" diff --git a/source/swap-erc20/package.json b/source/swap-erc20/package.json index f08e71c3b..9f8686c19 100644 --- a/source/swap-erc20/package.json +++ b/source/swap-erc20/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/swap-erc20", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Atomic ERC20 Token Swap", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -23,8 +25,11 @@ "verify": "hardhat run ./scripts/verify.js", "owners": "hardhat run ./scripts/owner.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { - "@airswap/staking": "5.0.0", + "@airswap/staking": "5.0.1", "@airswap/utils": "5.0.1", "solady": "0.0.173" }, diff --git a/source/swap/package.json b/source/swap/package.json index 0cf02aaa4..96d4bc5c1 100644 --- a/source/swap/package.json +++ b/source/swap/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/swap", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Atomic Token Swap", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -25,6 +27,9 @@ "verify-adapters": "hardhat run ./scripts/verify-adapters.js", "owners": "hardhat run ./scripts/owner.js" }, + "dependencies": { + "ethers": "^5.7.2" + }, "devDependencies": { "@airswap/utils": "5.0.1", "@nomicfoundation/hardhat-network-helpers": "^1.0.7", diff --git a/source/wrapper/package.json b/source/wrapper/package.json index 7c91b70c9..96a1cc890 100644 --- a/source/wrapper/package.json +++ b/source/wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/wrapper", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Wrap and Unwrap Native Tokens", "license": "MIT", "repository": { @@ -12,6 +12,8 @@ "./typechain", "./deploys*" ], + "main": "typechain/index.js", + "types": "typechain/index.ts", "scripts": { "clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain", "compile": "hardhat compile; yarn typechain", @@ -25,7 +27,7 @@ }, "devDependencies": { "@airswap/utils": "5.0.1", - "@airswap/swap-erc20": "5.0.0", + "@airswap/swap-erc20": "5.0.1", "@openzeppelin/contracts": "^4.8.3", "@uniswap/v2-periphery": "^1.1.0-beta.0" }, diff --git a/tools/libraries/package.json b/tools/libraries/package.json index e8be538f5..9cd2935bc 100644 --- a/tools/libraries/package.json +++ b/tools/libraries/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/libraries", - "version": "5.0.1", + "version": "5.0.2", "description": "AirSwap: Libraries for Developers", "repository": { "type": "git", @@ -22,16 +22,16 @@ "test:ci": "yarn test" }, "dependencies": { - "@airswap/batch-call": "5.0.0", + "@airswap/batch-call": "5.0.1", "@airswap/jsonrpc-client-websocket": "0.0.1", - "@airswap/delegate": "5.0.0", - "@airswap/pool": "5.0.0", - "@airswap/registry": "5.0.0", - "@airswap/staking": "5.0.0", - "@airswap/swap": "5.0.0", - "@airswap/swap-erc20": "5.0.0", + "@airswap/delegate": "5.0.1", + "@airswap/pool": "5.0.1", + "@airswap/registry": "5.0.1", + "@airswap/staking": "5.0.1", + "@airswap/swap": "5.0.1", + "@airswap/swap-erc20": "5.0.1", "@airswap/utils": "5.0.1", - "@airswap/wrapper": "5.0.0", + "@airswap/wrapper": "5.0.1", "browser-or-node": "^2.1.1", "ethers": "^5.7.2", "jayson": "^4.0.0", From 30d18bcc05462090f97612c2892a4301bb786b2f Mon Sep 17 00:00:00 2001 From: Don Mosites Date: Thu, 21 Nov 2024 15:36:04 +0100 Subject: [PATCH 4/4] @airswap/utils: getFullSwapERC20: handle case of zero fee transfer --- source/batch-call/package.json | 2 +- source/delegate/package.json | 2 +- source/pool/package.json | 2 +- source/registry/package.json | 2 +- source/staking/package.json | 2 +- source/swap-erc20/package.json | 2 +- source/swap/package.json | 2 +- source/wrapper/package.json | 2 +- tools/libraries/package.json | 4 ++-- tools/stores/package.json | 4 ++-- tools/utils/package.json | 2 +- tools/utils/src/swap-erc20.ts | 4 ++-- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/batch-call/package.json b/source/batch-call/package.json index 879694f3f..818206a75 100644 --- a/source/batch-call/package.json +++ b/source/batch-call/package.json @@ -29,7 +29,7 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@airswap/swap": "5.0.1", "@airswap/swap-erc20": "5.0.1", "@openzeppelin/contracts": "^4.8.3" diff --git a/source/delegate/package.json b/source/delegate/package.json index de826b636..2238faf94 100644 --- a/source/delegate/package.json +++ b/source/delegate/package.json @@ -29,7 +29,7 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@airswap/swap-erc20": "5.0.1" }, "publishConfig": { diff --git a/source/pool/package.json b/source/pool/package.json index 6661e2f4f..6a02741ac 100644 --- a/source/pool/package.json +++ b/source/pool/package.json @@ -30,7 +30,7 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@airswap/merkle": "0.0.2", "@openzeppelin/contracts": "^4.8.3" }, diff --git a/source/registry/package.json b/source/registry/package.json index 4ea8cdf90..d3121fa4c 100644 --- a/source/registry/package.json +++ b/source/registry/package.json @@ -29,7 +29,7 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@openzeppelin/contracts": "^4.8.3" }, "publishConfig": { diff --git a/source/staking/package.json b/source/staking/package.json index 01e79e18c..dbee452c7 100644 --- a/source/staking/package.json +++ b/source/staking/package.json @@ -29,7 +29,7 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@openzeppelin/contracts": "^4.8.3" }, "publishConfig": { diff --git a/source/swap-erc20/package.json b/source/swap-erc20/package.json index 9f8686c19..f791939b8 100644 --- a/source/swap-erc20/package.json +++ b/source/swap-erc20/package.json @@ -30,7 +30,7 @@ }, "devDependencies": { "@airswap/staking": "5.0.1", - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "solady": "0.0.173" }, "publishConfig": { diff --git a/source/swap/package.json b/source/swap/package.json index 96d4bc5c1..3f48e1463 100644 --- a/source/swap/package.json +++ b/source/swap/package.json @@ -31,7 +31,7 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@nomicfoundation/hardhat-network-helpers": "^1.0.7", "@openzeppelin/contracts": "^4.8.3" }, diff --git a/source/wrapper/package.json b/source/wrapper/package.json index 96a1cc890..3237c7bcc 100644 --- a/source/wrapper/package.json +++ b/source/wrapper/package.json @@ -26,7 +26,7 @@ "owners": "hardhat run ./scripts/owner.js" }, "devDependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@airswap/swap-erc20": "5.0.1", "@openzeppelin/contracts": "^4.8.3", "@uniswap/v2-periphery": "^1.1.0-beta.0" diff --git a/tools/libraries/package.json b/tools/libraries/package.json index 9cd2935bc..5b4ee5787 100644 --- a/tools/libraries/package.json +++ b/tools/libraries/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/libraries", - "version": "5.0.2", + "version": "5.0.3", "description": "AirSwap: Libraries for Developers", "repository": { "type": "git", @@ -30,7 +30,7 @@ "@airswap/staking": "5.0.1", "@airswap/swap": "5.0.1", "@airswap/swap-erc20": "5.0.1", - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "@airswap/wrapper": "5.0.1", "browser-or-node": "^2.1.1", "ethers": "^5.7.2", diff --git a/tools/stores/package.json b/tools/stores/package.json index 57b3d82cd..b9571e6f7 100644 --- a/tools/stores/package.json +++ b/tools/stores/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/stores", - "version": "5.0.0", + "version": "5.0.1", "description": "AirSwap: Storage for Indexing", "repository": { "type": "git", @@ -22,7 +22,7 @@ "test": "REDISCLOUD_URL=redis://localhost:6379 TS_NODE_COMPILER_OPTIONS='{\"strict\":false}' yarn mocha -r ts-node/esm test/*.ts" }, "dependencies": { - "@airswap/utils": "5.0.1", + "@airswap/utils": "5.0.2", "redis": "^4.6.13" }, "devDependencies": { diff --git a/tools/utils/package.json b/tools/utils/package.json index 95658e987..e3ca6479f 100644 --- a/tools/utils/package.json +++ b/tools/utils/package.json @@ -1,6 +1,6 @@ { "name": "@airswap/utils", - "version": "5.0.1", + "version": "5.0.2", "description": "AirSwap: Utilities for Developers", "repository": { "type": "git", diff --git a/tools/utils/src/swap-erc20.ts b/tools/utils/src/swap-erc20.ts index 9fc30291d..9005ae281 100644 --- a/tools/utils/src/swap-erc20.ts +++ b/tools/utils/src/swap-erc20.ts @@ -382,7 +382,7 @@ export const getFullSwapERC20FromTransfers = ( } if (!signerTransfer || !senderTransfer) { - throw new Error('getFullSwapERC20: Either signer or sender not found') + throw new Error('getFullSwapERC20: mutual transfers not found') } return { @@ -393,7 +393,7 @@ export const getFullSwapERC20FromTransfers = ( senderWallet: senderTransfer.from, senderToken: senderTransfer.token, senderAmount: senderTransfer.amount.toString(), - feeAmount: feeTransfer.amount.toString(), + feeAmount: (feeTransfer?.amount || 0).toString(), } }