diff --git a/package.json b/package.json index 7f37ed8..8f3b3a4 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "type": "module", "license": "MIT", "dependencies": { - "@airswap/libraries": "4.0.10", + "@airswap/libraries": "4.0.19", "@airswap/types": "4.0.5", "@airswap/utils": "4.0.6", "@airswap/constants": "4.0.3", diff --git a/src/client/Web3SwapClient.ts b/src/client/Web3SwapClient.ts index 1ab6aec..e66a3eb 100644 --- a/src/client/Web3SwapClient.ts +++ b/src/client/Web3SwapClient.ts @@ -1,6 +1,7 @@ -import { Contract, ethers } from 'ethers'; +import { Contract, ethers, providers } from 'ethers'; import { Database } from '../database/Database.js'; import { Swap } from '@airswap/libraries' +import { getProviderUrl } from './getProviderUrl.js'; export class Web3SwapClient { private contracts: Contract[] = []; @@ -13,19 +14,28 @@ export class Web3SwapClient { this.apiKey = apiKey; } - public connectToChain(network: number | string) { - const chainId = ethers.providers.getNetwork(network)?.chainId; - if (!chainId) { - console.warn("Tried to add this network but it does not work :", network) - return; - } - if (this.keyExists(String(chainId))) { - console.log("Already connected"); - return; - } + public connectToChain(network: number | string): boolean { + let chainId: number + let contract: Contract + let provider: providers.Provider - const provider = ethers.providers.InfuraProvider.getWebSocketProvider(chainId, this.apiKey); - const contract = Swap.getContract(provider, chainId); + try { + chainId = Number(network); + if (!chainId || isNaN(chainId)) { + console.warn("Tried to add this network but it does not work :", network) + return false + } + if (this.keyExists(String(chainId))) { + console.log("Already connected"); + return true + } + + provider = new ethers.providers.JsonRpcProvider(getProviderUrl(chainId, this.apiKey)) + contract = Swap.getContract(provider, chainId); + } catch (err) { + return false + } + contract.on("Swap", (nonce, signerWallet) => { this.onEvent(nonce, signerWallet); }); @@ -35,6 +45,7 @@ export class Web3SwapClient { this.contracts.push(contract); this.registeredChains.push(String(chainId)); console.log("Registered event SWAP from chain", chainId) + return true } private keyExists(network: string): boolean { @@ -45,6 +56,7 @@ export class Web3SwapClient { if (nonce && signerWallet) { const decodedNonce = parseInt(nonce._hex, 16); if (isNaN(decodedNonce)) return; + this.database.deleteOrder(decodedNonce, signerWallet.toLocaleLowerCase()); } } diff --git a/src/client/Web3SwapERC20Client.ts b/src/client/Web3SwapERC20Client.ts index 6722b86..1f23bef 100644 --- a/src/client/Web3SwapERC20Client.ts +++ b/src/client/Web3SwapERC20Client.ts @@ -1,6 +1,7 @@ -import { Contract, ethers } from 'ethers'; +import { Contract, ethers, providers } from 'ethers'; import { Database } from '../database/Database.js'; import { SwapERC20 } from '@airswap/libraries' +import { getProviderUrl } from './getProviderUrl.js'; export class Web3SwapERC20Client { private contracts: Contract[] = []; @@ -13,19 +14,27 @@ export class Web3SwapERC20Client { this.apiKey = apiKey; } - public connectToChain(network: number|string) { - const chainId = ethers.providers.getNetwork(network)?.chainId; - if (!chainId) { - console.warn("Tried to add this network but it does not work :", network) - return; - } - if (this.keyExists(String(chainId))) { - console.log("Already connected"); - return; + public connectToChain(network: number | string): boolean { + let chainId: number + let contract: Contract + let provider: providers.Provider + + try { + chainId = Number(network); + if (!chainId || isNaN(chainId)) { + console.warn("Tried to add this network but it does not work :", network) + return false + } + if (this.keyExists(String(chainId))) { + console.log("Already connected"); + return true + } + provider = new ethers.providers.JsonRpcProvider(getProviderUrl(chainId, this.apiKey)) + contract = SwapERC20.getContract(provider, chainId); + } catch (err) { + return false } - const provider = ethers.providers.InfuraProvider.getWebSocketProvider(chainId, this.apiKey); - const contract = SwapERC20.getContract(provider, chainId); contract.on("SwapERC20", (nonce, signerWallet, signerToken, signerAmount, protocolFee, senderWallet, senderToken, senderAmount) => { this.onEvent(nonce, signerWallet); }); @@ -35,6 +44,7 @@ export class Web3SwapERC20Client { this.contracts.push(contract); this.registeredChains.push(String(chainId)); console.log("Registered event SWAP ERC20 from chain", chainId) + return true } private keyExists(network: string): boolean { diff --git a/src/client/__tests__/Web3SwapClient.test.ts b/src/client/__tests__/Web3SwapClient.test.ts index fed9f2d..ecdffae 100644 --- a/src/client/__tests__/Web3SwapClient.test.ts +++ b/src/client/__tests__/Web3SwapClient.test.ts @@ -28,10 +28,7 @@ describe("Web3SwapClient", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - getNetwork: jest.fn(() => ({ chainId: 5, name: "a_custom" })) + JsonRpcProvider: jest.fn(), }; //@ts-ignore Swap.getContract = jest.fn(() => ({ on: jest.fn() })) @@ -39,39 +36,29 @@ describe("Web3SwapClient", () => { const client = new Web3SwapClient(apiKey, fakeDatabase as Database); client.connectToChain(5); - expect(mockedEther.providers.getNetwork).toHaveBeenCalledWith(5); - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).toHaveBeenCalledWith(5, "apikey"); + expect(mockedEther.providers.JsonRpcProvider).toHaveBeenCalledWith("https://https://goerli.infura.io/v3/apikey"); }); it("Network is not found", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => undefined) + JsonRpcProvider: jest.fn(), }; //@ts-ignore Swap.getContract = jest.fn(() => ({ on: jest.fn() })) const client = new Web3SwapClient(apiKey, fakeDatabase as Database); - client.connectToChain(5); + client.connectToChain("aze"); - expect(mockedEther.providers.getNetwork).toHaveBeenCalledWith(5); - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).not.toHaveBeenCalled(); + expect(mockedEther.providers.JsonRpcProvider).not.toHaveBeenCalled(); }); it("Network can't be added twice", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => ({ chainId: 5 })) + JsonRpcProvider: jest.fn(), }; //@ts-ignore Swap.getContract = jest.fn(() => ({ on: jest.fn() })) @@ -80,9 +67,8 @@ describe("Web3SwapClient", () => { client.connectToChain(5); client.connectToChain(5); - expect(mockedEther.providers.getNetwork).toHaveBeenCalledWith(5); - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).toHaveBeenCalledTimes(1) - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).toBeCalledWith(5, "apikey") + expect(mockedEther.providers.JsonRpcProvider).toHaveBeenCalledTimes(1) + expect(mockedEther.providers.JsonRpcProvider).toBeCalledWith("https://https://goerli.infura.io/v3/apikey"); }); }); @@ -95,13 +81,10 @@ describe("Web3SwapClient", () => { //@ts-ignore Swap.getContract = jest.fn(() => ({ on: mockedOn })) + //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => ({ chainId: 5 })) + JsonRpcProvider: jest.fn(), }; new Web3SwapClient(apiKey, fakeDatabase as Database).connectToChain(network); @@ -120,11 +103,7 @@ describe("Web3SwapClient", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => ({ chainId: 5 })) + JsonRpcProvider: jest.fn(), }; //@ts-ignore Swap.getContract = jest.fn(() => ({ on: mockedOn })) @@ -142,9 +121,7 @@ describe("Web3SwapClient", () => { callback(); }); //@ts-ignore - mockedEther.providers.InfuraProvider = { - getWebSocketProvider: jest.fn() - }; + mockedEther.providers.JsonRpcProvider = jest.fn(); //@ts-ignore Swap.getContract = jest.fn(() => ({ on: mockedOn })) @@ -158,8 +135,9 @@ describe("Web3SwapClient", () => { callback({}); }); //@ts-ignore - mockedEther.providers.InfuraProvider = { - getWebSocketProvider: jest.fn() + mockedEther.providers = { + //@ts-ignore + JsonRpcProvider: jest.fn(), }; //@ts-ignore Swap.getContract = jest.fn(() => ({ on: mockedOn })) @@ -174,8 +152,9 @@ describe("Web3SwapClient", () => { callback({ _hex: undefined, _isBigNumber: true }, "a_wallet"); }); //@ts-ignore - mockedEther.providers.InfuraProvider = { - getWebSocketProvider: jest.fn() + mockedEther.providers = { + //@ts-ignore + JsonRpcProvider: jest.fn(), }; //@ts-ignore Swap.getContract = jest.fn(() => ({ on: mockedOn })) diff --git a/src/client/__tests__/Web3SwapERC20Client.test.ts b/src/client/__tests__/Web3SwapERC20Client.test.ts index 3080447..ab55396 100644 --- a/src/client/__tests__/Web3SwapERC20Client.test.ts +++ b/src/client/__tests__/Web3SwapERC20Client.test.ts @@ -28,10 +28,7 @@ describe("Web3SwapERC20Client", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - getNetwork: jest.fn(() => ({ chainId: 5, name: "a_custom" })) + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: jest.fn() })) @@ -39,39 +36,29 @@ describe("Web3SwapERC20Client", () => { const client = new Web3SwapERC20Client(apiKey, fakeDatabase as Database); client.connectToChain(5); - expect(mockedEther.providers.getNetwork).toHaveBeenCalledWith(5); - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).toHaveBeenCalledWith(5, "apikey"); + expect(mockedEther.providers.JsonRpcProvider).toHaveBeenCalledWith("https://https://goerli.infura.io/v3/apikey"); }); it("Network is not found", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => undefined) + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: jest.fn() })) const client = new Web3SwapERC20Client(apiKey, fakeDatabase as Database); - client.connectToChain(5); + client.connectToChain("aze"); - expect(mockedEther.providers.getNetwork).toHaveBeenCalledWith(5); - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).not.toHaveBeenCalled(); + expect(mockedEther.providers.JsonRpcProvider).not.toHaveBeenCalled(); }); it("Network can't be added twice", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => ({ chainId: 5 })) + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: jest.fn() })) @@ -80,9 +67,8 @@ describe("Web3SwapERC20Client", () => { client.connectToChain(5); client.connectToChain(5); - expect(mockedEther.providers.getNetwork).toHaveBeenCalledWith(5); - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).toHaveBeenCalledTimes(1) - expect(mockedEther.providers.InfuraProvider.getWebSocketProvider).toBeCalledWith(5, "apikey") + expect(mockedEther.providers.JsonRpcProvider).toHaveBeenCalledTimes(1) + expect(mockedEther.providers.JsonRpcProvider).toBeCalledWith("https://https://goerli.infura.io/v3/apikey") }); }); @@ -95,13 +81,10 @@ describe("Web3SwapERC20Client", () => { //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: mockedOn })) + //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => ({ chainId: 5 })) + JsonRpcProvider: jest.fn(), }; new Web3SwapERC20Client(apiKey, fakeDatabase as Database).connectToChain(network); @@ -120,11 +103,7 @@ describe("Web3SwapERC20Client", () => { //@ts-ignore mockedEther.providers = { //@ts-ignore - InfuraProvider: { - getWebSocketProvider: jest.fn() - }, - //@ts-ignore - getNetwork: jest.fn(() => ({ chainId: 5 })) + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: mockedOn })) @@ -142,8 +121,9 @@ describe("Web3SwapERC20Client", () => { callback(); }); //@ts-ignore - mockedEther.providers.InfuraProvider = { - getWebSocketProvider: jest.fn() + mockedEther.providers = { + //@ts-ignore + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: mockedOn })) @@ -158,8 +138,9 @@ describe("Web3SwapERC20Client", () => { callback({}); }); //@ts-ignore - mockedEther.providers.InfuraProvider = { - getWebSocketProvider: jest.fn() + mockedEther.providers = { + //@ts-ignore + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: mockedOn })) @@ -174,8 +155,9 @@ describe("Web3SwapERC20Client", () => { callback({ _hex: undefined, _isBigNumber: true }, "A_wallet"); }); //@ts-ignore - mockedEther.providers.InfuraProvider = { - getWebSocketProvider: jest.fn() + mockedEther.providers = { + //@ts-ignore + JsonRpcProvider: jest.fn(), }; //@ts-ignore SwapERC20.getContract = jest.fn(() => ({ on: mockedOn })) diff --git a/src/client/getProviderUrl.ts b/src/client/getProviderUrl.ts new file mode 100644 index 0000000..75a9ca7 --- /dev/null +++ b/src/client/getProviderUrl.ts @@ -0,0 +1,11 @@ +import {apiUrls} from '@airswap/constants' + +export function getProviderUrl(chainId: number, apiKey: string) { + const host = apiUrls[chainId]; + + if (!host) { + throw new Error("Unknown chain ID"); + } + + return host.includes("infura.io/v3") ? `https://${host}/${apiKey}` : `https://${host}`; +} diff --git a/src/service/OrderService.ts b/src/service/OrderService.ts index cb82b04..3b22eb8 100644 --- a/src/service/OrderService.ts +++ b/src/service/OrderService.ts @@ -64,9 +64,12 @@ export class OrderService { } indexedOrder.hash = hash; + const isNetworkAdded = this.web3SwapERC20Client.connectToChain(indexedOrder.order.chainId) + if(!isNetworkAdded){ + throw new ClientError("Chain ID unsupported"); + } await this.database.addOrderERC20(indexedOrder); console.log("Added", indexedOrder.order) - this.web3SwapERC20Client.connectToChain(indexedOrder.order.chainId) return Promise.resolve(); } @@ -110,9 +113,12 @@ export class OrderService { } indexedOrder.hash = hash; + const isNetworkAdded = this.web3SwapClient.connectToChain(indexedOrder.order.chainId) + if(!isNetworkAdded){ + throw new ClientError("Chain ID unsupported"); + } await this.database.addOrder(indexedOrder); console.log("Added", indexedOrder.order) - this.web3SwapClient.connectToChain(indexedOrder.order.chainId) return Promise.resolve(); } diff --git a/src/service/__tests__/OrderService.test.ts b/src/service/__tests__/OrderService.test.ts index 9042b5a..abd5fd2 100644 --- a/src/service/__tests__/OrderService.test.ts +++ b/src/service/__tests__/OrderService.test.ts @@ -163,7 +163,7 @@ describe("Order service", () => { }); describe("Add Order ERC 20", () => { - test("Add order nominal & broadcast", async () => { + test("Add order nominal", async () => { const order = forgeFullOrderERC20(1653900784796); const expectedForgeHash = { order: forgeDbOrderERC20(1653900784796), addedOn: 1653900784706 } const expected = forgeIndexedOrderERC20(1653900784706, 1653900784796); @@ -176,6 +176,8 @@ describe("Order service", () => { }); //@ts-ignore fakeDb.orderERC20Exists.mockImplementation(() => false); + //@ts-ignore + fakeWeb3SwapERC20Client.connectToChain.mockImplementation(() => true) await new OrderService(fakeDb as Database, fakeWeb3SwapERC20Client as Web3SwapERC20Client, fakeWeb3SwapClient as Web3SwapClient, maxResultByQuery).addOrderERC20(order); @@ -185,6 +187,30 @@ describe("Order service", () => { expect(fakeWeb3SwapERC20Client.connectToChain).toHaveBeenCalledWith(5); }); + test("not adding on unsupported chain", async () => { + const order = forgeFullOrderERC20(1653900784796); + const expectedForgeHash = { order: forgeDbOrderERC20(1653900784796), addedOn: 1653900784706 } + + //@ts-ignore + fakeDb.generateHashERC20.mockImplementation((order) => { + expect(order).toEqual(expectedForgeHash); // https://github.com/facebook/jest/issues/7950 + return "a"; + }); + //@ts-ignore + fakeDb.orderERC20Exists.mockImplementation(() => false); + //@ts-ignore + fakeWeb3SwapERC20Client.connectToChain.mockImplementation(() => false) + + await expect(async () => { + await new OrderService(fakeDb as Database, fakeWeb3SwapERC20Client as Web3SwapERC20Client, fakeWeb3SwapClient as Web3SwapClient, maxResultByQuery).addOrderERC20(order); + }).rejects.toThrow("Chain ID unsupported"); + + expect(fakeDb.generateHashERC20).toHaveBeenCalledTimes(1); + expect(fakeDb.orderERC20Exists).toHaveBeenCalledWith("a"); + expect(fakeDb.addOrderERC20).not.toHaveBeenCalled(); + expect(fakeWeb3SwapERC20Client.connectToChain).toHaveBeenCalledWith(5); + }); + test("Add order missing data", async () => { const orderMissingExpiry = forgeIndexedOrderERC20(1653900784696, 1653900784706); // @ts-ignore @@ -265,7 +291,7 @@ describe("Order service", () => { }); describe("Add Order", () => { - test("Add order nominal & broadcast", async () => { + test("Add order nominal", async () => { const order = forgeFullOrder(1653900784796); const expectedForgeHash = { order: forgeDbOrder(1653900784796), addedOn: 1653900784706 } const expected = forgeIndexedOrder(1653900784706, 1653900784796); @@ -278,6 +304,8 @@ describe("Order service", () => { }); //@ts-ignore fakeDb.orderExists.mockImplementation(() => false); + //@ts-ignore + fakeWeb3SwapClient.connectToChain.mockImplementation(() => true) await new OrderService(fakeDb as Database, fakeWeb3SwapERC20Client as Web3SwapERC20Client, fakeWeb3SwapClient as Web3SwapClient, maxResultByQuery).addOrder(order); @@ -287,6 +315,30 @@ describe("Order service", () => { expect(fakeWeb3SwapClient.connectToChain).toHaveBeenCalledWith(5); }); + test("not adding on unsupported chain", async () => { + const order = forgeFullOrder(1653900784796); + const expectedForgeHash = { order: forgeDbOrder(1653900784796), addedOn: 1653900784706 } + + //@ts-ignore + fakeDb.generateHash.mockImplementation((order) => { + expect(order).toEqual(expectedForgeHash); // https://github.com/facebook/jest/issues/7950 + return "a"; + }); + //@ts-ignore + fakeDb.orderExists.mockImplementation(() => false); + //@ts-ignore + fakeWeb3SwapClient.connectToChain.mockImplementation(() => false) + + await expect(async () => { + await new OrderService(fakeDb as Database, fakeWeb3SwapERC20Client as Web3SwapERC20Client, fakeWeb3SwapClient as Web3SwapClient, maxResultByQuery).addOrder(order); + }).rejects.toThrow("Chain ID unsupported"); + + expect(fakeDb.generateHash).toHaveBeenCalledTimes(1); + expect(fakeDb.orderExists).toHaveBeenCalledWith("a"); + expect(fakeDb.addOrder).not.toHaveBeenCalled(); + expect(fakeWeb3SwapClient.connectToChain).toHaveBeenCalledWith(5); + }); + test("Add order missing data", async () => { const orderMissingExpiry = forgeIndexedOrder(1653900784696, 1653900784706); // @ts-ignore diff --git a/yarn.lock b/yarn.lock index afa1253..c42487e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,13 +2,18 @@ # yarn lockfile v1 -"@airswap/balances@4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@airswap/balances/-/balances-4.0.1.tgz#15d2832fb1de326ec71713f3334c46379ed04f87" - integrity sha512-wgxRfDqtuF+AZRIRfTMncPeaKWVluUgQVHMQtPUA2YHHzGXgABpRPytqfDsewrKB5Z4u131vNLaQuVkF6eGmdg== +"@airswap/balances@4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@airswap/balances/-/balances-4.0.2.tgz#3c7fdea917d75dd1a82ea0cd4ba2f96988260c0f" + integrity sha512-GrVhTjjtyGbw9AXufSzbR67DkqIl1xR55M9INY3VfuITQYHbsHxmWY9gpR6BAp3mNO8yIrYiO8fvqq0MubNAeg== dependencies: "@openzeppelin/contracts" "^4.8.3" +"@airswap/constants@4.0.10", "@airswap/constants@^4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@airswap/constants/-/constants-4.0.10.tgz#b2bf2cdba8dff42414cc5151586bacbfcbc3f0fb" + integrity sha512-jGqSrVf4YWJbMaiDkWXtCIaIw+MHq/BqrmHpfynw1la7woRSjbbKK6aFjgoYGY/XcZTmMPG7COT+oApxXdXdXg== + "@airswap/constants@4.0.3": version "4.0.3" resolved "https://registry.yarnpkg.com/@airswap/constants/-/constants-4.0.3.tgz#be0cd8ca6bd16f1007a83c86cf967b77ab3b9366" @@ -26,31 +31,32 @@ dependencies: get-parameter-names "^0.3.0" -"@airswap/libraries@4.0.10": - version "4.0.10" - resolved "https://registry.yarnpkg.com/@airswap/libraries/-/libraries-4.0.10.tgz#04681fbaa6ca8e654e4b386005226639f7a10287" - integrity sha512-qgZ/bCIA3JY513wdE/h2ZQJ6KrzyZIVTQqrK32KFnuWK6tYDSyrwqNStzDItCRLik7+cMIf5P0XAxg4LU23UqQ== +"@airswap/libraries@4.0.19": + version "4.0.19" + resolved "https://registry.yarnpkg.com/@airswap/libraries/-/libraries-4.0.19.tgz#44826c612fc092328ee846efabe8509c8b43f403" + integrity sha512-PeR58cVA3RDDCOGMpO0zslXwidOxF2dufswmeyTpvuGQSXgeBbpkNp+7SkcMbqvdcIWyMMMKwic45LwLES5GBg== dependencies: - "@airswap/balances" "4.0.1" - "@airswap/constants" "^4.0.4" + "@airswap/balances" "4.0.2" + "@airswap/constants" "4.0.10" "@airswap/jsonrpc-client-websocket" "0.0.1" - "@airswap/maker-registry" "4.0.1" + "@airswap/maker-registry" "4.0.4" "@airswap/registry" "4.0.3" + "@airswap/staking" "4.0.3" "@airswap/swap" "4.0.4" - "@airswap/swap-erc20" "4.0.3" - "@airswap/types" "^4.0.4" - "@airswap/utils" "^4.0.6" - "@airswap/wrapper" "4.0.5" + "@airswap/swap-erc20" "4.0.6" + "@airswap/types" "4.0.5" + "@airswap/utils" "4.0.8" + "@airswap/wrapper" "4.0.8" browser-or-node "^2.1.1" ethers "^5.6.9" jayson "^4.0.0" tiny-typed-emitter "^2.1.0" websocket "^1.0.34" -"@airswap/maker-registry@4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@airswap/maker-registry/-/maker-registry-4.0.1.tgz#008790185a32f6b385aa1c22a58f572c776a6384" - integrity sha512-ArBQZHAYMINUUyxI0zOVPmP7YIbsn0SLMuSBs90TxwtIrg/xUGMmAMR25wuK53/+FHlNWy9siOcDq978OTQE7A== +"@airswap/maker-registry@4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@airswap/maker-registry/-/maker-registry-4.0.4.tgz#57296740a3c08ee40982c4cbf02e84513df738cc" + integrity sha512-EuYXfnsLnRHbxDOONcmV6Qk4Q5CikcyyRki068+w6CwGC3s6FXdgUkSfQ6aYea/GGfjxqVdpHm2xsnyhEx0Z9w== dependencies: "@openzeppelin/contracts" "^4.8.1" @@ -61,10 +67,17 @@ dependencies: "@openzeppelin/contracts" "^4.8.3" -"@airswap/swap-erc20@4.0.3": +"@airswap/staking@4.0.3": version "4.0.3" - resolved "https://registry.yarnpkg.com/@airswap/swap-erc20/-/swap-erc20-4.0.3.tgz#a7cd0c3c6a597822225ae71e21bbc3587bdf4373" - integrity sha512-vyVQL+U79A96gzOi4/rXOlhrNbaEuCE5XHn0R0krv0eIgeIBGF2eUaMFPiAKhdqnM1geja6NTmtW0ymAfsgimg== + resolved "https://registry.yarnpkg.com/@airswap/staking/-/staking-4.0.3.tgz#0ed4632919c5b67dd22a85647a0c1666c5300c3e" + integrity sha512-N/9Qb6d0JHtV74gyPfZPSu2L6lbPQhOmQCQXMIFdXVqv7M81qCCxb4mEkxc26w5iwo5awc6wPinWjO5Cx7qD/A== + dependencies: + "@openzeppelin/contracts" "^4.8.3" + +"@airswap/swap-erc20@4.0.6": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@airswap/swap-erc20/-/swap-erc20-4.0.6.tgz#96d96b98cf633e1b50c3cbe02fced3ab1ecb2b4b" + integrity sha512-8mcjTX/4l/M4+bXCya3z5AYUGK73YQhrfTYGIUIDrqesrkVcNg3W/++km3MdGg0WQwKWOPygwfdQ4OVFTX4fWg== dependencies: "@openzeppelin/contracts" "^4.8.3" @@ -75,21 +88,14 @@ dependencies: "@openzeppelin/contracts" "^4.8.3" -"@airswap/types@4.0.5": +"@airswap/types@4.0.5", "@airswap/types@^4.0.4": version "4.0.5" resolved "https://registry.yarnpkg.com/@airswap/types/-/types-4.0.5.tgz#94ccc4f3a9e3c54573a88e62cd9b6670e23c77cc" integrity sha512-X6ZGCFyKpYo608PM14jX3Co+UdzQzaNPgceSfCI4x1VnZrGImVpNm26pzEO6FahpTmClWeQqk5I/AVGg21w2Vw== dependencies: "@uniswap/token-lists" "^1.0.0-beta.31" -"@airswap/types@^4.0.4": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@airswap/types/-/types-4.0.4.tgz#09def98ac4254d0c6cb85782a23071f555377612" - integrity sha512-JLBgh5NSKL/G3QkrCA7WamZiYRW73kTv0Tyub0nx2pfn32VK6FCkXROopNMaj5ok2D1x6gMHbFffWa6L+NPKKg== - dependencies: - "@uniswap/token-lists" "^1.0.0-beta.31" - -"@airswap/utils@4.0.6", "@airswap/utils@^4.0.6": +"@airswap/utils@4.0.6": version "4.0.6" resolved "https://registry.yarnpkg.com/@airswap/utils/-/utils-4.0.6.tgz#321d2510da362056f83be7942273a903b546f3e4" integrity sha512-ZAFsS6PtqeDIivmiR3BFjhM0Ub7Xua918H4tYfPlr1WirVaIEg8pd3C61UF/+M2PsC80LGoA+XrYCrBIgKYmNQ== @@ -102,12 +108,25 @@ ethers "^5.6.9" lz-string "^1.5.0" -"@airswap/wrapper@4.0.5": - version "4.0.5" - resolved "https://registry.yarnpkg.com/@airswap/wrapper/-/wrapper-4.0.5.tgz#fa1b2d9a91aeeda32936a649f6097dc4b9bb54a2" - integrity sha512-sWI6ofFaDuHJpft3BKj5rNhFA50eEhBH4UGc+xMNeKXcVLwJRhrqx7a++5vXpOO0dcRZOP0b+d5ll3VsdAMjjA== +"@airswap/utils@4.0.8": + version "4.0.8" + resolved "https://registry.yarnpkg.com/@airswap/utils/-/utils-4.0.8.tgz#a61c3e4dd89cc813c77f337f490d46452dea27ea" + integrity sha512-OfyykOc7RENrYoM8rRjBhNszYEzFkcRMdfeN33kee4j5HLIfB+Mbk7wLLQOiTrB+CgFSuIU1u8lCExfdtMp1VQ== + dependencies: + "@airswap/constants" "^4.0.10" + "@airswap/types" "^4.0.4" + "@metamask/eth-sig-util" "^5.0.2" + bignumber.js "^9.0.1" + ethereumjs-util "^7.1.5" + ethers "^5.6.9" + lz-string "^1.5.0" + +"@airswap/wrapper@4.0.8": + version "4.0.8" + resolved "https://registry.yarnpkg.com/@airswap/wrapper/-/wrapper-4.0.8.tgz#17659085edf318fcdc191dc332811a1f1957b48c" + integrity sha512-v0CBG1Med1bvug+cT4H1Nzgxhe1fRZPvK3VD7PIxmcOKbfeJzuJTyhnA9hWNE5CUJ5vaEb186Hn6VtwU0sKoEw== dependencies: - "@airswap/swap-erc20" "4.0.3" + "@airswap/swap-erc20" "4.0.6" "@openzeppelin/contracts" "^4.8.3" "@ampproject/remapping@^2.1.0":