@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hinkal/common",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"homepage": "hinkal.pro",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -68,11 +68,15 @@
|
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"wagmi": "2.13.3",
|
|
71
|
-
"ethers": "5.x"
|
|
71
|
+
"ethers": "5.x",
|
|
72
|
+
"@walletconnect/utils": "^2.17.2"
|
|
72
73
|
},
|
|
73
74
|
"peerDependenciesMeta": {
|
|
74
75
|
"wagmi": {
|
|
75
76
|
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"@walletconnect/utils": {
|
|
79
|
+
"optional": true
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),n=require("../error-handling/error-codes.constants.cjs"),s=require("ethers"),o=require("../functions/web3/getContractMetadata.cjs");class a{signer;chainId;originalProvider;fetchProvider;initConnector(){}initSigner(r){this.signer=r}requireSigner(){if(!this.signer)throw Error("No Connector In Provider Adapter")}async init(r){this.requireSigner(),r&&(this.chainId=r),this.originalProvider=this.signer.provider,this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available")}async disconnectFromConnector(){}async connectToConnector(){return 0}async waitForTransaction(r,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../constants/chains.constants.cjs"),n=require("../error-handling/error-codes.constants.cjs"),s=require("ethers"),o=require("../functions/web3/getContractMetadata.cjs");class a{signer;chainId;originalProvider;fetchProvider;chainEventListener;initConnector(){}initSigner(r){this.signer=r}getSigner(){if(!this.signer)throw new Error("No Signer In Provider Adapter");return this.signer}requireSigner(){if(!this.signer)throw Error("No Connector In Provider Adapter")}async init(r){this.requireSigner(),r&&(this.chainId=r),this.originalProvider=this.signer.provider,this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available")}async disconnectFromConnector(){}async connectToConnector(){return 0}async waitForTransaction(r,e){if((await this.fetchProvider?.waitForTransaction(r,e))?.status)return!0;throw Error(n.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(r){this.requireSigner();const e=await this.signer.signMessage(r);if(!e)throw new Error(n.transactionErrorCodes.SIGNING_FAILED);if(e.includes("error"))throw new Error(n.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return e}async signTypedData(r,e,t){return this.signer._signTypedData(r,e,t)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return i.networkRegistry[this.chainId]};async switchNetwork(r){if(this.originalProvider=this.createFetchProvider(r)??this.originalProvider,!this.originalProvider)throw new Error("switchNetwork illegal state: no provider");this.signer=this.signer?.connect(this.originalProvider),this.chainEventListener?.onChainChanged(r.chainId)}async switchAccount(r){const e=this.createFetchProvider();if(!e)throw new Error("can't create new fetch provider");this.signer=r.connect(e),await this.onAccountChanged(),this.chainEventListener?.onAccountChanged()}createFetchProvider(r){try{const t=(r??i.networkRegistry[this.chainId])?.fetchRpcUrl;return t?t.includes("wss")?new s.providers.WebSocketProvider(t):new s.providers.StaticJsonRpcProvider(t):void 0}catch(e){console.log("create Fetch Provider error",e);return}}async getAddress(){this.requireSigner();const r=await this.signer.getAddress();if(!r)throw new Error("IllegalState");return s.utils.getAddress(r)}setChainEventListener(r){this.chainEventListener=r}onAccountChanged(){return this.init()}onChainChanged(r){return this.init(r)}release(){this.removeListeners()}removeListeners(){this.chainEventListener=void 0}parseChainIdParam(r){const e=r??this.chainId;if(!e)throw new Error("No chainId provided in context");return e}getContractMetadata(r,e){const t=this.parseChainIdParam(e);return o.getContractMetadata(r,t)}getContract(r,e=void 0,t){const c=this.parseChainIdParam(t);return o.getContract(r,c,e)}getContractWithSigner(r,e=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(r,e).connect(this.signer)}getContractWithFetcher(r,e=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(r,e).connect(this.fetchProvider)}getContractWithFetcherForEthereum(r,e=void 0){const t=this.chainId===i.chainIds.localhost&&i.localhostNetwork===i.chainIds.ethMainnet?i.chainIds.localhost:i.chainIds.ethMainnet;return o.getContractWithFetcherByChainId(t,r,e)}async sendTransaction(r){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(r)}async connectAndPatchProvider(){return this.requireSigner(),await this.signer.getChainId()}isPermitterAvailable(){return!1}async getGasPrice(){const r=await this.fetchProvider?.getGasPrice();if(!r)throw Error("Could not fetch gas price in getGasPrice");return r.toBigInt()}}const h=new a,d=()=>new a;exports.EthersProviderAdapter=a;exports.default=d;exports.ethersProvierAdapter=h;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
|
|
1
|
+
import { ChainEventListener, IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
|
|
2
2
|
import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
|
|
3
3
|
import { ethers, Signer } from 'ethers';
|
|
4
4
|
export declare class EthersProviderAdapter implements IProviderAdapter<Signer> {
|
|
@@ -6,8 +6,10 @@ export declare class EthersProviderAdapter implements IProviderAdapter<Signer> {
|
|
|
6
6
|
chainId: number | undefined;
|
|
7
7
|
private originalProvider;
|
|
8
8
|
private fetchProvider;
|
|
9
|
+
private chainEventListener?;
|
|
9
10
|
initConnector(): void;
|
|
10
11
|
initSigner(signer: Signer): void;
|
|
12
|
+
getSigner(): Signer;
|
|
11
13
|
requireSigner(): void;
|
|
12
14
|
init(chainId?: number): Promise<void>;
|
|
13
15
|
disconnectFromConnector(): Promise<void>;
|
|
@@ -16,13 +18,15 @@ export declare class EthersProviderAdapter implements IProviderAdapter<Signer> {
|
|
|
16
18
|
signMessage(message: string): Promise<string>;
|
|
17
19
|
signTypedData(domain: ethers.TypedDataDomain, types: Record<string, ethers.TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
|
|
18
20
|
getSelectedNetwork: () => EthereumNetwork | undefined;
|
|
19
|
-
switchNetwork(): Promise<void>;
|
|
21
|
+
switchNetwork(network: EthereumNetwork): Promise<void>;
|
|
22
|
+
switchAccount(newSigner: Signer): Promise<void>;
|
|
20
23
|
private createFetchProvider;
|
|
21
24
|
getAddress(): Promise<string>;
|
|
22
|
-
setChainEventListener(): void;
|
|
25
|
+
setChainEventListener(chainEventListener: ChainEventListener): void;
|
|
23
26
|
onAccountChanged(): Promise<unknown>;
|
|
24
27
|
onChainChanged(chainId?: number): Promise<unknown>;
|
|
25
28
|
release(): void;
|
|
29
|
+
private removeListeners;
|
|
26
30
|
private parseChainIdParam;
|
|
27
31
|
getContractMetadata(contractType: ContractType, chainId?: number): ContractMetadata;
|
|
28
32
|
getContract(contractType: ContractType, contractAddress?: undefined, chainId?: number): ethers.Contract;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { networkRegistry as o, chainIds as i, localhostNetwork as h } from "../constants/chains.constants.mjs";
|
|
2
2
|
import { transactionErrorCodes as n } from "../error-handling/error-codes.constants.mjs";
|
|
3
3
|
import { providers as s, utils as d } from "ethers";
|
|
4
|
-
import { getContractMetadata as g, getContract as l, getContractWithFetcherByChainId as
|
|
4
|
+
import { getContractMetadata as g, getContract as l, getContractWithFetcherByChainId as v } from "../functions/web3/getContractMetadata.mjs";
|
|
5
5
|
class a {
|
|
6
6
|
signer;
|
|
7
7
|
chainId;
|
|
8
8
|
originalProvider;
|
|
9
9
|
fetchProvider;
|
|
10
|
+
chainEventListener;
|
|
10
11
|
initConnector() {
|
|
11
12
|
}
|
|
12
13
|
initSigner(r) {
|
|
13
14
|
this.signer = r;
|
|
14
15
|
}
|
|
16
|
+
getSigner() {
|
|
17
|
+
if (!this.signer)
|
|
18
|
+
throw new Error("No Signer In Provider Adapter");
|
|
19
|
+
return this.signer;
|
|
20
|
+
}
|
|
15
21
|
requireSigner() {
|
|
16
22
|
if (!this.signer)
|
|
17
23
|
throw Error("No Connector In Provider Adapter");
|
|
@@ -46,14 +52,23 @@ class a {
|
|
|
46
52
|
throw new Error("Illegal state: no chaindId");
|
|
47
53
|
return o[this.chainId];
|
|
48
54
|
};
|
|
49
|
-
async switchNetwork() {
|
|
55
|
+
async switchNetwork(r) {
|
|
56
|
+
if (this.originalProvider = this.createFetchProvider(r) ?? this.originalProvider, !this.originalProvider)
|
|
57
|
+
throw new Error("switchNetwork illegal state: no provider");
|
|
58
|
+
this.signer = this.signer?.connect(this.originalProvider), this.chainEventListener?.onChainChanged(r.chainId);
|
|
50
59
|
}
|
|
51
|
-
|
|
60
|
+
async switchAccount(r) {
|
|
61
|
+
const t = this.createFetchProvider();
|
|
62
|
+
if (!t)
|
|
63
|
+
throw new Error("can't create new fetch provider");
|
|
64
|
+
this.signer = r.connect(t), await this.onAccountChanged(), this.chainEventListener?.onAccountChanged();
|
|
65
|
+
}
|
|
66
|
+
createFetchProvider(r) {
|
|
52
67
|
try {
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
} catch (
|
|
56
|
-
console.log("create Fetch Provider error",
|
|
68
|
+
const e = (r ?? o[this.chainId])?.fetchRpcUrl;
|
|
69
|
+
return e ? e.includes("wss") ? new s.WebSocketProvider(e) : new s.StaticJsonRpcProvider(e) : void 0;
|
|
70
|
+
} catch (t) {
|
|
71
|
+
console.log("create Fetch Provider error", t);
|
|
57
72
|
return;
|
|
58
73
|
}
|
|
59
74
|
}
|
|
@@ -64,7 +79,8 @@ class a {
|
|
|
64
79
|
throw new Error("IllegalState");
|
|
65
80
|
return d.getAddress(r);
|
|
66
81
|
}
|
|
67
|
-
setChainEventListener() {
|
|
82
|
+
setChainEventListener(r) {
|
|
83
|
+
this.chainEventListener = r;
|
|
68
84
|
}
|
|
69
85
|
onAccountChanged() {
|
|
70
86
|
return this.init();
|
|
@@ -73,6 +89,10 @@ class a {
|
|
|
73
89
|
return this.init(r);
|
|
74
90
|
}
|
|
75
91
|
release() {
|
|
92
|
+
this.removeListeners();
|
|
93
|
+
}
|
|
94
|
+
removeListeners() {
|
|
95
|
+
this.chainEventListener = void 0;
|
|
76
96
|
}
|
|
77
97
|
parseChainIdParam(r) {
|
|
78
98
|
const t = r ?? this.chainId;
|
|
@@ -100,7 +120,7 @@ class a {
|
|
|
100
120
|
}
|
|
101
121
|
getContractWithFetcherForEthereum(r, t = void 0) {
|
|
102
122
|
const e = this.chainId === i.localhost && h === i.ethMainnet ? i.localhost : i.ethMainnet;
|
|
103
|
-
return
|
|
123
|
+
return v(e, r, t);
|
|
104
124
|
}
|
|
105
125
|
async sendTransaction(r) {
|
|
106
126
|
if (!this.signer)
|
|
@@ -120,9 +140,9 @@ class a {
|
|
|
120
140
|
return r.toBigInt();
|
|
121
141
|
}
|
|
122
142
|
}
|
|
123
|
-
const
|
|
143
|
+
const I = new a(), p = () => new a();
|
|
124
144
|
export {
|
|
125
145
|
a as EthersProviderAdapter,
|
|
126
146
|
p as default,
|
|
127
|
-
|
|
147
|
+
I as ethersProvierAdapter
|
|
128
148
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../constants/chains.constants.cjs"),i=require("../error-handling/error-codes.constants.cjs"),o=require("ethers"),g=require("wagmi"),c=require("../functions/web3/getContractMetadata.cjs"),h=require("../node_modules/@wagmi/core/dist/esm/actions/disconnect.cjs"),u=require("../node_modules/@wagmi/core/dist/esm/actions/reconnect.cjs"),w=require("../node_modules/@wagmi/core/dist/esm/actions/connect.cjs"),l=require("../node_modules/@wagmi/core/dist/esm/actions/signMessage.cjs"),f=require("../node_modules/@wagmi/core/dist/esm/actions/switchChain.cjs"),v=require("../node_modules/@wagmi/core/dist/esm/actions/getAccount.cjs"),C=require("../node_modules/@wagmi/core/dist/esm/actions/watchAccount.cjs"),I=require("../node_modules/@wagmi/core/dist/esm/actions/watchChainId.cjs");class a{connector;chainId;originalProvider;fetchProvider;signer;chainEventListener;config;unsubscribeFns=[];initConnector(t){this.connector=t}requireConnector(){if(!this.connector)throw Error("No Connector In Provider Adapter")}initConfig(t){this.config=t}async init(t){this.requireConnector(),t&&(this.chainId=t),this.originalProvider=await this.connector.getProvider(),this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available");const r=await this.connector.getProvider(),e=await this.connector.getAccounts();this.signer=await this.walletClientToSigner({transport:r,account:e[0]},this.chainId)}async disconnectFromConnector(){if(!this.config)throw new Error("No Config In Provider Adapter");this.release(),await h.disconnect(this.config)}async connectToConnector(t){if(!this.config)throw new Error("No Config In Provider Adapter");if(t.id==="walletConnect")try{await u.reconnect(this.config,{connectors:[t]}),await h.disconnect(this.config)}catch{}try{return(await w.connect(this.config,{connector:t})).chainId}catch(r){if(r instanceof g.ConnectorAlreadyConnectedError)return t.getChainId();throw console.log(r),new Error(i.transactionErrorCodes.CONNECTION_FAILED)}}async waitForTransaction(t,r){if((await this.fetchProvider?.waitForTransaction(t,r))?.status)return!0;throw Error(i.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(t){if(!this.config)throw new Error("No Config In Provider Adapter");const r=await l.signMessage(this.config,{message:t});if(!r)throw new Error(i.transactionErrorCodes.SIGNING_FAILED);if(r.includes("error"))throw new Error(i.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return r}async signTypedData(t,r,e){return this.signer._signTypedData(t,r,e)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return n.networkRegistry[this.chainId]};async switchNetwork(t){if(!this.config)throw new Error("No Config In Provider Adapter");return f.switchChain(this.config,{chainId:t.chainId})}createFetchProvider(){try{const r=n.networkRegistry[this.chainId]?.fetchRpcUrl;return r?r.includes("wss")?new o.providers.WebSocketProvider(r):new o.providers.StaticJsonRpcProvider(r):void 0}catch(t){console.log("create Fetch Provider error",t);return}}async getAddress(){if(!this.config)throw new Error("No Config In Provider Adapter");const{address:t}=v.getAccount(this.config);if(!t)throw new Error("IllegalState");return o.utils.getAddress(t)}setChainEventListener(t){if(!this.config)throw new Error("No Config In Provider Adapter");this.chainEventListener=t,this.chainEventListener&&(this.unsubscribeFns.push(C.watchAccount(this.config,{onChange:({address:r},{address:e})=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Account changed"),r!==e&&(console.log("Account changed"),this.chainEventListener.onAccountChanged())}})),this.unsubscribeFns.push(I.watchChainId(this.config,{onChange:r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Chain ID changed!",r),this.chainEventListener.onChainChanged(r)}})))}onAccountChanged(){return this.init()}onChainChanged(t){return this.init(t)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(t=>t()),this.unsubscribeFns=[]}parseChainIdParam(t){const r=t??this.chainId;if(!r)throw new Error("No chainId provided in context");return r}getContractMetadata(t,r){const e=this.parseChainIdParam(r);return c.getContractMetadata(t,e)}getContract(t,r=void 0,e){const s=this.parseChainIdParam(e);return c.getContract(t,s,r)}getContractWithSigner(t,r=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(t,r).connect(this.signer)}getContractWithFetcher(t,r=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(t,r).connect(this.fetchProvider)}getContractWithFetcherForEthereum(t,r=void 0){const e=this.chainId===n.chainIds.localhost&&n.localhostNetwork===n.chainIds.ethMainnet?n.chainIds.localhost:n.chainIds.ethMainnet;return c.getContractWithFetcherByChainId(e,t,r)}async sendTransaction(t){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(t)}async connectAndPatchProvider(t){return await this.connectToConnector(t)}isPermitterAvailable(){return!!this.getSelectedNetwork()?.contractData?.permitterAddress}async getGasPrice(){const t=await this.fetchProvider?.getGasPrice();if(!t)throw Error("Could not fetch gas price in getGasPrice");return t.toBigInt()}async walletClientToSigner(t,r){const{account:e,transport:s}=t,d={chainId:r,name:""};return new o.providers.Web3Provider(s,d).getSigner(e)}}const P=new a,E=()=>new a;exports.WagmiProviderAdapter=a;exports.default=E;exports.wagmiProviderAdapter=P;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../constants/chains.constants.cjs"),i=require("../error-handling/error-codes.constants.cjs"),o=require("ethers"),g=require("wagmi"),c=require("../functions/web3/getContractMetadata.cjs"),h=require("../node_modules/@wagmi/core/dist/esm/actions/disconnect.cjs"),u=require("../node_modules/@wagmi/core/dist/esm/actions/reconnect.cjs"),w=require("../node_modules/@wagmi/core/dist/esm/actions/connect.cjs"),l=require("../node_modules/@wagmi/core/dist/esm/actions/signMessage.cjs"),f=require("../node_modules/@wagmi/core/dist/esm/actions/switchChain.cjs"),v=require("../node_modules/@wagmi/core/dist/esm/actions/getAccount.cjs"),C=require("../node_modules/@wagmi/core/dist/esm/actions/watchAccount.cjs"),I=require("../node_modules/@wagmi/core/dist/esm/actions/watchChainId.cjs");class a{connector;chainId;originalProvider;fetchProvider;signer;chainEventListener;config;unsubscribeFns=[];initConnector(t){this.connector=t}getSigner(){if(!this.signer)throw new Error("No Signer In Provider Adapter");return this.signer}requireConnector(){if(!this.connector)throw Error("No Connector In Provider Adapter")}initConfig(t){this.config=t}async init(t){this.requireConnector(),t&&(this.chainId=t),this.originalProvider=await this.connector.getProvider(),this.fetchProvider=this.createFetchProvider()??this.originalProvider,this.fetchProvider===this.originalProvider&&console.warn("fetchProvider not available");const r=await this.connector.getProvider(),e=await this.connector.getAccounts();this.signer=await this.walletClientToSigner({transport:r,account:e[0]},this.chainId)}async disconnectFromConnector(){if(!this.config)throw new Error("No Config In Provider Adapter");this.release(),await h.disconnect(this.config)}async connectToConnector(t){if(!this.config)throw new Error("No Config In Provider Adapter");if(t.id==="walletConnect")try{await u.reconnect(this.config,{connectors:[t]}),await h.disconnect(this.config)}catch{}try{return(await w.connect(this.config,{connector:t})).chainId}catch(r){if(r instanceof g.ConnectorAlreadyConnectedError)return t.getChainId();throw console.log(r),new Error(i.transactionErrorCodes.CONNECTION_FAILED)}}async waitForTransaction(t,r){if((await this.fetchProvider?.waitForTransaction(t,r))?.status)return!0;throw Error(i.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(t){if(!this.config)throw new Error("No Config In Provider Adapter");const r=await l.signMessage(this.config,{message:t});if(!r)throw new Error(i.transactionErrorCodes.SIGNING_FAILED);if(r.includes("error"))throw new Error(i.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return r}async signTypedData(t,r,e){return this.signer._signTypedData(t,r,e)}getSelectedNetwork=()=>{if(!this.chainId)throw new Error("Illegal state: no chaindId");return n.networkRegistry[this.chainId]};async switchNetwork(t){if(!this.config)throw new Error("No Config In Provider Adapter");return f.switchChain(this.config,{chainId:t.chainId})}createFetchProvider(){try{const r=n.networkRegistry[this.chainId]?.fetchRpcUrl;return r?r.includes("wss")?new o.providers.WebSocketProvider(r):new o.providers.StaticJsonRpcProvider(r):void 0}catch(t){console.log("create Fetch Provider error",t);return}}async getAddress(){if(!this.config)throw new Error("No Config In Provider Adapter");const{address:t}=v.getAccount(this.config);if(!t)throw new Error("IllegalState");return o.utils.getAddress(t)}setChainEventListener(t){if(!this.config)throw new Error("No Config In Provider Adapter");this.chainEventListener=t,this.chainEventListener&&(this.unsubscribeFns.push(C.watchAccount(this.config,{onChange:({address:r},{address:e})=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Account changed"),r!==e&&(console.log("Account changed"),this.chainEventListener.onAccountChanged())}})),this.unsubscribeFns.push(I.watchChainId(this.config,{onChange:r=>{if(!this.chainEventListener){console.warn("chainEventListener is not set");return}console.log("Chain ID changed!",r),this.chainEventListener.onChainChanged(r)}})))}onAccountChanged(){return this.init()}onChainChanged(t){return this.init(t)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(t=>t()),this.unsubscribeFns=[]}parseChainIdParam(t){const r=t??this.chainId;if(!r)throw new Error("No chainId provided in context");return r}getContractMetadata(t,r){const e=this.parseChainIdParam(r);return c.getContractMetadata(t,e)}getContract(t,r=void 0,e){const s=this.parseChainIdParam(e);return c.getContract(t,s,r)}getContractWithSigner(t,r=void 0){if(!this.signer)throw new Error("IllegalState: no signer");return this.getContract(t,r).connect(this.signer)}getContractWithFetcher(t,r=void 0){if(!this.fetchProvider)throw new Error("fetchProvider not initialized");return this.getContract(t,r).connect(this.fetchProvider)}getContractWithFetcherForEthereum(t,r=void 0){const e=this.chainId===n.chainIds.localhost&&n.localhostNetwork===n.chainIds.ethMainnet?n.chainIds.localhost:n.chainIds.ethMainnet;return c.getContractWithFetcherByChainId(e,t,r)}async sendTransaction(t){if(!this.signer)throw new Error("IllegalState: no signer");return await this.signer.sendTransaction(t)}async connectAndPatchProvider(t){return await this.connectToConnector(t)}isPermitterAvailable(){return!!this.getSelectedNetwork()?.contractData?.permitterAddress}async getGasPrice(){const t=await this.fetchProvider?.getGasPrice();if(!t)throw Error("Could not fetch gas price in getGasPrice");return t.toBigInt()}async walletClientToSigner(t,r){const{account:e,transport:s}=t,d={chainId:r,name:""};return new o.providers.Web3Provider(s,d).getSigner(e)}switchAccount(){throw new Error("Method not implemented.")}}const P=new a,E=()=>new a;exports.WagmiProviderAdapter=a;exports.default=E;exports.wagmiProviderAdapter=P;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChainEventListener, IProviderAdapter } from '../data-structures/provider-adapter/IProviderAdapter';
|
|
2
2
|
import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
|
|
3
|
-
import { ethers } from 'ethers';
|
|
3
|
+
import { ethers, Signer } from 'ethers';
|
|
4
4
|
import { type Connector } from 'wagmi';
|
|
5
5
|
export declare class WagmiProviderAdapter implements IProviderAdapter<Connector> {
|
|
6
6
|
private connector;
|
|
@@ -12,6 +12,7 @@ export declare class WagmiProviderAdapter implements IProviderAdapter<Connector>
|
|
|
12
12
|
private config?;
|
|
13
13
|
private unsubscribeFns;
|
|
14
14
|
initConnector(connector: Connector): void;
|
|
15
|
+
getSigner(): Signer;
|
|
15
16
|
requireConnector(): void;
|
|
16
17
|
initConfig(config: any): void;
|
|
17
18
|
init(chainId?: number): Promise<void>;
|
|
@@ -40,6 +41,7 @@ export declare class WagmiProviderAdapter implements IProviderAdapter<Connector>
|
|
|
40
41
|
isPermitterAvailable(): boolean;
|
|
41
42
|
getGasPrice(): Promise<bigint>;
|
|
42
43
|
walletClientToSigner(walletClient: any, chainId: number): Promise<ethers.providers.JsonRpcSigner>;
|
|
44
|
+
switchAccount(): Promise<void>;
|
|
43
45
|
}
|
|
44
46
|
export declare const wagmiProviderAdapter: WagmiProviderAdapter;
|
|
45
47
|
declare const _default: <T = unknown>() => IProviderAdapter<T>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { networkRegistry as c, chainIds as n, localhostNetwork as g } from "../constants/chains.constants.mjs";
|
|
2
2
|
import { transactionErrorCodes as i } from "../error-handling/error-codes.constants.mjs";
|
|
3
|
-
import { providers as s, utils as
|
|
4
|
-
import { ConnectorAlreadyConnectedError as
|
|
3
|
+
import { providers as s, utils as w } from "ethers";
|
|
4
|
+
import { ConnectorAlreadyConnectedError as f } from "wagmi";
|
|
5
5
|
import { getContractMetadata as l, getContract as u, getContractWithFetcherByChainId as v } from "../functions/web3/getContractMetadata.mjs";
|
|
6
6
|
import { disconnect as a } from "../node_modules/@wagmi/core/dist/esm/actions/disconnect.mjs";
|
|
7
7
|
import { reconnect as C } from "../node_modules/@wagmi/core/dist/esm/actions/reconnect.mjs";
|
|
@@ -23,6 +23,11 @@ class h {
|
|
|
23
23
|
initConnector(t) {
|
|
24
24
|
this.connector = t;
|
|
25
25
|
}
|
|
26
|
+
getSigner() {
|
|
27
|
+
if (!this.signer)
|
|
28
|
+
throw new Error("No Signer In Provider Adapter");
|
|
29
|
+
return this.signer;
|
|
30
|
+
}
|
|
26
31
|
requireConnector() {
|
|
27
32
|
if (!this.connector)
|
|
28
33
|
throw Error("No Connector In Provider Adapter");
|
|
@@ -51,7 +56,7 @@ class h {
|
|
|
51
56
|
try {
|
|
52
57
|
return (await p(this.config, { connector: t })).chainId;
|
|
53
58
|
} catch (r) {
|
|
54
|
-
if (r instanceof
|
|
59
|
+
if (r instanceof f)
|
|
55
60
|
return t.getChainId();
|
|
56
61
|
throw console.log(r), new Error(i.CONNECTION_FAILED);
|
|
57
62
|
}
|
|
@@ -99,7 +104,7 @@ class h {
|
|
|
99
104
|
const { address: t } = m(this.config);
|
|
100
105
|
if (!t)
|
|
101
106
|
throw new Error("IllegalState");
|
|
102
|
-
return
|
|
107
|
+
return w.getAddress(t);
|
|
103
108
|
}
|
|
104
109
|
setChainEventListener(t) {
|
|
105
110
|
if (!this.config)
|
|
@@ -190,6 +195,9 @@ class h {
|
|
|
190
195
|
};
|
|
191
196
|
return new s.Web3Provider(o, d).getSigner(e);
|
|
192
197
|
}
|
|
198
|
+
switchAccount() {
|
|
199
|
+
throw new Error("Method not implemented.");
|
|
200
|
+
}
|
|
193
201
|
}
|
|
194
202
|
const x = new h(), q = () => new h();
|
|
195
203
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("../error-handling/error-codes.constants.cjs");require("../data-structures/crypto-keys/keys.cjs");require("libsodium-wrappers");const q=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../constants/vite.constants.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../types/activities.types.cjs");require("../constants/token-data/index.cjs");require("axios");const t=require("../crypto/preProcessing.cjs");require("../constants/reorg-depths.constants.cjs");require("../functions/utils/external-action.utils.cjs");require("node-forge");require("../functions/web3/events/getShieldedBalance.cjs");require("../constants/contracts.constants.cjs");require("idb-keyval");require("../functions/utils/convertIntegrationProviderToExternalActionId.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("../functions/utils/userAgent.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");const a=require("./EthersProviderAdapter.cjs"),n=async(i,u)=>{await t.preProcessing();const e=new q.Hinkal(u),r=a.default();return r.initSigner?.(i),await e.initProviderAdapter(void 0,r),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareEthersHinkal=n;
|
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
import "ethers";
|
|
2
2
|
import "circomlibjs-hinkal-fork";
|
|
3
|
+
import "../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import "../data-structures/crypto-keys/keys.mjs";
|
|
3
5
|
import "libsodium-wrappers";
|
|
4
6
|
import { Hinkal as p } from "../data-structures/Hinkal/Hinkal.mjs";
|
|
5
7
|
import "../constants/chains.constants.mjs";
|
|
6
8
|
import "../types/circom-data.types.mjs";
|
|
9
|
+
import "../constants/vite.constants.mjs";
|
|
7
10
|
import "../types/transactions.types.mjs";
|
|
8
11
|
import "../types/curve.types.mjs";
|
|
12
|
+
import "../types/activities.types.mjs";
|
|
9
13
|
import "../constants/token-data/index.mjs";
|
|
10
|
-
import "../data-structures/custom-token-registry/CustomTokenRegistry.mjs";
|
|
11
|
-
import "../constants/vite.constants.mjs";
|
|
12
14
|
import "axios";
|
|
13
|
-
import "../constants/coingecko.constants.mjs";
|
|
14
|
-
import "../constants/contracts.constants.mjs";
|
|
15
|
-
import "../constants/kyc.constants.mjs";
|
|
16
|
-
import "../constants/axelar.constants.mjs";
|
|
17
|
-
import "../constants/rewards.constants.mjs";
|
|
18
|
-
import "../constants/reorg-depths.constants.mjs";
|
|
19
15
|
import { preProcessing as m } from "../crypto/preProcessing.mjs";
|
|
16
|
+
import "../constants/reorg-depths.constants.mjs";
|
|
20
17
|
import "../functions/utils/external-action.utils.mjs";
|
|
21
18
|
import "node-forge";
|
|
22
19
|
import "../functions/web3/events/getShieldedBalance.mjs";
|
|
23
|
-
import "../
|
|
20
|
+
import "../constants/contracts.constants.mjs";
|
|
24
21
|
import "idb-keyval";
|
|
22
|
+
import "../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
23
|
+
import "../constants/kyc.constants.mjs";
|
|
24
|
+
import "../constants/coingecko.constants.mjs";
|
|
25
|
+
import "../constants/axelar.constants.mjs";
|
|
26
|
+
import "../constants/rewards.constants.mjs";
|
|
27
|
+
import "../constants/addresses.constants.mjs";
|
|
28
|
+
import "../constants/token.limits.constants.mjs";
|
|
29
|
+
import "../functions/utils/userAgent.mjs";
|
|
30
|
+
import "../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
25
31
|
import e from "./EthersProviderAdapter.mjs";
|
|
26
|
-
const
|
|
32
|
+
const G = async (t, o) => {
|
|
27
33
|
await m();
|
|
28
34
|
const r = new p(o), i = e();
|
|
29
35
|
return i.initSigner?.(t), await r.initProviderAdapter(void 0, i), await r.initUserKeys(), await r.resetMerkle(), r;
|
|
30
36
|
};
|
|
31
37
|
export {
|
|
32
|
-
|
|
38
|
+
G as prepareEthersHinkal
|
|
33
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("../error-handling/error-codes.constants.cjs");require("../data-structures/crypto-keys/keys.cjs");require("libsodium-wrappers");const q=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../constants/vite.constants.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../types/activities.types.cjs");require("../constants/token-data/index.cjs");require("axios");const a=require("../crypto/preProcessing.cjs");require("../constants/reorg-depths.constants.cjs");require("../functions/utils/external-action.utils.cjs");require("node-forge");require("../functions/web3/events/getShieldedBalance.cjs");require("../constants/contracts.constants.cjs");require("idb-keyval");require("../functions/utils/convertIntegrationProviderToExternalActionId.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("../functions/utils/userAgent.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");const r=require("./WagmiProviderAdapter.cjs"),t=async(i,u)=>{await a.preProcessing();const e=new q.Hinkal;return r.wagmiProviderAdapter.initConfig(u),await e.initProviderAdapter(i,r.wagmiProviderAdapter),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareWagmiHinkal=t;
|
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
import "ethers";
|
|
2
2
|
import "circomlibjs-hinkal-fork";
|
|
3
|
+
import "../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import "../data-structures/crypto-keys/keys.mjs";
|
|
3
5
|
import "libsodium-wrappers";
|
|
4
6
|
import { Hinkal as p } from "../data-structures/Hinkal/Hinkal.mjs";
|
|
5
7
|
import "../constants/chains.constants.mjs";
|
|
6
8
|
import "../types/circom-data.types.mjs";
|
|
9
|
+
import "../constants/vite.constants.mjs";
|
|
7
10
|
import "../types/transactions.types.mjs";
|
|
8
11
|
import "../types/curve.types.mjs";
|
|
12
|
+
import "../types/activities.types.mjs";
|
|
9
13
|
import "../constants/token-data/index.mjs";
|
|
10
|
-
import "../data-structures/custom-token-registry/CustomTokenRegistry.mjs";
|
|
11
|
-
import "../constants/vite.constants.mjs";
|
|
12
14
|
import "axios";
|
|
13
|
-
import "../constants/coingecko.constants.mjs";
|
|
14
|
-
import "../constants/contracts.constants.mjs";
|
|
15
|
-
import "../constants/kyc.constants.mjs";
|
|
16
|
-
import "../constants/axelar.constants.mjs";
|
|
17
|
-
import "../constants/rewards.constants.mjs";
|
|
18
|
-
import "../constants/reorg-depths.constants.mjs";
|
|
19
15
|
import { preProcessing as m } from "../crypto/preProcessing.mjs";
|
|
16
|
+
import "../constants/reorg-depths.constants.mjs";
|
|
20
17
|
import "../functions/utils/external-action.utils.mjs";
|
|
21
18
|
import "node-forge";
|
|
22
19
|
import "../functions/web3/events/getShieldedBalance.mjs";
|
|
23
|
-
import "../
|
|
20
|
+
import "../constants/contracts.constants.mjs";
|
|
24
21
|
import "idb-keyval";
|
|
22
|
+
import "../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
23
|
+
import "../constants/kyc.constants.mjs";
|
|
24
|
+
import "../constants/coingecko.constants.mjs";
|
|
25
|
+
import "../constants/axelar.constants.mjs";
|
|
26
|
+
import "../constants/rewards.constants.mjs";
|
|
27
|
+
import "../constants/addresses.constants.mjs";
|
|
28
|
+
import "../constants/token.limits.constants.mjs";
|
|
29
|
+
import "../functions/utils/userAgent.mjs";
|
|
30
|
+
import "../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
25
31
|
import { wagmiProviderAdapter as r } from "./WagmiProviderAdapter.mjs";
|
|
26
|
-
const
|
|
32
|
+
const F = async (t, o) => {
|
|
27
33
|
await m();
|
|
28
34
|
const i = new p();
|
|
29
35
|
return r.initConfig(o), await i.initProviderAdapter(t, r), await i.initUserKeys(), await i.resetMerkle(), i;
|
|
30
36
|
};
|
|
31
37
|
export {
|
|
32
|
-
|
|
38
|
+
F as prepareWagmiHinkal
|
|
33
39
|
};
|
package/types/API.types.d.ts
CHANGED
|
@@ -21,3 +21,24 @@ export interface LeaderBoardItem {
|
|
|
21
21
|
export interface LeaderboardEntry extends LeaderBoardItem {
|
|
22
22
|
position: number;
|
|
23
23
|
}
|
|
24
|
+
interface AssetChange {
|
|
25
|
+
type: string;
|
|
26
|
+
amount: string | null;
|
|
27
|
+
raw_amount: string;
|
|
28
|
+
dollar_value: string;
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
token_info: {
|
|
32
|
+
standard: string;
|
|
33
|
+
type: string;
|
|
34
|
+
contract_address: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export type AssetChanges = AssetChange[] | null;
|
|
38
|
+
export interface CallInfo<T = bigint> {
|
|
39
|
+
from: string;
|
|
40
|
+
to: string;
|
|
41
|
+
calldata: string;
|
|
42
|
+
value: T;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
package/types/ICacheDevice.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export interface ICacheDevice {
|
|
2
|
-
get(key: string):
|
|
3
|
-
set(key: string, value:
|
|
1
|
+
export interface ICacheDevice<T = string> {
|
|
2
|
+
get(key: string): T | undefined;
|
|
3
|
+
set(key: string, value: T): void;
|
|
4
|
+
serialize(): Record<string, string>;
|
|
4
5
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenChanges } from './token.types';
|
|
2
|
+
import { TxParametersBase } from './wc.types';
|
|
3
|
+
export interface TransactionSimulatorResult<T = bigint> {
|
|
4
|
+
isSameStateChanges: boolean;
|
|
5
|
+
tokenChanges: TokenChanges<T>[];
|
|
6
|
+
}
|
|
7
|
+
export interface ITransactionSimulator {
|
|
8
|
+
isTxStateless(txParameters: TxParametersBase): Promise<TransactionSimulatorResult>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./hinkal.types.cjs");var e=(r=>(r.PENDING="PENDING",r.CONFIRMED="CONFIRMED",r.FAILED="FAILED",r))(e||{}),o=(r=>(r.SHIELD="Deposit",r.SWAP="Swap",r.SEND="Send",r.DAPP_INTERACTION="Dapp Interaction",r.DAPP_INTERACTION_APPROVAL="Dapp Interaction Approval",r.RECIEVE="Shield",r.FUND="Fund",r.UNKNOWN="Unknown Transaction",r))(o||{});const I=[n.IntegrationProvider.UNISWAP,n.IntegrationProvider.ODOS,n.IntegrationProvider.ONEINCH,n.IntegrationProvider.NONE];exports.ActivityStatus=e;exports.ActivityTypes=o;exports.DexProviders=I;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IntegrationProvider } from './hinkal.types';
|
|
2
|
+
import { ERC20Token } from './token.types';
|
|
3
|
+
import { BigNumber } from 'ethers';
|
|
4
|
+
export declare enum ActivityStatus {
|
|
5
|
+
PENDING = "PENDING",
|
|
6
|
+
CONFIRMED = "CONFIRMED",
|
|
7
|
+
FAILED = "FAILED"
|
|
8
|
+
}
|
|
9
|
+
export declare enum ActivityTypes {
|
|
10
|
+
SHIELD = "Deposit",
|
|
11
|
+
SWAP = "Swap",
|
|
12
|
+
SEND = "Send",
|
|
13
|
+
DAPP_INTERACTION = "Dapp Interaction",
|
|
14
|
+
DAPP_INTERACTION_APPROVAL = "Dapp Interaction Approval",
|
|
15
|
+
RECIEVE = "Shield",
|
|
16
|
+
FUND = "Fund",
|
|
17
|
+
UNKNOWN = "Unknown Transaction"
|
|
18
|
+
}
|
|
19
|
+
export type TokenAmountInfo = {
|
|
20
|
+
token: ERC20Token;
|
|
21
|
+
amount: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const DexProviders: IntegrationProvider[];
|
|
24
|
+
export interface ActivityAddRequest {
|
|
25
|
+
activityType: ActivityTypes;
|
|
26
|
+
from?: string;
|
|
27
|
+
to?: string;
|
|
28
|
+
value?: string;
|
|
29
|
+
status?: ActivityStatus;
|
|
30
|
+
txHash?: string;
|
|
31
|
+
gas?: BigNumber;
|
|
32
|
+
gasPrice?: BigNumber;
|
|
33
|
+
tokensReceive?: TokenAmountInfo[];
|
|
34
|
+
tokensSpend?: TokenAmountInfo[];
|
|
35
|
+
chainId: number;
|
|
36
|
+
ownerPublicAddress?: string;
|
|
37
|
+
activityIcon?: string;
|
|
38
|
+
dappUrl?: string;
|
|
39
|
+
integrationProvider?: IntegrationProvider;
|
|
40
|
+
}
|
|
41
|
+
export interface Activity extends ActivityAddRequest {
|
|
42
|
+
id: string;
|
|
43
|
+
timestamp: Date;
|
|
44
|
+
status: ActivityStatus;
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IntegrationProvider as r } from "./hinkal.types.mjs";
|
|
2
|
+
var I = /* @__PURE__ */ ((N) => (N.PENDING = "PENDING", N.CONFIRMED = "CONFIRMED", N.FAILED = "FAILED", N))(I || {}), n = /* @__PURE__ */ ((N) => (N.SHIELD = "Deposit", N.SWAP = "Swap", N.SEND = "Send", N.DAPP_INTERACTION = "Dapp Interaction", N.DAPP_INTERACTION_APPROVAL = "Dapp Interaction Approval", N.RECIEVE = "Shield", N.FUND = "Fund", N.UNKNOWN = "Unknown Transaction", N))(n || {});
|
|
3
|
+
const E = [
|
|
4
|
+
r.UNISWAP,
|
|
5
|
+
r.ODOS,
|
|
6
|
+
r.ONEINCH,
|
|
7
|
+
r.NONE
|
|
8
|
+
];
|
|
9
|
+
export {
|
|
10
|
+
I as ActivityStatus,
|
|
11
|
+
n as ActivityTypes,
|
|
12
|
+
E as DexProviders
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(r=>(r.OnlyCache="ONLY_CACHE",r.Fresh="FRESH",r.FreshWithoutLoader="FRESH_WITHOUT_LOADER",r))(e||{});exports.PrivateBalanceUpdateType=e;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserKeys } from '../data-structures/crypto-keys/keys';
|
|
2
|
+
export declare enum PrivateBalanceUpdateType {
|
|
3
|
+
OnlyCache = "ONLY_CACHE",
|
|
4
|
+
Fresh = "FRESH",
|
|
5
|
+
FreshWithoutLoader = "FRESH_WITHOUT_LOADER"
|
|
6
|
+
}
|
|
7
|
+
export interface BalanceChangeState {
|
|
8
|
+
chainId?: number;
|
|
9
|
+
ethereumAddress?: string;
|
|
10
|
+
userKeys?: UserKeys;
|
|
11
|
+
}
|
|
12
|
+
export type PrivateBalanceUpdateEventType = {
|
|
13
|
+
updateType?: PrivateBalanceUpdateType;
|
|
14
|
+
resetCacheBefore?: boolean;
|
|
15
|
+
balanceChangeState?: BalanceChangeState;
|
|
16
|
+
updateTokensListBefore?: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _=(E=>(E.LOCAL_STORAGE_KEY_USER_ANALYTICS_CONSENT="userAnalyticsConsentPref",E.PASSWORD_HASH="passwordHash",E.SELECTED_NETWORK_CHAIN_ID="selectedNetworkChainId",E.LAST_ADDRESS="lastAddress",E.AUTO_LOCK_TIME="autoLockTime",E.TOKEN_REGISTRY="tokenRegistry",E.IS_BALANCE_HIDDEN="isBalanceHidden",E.SANDBOX_TRANSACTION_STATUS="sandboxTransactionStatus",E.SELECTED_SUB_ACCOUNT_ADDRESS="selectedSubAccountAddress",E.GENERATE_PROOF_REMOTELY="generateProofRemotely",E.IS_RELAYER_OFF="isRelayerOff",E.ONBOARDING_SHOWN="onboardingShown",E.STARRED_PENDLE_MARKETS="starredPendleMarkets",E.STARRED_PENDLE_POOLS="starredPendlePools",E.CONNECT_WITH_HINKAL="connectWithHinkal",E.GAS_COST_TOKEN="gasCostToken",E.PRIVATE_TOKENS="privateTokens",E.PUBLIC_TOKENS="publicTokens",E.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS="publicTokensLastProcessedBlocks",E.ACCEPTED_TERMS_OF_SERVICES="acceptedTermsOfServices",E.SLIPPAGE_PERCENTAGE="slippagePercentage",E.IS_SLIPPAGE_PERCENTAGE_CUSTOM="isSlippagePercentageCustom",E.MNEMONIC_PHRASE="mnemonicPhrase",E.SOURCE_MNEMONIC_PHRASE="sourceMnemonicPhrase",E.SELECTED_WALLET_ENVIRONMENT="selectedWalletEnvironment",E))(_||{});exports.StorageKeys=_;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum StorageKeys {
|
|
2
|
+
LOCAL_STORAGE_KEY_USER_ANALYTICS_CONSENT = "userAnalyticsConsentPref",
|
|
3
|
+
PASSWORD_HASH = "passwordHash",
|
|
4
|
+
SELECTED_NETWORK_CHAIN_ID = "selectedNetworkChainId",
|
|
5
|
+
LAST_ADDRESS = "lastAddress",
|
|
6
|
+
AUTO_LOCK_TIME = "autoLockTime",
|
|
7
|
+
TOKEN_REGISTRY = "tokenRegistry",
|
|
8
|
+
IS_BALANCE_HIDDEN = "isBalanceHidden",
|
|
9
|
+
SANDBOX_TRANSACTION_STATUS = "sandboxTransactionStatus",
|
|
10
|
+
SELECTED_SUB_ACCOUNT_ADDRESS = "selectedSubAccountAddress",
|
|
11
|
+
GENERATE_PROOF_REMOTELY = "generateProofRemotely",
|
|
12
|
+
IS_RELAYER_OFF = "isRelayerOff",
|
|
13
|
+
ONBOARDING_SHOWN = "onboardingShown",
|
|
14
|
+
STARRED_PENDLE_MARKETS = "starredPendleMarkets",
|
|
15
|
+
STARRED_PENDLE_POOLS = "starredPendlePools",
|
|
16
|
+
CONNECT_WITH_HINKAL = "connectWithHinkal",
|
|
17
|
+
GAS_COST_TOKEN = "gasCostToken",
|
|
18
|
+
PRIVATE_TOKENS = "privateTokens",
|
|
19
|
+
PUBLIC_TOKENS = "publicTokens",
|
|
20
|
+
PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS = "publicTokensLastProcessedBlocks",
|
|
21
|
+
ACCEPTED_TERMS_OF_SERVICES = "acceptedTermsOfServices",
|
|
22
|
+
SLIPPAGE_PERCENTAGE = "slippagePercentage",
|
|
23
|
+
IS_SLIPPAGE_PERCENTAGE_CUSTOM = "isSlippagePercentageCustom",
|
|
24
|
+
MNEMONIC_PHRASE = "mnemonicPhrase",
|
|
25
|
+
SOURCE_MNEMONIC_PHRASE = "sourceMnemonicPhrase",
|
|
26
|
+
SELECTED_WALLET_ENVIRONMENT = "selectedWalletEnvironment"
|
|
27
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var _ = /* @__PURE__ */ ((E) => (E.LOCAL_STORAGE_KEY_USER_ANALYTICS_CONSENT = "userAnalyticsConsentPref", E.PASSWORD_HASH = "passwordHash", E.SELECTED_NETWORK_CHAIN_ID = "selectedNetworkChainId", E.LAST_ADDRESS = "lastAddress", E.AUTO_LOCK_TIME = "autoLockTime", E.TOKEN_REGISTRY = "tokenRegistry", E.IS_BALANCE_HIDDEN = "isBalanceHidden", E.SANDBOX_TRANSACTION_STATUS = "sandboxTransactionStatus", E.SELECTED_SUB_ACCOUNT_ADDRESS = "selectedSubAccountAddress", E.GENERATE_PROOF_REMOTELY = "generateProofRemotely", E.IS_RELAYER_OFF = "isRelayerOff", E.ONBOARDING_SHOWN = "onboardingShown", E.STARRED_PENDLE_MARKETS = "starredPendleMarkets", E.STARRED_PENDLE_POOLS = "starredPendlePools", E.CONNECT_WITH_HINKAL = "connectWithHinkal", E.GAS_COST_TOKEN = "gasCostToken", E.PRIVATE_TOKENS = "privateTokens", E.PUBLIC_TOKENS = "publicTokens", E.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS = "publicTokensLastProcessedBlocks", E.ACCEPTED_TERMS_OF_SERVICES = "acceptedTermsOfServices", E.SLIPPAGE_PERCENTAGE = "slippagePercentage", E.IS_SLIPPAGE_PERCENTAGE_CUSTOM = "isSlippagePercentageCustom", E.MNEMONIC_PHRASE = "mnemonicPhrase", E.SOURCE_MNEMONIC_PHRASE = "sourceMnemonicPhrase", E.SELECTED_WALLET_ENVIRONMENT = "selectedWalletEnvironment", E))(_ || {});
|
|
2
|
+
export {
|
|
3
|
+
_ as StorageKeys
|
|
4
|
+
};
|