@hinkal/common 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +10 -3
- package/API/API.mjs +42 -31
- package/API/ai-calls.cjs +1 -0
- package/API/ai-calls.d.ts +9 -0
- package/API/ai-calls.mjs +13 -0
- package/API/callCurveAPI.cjs +1 -1
- package/API/callCurveAPI.mjs +28 -22
- package/API/callRelayer.d.ts +3 -2
- package/API/dataServerCalls.cjs +1 -1
- package/API/dataServerCalls.d.ts +4 -0
- package/API/dataServerCalls.mjs +11 -7
- package/API/duneAPI.cjs +1 -1
- package/API/duneAPI.mjs +7 -4
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.d.ts +9 -1
- package/API/fetchCommitmentsCache.mjs +6 -5
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.d.ts +2 -1
- package/API/getGasEstimates.mjs +10 -9
- package/API/getServerURL.d.ts +1 -1
- package/API/index.d.ts +2 -0
- package/API/is-tx-stateless.cjs +1 -0
- package/API/is-tx-stateless.d.ts +3 -0
- package/API/is-tx-stateless.mjs +9 -0
- package/API/rewardsPointsCalls.cjs +1 -1
- package/API/rewardsPointsCalls.d.ts +3 -3
- package/API/rewardsPointsCalls.mjs +1 -3
- package/API/tenderly.api.cjs +1 -0
- package/API/tenderly.api.d.ts +12 -0
- package/API/tenderly.api.mjs +47 -0
- package/API/token-calls.cjs +1 -0
- package/API/token-calls.d.ts +2 -0
- package/API/token-calls.mjs +9 -0
- package/API/userVerifyTransactions.cjs +1 -1
- package/API/userVerifyTransactions.d.ts +6 -7
- package/API/userVerifyTransactions.mjs +13 -14
- package/constants/addresses.constants.cjs +1 -0
- package/constants/addresses.constants.d.ts +16 -0
- package/constants/addresses.constants.mjs +50 -0
- package/constants/assets.constants.cjs +1 -1
- package/constants/assets.constants.mjs +13 -13
- package/constants/axelar.constants.cjs +1 -1
- package/constants/axelar.constants.mjs +5 -5
- package/constants/balance.constants.cjs +1 -0
- package/constants/balance.constants.d.ts +1 -0
- package/constants/balance.constants.mjs +4 -0
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +0 -2
- package/constants/chains.constants.mjs +28 -40
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +144 -140
- package/constants/conversion.constants.cjs +1 -0
- package/constants/conversion.constants.d.ts +1 -0
- package/constants/conversion.constants.mjs +4 -0
- package/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-arbMainnet.json.mjs +846 -11
- package/constants/deploy-data/deploy-data-avalanche.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-avalanche.json.mjs +848 -13
- package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-base.json.mjs +852 -17
- package/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +855 -20
- package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +850 -15
- package/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-localhost.json.mjs +3208 -1550
- package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-optimism.json.mjs +10010 -3429
- package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-polygon.json.mjs +844 -9
- package/constants/fees.constants.cjs +1 -1
- package/constants/fees.constants.d.ts +5 -3
- package/constants/fees.constants.mjs +22 -19
- package/constants/index.d.ts +6 -0
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +30 -18
- package/constants/mediaUrls.constants.cjs +1 -0
- package/constants/mediaUrls.constants.d.ts +23 -0
- package/constants/mediaUrls.constants.mjs +26 -0
- package/constants/permit2.constants.cjs +1 -0
- package/constants/permit2.constants.d.ts +2 -0
- package/constants/permit2.constants.mjs +5 -0
- package/constants/protocol.constants.cjs +1 -1
- package/constants/protocol.constants.d.ts +6 -0
- package/constants/protocol.constants.mjs +27 -15
- package/constants/rewards.constants.cjs +1 -1
- package/constants/rewards.constants.mjs +14 -12
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +14 -6
- package/constants/server.constants.mjs +24 -16
- package/constants/token-data/ERC20Registry.cjs +1 -1
- package/constants/token-data/ERC20Registry.mjs +49 -48
- package/constants/token-data/arbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistry.json.mjs +89 -86
- package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistryFixed.json.mjs +79 -76
- package/constants/token-data/avalancheRegistry.json.cjs +1 -1
- package/constants/token-data/avalancheRegistry.json.mjs +51 -48
- package/constants/token-data/avalancheRegistryFixed.json.cjs +1 -1
- package/constants/token-data/avalancheRegistryFixed.json.mjs +51 -48
- package/constants/token-data/baseRegistry.json.cjs +1 -1
- package/constants/token-data/baseRegistry.json.mjs +34 -31
- package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
- package/constants/token-data/baseRegistryFixed.json.mjs +31 -28
- package/constants/token-data/bnbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/bnbMainnetRegistry.json.mjs +67 -64
- package/constants/token-data/bnbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/bnbMainnetRegistryFixed.json.mjs +67 -64
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +229 -226
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +193 -190
- package/constants/token-data/index.cjs +1 -0
- package/constants/token-data/index.d.ts +1063 -15
- package/constants/token-data/index.mjs +34 -0
- package/constants/token-data/localhostRegistry.json.cjs +1 -1
- package/constants/token-data/localhostRegistry.json.mjs +296 -276
- package/constants/token-data/optimismRegistry.json.cjs +1 -1
- package/constants/token-data/optimismRegistry.json.mjs +703 -180
- package/constants/token-data/optimismRegistryFixed.json.cjs +1 -1
- package/constants/token-data/optimismRegistryFixed.json.mjs +679 -173
- package/constants/token-data/polygonRegistry.json.cjs +1 -1
- package/constants/token-data/polygonRegistry.json.mjs +110 -107
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +102 -99
- package/constants/token.limits.constants.cjs +1 -0
- package/constants/token.limits.constants.d.ts +5 -0
- package/constants/token.limits.constants.mjs +30 -0
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.d.ts +5 -0
- package/constants/vite.constants.mjs +26 -22
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +48 -20
- package/data-structures/Hinkal/Hinkal.mjs +263 -85
- package/data-structures/Hinkal/IHinkal.d.ts +37 -10
- package/data-structures/Hinkal/hinkalActionBeefy.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionBeefy.mjs +25 -23
- package/data-structures/Hinkal/hinkalActionConvex.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionConvex.mjs +11 -9
- package/data-structures/Hinkal/hinkalActionCurve.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionCurve.mjs +18 -16
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +3 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +61 -0
- package/data-structures/Hinkal/hinkalActionLidoEth.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionLidoEth.mjs +24 -22
- package/data-structures/Hinkal/hinkalActionPendle.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendle.d.ts +1 -1
- package/data-structures/Hinkal/hinkalActionPendle.mjs +17 -15
- package/data-structures/Hinkal/hinkalActionPendleLP.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendleLP.mjs +29 -26
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionReceive.d.ts +4 -0
- package/data-structures/Hinkal/hinkalActionReceive.mjs +39 -0
- package/data-structures/Hinkal/hinkalActionStake.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionStake.d.ts +1 -1
- package/data-structures/Hinkal/hinkalActionStake.mjs +15 -11
- package/data-structures/Hinkal/hinkalActionVolatile.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionVolatile.d.ts +1 -1
- package/data-structures/Hinkal/hinkalActionVolatile.mjs +31 -26
- package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
- package/data-structures/Hinkal/hinkalApprove.d.ts +2 -0
- package/data-structures/Hinkal/hinkalApprove.mjs +120 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.d.ts +3 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +12 -0
- package/data-structures/Hinkal/hinkalDeploySubAccount.cjs +1 -0
- package/data-structures/Hinkal/hinkalDeploySubAccount.d.ts +3 -0
- package/data-structures/Hinkal/hinkalDeploySubAccount.mjs +15 -0
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.d.ts +3 -2
- package/data-structures/Hinkal/hinkalDeposit.mjs +116 -52
- package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +2 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +10 -0
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +6 -17
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +2 -0
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +111 -0
- package/data-structures/Hinkal/hinkalMultiSend.cjs +1 -0
- package/data-structures/Hinkal/hinkalMultiSend.d.ts +3 -0
- package/data-structures/Hinkal/hinkalMultiSend.mjs +13 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +83 -37
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -0
- package/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +4 -0
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +46 -0
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -0
- package/data-structures/Hinkal/hinkalProxySwap.d.ts +5 -0
- package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +3 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +20 -0
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +69 -60
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.d.ts +3 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +77 -50
- package/data-structures/Hinkal/index.d.ts +1 -0
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +18 -11
- package/data-structures/IndexedDB/activity-db.cjs +1 -0
- package/data-structures/IndexedDB/activity-db.d.ts +16 -0
- package/data-structures/IndexedDB/activity-db.mjs +124 -0
- package/data-structures/IndexedDB/balances-db.cjs +1 -0
- package/data-structures/IndexedDB/balances-db.d.ts +13 -0
- package/data-structures/IndexedDB/balances-db.mjs +75 -0
- package/data-structures/IndexedDB/contact-db.cjs +1 -0
- package/data-structures/IndexedDB/contact-db.d.ts +11 -0
- package/data-structures/IndexedDB/contact-db.mjs +44 -0
- package/data-structures/IndexedDB/index.d.ts +5 -0
- package/data-structures/IndexedDB/prices-db.cjs +1 -0
- package/data-structures/IndexedDB/prices-db.d.ts +9 -0
- package/data-structures/IndexedDB/prices-db.mjs +62 -0
- package/data-structures/IndexedDB/private-balances-db.cjs +1 -0
- package/data-structures/IndexedDB/private-balances-db.d.ts +9 -0
- package/data-structures/IndexedDB/private-balances-db.mjs +28 -0
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +47 -44
- package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -0
- package/data-structures/TokenDBs/PrivateTokensDB.d.ts +11 -0
- package/data-structures/TokenDBs/PrivateTokensDB.mjs +53 -0
- package/data-structures/TokenDBs/PublicTokensDB.cjs +1 -0
- package/data-structures/TokenDBs/PublicTokensDB.d.ts +13 -0
- package/data-structures/TokenDBs/PublicTokensDB.mjs +81 -0
- package/data-structures/TokenDBs/index.d.ts +2 -0
- package/data-structures/cacheDevices/AttachableMemoryCacheDevice.cjs +1 -0
- package/data-structures/cacheDevices/AttachableMemoryCacheDevice.d.ts +8 -0
- package/data-structures/cacheDevices/AttachableMemoryCacheDevice.mjs +28 -0
- package/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/BaseCacheDevice.d.ts +9 -6
- package/data-structures/cacheDevices/BaseCacheDevice.mjs +13 -4
- package/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/FileCacheDevice.d.ts +1 -0
- package/data-structures/cacheDevices/FileCacheDevice.mjs +7 -3
- package/data-structures/cacheDevices/LocalStorageCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/LocalStorageCacheDevice.d.ts +2 -1
- package/data-structures/cacheDevices/LocalStorageCacheDevice.mjs +10 -5
- package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/data-structures/crypto-keys/decodeUTXO.mjs +13 -12
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +13 -3
- package/data-structures/crypto-keys/keys.mjs +45 -34
- package/data-structures/custom-token-registry/CustomTokenRegistry.cjs +1 -1
- package/data-structures/custom-token-registry/CustomTokenRegistry.d.ts +2 -3
- package/data-structures/custom-token-registry/CustomTokenRegistry.mjs +17 -21
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.mjs +15 -29
- package/data-structures/event-service/AbstractApprovalsSnapshotService.cjs +1 -0
- package/data-structures/event-service/AbstractApprovalsSnapshotService.d.ts +30 -0
- package/data-structures/event-service/AbstractApprovalsSnapshotService.mjs +104 -0
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.mjs +24 -37
- package/data-structures/event-service/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/AbstractEventService.d.ts +1 -1
- package/data-structures/event-service/AbstractEventService.mjs +15 -15
- package/data-structures/event-service/index.d.ts +1 -0
- package/data-structures/index.d.ts +2 -0
- package/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/data-structures/merkle-tree/MerkleTree.d.ts +6 -1
- package/data-structures/merkle-tree/MerkleTree.mjs +79 -65
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs +1 -0
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.ts +3 -0
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs +13 -0
- package/data-structures/merkle-tree/index.d.ts +1 -0
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +2 -0
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +3 -2
- package/data-structures/snapshot/ClientApprovalsSnapshotService.cjs +1 -0
- package/data-structures/snapshot/ClientApprovalsSnapshotService.d.ts +8 -0
- package/data-structures/snapshot/ClientApprovalsSnapshotService.mjs +23 -0
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +3 -2
- package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +6 -5
- package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
- package/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -0
- package/data-structures/token-price-fetcher/TokenChecker.mjs +4 -2
- package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
- package/data-structures/transactions-manager/TransactionsManager.d.ts +8 -6
- package/data-structures/transactions-manager/TransactionsManager.mjs +124 -122
- package/data-structures/transactions-manager/history/getBeefyData.cjs +1 -1
- package/data-structures/transactions-manager/history/getBeefyData.mjs +3 -2
- package/data-structures/transactions-manager/history/getConvexData.cjs +1 -1
- package/data-structures/transactions-manager/history/getConvexData.mjs +3 -2
- package/data-structures/transactions-manager/history/getCurveData.cjs +1 -1
- package/data-structures/transactions-manager/history/getCurveData.mjs +3 -2
- package/data-structures/transactions-manager/history/getLidoData.cjs +1 -1
- package/data-structures/transactions-manager/history/getLidoData.mjs +3 -2
- package/data-structures/transactions-manager/history/getPendleData.cjs +1 -1
- package/data-structures/transactions-manager/history/getPendleData.mjs +13 -12
- package/data-structures/transactions-manager/history/getTxDetails.cjs +1 -1
- package/data-structures/transactions-manager/history/getTxDetails.mjs +22 -20
- package/data-structures/transactions-manager/history/getVolatileData.cjs +1 -1
- package/data-structures/transactions-manager/history/getVolatileData.mjs +11 -10
- package/data-structures/transactions-manager/history/history.types.cjs +1 -1
- package/data-structures/transactions-manager/history/history.types.mjs +4 -2
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +3 -3
- package/data-structures/utxo/Utxo.mjs +8 -7
- package/error-handling/error-codes.constants.cjs +2 -2
- package/error-handling/error-codes.constants.d.ts +22 -1
- package/error-handling/error-codes.constants.mjs +129 -112
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +29 -25
- package/error-handling/index.d.ts +1 -0
- package/error-handling/logger.cjs +1 -0
- package/error-handling/logger.d.ts +5 -0
- package/error-handling/logger.mjs +16 -0
- package/error-handling/types.cjs +1 -1
- package/error-handling/types.d.ts +3 -1
- package/error-handling/types.mjs +2 -2
- package/externalABIs/BabPassport.json.cjs +1 -1
- package/externalABIs/BabPassport.json.mjs +8 -3
- package/externalABIs/BeefyRouterAbi.json.cjs +1 -1
- package/externalABIs/BeefyRouterAbi.json.mjs +5 -2
- package/externalABIs/BeefyStrategyAbi.json.cjs +1 -1
- package/externalABIs/BeefyStrategyAbi.json.mjs +5 -2
- package/externalABIs/BeefyVaultAbi.json.cjs +1 -1
- package/externalABIs/BeefyVaultAbi.json.mjs +5 -2
- package/externalABIs/BeefyZapAbi.json.cjs +1 -1
- package/externalABIs/BeefyZapAbi.json.mjs +5 -2
- package/externalABIs/BeefyZapOneInchAbi.json.cjs +1 -1
- package/externalABIs/BeefyZapOneInchAbi.json.mjs +5 -2
- package/externalABIs/ConvexBoosterAbi.json.cjs +1 -1
- package/externalABIs/ConvexBoosterAbi.json.mjs +5 -2
- package/externalABIs/ConvexBoosterAbiMainnet.json.cjs +1 -1
- package/externalABIs/ConvexBoosterAbiMainnet.json.mjs +5 -2
- package/externalABIs/ConvexRewardPoolAbi.json.cjs +1 -1
- package/externalABIs/ConvexRewardPoolAbi.json.mjs +5 -2
- package/externalABIs/CurveReadingWrapperAbi.json.cjs +1 -1
- package/externalABIs/CurveReadingWrapperAbi.json.mjs +5 -2
- package/externalABIs/CurveWrappedMainPool.json.cjs +1 -1
- package/externalABIs/CurveWrappedMainPool.json.mjs +5 -2
- package/externalABIs/CurveZap.json.cjs +1 -1
- package/externalABIs/CurveZap.json.mjs +5 -2
- package/externalABIs/CvxCrvUtilities.json.cjs +1 -1
- package/externalABIs/CvxCrvUtilities.json.mjs +5 -2
- package/externalABIs/ERC20.json.cjs +1 -1
- package/externalABIs/ERC20.json.mjs +20 -3
- package/externalABIs/GalxePassport.json.cjs +1 -1
- package/externalABIs/GalxePassport.json.mjs +8 -3
- package/externalABIs/IQuoterV2.json.cjs +1 -1
- package/externalABIs/IQuoterV2.json.mjs +20 -3
- package/externalABIs/ISwapRouter.json.cjs +1 -1
- package/externalABIs/ISwapRouter.json.mjs +5 -2
- package/externalABIs/IUniswapV3Factory.json.cjs +1 -1
- package/externalABIs/IUniswapV3Factory.json.mjs +20 -3
- package/externalABIs/IUniswapV3Pool.json.cjs +1 -1
- package/externalABIs/IUniswapV3Pool.json.mjs +20 -3
- package/externalABIs/PendleRouterAbi.json.cjs +1 -1
- package/externalABIs/PendleRouterAbi.json.mjs +5 -2
- package/externalABIs/UniswapV2PoolAbi.json.cjs +1 -1
- package/externalABIs/UniswapV2PoolAbi.json.mjs +16 -3
- package/externalABIs/index.cjs +1 -0
- package/externalABIs/index.d.ts +307 -11
- package/externalABIs/index.mjs +23 -0
- package/externalABIs/transactionsProver.json.cjs +1 -1
- package/externalABIs/transactionsProver.json.mjs +20 -3
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.d.ts +0 -1
- package/functions/kyc/zkMeHelper.mjs +8 -11
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -0
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +3 -0
- package/functions/pre-transaction/getExternalSwapAddress.mjs +26 -0
- package/functions/pre-transaction/getFeeStructure.cjs +1 -0
- package/functions/pre-transaction/getFeeStructure.d.ts +4 -0
- package/functions/pre-transaction/getFeeStructure.mjs +30 -0
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.d.ts +3 -7
- package/functions/pre-transaction/getFlatFees.mjs +52 -46
- package/functions/pre-transaction/getSignatureDataForTransact.cjs +1 -0
- package/functions/pre-transaction/getSignatureDataForTransact.d.ts +3 -0
- package/functions/pre-transaction/getSignatureDataForTransact.mjs +6 -0
- package/functions/pre-transaction/index.d.ts +1 -0
- package/functions/pre-transaction/interaction-to-action.cjs +1 -1
- package/functions/pre-transaction/interaction-to-action.mjs +3 -2
- package/functions/pre-transaction/merge-with-fee-structure.cjs +1 -0
- package/functions/pre-transaction/merge-with-fee-structure.d.ts +2 -0
- package/functions/pre-transaction/merge-with-fee-structure.mjs +25 -0
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -0
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +16 -0
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +42 -0
- package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.mjs +19 -30
- package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
- package/functions/pre-transaction/process-gas-estimates.d.ts +2 -2
- package/functions/pre-transaction/process-gas-estimates.mjs +17 -27
- package/functions/pre-transaction/processAmountChanges.cjs +1 -1
- package/functions/pre-transaction/processAmountChanges.mjs +34 -23
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -0
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +6 -0
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +7 -0
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +9 -1
- package/functions/private-wallet/emporium.helpers.mjs +117 -22
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -0
- package/functions/private-wallet/emporium.swap.helpers.d.ts +5 -0
- package/functions/private-wallet/emporium.swap.helpers.mjs +92 -0
- package/functions/private-wallet/index.d.ts +1 -0
- package/functions/private-wallet/opProducer.cjs +1 -1
- package/functions/private-wallet/opProducer.mjs +9 -10
- package/functions/private-wallet/smartContractWalletCalculator.cjs +1 -1
- package/functions/private-wallet/smartContractWalletCalculator.d.ts +5 -1
- package/functions/private-wallet/smartContractWalletCalculator.mjs +22 -17
- package/functions/protocols/convex.protocols.cjs +1 -1
- package/functions/protocols/convex.protocols.mjs +11 -8
- package/functions/protocols/pendle.helpers.cjs +1 -1
- package/functions/protocols/pendle.helpers.mjs +20 -15
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.d.ts +8 -5
- package/functions/snarkjs/common.snarkjs.mjs +177 -87
- package/functions/snarkjs/constant.cjs +1 -1
- package/functions/snarkjs/constant.d.ts +223 -1
- package/functions/snarkjs/constant.mjs +315 -94
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.d.ts +6 -3
- package/functions/snarkjs/constructEmporiumProof.mjs +148 -84
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +5 -3
- package/functions/snarkjs/constructGeneralZkProof.mjs +142 -86
- package/functions/snarkjs/generateCircomData.cjs +1 -1
- package/functions/snarkjs/generateCircomData.d.ts +3 -2
- package/functions/snarkjs/generateCircomData.mjs +33 -35
- package/functions/snarkjs/generateZkProof.cjs +1 -1
- package/functions/snarkjs/generateZkProof.d.ts +2 -2
- package/functions/snarkjs/generateZkProof.mjs +4 -15
- package/functions/snarkjs/generateZkProofEnclave.cjs +1 -0
- package/functions/snarkjs/generateZkProofEnclave.d.ts +6 -0
- package/functions/snarkjs/generateZkProofEnclave.mjs +26 -0
- package/functions/snarkjs/generateZkProofSelf.cjs +1 -0
- package/functions/snarkjs/generateZkProofSelf.d.ts +5 -0
- package/functions/snarkjs/generateZkProofSelf.mjs +17 -0
- package/functions/snarkjs/getOriginalSender.cjs +1 -0
- package/functions/snarkjs/getOriginalSender.d.ts +1 -0
- package/functions/snarkjs/getOriginalSender.mjs +5 -0
- package/functions/snarkjs/getZKFiles.cjs +1 -1
- package/functions/snarkjs/getZKFiles.d.ts +3 -2
- package/functions/snarkjs/getZKFiles.mjs +14 -5
- package/functions/utils/addresses.cjs +1 -0
- package/functions/utils/addresses.d.ts +4 -0
- package/functions/utils/addresses.mjs +20 -0
- package/functions/utils/amounts.utils.cjs +1 -1
- package/functions/utils/amounts.utils.d.ts +4 -1
- package/functions/utils/amounts.utils.mjs +29 -27
- package/functions/utils/arraysMatch.cjs +1 -0
- package/functions/utils/arraysMatch.d.ts +1 -0
- package/functions/utils/arraysMatch.mjs +4 -0
- package/functions/utils/axelar.utils.cjs +1 -1
- package/functions/utils/axelar.utils.d.ts +1 -0
- package/functions/utils/axelar.utils.mjs +32 -9
- package/functions/utils/cacheDevice.utils.cjs +1 -1
- package/functions/utils/cacheDevice.utils.mjs +11 -8
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.d.ts +10 -7
- package/functions/utils/cacheFunctions.mjs +62 -39
- package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -0
- package/functions/utils/convertEmporiumOpToCallInfo.d.ts +2 -0
- package/functions/utils/convertEmporiumOpToCallInfo.mjs +10 -0
- package/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/functions/utils/convertIntegrationProviderToExternalActionId.d.ts +2 -1
- package/functions/utils/convertIntegrationProviderToExternalActionId.mjs +7 -10
- package/functions/utils/encodeTokenWithId.cjs +1 -0
- package/functions/utils/encodeTokenWithId.d.ts +2 -0
- package/functions/utils/encodeTokenWithId.mjs +4 -0
- package/functions/utils/encryptInputForEnclave.cjs +1 -0
- package/functions/utils/encryptInputForEnclave.d.ts +8 -0
- package/functions/utils/encryptInputForEnclave.mjs +43 -0
- package/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/functions/utils/erc20tokenFunctions.d.ts +8 -2
- package/functions/utils/erc20tokenFunctions.mjs +23 -14
- package/functions/utils/evmNetworkFunctions.cjs +1 -1
- package/functions/utils/evmNetworkFunctions.mjs +7 -4
- package/functions/utils/external-action.utils.d.ts +2 -2
- package/functions/utils/fees.utils.cjs +1 -0
- package/functions/utils/fees.utils.d.ts +2 -0
- package/functions/utils/fees.utils.mjs +14 -0
- package/functions/utils/getBlockExplorerUrl.cjs +1 -0
- package/functions/utils/getBlockExplorerUrl.d.ts +1 -0
- package/functions/utils/getBlockExplorerUrl.mjs +6 -0
- package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -0
- package/functions/utils/getRecipientInfoFromUserKeys.d.ts +3 -0
- package/functions/utils/getRecipientInfoFromUserKeys.mjs +18 -0
- package/functions/utils/index.d.ts +12 -0
- package/functions/utils/involves-permit2-op.cjs +1 -0
- package/functions/utils/involves-permit2-op.d.ts +1 -0
- package/functions/utils/involves-permit2-op.mjs +5 -0
- package/functions/utils/merkleTree.utils.cjs +1 -0
- package/functions/utils/merkleTree.utils.d.ts +2 -0
- package/functions/utils/merkleTree.utils.mjs +19 -0
- package/functions/utils/prepareHinkal.d.ts +6 -0
- package/functions/utils/processUseApprovalUtxoData.cjs +1 -0
- package/functions/utils/processUseApprovalUtxoData.d.ts +3 -0
- package/functions/utils/processUseApprovalUtxoData.mjs +19 -0
- package/functions/utils/publicBalance.utils.cjs +1 -0
- package/functions/utils/publicBalance.utils.d.ts +5 -0
- package/functions/utils/publicBalance.utils.mjs +25 -0
- package/functions/utils/replaceAddressInCalldata.cjs +1 -0
- package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
- package/functions/utils/replaceAddressInCalldata.mjs +7 -0
- package/functions/utils/rpc-int-encode.cjs +1 -0
- package/functions/utils/rpc-int-encode.d.ts +2 -0
- package/functions/utils/rpc-int-encode.mjs +8 -0
- package/functions/utils/serialize.utils.cjs +1 -1
- package/functions/utils/serialize.utils.d.ts +1 -0
- package/functions/utils/serialize.utils.mjs +3 -2
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +2 -0
- package/functions/utils/string.utils.mjs +28 -14
- package/functions/utils/time.utils.cjs +1 -1
- package/functions/utils/time.utils.d.ts +1 -0
- package/functions/utils/time.utils.mjs +4 -3
- package/functions/utils/token-check.utils.cjs +1 -0
- package/functions/utils/token-check.utils.d.ts +1 -0
- package/functions/utils/token-check.utils.mjs +10 -0
- package/functions/utils/upToDateState.cjs +1 -0
- package/functions/utils/upToDateState.d.ts +2 -0
- package/functions/utils/upToDateState.mjs +11 -0
- package/functions/utils/userAgent.cjs +1 -1
- package/functions/utils/userAgent.mjs +8 -8
- package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -0
- package/functions/web3/events/balanceChangedCustomHandler.d.ts +2 -0
- package/functions/web3/events/balanceChangedCustomHandler.mjs +14 -0
- package/functions/web3/events/balanceChangedHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedHandler.mjs +5 -4
- package/functions/web3/events/getApprovedBalance.cjs +1 -0
- package/functions/web3/events/getApprovedBalance.d.ts +7 -0
- package/functions/web3/events/getApprovedBalance.mjs +80 -0
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +16 -3
- package/functions/web3/events/getInputUtxoAndBalance.mjs +128 -46
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +70 -65
- package/functions/web3/events/index.d.ts +2 -0
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +2 -2
- package/functions/web3/functionCalls/accessTokenCalls.mjs +20 -18
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +8 -7
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -0
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +4 -0
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +11 -0
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -2
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +14 -8
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +32 -0
- package/functions/web3/functionCalls/relayFunctions.d.ts +1 -15
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +2 -2
- package/functions/web3/functionCalls/transactCallDirect.mjs +31 -30
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
- package/functions/web3/functionCalls/transactCallRelayer.mjs +32 -9
- package/functions/web3/getContractMetadata.cjs +1 -0
- package/functions/web3/getContractMetadata.d.ts +5 -0
- package/functions/web3/getContractMetadata.mjs +30 -0
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.d.ts +1 -2
- package/functions/web3/odosAPI.mjs +23 -19
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.d.ts +1 -2
- package/functions/web3/oneInchAPI.mjs +20 -15
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +3 -2
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.d.ts +4 -4
- package/functions/web3/uniswapAPI.mjs +57 -43
- package/index.cjs +1 -1
- package/index.mjs +761 -639
- package/package.json +19 -8
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +8 -3
- package/providers/EthersProviderAdapter.mjs +52 -43
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +4 -1
- package/providers/WagmiProviderAdapter.mjs +53 -56
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +18 -10
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +18 -10
- package/types/API.types.d.ts +21 -0
- package/types/ICacheDevice.d.ts +4 -3
- package/types/TransactionSimulator.types.d.ts +9 -0
- package/types/activities.types.cjs +1 -0
- package/types/activities.types.d.ts +45 -0
- package/types/activities.types.mjs +13 -0
- package/types/balances.types.cjs +1 -0
- package/types/balances.types.d.ts +17 -0
- package/types/balances.types.mjs +4 -0
- package/types/cache.types.cjs +1 -0
- package/types/cache.types.d.ts +27 -0
- package/types/cache.types.mjs +4 -0
- package/types/circom-data.types.d.ts +29 -9
- package/types/commitments.types.d.ts +6 -0
- package/types/contacts.types.d.ts +5 -0
- package/types/crypto.types.d.ts +1 -0
- package/types/earlyAccessCode.types.d.ts +4 -0
- package/types/ethereum-network.types.cjs +1 -1
- package/types/ethereum-network.types.d.ts +8 -3
- package/types/ethereum-network.types.mjs +1 -1
- package/types/external-action.types.cjs +1 -1
- package/types/external-action.types.d.ts +2 -1
- package/types/external-action.types.mjs +1 -1
- package/types/fee.types.d.ts +9 -0
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +48 -0
- package/types/hinkal.types.mjs +38 -13
- package/types/index.d.ts +9 -0
- package/types/kyc.types.cjs +1 -1
- package/types/kyc.types.d.ts +1 -1
- package/types/kyc.types.mjs +1 -1
- package/types/remote-proof.types.d.ts +15 -0
- package/types/rewards.types.d.ts +9 -0
- package/types/sandbox.types.cjs +1 -0
- package/types/sandbox.types.d.ts +157 -0
- package/types/sandbox.types.mjs +4 -0
- package/types/tenderly.api.types.d.ts +180 -0
- package/types/time.types.cjs +1 -1
- package/types/time.types.mjs +1 -1
- package/types/token-with-id.types.d.ts +4 -0
- package/types/token.types.d.ts +23 -0
- package/types/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +31 -0
- package/types/transactions.types.mjs +8 -5
- package/types/wc.types.d.ts +89 -0
- package/types/with-id.types.d.ts +3 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +26 -26
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +58 -50
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/workerFactory.cjs +1 -1
- package/webworker/workerFactory.mjs +2 -2
- package/webworker/workerProxy.cjs +1 -1
- package/webworker/workerProxy.d.ts +11 -11
- package/webworker/workerProxy.mjs +24 -26
- package/webworker/zkProofWorker/zkProofWorker.types.d.ts +2 -0
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.mjs +47 -61
- package/functions/utils/memoize.utils.cjs +0 -1
- package/functions/utils/memoize.utils.mjs +0 -14
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { contractMetadataMapping as s } from "../../constants/contracts.constants.mjs";
|
|
2
|
+
import { networkRegistry as a } from "../../constants/chains.constants.mjs";
|
|
3
|
+
import { transactionErrorCodes as i } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import { ethers as c } from "ethers";
|
|
5
|
+
const d = (r, e) => {
|
|
6
|
+
const t = a[e];
|
|
7
|
+
if (!t)
|
|
8
|
+
throw new Error(i.UNSUPPORTED_NETWORK);
|
|
9
|
+
const o = s[r];
|
|
10
|
+
if (!o)
|
|
11
|
+
throw new Error(`Unsupported contractType: ${r}`);
|
|
12
|
+
return o(t.contractData);
|
|
13
|
+
}, f = (r, e, t) => {
|
|
14
|
+
const o = d(r, e);
|
|
15
|
+
if (!o.abi)
|
|
16
|
+
throw new Error(`No ABI configured for contractType: ${r}`);
|
|
17
|
+
if (o.address && t)
|
|
18
|
+
throw new Error(`Overriding address is not supported for contractType: ${r}`);
|
|
19
|
+
const n = o.address ?? t;
|
|
20
|
+
if (!n)
|
|
21
|
+
throw new Error(`No contractAddress configured for contractType: ${r}`);
|
|
22
|
+
return new c.Contract(n, o.abi);
|
|
23
|
+
}, m = (r, e, t = void 0) => f(e, r, t).connect(
|
|
24
|
+
new c.providers.StaticJsonRpcProvider(a[r].fetchRpcUrl)
|
|
25
|
+
);
|
|
26
|
+
export {
|
|
27
|
+
f as getContract,
|
|
28
|
+
d as getContractMetadata,
|
|
29
|
+
m as getContractWithFetcherByChainId
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../API/callOdosAPI.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../API/callOdosAPI.cjs");require("../../constants/token-data/index.cjs");const n=require("../../constants/chains.constants.cjs"),a=require("../../constants/protocol.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");const d=require("../../error-handling/error-codes.constants.cjs"),q=require("./etherFunctions.cjs");require("axios");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const l=async(r,e,t,u)=>{try{const o={chainId:r!==31337?r:n.localhostNetwork,inputTokens:[{tokenAddress:e?.wrappedErc20TokenAddress??e.erc20TokenAddress,amount:q.getAmountInWei(e,u).toString()}],outputTokens:[{tokenAddress:t?.wrappedErc20TokenAddress??t.erc20TokenAddress,proportion:1}],userAddr:n.networkRegistry[r].contractData.odosExternalActionInstanceAddress||a.zeroAddress,slippageLimitPercent:10,disableRFQs:!0},{odosResponse:s,status:i}=await c.callOdosAPI(r,o);if(i!=="success")throw Error("Odos API Fetch Error");return{outSwapAmountValue:BigInt(s.outputTokens[0].amount),odosDataValue:s.transaction.data}}catch(o){throw console.log({error:o}),Error(d.transactionErrorCodes.NO_ODOS_PRICE)}};exports.getOdosPrice=l;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IHinkal } from '../../data-structures';
|
|
2
1
|
import { ERC20Token } from '../../types';
|
|
3
|
-
export declare const getOdosPrice: (
|
|
2
|
+
export declare const getOdosPrice: (chainId: number, inSwapToken: ERC20Token, outSwapToken: ERC20Token, inSwapAmount: string) => Promise<{
|
|
4
3
|
outSwapAmountValue: bigint;
|
|
5
4
|
odosDataValue: string;
|
|
6
5
|
}>;
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
import { callOdosAPI as
|
|
2
|
-
import
|
|
1
|
+
import { callOdosAPI as m } from "../../API/callOdosAPI.mjs";
|
|
2
|
+
import "../../constants/token-data/index.mjs";
|
|
3
|
+
import { localhostNetwork as n, networkRegistry as d } from "../../constants/chains.constants.mjs";
|
|
4
|
+
import { zeroAddress as a } from "../../constants/protocol.constants.mjs";
|
|
3
5
|
import "../../constants/vite.constants.mjs";
|
|
4
6
|
import "../../constants/contracts.constants.mjs";
|
|
5
7
|
import "../../constants/kyc.constants.mjs";
|
|
6
|
-
import { zeroAddress as a } from "../../constants/protocol.constants.mjs";
|
|
7
8
|
import "../../constants/coingecko.constants.mjs";
|
|
8
9
|
import "../../constants/axelar.constants.mjs";
|
|
9
10
|
import "../../constants/rewards.constants.mjs";
|
|
10
11
|
import "../../constants/reorg-depths.constants.mjs";
|
|
12
|
+
import "../../constants/addresses.constants.mjs";
|
|
13
|
+
import "../../constants/token.limits.constants.mjs";
|
|
11
14
|
import { transactionErrorCodes as c } from "../../error-handling/error-codes.constants.mjs";
|
|
12
15
|
import { getAmountInWei as u } from "./etherFunctions.mjs";
|
|
13
16
|
import "axios";
|
|
14
17
|
import "../../types/circom-data.types.mjs";
|
|
15
18
|
import "../../types/transactions.types.mjs";
|
|
16
19
|
import "../../types/curve.types.mjs";
|
|
20
|
+
import "../../types/activities.types.mjs";
|
|
17
21
|
import "ethers";
|
|
18
22
|
import "circomlibjs-hinkal-fork";
|
|
19
23
|
import "libsodium-wrappers";
|
|
20
24
|
import "process";
|
|
21
25
|
import "buffer";
|
|
22
|
-
const
|
|
26
|
+
const Q = async (r, o, s, i) => {
|
|
23
27
|
try {
|
|
24
|
-
const
|
|
25
|
-
chainId: r
|
|
28
|
+
const t = {
|
|
29
|
+
chainId: r !== 31337 ? r : n,
|
|
26
30
|
inputTokens: [
|
|
27
31
|
{
|
|
28
|
-
tokenAddress:
|
|
29
|
-
amount: u(
|
|
32
|
+
tokenAddress: o?.wrappedErc20TokenAddress ?? o.erc20TokenAddress,
|
|
33
|
+
amount: u(o, i).toString()
|
|
30
34
|
}
|
|
31
35
|
],
|
|
32
36
|
outputTokens: [
|
|
33
37
|
{
|
|
34
|
-
tokenAddress:
|
|
38
|
+
tokenAddress: s?.wrappedErc20TokenAddress ?? s.erc20TokenAddress,
|
|
35
39
|
proportion: 1
|
|
36
40
|
}
|
|
37
41
|
],
|
|
38
|
-
userAddr:
|
|
42
|
+
userAddr: d[r].contractData.odosExternalActionInstanceAddress || a,
|
|
39
43
|
slippageLimitPercent: 10,
|
|
40
44
|
disableRFQs: !0
|
|
41
45
|
// sometimes swap fails because of RFQs
|
|
42
|
-
}, { odosResponse:
|
|
43
|
-
r
|
|
44
|
-
|
|
46
|
+
}, { odosResponse: e, status: p } = await m(
|
|
47
|
+
r,
|
|
48
|
+
t
|
|
45
49
|
);
|
|
46
|
-
if (
|
|
50
|
+
if (p !== "success")
|
|
47
51
|
throw Error("Odos API Fetch Error");
|
|
48
52
|
return {
|
|
49
|
-
outSwapAmountValue: BigInt(
|
|
50
|
-
odosDataValue:
|
|
53
|
+
outSwapAmountValue: BigInt(e.outputTokens[0].amount),
|
|
54
|
+
odosDataValue: e.transaction.data
|
|
51
55
|
};
|
|
52
|
-
} catch (
|
|
53
|
-
throw console.log({ error:
|
|
56
|
+
} catch (t) {
|
|
57
|
+
throw console.log({ error: t }), Error(c.NO_ODOS_PRICE);
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
export {
|
|
57
|
-
|
|
61
|
+
Q as getOdosPrice
|
|
58
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../API/callOneInchAPI.cjs");require("../../constants/chains.constants.cjs");require("../../constants/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../API/callOneInchAPI.cjs");require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");const e=require("../../constants/protocol.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");const u=require("../../error-handling/error-codes.constants.cjs"),a=require("./etherFunctions.cjs");require("axios");require("../../types/circom-data.types.cjs");const d=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const q=require("./getContractMetadata.cjs"),l=async(s,t,n,c)=>{try{const o={fromTokenAddress:t.erc20TokenAddress!==e.zeroAddress?t.erc20TokenAddress:e.oneInchZeroAddress,toTokenAddress:n.erc20TokenAddress!==e.zeroAddress?n.erc20TokenAddress:e.oneInchZeroAddress,fromAddress:e.zeroAddress,destReceiver:q.getContractMetadata(d.ContractType.OneInchExternalActionContract,s).address,amount:a.getAmountInWei(t,c),slippage:10,disableEstimate:!0,allowPartialFill:!1},r=await i.callOneInchAPI(s,o);if(!r||!r.tx)throw Error("OneInch API price fetch error");return{outSwapAmountValue:BigInt(r.toAmount),oneInchDataValue:r.tx.data}}catch(o){throw console.log({error:o}),Error(u.transactionErrorCodes.NO_ONEINCH_PRICE)}};exports.getOneInchPrice=l;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
2
1
|
import { ERC20Token } from '../../types';
|
|
3
|
-
export declare const getOneInchPrice: (
|
|
2
|
+
export declare const getOneInchPrice: (chainId: number, inSwapToken: ERC20Token, outSwapToken: ERC20Token, inSwapAmount: string) => Promise<{
|
|
4
3
|
outSwapAmountValue: bigint;
|
|
5
4
|
oneInchDataValue: string;
|
|
6
5
|
}>;
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import { callOneInchAPI as
|
|
1
|
+
import { callOneInchAPI as p } from "../../API/callOneInchAPI.mjs";
|
|
2
|
+
import "../../constants/token-data/index.mjs";
|
|
2
3
|
import "../../constants/chains.constants.mjs";
|
|
4
|
+
import { zeroAddress as e, oneInchZeroAddress as s } from "../../constants/protocol.constants.mjs";
|
|
3
5
|
import "../../constants/vite.constants.mjs";
|
|
4
6
|
import "../../constants/contracts.constants.mjs";
|
|
5
7
|
import "../../constants/kyc.constants.mjs";
|
|
6
|
-
import { zeroAddress as e, oneInchZeroAddress as m } from "../../constants/protocol.constants.mjs";
|
|
7
8
|
import "../../constants/coingecko.constants.mjs";
|
|
8
9
|
import "../../constants/axelar.constants.mjs";
|
|
9
10
|
import "../../constants/rewards.constants.mjs";
|
|
10
11
|
import "../../constants/reorg-depths.constants.mjs";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
12
|
+
import "../../constants/addresses.constants.mjs";
|
|
13
|
+
import "../../constants/token.limits.constants.mjs";
|
|
14
|
+
import { transactionErrorCodes as a } from "../../error-handling/error-codes.constants.mjs";
|
|
15
|
+
import { getAmountInWei as c } from "./etherFunctions.mjs";
|
|
13
16
|
import "axios";
|
|
14
17
|
import "../../types/circom-data.types.mjs";
|
|
15
|
-
import { ContractType as
|
|
18
|
+
import { ContractType as d } from "../../types/ethereum-network.types.mjs";
|
|
16
19
|
import "../../types/transactions.types.mjs";
|
|
17
20
|
import "../../types/curve.types.mjs";
|
|
21
|
+
import "../../types/activities.types.mjs";
|
|
18
22
|
import "ethers";
|
|
19
23
|
import "circomlibjs-hinkal-fork";
|
|
20
24
|
import "libsodium-wrappers";
|
|
21
25
|
import "process";
|
|
22
26
|
import "buffer";
|
|
23
|
-
|
|
27
|
+
import { getContractMetadata as l } from "./getContractMetadata.mjs";
|
|
28
|
+
const M = async (m, o, i, n) => {
|
|
24
29
|
try {
|
|
25
|
-
const
|
|
26
|
-
fromTokenAddress:
|
|
27
|
-
toTokenAddress: i.erc20TokenAddress !== e ? i.erc20TokenAddress :
|
|
30
|
+
const t = {
|
|
31
|
+
fromTokenAddress: o.erc20TokenAddress !== e ? o.erc20TokenAddress : s,
|
|
32
|
+
toTokenAddress: i.erc20TokenAddress !== e ? i.erc20TokenAddress : s,
|
|
28
33
|
fromAddress: e,
|
|
29
34
|
// we user zero address here because this paramater is not relevant to us, only destReceiver is
|
|
30
|
-
destReceiver:
|
|
31
|
-
amount:
|
|
35
|
+
destReceiver: l(d.OneInchExternalActionContract, m).address,
|
|
36
|
+
amount: c(o, n),
|
|
32
37
|
slippage: 10,
|
|
33
38
|
disableEstimate: !0,
|
|
34
39
|
// disable gas estimation, we don't need it
|
|
@@ -37,7 +42,7 @@ const v = async (s, t, i, n) => {
|
|
|
37
42
|
// and returning leftover tokens to fromAddress
|
|
38
43
|
// this is not what we want
|
|
39
44
|
allowPartialFill: !1
|
|
40
|
-
}, r = await
|
|
45
|
+
}, r = await p(m, t);
|
|
41
46
|
if (!r || !r.tx)
|
|
42
47
|
throw Error("OneInch API price fetch error");
|
|
43
48
|
return {
|
|
@@ -45,10 +50,10 @@ const v = async (s, t, i, n) => {
|
|
|
45
50
|
oneInchDataValue: r.tx.data
|
|
46
51
|
// calldata to use
|
|
47
52
|
};
|
|
48
|
-
} catch (
|
|
49
|
-
throw console.log({ error:
|
|
53
|
+
} catch (t) {
|
|
54
|
+
throw console.log({ error: t }), Error(a.NO_ONEINCH_PRICE);
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
export {
|
|
53
|
-
|
|
58
|
+
M as getOneInchPrice
|
|
54
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../error-handling/error-codes.constants.cjs");require("ethers");const m=require("../../error-handling/get-error.message.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../error-handling/error-codes.constants.cjs");require("ethers");const m=require("../../error-handling/get-error.message.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");const q=5e4,l=1,d=11,w=15,g=async(t,s)=>{try{const r=await t.getFeeData(),a=s===0?d:w;return r.gasPrice?.mul(a).div(10)??void 0}catch(r){console.log("getGasPrice error: ",{err:r});return}},P=(t,s,r)=>new Promise((a,o)=>{const i=setTimeout(()=>{o(new Error(c.transactionErrorCodes.TRANSACTION_TIMEOUT))},r);t.wait(s).then(e=>{clearTimeout(i),a(e)}).catch(e=>{clearTimeout(i),o(e)})}),T=async({contractFunction:t,args:s,gasPrice:r,gasLimit:a,nonce:o,confirmations:i,waitTime:e})=>{const n=await t(...s,{type:0,gasLimit:a,gasPrice:r,nonce:o});return await P(n,i??l,e??q)},E=async({provider:t,contractFunction:s,args:r,gasLimit:a,nonce:o,confirmations:i})=>{try{const e=await g(t,0);return await T({contractFunction:s,args:r,gasPrice:e,gasLimit:a,nonce:o,confirmations:i})}catch(e){const n=m.getErrorMessage(e);if(n===c.UserFriendlyErrorCodes.MAX_FEE_GAS_ERROR||n===c.transactionErrorCodes.TRANSACTION_TIMEOUT){console.log("Timeout Hit: Increase gas");const u=await g(t,1);return await T({contractFunction:s,args:r,gasPrice:u,gasLimit:a,nonce:o,confirmations:i})}throw e}};exports.runContractFunction=E;
|
|
@@ -7,6 +7,7 @@ import "../../constants/vite.constants.mjs";
|
|
|
7
7
|
import "../../types/circom-data.types.mjs";
|
|
8
8
|
import "../../types/transactions.types.mjs";
|
|
9
9
|
import "../../types/curve.types.mjs";
|
|
10
|
+
import "../../types/activities.types.mjs";
|
|
10
11
|
import "circomlibjs-hinkal-fork";
|
|
11
12
|
import "libsodium-wrappers";
|
|
12
13
|
import "process";
|
|
@@ -49,7 +50,7 @@ const w = 5e4, l = 1, P = 11, d = 15, m = async (o, e) => {
|
|
|
49
50
|
s ?? l,
|
|
50
51
|
r ?? w
|
|
51
52
|
);
|
|
52
|
-
},
|
|
53
|
+
}, v = async ({
|
|
53
54
|
provider: o,
|
|
54
55
|
contractFunction: e,
|
|
55
56
|
args: t,
|
|
@@ -79,5 +80,5 @@ const w = 5e4, l = 1, P = 11, d = 15, m = async (o, e) => {
|
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
export {
|
|
82
|
-
|
|
83
|
+
v as runContractFunction
|
|
83
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("ethers");require("../../constants/token-data/index.cjs");const u=require("../../constants/chains.constants.cjs"),C=require("../../constants/protocol.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");const l=require("../../error-handling/error-codes.constants.cjs"),P=require("./etherFunctions.cjs");require("axios");require("../../types/circom-data.types.cjs");const d=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const h=require("../../error-handling/logError.cjs"),q=async(s,t,c,r)=>{const o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await t.getPool(c,r,e),fee:e})))).filter(({poolAddress:e})=>e!==C.zeroAddress),n=await Promise.all(o.map(async e=>({poolAddress:e.poolAddress,fee:e.fee,token1Balance:(await s.balanceOf(e.poolAddress)).toBigInt()}))),i=n.map(e=>e.token1Balance).reduce((e,p)=>p>=e?p:e,0n);if(i===0n)throw new Error(l.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return n.find(e=>e.token1Balance===i)},w=async(s,t,c,r,o,n)=>{try{if(!u.networkRegistry[t].quoterV2Address)throw Error("No Quoter Contract Provided");return(await s.getContractWithFetcherByChainId(t,d.ContractType.UniswapV3QuoterContract,u.networkRegistry[t].quoterV2Address).callStatic.quoteExactInputSingle({tokenIn:c.wrappedErc20TokenAddress??c.erc20TokenAddress,tokenOut:r.wrappedErc20TokenAddress??r.erc20TokenAddress,fee:o,amountIn:n,sqrtPriceLimitX96:0})).amountOut.toBigInt()}catch(a){throw h.logError(a),a}},A=async(s,t,c,r)=>{try{const o=s.getContractWithFetcherByChainId(t,d.ContractType.UniswapV3FactoryContract,u.networkRegistry[t].uniswapV3FactoryAddress),n=s.getContractWithFetcherByChainId(t,d.ContractType.ERC20Contract,r.wrappedErc20TokenAddress??r.erc20TokenAddress),{fee:a}=await q(n,o,c.wrappedErc20TokenAddress??c.erc20TokenAddress,r.wrappedErc20TokenAddress??r.erc20TokenAddress);return a}catch(o){throw console.log("Error in getUniswapFee",o),o}},E=async(s,t,c,r,o)=>{try{const n=await A(s,t,r,o),a=g.utils.defaultAbiCoder.encode(["uint24"],[n]),i=P.getAmountInWei(r,c);return{tokenPrice:await w(s,t,r,o,n,i),poolFee:a}}catch{throw Error(l.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=A;exports.getUniswapPrice=E;exports.getUniswapPriceHelper=w;exports.searchPoolAndFee=q;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Contract } from 'ethers';
|
|
2
|
-
import { IHinkal } from '../../data-structures';
|
|
3
2
|
import { ERC20Token } from '../../types';
|
|
3
|
+
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
4
4
|
interface PoolAndFee {
|
|
5
5
|
poolAddress: string;
|
|
6
6
|
fee: number;
|
|
7
7
|
token1Balance: bigint;
|
|
8
8
|
}
|
|
9
9
|
export declare const searchPoolAndFee: (token1Contract: Contract, factory: Contract, token0Address: string, token1Address: string) => Promise<PoolAndFee>;
|
|
10
|
-
export declare const getUniswapPriceHelper: (hinkal: IHinkal, token0: ERC20Token, token1: ERC20Token, fee: number, inSwapAmount: bigint) => Promise<bigint>;
|
|
11
|
-
export declare const getUniswapFee: (hinkal: IHinkal, token0: ERC20Token, token1: ERC20Token) => Promise<number>;
|
|
12
|
-
export declare const getUniswapPrice: (hinkal: IHinkal, inSwapAmount: string, inSwapToken: ERC20Token, outSwapToken: ERC20Token) => Promise<{
|
|
10
|
+
export declare const getUniswapPriceHelper: (hinkal: IHinkal, chainId: number, token0: ERC20Token, token1: ERC20Token, fee: number, inSwapAmount: bigint) => Promise<bigint>;
|
|
11
|
+
export declare const getUniswapFee: (hinkal: IHinkal, chainId: number, token0: ERC20Token, token1: ERC20Token) => Promise<number>;
|
|
12
|
+
export declare const getUniswapPrice: (hinkal: IHinkal, chainId: number, inSwapAmount: string, inSwapToken: ERC20Token, outSwapToken: ERC20Token) => Promise<{
|
|
13
13
|
tokenPrice: bigint;
|
|
14
14
|
poolFee: string;
|
|
15
15
|
}>;
|
|
@@ -1,87 +1,101 @@
|
|
|
1
|
-
import { utils as
|
|
2
|
-
import
|
|
1
|
+
import { utils as A } from "ethers";
|
|
2
|
+
import "../../constants/token-data/index.mjs";
|
|
3
|
+
import { networkRegistry as p } from "../../constants/chains.constants.mjs";
|
|
4
|
+
import { zeroAddress as u } from "../../constants/protocol.constants.mjs";
|
|
3
5
|
import "../../constants/vite.constants.mjs";
|
|
4
6
|
import "../../constants/contracts.constants.mjs";
|
|
5
7
|
import "../../constants/kyc.constants.mjs";
|
|
6
|
-
import { zeroAddress as A } from "../../constants/protocol.constants.mjs";
|
|
7
8
|
import "../../constants/coingecko.constants.mjs";
|
|
8
9
|
import "../../constants/axelar.constants.mjs";
|
|
9
10
|
import "../../constants/rewards.constants.mjs";
|
|
10
11
|
import "../../constants/reorg-depths.constants.mjs";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
12
|
+
import "../../constants/addresses.constants.mjs";
|
|
13
|
+
import "../../constants/token.limits.constants.mjs";
|
|
14
|
+
import { transactionErrorCodes as l } from "../../error-handling/error-codes.constants.mjs";
|
|
15
|
+
import { getAmountInWei as f } from "./etherFunctions.mjs";
|
|
13
16
|
import "axios";
|
|
14
17
|
import "../../types/circom-data.types.mjs";
|
|
15
|
-
import { ContractType as
|
|
18
|
+
import { ContractType as d } from "../../types/ethereum-network.types.mjs";
|
|
16
19
|
import "../../types/transactions.types.mjs";
|
|
17
20
|
import "../../types/curve.types.mjs";
|
|
21
|
+
import "../../types/activities.types.mjs";
|
|
18
22
|
import "circomlibjs-hinkal-fork";
|
|
19
23
|
import "libsodium-wrappers";
|
|
20
24
|
import "process";
|
|
21
25
|
import "buffer";
|
|
22
|
-
import { logError as
|
|
23
|
-
const
|
|
24
|
-
const
|
|
26
|
+
import { logError as y } from "../../error-handling/logError.mjs";
|
|
27
|
+
const C = async (s, o, a, t) => {
|
|
28
|
+
const e = (await Promise.all(
|
|
25
29
|
[100, 500, 3e3, 1e4].map(async (r) => ({
|
|
26
|
-
poolAddress: await
|
|
30
|
+
poolAddress: await o.getPool(a, t, r),
|
|
27
31
|
fee: r
|
|
28
32
|
}))
|
|
29
|
-
)).filter(({ poolAddress: r }) => r !==
|
|
30
|
-
|
|
33
|
+
)).filter(({ poolAddress: r }) => r !== u), n = await Promise.all(
|
|
34
|
+
e.map(async (r) => ({
|
|
31
35
|
poolAddress: r.poolAddress,
|
|
32
36
|
fee: r.fee,
|
|
33
|
-
token1Balance: (await
|
|
37
|
+
token1Balance: (await s.balanceOf(r.poolAddress)).toBigInt()
|
|
34
38
|
}))
|
|
35
39
|
), i = n.map((r) => r.token1Balance).reduce((r, m) => m >= r ? m : r, 0n);
|
|
36
40
|
if (i === 0n)
|
|
37
|
-
throw new Error(
|
|
41
|
+
throw new Error(l.UNISWAP_NOT_ENOUGH_LIQUIDITY);
|
|
38
42
|
return n.find((r) => r.token1Balance === i);
|
|
39
|
-
}, g = async (
|
|
43
|
+
}, g = async (s, o, a, t, e, n) => {
|
|
40
44
|
try {
|
|
41
|
-
if (!
|
|
45
|
+
if (!p[o].quoterV2Address)
|
|
42
46
|
throw Error("No Quoter Contract Provided");
|
|
43
|
-
return (await
|
|
44
|
-
|
|
45
|
-
d
|
|
47
|
+
return (await s.getContractWithFetcherByChainId(
|
|
48
|
+
o,
|
|
49
|
+
d.UniswapV3QuoterContract,
|
|
50
|
+
p[o].quoterV2Address
|
|
46
51
|
).callStatic.quoteExactInputSingle({
|
|
47
|
-
tokenIn:
|
|
52
|
+
tokenIn: a.wrappedErc20TokenAddress ?? a.erc20TokenAddress,
|
|
48
53
|
tokenOut: t.wrappedErc20TokenAddress ?? t.erc20TokenAddress,
|
|
49
|
-
fee:
|
|
50
|
-
amountIn:
|
|
54
|
+
fee: e,
|
|
55
|
+
amountIn: n,
|
|
51
56
|
sqrtPriceLimitX96: 0
|
|
52
57
|
})).amountOut.toBigInt();
|
|
53
|
-
} catch (
|
|
54
|
-
throw
|
|
58
|
+
} catch (c) {
|
|
59
|
+
throw y(c), c;
|
|
55
60
|
}
|
|
56
|
-
},
|
|
61
|
+
}, E = async (s, o, a, t) => {
|
|
57
62
|
try {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
d
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
const e = s.getContractWithFetcherByChainId(
|
|
64
|
+
o,
|
|
65
|
+
d.UniswapV3FactoryContract,
|
|
66
|
+
p[o].uniswapV3FactoryAddress
|
|
67
|
+
), n = s.getContractWithFetcherByChainId(
|
|
68
|
+
o,
|
|
69
|
+
d.ERC20Contract,
|
|
63
70
|
t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
|
|
64
|
-
), { fee:
|
|
71
|
+
), { fee: c } = await C(
|
|
65
72
|
n,
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
e,
|
|
74
|
+
a.wrappedErc20TokenAddress ?? a.erc20TokenAddress,
|
|
68
75
|
t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
|
|
69
76
|
);
|
|
70
|
-
return
|
|
71
|
-
} catch (
|
|
72
|
-
throw console.log("Error in getUniswapFee",
|
|
77
|
+
return c;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
throw console.log("Error in getUniswapFee", e), e;
|
|
73
80
|
}
|
|
74
|
-
},
|
|
81
|
+
}, j = async (s, o, a, t, e) => {
|
|
75
82
|
try {
|
|
76
|
-
const
|
|
77
|
-
return { tokenPrice: await g(
|
|
83
|
+
const n = await E(s, o, t, e), c = A.defaultAbiCoder.encode(["uint24"], [n]), i = f(t, a);
|
|
84
|
+
return { tokenPrice: await g(
|
|
85
|
+
s,
|
|
86
|
+
o,
|
|
87
|
+
t,
|
|
88
|
+
e,
|
|
89
|
+
n,
|
|
90
|
+
i
|
|
91
|
+
), poolFee: c };
|
|
78
92
|
} catch {
|
|
79
|
-
throw Error(
|
|
93
|
+
throw Error(l.NO_UNISWAP_PRICE);
|
|
80
94
|
}
|
|
81
95
|
};
|
|
82
96
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
E as getUniswapFee,
|
|
98
|
+
j as getUniswapPrice,
|
|
85
99
|
g as getUniswapPriceHelper,
|
|
86
|
-
|
|
100
|
+
C as searchPoolAndFee
|
|
87
101
|
};
|