diff --git a/v3-sdk/swap-and-add-liquidity/package.json b/v3-sdk/swap-and-add-liquidity/package.json index f6a2f375..315e298b 100644 --- a/v3-sdk/swap-and-add-liquidity/package.json +++ b/v3-sdk/swap-and-add-liquidity/package.json @@ -1,14 +1,14 @@ { "name": "swap-and-add-liquidity", - "version": "0.1.0", + "version": "0.2.0", "private": true, "dependencies": { "@types/node": "^16.7.13", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@uniswap/sdk-core": "npm:@koraykoska/uniswap-sdk-core@^6.0.9", - "@uniswap/v3-sdk": "npm:@florian-s-a-w/uniswap-v3-sdk@3.15.18", - "@uniswap/smart-order-router": "npm:@florian-s-a-w/uniswap-smart-order-router@^3.18.8", + "@uniswap/v3-sdk": "npm:@florian-s-a-w/uniswap-v3-sdk@4.0.2", + "@uniswap/smart-order-router": "npm:@florian-s-a-w/uniswap-smart-order-router@^3.19.0", "ethers": "^5.7.2", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -20,7 +20,7 @@ "build": "react-scripts build", "lint": "yarn eslint .", "install:chain": "curl -L https://foundry.paradigm.xyz | bash && clear && echo $0 | exec && foundryup", - "start:chain": "anvil --chain-id 1337 --fork-url" + "start:chain": "anvil --chain-id 1 --fork-url" }, "eslintConfig": { "extends": [ diff --git a/v3-sdk/swap-and-add-liquidity/src/libs/liquidity.ts b/v3-sdk/swap-and-add-liquidity/src/libs/liquidity.ts index ba501cb5..afc3a8d8 100644 --- a/v3-sdk/swap-and-add-liquidity/src/libs/liquidity.ts +++ b/v3-sdk/swap-and-add-liquidity/src/libs/liquidity.ts @@ -154,12 +154,12 @@ export async function getTokenTransferApproval( return TransactionState.Failed } - const receipt = await approveTokenTransfer( + const receipt = await approveTokenTransfer({ contractAddress, - token.address, - rawAmount, - getWallet() - ) + tokenAddress: token.address, + amount: rawAmount, + signer: getWallet(), + }) if (receipt) { return TransactionState.Sent } else { diff --git a/v3-sdk/swap-and-add-liquidity/src/libs/pool.ts b/v3-sdk/swap-and-add-liquidity/src/libs/pool.ts index 17c74cc6..3f0d03a2 100644 --- a/v3-sdk/swap-and-add-liquidity/src/libs/pool.ts +++ b/v3-sdk/swap-and-add-liquidity/src/libs/pool.ts @@ -8,10 +8,10 @@ export async function getPool(): Promise { throw new Error('No provider') } - return Pool.initFromChain( + return Pool.initFromChain({ provider, - CurrentConfig.tokens.token0, - CurrentConfig.tokens.token1, - CurrentConfig.tokens.poolFee - ) + tokenA: CurrentConfig.tokens.token0, + tokenB: CurrentConfig.tokens.token1, + fee: CurrentConfig.tokens.poolFee, + }) } diff --git a/v3-sdk/swap-and-add-liquidity/yarn.lock b/v3-sdk/swap-and-add-liquidity/yarn.lock index e8d839aa..950ac872 100644 --- a/v3-sdk/swap-and-add-liquidity/yarn.lock +++ b/v3-sdk/swap-and-add-liquidity/yarn.lock @@ -2614,16 +2614,16 @@ ethers "^5.3.1" tiny-invariant "^1.3.1" -"@uniswap/router-sdk@npm:@florian-s-a-w/uniswap-router-sdk@^1.7.2": - version "1.7.2" - resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-router-sdk/-/uniswap-router-sdk-1.7.2.tgz#8944f074d93043e9e41a9452c22d3a9323614514" - integrity sha512-mRfTU1Oc40Wh+qBoM3mva1G2xal9yUiyMUfrR89ifoB6j1gUM8qcJSsFqDGN/1VqAtkyFvhdDBXbPLguUBcs6A== +"@uniswap/router-sdk@npm:@florian-s-a-w/uniswap-router-sdk@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-router-sdk/-/uniswap-router-sdk-1.8.0.tgz#84a95a64c53727ffc2bf9bfbd131ec1ff9a9d184" + integrity sha512-EvTxQXh5I/9yv9RN7WiGs95PdqqA9QD6OqxkgrmsAyATDJImSnFPfnLO5WNd/RpnK4ihO4IEBFIGpGWIl4/Fjw== dependencies: "@ethersproject/abi" "^5.5.0" "@uniswap/sdk-core" "npm:@koraykoska/uniswap-sdk-core@^6.0.9" "@uniswap/swap-router-contracts" "^1.1.0" "@uniswap/v2-sdk" "npm:@florian-s-a-w/uniswap-v2-sdk@^3.2.4" - "@uniswap/v3-sdk" "npm:@florian-s-a-w/uniswap-v3-sdk@^3.15.12" + "@uniswap/v3-sdk" "npm:@florian-s-a-w/uniswap-v3-sdk@^4.0.2" "@uniswap/sdk-core@npm:@koraykoska/uniswap-sdk-core@^6.0.9": version "6.0.9" @@ -2637,21 +2637,21 @@ tiny-invariant "^1.1.0" toformat "^2.0.0" -"@uniswap/smart-order-router@npm:@florian-s-a-w/uniswap-smart-order-router@^3.18.8": - version "3.18.8" - resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-smart-order-router/-/uniswap-smart-order-router-3.18.8.tgz#a7515df032e60a34bb3c7c86d7b8eb393f6b4656" - integrity sha512-SSVJGSdO0ig7ZyCxCcHDHWCZFU/VvCE4NYkNmlq+2Y5f+SUHpFNcVE6hYoutLVxamceylxQHuxWXoIgArqcvpw== +"@uniswap/smart-order-router@npm:@florian-s-a-w/uniswap-smart-order-router@^3.19.0": + version "3.19.0" + resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-smart-order-router/-/uniswap-smart-order-router-3.19.0.tgz#6694398bc8e5eedb5b309421d7bf33affce80af0" + integrity sha512-w7LF3bkAeK1LeM6wKc/QdCgRNT2B5BV4HgZ+rRb6W3g04zPPEo09W0+Zk/sOw1QslEqkG1+o33kFZV8xH4mxqA== dependencies: "@uniswap/default-token-list" "npm:@florian-s-a-w/uniswap-default-token-list@^11.10.0" "@uniswap/permit2-sdk" "^1.2.0" - "@uniswap/router-sdk" "npm:@florian-s-a-w/uniswap-router-sdk@^1.7.2" + "@uniswap/router-sdk" "npm:@florian-s-a-w/uniswap-router-sdk@^1.8.0" "@uniswap/sdk-core" "npm:@koraykoska/uniswap-sdk-core@^6.0.9" "@uniswap/swap-router-contracts" "^1.3.0" "@uniswap/token-lists" "^1.0.0-beta.31" "@uniswap/universal-router" "^1.0.1" - "@uniswap/universal-router-sdk" "npm:@florian-s-a-w/uniswap-universal-router-sdk@^2.1.0" + "@uniswap/universal-router-sdk" "npm:@florian-s-a-w/uniswap-universal-router-sdk@^2.2.0" "@uniswap/v2-sdk" "npm:@florian-s-a-w/uniswap-v2-sdk@^3.2.4" - "@uniswap/v3-sdk" "npm:@florian-s-a-w/uniswap-v3-sdk@^3.15.12" + "@uniswap/v3-sdk" "npm:@florian-s-a-w/uniswap-v3-sdk@^4.0.2" async-retry "^1.3.1" await-timeout "^1.1.1" axios "^0.21.1" @@ -2682,17 +2682,17 @@ resolved "https://registry.yarnpkg.com/@uniswap/token-lists/-/token-lists-1.0.0-beta.33.tgz#966ba96c9ccc8f0e9e09809890b438203f2b1911" integrity sha512-JQkXcpRI3jFG8y3/CGC4TS8NkDgcxXaOQuYW8Qdvd6DcDiIyg2vVYCG9igFEzF0G6UvxgHkBKC7cWCgzZNYvQg== -"@uniswap/universal-router-sdk@npm:@florian-s-a-w/uniswap-universal-router-sdk@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-universal-router-sdk/-/uniswap-universal-router-sdk-2.1.0.tgz#c70fd0e8aaf9fec13fd8cb4d46113112f30afd09" - integrity sha512-TSYpV7Pk85odl5UXTR7c5c4+QFTVp235azgAKtJj7RayReDk+djGcWtCcj/qHGfvyHAlvPgbgGHAT/KW0WH3/A== +"@uniswap/universal-router-sdk@npm:@florian-s-a-w/uniswap-universal-router-sdk@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-universal-router-sdk/-/uniswap-universal-router-sdk-2.2.0.tgz#73963b4b1db0f7d1cec4e9bd825f5536ed28a31a" + integrity sha512-o/41lcxZbN4oFfF81izFi5mWoJHwAQlxFBkYoZWQJpqNeNjBV6BQRTCiC2xSo6a2emFrOD1fLB6H0Hf96ARqVg== dependencies: "@uniswap/permit2-sdk" "^1.2.0" - "@uniswap/router-sdk" "npm:@florian-s-a-w/uniswap-router-sdk@^1.7.2" + "@uniswap/router-sdk" "npm:@florian-s-a-w/uniswap-router-sdk@^1.8.0" "@uniswap/sdk-core" "npm:@koraykoska/uniswap-sdk-core@^6.0.9" "@uniswap/universal-router" "1.5.1" "@uniswap/v2-sdk" "npm:@florian-s-a-w/uniswap-v2-sdk@^3.2.4" - "@uniswap/v3-sdk" "npm:@florian-s-a-w/uniswap-v3-sdk@^3.15.12" + "@uniswap/v3-sdk" "npm:@florian-s-a-w/uniswap-v3-sdk@^4.0.2" bignumber.js "^9.0.2" ethers "^5.3.1" @@ -2742,10 +2742,10 @@ "@uniswap/v3-core" "^1.0.0" base64-sol "1.0.1" -"@uniswap/v3-sdk@npm:@florian-s-a-w/uniswap-v3-sdk@3.15.18", "@uniswap/v3-sdk@npm:@florian-s-a-w/uniswap-v3-sdk@^3.15.12": - version "3.15.18" - resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-v3-sdk/-/uniswap-v3-sdk-3.15.18.tgz#7396fa89834ef71eda944a3e697cca2a4b23ff2b" - integrity sha512-rPK/JiEuDIHP1F35uiupx7wMArnRO0WjoeNVe59FyhJYhyEyhoQHop3zT0OA+mn5ckWlOj6MHBv82tkhCPZwQQ== +"@uniswap/v3-sdk@npm:@florian-s-a-w/uniswap-v3-sdk@4.0.2", "@uniswap/v3-sdk@npm:@florian-s-a-w/uniswap-v3-sdk@^4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@florian-s-a-w/uniswap-v3-sdk/-/uniswap-v3-sdk-4.0.2.tgz#260942599aab4baf4d91a5643c204dba94dd0507" + integrity sha512-/8qO6E0rhsMQ9PGEf2pa+H8lbi7a7rpoHuQPbcvnauYD5KmaLiAnVC5MjYfO3SmX5ZENoDVLFibI3LXF05q1yg== dependencies: "@ethersproject/abi" "^5.0.12" "@ethersproject/solidity" "^5.0.9"