@hinkal/common 0.2.12 → 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 +9 -3
- package/API/API.mjs +44 -34
- 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 +6 -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/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +0 -4
- package/API/kycCalls.mjs +11 -15
- package/API/rewardsPointsCalls.d.ts +0 -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/README.md +0 -61
- 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 +26 -38
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +108 -108
- 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-localhost.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-localhost.json.mjs +1652 -829
- package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-optimism.json.mjs +9707 -3957
- 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/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.d.ts +0 -1
- package/constants/rewards.constants.mjs +14 -13
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +8 -3
- package/constants/server.constants.mjs +16 -11
- package/constants/token-data/ERC20Registry.cjs +1 -1
- package/constants/token-data/ERC20Registry.mjs +10 -9
- package/constants/token-data/arbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistry.json.mjs +88 -88
- package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistryFixed.json.mjs +78 -78
- package/constants/token-data/avalancheRegistry.json.cjs +1 -1
- package/constants/token-data/avalancheRegistry.json.mjs +49 -49
- package/constants/token-data/avalancheRegistryFixed.json.cjs +1 -1
- package/constants/token-data/avalancheRegistryFixed.json.mjs +49 -49
- package/constants/token-data/baseRegistry.json.cjs +1 -1
- package/constants/token-data/baseRegistry.json.mjs +32 -32
- package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
- package/constants/token-data/baseRegistryFixed.json.mjs +29 -29
- package/constants/token-data/bnbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/bnbMainnetRegistry.json.mjs +65 -65
- package/constants/token-data/bnbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/bnbMainnetRegistryFixed.json.mjs +65 -65
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +227 -227
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +191 -191
- package/constants/token-data/index.d.ts +91 -0
- package/constants/token-data/localhostRegistry.json.cjs +1 -1
- package/constants/token-data/localhostRegistry.json.mjs +294 -277
- package/constants/token-data/optimismRegistry.json.cjs +1 -1
- package/constants/token-data/optimismRegistry.json.mjs +702 -182
- package/constants/token-data/optimismRegistryFixed.json.cjs +1 -1
- package/constants/token-data/optimismRegistryFixed.json.mjs +678 -175
- package/constants/token-data/polygonRegistry.json.cjs +1 -1
- package/constants/token-data/polygonRegistry.json.mjs +109 -109
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +101 -101
- 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 +46 -21
- package/data-structures/Hinkal/Hinkal.mjs +260 -92
- package/data-structures/Hinkal/IHinkal.d.ts +35 -11
- package/data-structures/Hinkal/hinkalActionBeefy.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionBeefy.mjs +5 -4
- package/data-structures/Hinkal/hinkalActionConvex.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionConvex.mjs +4 -3
- package/data-structures/Hinkal/hinkalActionCurve.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionCurve.mjs +5 -4
- 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 +9 -8
- package/data-structures/Hinkal/hinkalActionPendle.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendle.mjs +17 -16
- package/data-structures/Hinkal/hinkalActionPendleLP.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendleLP.mjs +14 -12
- 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.mjs +12 -9
- package/data-structures/Hinkal/hinkalActionVolatile.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionVolatile.mjs +25 -21
- 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 +96 -71
- package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +1 -1
- package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +5 -11
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +6 -18
- 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 -38
- 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 +68 -60
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.d.ts +3 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +76 -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 +34 -46
- 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 +4 -1
- package/data-structures/merkle-tree/MerkleTree.mjs +66 -65
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs +1 -1
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.ts +1 -1
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs +10 -6
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +2 -0
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +6 -10
- 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 +6 -10
- package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +6 -10
- 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 +6 -5
- package/data-structures/transactions-manager/TransactionsManager.mjs +95 -100
- 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 +20 -3
- package/error-handling/error-codes.constants.mjs +139 -126
- 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/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 -28
- 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 +17 -4
- package/functions/private-wallet/emporium.helpers.mjs +119 -12
- 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 +2 -0
- package/functions/private-wallet/opProducer.cjs +1 -1
- package/functions/private-wallet/opProducer.mjs +1 -1
- package/functions/private-wallet/smartContractWalletCalculator.cjs +1 -0
- package/functions/private-wallet/smartContractWalletCalculator.d.ts +5 -0
- package/functions/private-wallet/smartContractWalletCalculator.mjs +25 -0
- package/functions/protocols/convex.protocols.cjs +1 -1
- package/functions/protocols/convex.protocols.mjs +10 -8
- package/functions/protocols/pendle.helpers.cjs +1 -1
- package/functions/protocols/pendle.helpers.mjs +16 -12
- 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 -2
- package/functions/snarkjs/constant.mjs +313 -93
- 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 +141 -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 -4
- package/functions/snarkjs/generateZkProofEnclave.cjs +1 -1
- package/functions/snarkjs/generateZkProofEnclave.d.ts +2 -1
- package/functions/snarkjs/generateZkProofEnclave.mjs +22 -29
- package/functions/snarkjs/generateZkProofSelf.cjs +1 -1
- package/functions/snarkjs/generateZkProofSelf.d.ts +2 -2
- package/functions/snarkjs/generateZkProofSelf.mjs +10 -10
- 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 +31 -9
- package/functions/utils/cacheDevice.utils.cjs +1 -1
- package/functions/utils/cacheDevice.utils.mjs +5 -3
- 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 +22 -14
- package/functions/utils/evmNetworkFunctions.cjs +1 -1
- package/functions/utils/evmNetworkFunctions.mjs +6 -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 +3 -0
- package/functions/utils/string.utils.mjs +31 -7
- 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/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 +79 -82
- 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 +19 -17
- 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 +29 -42
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
- package/functions/web3/functionCalls/transactCallRelayer.mjs +26 -5
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +6 -3
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +6 -3
- 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.mjs +6 -3
- package/index.cjs +1 -1
- package/index.mjs +756 -612
- package/package.json +6 -2
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +7 -3
- package/providers/EthersProviderAdapter.mjs +31 -11
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +3 -1
- package/providers/WagmiProviderAdapter.mjs +12 -4
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +17 -11
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +17 -11
- 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 +66 -62
- 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 +43 -5
- package/types/hinkal.types.mjs +37 -13
- package/types/index.d.ts +9 -0
- package/types/rewards.types.cjs +1 -1
- package/types/rewards.types.d.ts +3 -4
- package/types/rewards.types.mjs +12 -12
- 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/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 -31
- 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,68 +1,76 @@
|
|
|
1
|
-
import { preProcessing as
|
|
2
|
-
import { UserKeys as
|
|
3
|
-
import { Utxo as
|
|
4
|
-
import { decryptUtxoConstructorArgs as
|
|
5
|
-
import { decodeUtxoConstructorArgs as
|
|
6
|
-
import { WorkerProxy as
|
|
7
|
-
import { UtxoWorkerActionType as
|
|
8
|
-
const
|
|
9
|
-
const { utxos:
|
|
10
|
-
const
|
|
11
|
-
return !
|
|
1
|
+
import { preProcessing as u } from "../../crypto/preProcessing.mjs";
|
|
2
|
+
import { stealthPairCacheDevice as p, stealthAddressCacheDevice as y, UserKeys as h } from "../../data-structures/crypto-keys/keys.mjs";
|
|
3
|
+
import { Utxo as f } from "../../data-structures/utxo/Utxo.mjs";
|
|
4
|
+
import { decryptUtxoConstructorArgs as m, decryptUtxo as g } from "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
|
|
5
|
+
import { decodeUtxoConstructorArgs as x, checkUtxoSignature as U } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
|
|
6
|
+
import { WorkerProxy as T } from "../workerProxy.mjs";
|
|
7
|
+
import { UtxoWorkerActionType as d } from "./utxoWorker.types.mjs";
|
|
8
|
+
const i = new T(), w = async ({ data: e }) => {
|
|
9
|
+
const { utxos: r, nullifiers: s } = e, o = r.filter((t) => {
|
|
10
|
+
const n = new f(t);
|
|
11
|
+
return !s.has(n.getNullifier());
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
i.postMessageToMainThread({
|
|
14
|
+
utxoConstructors: o,
|
|
15
|
+
stealthPairCache: p.serialize(),
|
|
16
|
+
stealthAddressCache: y.serialize()
|
|
17
|
+
});
|
|
18
|
+
}, P = async ({ data: e }) => {
|
|
19
|
+
const r = new h(e.signature), s = r.getShieldedPrivateKey(), o = e.encryptedOutputs.map((t) => {
|
|
16
20
|
try {
|
|
17
|
-
return
|
|
21
|
+
return t.isPositive ? m(Buffer.from(t.value.slice(2), "hex"), r) : x(t.value, s);
|
|
18
22
|
} catch {
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
21
|
-
}).filter((
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
let { lastOutput:
|
|
26
|
-
const
|
|
27
|
-
for (let
|
|
28
|
-
const c =
|
|
29
|
-
if (
|
|
25
|
+
}).filter((t) => t !== void 0 && t.amount !== 0n);
|
|
26
|
+
i.postMessageToMainThread(o);
|
|
27
|
+
}, v = async ({ data: e }) => {
|
|
28
|
+
const r = new h(e.signature), s = [], { encryptedOutputs: o } = e;
|
|
29
|
+
let { lastOutput: t } = e;
|
|
30
|
+
const n = r.getShieldedPrivateKey();
|
|
31
|
+
for (let l = 0; l < o.length; l += 1) {
|
|
32
|
+
const c = o[l];
|
|
33
|
+
if (t = c.value, c.isPositive)
|
|
30
34
|
try {
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
35
|
+
const a = g(Buffer.from(t.slice(2), "hex"), r);
|
|
36
|
+
if (!a.erc20TokenAddress || !a.amount || !a.stealthAddress)
|
|
33
37
|
throw Error("bruh");
|
|
34
|
-
|
|
38
|
+
s.push(c);
|
|
35
39
|
} catch {
|
|
36
40
|
}
|
|
37
41
|
else
|
|
38
42
|
try {
|
|
39
|
-
|
|
43
|
+
U(t, n) && s.push(c);
|
|
40
44
|
} catch {
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
i.postMessageToMainThread({ additionalEncryptedOutputs: s, lastOutput: t });
|
|
48
|
+
}, k = async (e) => {
|
|
49
|
+
try {
|
|
50
|
+
await u();
|
|
51
|
+
const { type: r } = e.payload;
|
|
52
|
+
switch (r) {
|
|
53
|
+
case d.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
|
|
54
|
+
await w(e.payload);
|
|
55
|
+
return;
|
|
56
|
+
case d.BUILD_UTXOS:
|
|
57
|
+
await P(e.payload);
|
|
58
|
+
return;
|
|
59
|
+
case d.DECIPHER_OUTPUTS:
|
|
60
|
+
await v(e.payload);
|
|
61
|
+
return;
|
|
62
|
+
default:
|
|
63
|
+
throw Error(`Unknown worker message type ${r}`);
|
|
64
|
+
}
|
|
65
|
+
} catch (r) {
|
|
66
|
+
console.error(r), i.postErrorToMainThread(r);
|
|
59
67
|
}
|
|
60
68
|
};
|
|
61
|
-
|
|
69
|
+
i.attachWorkerSideOnMessage(k);
|
|
62
70
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
i as default,
|
|
72
|
+
P as handleBuildUtxosMessage,
|
|
73
|
+
v as handleDecipherMessage,
|
|
74
|
+
w as handleFilterUtxosWithNullifier,
|
|
75
|
+
k as onWorkerMessage
|
|
68
76
|
};
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.2.13/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.2.13/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.2.13/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
exports.getWorkerViteURL = n;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.2.13/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.2.13/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.2.13/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
export { n as getWorkerViteURL };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../constants/vite.constants.cjs"),r=require("./worker.registry.cjs");class t{constructor(){}static resolveWorkerURL=async e=>{const{getWorkerViteURL:s}=await Promise.resolve().then(()=>require("./viteWorkerURL.constant.cjs"));return(await s())[e]};static createWorker=async e=>{if(i.isNode){let o;return e===r.WorkerVariant.SnarkJS?o=await Promise.resolve().then(()=>require("./snarkjsWorker/snarkjsWorkerLogic.cjs")):e===r.WorkerVariant.ZKProof?o=await Promise.resolve().then(()=>require("./zkProofWorker/zkProofWorkerLogic.cjs")):e===r.WorkerVariant.UTXO&&(o=await Promise.resolve().then(()=>require("./utxoWorker/utxoWorkerLogic.cjs"))),o.default}const s=await t.resolveWorkerURL(e);return new Worker(s,{type:"module"})};static getWebWorker(e){switch(e){case r.WorkerVariant.ZKProof:return t.createWorker(e);case r.WorkerVariant.SnarkJS:return t.createWorker(e);case r.WorkerVariant.UTXO:return t.createWorker(e);default:throw Error(`Unknown worker type: ${e}`)}}}exports.WorkerFactory=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../constants/vite.constants.cjs"),r=require("./worker.registry.cjs");class t{constructor(){}static resolveWorkerURL=async e=>{const{getWorkerViteURL:s}=await Promise.resolve().then(()=>require("./viteWorkerURL.constant.cjs"));return(await s())[e]};static createWorker=async e=>{if(i.isNode||i.isSandbox){let o;return e===r.WorkerVariant.SnarkJS?o=await Promise.resolve().then(()=>require("./snarkjsWorker/snarkjsWorkerLogic.cjs")):e===r.WorkerVariant.ZKProof?o=await Promise.resolve().then(()=>require("./zkProofWorker/zkProofWorkerLogic.cjs")):e===r.WorkerVariant.UTXO&&(o=await Promise.resolve().then(()=>require("./utxoWorker/utxoWorkerLogic.cjs"))),o.default}const s=await t.resolveWorkerURL(e);return new Worker(s,{type:"module"})};static getWebWorker(e){switch(e){case r.WorkerVariant.ZKProof:return t.createWorker(e);case r.WorkerVariant.SnarkJS:return t.createWorker(e);case r.WorkerVariant.UTXO:return t.createWorker(e);default:throw Error(`Unknown worker type: ${e}`)}}}exports.WorkerFactory=t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNode as i } from "../constants/vite.constants.mjs";
|
|
1
|
+
import { isNode as i, isSandbox as c } from "../constants/vite.constants.mjs";
|
|
2
2
|
import { WorkerVariant as r } from "./worker.registry.mjs";
|
|
3
3
|
class o {
|
|
4
4
|
constructor() {
|
|
@@ -8,7 +8,7 @@ class o {
|
|
|
8
8
|
return (await s())[e];
|
|
9
9
|
};
|
|
10
10
|
static createWorker = async (e) => {
|
|
11
|
-
if (i) {
|
|
11
|
+
if (i || c) {
|
|
12
12
|
let t;
|
|
13
13
|
return e === r.SnarkJS ? t = await import(
|
|
14
14
|
/* @vite-ignore */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{isNode=!1;onmessage=null;_eventEmitter;get eventEmitter(){if(this._eventEmitter)return this._eventEmitter;const e=require("events");
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{isNode=!1;isSandbox=!1;onmessage=null;onerror=null;_eventEmitter;get eventEmitter(){if(this._eventEmitter)return this._eventEmitter;if(this.isNode){const e=require("events");this._eventEmitter=new e}else this._eventEmitter=new EventTarget;return this._eventEmitter}constructor(){this.isNode=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,this.isSandbox=typeof window<"u"&&window.origin==="null"}terminate(){}postMessage(e){this.isNode?this.eventEmitter.emit("message",e):this.isSandbox?this.eventEmitter?.dispatchEvent(new CustomEvent("worker-message",{detail:e})):postMessage(e)}postMessageToMainThread(e){const t={data:e};this.onmessage?this.onmessage(t):postMessage(e)}postErrorToMainThread(e){const t={data:{error:e}};this.onerror?this.onerror(t):postMessage(e)}attachWorkerSideOnMessage(e){this.isNode?this.eventEmitter.on("message",t=>{e(t)}):this.isSandbox&&this.eventEmitter.addEventListener("worker-message",t=>{e(t.detail)})}}exports.WorkerProxy=s;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class WorkerProxy {
|
|
12
12
|
private isNode;
|
|
13
|
+
private isSandbox;
|
|
13
14
|
/**
|
|
14
15
|
* This allow browser or main thread to listen for worker response message
|
|
15
16
|
* using the normal `worker.onmessage = () => {}` syntax. Is should only be side on the
|
|
@@ -18,23 +19,22 @@ export declare class WorkerProxy {
|
|
|
18
19
|
onmessage: ((e: {
|
|
19
20
|
data: any;
|
|
20
21
|
}) => void) | null;
|
|
21
|
-
private _eventEmitter;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* This allow browser or main thread to listen for worker response message
|
|
24
|
+
* using the normal `worker.onerror = () => {}` syntax. Is should only be side on the
|
|
25
|
+
* main thread side, not on worker side.
|
|
24
26
|
*/
|
|
27
|
+
onerror: ((e: {
|
|
28
|
+
data: {
|
|
29
|
+
error: unknown;
|
|
30
|
+
};
|
|
31
|
+
}) => void) | null;
|
|
32
|
+
private _eventEmitter;
|
|
25
33
|
private get eventEmitter();
|
|
26
34
|
constructor();
|
|
27
35
|
terminate(): void;
|
|
28
|
-
/**
|
|
29
|
-
* This postMessage() should only be called when intending to send message from main thread to
|
|
30
|
-
* worker; In a typical browser environment, this will just act as a normal postMessage() function.
|
|
31
|
-
*/
|
|
32
36
|
postMessage(message: unknown): void;
|
|
33
|
-
/**
|
|
34
|
-
* A separate postMessage() is needed because both main thread and worker thread communicate with
|
|
35
|
-
* each other using postMessage(), but we cannot (and do not) differentiate between the two
|
|
36
|
-
* while running on main thread on hardhat
|
|
37
|
-
*/
|
|
38
37
|
postMessageToMainThread(message: unknown): void;
|
|
38
|
+
postErrorToMainThread(error: unknown): void;
|
|
39
39
|
attachWorkerSideOnMessage(fn: (e: any) => void | Promise<void>): void;
|
|
40
40
|
}
|
|
@@ -1,53 +1,51 @@
|
|
|
1
1
|
class i {
|
|
2
2
|
isNode = !1;
|
|
3
|
+
isSandbox = !1;
|
|
3
4
|
/**
|
|
4
5
|
* This allow browser or main thread to listen for worker response message
|
|
5
6
|
* using the normal `worker.onmessage = () => {}` syntax. Is should only be side on the
|
|
6
7
|
* main thread side, not on worker side.
|
|
7
8
|
*/
|
|
8
9
|
onmessage = null;
|
|
9
|
-
_eventEmitter;
|
|
10
|
-
// node EventEmitter
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* This allow browser or main thread to listen for worker response message
|
|
12
|
+
* using the normal `worker.onerror = () => {}` syntax. Is should only be side on the
|
|
13
|
+
* main thread side, not on worker side.
|
|
13
14
|
*/
|
|
15
|
+
onerror = null;
|
|
16
|
+
_eventEmitter;
|
|
17
|
+
// node EventEmitter
|
|
14
18
|
get eventEmitter() {
|
|
15
19
|
if (this._eventEmitter)
|
|
16
20
|
return this._eventEmitter;
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
if (this.isNode) {
|
|
22
|
+
const e = require("events");
|
|
23
|
+
this._eventEmitter = new e();
|
|
24
|
+
} else
|
|
25
|
+
this._eventEmitter = new EventTarget();
|
|
26
|
+
return this._eventEmitter;
|
|
19
27
|
}
|
|
20
28
|
constructor() {
|
|
21
|
-
this.isNode = typeof process < "u" && process.versions != null && process.versions.node != null;
|
|
29
|
+
this.isNode = typeof process < "u" && process.versions != null && process.versions.node != null, this.isSandbox = typeof window < "u" && window.origin === "null";
|
|
22
30
|
}
|
|
23
31
|
terminate() {
|
|
24
32
|
}
|
|
25
|
-
/**
|
|
26
|
-
* This postMessage() should only be called when intending to send message from main thread to
|
|
27
|
-
* worker; In a typical browser environment, this will just act as a normal postMessage() function.
|
|
28
|
-
*/
|
|
29
33
|
postMessage(e) {
|
|
30
|
-
|
|
31
|
-
this.eventEmitter.emit("message", e);
|
|
32
|
-
return;
|
|
33
|
-
} else
|
|
34
|
-
postMessage(e);
|
|
34
|
+
this.isNode ? this.eventEmitter.emit("message", e) : this.isSandbox ? this.eventEmitter?.dispatchEvent(new CustomEvent("worker-message", { detail: e })) : postMessage(e);
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* A separate postMessage() is needed because both main thread and worker thread communicate with
|
|
38
|
-
* each other using postMessage(), but we cannot (and do not) differentiate between the two
|
|
39
|
-
* while running on main thread on hardhat
|
|
40
|
-
*/
|
|
41
36
|
postMessageToMainThread(e) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
const t = { data: e };
|
|
38
|
+
this.onmessage ? this.onmessage(t) : postMessage(e);
|
|
39
|
+
}
|
|
40
|
+
postErrorToMainThread(e) {
|
|
41
|
+
const t = { data: { error: e } };
|
|
42
|
+
this.onerror ? this.onerror(t) : postMessage(e);
|
|
47
43
|
}
|
|
48
44
|
attachWorkerSideOnMessage(e) {
|
|
49
|
-
this.isNode
|
|
45
|
+
this.isNode ? this.eventEmitter.on("message", (t) => {
|
|
50
46
|
e(t);
|
|
47
|
+
}) : this.isSandbox && this.eventEmitter.addEventListener("worker-message", (t) => {
|
|
48
|
+
e(t.detail);
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
51
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IUtxoConstructor } from '../../data-structures/utxo/Utxo';
|
|
2
2
|
import { type MerkleTreeJson } from '../../data-structures/merkle-tree';
|
|
3
3
|
import { WorkerParams, WorkerPayload } from '../worker.types';
|
|
4
|
+
import { ProverVersion } from '../../types/hinkal.types';
|
|
4
5
|
export declare enum ZKProofWorkerActionType {
|
|
5
6
|
CALC_COMMITMENTS_SIBLING_AND_SIDES = 0,
|
|
6
7
|
CALC_ACCESS_TOKEN_SIBLING_AND_SIDES = 1,
|
|
@@ -30,6 +31,7 @@ export interface ZKProofWorkerCalcAccessTokenReturn {
|
|
|
30
31
|
export interface ZKProofWorkerBuildInNullifiersPayload extends WorkerPayload<{
|
|
31
32
|
inputUtxosSerialized: IUtxoConstructor[][];
|
|
32
33
|
onChainCreation: boolean[];
|
|
34
|
+
proverVersion: ProverVersion;
|
|
33
35
|
}> {
|
|
34
36
|
type: ZKProofWorkerActionType.BUILD_IN_NULLIFIERS;
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/zkProofWorkerLauncher-
|
|
1
|
+
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/zkProofWorkerLauncher-WftdKeo_.js").href:new URL("../../assets/zkProofWorkerLauncher-WftdKeo_.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("../../crypto/preProcessing.cjs"),A=require("../../data-structures/crypto-keys/keys.cjs"),S=require("../../data-structures/utxo/Utxo.cjs"),m=require("../../functions/snarkjs/common.snarkjs.cjs"),C=require("../workerProxy.cjs"),d=require("./zkProofWorker.types.cjs"),u=require("../../functions/utils/merkleTree.utils.cjs"),t=new C.WorkerProxy,p=r=>{const{inputUtxosSerialized:e,merkleTreeSerialized:a}=r.data,c=u.contructMerkleTreeFromSerialized(a),i=e.map(n=>n.map(l=>new S.Utxo(l))),{inCommitmentSiblings:s,inCommitmentSiblingSides:o}=m.calcCommitmentsSiblingAndSides(i,c);t.postMessageToMainThread({inCommitmentSiblings:s,inCommitmentSiblingSides:o})},k=r=>{const{userSignature:e,merkleTreeAccessTokenSerialized:a}=r.data,c=new A.UserKeys(e),i=u.contructMerkleTreeFromSerialized(a),{accessTokenSiblings:s,accessTokenSiblingSides:o}=m.calcAccessTokenSiblingsAndSides(c,i);t.postMessageToMainThread({accessTokenSiblings:s,accessTokenSiblingSides:o})},T=r=>{const{inputUtxosSerialized:e,onChainCreation:a,proverVersion:c}=r.data,i=e.map(o=>o.map(n=>new S.Utxo(n)));let s=[];c==="v1x0"?s=i.map((o,n)=>o.map(l=>a[n]?"0":l.getNullifier())):s=i.map(o=>o.map(n=>n.amount===0n?"0":n.getNullifier())),t.postMessageToMainThread(s)},g=async r=>{try{await y.preProcessing();const{type:e}=r.payload;switch(e){case d.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES:p(r.payload);return;case d.ZKProofWorkerActionType.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES:k(r.payload);return;case d.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS:T(r.payload);return;default:throw Error(`Unknown worker message type ${e}`)}}catch(e){console.error(e),t.postErrorToMainThread(e)}};t.attachWorkerSideOnMessage(g);exports.default=t;exports.handleBuildInNullifiers=T;exports.handleCalcAccessTokenSiblingAndSides=k;exports.handleCalcCommitmentsSiblingAndSides=p;exports.onWorkerMessage=g;
|
|
@@ -1,66 +1,52 @@
|
|
|
1
|
-
import { preProcessing as
|
|
2
|
-
import { UserKeys as
|
|
3
|
-
import { Utxo as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
), i = t.map(
|
|
20
|
-
(a) => a.map((c) => new S(c))
|
|
21
|
-
), { inCommitmentSiblings: s, inCommitmentSiblingSides: p } = k(i, o);
|
|
22
|
-
l.postMessageToMainThread({ inCommitmentSiblings: s, inCommitmentSiblingSides: p });
|
|
23
|
-
}, A = (e) => {
|
|
24
|
-
const { userSignature: t, merkleTreeAccessTokenSerialized: n } = e.data, m = new I(t), r = n.tree, o = new Map(
|
|
25
|
-
Object.entries(r).map(([a, c]) => [BigInt(a), BigInt(c)])
|
|
26
|
-
), i = T.createWithData(
|
|
27
|
-
o,
|
|
28
|
-
BigInt(n.index),
|
|
29
|
-
BigInt(n.count),
|
|
30
|
-
g,
|
|
31
|
-
25n,
|
|
32
|
-
0n
|
|
33
|
-
), { accessTokenSiblings: s, accessTokenSiblingSides: p } = C(m, i);
|
|
34
|
-
l.postMessageToMainThread({ accessTokenSiblings: s, accessTokenSiblingSides: p });
|
|
35
|
-
}, h = (e) => {
|
|
36
|
-
const { inputUtxosSerialized: t, onChainCreation: n } = e.data, r = t.map(
|
|
37
|
-
(o) => o.map((i) => new S(i))
|
|
38
|
-
).map(
|
|
39
|
-
(o, i) => o.map((s) => n[i] ? "0" : s.getNullifier())
|
|
1
|
+
import { preProcessing as d } from "../../crypto/preProcessing.mjs";
|
|
2
|
+
import { UserKeys as T } from "../../data-structures/crypto-keys/keys.mjs";
|
|
3
|
+
import { Utxo as p } from "../../data-structures/utxo/Utxo.mjs";
|
|
4
|
+
import { calcCommitmentsSiblingAndSides as g, calcAccessTokenSiblingsAndSides as u } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
5
|
+
import { WorkerProxy as k } from "../workerProxy.mjs";
|
|
6
|
+
import { ZKProofWorkerActionType as m } from "./zkProofWorker.types.mjs";
|
|
7
|
+
import { contructMerkleTreeFromSerialized as S } from "../../functions/utils/merkleTree.utils.mjs";
|
|
8
|
+
const c = new k(), C = (r) => {
|
|
9
|
+
const { inputUtxosSerialized: e, merkleTreeSerialized: t } = r.data, a = S(t), i = e.map(
|
|
10
|
+
(n) => n.map((l) => new p(l))
|
|
11
|
+
), { inCommitmentSiblings: s, inCommitmentSiblingSides: o } = g(i, a);
|
|
12
|
+
c.postMessageToMainThread({ inCommitmentSiblings: s, inCommitmentSiblingSides: o });
|
|
13
|
+
}, f = (r) => {
|
|
14
|
+
const { userSignature: e, merkleTreeAccessTokenSerialized: t } = r.data, a = new T(e), i = S(t), { accessTokenSiblings: s, accessTokenSiblingSides: o } = u(a, i);
|
|
15
|
+
c.postMessageToMainThread({ accessTokenSiblings: s, accessTokenSiblingSides: o });
|
|
16
|
+
}, y = (r) => {
|
|
17
|
+
const { inputUtxosSerialized: e, onChainCreation: t, proverVersion: a } = r.data, i = e.map(
|
|
18
|
+
(o) => o.map((n) => new p(n))
|
|
40
19
|
);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
20
|
+
let s = [];
|
|
21
|
+
a === "v1x0" ? s = i.map(
|
|
22
|
+
(o, n) => o.map((l) => t[n] ? "0" : l.getNullifier())
|
|
23
|
+
) : s = i.map((o) => o.map((n) => n.amount === 0n ? "0" : n.getNullifier())), c.postMessageToMainThread(s);
|
|
24
|
+
}, A = async (r) => {
|
|
25
|
+
try {
|
|
26
|
+
await d();
|
|
27
|
+
const { type: e } = r.payload;
|
|
28
|
+
switch (e) {
|
|
29
|
+
case m.CALC_COMMITMENTS_SIBLING_AND_SIDES:
|
|
30
|
+
C(r.payload);
|
|
31
|
+
return;
|
|
32
|
+
case m.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES:
|
|
33
|
+
f(r.payload);
|
|
34
|
+
return;
|
|
35
|
+
case m.BUILD_IN_NULLIFIERS:
|
|
36
|
+
y(r.payload);
|
|
37
|
+
return;
|
|
38
|
+
default:
|
|
39
|
+
throw Error(`Unknown worker message type ${e}`);
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
console.error(e), c.postErrorToMainThread(e);
|
|
57
43
|
}
|
|
58
44
|
};
|
|
59
|
-
|
|
45
|
+
c.attachWorkerSideOnMessage(A);
|
|
60
46
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
c as default,
|
|
48
|
+
y as handleBuildInNullifiers,
|
|
49
|
+
f as handleCalcAccessTokenSiblingAndSides,
|
|
50
|
+
C as handleCalcCommitmentsSiblingAndSides,
|
|
51
|
+
A as onWorkerMessage
|
|
66
52
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./serialize.utils.cjs"),s=i=>{const e=new Map;return(...n)=>{const t=o.CustomJSONStringify(n);if(e.has(t))return e.get(t);const r=i(...n);return e.set(t,r),r}};exports.memoizeFunc=s;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CustomJSONStringify as c } from "./serialize.utils.mjs";
|
|
2
|
-
const u = (o) => {
|
|
3
|
-
const t = /* @__PURE__ */ new Map();
|
|
4
|
-
return (...n) => {
|
|
5
|
-
const e = c(n);
|
|
6
|
-
if (t.has(e))
|
|
7
|
-
return t.get(e);
|
|
8
|
-
const r = o(...n);
|
|
9
|
-
return t.set(e, r), r;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
u as memoizeFunc
|
|
14
|
-
};
|