@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n = (i) => JSON.stringify(i, (r, t) => typeof t == "bigint" ? `bigint:${t.toString()}` : t), s = (i) => JSON.parse(i, (r, t) => typeof t == "string" && t.startsWith("bigint:") ? BigInt(t.slice(7)) : t);
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
s as CustomJSONParse,
|
|
4
|
+
n as CustomJSONStringify
|
|
4
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants/chains.constants.cjs");function i(t){return t?.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" ")}function a(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){return!t||t===null||Array.isArray(t)&&t.length===0?!0:Object.keys(t).length===0&&t.constructor===Object}const l=t=>{t.startsWith("0x")&&(t=t.slice(2));const e=[];for(let r=0;r<t.length;r+=2){const s=parseInt(t.slice(r,r+2),16);e.push(s)}return new TextDecoder("utf-8").decode(new Uint8Array(e))},u=(t,e,n=!1)=>{const r=`${t}-${e}`;if(n){const{hinkalAddress:s}=o.networkRegistry[e].contractData;return`${r}-${s}`.toLowerCase()}return r.toLowerCase()},f=(t,e,n)=>{if(!e||!n)throw Error("oldPart and newPart must be provided");return t.toLowerCase().split(e.toLowerCase()).join(n.toLowerCase())};exports.capitalizeFirstLetter=a;exports.getStateKey=u;exports.hexToUtf8=l;exports.isNullOrEmpty=c;exports.replaceAllInstances=f;exports.toTitleCase=i;
|
|
@@ -7,3 +7,5 @@ export declare function capitalizeFirstLetter(str: string): string;
|
|
|
7
7
|
/** Returns true if a value is null, undefined, or an empty object, array (length 0), or string (e.g. '') */
|
|
8
8
|
export declare function isNullOrEmpty(obj: unknown): boolean;
|
|
9
9
|
export declare const hexToUtf8: (hex: string) => string;
|
|
10
|
+
export declare const getStateKey: (address: string, chainId: number, withHinkalContractAddress?: boolean) => string;
|
|
11
|
+
export declare const replaceAllInstances: (text: string, oldPart: string, newPart: string) => string;
|
|
@@ -1,24 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { networkRegistry as o } from "../../constants/chains.constants.mjs";
|
|
2
|
+
function a(t) {
|
|
3
|
+
return t?.toLowerCase().split(" ").map((e) => e.charAt(0).toUpperCase() + e.substring(1)).join(" ");
|
|
3
4
|
}
|
|
4
|
-
function
|
|
5
|
+
function c(t) {
|
|
5
6
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function u(t) {
|
|
8
9
|
return !t || t === null || Array.isArray(t) && t.length === 0 ? !0 : Object.keys(t).length === 0 && t.constructor === Object;
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
+
const l = (t) => {
|
|
11
12
|
t.startsWith("0x") && (t = t.slice(2));
|
|
12
|
-
const
|
|
13
|
-
for (let
|
|
14
|
-
const
|
|
15
|
-
|
|
13
|
+
const e = [];
|
|
14
|
+
for (let r = 0; r < t.length; r += 2) {
|
|
15
|
+
const s = parseInt(t.slice(r, r + 2), 16);
|
|
16
|
+
e.push(s);
|
|
17
|
+
}
|
|
18
|
+
return new TextDecoder("utf-8").decode(new Uint8Array(e));
|
|
19
|
+
}, f = (t, e, n = !1) => {
|
|
20
|
+
const r = `${t}-${e}`;
|
|
21
|
+
if (n) {
|
|
22
|
+
const { hinkalAddress: s } = o[e].contractData;
|
|
23
|
+
return `${r}-${s}`.toLowerCase();
|
|
16
24
|
}
|
|
17
|
-
return
|
|
25
|
+
return r.toLowerCase();
|
|
26
|
+
}, p = (t, e, n) => {
|
|
27
|
+
if (!e || !n)
|
|
28
|
+
throw Error("oldPart and newPart must be provided");
|
|
29
|
+
return t.toLowerCase().split(e.toLowerCase()).join(n.toLowerCase());
|
|
18
30
|
};
|
|
19
31
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
c as capitalizeFirstLetter,
|
|
33
|
+
f as getStateKey,
|
|
34
|
+
l as hexToUtf8,
|
|
35
|
+
u as isNullOrEmpty,
|
|
36
|
+
p as replaceAllInstances,
|
|
37
|
+
a as toTitleCase
|
|
24
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(e=1e3)=>new Promise(t=>{setTimeout(()=>{t(void 0)},e)}),i=()=>Math.floor(Date.now()/1e3);exports.getCurrentTimeInSeconds=i;exports.waitLittle=o;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = (e = 1e3) => new Promise((t) => {
|
|
2
2
|
setTimeout(() => {
|
|
3
3
|
t(void 0);
|
|
4
4
|
}, e);
|
|
5
|
-
});
|
|
5
|
+
}), n = () => Math.floor(Date.now() / 1e3);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
n as getCurrentTimeInSeconds,
|
|
8
|
+
o as waitLittle
|
|
8
9
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../API/API.cjs"),l=async(t,o)=>{const a=await i.API.tokensInfoCall(t,o),n=[];return a.forEach((e,c)=>{(!e||!e.balanceStorageOffset||!e.allowanceStorageOffset)&&n.push(o[c])}),n};exports.checkTokensForShielding=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkTokensForShielding: (chainId: number, erc20Addresses: string[]) => Promise<string[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { API as f } from "../../API/API.mjs";
|
|
2
|
+
const s = async (t, n) => {
|
|
3
|
+
const e = await f.tokensInfoCall(t, n), a = [];
|
|
4
|
+
return e.forEach((o, c) => {
|
|
5
|
+
(!o || !o.balanceStorageOffset || !o.allowanceStorageOffset) && a.push(n[c]);
|
|
6
|
+
}), a;
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
s as checkTokensForShielding
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../error-handling/error-codes.constants.cjs"),d=require("./caseInsensitive.utils.cjs"),o=async(e,r,t)=>{const s=await e.getEthereumAddress();if(e.getCurrentChainId()!==r||!d.caseInsensitiveEqual(s,t))throw Error(n.transactionErrorCodes.ERROR_MESSAGE_CHAIN_ADDRESS_CHANGED);return!0};exports.checkChainOrAddressNotUpdated=o;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { transactionErrorCodes as s } from "../../error-handling/error-codes.constants.mjs";
|
|
2
|
+
import { caseInsensitiveEqual as o } from "./caseInsensitive.utils.mjs";
|
|
3
|
+
const E = async (r, e, t) => {
|
|
4
|
+
const n = await r.getEthereumAddress();
|
|
5
|
+
if (r.getCurrentChainId() !== e || !o(n, t))
|
|
6
|
+
throw Error(s.ERROR_MESSAGE_CHAIN_ADDRESS_CHANGED);
|
|
7
|
+
return !0;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
E as checkChainOrAddressNotUpdated
|
|
11
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("ua-parser-js"),a=new s.UAParser,o=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("ua-parser-js"),a=new s.UAParser,o=17,n=()=>{const{name:e,version:r}=a.getBrowser(),t=parseInt(r?.split(".")[0]??"0",10);return!(e==="Safari"&&t&&o>t)},l={mpcVault:"MPCVault - Multisig Wallet",utila:"UtilaWallet"},u=e=>{const r=e?.session?.peer?.metadata?.name;return!Object.values(l).includes(r)};exports.browserSupported=n;exports.walletSupported=u;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { UAParser as s } from "ua-parser-js";
|
|
2
|
-
const a = new s(), n =
|
|
3
|
-
const { name: e, version:
|
|
4
|
-
return !(e === "Safari" &&
|
|
2
|
+
const a = new s(), n = 17, i = () => {
|
|
3
|
+
const { name: e, version: t } = a.getBrowser(), r = parseInt(t?.split(".")[0] ?? "0", 10);
|
|
4
|
+
return !(e === "Safari" && r && n > r);
|
|
5
5
|
}, o = {
|
|
6
6
|
mpcVault: "MPCVault - Multisig Wallet",
|
|
7
7
|
utila: "UtilaWallet"
|
|
8
|
-
},
|
|
9
|
-
const
|
|
10
|
-
return !Object.values(o).includes(
|
|
8
|
+
}, u = (e) => {
|
|
9
|
+
const t = e?.session?.peer?.metadata?.name;
|
|
10
|
+
return !Object.values(o).includes(t);
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
i as browserSupported,
|
|
14
|
+
u as walletSupported
|
|
15
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../types/circom-data.types.cjs");const a=require("../../../types/hinkal.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/curve.types.cjs");require("../../../types/activities.types.cjs");const r=n=>{const t=a.EventType.BalanceChange,e=new CustomEvent(t,{detail:n});typeof document<"u"?document.dispatchEvent(e):process?.emit("message",e,void 0)};exports.balanceChangedCustomHandler=r;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../../types/circom-data.types.mjs";
|
|
2
|
+
import { EventType as o } from "../../../types/hinkal.types.mjs";
|
|
3
|
+
import "../../../types/transactions.types.mjs";
|
|
4
|
+
import "../../../types/curve.types.mjs";
|
|
5
|
+
import "../../../types/activities.types.mjs";
|
|
6
|
+
const i = (t) => {
|
|
7
|
+
const n = o.BalanceChange, e = new CustomEvent(n, {
|
|
8
|
+
detail: t
|
|
9
|
+
});
|
|
10
|
+
typeof document < "u" ? document.dispatchEvent(e) : process?.emit("message", e, void 0);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
i as balanceChangedCustomHandler
|
|
14
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../types/circom-data.types.cjs");const n=require("../../../types/hinkal.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/curve.types.cjs");const t=()=>{const e=n.EventType.BalanceChange;typeof document<"u"?document.dispatchEvent(new Event(e)):process?.emit("message",e,void 0)};exports.balanceChangedHandler=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../types/circom-data.types.cjs");const n=require("../../../types/hinkal.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/curve.types.cjs");require("../../../types/activities.types.cjs");const t=()=>{const e=n.EventType.BalanceChange;typeof document<"u"?document.dispatchEvent(new Event(e)):process?.emit("message",e,void 0)};exports.balanceChangedHandler=t;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "../../../types/circom-data.types.mjs";
|
|
2
|
-
import { EventType as
|
|
2
|
+
import { EventType as t } from "../../../types/hinkal.types.mjs";
|
|
3
3
|
import "../../../types/transactions.types.mjs";
|
|
4
4
|
import "../../../types/curve.types.mjs";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import "../../../types/activities.types.mjs";
|
|
6
|
+
const a = () => {
|
|
7
|
+
const e = t.BalanceChange;
|
|
7
8
|
typeof document < "u" ? document.dispatchEvent(new Event(e)) : process?.emit("message", e, void 0);
|
|
8
9
|
};
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
a as balanceChangedHandler
|
|
11
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../../utils/caseInsensitive.utils.cjs"),l=require("../../utils/cacheFunctions.cjs"),m=require("async-mutex"),k=require("ethers"),y=require("../../../error-handling/logger.cjs");require("../../utils/external-action.utils.cjs");const I=require("../../utils/erc20tokenFunctions.cjs");require("../../utils/convertIntegrationProviderToExternalActionId.cjs");require("../../../types/circom-data.types.cjs");const g=require("../../../constants/vite.constants.cjs");require("../../../types/transactions.types.cjs");require("../../../types/curve.types.cjs");require("../../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("../../../error-handling/error-codes.constants.cjs");require("../../../data-structures/crypto-keys/keys.cjs");require("axios");require("../../../constants/chains.constants.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../../constants/reorg-depths.constants.cjs");require("../../../constants/token-data/index.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/addresses.constants.cjs");require("../../../constants/token.limits.constants.cjs");require("../../utils/userAgent.cjs");require("../../../data-structures/volatile-helper/VolatileHelper.cjs");const v=require("../../../data-structures/TokenDBs/PrivateTokensDB.cjs"),h=new m.Mutex,f=(e,a,s)=>(e.forEach(r=>{r.inHinkalAddress===s&&a.push(r)}),a),A=(e,a=!1)=>{const{userKeys:s}=e,r=e.getCurrentChainId();a&&l.resetInHinkalAddressesCache(e,r,s.getShieldedPublicKey());const{approvals:o}=e,n=l.getInHinkalAddressesCache(e,r,s.getShieldedPublicKey());let u=[];return o.forEach((c,d)=>{const t=n[d];let i;t?i=BigInt(t):(i=s.getInHinkalAddress(d),n[d]=i.toString()),u=f(c.map(p=>({...p,interactionAddress:d})),u,i)}),l.setInHinkalAddressesCache(n,e,r,s.getShieldedPublicKey()),u},x=(e,a,s)=>A(e,s).filter(o=>q.caseInsensitiveEqual(o.tokenAddress,a)).sort((o,n)=>o.amount===n.amount?0:o.amount>n.amount?-1:1),E=async(e,a,s)=>{const r=e.getCurrentChainId(),o=await e.getEthereumAddress();let n=[];const u=new Map;return await h.runExclusive(async()=>{const c=A(e,a);s&&g.isExtension&&await v.privateTokensDB.fetchAndUpdatePrivateTokens(c.map(t=>t.tokenAddress),r,o),y.Logger.log({myApprovals:c}),n=(g.isExtension?await v.privateTokensDB.getPrivateTokens(r,o):I.getErc20TokensForChain(r)).map(t=>({token:t,balance:c.reduce((i,p)=>q.caseInsensitiveEqual(t.erc20TokenAddress,p.tokenAddress)?i+p.amount:i,0n),timestamp:"0",nfts:[]})),n.forEach(t=>{u.set(t.token.erc20TokenAddress.toLowerCase(),t)})}),u},T=(e,a,s)=>{const{userKeys:r,approvals:o}=e,n=k.ethers.utils.getAddress(a),u=o.get(n)??[],c=r.getInHinkalAddress(n);return u.reduce((t,i)=>q.caseInsensitiveEqual(i.tokenAddress,s)&&i.inHinkalAddress===c?t+i.amount:t,0n)};exports.getApprovedBalance=E;exports.getApprovedUtxos=A;exports.getApprovedUtxosForToken=x;exports.getMyApprovalAmountForInteraction=T;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApprovedUtxoWithInteractionAddress } from '../../../types/hinkal.types';
|
|
2
|
+
import { type IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
3
|
+
import type { TokenBalance } from '../../../types/token.types';
|
|
4
|
+
export declare const getApprovedUtxos: (hinkal: IHinkal, resetCacheBefore?: boolean) => ApprovedUtxoWithInteractionAddress[];
|
|
5
|
+
export declare const getApprovedUtxosForToken: (hinkal: IHinkal, erc20Address: string, resetCacheBefore: boolean) => ApprovedUtxoWithInteractionAddress[];
|
|
6
|
+
export declare const getApprovedBalance: (hinkal: IHinkal, resetCacheBefore: boolean, updateTokensListBefore: boolean) => Promise<Map<string, TokenBalance>>;
|
|
7
|
+
export declare const getMyApprovalAmountForInteraction: (hinkal: IHinkal, interactionAddress: string, tokenAddress: string) => bigint;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { caseInsensitiveEqual as u } from "../../utils/caseInsensitive.utils.mjs";
|
|
2
|
+
import { resetInHinkalAddressesCache as f, getInHinkalAddressesCache as v, setInHinkalAddressesCache as k } from "../../utils/cacheFunctions.mjs";
|
|
3
|
+
import { Mutex as h } from "async-mutex";
|
|
4
|
+
import { ethers as y } from "ethers";
|
|
5
|
+
import { Logger as I } from "../../../error-handling/logger.mjs";
|
|
6
|
+
import "../../utils/external-action.utils.mjs";
|
|
7
|
+
import { getErc20TokensForChain as C } from "../../utils/erc20tokenFunctions.mjs";
|
|
8
|
+
import "../../utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
9
|
+
import "../../../types/circom-data.types.mjs";
|
|
10
|
+
import { isExtension as l } from "../../../constants/vite.constants.mjs";
|
|
11
|
+
import "../../../types/transactions.types.mjs";
|
|
12
|
+
import "../../../types/curve.types.mjs";
|
|
13
|
+
import "../../../types/activities.types.mjs";
|
|
14
|
+
import "circomlibjs-hinkal-fork";
|
|
15
|
+
import "../../../error-handling/error-codes.constants.mjs";
|
|
16
|
+
import "../../../data-structures/crypto-keys/keys.mjs";
|
|
17
|
+
import "axios";
|
|
18
|
+
import "../../../constants/chains.constants.mjs";
|
|
19
|
+
import "libsodium-wrappers";
|
|
20
|
+
import "process";
|
|
21
|
+
import "buffer";
|
|
22
|
+
import "../../../constants/reorg-depths.constants.mjs";
|
|
23
|
+
import "../../../constants/token-data/index.mjs";
|
|
24
|
+
import "../../../constants/contracts.constants.mjs";
|
|
25
|
+
import "../../../constants/kyc.constants.mjs";
|
|
26
|
+
import "../../../constants/coingecko.constants.mjs";
|
|
27
|
+
import "../../../constants/axelar.constants.mjs";
|
|
28
|
+
import "../../../constants/rewards.constants.mjs";
|
|
29
|
+
import "../../../constants/addresses.constants.mjs";
|
|
30
|
+
import "../../../constants/token.limits.constants.mjs";
|
|
31
|
+
import "../../utils/userAgent.mjs";
|
|
32
|
+
import "../../../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
33
|
+
import { privateTokensDB as A } from "../../../data-structures/TokenDBs/PrivateTokensDB.mjs";
|
|
34
|
+
const H = new h(), x = (e, p, o) => (e.forEach((t) => {
|
|
35
|
+
t.inHinkalAddress === o && p.push(t);
|
|
36
|
+
}), p), g = (e, p = !1) => {
|
|
37
|
+
const { userKeys: o } = e, t = e.getCurrentChainId();
|
|
38
|
+
p && f(e, t, o.getShieldedPublicKey());
|
|
39
|
+
const { approvals: n } = e, s = v(e, t, o.getShieldedPublicKey());
|
|
40
|
+
let a = [];
|
|
41
|
+
return n.forEach((m, d) => {
|
|
42
|
+
const r = s[d];
|
|
43
|
+
let i;
|
|
44
|
+
r ? i = BigInt(r) : (i = o.getInHinkalAddress(d), s[d] = i.toString()), a = x(
|
|
45
|
+
m.map(
|
|
46
|
+
(c) => ({ ...c, interactionAddress: d })
|
|
47
|
+
),
|
|
48
|
+
a,
|
|
49
|
+
i
|
|
50
|
+
);
|
|
51
|
+
}), k(s, e, t, o.getShieldedPublicKey()), a;
|
|
52
|
+
}, se = (e, p, o) => g(e, o).filter((n) => u(n.tokenAddress, p)).sort((n, s) => n.amount === s.amount ? 0 : n.amount > s.amount ? -1 : 1), ne = async (e, p, o) => {
|
|
53
|
+
const t = e.getCurrentChainId(), n = await e.getEthereumAddress();
|
|
54
|
+
let s = [];
|
|
55
|
+
const a = /* @__PURE__ */ new Map();
|
|
56
|
+
return await H.runExclusive(async () => {
|
|
57
|
+
const m = g(e, p);
|
|
58
|
+
o && l && await A.fetchAndUpdatePrivateTokens(
|
|
59
|
+
m.map((r) => r.tokenAddress),
|
|
60
|
+
t,
|
|
61
|
+
n
|
|
62
|
+
), I.log({ myApprovals: m }), s = (l ? await A.getPrivateTokens(t, n) : C(t)).map((r) => ({
|
|
63
|
+
token: r,
|
|
64
|
+
balance: m.reduce((i, c) => u(r.erc20TokenAddress, c.tokenAddress) ? i + c.amount : i, 0n),
|
|
65
|
+
timestamp: "0",
|
|
66
|
+
nfts: []
|
|
67
|
+
})), s.forEach((r) => {
|
|
68
|
+
a.set(r.token.erc20TokenAddress.toLowerCase(), r);
|
|
69
|
+
});
|
|
70
|
+
}), a;
|
|
71
|
+
}, ie = (e, p, o) => {
|
|
72
|
+
const { userKeys: t, approvals: n } = e, s = y.utils.getAddress(p), a = n.get(s) ?? [], m = t.getInHinkalAddress(s);
|
|
73
|
+
return a.reduce((r, i) => u(i.tokenAddress, o) && i.inHinkalAddress === m ? r + i.amount : r, 0n);
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
ne as getApprovedBalance,
|
|
77
|
+
g as getApprovedUtxos,
|
|
78
|
+
se as getApprovedUtxosForToken,
|
|
79
|
+
ie as getMyApprovalAmountForInteraction
|
|
80
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("../../../data-structures/crypto-keys/keys.cjs"),C=require("../../../data-structures/utxo/Utxo.cjs"),v=require("../../utils/upToDateState.cjs"),O=require("../../utils/cacheFunctions.cjs"),b=require("axios"),q=require("../../snarkjs/constant.cjs"),m=require("../../utils/encryptInputForEnclave.cjs"),f=require("ethers"),N=require("../../utils/caseInsensitive.utils.cjs"),w=require("../../utils/encodeTokenWithId.cjs"),S=async(t,r,n)=>await t.utxoUtils.buildBatchProcess(r,n),B=async(t,r)=>{const n=t.getCurrentChainId(),o=r.getShieldedPrivateKey(),{privateKey:u,publicKey:c}=K.UserKeys.getEncryptionKeyPair(o),a=f.ethers.utils.solidityPack(["uint256","uint256","uint256"],[c,u,o]),e=f.ethers.utils.arrayify(a),{keyCiphertext:p,inputCiphertext:h}=await m.makeEnclaveHandshakeAndEncryptUint8Array(e),x=(await b.post(`${q.ENCLAVE_EC2_URL}/decrypt-utxos`,{chainId:n,input:h,key:p})).data;return{utxos:x.utxos.map(l=>new C.Utxo({...l,amount:BigInt(l.amount),randomization:l.randomization?BigInt(l.randomization):void 0,shieldedPrivateKey:o})),encryptedOutputs:x.encryptedOutputs,lastOutput:x.lastOutput}},E=async(t,r,n,o)=>{let u=[],c;if(o){const{utxos:a,encryptedOutputs:e,lastOutput:p}=await B(t,n);u=a,c={encryptedOutputs:e,lastOutput:p}}else u=await S(t,r,n);return{utxos:u,cacheOverride:c}},F=t=>{if(Array.isArray(t))return t;if(t!==void 0)return[t]},H=async(t,r,n)=>await t.utxoUtils.batchFilterUtxosWithNullifier(r,n),z=(t,r,n,o,u,c)=>{for(t.sort((a,e)=>a.amount<=e.amount?1:-1);t.length<r||t.length>r&&t.length<6;)if(t.push(new C.Utxo({amount:0n,erc20TokenAddress:u,shieldedPrivateKey:o,tokenId:c})),n)for(;t.length>6;)t.splice(t.length-1)},k=async({hinkal:t,chainId:r=void 0,passedShieldedPublicKey:n=void 0,ethAddress:o=void 0,resetCacheBefore:u=!1,allowRemoteDecryption:c=!1})=>{if(!t.getCurrentChainId||!t.getSelectedNetwork())return console.log("returning empty balance"),{inputUtxos:[]};const a=o??await t.getEthereumAddress(),e=r??t.getCurrentChainId(),p=n??t.userKeys.getShieldedPublicKey(),{encryptedOutputs:h,nullifiers:x,userKeys:l}=t,U=Array.from(h);u&&O.resetCache(t,e,p);let{encryptedOutputs:d,lastOutput:s}=O.getHinkalCache(t,e,p),i=[...d],g=[];await v.checkChainOrAddressNotUpdated(t,e,a);let y=U.findIndex(A=>A.value===s);const T=d.length===0&&c;if(y>-1||d.length===0&&!c&&!t.areMerkleTreeUpdatesDisabled()){y+=1;const A=U.slice(y);({lastOutput:s,additionalEncryptedOutputs:g}=await t.utxoUtils.batchProcess(A,s,l)),i=[...d,...g],await v.checkChainOrAddressNotUpdated(t,e,a),O.setHinkalCache({lastOutput:s,encryptedOutputs:i},t,e,p)}await v.checkChainOrAddressNotUpdated(t,e,a);const{utxos:P,cacheOverride:I}=await E(t,i,l,T);return await v.checkChainOrAddressNotUpdated(t,e,a),I&&O.setHinkalCache(I,t,e,p),{inputUtxos:await H(t,P,x)}},L=async({hinkal:t,tokenWithId:r,minInput:n=2,sliceIfMore6:o=!0,chainId:u=void 0,passedShieldedPrivateKey:c=void 0,passedShieldedPublicKey:a=void 0,ethAddress:e=void 0,resetCacheBefore:p=!1,ensuredTokensWithId:h})=>{const x=c??t.userKeys.getShieldedPrivateKey(),{inputUtxos:l}=await k({hinkal:t,minInput:n,sliceIfMore6:o,chainId:u,passedShieldedPrivateKey:c,passedShieldedPublicKey:a,ethAddress:e,resetCacheBefore:p}),U=F(r),d=new Map;l.forEach(s=>{if(U&&!U.some(y=>N.caseInsensitiveEqual(y.erc20TokenAddress,s.erc20TokenAddress)&&y.tokenId===s.tokenId))return;const i=w.encodeTokenWithId({erc20TokenAddress:s.erc20TokenAddress,tokenId:s.tokenId}),g=d.get(i)??[];d.set(i,[...g,s])}),h?.forEach(s=>{const i=w.encodeTokenWithId({erc20TokenAddress:s.erc20TokenAddress,tokenId:s.tokenId});d.set(i,d.get(i)??[])});for(const[s,i]of d){const g=s.split("-")[0],y=Number(s.split("-")[1]);z(i,n,o,x,g,y)}return d};exports.getInputUtxoAndBalance=k;exports.getInputUtxoAndBalancePerToken=L;exports.getInputUtxosFromEncryptedOutputs=E;
|
|
@@ -2,14 +2,26 @@ import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
|
2
2
|
import { UserKeys } from '../../../data-structures/crypto-keys/keys';
|
|
3
3
|
import { Utxo } from '../../../data-structures/utxo/Utxo';
|
|
4
4
|
import { EncryptedOutputWithSign } from '../../../types/commitments.types';
|
|
5
|
+
import { HinkalCacheInterface } from '../../utils/cacheFunctions';
|
|
6
|
+
import { type TokenWithId } from '../../../types/token-with-id.types';
|
|
5
7
|
interface IGetInputUtxos {
|
|
6
8
|
hinkal: IHinkal;
|
|
7
|
-
|
|
9
|
+
tokenWithId?: TokenWithId | TokenWithId[];
|
|
8
10
|
minInput?: number;
|
|
9
11
|
sliceIfMore6?: boolean;
|
|
10
12
|
tokenId?: number;
|
|
13
|
+
chainId?: number;
|
|
14
|
+
passedShieldedPrivateKey?: string;
|
|
15
|
+
passedShieldedPublicKey?: string;
|
|
16
|
+
ethAddress?: string;
|
|
17
|
+
resetCacheBefore?: boolean;
|
|
18
|
+
allowRemoteDecryption?: boolean;
|
|
19
|
+
ensuredTokensWithId?: TokenWithId[];
|
|
11
20
|
}
|
|
12
|
-
export declare const getInputUtxosFromEncryptedOutputs: (hinkal: IHinkal, encryptedOutputs: EncryptedOutputWithSign[], userKeys: UserKeys,
|
|
21
|
+
export declare const getInputUtxosFromEncryptedOutputs: (hinkal: IHinkal, encryptedOutputs: EncryptedOutputWithSign[], userKeys: UserKeys, decryptRemotely?: boolean) => Promise<{
|
|
22
|
+
utxos: Utxo[];
|
|
23
|
+
cacheOverride?: HinkalCacheInterface | undefined;
|
|
24
|
+
}>;
|
|
13
25
|
/**
|
|
14
26
|
*
|
|
15
27
|
* @param hinkal instance of the hinkal class
|
|
@@ -18,7 +30,8 @@ export declare const getInputUtxosFromEncryptedOutputs: (hinkal: IHinkal, encryp
|
|
|
18
30
|
* @param sliceIfMore6 max upper bound on input UTXOs controller
|
|
19
31
|
* @returns UTXOs for particular erc20 token address
|
|
20
32
|
*/
|
|
21
|
-
export declare const getInputUtxoAndBalance: ({ hinkal,
|
|
33
|
+
export declare const getInputUtxoAndBalance: ({ hinkal, chainId, passedShieldedPublicKey, ethAddress, resetCacheBefore, allowRemoteDecryption, }: IGetInputUtxos) => Promise<{
|
|
22
34
|
inputUtxos: Utxo[];
|
|
23
35
|
}>;
|
|
36
|
+
export declare const getInputUtxoAndBalancePerToken: ({ hinkal, tokenWithId, minInput, sliceIfMore6, chainId, passedShieldedPrivateKey, passedShieldedPublicKey, ethAddress, resetCacheBefore, ensuredTokensWithId, }: IGetInputUtxos) => Promise<Map<string, Utxo[]>>;
|
|
24
37
|
export {};
|
|
@@ -1,62 +1,144 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { UserKeys as K } from "../../../data-structures/crypto-keys/keys.mjs";
|
|
2
|
+
import { Utxo as I } from "../../../data-structures/utxo/Utxo.mjs";
|
|
3
|
+
import { checkChainOrAddressNotUpdated as v } from "../../utils/upToDateState.mjs";
|
|
4
|
+
import { resetCache as P, getHinkalCache as T, setHinkalCache as O } from "../../utils/cacheFunctions.mjs";
|
|
5
|
+
import b from "axios";
|
|
6
|
+
import { ENCLAVE_EC2_URL as k } from "../../snarkjs/constant.mjs";
|
|
7
|
+
import { makeEnclaveHandshakeAndEncryptUint8Array as B } from "../../utils/encryptInputForEnclave.mjs";
|
|
8
|
+
import { ethers as U } from "ethers";
|
|
9
|
+
import { caseInsensitiveEqual as N } from "../../utils/caseInsensitive.utils.mjs";
|
|
10
|
+
import { encodeTokenWithId as A } from "../../utils/encodeTokenWithId.mjs";
|
|
11
|
+
const S = async (t, r, o) => await t.utxoUtils.buildBatchProcess(r, o), z = async (t, r) => {
|
|
12
|
+
const o = t.getCurrentChainId(), n = r.getShieldedPrivateKey(), { privateKey: u, publicKey: a } = K.getEncryptionKeyPair(n), c = U.utils.solidityPack(
|
|
13
|
+
["uint256", "uint256", "uint256"],
|
|
14
|
+
[a, u, n]
|
|
15
|
+
), e = U.utils.arrayify(c), { keyCiphertext: p, inputCiphertext: g } = await B(e), f = (await b.post(`${k}/decrypt-utxos`, {
|
|
16
|
+
chainId: o,
|
|
17
|
+
input: g,
|
|
18
|
+
key: p
|
|
19
|
+
})).data;
|
|
20
|
+
return {
|
|
21
|
+
utxos: f.utxos.map(
|
|
22
|
+
(l) => new I({
|
|
23
|
+
...l,
|
|
24
|
+
amount: BigInt(l.amount),
|
|
25
|
+
randomization: l.randomization ? BigInt(l.randomization) : void 0,
|
|
26
|
+
shieldedPrivateKey: n
|
|
27
|
+
})
|
|
28
|
+
),
|
|
29
|
+
encryptedOutputs: f.encryptedOutputs,
|
|
30
|
+
lastOutput: f.lastOutput
|
|
31
|
+
};
|
|
32
|
+
}, H = async (t, r, o, n) => {
|
|
33
|
+
let u = [], a;
|
|
34
|
+
if (n) {
|
|
35
|
+
const { utxos: c, encryptedOutputs: e, lastOutput: p } = await z(t, o);
|
|
36
|
+
u = c, a = {
|
|
37
|
+
encryptedOutputs: e,
|
|
38
|
+
lastOutput: p
|
|
39
|
+
};
|
|
40
|
+
} else
|
|
41
|
+
u = await S(t, r, o);
|
|
12
42
|
return {
|
|
13
|
-
|
|
43
|
+
utxos: u,
|
|
44
|
+
cacheOverride: a
|
|
14
45
|
};
|
|
15
|
-
},
|
|
46
|
+
}, L = (t) => {
|
|
47
|
+
if (Array.isArray(t))
|
|
48
|
+
return t;
|
|
49
|
+
if (t !== void 0)
|
|
50
|
+
return [t];
|
|
51
|
+
}, R = async (t, r, o) => await t.utxoUtils.batchFilterUtxosWithNullifier(r, o), F = (t, r, o, n, u, a) => {
|
|
52
|
+
for (t.sort((c, e) => c.amount <= e.amount ? 1 : -1); t.length < r || t.length > r && t.length < 6; )
|
|
53
|
+
if (t.push(new I({ amount: 0n, erc20TokenAddress: u, shieldedPrivateKey: n, tokenId: a })), o)
|
|
54
|
+
for (; t.length > 6; )
|
|
55
|
+
t.splice(t.length - 1);
|
|
56
|
+
}, _ = async ({
|
|
16
57
|
hinkal: t,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
58
|
+
chainId: r = void 0,
|
|
59
|
+
passedShieldedPublicKey: o = void 0,
|
|
60
|
+
ethAddress: n = void 0,
|
|
61
|
+
resetCacheBefore: u = !1,
|
|
62
|
+
allowRemoteDecryption: a = !1
|
|
21
63
|
}) => {
|
|
22
64
|
if (!t.getCurrentChainId || !t.getSelectedNetwork())
|
|
23
|
-
return { inputUtxos: [] };
|
|
24
|
-
const { encryptedOutputs:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
65
|
+
return console.log("returning empty balance"), { inputUtxos: [] };
|
|
66
|
+
const c = n ?? await t.getEthereumAddress(), e = r ?? t.getCurrentChainId(), p = o ?? t.userKeys.getShieldedPublicKey(), { encryptedOutputs: g, nullifiers: f, userKeys: l } = t, m = Array.from(g);
|
|
67
|
+
u && P(t, e, p);
|
|
68
|
+
let { encryptedOutputs: d, lastOutput: s } = T(
|
|
69
|
+
t,
|
|
70
|
+
e,
|
|
71
|
+
p
|
|
72
|
+
), i = [...d], x = [];
|
|
73
|
+
await v(t, e, c);
|
|
74
|
+
let y = m.findIndex((w) => w.value === s);
|
|
75
|
+
const E = d.length === 0 && a;
|
|
76
|
+
if (y > -1 || d.length === 0 && !a && !t.areMerkleTreeUpdatesDisabled()) {
|
|
77
|
+
y += 1;
|
|
78
|
+
const w = m.slice(y);
|
|
79
|
+
({ lastOutput: s, additionalEncryptedOutputs: x } = await t.utxoUtils.batchProcess(
|
|
80
|
+
w,
|
|
81
|
+
s,
|
|
82
|
+
l
|
|
83
|
+
)), i = [...d, ...x], await v(t, e, c), O(
|
|
34
84
|
{
|
|
35
|
-
lastOutput:
|
|
36
|
-
encryptedOutputs:
|
|
85
|
+
lastOutput: s,
|
|
86
|
+
encryptedOutputs: i
|
|
37
87
|
},
|
|
38
|
-
t
|
|
88
|
+
t,
|
|
89
|
+
e,
|
|
90
|
+
p
|
|
39
91
|
);
|
|
40
92
|
}
|
|
41
|
-
|
|
93
|
+
await v(t, e, c);
|
|
94
|
+
const { utxos: C, cacheOverride: h } = await H(
|
|
42
95
|
t,
|
|
43
|
-
a,
|
|
44
|
-
e,
|
|
45
96
|
i,
|
|
46
|
-
n
|
|
47
|
-
);
|
|
48
|
-
return await m(
|
|
49
|
-
t,
|
|
50
|
-
w,
|
|
51
|
-
o,
|
|
52
97
|
l,
|
|
53
|
-
|
|
54
|
-
p,
|
|
55
|
-
i,
|
|
56
|
-
n
|
|
98
|
+
E
|
|
57
99
|
);
|
|
100
|
+
return await v(t, e, c), h && O(h, t, e, p), { inputUtxos: await R(t, C, f) };
|
|
101
|
+
}, Y = async ({
|
|
102
|
+
hinkal: t,
|
|
103
|
+
tokenWithId: r,
|
|
104
|
+
minInput: o = 2,
|
|
105
|
+
sliceIfMore6: n = !0,
|
|
106
|
+
chainId: u = void 0,
|
|
107
|
+
passedShieldedPrivateKey: a = void 0,
|
|
108
|
+
passedShieldedPublicKey: c = void 0,
|
|
109
|
+
ethAddress: e = void 0,
|
|
110
|
+
resetCacheBefore: p = !1,
|
|
111
|
+
ensuredTokensWithId: g
|
|
112
|
+
}) => {
|
|
113
|
+
const f = a ?? t.userKeys.getShieldedPrivateKey(), { inputUtxos: l } = await _({
|
|
114
|
+
hinkal: t,
|
|
115
|
+
minInput: o,
|
|
116
|
+
sliceIfMore6: n,
|
|
117
|
+
chainId: u,
|
|
118
|
+
passedShieldedPrivateKey: a,
|
|
119
|
+
passedShieldedPublicKey: c,
|
|
120
|
+
ethAddress: e,
|
|
121
|
+
resetCacheBefore: p
|
|
122
|
+
}), m = L(r), d = /* @__PURE__ */ new Map();
|
|
123
|
+
l.forEach((s) => {
|
|
124
|
+
if (m && !m.some(
|
|
125
|
+
(y) => N(y.erc20TokenAddress, s.erc20TokenAddress) && y.tokenId === s.tokenId
|
|
126
|
+
))
|
|
127
|
+
return;
|
|
128
|
+
const i = A({ erc20TokenAddress: s.erc20TokenAddress, tokenId: s.tokenId }), x = d.get(i) ?? [];
|
|
129
|
+
d.set(i, [...x, s]);
|
|
130
|
+
}), g?.forEach((s) => {
|
|
131
|
+
const i = A({ erc20TokenAddress: s.erc20TokenAddress, tokenId: s.tokenId });
|
|
132
|
+
d.set(i, d.get(i) ?? []);
|
|
133
|
+
});
|
|
134
|
+
for (const [s, i] of d) {
|
|
135
|
+
const x = s.split("-")[0], y = Number(s.split("-")[1]);
|
|
136
|
+
F(i, o, n, f, x, y);
|
|
137
|
+
}
|
|
138
|
+
return d;
|
|
58
139
|
};
|
|
59
140
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
141
|
+
_ as getInputUtxoAndBalance,
|
|
142
|
+
Y as getInputUtxoAndBalancePerToken,
|
|
143
|
+
H as getInputUtxosFromEncryptedOutputs
|
|
62
144
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
Please try again with ${
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("async-mutex"),x=require("../../utils/erc20tokenFunctions.cjs"),p=require("../../utils/caseInsensitive.utils.cjs"),U=require("../../utils/volatile-patcher.utils.cjs"),v=require("../../../data-structures/utxo/Utxo.cjs"),A=require("../etherFunctions.cjs"),E=require("../../../error-handling/customErrors/ErrorWithAmount.cjs");require("../../../error-handling/error-codes.constants.cjs");const w=require("./getInputUtxoAndBalance.cjs"),y=require("../../../data-structures/TokenDBs/PrivateTokensDB.cjs"),h=require("../../../constants/vite.constants.cjs"),I=require("../../utils/encodeTokenWithId.cjs"),S=new P.Mutex,B=async(u,o,f,a,i,k=!1,T,d=!1)=>S.runExclusive(async()=>{const{inputUtxos:s}=await w.getInputUtxoAndBalance({hinkal:u,sliceIfMore6:!1,chainId:o,passedShieldedPrivateKey:f,passedShieldedPublicKey:a,ethAddress:i,resetCacheBefore:k,allowRemoteDecryption:T});d&&h.isExtension&&await y.privateTokensDB.fetchAndUpdatePrivateTokens(s.map(e=>e.erc20TokenAddress),o,i);const g=h.isExtension?await y.privateTokensDB.getPrivateTokens(o,i):x.getErc20TokensForChain(o);h.isExtension||await U.patchRegistry(o);const l=g.map(e=>({token:e,balance:s.reduce((t,r)=>{const c=e.erc20TokenAddress;return p.caseInsensitiveEqual(c,r.erc20TokenAddress)?t+r.amount:t},0n),timestamp:s.filter(t=>p.caseInsensitiveEqual(t.erc20TokenAddress,e.erc20TokenAddress))[0]?.timeStamp,nfts:s.filter(t=>p.caseInsensitiveEqual(t.erc20TokenAddress,e.erc20TokenAddress)&&t.tokenId!==0).map(t=>({tokenId:t.tokenId,timestamp:t.timeStamp}))})),n=new Map;return l.forEach(e=>{n.set(e.token.erc20TokenAddress.toLowerCase(),e)}),n}),M=async(u,o,f,a=6,i=o.map(()=>0),k=!1)=>{const{userKeys:T}=u,d=[],s=[],g=await w.getInputUtxoAndBalancePerToken({hinkal:u,sliceIfMore6:!1,ensuredTokensWithId:o.map((n,e)=>({erc20TokenAddress:o[e],tokenId:i[e]})),allowRemoteDecryption:!1});let l=0;for(let n=0;n<o.length;n+=1)if(k===!1){const e=g.get(I.encodeTokenWithId({erc20TokenAddress:o[n],tokenId:i[n]}))??[];if(!e)throw new Error("Missing utxos for token");l=Math.max(e.length,l),s.push(e)}else s.push([]);return l===2?s:(s.forEach((n,e)=>{if(n.length>a){const t=n.slice(0,a),r=t.reduce((c,m)=>c+m.amount,0n);if(f[e]<0n&&r<-f[e]){const c=x.getERC20Token(o[e],u.getCurrentChainId()),m=Number(A.getAmountWithPrecision(r,c,2)),q=`Unfortunately your transaction did not go through due to UTXOs limitations.
|
|
2
|
+
Please try again with ${c.symbol}`;throw new E.ErrorWithAmount(m,q)}d.push(t)}else if(n.length<=a){const t=[...n];let r=a-n.length;for(;r>0;)r-=1,t.push(new v.Utxo({amount:0n,erc20TokenAddress:o[e],shieldedPrivateKey:T.getShieldedPrivateKey(),tokenId:i[e]}));d.push(t)}}),d)};exports.addPaddingToUtxos=M;exports.getShieldedBalance=B;
|
|
@@ -6,7 +6,7 @@ import { IHinkal } from '../../../data-structures/Hinkal/IHinkal';
|
|
|
6
6
|
* @param UserKeys to access user's encryption keys
|
|
7
7
|
* @returns shielded balance
|
|
8
8
|
*/
|
|
9
|
-
export declare const getShieldedBalance: (hinkal: IHinkal) => Promise<TokenBalance
|
|
9
|
+
export declare const getShieldedBalance: (hinkal: IHinkal, chainId: number, passedShieldedPrivateKey: string, passedShieldedPublicKey: string, ethAddress: string, resetCacheBefore?: boolean, allowRemoteDecryption?: boolean, updateTokensListBefore?: boolean) => Promise<Map<string, TokenBalance>>;
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
* @param hinkal hinkal instance to get userKeys
|