From d2da7f657c779a05a1e04aba14aaf027dd3d5b40 Mon Sep 17 00:00:00 2001 From: kaushalrajbacancy <78725072+kaushalrajbacancy@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:53:13 +0530 Subject: [PATCH] Updated contract addresses across all chains (#11) * Updated contract addresses across all chains and implementation of installModule/uninstallModule functions * Update contract addresses on XDC Testnet * Update Networks details --- CHANGELOG.md | 10 +- ...2-add-guardians.ts => 05-add-guardians.ts} | 0 examples/05-get-account-balances.ts | 19 - examples/{13-paymaster.ts => 06-paymaster.ts} | 0 examples/06-transaction.ts | 17 - ...paymaster-arka.ts => 07-paymaster-arka.ts} | 0 examples/07-transactions.ts | 21 - examples/08-nft-list.ts | 18 - ... => 08-paymaster-validUntil-validAfter.ts} | 0 ...{20-callGasLimit.ts => 09-callGasLimit.ts} | 0 examples/09-exchange.ts | 33 - examples/10-advance-routes-lifi.ts | 38 -- ...ccounts.ts => 10-get-multiple-accounts.ts} | 0 ...nt-userops.ts => 11-concurrent-userops.ts} | 0 ...3-bundlerApiKey.ts => 12-bundlerApiKey.ts} | 0 ...4-ArkaPaymaster.ts => 13-ArkaPaymaster.ts} | 0 examples/14-install-module.ts | 26 + examples/14-zeroDev-address.ts | 22 - examples/15-simpleAccount-address.ts | 22 - examples/15-uninstall-module.ts | 32 + examples/17-token-list.ts | 30 - examples/18-exchange-rates.ts | 29 - examples/25-get-quotes.ts | 46 -- examples/26-install-module.ts | 58 -- examples/27-uninstall-module.ts | 58 -- package-lock.json | 323 +--------- package.json | 36 +- src/sdk/api/constants.ts | 29 - src/sdk/api/index.ts | 2 - src/sdk/api/interfaces.ts | 16 - src/sdk/api/restApi.service.ts | 49 -- src/sdk/base/BaseAccountAPI.ts | 6 +- src/sdk/base/SimpleAccountWalletAPI.ts | 129 ---- src/sdk/base/ZeroDevWalletAPI.ts | 185 ------ .../SimpleAccount/SimpleAccountAbi.ts | 524 ---------------- .../SimpleAccount/SimpleAccountFactoryAbi.ts | 74 --- .../EtherspotWallet7579Factory__factory.ts | 2 +- .../zeroDevKernal/ECDSAKernelFactoryAbi.ts | 110 ---- .../zeroDevKernal/KernalAccountAbi.ts | 579 ------------------ .../zeroDevKernal/KernalFactoryAbi.ts | 380 ------------ .../contracts/zeroDevKernal/MultiSendAbi.ts | 20 - src/sdk/data/classes/account-balance.ts | 12 - src/sdk/data/classes/account-balances.ts | 7 - src/sdk/data/classes/advance-routes-lifi.ts | 5 - src/sdk/data/classes/decoded-log-param.ts | 11 - .../data/classes/exchange-bridging-quote.ts | 54 -- src/sdk/data/classes/exchange-offer.ts | 17 - src/sdk/data/classes/exchange-offers.ts | 7 - src/sdk/data/classes/index.ts | 29 - src/sdk/data/classes/internal-transaction.ts | 11 - src/sdk/data/classes/nft-collection.ts | 21 - src/sdk/data/classes/nft-list.ts | 8 - src/sdk/data/classes/nft.ts | 13 - src/sdk/data/classes/paginated-tokens.ts | 8 - src/sdk/data/classes/quote.ts | 10 - src/sdk/data/classes/rate-data.ts | 11 - src/sdk/data/classes/rate-info.ts | 7 - .../data/classes/step-transactions-lifi.ts | 25 - src/sdk/data/classes/token-list-token copy.ts | 8 - src/sdk/data/classes/token-list-token.ts | 8 - src/sdk/data/classes/token-list.ts | 19 - src/sdk/data/classes/token-lists.ts | 7 - src/sdk/data/classes/token.ts | 8 - src/sdk/data/classes/transaction-asset.ts | 25 - src/sdk/data/classes/transaction-batch.ts | 15 - src/sdk/data/classes/transaction-data.ts | 11 - .../data/classes/transaction-log-decoded.ts | 9 - src/sdk/data/classes/transaction-log.ts | 11 - src/sdk/data/classes/transaction-status.ts | 6 - src/sdk/data/classes/transaction.ts | 58 -- src/sdk/data/classes/transactions.ts | 71 --- src/sdk/data/constants.ts | 60 -- src/sdk/data/data.module.ts | 345 ----------- src/sdk/data/index.ts | 3 - src/sdk/dataUtils.ts | 280 --------- src/sdk/dto/advance-routes-lifi.dto.ts | 40 -- src/sdk/dto/fetch-exchange-rates.dto.ts | 14 - src/sdk/dto/get-account-balances.dto.ts | 20 - .../dto/get-exchange-cross-chain-quote.dto.ts | 43 -- src/sdk/dto/get-exchange-offers.dto.ts | 29 - .../dto/get-exchange-supported-assets.dto.ts | 11 - src/sdk/dto/get-nft-list.dto.ts | 10 - src/sdk/dto/get-quotes.dto.ts | 29 - src/sdk/dto/get-step-transactions-lifi.dto.ts | 9 - src/sdk/dto/get-supported-assets.dto.ts | 12 - src/sdk/dto/get-token-list.dto.ts | 13 - src/sdk/dto/get-token-lists.dto.ts | 6 - src/sdk/dto/get-transaction-status.dto.ts | 19 - src/sdk/dto/get-transaction.dto.ts | 10 - src/sdk/dto/get-transactions.dto.ts | 11 - src/sdk/dto/index.ts | 16 - src/sdk/dto/pagination.dto.ts | 14 - src/sdk/index.ts | 4 +- src/sdk/interfaces.ts | 2 - src/sdk/network/constants.ts | 481 ++------------- src/sdk/network/interfaces.ts | 6 +- src/sdk/sdk.ts | 84 ++- 97 files changed, 194 insertions(+), 4832 deletions(-) rename examples/{12-add-guardians.ts => 05-add-guardians.ts} (100%) delete mode 100644 examples/05-get-account-balances.ts rename examples/{13-paymaster.ts => 06-paymaster.ts} (100%) delete mode 100644 examples/06-transaction.ts rename examples/{16-paymaster-arka.ts => 07-paymaster-arka.ts} (100%) delete mode 100644 examples/07-transactions.ts delete mode 100644 examples/08-nft-list.ts rename examples/{19-paymaster-validUntil-validAfter.ts => 08-paymaster-validUntil-validAfter.ts} (100%) rename examples/{20-callGasLimit.ts => 09-callGasLimit.ts} (100%) delete mode 100644 examples/09-exchange.ts delete mode 100644 examples/10-advance-routes-lifi.ts rename examples/{21-get-multiple-accounts.ts => 10-get-multiple-accounts.ts} (100%) rename examples/{22-concurrent-userops.ts => 11-concurrent-userops.ts} (100%) rename examples/{23-bundlerApiKey.ts => 12-bundlerApiKey.ts} (100%) rename examples/{24-ArkaPaymaster.ts => 13-ArkaPaymaster.ts} (100%) create mode 100644 examples/14-install-module.ts delete mode 100644 examples/14-zeroDev-address.ts delete mode 100644 examples/15-simpleAccount-address.ts create mode 100644 examples/15-uninstall-module.ts delete mode 100644 examples/17-token-list.ts delete mode 100644 examples/18-exchange-rates.ts delete mode 100644 examples/25-get-quotes.ts delete mode 100644 examples/26-install-module.ts delete mode 100644 examples/27-uninstall-module.ts delete mode 100644 src/sdk/api/constants.ts delete mode 100644 src/sdk/api/index.ts delete mode 100644 src/sdk/api/interfaces.ts delete mode 100644 src/sdk/api/restApi.service.ts delete mode 100644 src/sdk/base/SimpleAccountWalletAPI.ts delete mode 100644 src/sdk/base/ZeroDevWalletAPI.ts delete mode 100644 src/sdk/contracts/SimpleAccount/SimpleAccountAbi.ts delete mode 100644 src/sdk/contracts/SimpleAccount/SimpleAccountFactoryAbi.ts delete mode 100644 src/sdk/contracts/zeroDevKernal/ECDSAKernelFactoryAbi.ts delete mode 100644 src/sdk/contracts/zeroDevKernal/KernalAccountAbi.ts delete mode 100644 src/sdk/contracts/zeroDevKernal/KernalFactoryAbi.ts delete mode 100644 src/sdk/contracts/zeroDevKernal/MultiSendAbi.ts delete mode 100644 src/sdk/data/classes/account-balance.ts delete mode 100644 src/sdk/data/classes/account-balances.ts delete mode 100644 src/sdk/data/classes/advance-routes-lifi.ts delete mode 100644 src/sdk/data/classes/decoded-log-param.ts delete mode 100644 src/sdk/data/classes/exchange-bridging-quote.ts delete mode 100644 src/sdk/data/classes/exchange-offer.ts delete mode 100644 src/sdk/data/classes/exchange-offers.ts delete mode 100644 src/sdk/data/classes/index.ts delete mode 100644 src/sdk/data/classes/internal-transaction.ts delete mode 100644 src/sdk/data/classes/nft-collection.ts delete mode 100644 src/sdk/data/classes/nft-list.ts delete mode 100644 src/sdk/data/classes/nft.ts delete mode 100644 src/sdk/data/classes/paginated-tokens.ts delete mode 100644 src/sdk/data/classes/quote.ts delete mode 100644 src/sdk/data/classes/rate-data.ts delete mode 100644 src/sdk/data/classes/rate-info.ts delete mode 100644 src/sdk/data/classes/step-transactions-lifi.ts delete mode 100644 src/sdk/data/classes/token-list-token copy.ts delete mode 100644 src/sdk/data/classes/token-list-token.ts delete mode 100644 src/sdk/data/classes/token-list.ts delete mode 100644 src/sdk/data/classes/token-lists.ts delete mode 100644 src/sdk/data/classes/token.ts delete mode 100644 src/sdk/data/classes/transaction-asset.ts delete mode 100644 src/sdk/data/classes/transaction-batch.ts delete mode 100644 src/sdk/data/classes/transaction-data.ts delete mode 100644 src/sdk/data/classes/transaction-log-decoded.ts delete mode 100644 src/sdk/data/classes/transaction-log.ts delete mode 100644 src/sdk/data/classes/transaction-status.ts delete mode 100644 src/sdk/data/classes/transaction.ts delete mode 100644 src/sdk/data/classes/transactions.ts delete mode 100644 src/sdk/data/constants.ts delete mode 100644 src/sdk/data/data.module.ts delete mode 100644 src/sdk/data/index.ts delete mode 100644 src/sdk/dataUtils.ts delete mode 100644 src/sdk/dto/advance-routes-lifi.dto.ts delete mode 100644 src/sdk/dto/fetch-exchange-rates.dto.ts delete mode 100644 src/sdk/dto/get-account-balances.dto.ts delete mode 100644 src/sdk/dto/get-exchange-cross-chain-quote.dto.ts delete mode 100644 src/sdk/dto/get-exchange-offers.dto.ts delete mode 100644 src/sdk/dto/get-exchange-supported-assets.dto.ts delete mode 100644 src/sdk/dto/get-nft-list.dto.ts delete mode 100644 src/sdk/dto/get-quotes.dto.ts delete mode 100644 src/sdk/dto/get-step-transactions-lifi.dto.ts delete mode 100644 src/sdk/dto/get-supported-assets.dto.ts delete mode 100644 src/sdk/dto/get-token-list.dto.ts delete mode 100644 src/sdk/dto/get-token-lists.dto.ts delete mode 100644 src/sdk/dto/get-transaction-status.dto.ts delete mode 100644 src/sdk/dto/get-transaction.dto.ts delete mode 100644 src/sdk/dto/get-transactions.dto.ts delete mode 100644 src/sdk/dto/pagination.dto.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 26617b9..cb9148b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog -## [2.0.0] - 2024-06-04 +## [1.0.1] - 2024-06-13 +### New +- The addresses of the contracts have been updated on all chains. +### Changes +- The `installModule` and `uninstallModule` functions have been enhanced to allow direct module installation and uninstallation from within the functions, providing a return of the UserOp Hash. +- The `DataUtils` module has been removed from the code. +- The code supporting ZeroDev and SimpleAccount has been removed. + +## [1.0.0] - 2024-06-04 ### New - Added support for EP7.0 and Etherspot's Modular accounts - Added `installModule` function to install module diff --git a/examples/12-add-guardians.ts b/examples/05-add-guardians.ts similarity index 100% rename from examples/12-add-guardians.ts rename to examples/05-add-guardians.ts diff --git a/examples/05-get-account-balances.ts b/examples/05-get-account-balances.ts deleted file mode 100644 index 9ae9d50..0000000 --- a/examples/05-get-account-balances.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - -async function main() { - // initializating Data service... - const dataService = new DataUtils(); - - const balances = await dataService.getAccountBalances({ - account: '', // address - chainId: 1, - }); - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet balances:`, balances); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/13-paymaster.ts b/examples/06-paymaster.ts similarity index 100% rename from examples/13-paymaster.ts rename to examples/06-paymaster.ts diff --git a/examples/06-transaction.ts b/examples/06-transaction.ts deleted file mode 100644 index b7e1607..0000000 --- a/examples/06-transaction.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(); - const hash = '0x7f8633f21d0c0c71d248333a0a2b976495015109a270a6f8a51befe3baf6fb6e'; - const transaction = await dataService.getTransaction({ hash, chainId: 80001 }); - - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet transaction:`, transaction); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/16-paymaster-arka.ts b/examples/07-paymaster-arka.ts similarity index 100% rename from examples/16-paymaster-arka.ts rename to examples/07-paymaster-arka.ts diff --git a/examples/07-transactions.ts b/examples/07-transactions.ts deleted file mode 100644 index 5746d1d..0000000 --- a/examples/07-transactions.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; -dotenv.config(); - -const dataApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjI4ZWJiMGQ5YTMxYjQ3MmY4NmU4MWY2YTVhYzBhMzE1IiwiaCI6Im11cm11cjEyOCJ9'; - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(dataApiKey); - const account = '0xe05fb316eb8c4ba7288d43c1bd87be8a8d16761c'; - const transactions = await dataService.getTransactions({ - account, - chainId: 122, - }); - - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet transactions:`, transactions); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/08-nft-list.ts b/examples/08-nft-list.ts deleted file mode 100644 index f5219d5..0000000 --- a/examples/08-nft-list.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(); - const chainId = 137; - const account = ''; // account address - const nfts = await dataService.getNftList({ chainId, account }); - - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet nfts:`, nfts); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/19-paymaster-validUntil-validAfter.ts b/examples/08-paymaster-validUntil-validAfter.ts similarity index 100% rename from examples/19-paymaster-validUntil-validAfter.ts rename to examples/08-paymaster-validUntil-validAfter.ts diff --git a/examples/20-callGasLimit.ts b/examples/09-callGasLimit.ts similarity index 100% rename from examples/20-callGasLimit.ts rename to examples/09-callGasLimit.ts diff --git a/examples/09-exchange.ts b/examples/09-exchange.ts deleted file mode 100644 index 797ccab..0000000 --- a/examples/09-exchange.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { BigNumber, constants } from 'ethers'; -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); -const dataApiKey = ''; - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(dataApiKey); - const exchangeSupportedAssets = await dataService.getExchangeSupportedAssets({ page: 1, limit: 100, account: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', chainId: Number(process.env.CHAIN_ID) }); - console.log('\x1b[33m%s\x1b[0m', `Found exchange supported assets:`, exchangeSupportedAssets.items.length); - - const fromChainId = 1; - const fromAddress = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; - const fromTokenAddress = constants.AddressZero; - const toTokenAddress = '0xe3818504c1b32bf1557b16c238b2e01fd3149c17'; - const fromAmount = '1000000000000000000'; - - const offers = await dataService.getExchangeOffers({ - fromAddress, - fromChainId, - fromTokenAddress, - toTokenAddress, - fromAmount: BigNumber.from(fromAmount), - }); - - console.log('\x1b[33m%s\x1b[0m', `Exchange offers:`, offers); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/10-advance-routes-lifi.ts b/examples/10-advance-routes-lifi.ts deleted file mode 100644 index 4fee72e..0000000 --- a/examples/10-advance-routes-lifi.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { ethers, utils } from 'ethers'; -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; -dotenv.config(); - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(); - - const fromChainId = 56; - const toChainId = 137; - - const fromAmount = utils.parseUnits('1', 18); - - const quoteRequestPayload = { - fromAddress: '', - fromChainId: fromChainId, - toChainId: toChainId, - fromTokenAddress: ethers.constants.AddressZero, - toTokenAddress: ethers.constants.AddressZero, - fromAmount: fromAmount, - }; - - const quotes = await dataService.getAdvanceRoutesLiFi(quoteRequestPayload); - - console.log('\x1b[33m%s\x1b[0m', `Quotes:`, quotes.items); - - if (quotes.items.length > 0) { - const quote = quotes.items[0]; // Selected the first route - const transactions = await dataService.getStepTransaction({ route: quote, account: '' }); - - console.log('\x1b[33m%s\x1b[0m', `transactions:`, transactions); - } -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/21-get-multiple-accounts.ts b/examples/10-get-multiple-accounts.ts similarity index 100% rename from examples/21-get-multiple-accounts.ts rename to examples/10-get-multiple-accounts.ts diff --git a/examples/22-concurrent-userops.ts b/examples/11-concurrent-userops.ts similarity index 100% rename from examples/22-concurrent-userops.ts rename to examples/11-concurrent-userops.ts diff --git a/examples/23-bundlerApiKey.ts b/examples/12-bundlerApiKey.ts similarity index 100% rename from examples/23-bundlerApiKey.ts rename to examples/12-bundlerApiKey.ts diff --git a/examples/24-ArkaPaymaster.ts b/examples/13-ArkaPaymaster.ts similarity index 100% rename from examples/24-ArkaPaymaster.ts rename to examples/13-ArkaPaymaster.ts diff --git a/examples/14-install-module.ts b/examples/14-install-module.ts new file mode 100644 index 0000000..7aa6f62 --- /dev/null +++ b/examples/14-install-module.ts @@ -0,0 +1,26 @@ +import { EtherspotBundler, ModularSdk } from '../src'; +import * as dotenv from 'dotenv'; +import { MODULE_TYPE } from '../src/sdk/common'; + +dotenv.config(); + +async function main() { + const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9'; + + // initializating sdk... + const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { chainId: Number(process.env.CHAIN_ID), bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) }) + + console.log('address: ', modularSdk.state.EOAAddress); + + // get address of EtherspotWallet + const address: string = await modularSdk.getCounterFactualAddress(); + + console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet address: ${address}`); + + const uoHash = await modularSdk.installModule(MODULE_TYPE.VALIDATOR, '0x1417aDC5308a32265E0fA0690ea1408FFA62F37c'); + console.log(`UserOpHash: ${uoHash}`); +} + +main() + .catch(console.error) + .finally(() => process.exit()); diff --git a/examples/14-zeroDev-address.ts b/examples/14-zeroDev-address.ts deleted file mode 100644 index 23da2bb..0000000 --- a/examples/14-zeroDev-address.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { EtherspotBundler, Factory, ModularSdk } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - - -async function main() { - const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9'; - // initializating sdk... - const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { - chainId: Number(process.env.CHAIN_ID), factoryWallet: Factory.ZERO_DEV, - bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) - }) - - // get ZeroDev address... - const address: string = await modularSdk.getCounterFactualAddress(); - console.log('\x1b[33m%s\x1b[0m', `ZeroDev address: ${address}`); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/15-simpleAccount-address.ts b/examples/15-simpleAccount-address.ts deleted file mode 100644 index 12009e9..0000000 --- a/examples/15-simpleAccount-address.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { EtherspotBundler, Factory, ModularSdk } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - - -async function main() { - const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9'; - // initializating sdk... - const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { - chainId: Number(process.env.CHAIN_ID), factoryWallet: Factory.SIMPLE_ACCOUNT, - bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) - }) - - // get SimpleAccount address... - const address: string = await modularSdk.getCounterFactualAddress(); - console.log('\x1b[33m%s\x1b[0m', `SimpleAccount address: ${address}`); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/15-uninstall-module.ts b/examples/15-uninstall-module.ts new file mode 100644 index 0000000..4edadb0 --- /dev/null +++ b/examples/15-uninstall-module.ts @@ -0,0 +1,32 @@ +import { ethers } from 'ethers'; +import { EtherspotBundler, ModularSdk } from '../src'; +import * as dotenv from 'dotenv'; +import { MODULE_TYPE } from '../src/sdk/common'; + +dotenv.config(); + +async function main() { + const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9'; + + // initializating sdk... + const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { chainId: Number(process.env.CHAIN_ID), bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) }) + + console.log('address: ', modularSdk.state.EOAAddress); + + // get address of EtherspotWallet + const address: string = await modularSdk.getCounterFactualAddress(); + + console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet address: ${address}`); + + const deInitData = ethers.utils.defaultAbiCoder.encode( + ["address", "bytes"], + ['0x0000000000000000000000000000000000000001', '0x00'] + ); + + const uoHash = await modularSdk.uninstallModule(MODULE_TYPE.VALIDATOR, '0x1417aDC5308a32265E0fA0690ea1408FFA62F37c', deInitData); + console.log(`UserOpHash: ${uoHash}`); +} + +main() + .catch(console.error) + .finally(() => process.exit()); diff --git a/examples/17-token-list.ts b/examples/17-token-list.ts deleted file mode 100644 index f46a268..0000000 --- a/examples/17-token-list.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(); - - const tokenLists = await dataService.getTokenLists({ chainId: 1 }); - - console.log('\x1b[33m%s\x1b[0m', `TokenLists:`, tokenLists); - - const { name } = tokenLists[0]; - - let tokenListTokens = await dataService.getTokenListTokens({ chainId: 1 }); - - console.log('\x1b[33m%s\x1b[0m', `Default token list tokens length:`, tokenListTokens.length); - - tokenListTokens = await dataService.getTokenListTokens({ - chainId: 1, - name, - }); - - console.log('\x1b[33m%s\x1b[0m', `${name} token list tokens length:`, tokenListTokens.length); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/18-exchange-rates.ts b/examples/18-exchange-rates.ts deleted file mode 100644 index 38ba052..0000000 --- a/examples/18-exchange-rates.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { RateData } from '../src/sdk/data'; -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(); - - const ETH_AAVE_ADDR = '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9'; - const ETH_MATIC_ADDR = '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0'; - const ETH_USDC_ADDR = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; - const TOKEN_LIST = [ETH_AAVE_ADDR, ETH_MATIC_ADDR, ETH_USDC_ADDR]; - const ETH_CHAIN_ID = 1; - - const requestPayload = { - tokens: TOKEN_LIST, - chainId: ETH_CHAIN_ID, - }; - - const rates: RateData = await dataService.fetchExchangeRates(requestPayload); - - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet Rates:`, rates); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/25-get-quotes.ts b/examples/25-get-quotes.ts deleted file mode 100644 index cf7ab8c..0000000 --- a/examples/25-get-quotes.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { utils } from 'ethers'; -import { DataUtils } from '../src'; -import * as dotenv from 'dotenv'; -import { BridgingProvider } from '../src/sdk/data'; - -dotenv.config(); -const dataApiKey = ''; - -async function main(): Promise { - // initializating Data service... - const dataService = new DataUtils(dataApiKey); - - const allSupportedAssets = await dataService.getSupportedAssets({}); - // the default provider is Connext - console.log('\x1b[33m%s\x1b[0m', `All supported assets:`, allSupportedAssets.length); - - const supportedAssets = await dataService.getSupportedAssets({ - chainId: 1, - provider: BridgingProvider.Connext, - }); - console.log('\x1b[33m%s\x1b[0m', `Connext supported assets per chain:`, supportedAssets.length); - - const quotes = await dataService.getQuotes({ - fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', - toAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', - fromChainId: 1, - toChainId: 10, - fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - fromAmount: utils.parseUnits('1', 18), - slippage: 0.1, - provider: BridgingProvider.Connext, - }); - console.log('\x1b[33m%s\x1b[0m', `Connext quote transactions:`, quotes); - - const transactionStatus = await dataService.getTransactionStatus({ - fromChainId: 100, - toChainId: 56, - transactionHash: '0xfc46adedf462d3fd6cdbe0214ed11c06cba20c385b9875aa4d51c60afbd9725d', - provider: BridgingProvider.Connext, - }); - console.log('\x1b[33m%s\x1b[0m', `Connext transaction status:`, transactionStatus); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/26-install-module.ts b/examples/26-install-module.ts deleted file mode 100644 index 886c2f7..0000000 --- a/examples/26-install-module.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ethers } from 'ethers'; -import { EtherspotBundler, ModularSdk } from '../src'; -import { printOp } from '../src/sdk/common/OperationUtils'; -import * as dotenv from 'dotenv'; -import { MODULE_TYPE, sleep } from '../src/sdk/common'; - -dotenv.config(); - -async function main() { - const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9'; - - // initializating sdk... - const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { chainId: Number(process.env.CHAIN_ID), bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) }) - - console.log('address: ', modularSdk.state.EOAAddress); - - // get address of EtherspotWallet - const address: string = await modularSdk.getCounterFactualAddress(); - - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet address: ${address}`); - - const initData = ethers.utils.defaultAbiCoder.encode( - ["address", "bytes"], - ['0x0000000000000000000000000000000000000001', '0x00'] - ); - - // get installData of module - const installData = await modularSdk.installModule(MODULE_TYPE.VALIDATOR, '0x6a00da4DEEf677Ad854B7c14F17Ed9312c2B5fDf', initData); - - // clear the transaction batch - await modularSdk.clearUserOpsFromBatch(); - - // add transactions to the batch - const userOpsBatch = await modularSdk.addUserOpsToBatch({ to: address, data: installData }); - console.log('transactions: ', userOpsBatch); - - // sign transactions added to the batch - const op = await modularSdk.estimate(); - console.log(`Estimated UserOp: ${await printOp(op)}`); - - // sign the userOps and sending to the bundler... - const uoHash = await modularSdk.send(op); - console.log(`UserOpHash: ${uoHash}`); - - // get transaction hash... - console.log('Waiting for transaction...'); - let userOpsReceipt = null; - const timeout = Date.now() + 60000; // 1 minute timeout - while (userOpsReceipt == null && Date.now() < timeout) { - await sleep(2); - userOpsReceipt = await modularSdk.getUserOpReceipt(uoHash); - } - console.log('\x1b[33m%s\x1b[0m', `Transaction Receipt: `, userOpsReceipt); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/examples/27-uninstall-module.ts b/examples/27-uninstall-module.ts deleted file mode 100644 index ea872c6..0000000 --- a/examples/27-uninstall-module.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ethers } from 'ethers'; -import { EtherspotBundler, ModularSdk } from '../src'; -import { printOp } from '../src/sdk/common/OperationUtils'; -import * as dotenv from 'dotenv'; -import { MODULE_TYPE, sleep } from '../src/sdk/common'; - -dotenv.config(); - -async function main() { - const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9'; - - // initializating sdk... - const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { chainId: Number(process.env.CHAIN_ID), bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) }) - - console.log('address: ', modularSdk.state.EOAAddress); - - // get address of EtherspotWallet - const address: string = await modularSdk.getCounterFactualAddress(); - - console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet address: ${address}`); - - const deInitData = ethers.utils.defaultAbiCoder.encode( - ["address", "bytes"], - ['0x0000000000000000000000000000000000000001', '0x00'] - ); - - // get uninstallData of module - const uninstallData = await modularSdk.uninstallModule(MODULE_TYPE.VALIDATOR, '0x6a00da4DEEf677Ad854B7c14F17Ed9312c2B5fDf', deInitData); - - // clear the transaction batch - await modularSdk.clearUserOpsFromBatch(); - - // add transactions to the batch - const userOpsBatch = await modularSdk.addUserOpsToBatch({ to: address, data: uninstallData }); - console.log('transactions: ', userOpsBatch); - - // sign transactions added to the batch - const op = await modularSdk.estimate(); - console.log(`Estimated UserOp: ${await printOp(op)}`); - - // sign the userOps and sending to the bundler... - const uoHash = await modularSdk.send(op); - console.log(`UserOpHash: ${uoHash}`); - - // get transaction hash... - console.log('Waiting for transaction...'); - let userOpsReceipt = null; - const timeout = Date.now() + 60000; // 1 minute timeout - while (userOpsReceipt == null && Date.now() < timeout) { - await sleep(2); - userOpsReceipt = await modularSdk.getUserOpReceipt(uoHash); - } - console.log('\x1b[33m%s\x1b[0m', `Transaction Receipt: `, userOpsReceipt); -} - -main() - .catch(console.error) - .finally(() => process.exit()); diff --git a/package-lock.json b/package-lock.json index d59c37b..befee73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,34 +1,30 @@ { "name": "@etherspot/modular-sdk", - "version": "2.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@etherspot/modular-sdk", - "version": "2.0.0", + "version": "1.0.1", "license": "MIT", "dependencies": { "@lifi/sdk": "2.5.0", "@thehubbleproject/bls": "0.5.1", "@walletconnect/universal-provider": "2.10.0", - "apollo-link-ws": "1.0.20", "buffer": "^6.0.3", "class-transformer": "0.5.1", "class-validator": "0.14.1", "commander": "10.0.1", "cross-fetch": "3.1.8", "ethers": "5.7.2", - "graphql-ws": "5.14.2", "prettier": "2.8.8", - "qs": "6.12.0", "reflect-metadata": "0.1.14", "rxjs": "6.6.7" }, "devDependencies": { "@types/node": "18.11.9", "@types/prettier": "2.7.3", - "@types/qs": "6.9.12", "@typescript-eslint/eslint-plugin": "5.45.0", "@typescript-eslint/parser": "5.45.0", "dotenv": "16.0.3", @@ -1363,12 +1359,6 @@ "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", "dev": true }, - "node_modules/@types/qs": { - "version": "6.9.12", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.12.tgz", - "integrity": "sha512-bZcOkJ6uWrL0Qb2NAWKa7TBU+mJHPzhx9jjLL1KHF+XpzEcR7EXHvjbHlGtR/IsP1vyPrehuS6XqkmaePy//mg==", - "dev": true - }, "node_modules/@types/semver": { "version": "7.5.8", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", @@ -1834,14 +1824,6 @@ "tslib": "1.14.1" } }, - "node_modules/@wry/equality": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.11.tgz", - "integrity": "sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA==", - "dependencies": { - "tslib": "^1.9.3" - } - }, "node_modules/acorn": { "version": "8.11.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", @@ -1928,46 +1910,6 @@ "node": ">= 8" } }, - "node_modules/apollo-link": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.14.tgz", - "integrity": "sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg==", - "dependencies": { - "apollo-utilities": "^1.3.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.9.3", - "zen-observable-ts": "^0.8.21" - }, - "peerDependencies": { - "graphql": "^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0 || ^15.0.0" - } - }, - "node_modules/apollo-link-ws": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/apollo-link-ws/-/apollo-link-ws-1.0.20.tgz", - "integrity": "sha512-mjSFPlQxmoLArpHBeUb2Xj+2HDYeTaJqFGOqQ+I8NVJxgL9lJe84PDWcPah/yMLv3rB7QgBDSuZ0xoRFBPlySw==", - "dependencies": { - "apollo-link": "^1.2.14", - "tslib": "^1.9.3" - }, - "peerDependencies": { - "subscriptions-transport-ws": "^0.9.0" - } - }, - "node_modules/apollo-utilities": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "dependencies": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - } - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -1997,12 +1939,6 @@ "node": ">=8.0.0" } }, - "node_modules/backo2": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "integrity": "sha512-zj6Z6M7Eq+PBZ7PQxl5NT665MvJdAkzp0f60nAJ+sLaSCBPMwVak5ZegFbgVCzFcCJTKFoMizvM5Ld7+JrRJHA==", - "peer": true - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2106,24 +2042,6 @@ "ieee754": "^1.2.1" } }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2343,22 +2261,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/defu": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", @@ -2465,25 +2367,6 @@ "once": "^1.4.0" } }, - "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "engines": { - "node": ">= 0.4" - } - }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -2794,12 +2677,6 @@ "@ethersproject/wordlists": "5.7.0" } }, - "node_modules/eventemitter3": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==", - "peer": true - }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -2873,7 +2750,8 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -3007,24 +2885,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - }, + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3113,17 +2974,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -3136,26 +2986,6 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, - "node_modules/graphql": { - "version": "15.8.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.8.0.tgz", - "integrity": "sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==", - "peer": true, - "engines": { - "node": ">= 10.x" - } - }, - "node_modules/graphql-ws": { - "version": "5.14.2", - "resolved": "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.14.2.tgz", - "integrity": "sha512-LycmCwhZ+Op2GlHz4BZDsUYHKRiiUz+3r9wbhBATMETNlORQJAaFlAgTFoeRh6xQoQegwYwIylVD1Qns9/DA3w==", - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "graphql": ">=0.11 <=16" - } - }, "node_modules/h3": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/h3/-/h3-1.11.1.tgz", @@ -3203,39 +3033,6 @@ "node": ">=8" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -3249,6 +3046,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -3517,12 +3315,6 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, - "node_modules/iterall": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", - "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==", - "peer": true - }, "node_modules/jiti": { "version": "1.21.0", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", @@ -6892,14 +6684,6 @@ "inBundle": true, "license": "ISC" }, - "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/ofetch": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.4.tgz", @@ -7161,20 +6945,6 @@ "node": ">=6" } }, - "node_modules/qs": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.0.tgz", - "integrity": "sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg==", - "dependencies": { - "side-channel": "^1.0.6" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/query-string": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", @@ -7413,22 +7183,6 @@ "node": ">=10" } }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -7465,23 +7219,6 @@ "node": ">=4" } }, - "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", - "dependencies": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", @@ -7596,23 +7333,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/subscriptions-transport-ws": { - "version": "0.9.19", - "resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.19.tgz", - "integrity": "sha512-dxdemxFFB0ppCLg10FTtRqH/31FNRL1y1BQv8209MK5I4CwALb7iihQg+7p65lFcIl8MHatINWBLOqpgU4Kyyw==", - "deprecated": "The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md", - "peer": true, - "dependencies": { - "backo2": "^1.0.2", - "eventemitter3": "^3.1.0", - "iterall": "^1.2.1", - "symbol-observable": "^1.0.4", - "ws": "^5.2.0 || ^6.0.0 || ^7.0.0" - }, - "peerDependencies": { - "graphql": ">=0.10.0" - } - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -7637,15 +7357,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/system-architecture": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/system-architecture/-/system-architecture-0.1.0.tgz", @@ -7687,14 +7398,6 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, - "node_modules/ts-invariant": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", - "integrity": "sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA==", - "dependencies": { - "tslib": "^1.9.3" - } - }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -8098,20 +7801,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/zen-observable": { - "version": "0.8.15", - "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", - "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" - }, - "node_modules/zen-observable-ts": { - "version": "0.8.21", - "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz", - "integrity": "sha512-Yj3yXweRc8LdRMrCC8nIc4kkjWecPAUVh0TI0OUrWXx6aX790vLcDlWca6I4vsyCGH3LpWxq0dJRcMOFoVqmeg==", - "dependencies": { - "tslib": "^1.9.3", - "zen-observable": "^0.8.0" - } } } } diff --git a/package.json b/package.json index 03afc47..bc0cd78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@etherspot/modular-sdk", - "version": "1.0.0", + "version": "1.0.1", "description": "Etherspot Modular SDK - build with ERC-7579 smart accounts modules", "keywords": [ "ether", @@ -28,26 +28,16 @@ "01-get-address": "./node_modules/.bin/ts-node ./examples/01-get-address", "02-transfer-funds": "./node_modules/.bin/ts-node ./examples/02-transfer-funds", "03-transfer-erc20": "./node_modules/.bin/ts-node ./examples/03-transfer-erc20", - "05-get-account-balances": "./node_modules/.bin/ts-node ./examples/05-get-account-balances", - "06-transaction": "./node_modules/.bin/ts-node ./examples/06-transaction", - "07-transactions": "./node_modules/.bin/ts-node ./examples/07-transactions", - "08-nft-list": "./node_modules/.bin/ts-node ./examples/08-nft-list", - "09-exchange": "./node_modules/.bin/ts-node ./examples/09-exchange", - "10-advance-routes-lifi": "./node_modules/.bin/ts-node ./examples/10-advance-routes-lifi", - "12-add-guardians": "./node_modules/.bin/ts-node ./examples/12-add-guardians", - "13-paymaster": "./node_modules/.bin/ts-node ./examples/13-paymaster", - "14-zeroDev-address": "./node_modules/.bin/ts-node ./examples/14-zeroDev-address", - "15-simpleAccount-address": "./node_modules/.bin/ts-node ./examples/15-simpleAccount-address", - "16-paymaster-arka": "./node_modules/.bin/ts-node ./examples/16-paymaster-arka", - "17-token-list": "./node_modules/.bin/ts-node ./examples/17-token-list", - "18-exchange-rates": "./node_modules/.bin/ts-node ./examples/18-exchange-rates", - "19-paymaster-validUntil-validAfter": "./node_modules/.bin/ts-node ./examples/19-paymaster-validUntil-validAfter", - "20-callGasLimit": "./node_modules/.bin/ts-node ./examples/20-callGasLimit", - "21-get-multiple-accounts": "./node_modules/.bin/ts-node ./examples/21-get-multiple-accounts", - "22-concurrent-userops": "./node_modules/.bin/ts-node ./examples/22-concurrent-userops", - "25-get-quotes": "./node_modules/.bin/ts-node ./examples/25-get-quotes", - "26-install-module": "./node_modules/.bin/ts-node ./examples/26-install-module", - "27-uninstall-module": "./node_modules/.bin/ts-node ./examples/27-uninstall-module", + "04-transfer-nft": "./node_modules/.bin/ts-node ./examples/04-transfer-nft", + "05-add-guardians": "./node_modules/.bin/ts-node ./examples/05-add-guardians", + "06-paymaster": "./node_modules/.bin/ts-node ./examples/06-paymaster", + "07-paymaster-arka": "./node_modules/.bin/ts-node ./examples/07-paymaster-arka", + "08-paymaster-validUntil-validAfter": "./node_modules/.bin/ts-node ./examples/08-paymaster-validUntil-validAfter", + "09-callGasLimit": "./node_modules/.bin/ts-node ./examples/09-callGasLimit", + "10-get-multiple-accounts": "./node_modules/.bin/ts-node ./examples/10-get-multiple-accounts", + "11-concurrent-userops": "./node_modules/.bin/ts-node ./examples/11-concurrent-userops", + "14-install-module": "./node_modules/.bin/ts-node ./examples/14-install-module", + "15-uninstall-module": "./node_modules/.bin/ts-node ./examples/15-uninstall-module", "format": "prettier --write \"{src,test,examples}/**/*.ts\"", "lint": "eslint \"{src,test,examples}/**/*.ts\"", "lint-fix": "npm run lint -- --fix", @@ -73,23 +63,19 @@ "@lifi/sdk": "2.5.0", "@thehubbleproject/bls": "0.5.1", "@walletconnect/universal-provider": "2.10.0", - "apollo-link-ws": "1.0.20", "buffer": "^6.0.3", "class-transformer": "0.5.1", "class-validator": "0.14.1", "commander": "10.0.1", "cross-fetch": "3.1.8", "ethers": "5.7.2", - "graphql-ws": "5.14.2", "prettier": "2.8.8", - "qs": "6.12.0", "reflect-metadata": "0.1.14", "rxjs": "6.6.7" }, "devDependencies": { "@types/node": "18.11.9", "@types/prettier": "2.7.3", - "@types/qs": "6.9.12", "@typescript-eslint/eslint-plugin": "5.45.0", "@typescript-eslint/parser": "5.45.0", "dotenv": "16.0.3", diff --git a/src/sdk/api/constants.ts b/src/sdk/api/constants.ts deleted file mode 100644 index 41e82dd..0000000 --- a/src/sdk/api/constants.ts +++ /dev/null @@ -1,29 +0,0 @@ -export const ŅacheSettings = { - TokenList: { - timeToLive: 1 * 60 * 60 * 12, // 12 hours - }, -}; - -export const MethodTypes = { - GET: 'GET', - POST: 'POST', -}; - -export const BACKEND_API_ENDPOINT = 'https://rpc.etherspot.io/data-api'; - -export const API_ENDPOINTS = { - GET_ACCOUNT_BALANCES: 'account/balances', - GET_ACCOUNT_NFTS: 'account/nfts', - GET_TRANSACTION: 'transactions/transactionByHash', - GET_TRANSACTIONS: 'transactions', - GET_ADVANCE_ROUTES_LIFI: 'exchange/getAdvanceRoutesLiFi', - GET_STEP_TRANSACTIONS: 'exchange/getStepTransactions', - GET_EXCHANGE_OFFERS: 'exchange/offers', - GET_CONNEXT_SUPPORTED_ASSETS: 'exchange/connext/supportedAssets', - GET_CONNEXT_QUOTE_TRANSACTIONS: 'exchange/connext/quoteTransactions', - GET_CONNEXT_TRANSACTION_STATUS: 'exchange/connext/transactionStatus', - GET_EXCHANGE_SUPPORTED_ASSETS: 'assets/exchangeSupportedAssets', - GET_TOKEN_LISTS: 'assets/tokenLists', - GET_TOKEN_LIST_TOKENS: 'assets/tokenListTokens', - EXCHANGE_RATES: 'rates/exchangeRates' -} diff --git a/src/sdk/api/index.ts b/src/sdk/api/index.ts deleted file mode 100644 index c96fb1e..0000000 --- a/src/sdk/api/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './interfaces'; -export * from './restApi.service'; diff --git a/src/sdk/api/interfaces.ts b/src/sdk/api/interfaces.ts deleted file mode 100644 index 9191526..0000000 --- a/src/sdk/api/interfaces.ts +++ /dev/null @@ -1,16 +0,0 @@ -export interface ApiOptions { - host: string; - port?: number; - useSsl?: boolean; -} - -export interface ApiRequestOptions { - variables?: { [key: string]: any }; - models?: { - [key in K]: { new (...args: any): T[K] }; - }; -} - -export interface QueryParams { - [key: string]: any; -} diff --git a/src/sdk/api/restApi.service.ts b/src/sdk/api/restApi.service.ts deleted file mode 100644 index 93af22d..0000000 --- a/src/sdk/api/restApi.service.ts +++ /dev/null @@ -1,49 +0,0 @@ -import fetch from 'cross-fetch'; -import qs from 'qs'; -import { QueryParams } from './interfaces'; -import { BACKEND_API_ENDPOINT } from './constants'; - -export class RestApiService { - async makeRequest(endpoint: string, method = 'GET', queryParams = {}, body = null) { - const queryString = qs.stringify(this.buildQueryParams(queryParams), { indices: false }); - const url = new URL(`${BACKEND_API_ENDPOINT}/${endpoint}?${queryString}`); - - const requestOptions = { - method, - headers: { - 'Content-Type': 'application/json', - }, - body: body ? JSON.stringify(body) : null, - }; - - try { - const response = await fetch(url.toString(), requestOptions); - - const data = await response.json(); - - if (!response.ok) { - if (response.status === 403) { - throw new Error('Invalid API Key'); - } - - throw new Error(data.message || data.error || 'Request failed'); - } - - return data; - } catch (error) { - throw new Error(error.message || 'Something went wrong'); - } - } - - buildQueryParams(params: QueryParams): QueryParams { - const queryParams: QueryParams = {}; - - for (const key in params) { - if (params.hasOwnProperty(key) && params[key] !== undefined && params[key] !== null) { - queryParams[key] = params[key]; - } - } - - return queryParams; - } -} diff --git a/src/sdk/base/BaseAccountAPI.ts b/src/sdk/base/BaseAccountAPI.ts index ebb3021..db138a1 100644 --- a/src/sdk/base/BaseAccountAPI.ts +++ b/src/sdk/base/BaseAccountAPI.ts @@ -267,10 +267,10 @@ export abstract class BaseAccountAPI { } const senderAddressCode = await this.provider.getCode(this.getAccountAddress()); if (senderAddressCode.length > 2) { - // console.log(`SimpleAccount Contract already deployed at ${this.senderAddress}`) + // console.log(`Contract already deployed at ${this.senderAddress}`) this.isPhantom = false; } else { - // console.log(`SimpleAccount Contract is NOT YET deployed at ${this.senderAddress} - working in "phantom account" mode.`) + // console.log(`Contract is NOT YET deployed at ${this.senderAddress} - working in "phantom account" mode.`) } return this.isPhantom; } @@ -342,8 +342,6 @@ export abstract class BaseAccountAPI { throw new Error('must have target address if data is single value'); } callData = await this.encodeExecute(target, value, data); - } else if (this.factoryUsed === Factory.SIMPLE_ACCOUNT && target.length === 1){ - callData = await this.encodeExecute(target[0], detailsForUserOp.values[0], data[0]); } else { if (typeof target === 'string') { target = Array(data.length).fill(target); diff --git a/src/sdk/base/SimpleAccountWalletAPI.ts b/src/sdk/base/SimpleAccountWalletAPI.ts deleted file mode 100644 index df2d992..0000000 --- a/src/sdk/base/SimpleAccountWalletAPI.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { BigNumber, BigNumberish, Contract, ethers } from 'ethers'; -import { - EntryPoint__factory, -} from '../contracts'; -import { arrayify, hexConcat } from 'ethers/lib/utils'; -import { BaseApiParams, BaseAccountAPI } from './BaseAccountAPI'; -import { SimpleAccountAbi } from '../contracts/SimpleAccount/SimpleAccountAbi'; -import { SimpleAccountFactoryAbi } from '../contracts/SimpleAccount/SimpleAccountFactoryAbi'; -import { MODULE_TYPE } from '../common'; - -/** - * constructor params, added no top of base params: - * @param owner the signer object for the account owner - * @param factoryAddress address of contract "factory" to deploy new contracts (not needed if account already deployed) - * @param index nonce value used when creating multiple accounts for the same owner - */ -export interface SimpleAccountApiParams extends BaseApiParams { - factoryAddress?: string; - index?: number; -} - -/** - * An implementation of the BaseAccountAPI using the SimpleAccountWallet contract. - * - contract deployer gets "entrypoint", "owner" addresses and "index" nonce - * - owner signs requests using normal "Ethereum Signed Message" (ether's signer.signMessage()) - * - nonce method is "nonce()" - * - execute method is "execFromEntryPoint()" - */ -export class SimpleAccountAPI extends BaseAccountAPI { - factoryAddress?: string; - index: number; - accountAddress?: string; - - /** - * our account contract. - * should support the "execFromEntryPoint" and "nonce" methods - */ - accountContract?: Contract; - - factory?: Contract; - - constructor(params: SimpleAccountApiParams) { - super(params); - this.factoryAddress = params.factoryAddress; - this.index = params.index ?? 0; - } - - async _getAccountContract(): Promise { - this.accountContract = new ethers.Contract(this.accountAddress, SimpleAccountAbi, this.provider); - return this.accountContract; - } - - /** - * return the value to put into the "initCode" field, if the account is not yet deployed. - * this value holds the "factory" address, followed by this account's information - */ - async getAccountInitCode(): Promise { - this.factory = new ethers.Contract(this.factoryAddress, SimpleAccountFactoryAbi, this.provider); - - return hexConcat([ - this.factoryAddress, - this.factory.interface.encodeFunctionData('createAccount', [ - this.services.walletService.EOAAddress, - this.index, - ]), - ]); - } - - async getCounterFactualAddress(): Promise { - if (!this.accountAddress) { - try { - const initCode = await this.getAccountInitCode(); - const entryPoint = EntryPoint__factory.connect(this.entryPointAddress, this.provider); - await entryPoint.callStatic.getSenderAddress(initCode); - - throw new Error("getSenderAddress: unexpected result"); - } catch (error: any) { - const addr = error?.errorArgs?.sender; - if (!addr) throw error; - if (addr === ethers.constants.AddressZero) throw new Error('Unsupported chain_id/walletFactoryAddress'); - this.accountContract = new ethers.Contract(addr, SimpleAccountAbi, this.provider); - this.accountAddress = addr; - } - } - return this.accountAddress; - } - - async getNonce(key = BigNumber.from(0)): Promise { - if (await this.checkAccountPhantom()) { - return BigNumber.from(0); - } - return await this.nonceManager.getNonce(await this.getAccountAddress(), key); - } - - /** - * encode a method call from entryPoint to our contract - * @param target - * @param value - * @param data - */ - async encodeExecute(target: string, value: BigNumberish, data: string): Promise { - const accountContract = await this._getAccountContract(); - return accountContract.interface.encodeFunctionData('execute', [target, value, data]); - } - - async signUserOpHash(userOpHash: string): Promise { - const signature = await this.services.walletService.signMessage(arrayify(userOpHash)); - return signature; - } - - get epView() { - return this.entryPointView; - } - - async encodeBatch(targets: string[], values: BigNumberish[], datas: string[]): Promise { - const accountContract = await this._getAccountContract(); - return accountContract.interface.encodeFunctionData('executeBatch', [targets, datas]); - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - installModule(moduleTypeId: MODULE_TYPE, module: string, initData?: string): Promise { - throw new Error('Method not implemented.'); - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - uninstallModule(moduleTypeId: MODULE_TYPE, module: string, deinitData: string): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/src/sdk/base/ZeroDevWalletAPI.ts b/src/sdk/base/ZeroDevWalletAPI.ts deleted file mode 100644 index a121049..0000000 --- a/src/sdk/base/ZeroDevWalletAPI.ts +++ /dev/null @@ -1,185 +0,0 @@ -import { BigNumber, BigNumberish, Contract, ethers } from 'ethers'; -import { - EntryPoint__factory, -} from '../contracts'; -import { arrayify, hexConcat } from 'ethers/lib/utils'; -import { BaseApiParams, BaseAccountAPI } from './BaseAccountAPI'; -import { KernelAccountAbi } from '../contracts/zeroDevKernal/KernalAccountAbi'; -import { MultiSendAbi } from '../contracts/zeroDevKernal/MultiSendAbi'; -import { Safe } from '../network/constants'; -import { KernelFactoryAbi } from '../contracts/zeroDevKernal/KernalFactoryAbi'; -import { MODULE_TYPE } from '../common'; - -/** - * For Interacting with safe contract - */ -enum Operation { - Call, - DelegateCall, -} - -/** - * constructor params, added no top of base params: - * @param owner the signer object for the account owner - * @param factoryAddress address of contract "factory" to deploy new contracts (not needed if account already deployed) - * @param index nonce value used when creating multiple accounts for the same owner - */ -export interface ZeroDevWalletApiParams extends BaseApiParams { - factoryAddress?: string; - index?: number; -} - -/** - * An implementation of the BaseAccountAPI using the EtherspotWallet contract. - * - contract deployer gets "entrypoint", "owner" addresses and "index" nonce - * - owner signs requests using normal "Ethereum Signed Message" (ether's signer.signMessage()) - * - nonce method is "nonce()" - * - execute method is "execFromEntryPoint()" - */ -export class ZeroDevWalletAPI extends BaseAccountAPI { - factoryAddress?: string; - index: number; - accountAddress?: string; - - /** - * our account contract. - * should support the "execFromEntryPoint" and "nonce" methods - */ - accountContract?: Contract; - - factory?: Contract; - - multisend: Contract; - - constructor(params: ZeroDevWalletApiParams) { - super(params); - this.factoryAddress = params.factoryAddress; - this.index = params.index ?? 0; - } - - async _getAccountContract(): Promise { - this.accountContract = new ethers.Contract(this.accountAddress, KernelAccountAbi, this.provider); - return this.accountContract; - } - - protected async getKernelFactoryInitCode(): Promise { - try { - const KernalFactoryInterface = new ethers.utils.Interface(KernelFactoryAbi) - return KernalFactoryInterface.encodeFunctionData('createAccount', [ - "0xf048AD83CB2dfd6037A43902a2A5Be04e53cd2Eb", // Kernel Implementation Address - new ethers.utils.Interface(KernelAccountAbi).encodeFunctionData( - "initialize", - ["0xd9AB5096a832b9ce79914329DAEE236f8Eea0390", this.services.walletService.EOAAddress], // Kernel Validation Address - ), - this.index, - ], - ); - } catch (err: any) { - throw new Error("Factory Code generation failed"); - } - } - - /** - * return the value to put into the "initCode" field, if the account is not yet deployed. - * this value holds the "factory" address, followed by this account's information - */ - async getAccountInitCode(): Promise { - - this.factory = new ethers.Contract(this.factoryAddress, KernelFactoryAbi, this.provider); - return hexConcat([ - this.factoryAddress, await this.getKernelFactoryInitCode() - ]); - } - - async getCounterFactualAddress(): Promise { - if (!this.accountAddress) { - try { - const initCode = await this.getAccountInitCode(); - const entryPoint = EntryPoint__factory.connect(this.entryPointAddress, this.provider); - await entryPoint.callStatic.getSenderAddress(initCode); - - throw new Error("getSenderAddress: unexpected result"); - } catch (error: any) { - const addr = error?.errorArgs?.sender; - if (!addr) throw error; - if (addr === ethers.constants.AddressZero) throw new Error('Unsupported chain_id'); - const chain = await this.provider.getNetwork().then((n) => n.chainId); - const ms = Safe.MultiSend[chain.toString()]; - if (!ms) - throw new Error( - `Multisend contract not deployed on network: ${chain.toString()}` - ); - this.multisend = new ethers.Contract(ms, MultiSendAbi, this.provider); - this.accountContract = new ethers.Contract(addr, KernelAccountAbi, this.provider); - this.accountAddress = addr; - } - } - return this.accountAddress; - } - - async getNonce(key = BigNumber.from(0)): Promise { - if (await this.checkAccountPhantom()) { - return BigNumber.from(0); - } - return await this.nonceManager.getNonce(await this.getAccountAddress(), key); - } - - async signUserOpHash(userOpHash: string): Promise { - const signature = await this.services.walletService.signMessage(arrayify(userOpHash)); - return ethers.utils.hexConcat([ - "0x00000000", - signature, - ]); - } - - get epView() { - return this.entryPointView; - } - - /** - * encode a method call from entryPoint to our contract - * @param target - * @param value - * @param data - */ - async encodeExecute(target: string, value: BigNumberish, data: string): Promise { - const accountContract = await this._getAccountContract(); - return accountContract.interface.encodeFunctionData('execute', [target, value, data]); - } - - async encodeBatch(targets: string[], values: BigNumberish[], datas: string[]): Promise { - const accountContract = await this._getAccountContract(); - const data = this.multisend.interface.encodeFunctionData("multiSend", [ - ethers.utils.hexConcat( - targets.map((c, index) => - ethers.utils.solidityPack( - ["uint8", "address", "uint256", "uint256", "bytes"], - [ - Operation.Call, - c, - values[index], - ethers.utils.hexDataLength(datas[index]), - datas[index], - ] - ) - ) - ), - ]); - return accountContract.interface.encodeFunctionData('execute', [ - this.multisend.address, - ethers.constants.Zero, - data, - Operation.DelegateCall, - ]) - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - installModule(moduleTypeId: MODULE_TYPE, module: string, initData?: string): Promise { - throw new Error('Method not implemented.'); - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - uninstallModule(moduleTypeId: MODULE_TYPE, module: string, deinitData: string): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/src/sdk/contracts/SimpleAccount/SimpleAccountAbi.ts b/src/sdk/contracts/SimpleAccount/SimpleAccountAbi.ts deleted file mode 100644 index 36e6d84..0000000 --- a/src/sdk/contracts/SimpleAccount/SimpleAccountAbi.ts +++ /dev/null @@ -1,524 +0,0 @@ -export const SimpleAccountAbi = [ - { - inputs: [ - { - internalType: "contract IEntryPoint", - name: "anEntryPoint", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "previousAdmin", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "newAdmin", - type: "address", - }, - ], - name: "AdminChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "beacon", - type: "address", - }, - ], - name: "BeaconUpgraded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "contract IEntryPoint", - name: "entryPoint", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "SimpleAccountInitialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "Upgraded", - type: "event", - }, - { - inputs: [], - name: "addDeposit", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [], - name: "entryPoint", - outputs: [ - { - internalType: "contract IEntryPoint", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "dest", - type: "address", - }, - { - internalType: "uint256", - name: "value", - type: "uint256", - }, - { - internalType: "bytes", - name: "func", - type: "bytes", - }, - ], - name: "execute", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address[]", - name: "dest", - type: "address[]", - }, - { - internalType: "bytes[]", - name: "func", - type: "bytes[]", - }, - ], - name: "executeBatch", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "getDeposit", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getNonce", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "anOwner", - type: "address", - }, - ], - name: "initialize", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "onERC1155BatchReceived", - outputs: [ - { - internalType: "bytes4", - name: "", - type: "bytes4", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "onERC1155Received", - outputs: [ - { - internalType: "bytes4", - name: "", - type: "bytes4", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "onERC721Received", - outputs: [ - { - internalType: "bytes4", - name: "", - type: "bytes4", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "proxiableUUID", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "interfaceId", - type: "bytes4", - }, - ], - name: "supportsInterface", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "tokensReceived", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newImplementation", - type: "address", - }, - ], - name: "upgradeTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newImplementation", - type: "address", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "upgradeToAndCall", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - components: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "nonce", - type: "uint256", - }, - { - internalType: "bytes", - name: "initCode", - type: "bytes", - }, - { - internalType: "bytes", - name: "callData", - type: "bytes", - }, - { - internalType: "uint256", - name: "callGasLimit", - type: "uint256", - }, - { - internalType: "uint256", - name: "verificationGasLimit", - type: "uint256", - }, - { - internalType: "uint256", - name: "preVerificationGas", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxFeePerGas", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxPriorityFeePerGas", - type: "uint256", - }, - { - internalType: "bytes", - name: "paymasterAndData", - type: "bytes", - }, - { - internalType: "bytes", - name: "signature", - type: "bytes", - }, - ], - internalType: "struct UserOperation", - name: "userOp", - type: "tuple", - }, - { - internalType: "bytes32", - name: "userOpHash", - type: "bytes32", - }, - { - internalType: "uint256", - name: "missingAccountFunds", - type: "uint256", - }, - ], - name: "validateUserOp", - outputs: [ - { - internalType: "uint256", - name: "validationData", - type: "uint256", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address payable", - name: "withdrawAddress", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "withdrawDepositTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, - ] as const; \ No newline at end of file diff --git a/src/sdk/contracts/SimpleAccount/SimpleAccountFactoryAbi.ts b/src/sdk/contracts/SimpleAccount/SimpleAccountFactoryAbi.ts deleted file mode 100644 index c37d836..0000000 --- a/src/sdk/contracts/SimpleAccount/SimpleAccountFactoryAbi.ts +++ /dev/null @@ -1,74 +0,0 @@ -export const SimpleAccountFactoryAbi = [ - { - inputs: [ - { - internalType: "contract IEntryPoint", - name: "_entryPoint", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "accountImplementation", - outputs: [ - { - internalType: "contract SimpleAccount", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "salt", - type: "uint256", - }, - ], - name: "createAccount", - outputs: [ - { - internalType: "contract SimpleAccount", - name: "ret", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "salt", - type: "uint256", - }, - ], - name: "getAddress", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - ] as const; \ No newline at end of file diff --git a/src/sdk/contracts/factories/src/ERC7579/wallet/EtherspotWallet7579Factory__factory.ts b/src/sdk/contracts/factories/src/ERC7579/wallet/EtherspotWallet7579Factory__factory.ts index a823bc9..4629e18 100644 --- a/src/sdk/contracts/factories/src/ERC7579/wallet/EtherspotWallet7579Factory__factory.ts +++ b/src/sdk/contracts/factories/src/ERC7579/wallet/EtherspotWallet7579Factory__factory.ts @@ -109,7 +109,7 @@ const _abi = [ ] as const; const _bytecode = - "0x60a060405234801561001057600080fd5b5060405161054438038061054483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104ac61009860003960008181608901528181610141015261018901526104ac6000f3fe60806040526004361061003f5760003560e01c806356c717f5146100445780635c60da1b14610077578063d959fd0e146100c3578063f8a59370146100e3575b600080fd5b34801561005057600080fd5b5061006461005f3660046103b1565b6100f6565b6040519081526020015b60405180910390f35b34801561008357600080fd5b506100ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161006e565b3480156100cf57600080fd5b506100ab6100de3660046103b1565b61012c565b6100ab6100f13660046103b1565b610170565b600083838360405160200161010d9392919061042d565b6040516020818303038152906040528051906020012090509392505050565b60008061013a8585856100f6565b90506101677f00000000000000000000000000000000000000000000000000000000000000008230610222565b95945050505050565b60008061017e8585856100f6565b90506000806101ae347f0000000000000000000000000000000000000000000000000000000000000000856102ab565b915091508161021857604051634b6a141960e01b81526001600160a01b03821690634b6a1419906101e59089908990600401610447565b600060405180830381600087803b1580156101ff57600080fd5b505af1158015610213573d6000803e3d6000fd5b505050505b9695505050505050565b60008061029e85604080517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f360609081527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e20768352616009602052601e9390935268603d3d8160223d3973600a52605f6021209152600090915290565b905061016781858561038f565b6000806040517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f36060527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e207660405261600960205284601e5268603d3d8160223d3973600a52605f60212060358201523060581b815260ff8153836015820152605581209150813b6103575783605f602188f59150816103525763301164256000526004601cfd5b61037d565b60019250851561037d5760003860003889865af161037d5763b12d13eb6000526004601cfd5b80604052506000606052935093915050565b600060ff60005350603592835260601b60015260155260556000908120915290565b6000806000604084860312156103c657600080fd5b83359250602084013567ffffffffffffffff808211156103e557600080fd5b818601915086601f8301126103f957600080fd5b81358181111561040857600080fd5b87602082850101111561041a57600080fd5b6020830194508093505050509250925092565b838152818360208301376000910160200190815292915050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea2646970667358221220a61ce66e1d571004e70201d8429d05f49ab0d1c9fa70aadd2e986bf67745bbe764736f6c63430008170033"; + "0x6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063f04e283e11610059578063f04e283e14610207578063f2fde38b1461021a578063f8a593701461022d578063fee81cf41461024057600080fd5b80638da5cb5b146101ae578063b36f9705146101c7578063d959fd0e146101e757600080fd5b806354d1f13d116100bb57806354d1f13d1461011f57806356c717f5146101275780635c60da1b1461015a578063715018a6146101a657600080fd5b806325692962146100e257806345171159146100ec5780634a1ce599146100ff575b600080fd5b6100ea610273565b005b6100ea6100fa366004610849565b6102c3565b34801561010b57600080fd5b506100ea61011a36600461088b565b610356565b6100ea6103db565b34801561013357600080fd5b506101476101423660046108af565b610417565b6040519081526020015b60405180910390f35b34801561016657600080fd5b5061018e7f000000000000000000000000202a5598bdba2ce62bffa13ecccb04969719fad981565b6040516001600160a01b039091168152602001610151565b6100ea61044d565b3480156101ba57600080fd5b50638b78c6d8195461018e565b3480156101d357600080fd5b506100ea6101e236600461092b565b610461565b3480156101f357600080fd5b5061018e6102023660046108af565b6104ef565b6100ea61021536600461088b565b610533565b6100ea61022836600461088b565b610573565b61018e61023b3660046108af565b61059a565b34801561024c57600080fd5b5061014761025b36600461088b565b63389a75e1600c908152600091909152602090205490565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6102cb61064c565b6001600160a01b0382166102f2576040516301650c7760e51b815260040160405180910390fd5b604051621cb65b60e51b815263ffffffff821660048201526001600160a01b03831690630396cb609034906024016000604051808303818588803b15801561033957600080fd5b505af115801561034d573d6000803e3d6000fd5b50505050505050565b61035e61064c565b6001600160a01b038116610385576040516301650c7760e51b815260040160405180910390fd5b806001600160a01b031663bb9fe6bf6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156103c057600080fd5b505af11580156103d4573d6000803e3d6000fd5b5050505050565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b600083838360405160200161042e93929190610959565b6040516020818303038152906040528051906020012090509392505050565b61045561064c565b61045f6000610667565b565b61046961064c565b6001600160a01b038216610490576040516301650c7760e51b815260040160405180910390fd5b60405163611d2e7560e11b81526001600160a01b03828116600483015283169063c23a5cea90602401600060405180830381600087803b1580156104d357600080fd5b505af11580156104e7573d6000803e3d6000fd5b505050505050565b6000806104fd858585610417565b905061052a7f000000000000000000000000202a5598bdba2ce62bffa13ecccb04969719fad982306106a5565b95945050505050565b61053b61064c565b63389a75e1600c52806000526020600c20805442111561056357636f5e88186000526004601cfd5b6000905561057081610667565b50565b61057b61064c565b8060601b61059157637448fbae6000526004601cfd5b61057081610667565b6000806105a8858585610417565b90506000806105d8347f000000000000000000000000202a5598bdba2ce62bffa13ecccb04969719fad98561072e565b915091508161064257604051634b6a141960e01b81526001600160a01b03821690634b6a14199061060f9089908990600401610973565b600060405180830381600087803b15801561062957600080fd5b505af115801561063d573d6000803e3d6000fd5b505050505b9695505050505050565b638b78c6d81954331461045f576382b429006000526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60008061072185604080517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f360609081527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e20768352616009602052601e9390935268603d3d8160223d3973600a52605f6021209152600090915290565b905061052a818585610812565b6000806040517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f36060527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e207660405261600960205284601e5268603d3d8160223d3973600a52605f60212060358201523060581b815260ff8153836015820152605581209150813b6107da5783605f602188f59150816107d55763301164256000526004601cfd5b610800565b6001925085156108005760003860003889865af16108005763b12d13eb6000526004601cfd5b80604052506000606052935093915050565b600060ff60005350603592835260601b60015260155260556000908120915290565b6001600160a01b038116811461057057600080fd5b6000806040838503121561085c57600080fd5b823561086781610834565b9150602083013563ffffffff8116811461088057600080fd5b809150509250929050565b60006020828403121561089d57600080fd5b81356108a881610834565b9392505050565b6000806000604084860312156108c457600080fd5b83359250602084013567ffffffffffffffff808211156108e357600080fd5b818601915086601f8301126108f757600080fd5b81358181111561090657600080fd5b87602082850101111561091857600080fd5b6020830194508093505050509250925092565b6000806040838503121561093e57600080fd5b823561094981610834565b9150602083013561088081610834565b838152818360208301376000910160200190815292915050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea2646970667358221220513a82a8caa53617dec3bbe9922886aaba082d511fed53c25ac374c22d18c93764736f6c63430008170033"; type EtherspotWallet7579FactoryConstructorParams = | [signer?: Signer] diff --git a/src/sdk/contracts/zeroDevKernal/ECDSAKernelFactoryAbi.ts b/src/sdk/contracts/zeroDevKernal/ECDSAKernelFactoryAbi.ts deleted file mode 100644 index 91160b8..0000000 --- a/src/sdk/contracts/zeroDevKernal/ECDSAKernelFactoryAbi.ts +++ /dev/null @@ -1,110 +0,0 @@ -export const ECDSAKernelFactoryAbi = [ - { - inputs: [ - { - internalType: "contract KernelFactory", - name: "_singletonFactory", - type: "address", - }, - { - internalType: "contract ECDSAValidator", - name: "_validator", - type: "address", - }, - { - internalType: "contract IEntryPoint", - name: "_entryPoint", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address", - }, - { - internalType: "uint256", - name: "_index", - type: "uint256", - }, - ], - name: "createAccount", - outputs: [ - { - internalType: "contract EIP1967Proxy", - name: "proxy", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "entryPoint", - outputs: [ - { - internalType: "contract IEntryPoint", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address", - }, - { - internalType: "uint256", - name: "_index", - type: "uint256", - }, - ], - name: "getAccountAddress", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "singletonFactory", - outputs: [ - { - internalType: "contract KernelFactory", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "validator", - outputs: [ - { - internalType: "contract ECDSAValidator", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - ] as const; \ No newline at end of file diff --git a/src/sdk/contracts/zeroDevKernal/KernalAccountAbi.ts b/src/sdk/contracts/zeroDevKernal/KernalAccountAbi.ts deleted file mode 100644 index 905d4d7..0000000 --- a/src/sdk/contracts/zeroDevKernal/KernalAccountAbi.ts +++ /dev/null @@ -1,579 +0,0 @@ -export const KernelAccountAbi = [ - { - "inputs": [ - { - "internalType": "contract IEntryPoint", - "name": "_entryPoint", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldValidator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newValidator", - "type": "address" - } - ], - "name": "DefaultValidatorChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes4", - "name": "selector", - "type": "bytes4" - }, - { - "indexed": true, - "internalType": "address", - "name": "executor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "ExecutionChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "stateMutability": "payable", - "type": "fallback" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_disableFlag", - "type": "bytes4" - } - ], - "name": "disableMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "entryPoint", - "outputs": [ - { - "internalType": "contract IEntryPoint", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "enum Operation", - "name": "operation", - "type": "uint8" - } - ], - "name": "execute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getDefaultValidator", - "outputs": [ - { - "internalType": "contract IKernelValidator", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDisabledMode", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "getExecution", - "outputs": [ - { - "components": [ - { - "internalType": "uint48", - "name": "validUntil", - "type": "uint48" - }, - { - "internalType": "uint48", - "name": "validAfter", - "type": "uint48" - }, - { - "internalType": "address", - "name": "executor", - "type": "address" - }, - { - "internalType": "contract IKernelValidator", - "name": "validator", - "type": "address" - } - ], - "internalType": "struct ExecutionDetail", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLastDisabledTime", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint192", - "name": "key", - "type": "uint192" - } - ], - "name": "getNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IKernelValidator", - "name": "_defaultValidator", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "name": "isValidSignature", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155BatchReceived", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IKernelValidator", - "name": "_defaultValidator", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "setDefaultValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - }, - { - "internalType": "address", - "name": "_executor", - "type": "address" - }, - { - "internalType": "contract IKernelValidator", - "name": "_validator", - "type": "address" - }, - { - "internalType": "uint48", - "name": "_validUntil", - "type": "uint48" - }, - { - "internalType": "uint48", - "name": "_validAfter", - "type": "uint48" - }, - { - "internalType": "bytes", - "name": "_enableData", - "type": "bytes" - } - ], - "name": "setExecution", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "initCode", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "callGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "verificationGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "preVerificationGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPriorityFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "paymasterAndData", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct UserOperation", - "name": "userOp", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "userOpHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "missingAccountFunds", - "type": "uint256" - } - ], - "name": "validateUserOp", - "outputs": [ - { - "internalType": "uint256", - "name": "validationData", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] as const; \ No newline at end of file diff --git a/src/sdk/contracts/zeroDevKernal/KernalFactoryAbi.ts b/src/sdk/contracts/zeroDevKernal/KernalFactoryAbi.ts deleted file mode 100644 index 497362e..0000000 --- a/src/sdk/contracts/zeroDevKernal/KernalFactoryAbi.ts +++ /dev/null @@ -1,380 +0,0 @@ -export const KernelFactoryAbi = [ - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address", - }, - { - internalType: "contract IEntryPoint", - name: "_entryPoint", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "DeploymentFailed", - type: "error", - }, - { - inputs: [], - name: "NewOwnerIsZeroAddress", - type: "error", - }, - { - inputs: [], - name: "NoHandoverRequest", - type: "error", - }, - { - inputs: [], - name: "SaltDoesNotStartWithCaller", - type: "error", - }, - { - inputs: [], - name: "Unauthorized", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "proxy", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "Deployed", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "pendingOwner", - type: "address", - }, - ], - name: "OwnershipHandoverCanceled", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "pendingOwner", - type: "address", - }, - ], - name: "OwnershipHandoverRequested", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "oldOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - inputs: [ - { - internalType: "uint32", - name: "unstakeDelaySec", - type: "uint32", - }, - ], - name: "addStake", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [], - name: "cancelOwnershipHandover", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "pendingOwner", - type: "address", - }, - ], - name: "completeOwnershipHandover", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_implementation", - type: "address", - }, - { - internalType: "bytes", - name: "_data", - type: "bytes", - }, - { - internalType: "uint256", - name: "_index", - type: "uint256", - }, - ], - name: "createAccount", - outputs: [ - { - internalType: "address", - name: "proxy", - type: "address", - }, - ], - stateMutability: "payable", - type: "function", - }, - { - inputs: [], - name: "entryPoint", - outputs: [ - { - internalType: "contract IEntryPoint", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes", - name: "_data", - type: "bytes", - }, - { - internalType: "uint256", - name: "_index", - type: "uint256", - }, - ], - name: "getAccountAddress", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "initCodeHash", - outputs: [ - { - internalType: "bytes32", - name: "result", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "isAllowedImplementation", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "result", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "pendingOwner", - type: "address", - }, - ], - name: "ownershipHandoverExpiresAt", - outputs: [ - { - internalType: "uint256", - name: "result", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "ownershipHandoverValidFor", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "salt", - type: "bytes32", - }, - ], - name: "predictDeterministicAddress", - outputs: [ - { - internalType: "address", - name: "predicted", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [], - name: "requestOwnershipHandover", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "contract IEntryPoint", - name: "_entryPoint", - type: "address", - }, - ], - name: "setEntryPoint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_implementation", - type: "address", - }, - { - internalType: "bool", - name: "_allow", - type: "bool", - }, - ], - name: "setImplementation", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [], - name: "unlockStake", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address payable", - name: "withdrawAddress", - type: "address", - }, - ], - name: "withdrawStake", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -] as const; \ No newline at end of file diff --git a/src/sdk/contracts/zeroDevKernal/MultiSendAbi.ts b/src/sdk/contracts/zeroDevKernal/MultiSendAbi.ts deleted file mode 100644 index 04c872a..0000000 --- a/src/sdk/contracts/zeroDevKernal/MultiSendAbi.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const MultiSendAbi = [ - { - inputs: [], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [ - { - internalType: "bytes", - name: "transactions", - type: "bytes", - }, - ], - name: "multiSend", - outputs: [], - stateMutability: "payable", - type: "function", - }, - ] as const; \ No newline at end of file diff --git a/src/sdk/data/classes/account-balance.ts b/src/sdk/data/classes/account-balance.ts deleted file mode 100644 index 20eb4ec..0000000 --- a/src/sdk/data/classes/account-balance.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BigNumber } from 'ethers'; -import { TransformBigNumber } from '../../common'; - -export class AccountBalance { - token: string; - - @TransformBigNumber() - balance: BigNumber; - - @TransformBigNumber() - superBalance: BigNumber; -} diff --git a/src/sdk/data/classes/account-balances.ts b/src/sdk/data/classes/account-balances.ts deleted file mode 100644 index 73c704a..0000000 --- a/src/sdk/data/classes/account-balances.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Type } from 'class-transformer'; -import { AccountBalance } from './account-balance'; - -export class AccountBalances { - @Type(() => AccountBalance) - items: AccountBalance[]; -} diff --git a/src/sdk/data/classes/advance-routes-lifi.ts b/src/sdk/data/classes/advance-routes-lifi.ts deleted file mode 100644 index d1072ca..0000000 --- a/src/sdk/data/classes/advance-routes-lifi.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Route } from "@lifi/sdk"; - -export class AdvanceRoutesLiFi { - items: Route[] -} \ No newline at end of file diff --git a/src/sdk/data/classes/decoded-log-param.ts b/src/sdk/data/classes/decoded-log-param.ts deleted file mode 100644 index 5fb50e8..0000000 --- a/src/sdk/data/classes/decoded-log-param.ts +++ /dev/null @@ -1,11 +0,0 @@ -export class DecodedLogParam { - name?: string; - - type: string; - - indexed: boolean; - - decoded: boolean; - - value: any; -} diff --git a/src/sdk/data/classes/exchange-bridging-quote.ts b/src/sdk/data/classes/exchange-bridging-quote.ts deleted file mode 100644 index b38a6af..0000000 --- a/src/sdk/data/classes/exchange-bridging-quote.ts +++ /dev/null @@ -1,54 +0,0 @@ -interface ITranscation { - data: string; - to: string; - value: string; - from: string; - chainId: number; -} - -interface IApprovalData { - approvalAddress: string; - amount: string; -} - -interface Token { - address: string; - symbol: string; - decimals: number; - chainId: number; - name: string; - logoURI: string; -} - -interface GasCost { - limit: string; - amountUSD: string; - token: Token; -} - -interface Data { - fromToken: Token; - toToken: Token; - toTokenAmount: string; - fromTokenAmount: string; - estimatedGas: string; -} -interface IEstimate { - fromAmount: string; - toAmount: string; - toAmountMin: string; - approvalAddress: string; - gasCosts: GasCost; - data: Data; -} -export class BridgingQuote { - provider: string; - approvalData: IApprovalData | null; - transaction: ITranscation; - estimate: IEstimate; - LiFiBridgeUsed?: string | null; -} - -export class BridgingQuotes { - items: BridgingQuote[]; -} diff --git a/src/sdk/data/classes/exchange-offer.ts b/src/sdk/data/classes/exchange-offer.ts deleted file mode 100644 index 4c00302..0000000 --- a/src/sdk/data/classes/exchange-offer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { BigNumber } from 'ethers'; -import { Type } from 'class-transformer'; -import { TransformBigNumber } from '../../common'; -import { ExchangeProviders } from '../constants'; -import { TransactionData } from './transaction-data'; - -export class ExchangeOffer { - provider: ExchangeProviders; - - @TransformBigNumber() - receiveAmount: BigNumber; - - exchangeRate: number; - - @Type(() => TransactionData) - transactions: TransactionData[]; -} diff --git a/src/sdk/data/classes/exchange-offers.ts b/src/sdk/data/classes/exchange-offers.ts deleted file mode 100644 index 4df1e74..0000000 --- a/src/sdk/data/classes/exchange-offers.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Type } from 'class-transformer'; -import { ExchangeOffer } from './exchange-offer'; - -export class ExchangeOffers { - @Type(() => ExchangeOffer) - items: ExchangeOffer[]; -} diff --git a/src/sdk/data/classes/index.ts b/src/sdk/data/classes/index.ts deleted file mode 100644 index 4c3eaa6..0000000 --- a/src/sdk/data/classes/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -export * from './account-balance'; -export * from './account-balances'; -export * from './internal-transaction'; -export * from './transaction-asset'; -export * from './transaction-batch'; -export * from './transaction-log'; -export * from './decoded-log-param'; -export * from './transaction-log-decoded'; -export * from './transaction'; -export * from './nft-collection'; -export * from './nft-list'; -export * from './nft'; -export * from './exchange-offer'; -export * from './exchange-offers'; -export * from './transaction-data'; -export * from './advance-routes-lifi'; -export * from './step-transactions-lifi'; -export * from './exchange-bridging-quote'; -export * from './rate-info'; -export * from './rate-data'; -export * from './token-list-token'; -export * from './token-list'; -export * from './token-lists'; -export * from './token-list-token'; -export * from './paginated-tokens'; -export * from './transactions'; -export * from './token'; -export * from './quote'; -export * from './transaction-status'; diff --git a/src/sdk/data/classes/internal-transaction.ts b/src/sdk/data/classes/internal-transaction.ts deleted file mode 100644 index 4670743..0000000 --- a/src/sdk/data/classes/internal-transaction.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BigNumber } from 'ethers'; -import { TransformBigNumber } from '../../common'; - -export class InternalTransaction { - from: string; - - to: string; - - @TransformBigNumber() - value: BigNumber; -} diff --git a/src/sdk/data/classes/nft-collection.ts b/src/sdk/data/classes/nft-collection.ts deleted file mode 100644 index e68090b..0000000 --- a/src/sdk/data/classes/nft-collection.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { BaseClass } from '../../common'; -import { TokenTypes } from '../constants'; -import { Nft } from './nft'; - -export class NftCollection extends BaseClass { - contractName: string; - - contractSymbol: string; - - contractAddress: string; - - tokenType: TokenTypes; - - nftVersion: string; - - nftDescription: string; - - balance: number; - - items: Nft[]; -} diff --git a/src/sdk/data/classes/nft-list.ts b/src/sdk/data/classes/nft-list.ts deleted file mode 100644 index 33afd94..0000000 --- a/src/sdk/data/classes/nft-list.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Type } from 'class-transformer'; -import { PaginationResult } from '../../common/classes/pagination-result'; -import { NftCollection } from './nft-collection'; - -export class NftList extends PaginationResult { - @Type(() => NftCollection) - items: NftCollection[]; -} diff --git a/src/sdk/data/classes/nft.ts b/src/sdk/data/classes/nft.ts deleted file mode 100644 index 4cad74a..0000000 --- a/src/sdk/data/classes/nft.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BaseClass } from '../../common'; - -export class Nft extends BaseClass { - tokenId: number; - - name: string; - - amount: number; - - image: string; - - ipfsGateway: string; -} diff --git a/src/sdk/data/classes/paginated-tokens.ts b/src/sdk/data/classes/paginated-tokens.ts deleted file mode 100644 index 50a9ecd..0000000 --- a/src/sdk/data/classes/paginated-tokens.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Type } from 'class-transformer'; -import { PaginationResult } from '../../common/classes/pagination-result'; -import { TokenListToken } from './token-list-token'; - -export class PaginatedTokens extends PaginationResult { - @Type(() => TokenListToken) - items: TokenListToken[]; -} diff --git a/src/sdk/data/classes/quote.ts b/src/sdk/data/classes/quote.ts deleted file mode 100644 index c093821..0000000 --- a/src/sdk/data/classes/quote.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BigNumberish, BytesLike } from "ethers"; - -export class Quote { - to?: string; - data?: BytesLike; - value?: BigNumberish; - gasLimit?: string; - gasPrice?: string; - chainId?: number; -} diff --git a/src/sdk/data/classes/rate-data.ts b/src/sdk/data/classes/rate-data.ts deleted file mode 100644 index 497fb6b..0000000 --- a/src/sdk/data/classes/rate-data.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Type } from 'class-transformer'; -import { RateInfo } from './rate-info'; - -export class RateData { - errored: boolean; - - error: string; - - @Type(() => RateInfo) - items: Array; -} diff --git a/src/sdk/data/classes/rate-info.ts b/src/sdk/data/classes/rate-info.ts deleted file mode 100644 index a8dd6dd..0000000 --- a/src/sdk/data/classes/rate-info.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class RateInfo { - address: string; - eth: number; - eur: number; - gbp: number; - usd: number; -} diff --git a/src/sdk/data/classes/step-transactions-lifi.ts b/src/sdk/data/classes/step-transactions-lifi.ts deleted file mode 100644 index 2037a36..0000000 --- a/src/sdk/data/classes/step-transactions-lifi.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BigNumberish, BytesLike } from 'ethers'; -import { TransformBigNumber } from '../../common'; - -export class StepTransaction { - to?: string; - - data?: BytesLike; - - @TransformBigNumber() - value?: BigNumberish; - - @TransformBigNumber() - gasLimit?: BigNumberish; - - @TransformBigNumber() - gasPrice?: BigNumberish; - - chainId?: number; - - type?: number; -} - -export class StepTransactions { - items: StepTransaction[] -} \ No newline at end of file diff --git a/src/sdk/data/classes/token-list-token copy.ts b/src/sdk/data/classes/token-list-token copy.ts deleted file mode 100644 index 10d089f..0000000 --- a/src/sdk/data/classes/token-list-token copy.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class TokenListToken { - address: string; - chainId: number; - name: string; - symbol: string; - decimals: number; - logoURI: string; -} diff --git a/src/sdk/data/classes/token-list-token.ts b/src/sdk/data/classes/token-list-token.ts deleted file mode 100644 index 10d089f..0000000 --- a/src/sdk/data/classes/token-list-token.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class TokenListToken { - address: string; - chainId: number; - name: string; - symbol: string; - decimals: number; - logoURI: string; -} diff --git a/src/sdk/data/classes/token-list.ts b/src/sdk/data/classes/token-list.ts deleted file mode 100644 index 37fd2bf..0000000 --- a/src/sdk/data/classes/token-list.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Type } from 'class-transformer'; -import { TokenListToken } from './token-list-token'; - -export class TokenList { - name: string; - - endpoint: string; - - isDefault: boolean; - - @Type(() => TokenListToken) - tokens: TokenListToken[]; - - @Type(() => Date) - createdAt: Date; - - @Type(() => Date) - updatedAt: Date; -} diff --git a/src/sdk/data/classes/token-lists.ts b/src/sdk/data/classes/token-lists.ts deleted file mode 100644 index e9530a1..0000000 --- a/src/sdk/data/classes/token-lists.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Type } from 'class-transformer'; -import { TokenList } from './token-list'; - -export class TokenLists { - @Type(() => TokenList) - items: TokenList[]; -} diff --git a/src/sdk/data/classes/token.ts b/src/sdk/data/classes/token.ts deleted file mode 100644 index 3a30d5d..0000000 --- a/src/sdk/data/classes/token.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class Token { - symbol: string; - address: string; - decimals: number; - chainId: number; - name: string; - icon: string; -} diff --git a/src/sdk/data/classes/transaction-asset.ts b/src/sdk/data/classes/transaction-asset.ts deleted file mode 100644 index 3cf3c29..0000000 --- a/src/sdk/data/classes/transaction-asset.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BigNumber } from 'ethers'; -import { TransformBigNumber } from '../../common'; -import { TokenTypes, TransactionAssetCategories } from '../constants'; - -export class TransactionAsset { - name: string; - - category: TransactionAssetCategories; - - type: TokenTypes; - - @TransformBigNumber() - value: BigNumber; - - // @deprecated - decimal: number; - - decimals: number; - - contract: string; - - from: string; - - to: string; -} diff --git a/src/sdk/data/classes/transaction-batch.ts b/src/sdk/data/classes/transaction-batch.ts deleted file mode 100644 index f224175..0000000 --- a/src/sdk/data/classes/transaction-batch.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BigNumber } from 'ethers'; -import { TransformBigNumber } from '../../common'; - -export class TransactionBatch { - from: string; - - to: string[]; - - data: string[]; - - @TransformBigNumber() - feeAmount: BigNumber; - - feeToken: string; -} diff --git a/src/sdk/data/classes/transaction-data.ts b/src/sdk/data/classes/transaction-data.ts deleted file mode 100644 index 18b9d4a..0000000 --- a/src/sdk/data/classes/transaction-data.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BigNumber } from 'ethers'; -import { TransformBigNumber } from '../../common'; - -export class TransactionData { - to: string; - - data: string; - - @TransformBigNumber() - value: BigNumber; -} diff --git a/src/sdk/data/classes/transaction-log-decoded.ts b/src/sdk/data/classes/transaction-log-decoded.ts deleted file mode 100644 index 38d0ca5..0000000 --- a/src/sdk/data/classes/transaction-log-decoded.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { DecodedLogParam } from './decoded-log-param'; - -export class TransactionLogDecoded { - name: string; - - signature: string; - - params: DecodedLogParam[]; -} diff --git a/src/sdk/data/classes/transaction-log.ts b/src/sdk/data/classes/transaction-log.ts deleted file mode 100644 index 502625f..0000000 --- a/src/sdk/data/classes/transaction-log.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { TransactionLogDecoded } from './transaction-log-decoded'; - -export class TransactionLog { - address: string; - - topics: string[]; - - data: string; - - decoded?: TransactionLogDecoded; -} diff --git a/src/sdk/data/classes/transaction-status.ts b/src/sdk/data/classes/transaction-status.ts deleted file mode 100644 index 5d216d9..0000000 --- a/src/sdk/data/classes/transaction-status.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class TransactionStatus { - status: string; - transactionHash?: string; - connextscanUrl: string; - transferId?: string; -} diff --git a/src/sdk/data/classes/transaction.ts b/src/sdk/data/classes/transaction.ts deleted file mode 100644 index 0a1d058..0000000 --- a/src/sdk/data/classes/transaction.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { BigNumber } from 'ethers'; -import { Type } from 'class-transformer'; -import { TransformBigNumber } from '../../common'; -import { TransactionDirections, TransactionStatuses } from '../constants'; -import { TransactionAsset } from './transaction-asset'; -import { TransactionBatch } from './transaction-batch'; -import { TransactionLog } from './transaction-log'; -import { InternalTransaction } from './internal-transaction'; - -export class Transaction { - hash: string; - - nonce: number; - - blockHash: string; - - blockNumber: number; - - timestamp: number; - - from: string; - - to: string; - - @TransformBigNumber() - value: BigNumber; - - @TransformBigNumber() - gasPrice: BigNumber; - - gasLimit: number; - - input: string; - - transactionIndex: number; - - gasUsed: number; - - logs: TransactionLog[]; - - status: TransactionStatuses; - - @Type(() => TransactionAsset) - asset: TransactionAsset; - - blockExplorerUrl: string; - - direction: TransactionDirections; - - mainTransactionDataFetched: boolean; - - internalTransactionsFetched: boolean; - - internalTransactions: InternalTransaction[]; - - @Type(() => TransactionBatch) - batch: TransactionBatch; -} diff --git a/src/sdk/data/classes/transactions.ts b/src/sdk/data/classes/transactions.ts deleted file mode 100644 index e0a22e4..0000000 --- a/src/sdk/data/classes/transactions.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { BigNumber } from 'ethers'; -import { TransactionStatuses } from '../constants'; - -export class Transactions { - transactions: UserOpTransaction[]; - pageInfo?: { - currentPage: number; - limit: number; - }; -} - -export class UserOpTransaction { - chainId: number; - sender: string; - target?: string | null; - transactionHash: string; - userOpHash: string; - actualGasCost: number; - actualGasUsed: number; - success: TransactionStatuses; - timestamp: number; - paymaster: string; - value: number; - blockExplorerUrl: string; - input: string; - nonce: number; - initCode?: string; - callData?: string; - accountGasLimits?: string; - gasFees?: string; - callGasLimit: BigNumber; - verificationGasLimit: BigNumber; - preVerificationGas: BigNumber; - maxFeePerGas: BigNumber; - maxPriorityFeePerGas: BigNumber; - paymasterAndData?: string; - signature?: string; - beneficiary?: string; - nativeTransfers?: NativeTransfersEntity[]; - erc20Transfers?: Erc20TransfersEntity[]; - nftTransfers?: NFTTransfersEntity[]; -} - -export class Erc20TransfersEntity { - from: string; - to: string; - value: number; - asset?: string; - address: string; - decimal: number; -} - -export class NativeTransfersEntity { - from: string; - to: string; - value: string; - asset?: string; - address: string; - decimal: number; - data: string; -} - -export class NFTTransfersEntity { - from: string; - to: string; - value: number; - tokenId: number; - asset?: string; - category: string; - address: string; -} diff --git a/src/sdk/data/constants.ts b/src/sdk/data/constants.ts deleted file mode 100644 index 7891f58..0000000 --- a/src/sdk/data/constants.ts +++ /dev/null @@ -1,60 +0,0 @@ -export enum TransactionStatuses { - Pending = 'Pending', - Completed = 'Completed', - Reverted = 'Reverted', -} - -export enum TransactionDirections { - Sender = 'Sender', - Receiver = 'Receiver', -} - -export enum TransactionAssetCategories { - External = 'external', - Internal = 'internal', - Token = 'token', -} - -export enum TokenTypes { - Erc20 = 'Erc20', - Erc721 = 'Erc721', - Erc1155 = 'Erc1155', - Native = 'Native', - WrappedSupertoken = 'WrappedSupertoken', -} - -export enum ExchangeProviders { - Uniswap = 'Uniswap', - OneInch = 'OneInch', - Synthetix = 'Synthetix', - Sushiswap = 'Sushiswap', - Honeyswap = 'Honeyswap', - Paraswap = 'Paraswap', -} - -export enum CrossChainServiceProvider { - SocketV2 = 'SocketV2', - LiFi = 'LiFi', - Etherspot = 'Connext', -} - -export enum BridgingProvider { - Connext = 'Connext', -} - -export enum LiFiBridge { - across = 'across', - arbitrum = 'arbitrum', - avalanche = 'avalanche', - cbridge = 'cbridge', - connext = 'connext', - hop = 'hop', - hyphen = 'hyphen', - multichain = 'multichain', - optimism = 'optimism', - polygon = 'polygon', - stargate = 'stargate', -} - -export const TOKEN_LIST_MIN_NAME_LENGTH = 3; -export const TOKEN_LIST_MAX_NAME_LENGTH = 32; diff --git a/src/sdk/data/data.module.ts b/src/sdk/data/data.module.ts deleted file mode 100644 index 9e5ca6b..0000000 --- a/src/sdk/data/data.module.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { BigNumber } from 'ethers'; -import { Route } from '@lifi/sdk'; -import { ObjectSubject } from '../common'; -import { AccountBalances, AdvanceRoutesLiFi, Token, Quote, TransactionStatus, ExchangeOffer, NftList, PaginatedTokens, RateData, StepTransactions, TokenList, TokenListToken, Transaction, Transactions } from './classes'; -import { RestApiService } from '../api'; -import { API_ENDPOINTS, MethodTypes } from '../api/constants'; -import { BridgingProvider } from './constants'; - -export class DataModule { - readonly apiKey$ = new ObjectSubject(''); - private apiService: RestApiService; - - constructor(apiKey = '') { - this.apiService = new RestApiService(); - this.switchCurrentApi(apiKey); - } - - get currentApi(): string { - return this.apiKey$.value; - } - - switchCurrentApi(currentApi: string): string { - this.apiKey$.nextData(currentApi); - - return this.currentApi; - } - - async getAccountBalances(account: string, tokens: string[], chainId: number, provider?: string): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - account, - chainId, - provider, - tokens: tokens.length ? tokens : [] - }; - - const balances: AccountBalances = await this.apiService.makeRequest(API_ENDPOINTS.GET_ACCOUNT_BALANCES, MethodTypes.GET, queryParams); - - return balances; - } catch (error) { - throw new Error(error.message || 'Failed to get account balances'); - } - } - - async getTransaction(hash: string, chainId: number): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - hash, - chainId, - }; - - const response = await this.apiService.makeRequest(API_ENDPOINTS.GET_TRANSACTION, MethodTypes.GET, queryParams); - - return response.transaction; - } catch (error) { - throw new Error(error.message || 'Failed to get transaction'); - } - } - - async getTransactions(account: string, chainId: number, page?: number, limit?: number): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - account, - chainId, - page, - limit, - }; - - const response = await this.apiService.makeRequest(API_ENDPOINTS.GET_TRANSACTIONS, MethodTypes.GET, queryParams); - - return response; - } catch (error) { - throw new Error(error.message || 'Failed to get transactions'); - } - } - - async getNftList(account: string, chainId: number): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - account, - chainId, - }; - - const nfts = await this.apiService.makeRequest(API_ENDPOINTS.GET_ACCOUNT_NFTS, MethodTypes.GET, queryParams); - - return nfts; - } catch (error) { - throw new Error(error.message || 'Failed to get nft list'); - } - } - - async getAdvanceRoutesLiFi( - fromTokenAddress: string, - toTokenAddress: string, - fromChainId: number, - toChainId: number, - fromAmount: BigNumber, - toAddress?: string, - allowSwitchChain?: boolean, - fromAddress?: string, - showZeroUsd?: boolean, - ): Promise { - const account = fromAddress; - let data = null; - - try { - const queryParams = { - 'api-key': this.currentApi, - account, - fromTokenAddress, - toTokenAddress, - fromChainId, - toChainId, - fromAmount: fromAmount.toString(), - toAddress, - allowSwitchChain, - fromAddress, - showZeroUsd, - }; - - const response = await this.apiService.makeRequest(API_ENDPOINTS.GET_ADVANCE_ROUTES_LIFI, MethodTypes.GET, queryParams); - - data = JSON.parse(response.data); - - return data; - } catch (error) { - throw new Error(error.message || 'Failed to advance routes from LiFi'); - } - } - - async getStepTransaction(selectedRoute: Route, account: string): Promise { - try { - const route = JSON.stringify(selectedRoute); - const queryParams = { - 'api-key': this.currentApi, - }; - - const body = { - route, - account - }; - - const response = await this.apiService.makeRequest(API_ENDPOINTS.GET_STEP_TRANSACTIONS, MethodTypes.POST, queryParams, body); - - return { - items: response.transactions - }; - } catch (error) { - throw new Error(error.message || 'Failed to get step transaction from LIFI'); - } - } - - async getExchangeSupportedAssets(page: number = null, limit: number = null, chainId: number, account: string): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - account, - page: page || 1, - limit: limit || 100, - chainId - }; - - const assets: PaginatedTokens = await this.apiService.makeRequest(API_ENDPOINTS.GET_EXCHANGE_SUPPORTED_ASSETS, MethodTypes.GET, queryParams); - - return assets; - } catch (error) { - throw new Error(error.message || 'Failed to get exchange supported assets'); - } - } - - async getExchangeOffers( - fromTokenAddress: string, - toTokenAddress: string, - fromAmount: BigNumber, - fromChainId: number, - fromAddress: string, - toAddress?: string, - showZeroUsd?: boolean - ): Promise { - const account = fromAddress; - - try { - const queryParams = { - 'api-key': this.currentApi, - account, - fromTokenAddress, - toTokenAddress, - fromAmount: fromAmount.toString(), - chainId: fromChainId, - fromAddress, - toAddress, - showZeroUsd, - }; - - const result = await this.apiService.makeRequest(API_ENDPOINTS.GET_EXCHANGE_OFFERS, MethodTypes.GET, queryParams); - - return result ? result.items : null; - } catch (error) { - throw new Error(error.message || 'Failed to get exchange offers'); - } - } - - async getTokenLists(chainId: number): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - chainId, - }; - - const result = await this.apiService.makeRequest(API_ENDPOINTS.GET_TOKEN_LISTS, MethodTypes.GET, queryParams); - - return result ? result.items : []; - } catch (error) { - throw new Error(error.message || 'Failed to get token lists'); - } - } - - async getTokenListTokens(chainId: number, name: string = null): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - chainId, - name, - }; - - const result = await this.apiService.makeRequest(API_ENDPOINTS.GET_TOKEN_LIST_TOKENS, MethodTypes.GET, queryParams); - - return result ? result.tokens : []; - } catch (error) { - throw new Error(error.message || 'Failed to get token list tokens'); - } - } - - async fetchExchangeRates(tokens: string[], chainId: number): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - chainId, - tokens, - }; - - const result = await this.apiService.makeRequest(API_ENDPOINTS.EXCHANGE_RATES, MethodTypes.GET, queryParams); - - return result ? result.exchangeRates : null; - } catch (error) { - throw new Error(error.message || 'Failed to fetch exchange rates'); - } - } - - async getSupportedAssets(chainId?: number, provider?: BridgingProvider): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - chainId, - }; - let apiUrl: string; - - switch (provider) { - case BridgingProvider.Connext: - apiUrl = API_ENDPOINTS.GET_CONNEXT_SUPPORTED_ASSETS; - break; - default: - apiUrl = API_ENDPOINTS.GET_CONNEXT_SUPPORTED_ASSETS; - break; - } - - const result: { tokens: Token[] } = await this.apiService.makeRequest(apiUrl, MethodTypes.GET, queryParams); - - return result ? result.tokens : []; - } catch (error) { - throw new Error(error.message || 'Failed to get supported assets'); - } - } - - async getQuotes( - fromAddress: string, - toAddress: string, - fromChainId: number, - toChainId: number, - fromToken: string, - fromAmount: BigNumber, - slippage: number, - provider?: BridgingProvider - ): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - fromAddress, - toAddress, - fromChainId, - toChainId, - fromToken, - fromAmount: fromAmount.toString(), - slippage - }; - let apiUrl: string; - - switch (provider) { - case BridgingProvider.Connext: - apiUrl = API_ENDPOINTS.GET_CONNEXT_QUOTE_TRANSACTIONS; - break; - default: - apiUrl = API_ENDPOINTS.GET_CONNEXT_QUOTE_TRANSACTIONS; - break; - } - - const result: { transactions: Quote[] } = await this.apiService.makeRequest(apiUrl, MethodTypes.GET, queryParams); - - return result ? result.transactions : []; - } catch (error) { - throw new Error(error.message || 'Failed to get quotes transactions'); - } - } - - async getTransactionStatus(fromChainId: number, toChainId: number, transactionHash: string, provider?: BridgingProvider): Promise { - try { - const queryParams = { - 'api-key': this.currentApi, - fromChainId, - toChainId, - transactionHash, - }; - let apiUrl: string; - - switch (provider) { - case BridgingProvider.Connext: - apiUrl = API_ENDPOINTS.GET_CONNEXT_TRANSACTION_STATUS; - break; - default: - apiUrl = API_ENDPOINTS.GET_CONNEXT_TRANSACTION_STATUS; - break; - } - - const result: TransactionStatus = await this.apiService.makeRequest(apiUrl, MethodTypes.GET, queryParams); - - return result ? result : null; - } catch (error) { - throw new Error(error.message || 'Failed to get transaction status'); - } - } -} diff --git a/src/sdk/data/index.ts b/src/sdk/data/index.ts deleted file mode 100644 index 61cde47..0000000 --- a/src/sdk/data/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './data.module'; -export * from './classes'; -export * from './constants'; \ No newline at end of file diff --git a/src/sdk/dataUtils.ts b/src/sdk/dataUtils.ts deleted file mode 100644 index 217b63f..0000000 --- a/src/sdk/dataUtils.ts +++ /dev/null @@ -1,280 +0,0 @@ -import "reflect-metadata"; -import { AccountBalances, AdvanceRoutesLiFi, Token, Quote, TransactionStatus, DataModule, ExchangeOffer, NftList, PaginatedTokens, RateData, StepTransactions, TokenList, TokenListToken, Transaction, Transactions } from "./data"; -import { FetchExchangeRatesDto, GetAccountBalancesDto, GetAdvanceRoutesLiFiDto, GetSupportedAssetsDto, GetTransactionStatusDto, GetExchangeOffersDto, GetExchangeSupportedAssetsDto, GetNftListDto, GetStepTransactionsLiFiDto, GetTokenListDto, GetTokenListsDto, GetTransactionDto, GetTransactionsDto, GetQuotesDto, validateDto } from "./dto"; -import { BigNumber } from "ethers"; - -export class DataUtils { - private dataModule: DataModule; - private readonly defaultDataApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjI4ZWJiMGQ5YTMxYjQ3MmY4NmU4MWY2YTVhYzBhMzE1IiwiaCI6Im11cm11cjEyOCJ9'; - constructor(apiKey?: string) { - this.dataModule = new DataModule(apiKey || this.defaultDataApiKey); - } - - /** - * gets account balances - * @param dto - * @return Promise - */ - async getAccountBalances(dto: GetAccountBalancesDto): Promise { - const { account, tokens, chainId, provider } = await validateDto(dto, GetAccountBalancesDto, { - addressKeys: ['account', 'tokens'], - }); - - return this.dataModule.getAccountBalances( - account, - tokens, - chainId, - provider, - ); - } - - /** - * gets transaction - * @param dto - * @return Promise - */ - async getTransaction(dto: GetTransactionDto): Promise { - const { hash, chainId } = await validateDto(dto, GetTransactionDto); - - return this.dataModule.getTransaction(hash, chainId); - } - - /** - * gets transactions - * @param dto - * @return Promise - */ - async getTransactions(dto: GetTransactionsDto): Promise { - const { account, chainId, page, limit } = await validateDto(dto, GetTransactionsDto, { - addressKeys: ['account'], - }); - - return this.dataModule.getTransactions( - account, - chainId, - page, - limit, - ); - } - - /** - * gets NFT list belonging to account - * @param dto - * @return Promise - */ - async getNftList(dto: GetNftListDto): Promise { - const { account, chainId } = await validateDto(dto, GetNftListDto, { - addressKeys: ['account'], - }); - - return this.dataModule.getNftList( - account, - chainId, - ); - } - - /** - * gets advance routes from LIFI - * @param dto - * @return Promise - */ - async getAdvanceRoutesLiFi(dto: GetAdvanceRoutesLiFiDto): Promise { - const { - fromChainId, - toChainId, - fromTokenAddress, - toTokenAddress, - fromAmount, - allowSwitchChain, - showZeroUsd, - fromAddress, - } = await validateDto(dto, GetAdvanceRoutesLiFiDto, { - addressKeys: ['fromTokenAddress', 'toTokenAddress', 'fromAddress'], - }); - - let { toAddress } = dto; - - if (!toAddress) toAddress = fromAddress; - - const data = await this.dataModule.getAdvanceRoutesLiFi( - fromTokenAddress, - toTokenAddress, - fromChainId, - toChainId, - BigNumber.from(fromAmount), - toAddress, - allowSwitchChain, - fromAddress, - showZeroUsd, - ); - - return data; - } - - /** - * gets step transactions from LIFI - * @param dto - * @return Promise - */ - async getStepTransaction(dto: GetStepTransactionsLiFiDto): Promise { - const { route, account } = await validateDto(dto, GetStepTransactionsLiFiDto, { - addressKeys: ['account'] - }) - - return this.dataModule.getStepTransaction(route, account); - } - - /** - * gets exchange supported tokens - * @param dto - * @return Promise - */ - async getExchangeSupportedAssets(dto: GetExchangeSupportedAssetsDto): Promise { - const { page, limit, chainId, account } = await validateDto(dto, GetExchangeSupportedAssetsDto, { - addressKeys: ['account'] - }); - - return this.dataModule.getExchangeSupportedAssets(page, limit, chainId, account); - } - - /** - * gets exchange offers - * @param dto - * @return Promise - */ - async getExchangeOffers(dto: GetExchangeOffersDto): Promise { - const { fromTokenAddress, toTokenAddress, fromAmount, fromChainId, showZeroUsd, fromAddress } = await validateDto(dto, GetExchangeOffersDto, { - addressKeys: ['fromTokenAddress', 'toTokenAddress', 'fromAddress'], - }); - - let { toAddress } = dto; - - if (!toAddress) toAddress = fromAddress; - - return this.dataModule.getExchangeOffers( - fromTokenAddress, - toTokenAddress, - BigNumber.from(fromAmount), - fromChainId, - fromAddress, - toAddress, - showZeroUsd, - ); - } - - /** - * gets token lists - * @param dto - * @return Promise - */ - async getTokenLists(dto: GetTokenListsDto): Promise { - const { chainId } = await validateDto(dto, GetTokenListsDto); - - return this.dataModule.getTokenLists(chainId); - } - - /** - * gets token list tokens - * @param dto - * @return Promise - */ - async getTokenListTokens(dto: GetTokenListDto): Promise { - const { chainId, name } = await validateDto(dto, GetTokenListDto); - - return this.dataModule.getTokenListTokens(chainId, name); - } - - /** - * fetch exchange rates of tokens - * @param dto - * @return Promise - */ - async fetchExchangeRates(dto: FetchExchangeRatesDto): Promise { - const { tokens, chainId } = dto; - let data: RateData; - const promises = []; - - // Create a batch of 50 - const batches = [...Array(Math.ceil(tokens.length / 50))].map(() => tokens.splice(0, 50)); - batches.forEach((batch) => { - promises.push(this.dataModule.fetchExchangeRates(batch, chainId)); - }); - - // Fetch succeded results and merge - await (Promise as any) - .allSettled(promises) - .then((response) => - response?.forEach((result) => { - if (result?.status === 'fulfilled') { - !data - ? (data = result.value ? result.value : {}) - : (data.items = result?.value?.items ? [...data.items, ...result.value.items] : [...data.items]); - } - }), - ); - - // Return Unique tokens - if (data && data.items && data.items.length) { - data.error = '' - data.errored = false - data.items = [...new Map(data.items.map(item => [item['address'], item])).values()]; - } else { - data.items = []; - } - - return data; - } - - /** - * gets supported tokens - * @param dto - * @return Promise - */ - async getSupportedAssets(dto: GetSupportedAssetsDto): Promise { - const { chainId, provider } = await validateDto(dto, GetSupportedAssetsDto); - - return this.dataModule.getSupportedAssets(chainId, provider); - } - - /** - * gets quote transactions - * @param dto - * @return Promise - */ - async getQuotes(dto: GetQuotesDto): Promise { - const { - fromAddress, - toAddress, - fromChainId, - toChainId, - fromToken, - fromAmount, - slippage, - provider - } = await validateDto(dto, GetQuotesDto, { - addressKeys: ['fromAddress', 'toAddress', 'fromToken'], - }); - - return this.dataModule.getQuotes( - fromAddress, - toAddress, - fromChainId, - toChainId, - fromToken, - BigNumber.from(fromAmount), - slippage, - provider - ); - } - - /** - * gets transaction status - * @param dto - * @return Promise - */ - async getTransactionStatus(dto: GetTransactionStatusDto): Promise { - const { fromChainId, toChainId, transactionHash, provider } = await validateDto(dto, GetTransactionStatusDto); - - return this.dataModule.getTransactionStatus(fromChainId, toChainId, transactionHash, provider); - } -} diff --git a/src/sdk/dto/advance-routes-lifi.dto.ts b/src/sdk/dto/advance-routes-lifi.dto.ts deleted file mode 100644 index 06dfb8b..0000000 --- a/src/sdk/dto/advance-routes-lifi.dto.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { BigNumber } from 'ethers'; -import { Type } from 'class-transformer'; -import { IsBoolean, IsInt, IsOptional, IsPositive } from 'class-validator'; -import { IsAddress, IsBigNumberish } from './validators'; - -export class GetAdvanceRoutesLiFiDto { - @IsAddress() - fromTokenAddress: string; - - @IsAddress() - toTokenAddress: string; - - @IsPositive() - @IsInt() - @Type(() => Number) - fromChainId: number | null; - - @IsPositive() - @IsInt() - @Type(() => Number) - toChainId: number; - - @IsBigNumberish() - fromAmount: BigNumber; - - @IsAddress() - fromAddress: string; - - @IsOptional() - @IsAddress() - toAddress?: string; - - @IsOptional() - @IsBoolean() - allowSwitchChain?: boolean; - - @IsOptional() - @IsBoolean() - showZeroUsd?: boolean; -} diff --git a/src/sdk/dto/fetch-exchange-rates.dto.ts b/src/sdk/dto/fetch-exchange-rates.dto.ts deleted file mode 100644 index 918be87..0000000 --- a/src/sdk/dto/fetch-exchange-rates.dto.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IsAddress } from './validators'; -import { ArrayNotEmpty, IsInt, IsPositive } from 'class-validator'; - -export class FetchExchangeRatesDto { - @IsAddress({ - each: true, - }) - @ArrayNotEmpty() - tokens: Array; - - @IsInt() - @IsPositive() - chainId: number; -} diff --git a/src/sdk/dto/get-account-balances.dto.ts b/src/sdk/dto/get-account-balances.dto.ts deleted file mode 100644 index 1c1c07e..0000000 --- a/src/sdk/dto/get-account-balances.dto.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsOptional, IsPositive, IsString } from 'class-validator'; -import { IsAddress } from './validators'; - -export class GetAccountBalancesDto { - @IsOptional() - @IsAddress({ - each: true, - }) - tokens?: string[] = []; - - @IsOptional() - @IsString() - provider?: string = null; - - @IsAddress() - account: string = null; - - @IsPositive() - chainId: number; -} diff --git a/src/sdk/dto/get-exchange-cross-chain-quote.dto.ts b/src/sdk/dto/get-exchange-cross-chain-quote.dto.ts deleted file mode 100644 index ec6cf5c..0000000 --- a/src/sdk/dto/get-exchange-cross-chain-quote.dto.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { BigNumber } from 'ethers'; -import { Type } from 'class-transformer'; -import { IsBoolean, IsInt, IsOptional, IsPositive } from 'class-validator'; -import { IsAddress, IsBigNumberish } from './validators'; -import { CrossChainServiceProvider, LiFiBridge } from '../data'; - -export class GetExchangeCrossChainQuoteDto { - @IsAddress() - fromTokenAddress: string; - - @IsAddress() - toTokenAddress: string; - - @IsPositive() - @IsInt() - @Type(() => Number) - fromChainId: number | null; - - @IsPositive() - @IsInt() - @Type(() => Number) - toChainId: number; - - @IsBigNumberish() - fromAmount: BigNumber; - - @IsAddress() - fromAddress: string; - - @IsOptional() - serviceProvider?: CrossChainServiceProvider; - - @IsOptional() - @IsAddress() - toAddress?: string; - - @IsOptional() - lifiBridges?: LiFiBridge[]; - - @IsOptional() - @IsBoolean() - showZeroUsd?: boolean; -} diff --git a/src/sdk/dto/get-exchange-offers.dto.ts b/src/sdk/dto/get-exchange-offers.dto.ts deleted file mode 100644 index 224ecc2..0000000 --- a/src/sdk/dto/get-exchange-offers.dto.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { IsBoolean, IsOptional } from 'class-validator'; -import { BigNumberish } from 'ethers'; -import { IsAddress, IsBigNumberish } from './validators'; - -export class GetExchangeOffersDto { - @IsAddress() - fromTokenAddress: string; - - @IsAddress() - toTokenAddress: string; - - @IsBigNumberish({ - positive: true, - }) - fromAmount: BigNumberish; - - fromChainId: number; - - @IsAddress() - fromAddress: string; - - @IsOptional() - @IsAddress() - toAddress?: string; - - @IsOptional() - @IsBoolean() - showZeroUsd?: boolean; -} diff --git a/src/sdk/dto/get-exchange-supported-assets.dto.ts b/src/sdk/dto/get-exchange-supported-assets.dto.ts deleted file mode 100644 index fe49721..0000000 --- a/src/sdk/dto/get-exchange-supported-assets.dto.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { IsPositive } from 'class-validator'; -import { PaginationDto } from './pagination.dto'; -import { IsAddress } from './validators'; - -export class GetExchangeSupportedAssetsDto extends PaginationDto { - @IsPositive() - chainId: number; - - @IsAddress() - account: string; -} diff --git a/src/sdk/dto/get-nft-list.dto.ts b/src/sdk/dto/get-nft-list.dto.ts deleted file mode 100644 index a5ee505..0000000 --- a/src/sdk/dto/get-nft-list.dto.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IsPositive } from 'class-validator'; -import { IsAddress } from './validators'; - -export class GetNftListDto { - @IsPositive() - chainId: number; - - @IsAddress() - account: string; -} diff --git a/src/sdk/dto/get-quotes.dto.ts b/src/sdk/dto/get-quotes.dto.ts deleted file mode 100644 index d33529a..0000000 --- a/src/sdk/dto/get-quotes.dto.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { BigNumberish } from 'ethers'; -import { IsAddress, IsBigNumberish } from './validators'; -import { IsOptional } from 'class-validator'; -import { BridgingProvider } from '../data'; - -export class GetQuotesDto { - @IsAddress() - fromAddress: string; - - @IsAddress() - toAddress: string; - - fromChainId: number; - - toChainId: number; - - @IsAddress() - fromToken: string; - - @IsBigNumberish({ - positive: true, - }) - fromAmount: BigNumberish; - - slippage: number; - - @IsOptional() - provider?: BridgingProvider; -} diff --git a/src/sdk/dto/get-step-transactions-lifi.dto.ts b/src/sdk/dto/get-step-transactions-lifi.dto.ts deleted file mode 100644 index 37642c4..0000000 --- a/src/sdk/dto/get-step-transactions-lifi.dto.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Route } from '@lifi/sdk'; -import { IsAddress } from './validators'; - -export class GetStepTransactionsLiFiDto { - route: Route - - @IsAddress() - account: string; -} diff --git a/src/sdk/dto/get-supported-assets.dto.ts b/src/sdk/dto/get-supported-assets.dto.ts deleted file mode 100644 index aca3fa3..0000000 --- a/src/sdk/dto/get-supported-assets.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { IsInt, IsOptional, IsPositive } from 'class-validator'; -import { BridgingProvider } from '../data'; - -export class GetSupportedAssetsDto { - @IsOptional() - @IsPositive() - @IsInt() - chainId?: number = null; - - @IsOptional() - provider?: BridgingProvider; -} diff --git a/src/sdk/dto/get-token-list.dto.ts b/src/sdk/dto/get-token-list.dto.ts deleted file mode 100644 index e67bae5..0000000 --- a/src/sdk/dto/get-token-list.dto.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { IsString, MinLength, MaxLength, IsOptional, IsPositive } from 'class-validator'; -import { TOKEN_LIST_MAX_NAME_LENGTH, TOKEN_LIST_MIN_NAME_LENGTH } from '../data'; - -export class GetTokenListDto { - @IsPositive() - chainId: number; - - @IsOptional() - @IsString() - @MinLength(TOKEN_LIST_MIN_NAME_LENGTH) - @MaxLength(TOKEN_LIST_MAX_NAME_LENGTH) - name?: string = null; -} diff --git a/src/sdk/dto/get-token-lists.dto.ts b/src/sdk/dto/get-token-lists.dto.ts deleted file mode 100644 index 625ea26..0000000 --- a/src/sdk/dto/get-token-lists.dto.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IsPositive } from 'class-validator'; - -export class GetTokenListsDto { - @IsPositive() - chainId: number; -} diff --git a/src/sdk/dto/get-transaction-status.dto.ts b/src/sdk/dto/get-transaction-status.dto.ts deleted file mode 100644 index 2b4d898..0000000 --- a/src/sdk/dto/get-transaction-status.dto.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { IsInt, IsOptional, IsPositive } from 'class-validator'; -import { IsHex32 } from './validators'; -import { BridgingProvider } from '../data'; - -export class GetTransactionStatusDto { - @IsPositive() - @IsInt() - fromChainId: number; - - @IsPositive() - @IsInt() - toChainId: number; - - @IsHex32() - transactionHash: string; - - @IsOptional() - provider?: BridgingProvider; -} diff --git a/src/sdk/dto/get-transaction.dto.ts b/src/sdk/dto/get-transaction.dto.ts deleted file mode 100644 index c888320..0000000 --- a/src/sdk/dto/get-transaction.dto.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IsPositive } from 'class-validator'; -import { IsHex32 } from './validators'; - -export class GetTransactionDto { - @IsHex32() - hash: string; - - @IsPositive() - chainId: number; -} diff --git a/src/sdk/dto/get-transactions.dto.ts b/src/sdk/dto/get-transactions.dto.ts deleted file mode 100644 index 3a314c4..0000000 --- a/src/sdk/dto/get-transactions.dto.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { IsPositive } from 'class-validator'; -import { IsAddress } from './validators'; -import { PaginationDto } from './pagination.dto'; - -export class GetTransactionsDto extends PaginationDto { - @IsAddress() - account: string = null; - - @IsPositive() - chainId: number; -} diff --git a/src/sdk/dto/index.ts b/src/sdk/dto/index.ts index c533fd1..cbb5fd0 100644 --- a/src/sdk/dto/index.ts +++ b/src/sdk/dto/index.ts @@ -1,19 +1,3 @@ export * from './sign-message.dto'; export * from './utils'; export * from './onRamper.dto'; -export * from './get-account-balances.dto'; -export * from './get-transaction.dto'; -export * from './get-nft-list.dto'; -export * from './get-exchange-offers.dto'; -export * from './advance-routes-lifi.dto'; -export * from './get-step-transactions-lifi.dto'; -export * from './get-exchange-cross-chain-quote.dto'; -export * from './fetch-exchange-rates.dto'; -export * from './get-token-list.dto'; -export * from './pagination.dto'; -export * from './get-exchange-supported-assets.dto'; -export * from './get-token-lists.dto'; -export * from './get-transactions.dto'; -export * from './get-supported-assets.dto'; -export * from './get-quotes.dto'; -export * from './get-transaction-status.dto'; diff --git a/src/sdk/dto/pagination.dto.ts b/src/sdk/dto/pagination.dto.ts deleted file mode 100644 index 2284667..0000000 --- a/src/sdk/dto/pagination.dto.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IsOptional, IsPositive, IsInt, Max } from 'class-validator'; - -export class PaginationDto { - @IsOptional() - @IsPositive() - @IsInt() - page?: number = null; - - @IsOptional() - @IsPositive() - @IsInt() - @Max(100) - limit?: number = null; -} diff --git a/src/sdk/index.ts b/src/sdk/index.ts index b39f7c3..cf2cd4e 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -1,8 +1,6 @@ -import { DataUtils } from './dataUtils'; import { ModularSdk } from './sdk'; import { ArkaPaymaster } from './paymaster'; -export * from './api'; export * from './dto'; export * from './interfaces'; export * from './network'; @@ -10,5 +8,5 @@ export * from './state'; export * from './wallet'; export * from './bundler'; -export { ModularSdk, DataUtils, ArkaPaymaster }; +export { ModularSdk, ArkaPaymaster }; export default ModularSdk; \ No newline at end of file diff --git a/src/sdk/interfaces.ts b/src/sdk/interfaces.ts index e8f4fec..af21320 100644 --- a/src/sdk/interfaces.ts +++ b/src/sdk/interfaces.ts @@ -7,9 +7,7 @@ export interface PaymasterApi { } export enum Factory { - ZERO_DEV = 'zeroDev', ETHERSPOT = 'etherspot', - SIMPLE_ACCOUNT = 'simpleAccount' } export interface SdkOptions { diff --git a/src/sdk/network/constants.ts b/src/sdk/network/constants.ts index 47e2a38..d91fab3 100644 --- a/src/sdk/network/constants.ts +++ b/src/sdk/network/constants.ts @@ -16,7 +16,6 @@ export enum NetworkNames { OptimismSepolia = 'optimismSepolia', Rootstock = 'rootstock', RootstockTestnet = 'rootstockTestnet', - VerseTestnet = 'verseTestnet', Mantle = 'Mantle', MantleSepolia = 'MantleSepolia', Avalanche = 'avalanche', @@ -33,11 +32,10 @@ export enum NetworkNames { Ancient8Testnet = 'ancient8Testnet', Ancient8 = 'ancient8', Amoy = 'amoy', - XDCTestnet = 'xdcTestnet', } export const SupportedNetworks = - [1, 10, 14, 30, 31, 51, 56, 97, 100, 114, 122, 123, 137, 2357, 5000, 5003, 8453, 10200, 20197, 42161, 43113, 43114, 59140, 59144, 80002, 84532, 421614, 534351, 534352, 11155111, 11155420, 28122024, 888888888] + [1, 10, 14, 30, 31, 56, 97, 100, 114, 122, 123, 137, 2357, 5000, 5003, 8453, 10200, 42161, 43113, 43114, 59140, 59144, 80002, 84532, 421614, 534351, 534352, 11155111, 11155420, 28122024, 888888888] export const NETWORK_NAME_TO_CHAIN_ID: { [key: string]: number; @@ -57,7 +55,6 @@ export const NETWORK_NAME_TO_CHAIN_ID: { [NetworkNames.OptimismSepolia]: 11155420, [NetworkNames.Rootstock]: 30, [NetworkNames.RootstockTestnet]: 31, - [NetworkNames.VerseTestnet]: 20197, [NetworkNames.Mantle]: 5000, [NetworkNames.MantleSepolia]: 5003, [NetworkNames.Avalanche]: 43114, @@ -74,7 +71,6 @@ export const NETWORK_NAME_TO_CHAIN_ID: { [NetworkNames.Ancient8Testnet]: 28122024, [NetworkNames.Ancient8]: 888888888, [NetworkNames.Amoy]: 80002, - [NetworkNames.XDCTestnet]: 51, }; export const onRamperAllNetworks = ['OPTIMISM', 'POLYGON', 'ARBITRUM', 'FUSE', 'GNOSIS', 'ETHEREUM'] @@ -87,13 +83,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/84532', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [11155111]: { @@ -101,13 +93,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/11155111', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [10]: { @@ -115,13 +103,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/10', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [137]: { @@ -129,13 +113,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/137', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [42161]: { @@ -143,13 +123,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/42161', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [1]: { @@ -157,13 +133,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/1', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [10200]: { @@ -171,13 +143,9 @@ export const Networks: { bundler: '', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [122]: { @@ -185,13 +153,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/122', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [123]: { @@ -199,13 +163,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/123', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [100]: { @@ -213,13 +173,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/100', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [2357]: { @@ -227,13 +183,9 @@ export const Networks: { bundler: '', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [30]: { @@ -241,13 +193,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/30', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [31]: { @@ -255,27 +203,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/31', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', - }, - }, - [20197]: { - chainId: 20197, - bundler: '', - contracts: { - entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, - bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [5000]: { @@ -283,13 +213,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/5000', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [5003]: { @@ -297,13 +223,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/5003', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [43114]: { @@ -311,13 +233,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/43114', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [8453]: { @@ -325,13 +243,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/8453', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [56]: { @@ -339,13 +253,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/56', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [97]: { @@ -353,13 +263,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/97', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [43113]: { @@ -367,13 +273,9 @@ export const Networks: { bundler: '', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [59144]: { @@ -381,13 +283,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/59144', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [59140]: { @@ -395,13 +293,9 @@ export const Networks: { bundler: '', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [114]: { @@ -409,13 +303,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/114', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [14]: { @@ -423,13 +313,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/14', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [534351]: { @@ -437,13 +323,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/534351', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [534352]: { @@ -451,13 +333,9 @@ export const Networks: { bundler: 'https://rpc.etherspot.io/v2/534352', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [11155420]: { @@ -465,13 +343,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/11155420', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [28122024]: { @@ -479,13 +353,9 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/28122024', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [888888888]: { @@ -493,13 +363,9 @@ export const Networks: { bundler: '', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x77E4288A4b15893F520F15C262a07dF9866904e4', - zeroDev: '', - simpleAccount: '', - }, - bootstrap: '0x4f695ad7694863c8280FCEBf2Cb220E361ce4eA0', - multipleOwnerECDSAValidator: '0x1E714c551Fe6234B6eE406899Ec3Be9234Ad2124', + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', + bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, [80002]: { @@ -507,234 +373,23 @@ export const Networks: { bundler: 'https://testnet-rpc.etherspot.io/v2/80002', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x059379cdb7Ee132De6a2281307bb4dC04a302064', - zeroDev: '', - simpleAccount: '', - }, + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', - multipleOwnerECDSAValidator: '0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, }, - [51]: { - chainId: 51, - bundler: 'https://testnet-rpc.etherspot.io/v2/51', + [421614]: { + chainId: 421614, + bundler: 'https://testnet-rpc.etherspot.io/v2/421614', contracts: { entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032', - walletFactory: { - etherspot: '0x3aa509fd07B09d5a8b944c96ae6eE767fe75C465', - zeroDev: '', - simpleAccount: '', - }, - bootstrap: '0xcaDBADcFeD5530A49762DFc9d1d712CcD6b09b25', - multipleOwnerECDSAValidator: '0x50af618E286713Fd2bda2113b7e56352BD357222', + walletFactory: '0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F', + bootstrap: '0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066', + multipleOwnerECDSAValidator: '0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143', }, } }; -interface ISafeConstant { - MultiSend: Record; -} - -export const Safe: ISafeConstant = { - // From https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.3.0/multi_send.json - MultiSend: { - "1": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "3": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "5": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "10": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "11": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "12": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "18": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "25": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "28": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "30": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "31": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "39": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "40": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "41": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "42": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "43": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "44": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "46": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "50": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "51": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "56": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "57": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "61": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "63": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "69": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "71": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "81": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "82": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "83": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "97": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "100": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "106": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "108": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "109": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "111": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "122": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "123": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "137": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "148": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "155": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "169": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "195": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "204": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "246": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "250": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "252": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "255": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "280": "0x0dFcccB95225ffB03c6FBB2559B530C2B7C8A912", - "288": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "291": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "300": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "321": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "322": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "324": "0x0dFcccB95225ffB03c6FBB2559B530C2B7C8A912", - "336": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "338": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "420": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "424": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "570": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "588": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "592": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "595": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "599": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "686": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "787": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "919": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1001": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1008": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1030": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1088": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1101": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1111": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1112": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1115": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1116": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1230": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1231": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1284": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1285": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1287": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1294": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1442": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1559": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1663": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1807": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1890": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1891": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1984": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1998": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2001": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2002": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2008": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2019": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2020": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2021": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2221": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2222": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "2358": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "3737": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "3776": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4002": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4202": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4337": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4460": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4689": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "4918": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "4919": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "5000": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "5003": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "5700": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "6102": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "7001": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "7332": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "7341": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "7700": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "8192": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "8194": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "8217": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "8453": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "9000": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "9001": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "9728": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "10000": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "10001": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "10081": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "10200": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "10242": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "10243": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "11235": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "11437": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "11891": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "12357": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "13337": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "17000": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "17172": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "18231": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "23294": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "23295": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "34443": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "42161": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "42170": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "42220": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "43113": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "43114": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "43288": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "44787": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "45000": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "47805": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "54211": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "56288": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "57000": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "58008": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "59140": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "59144": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "71401": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "71402": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "73799": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "80002": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "80085": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "81457": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "84531": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "84532": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "103454": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "167008": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "200101": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "200202": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "333999": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "421611": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "421613": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "421614": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "534351": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "534352": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "534353": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "622277": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "713715": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "7777777": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "11155111": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "11155420": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "168587773": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "222000222": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "245022926": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "245022934": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "333000333": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "999999999": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1313161554": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1313161555": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "1666600000": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "1666700000": "0x998739BFdAAdde7C933B942a68053933098f9EDa", - "11297108099": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761", - "11297108109": "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761" - }, -}; - -export const KERNEL_IMPL_ADDRESS = "0xf048AD83CB2dfd6037A43902a2A5Be04e53cd2Eb"; -export const KERNEL_VALIDATOR_ADDRESS = "0xd9AB5096a832b9ce79914329DAEE236f8Eea0390"; export const DEFAULT_BOOTSTRAP_ADDRESS = "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066"; export const DEFAULT_MULTIPLE_OWNER_ECDSA_VALIDATOR_ADDRESS = "0x609d3ED5F7D1707806327D198Cb480B93dD6E6b9"; diff --git a/src/sdk/network/interfaces.ts b/src/sdk/network/interfaces.ts index a184ec3..8902b6f 100644 --- a/src/sdk/network/interfaces.ts +++ b/src/sdk/network/interfaces.ts @@ -10,11 +10,7 @@ export interface NetworkConfig { bundler: string; contracts: { entryPoint: string; - walletFactory: { - etherspot: string; - zeroDev: string; - simpleAccount: string; - }; + walletFactory: string; bootstrap: string; multipleOwnerECDSAValidator: string; }; diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 7d673e3..6a9ef43 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -15,8 +15,6 @@ import { Networks, onRamperAllNetworks } from './network/constants'; import { EtherspotWalletAPI, HttpRpcClient, VerifyingPaymasterAPI } from './base'; import { TransactionDetailsForUserOp, TransactionGasInfoForUserOp } from './base/TransactionDetailsForUserOp'; import { OnRamperDto, SignMessageDto, validateDto } from './dto'; -import { ZeroDevWalletAPI } from './base/ZeroDevWalletAPI'; -import { SimpleAccountAPI } from './base/SimpleAccountWalletAPI'; import { ErrorHandler } from './errorHandler/errorHandler.service'; import { EtherspotBundler } from './bundler'; import { ModularEtherspotWallet } from './contracts/src/ERC7579/wallet'; @@ -28,7 +26,7 @@ import { ModularEtherspotWallet } from './contracts/src/ERC7579/wallet'; */ export class ModularSdk { - private etherspotWallet: EtherspotWalletAPI | ZeroDevWalletAPI | SimpleAccountAPI; + private etherspotWallet: EtherspotWalletAPI; private bundler: HttpRpcClient; private chainId: number; private factoryUsed: Factory; @@ -70,8 +68,8 @@ export class ModularSdk { let entryPointAddress = '', walletFactoryAddress = ''; if (Networks[chainId]) { entryPointAddress = Networks[chainId].contracts.entryPoint; - if (Networks[chainId].contracts.walletFactory[this.factoryUsed] == '') throw new Exception('The selected factory is not deployed in the selected chain_id') - walletFactoryAddress = Networks[chainId].contracts.walletFactory[this.factoryUsed]; + if (Networks[chainId].contracts.walletFactory == '') throw new Exception('The selected factory is not deployed in the selected chain_id') + walletFactoryAddress = Networks[chainId].contracts.walletFactory; } if (optionsLike.entryPointAddress) entryPointAddress = optionsLike.entryPointAddress; @@ -80,38 +78,16 @@ export class ModularSdk { if (entryPointAddress == '') throw new Exception('entryPointAddress not set on the given chain_id') if (walletFactoryAddress == '') throw new Exception('walletFactoryAddress not set on the given chain_id') - if (this.factoryUsed === Factory.ZERO_DEV) { - this.etherspotWallet = new ZeroDevWalletAPI({ - provider, - walletProvider: walletConnectProvider ?? walletProvider, - optionsLike, - entryPointAddress, - factoryAddress: walletFactoryAddress, - index: this.index, - }) - } else if (this.factoryUsed === Factory.SIMPLE_ACCOUNT) { - this.etherspotWallet = new SimpleAccountAPI({ - provider, - walletProvider: walletConnectProvider ?? walletProvider, - optionsLike, - entryPointAddress, - factoryAddress: walletFactoryAddress, - index: this.index, - }) - } - else { - this.etherspotWallet = new EtherspotWalletAPI({ - provider, - walletProvider: walletConnectProvider ?? walletProvider, - optionsLike, - entryPointAddress, - factoryAddress: walletFactoryAddress, - predefinedAccountAddress: accountAddress, - index: this.index, - }) - } + this.etherspotWallet = new EtherspotWalletAPI({ + provider, + walletProvider: walletConnectProvider ?? walletProvider, + optionsLike, + entryPointAddress, + factoryAddress: walletFactoryAddress, + predefinedAccountAddress: accountAddress, + index: this.index, + }) this.bundler = new HttpRpcClient(optionsLike.bundlerProvider.url, entryPointAddress, chainId); - } @@ -163,14 +139,7 @@ export class ModularSdk { key?: BigNumber } = {}) { const { paymasterDetails, gasDetails, callGasLimit, key } = params; - let dummySignature = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"; - - /** - * Dummy signature used only in the case of zeroDev factory contract - */ - if (this.factoryUsed === Factory.ZERO_DEV) { - dummySignature = "0x00000000870fe151d548a1c527c3804866fab30abf28ed17b79d5fc5149f19ca0819fefc3c57f3da4fdf9b10fab3f2f3dca536467ae44943b9dbb8433efe7760ddd72aaa1c" - } + const dummySignature = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"; if (this.userOpsBatch.to.length < 1) { throw new ErrorHandler('cannot sign empty transaction batch', 1); @@ -275,7 +244,6 @@ export class ModularSdk { tx: UserOpsRequest, ): Promise { if (!tx.data && !tx.value) throw new ErrorHandler('Data and Value both cannot be empty', 1); - if (tx.value && this.factoryUsed === Factory.SIMPLE_ACCOUNT && tx.value.toString() !== '0' && this.userOpsBatch.value.length > 0) throw new ErrorHandler('SimpleAccount: native transfers cant be part of batch', 1); this.userOpsBatch.to.push(tx.to); this.userOpsBatch.value.push(tx.value ?? BigNumber.from(0)); this.userOpsBatch.data.push(tx.data ?? '0x'); @@ -293,11 +261,33 @@ export class ModularSdk { } async installModule(moduleTypeId: MODULE_TYPE, module: string, initData?: string): Promise { - return this.etherspotWallet.installModule(moduleTypeId, module, initData); + const installData = await this.etherspotWallet.installModule(moduleTypeId, module, initData); + + this.clearUserOpsFromBatch(); + + await this.addUserOpsToBatch({ + to: this.etherspotWallet.accountAddress ?? await this.getCounterFactualAddress(), + data: installData + }); + + const op = await this.estimate(); + const uoHash = await this.send(op); + return uoHash; } async uninstallModule(moduleTypeId: MODULE_TYPE, module: string, deinitData: string): Promise { - return this.etherspotWallet.uninstallModule(moduleTypeId, module, deinitData); + const uninstallData = await this.etherspotWallet.uninstallModule(moduleTypeId, module, deinitData); + + this.clearUserOpsFromBatch(); + + await this.addUserOpsToBatch({ + to: this.etherspotWallet.accountAddress ?? await this.getCounterFactualAddress(), + data: uninstallData + }); + + const op = await this.estimate(); + const uoHash = await this.send(op); + return uoHash; } async totalGasEstimated(userOp: UserOperation): Promise {