@hinkal/common 0.2.13 → 0.2.15
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/getRelayerURL.cjs +1 -1
- package/API/getRelayerURL.mjs +4 -4
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +1 -1
- package/API/getServerURL.mjs +14 -12
- 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 +14 -0
- package/API/tenderly.api.mjs +55 -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 +11 -11
- 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 +2 -2
- package/constants/chains.constants.mjs +32 -35
- 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 +10115 -3422
- package/constants/deploy-data/deploy-data-avalanche.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-avalanche.json.mjs +10112 -3415
- package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-base.json.mjs +9408 -3725
- package/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +9893 -3194
- package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +6318 -3587
- 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 +10113 -3422
- package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-polygon.json.mjs +10092 -3423
- 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 +8 -0
- package/constants/protocol.constants.mjs +29 -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 +34 -6
- package/constants/server.constants.mjs +48 -20
- 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 +350 -110
- package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistryFixed.json.mjs +334 -100
- package/constants/token-data/avalancheRegistry.json.cjs +1 -1
- package/constants/token-data/avalancheRegistry.json.mjs +236 -68
- package/constants/token-data/avalancheRegistryFixed.json.cjs +1 -1
- package/constants/token-data/avalancheRegistryFixed.json.mjs +236 -68
- package/constants/token-data/baseRegistry.json.cjs +1 -1
- package/constants/token-data/baseRegistry.json.mjs +224 -59
- package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
- package/constants/token-data/baseRegistryFixed.json.mjs +212 -56
- 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 +1017 -344
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +946 -303
- package/constants/token-data/index.cjs +1 -0
- package/constants/token-data/index.d.ts +1496 -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 +530 -155
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +504 -147
- 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 +7 -1
- package/constants/vite.constants.mjs +27 -22
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +48 -20
- package/data-structures/Hinkal/Hinkal.mjs +264 -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 +86 -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 +7 -2
- package/data-structures/merkle-tree/MerkleTree.mjs +85 -70
- 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 +20 -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/getTokenHolder.cjs +1 -0
- package/functions/web3/getTokenHolder.d.ts +1 -0
- package/functions/web3/getTokenHolder.mjs +12 -0
- package/functions/web3/index.d.ts +1 -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 +739 -609
- 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
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { MERKLE_LEVELS as a, CIRCOM_MERKLE_LENGTH as o } from "../../constants/protocol.constants.mjs";
|
|
2
|
+
import { logError as u } from "../../error-handling/logError.mjs";
|
|
3
|
+
import { MerkleTreeIncompleteError as c } from "./MerkleTreeIncompleteError.mjs";
|
|
4
|
+
class l {
|
|
5
|
+
constructor(t, e, r, i, s, n, h) {
|
|
6
|
+
this.hashFunction = t, this.levels = e, this.defaultNodeValue = r, this.tree = i ?? /* @__PURE__ */ new Map(), this.count = h ?? 0n, this.index = n ?? 2n ** (e - 1n), s ? this.reverseTree = s : this.reverseTree = this.createReverseTree();
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* the map where the items are stored
|
|
@@ -18,16 +19,25 @@ class h {
|
|
|
18
19
|
* meaning that there aren't any missing elements between getStartIndex() and index
|
|
19
20
|
*/
|
|
20
21
|
index;
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
reverseTree;
|
|
23
|
+
static createWithData(t, e, r, i, s, n, h) {
|
|
24
|
+
return new l(s, n, h, t, e, r, i);
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* @param hashFunction the hashFunction used to fill the upper layers of the merkle tree
|
|
26
28
|
* @param levels the amount of layers in the merkle tree
|
|
27
29
|
* @param defaultNodeValue the default value of an empty node in the merkle tree
|
|
28
30
|
*/
|
|
29
|
-
static create(
|
|
30
|
-
return new
|
|
31
|
+
static create(t, e, r = a) {
|
|
32
|
+
return new l(t, r, e);
|
|
33
|
+
}
|
|
34
|
+
createReverseTree() {
|
|
35
|
+
const t = /* @__PURE__ */ new Map();
|
|
36
|
+
for (let e = this.getStartIndex(); e < this.getStartIndex() + this.count; e += 1n) {
|
|
37
|
+
const r = this.tree.get(e);
|
|
38
|
+
r !== void 0 && t.set(r, e);
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
31
41
|
}
|
|
32
42
|
/**
|
|
33
43
|
* get starting nodeIndex from which inserts are allowed
|
|
@@ -38,28 +48,28 @@ class h {
|
|
|
38
48
|
/**
|
|
39
49
|
* implementation of logarithm2 function from merkle contract
|
|
40
50
|
*/
|
|
41
|
-
logarithm2(
|
|
42
|
-
let
|
|
43
|
-
for (; 2n **
|
|
44
|
-
|
|
45
|
-
return
|
|
51
|
+
logarithm2(t) {
|
|
52
|
+
let e = 0n;
|
|
53
|
+
for (; 2n ** e < t; )
|
|
54
|
+
e += 1n;
|
|
55
|
+
return e;
|
|
46
56
|
}
|
|
47
|
-
bigIntMax(
|
|
48
|
-
return
|
|
57
|
+
bigIntMax(t, e) {
|
|
58
|
+
return t > e ? t : e;
|
|
49
59
|
}
|
|
50
|
-
forceInsert(
|
|
51
|
-
if (
|
|
60
|
+
forceInsert(t, e) {
|
|
61
|
+
if (e < this.getStartIndex())
|
|
52
62
|
throw new RangeError();
|
|
53
|
-
this.tree.set(t, e);
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
for (let
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
this.tree.get(
|
|
60
|
-
this.tree.get(
|
|
63
|
+
this.tree.set(e, t), this.reverseTree.set(t, e);
|
|
64
|
+
const r = this.index - this.getStartIndex(), i = this.logarithm2(r);
|
|
65
|
+
let s = e;
|
|
66
|
+
for (let n = 1n; n <= i; n += 1n) {
|
|
67
|
+
s /= 2n;
|
|
68
|
+
const h = this.hashFunction(
|
|
69
|
+
this.tree.get(s * 2n) || this.defaultNodeValue,
|
|
70
|
+
this.tree.get(s * 2n + 1n) || this.defaultNodeValue
|
|
61
71
|
);
|
|
62
|
-
this.tree.set(
|
|
72
|
+
this.tree.set(s, h);
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
/**
|
|
@@ -69,16 +79,16 @@ class h {
|
|
|
69
79
|
* @return true - if added, false - if already exists
|
|
70
80
|
* @throws will throw RangeError if nodeIndex is less than getStartIndex()
|
|
71
81
|
*/
|
|
72
|
-
insert(
|
|
73
|
-
let
|
|
74
|
-
return this.tree.has(
|
|
82
|
+
insert(t, e) {
|
|
83
|
+
let r = !1;
|
|
84
|
+
return this.tree.has(e) && (r = !0, u(`Editing commitment index: ${e} `)), r || (this.count += 1n), this.index = this.bigIntMax(this.index, e + 1n), this.forceInsert(t, e), !0;
|
|
75
85
|
}
|
|
76
|
-
remove(
|
|
77
|
-
this.forceInsert(this.defaultNodeValue,
|
|
86
|
+
remove(t) {
|
|
87
|
+
this.forceInsert(this.defaultNodeValue, t);
|
|
78
88
|
}
|
|
79
89
|
completenessCheck() {
|
|
80
90
|
if (this.count !== this.index - this.getStartIndex())
|
|
81
|
-
throw new
|
|
91
|
+
throw new c();
|
|
82
92
|
}
|
|
83
93
|
/**
|
|
84
94
|
* get root hash of the merkle tree
|
|
@@ -87,67 +97,72 @@ class h {
|
|
|
87
97
|
*/
|
|
88
98
|
getRootHash() {
|
|
89
99
|
this.completenessCheck();
|
|
90
|
-
for (let
|
|
91
|
-
if (this.tree.get(
|
|
92
|
-
return this.tree.get(
|
|
100
|
+
for (let t = 1n; t < 2n ** this.levels; t *= 2n)
|
|
101
|
+
if (this.tree.get(t))
|
|
102
|
+
return this.tree.get(t);
|
|
93
103
|
return this.defaultNodeValue;
|
|
94
104
|
}
|
|
95
105
|
getMerkleData() {
|
|
96
106
|
return this.completenessCheck(), new Map(this.tree);
|
|
97
107
|
}
|
|
98
|
-
getSiblingIndex(
|
|
99
|
-
return
|
|
108
|
+
getSiblingIndex(t) {
|
|
109
|
+
return t === 1n ? 1n : t % 2n === 1n ? t - 1n : t + 1n;
|
|
100
110
|
}
|
|
101
111
|
/**
|
|
102
112
|
* get sibling hashes needed by main.circom
|
|
103
113
|
* @throws will throw MerkleTreeIncompleteError if there are missing elements in the tree
|
|
104
114
|
*/
|
|
105
|
-
getSiblingHashesForVerification(
|
|
115
|
+
getSiblingHashesForVerification(t) {
|
|
106
116
|
this.completenessCheck();
|
|
107
|
-
let t;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return new Array(Number(this.levels)).fill(0n);
|
|
115
|
-
const n = [];
|
|
116
|
-
for (; t !== 0n; )
|
|
117
|
-
n.push(this.tree.get(this.getSiblingIndex(t)) || this.defaultNodeValue), t /= 2n;
|
|
118
|
-
return n;
|
|
117
|
+
let e = this.reverseTree.get(t);
|
|
118
|
+
if (e === void 0)
|
|
119
|
+
return new Array(Number(o)).fill(0n);
|
|
120
|
+
const r = [];
|
|
121
|
+
for (; e !== 0n; )
|
|
122
|
+
r.push(this.tree.get(this.getSiblingIndex(e)) || this.defaultNodeValue), e /= 2n;
|
|
123
|
+
return r.slice(0, o);
|
|
119
124
|
}
|
|
120
125
|
/**
|
|
121
126
|
* get item's sibling hashes side
|
|
122
127
|
* @returns sibling's indexes
|
|
123
128
|
* @throws will throw MerkleTreeIncompleteError if there are missing elements in the tree
|
|
124
129
|
*/
|
|
125
|
-
getSiblingSides(
|
|
130
|
+
getSiblingSides(t) {
|
|
126
131
|
this.completenessCheck();
|
|
127
|
-
let t;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return new Array(Number(this.levels)).fill(0n);
|
|
135
|
-
const n = [];
|
|
136
|
-
for (; t !== 0n; ) {
|
|
137
|
-
const i = t % 2n === 0n ? 0n : 1n;
|
|
138
|
-
n.push(i), t /= 2n;
|
|
132
|
+
let e = this.reverseTree.get(t);
|
|
133
|
+
if (e === void 0)
|
|
134
|
+
return new Array(Number(o)).fill(0n);
|
|
135
|
+
const r = [];
|
|
136
|
+
for (; e !== 0n; ) {
|
|
137
|
+
const i = e % 2n === 0n ? 0n : 1n;
|
|
138
|
+
r.push(i), e /= 2n;
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return r.slice(0, o);
|
|
141
141
|
}
|
|
142
142
|
toJSON() {
|
|
143
|
-
const { tree: e, count:
|
|
143
|
+
const { tree: t, reverseTree: e, count: r, index: i } = this;
|
|
144
144
|
return {
|
|
145
|
-
tree: Object.fromEntries(
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
tree: Object.fromEntries(t),
|
|
146
|
+
reverseTree: Object.fromEntries(e),
|
|
147
|
+
count: r.toString(),
|
|
148
|
+
index: i.toString()
|
|
148
149
|
};
|
|
149
150
|
}
|
|
151
|
+
clone() {
|
|
152
|
+
return l.createWithData(
|
|
153
|
+
new Map(this.tree),
|
|
154
|
+
new Map(this.reverseTree),
|
|
155
|
+
this.index,
|
|
156
|
+
this.count,
|
|
157
|
+
this.hashFunction,
|
|
158
|
+
this.levels,
|
|
159
|
+
this.defaultNodeValue
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
getIndex() {
|
|
163
|
+
return this.index;
|
|
164
|
+
}
|
|
150
165
|
}
|
|
151
166
|
export {
|
|
152
|
-
|
|
167
|
+
l as MerkleTree
|
|
153
168
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../functions/web3/etherFunctions.cjs"),c=require("../../crypto/poseidon.cjs"),i=require("./MerkleTree.cjs"),g=(r,n,o,t)=>{if(!t||o){const e=i.MerkleTree.create(c.poseidonFunction,0n);return e.insert(BigInt(n.getAccessKey()),e.getStartIndex()),t||e.insert(s.randomBigInt(31),e.getStartIndex()+1n),e}return r};exports.getPatchedAccessTokenMerkleTree=g;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { UserKeys } from '../crypto-keys/keys';
|
|
2
|
+
import { MerkleTree } from './MerkleTree';
|
|
3
|
+
export declare const getPatchedAccessTokenMerkleTree: (merkleTreeAccessToken: MerkleTree<bigint>, userKeys: UserKeys, patchAccessTokenMerkleTree: boolean, kycRequired: boolean) => MerkleTree<bigint>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { randomBigInt as i } from "../../functions/web3/etherFunctions.mjs";
|
|
2
|
+
import { poseidonFunction as s } from "../../crypto/poseidon.mjs";
|
|
3
|
+
import { MerkleTree as c } from "./MerkleTree.mjs";
|
|
4
|
+
const f = (r, n, o, t) => {
|
|
5
|
+
if (!t || o) {
|
|
6
|
+
const e = c.create(s, 0n);
|
|
7
|
+
return e.insert(BigInt(n.getAccessKey()), e.getStartIndex()), t || e.insert(i(31), e.getStartIndex() + 1n), e;
|
|
8
|
+
}
|
|
9
|
+
return r;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
f as getPatchedAccessTokenMerkleTree
|
|
13
|
+
};
|
|
@@ -8,6 +8,7 @@ export interface ChainEventListener {
|
|
|
8
8
|
export interface IProviderAdapter<ConnectorType = unknown> {
|
|
9
9
|
chainId: number | undefined;
|
|
10
10
|
initConnector(connector: ConnectorType): void;
|
|
11
|
+
getSigner(): Signer;
|
|
11
12
|
initSigner?(signer: Signer): void;
|
|
12
13
|
init(chainId?: number): Promise<void>;
|
|
13
14
|
initConfig?(config?: any): Promise<void> | void;
|
|
@@ -27,6 +28,7 @@ export interface IProviderAdapter<ConnectorType = unknown> {
|
|
|
27
28
|
getContractWithFetcherForEthereum(contract: ContractType, contractAddress?: string): Contract;
|
|
28
29
|
sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>;
|
|
29
30
|
switchNetwork(network: EthereumNetwork): Promise<unknown>;
|
|
31
|
+
switchAccount(signer: ethers.Signer): Promise<void>;
|
|
30
32
|
onAccountChanged(): Promise<unknown>;
|
|
31
33
|
onChainChanged(chainId?: number): Promise<unknown>;
|
|
32
34
|
isPermitterAvailable(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../event-service/AbstractAccessTokenSnapshotService.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const t=require("../../API/fetchCommitmentsCache.cjs");class c extends s.AbstractAccessTokenSnapshotService{constructor(r,e){super(r,0,!1,e)}async fetchSnapshot(){const{chainId:r}=await this.contract.provider.getNetwork(),e=await t.fetchAccessTokenSnapshot(r);if(e.accessTokenContractAddress!==this.contract.address||e.chainId!==r)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,senderAddresses:e.senderAddresses,senderAddressIndexMap:e.senderAddressIndexMap}}persistSnapshot(r){return Promise.resolve()}}exports.ClientAccessTokenSnapshotService=c;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../event-service/AbstractAccessTokenSnapshotService.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const t=require("../../API/fetchCommitmentsCache.cjs");class c extends s.AbstractAccessTokenSnapshotService{constructor(r,e){super(r,0,!1,e)}async fetchSnapshot(){const{chainId:r}=await this.contract.provider.getNetwork(),e=await t.fetchAccessTokenSnapshot(r);if(e.accessTokenContractAddress!==this.contract.address||e.chainId!==r)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,senderAddresses:e.senderAddresses,senderAddressIndexMap:e.senderAddressIndexMap}}persistSnapshot(r){return Promise.resolve()}}exports.ClientAccessTokenSnapshotService=c;
|
|
@@ -5,9 +5,10 @@ import "libsodium-wrappers";
|
|
|
5
5
|
import "process";
|
|
6
6
|
import "buffer";
|
|
7
7
|
import "../../constants/vite.constants.mjs";
|
|
8
|
+
import "../../error-handling/error-codes.constants.mjs";
|
|
8
9
|
import "../../constants/reorg-depths.constants.mjs";
|
|
9
10
|
import { fetchAccessTokenSnapshot as t } from "../../API/fetchCommitmentsCache.mjs";
|
|
10
|
-
class
|
|
11
|
+
class S extends s {
|
|
11
12
|
constructor(r, e) {
|
|
12
13
|
super(r, 0, !1, e);
|
|
13
14
|
}
|
|
@@ -27,5 +28,5 @@ class k extends s {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
S as ClientAccessTokenSnapshotService
|
|
31
32
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../event-service/AbstractApprovalsSnapshotService.cjs"),r=require("../../API/fetchCommitmentsCache.cjs");class s extends a.AbstractApprovalsSnapshotService{constructor(e,t){super(e,0,!1,t)}async fetchSnapshot(){const{chainId:e}=await this.contract.provider.getNetwork(),t=await r.fetchApprovalsSnapshot(e);if(t.hinkalAddress!==this.contract.address||t.chainId!==e)throw Error("approvalsSnapshotData Snapshot: incorrect contract or chain id");return{latestBlockNumber:t.latestBlockNumber,approvals:t.approvals,events:t.events}}persistSnapshot(e){return Promise.resolve()}}exports.ClientApprovalsSnapshotService=s;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Contract } from 'ethers';
|
|
2
|
+
import { AbstractApprovalsSnapshotService, ApprovalsSerializedSnapshot } from '../event-service/AbstractApprovalsSnapshotService';
|
|
3
|
+
import { CommitmentsSerializedSnapshot } from '../event-service';
|
|
4
|
+
export declare class ClientApprovalsSnapshotService extends AbstractApprovalsSnapshotService {
|
|
5
|
+
constructor(contract: Contract, maxPageSize?: number);
|
|
6
|
+
protected fetchSnapshot(): Promise<ApprovalsSerializedSnapshot>;
|
|
7
|
+
protected persistSnapshot(_serializedSnapshot: CommitmentsSerializedSnapshot): Promise<unknown>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AbstractApprovalsSnapshotService as r } from "../event-service/AbstractApprovalsSnapshotService.mjs";
|
|
2
|
+
import { fetchApprovalsSnapshot as s } from "../../API/fetchCommitmentsCache.mjs";
|
|
3
|
+
class n extends r {
|
|
4
|
+
constructor(a, t) {
|
|
5
|
+
super(a, 0, !1, t);
|
|
6
|
+
}
|
|
7
|
+
async fetchSnapshot() {
|
|
8
|
+
const { chainId: a } = await this.contract.provider.getNetwork(), t = await s(a);
|
|
9
|
+
if (t.hinkalAddress !== this.contract.address || t.chainId !== a)
|
|
10
|
+
throw Error("approvalsSnapshotData Snapshot: incorrect contract or chain id");
|
|
11
|
+
return {
|
|
12
|
+
latestBlockNumber: t.latestBlockNumber,
|
|
13
|
+
approvals: t.approvals,
|
|
14
|
+
events: t.events
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
persistSnapshot(a) {
|
|
18
|
+
return Promise.resolve();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
n as ClientApprovalsSnapshotService
|
|
23
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const r=require("../event-service/AbstractCommitmentsSnapshotService.cjs"),s=require("../../API/fetchCommitmentsCache.cjs");class i extends r.AbstractCommitmentsSnapshotService{constructor(t,e){super(t,0,!1,e)}async fetchSnapshot(){const{chainId:t}=await this.contract.provider.getNetwork(),e=await s.fetchCommitmentsSnapshot(t);if(e.hinkalAddress!==this.contract.address||e.chainId!==t)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,encryptedOutputs:e.encryptedOutputs}}persistSnapshot(t){return Promise.resolve()}}exports.ClientCommitmentsSnapshotService=i;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const r=require("../event-service/AbstractCommitmentsSnapshotService.cjs"),s=require("../../API/fetchCommitmentsCache.cjs");class i extends r.AbstractCommitmentsSnapshotService{constructor(t,e){super(t,0,!1,e)}async fetchSnapshot(){const{chainId:t}=await this.contract.provider.getNetwork(),e=await s.fetchCommitmentsSnapshot(t);if(e.hinkalAddress!==this.contract.address||e.chainId!==t)throw Error("Commitment Snapshot: incorrect contract or chain id");return{latestBlockNumber:e.latestBlockNumber,merkleTree:e.merkleTree,encryptedOutputs:e.encryptedOutputs}}persistSnapshot(t){return Promise.resolve()}}exports.ClientCommitmentsSnapshotService=i;
|
|
@@ -4,10 +4,11 @@ import "libsodium-wrappers";
|
|
|
4
4
|
import "process";
|
|
5
5
|
import "buffer";
|
|
6
6
|
import "../../constants/vite.constants.mjs";
|
|
7
|
+
import "../../error-handling/error-codes.constants.mjs";
|
|
7
8
|
import "../../constants/reorg-depths.constants.mjs";
|
|
8
9
|
import { AbstractCommitmentsSnapshotService as e } from "../event-service/AbstractCommitmentsSnapshotService.mjs";
|
|
9
10
|
import { fetchCommitmentsSnapshot as o } from "../../API/fetchCommitmentsCache.mjs";
|
|
10
|
-
class
|
|
11
|
+
class S extends e {
|
|
11
12
|
constructor(r, t) {
|
|
12
13
|
super(r, 0, !1, t);
|
|
13
14
|
}
|
|
@@ -26,5 +27,5 @@ class u extends e {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
export {
|
|
29
|
-
|
|
30
|
+
S as ClientCommitmentsSnapshotService
|
|
30
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../event-service/AbstractNullifierSnapshotService.cjs"),t=require("../../API/fetchNullifiers.cjs");class s extends i.AbstractNullifierSnapshotService{constructor(e,r){super(e,0,!1,r)}async fetchSnapshot(){const{chainId:e}=await this.contract.provider.getNetwork(),r=await t.fetchNullifiers(e);return{latestBlockNumber:r.latestBlockNumber,nullifiers:r.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientNullifierSnapshotService=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../event-service/AbstractNullifierSnapshotService.cjs"),t=require("../../API/fetchNullifiers.cjs");class s extends i.AbstractNullifierSnapshotService{constructor(e,r){super(e,0,!1,r)}async fetchSnapshot(){const{chainId:e}=await this.contract.provider.getNetwork(),r=await t.fetchNullifiers(e);return{latestBlockNumber:r.latestBlockNumber,nullifiers:r.nullifiers}}persistSnapshot(e){return Promise.resolve()}}exports.ClientNullifierSnapshotService=s;
|
|
@@ -4,15 +4,16 @@ import "libsodium-wrappers";
|
|
|
4
4
|
import "process";
|
|
5
5
|
import "buffer";
|
|
6
6
|
import "../../constants/vite.constants.mjs";
|
|
7
|
+
import "../../error-handling/error-codes.constants.mjs";
|
|
7
8
|
import "../../constants/reorg-depths.constants.mjs";
|
|
8
|
-
import { AbstractNullifierSnapshotService as
|
|
9
|
-
import { fetchNullifiers as
|
|
10
|
-
class
|
|
9
|
+
import { AbstractNullifierSnapshotService as i } from "../event-service/AbstractNullifierSnapshotService.mjs";
|
|
10
|
+
import { fetchNullifiers as e } from "../../API/fetchNullifiers.mjs";
|
|
11
|
+
class S extends i {
|
|
11
12
|
constructor(t, r) {
|
|
12
13
|
super(t, 0, !1, r);
|
|
13
14
|
}
|
|
14
15
|
async fetchSnapshot() {
|
|
15
|
-
const { chainId: t } = await this.contract.provider.getNetwork(), r = await
|
|
16
|
+
const { chainId: t } = await this.contract.provider.getNetwork(), r = await e(t);
|
|
16
17
|
return {
|
|
17
18
|
latestBlockNumber: r.latestBlockNumber,
|
|
18
19
|
nullifiers: r.nullifiers
|
|
@@ -23,5 +24,5 @@ class h extends e {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
S as ClientNullifierSnapshotService
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../functions/utils/caseInsensitive.utils.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../functions/utils/caseInsensitive.utils.cjs"),t=require("../../constants/lido.constants.cjs"),o=require("../../constants/protocol.constants.cjs");class l{static isCurveLPToken=(e,s)=>a.lowerCaseIncludes(s,e.erc20TokenAddress);static isCurveStakeToken=e=>e.name.includes("Gauge")&&e.symbol.includes("-gauge");static isConvexToken=e=>e.name.includes("Convex")&&e.symbol.includes("cvx");static isBeefyLpToken=e=>e.name.startsWith("moo")&&e.symbol.startsWith("moo");static isBeefyStakeToken=e=>e.name.includes("-Boost")&&e.symbol.includes("-Boost");static isLidoToken=e=>e.symbol===t.wstEthSymbol||e.symbol===t.stMaticSymbol;static isCurveOrConvex=(e,s)=>this.isCurveLPToken(e,s)||this.isCurveStakeToken(e)||this.isConvexToken(e);static isBeefyToken=e=>this.isBeefyLpToken(e)||this.isBeefyStakeToken(e);static isStakeToken=e=>this.isCurveStakeToken(e)||this.isConvexToken(e)||this.isBeefyStakeToken(e);static isPendleYtToken=e=>e.name.startsWith("Pendle-YT-")&&e.symbol.startsWith("Pendle-YT-");static isPendleLPToken=e=>e.name.startsWith("Pendle-LP-")&&e.symbol.startsWith("Pendle-LP-");static isPendleSyToken=e=>e.name.startsWith("SY ")&&e.symbol.includes("SY-");static isPendleNativeToken=e=>{const s=e.name.startsWith("YT ")&&e.symbol.includes("YT-"),i=this.isPendleSyToken(e),n=e.name.startsWith("PT ")&&e.symbol.includes("PT-"),r=e.name.startsWith("LP ")&&e.symbol.includes("LP-");return s||i||n||r};static isPendleToken=e=>this.isPendleYtToken(e)||this.isPendleLPToken(e)||this.isPendleNativeToken(e);static isAaveToken=e=>e.aaveToken;static isKinzaToken=e=>e.name.startsWith("Kinza");static isProtocolToken=(e,s)=>this.isCurveLPToken(e,s)||this.isCurveStakeToken(e)||this.isConvexToken(e)||this.isBeefyLpToken(e)||this.isBeefyStakeToken(e)||this.isLidoToken(e)||this.isPendleToken(e)||this.isAaveToken(e);static isPotentiallyVolatile=e=>e.erc20TokenAddress===o.zeroAddress?!1:e.isVolatile||e.balanceStorageOffset===void 0||e.allowanceStorageOffset===void 0}exports.TokenChecker=l;
|
|
@@ -17,4 +17,5 @@ export declare class TokenChecker {
|
|
|
17
17
|
static isAaveToken: (token: ERC20Token) => boolean | undefined;
|
|
18
18
|
static isKinzaToken: (token: ERC20Token) => boolean;
|
|
19
19
|
static isProtocolToken: (token: ERC20Token, curveTokens: string[]) => boolean | undefined;
|
|
20
|
+
static isPotentiallyVolatile: (token: ERC20Token) => boolean;
|
|
20
21
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { lowerCaseIncludes as r } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
2
2
|
import { wstEthSymbol as a, stMaticSymbol as o } from "../../constants/lido.constants.mjs";
|
|
3
|
-
|
|
3
|
+
import { zeroAddress as l } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
class h {
|
|
4
5
|
static isCurveLPToken = (s, e) => r(e, s.erc20TokenAddress);
|
|
5
6
|
static isCurveStakeToken = (s) => s.name.includes("Gauge") && s.symbol.includes("-gauge");
|
|
6
7
|
static isConvexToken = (s) => s.name.includes("Convex") && s.symbol.includes("cvx");
|
|
@@ -21,7 +22,8 @@ class u {
|
|
|
21
22
|
static isAaveToken = (s) => s.aaveToken;
|
|
22
23
|
static isKinzaToken = (s) => s.name.startsWith("Kinza");
|
|
23
24
|
static isProtocolToken = (s, e) => this.isCurveLPToken(s, e) || this.isCurveStakeToken(s) || this.isConvexToken(s) || this.isBeefyLpToken(s) || this.isBeefyStakeToken(s) || this.isLidoToken(s) || this.isPendleToken(s) || this.isAaveToken(s);
|
|
25
|
+
static isPotentiallyVolatile = (s) => s.erc20TokenAddress === l ? !1 : s.isVolatile || s.balanceStorageOffset === void 0 || s.allowanceStorageOffset === void 0;
|
|
24
26
|
}
|
|
25
27
|
export {
|
|
26
|
-
|
|
28
|
+
h as TokenChecker
|
|
27
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../../API/API.cjs"),A=require("../../functions/snarkjs/generateZkProof.cjs");require("../../types/circom-data.types.cjs");require("../../constants/vite.constants.cjs");const m=require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");const k=require("./history/getTxDetails.cjs");require("ethers");require("circomlibjs-hinkal-fork");const v=require("../../error-handling/error-codes.constants.cjs"),x=require("../crypto-keys/keys.cjs"),w=require("../crypto-keys/encryptDecryptUtxo.cjs"),g=require("../../constants/chains.constants.cjs"),C=require("../../constants/contracts.constants.cjs"),p=require("../../functions/utils/getDataFromTransaction.cjs"),I=require("../../functions/utils/cacheFunctions.cjs");class P{circuitSize=50;hinkalContract;init(t){this.hinkalContract=t}requireInit(){if(!this.hinkalContract)throw Error("TransactionsManager not initialized")}filterOwnTransactions=async(t,e,a,s)=>{const{transactMethodId:i,transactWithExternalActionMethodId:n,hinkalInterface:r}=C.getHinkalParameters(g.getNonLocalhostChainId(t)),o=c=>"decodedInput"in c,l=e.filter(c=>c.methodId===i||c.methodId===n).map(c=>o(c)?c:{...c,decodedInput:p.decodeTxInput(r,c.input),status:c.isError==="0"?"SUCCESS":"FAILURE"}),h=a.getShieldedPrivateKey();return l.filter(c=>{try{if(o(c)){if(w.decryptUtxo(Buffer.from(c.decodedInput.encryptedOutputs[0].slice(2),"hex"),a),!s&&c.methodId===i){const{extraRandomization:f,H0:T,H1:S}=c.decodedInput.stealthAddressStructure;return x.UserKeys.checkSignature(f,T,S,h)}return!0}return!1}catch{return!1}})};saveTxsInStorage=(t,e,a,s,i)=>{const n=a.getShieldedPublicKey();return I.saveTxsCache(t,e,n,this.hinkalContract.address,s,i)};loadTxsFromStorage=async(t,e,a)=>{const s=e.getShieldedPublicKey();return await I.loadTxsCache(t,s,this.hinkalContract.address,a)};getAllTransactions=async(t,e,a,s,i)=>{if(s){const{transactions:d}=await y.API.userGetTransactions(t,s);return d}const{decodedTxs:n,lastHash:r}=await this.loadTxsFromStorage(t,e,a),{transactions:o}=await y.API.userGetTransactions(t,s,r,i);return[...o,...n]};getHinkalHistoryBase=async(t,e,a,s,i=!1,n)=>{this.requireInit();const r=await this.getAllTransactions(t,e,a,s,n)??[];r.sort((d,l)=>l.timeStamp-d.timeStamp);const o=await this.filterOwnTransactions(t,r,e,i);return!s&&r.length>0&&await this.saveTxsInStorage(o,t,e,r[0].hash,a),o};getHinkalHistory=async(t,e,a)=>{const s=await this.getHinkalHistoryBase(t,e,a,void 0,!0),i=p.decodeTxLogs(t,s);return await Promise.all(i.map(async r=>({...r,status:r.status,details:await k.getTxDetails(t,r.decodedInput,r.utxosArray)})))};sortInBatches=t=>{const e=[];let a=0,s=0;t.forEach(r=>{a===0&&e.push([]),e[s].push(r),a+=1,a===this.circuitSize&&(a=0,s+=1)});const i=e[e.length-1],n=i.length;if(n<this.circuitSize){const r=this.circuitSize-n,o=new Array(r).fill(m.emptyDecodedTx);e[e.length-1]=i.concat(o)}return e};generateTransactionsProof=async(t,e,a)=>{const s=this.sortInBatches(e),i=new Array(s.length).fill([]);for(let n=0;n<s.length;n+=1){const r=s[n].map(u=>u.decodedInput.stealthAddressStructure),o=r.map(u=>u.extraRandomization),d=r.map(u=>u.stealthAddress),l={shieldedPrivateKey:a,extraRandomizations:o,stealthAddresses:d},{zkCallData:h}=await A.generateZkProof("v1x0",t,"transactionsProver",l,!1);i[n]=h}return{zkCallDataArray:i}};userVerifyTransactions=async(t,e,a,s,i)=>await y.API.userVerifyTransactions(t,e,a,s,i);verifyTransactionsInBatches=async(t,e,a,s)=>{const n=e.getBackendToken(),r=e.getShieldedPrivateKey(),o={trade:0,transactions:0,lockedDeposit:0,verification:!0};if(s.length===0){const d=await this.userVerifyTransactions(t,[],[],n,a);Object.assign(o,d)}for(let d=0;d<s.length;d+=15){const l=s.slice(d,d+15),{zkCallDataArray:h}=await this.generateTransactionsProof(t,l,r),u=l.map(f=>f.hash),c=await this.userVerifyTransactions(t,u,h,n,a);if(o.trade+=c.trade,o.transactions+=c.transactions,o.lockedDeposit+=c.lockedDeposit,o.verification&&=c.verification,!o.verification)throw Error("Verification failed for batch of transactions")}return o};processAndSendTransactionsForVerification=async(t,e,a,s,i,n)=>{this.requireInit();const r=await this.getHinkalHistoryBase(t,e,a,void 0,void 0,n),o=i?r.findIndex(T=>T.hash===i):void 0,l=r.slice(0,o).reverse(),{trade:h,transactions:u,lockedDeposit:c,verification:f}=await this.verifyTransactionsInBatches(t,e,s,l);return{trade:h,transactions:u,lockedDeposit:c,verification:f}};multiProcessAndSendTransactionsForVerification=async(t,e,a,s)=>{const i=g.chainIdsByType[g.EthereumNetworkType.Mainnet];let n=!0;for(let r=0;r<i.length;r+=1)try{const o=i[r],d=s?.[o],l=d?.lastCertifiedHash,h=d?.week,{verification:u}=await this.processAndSendTransactionsForVerification(o,t,e,a,l,h);if(n=n&&u,!n)break}catch(o){console.error(`current chain ${i[r]} certification error`,{err:o}),n=!1;break}if(!n)throw Error(v.transactionErrorCodes.MULTI_VERIFICATION_FAILED);return!0}}exports.TransactionsManager=P;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Contract } from 'ethers';
|
|
2
|
-
import { DecodedTx, RawTx } from '../../types';
|
|
2
|
+
import { DecodedTx, HashInfoByChain, RawTx } from '../../types';
|
|
3
3
|
import { TransactionField } from './history/history.types';
|
|
4
4
|
import { UserKeys } from '../crypto-keys';
|
|
5
|
+
import { type IHinkal } from '../Hinkal/IHinkal';
|
|
5
6
|
export declare class TransactionsManager {
|
|
6
7
|
readonly circuitSize: number;
|
|
7
8
|
hinkalContract: Contract;
|
|
@@ -10,17 +11,18 @@ export declare class TransactionsManager {
|
|
|
10
11
|
private filterOwnTransactions;
|
|
11
12
|
private saveTxsInStorage;
|
|
12
13
|
private loadTxsFromStorage;
|
|
13
|
-
getAllTransactions: (chainId: number, userKeys: UserKeys, week?: number) => Promise<RawTx[]>;
|
|
14
|
-
getHinkalHistoryBase: (chainId: number, userKeys: UserKeys, week?: number, includeOthersDeposits?: boolean) => Promise<DecodedTx[]>;
|
|
15
|
-
getHinkalHistory: (chainId: number, userKeys: UserKeys) => Promise<TransactionField[]>;
|
|
14
|
+
getAllTransactions: (chainId: number, userKeys: UserKeys, hinkal: IHinkal, week?: number, startWeek?: number) => Promise<RawTx[]>;
|
|
15
|
+
getHinkalHistoryBase: (chainId: number, userKeys: UserKeys, hinkal: IHinkal, week?: number, includeOthersDeposits?: boolean, startWeek?: number) => Promise<DecodedTx[]>;
|
|
16
|
+
getHinkalHistory: (chainId: number, userKeys: UserKeys, hinkal: IHinkal) => Promise<TransactionField[]>;
|
|
16
17
|
private sortInBatches;
|
|
17
18
|
private generateTransactionsProof;
|
|
18
19
|
private userVerifyTransactions;
|
|
19
|
-
|
|
20
|
+
private verifyTransactionsInBatches;
|
|
21
|
+
processAndSendTransactionsForVerification: (chainId: number, userKeys: UserKeys, hinkal: IHinkal, ethereumAddress: string, latestCertifiedHash?: string, startWeek?: number) => Promise<{
|
|
20
22
|
trade: number;
|
|
21
23
|
transactions: number;
|
|
22
24
|
lockedDeposit: number;
|
|
23
25
|
verification: boolean;
|
|
24
26
|
}>;
|
|
25
|
-
multiProcessAndSendTransactionsForVerification: (userKeys: UserKeys, ethereumAddress: string) => Promise<boolean>;
|
|
27
|
+
multiProcessAndSendTransactionsForVerification: (userKeys: UserKeys, hinkal: IHinkal, ethereumAddress: string, lastCertifiedHashes?: HashInfoByChain) => Promise<boolean>;
|
|
26
28
|
}
|