@hinkal/common 0.2.21 → 0.2.22
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 +14 -14
- package/API/API.mjs +88 -87
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.d.ts +1 -1
- package/API/admin-calls.mjs +4 -4
- package/API/ai-calls.cjs +1 -0
- package/API/ai-calls.d.ts +17 -0
- package/API/ai-calls.mjs +21 -0
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.d.ts +1 -1
- package/API/callLifiAPI.mjs +5 -5
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +1 -1
- package/API/callMonitor.mjs +7 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +11 -11
- package/API/callOkxAPI.cjs +1 -1
- package/API/callOkxAPI.d.ts +1 -1
- package/API/callOkxAPI.mjs +5 -5
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +11 -10
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +5 -6
- package/API/callRelayer.mjs +11 -11
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.d.ts +1 -1
- package/API/checkRisk.mjs +4 -4
- package/API/deposit-and-withdraw-status-calls.cjs +1 -0
- package/API/deposit-and-withdraw-status-calls.d.ts +20 -0
- package/API/deposit-and-withdraw-status-calls.mjs +18 -0
- package/API/duneAPI.cjs +1 -0
- package/API/duneAPI.d.ts +11 -0
- package/API/duneAPI.mjs +25 -0
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +4 -5
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.mjs +9 -9
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.d.ts +1 -1
- package/API/get-token-data.mjs +5 -5
- package/API/getBridgeProtocols.cjs +1 -0
- package/API/getBridgeProtocols.d.ts +7 -0
- package/API/getBridgeProtocols.mjs +8 -0
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.mjs +9 -9
- package/API/getLifiStatus.cjs +1 -0
- package/API/getLifiStatus.d.ts +24 -0
- package/API/getLifiStatus.mjs +15 -0
- package/API/getRelayerURL.cjs +1 -0
- package/API/getRelayerURL.d.ts +1 -0
- package/API/getRelayerURL.mjs +10 -0
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -3
- package/API/getServerURL.mjs +67 -51
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +0 -5
- package/API/getTokenPrice.mjs +7 -14
- package/API/index.d.ts +3 -1
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.d.ts +1 -1
- package/API/is-tx-stateless.mjs +12 -10
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +8 -4
- package/API/kycCalls.mjs +26 -23
- package/API/passwordCalls.cjs +1 -0
- package/API/passwordCalls.d.ts +9 -0
- package/API/passwordCalls.mjs +13 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +2 -7
- package/API/proxyAccountsCalls.mjs +21 -27
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +4 -4
- package/API/restoreSnapshots.cjs +1 -0
- package/API/restoreSnapshots.d.ts +1 -0
- package/API/restoreSnapshots.mjs +10 -0
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +9 -1
- package/API/scheduled-transactions-calls.mjs +9 -5
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.d.ts +2 -2
- package/API/simulate-batch-tx.mjs +6 -7
- package/API/solana-calls.cjs +1 -1
- package/API/solana-calls.d.ts +3 -6
- package/API/solana-calls.mjs +15 -15
- package/API/temporaryWalletCalls.cjs +1 -1
- package/API/temporaryWalletCalls.mjs +19 -13
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +5 -6
- package/README.md +54 -42
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +6 -0
- package/constants/chains.constants.mjs +52 -58
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +0 -1
- package/constants/coingecko.constants.mjs +10 -11
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +2 -28
- package/constants/function-signatures.constants.cjs +1 -1
- package/constants/function-signatures.constants.d.ts +1 -0
- package/constants/function-signatures.constants.mjs +4 -3
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +40 -39
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +0 -1
- package/constants/mediaUrls.constants.mjs +1 -2
- package/constants/permit2.constants.cjs +1 -1
- package/constants/permit2.constants.d.ts +1 -0
- package/constants/permit2.constants.mjs +11 -10
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +123 -19
- package/constants/server.constants.mjs +142 -38
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +13 -36
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +71 -68
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +56 -45
- package/data-structures/Hinkal/Hinkal.mjs +348 -314
- package/data-structures/Hinkal/IHinkal.d.ts +54 -40
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +49 -48
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +7 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +42 -0
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +24 -29
- package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
- package/data-structures/Hinkal/hinkalApprove.d.ts +3 -0
- package/data-structures/Hinkal/hinkalApprove.mjs +114 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +20 -20
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +84 -88
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +96 -77
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +80 -75
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +150 -138
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +5 -4
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +4 -0
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +119 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +118 -114
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +34 -36
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -40
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +32 -37
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +15 -17
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +3 -4
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +95 -84
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +182 -155
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +3 -2
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +40 -43
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +67 -71
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -63
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +45 -48
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +48 -49
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +68 -71
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +78 -71
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +70 -71
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +79 -81
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +103 -105
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +53 -107
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +0 -1
- package/data-structures/IndexedDB/activity-db.mjs +75 -91
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +37 -40
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +13 -16
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +40 -25
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +84 -82
- package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
- package/data-structures/TokenDBs/token-visibility-db.mjs +36 -22
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +11 -0
- package/data-structures/crypto-keys/keys.mjs +107 -47
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +2 -4
- package/data-structures/event-service/evm/AbstractEventService.mjs +19 -19
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +5 -6
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +2 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.mjs +4 -3
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +5 -10
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +35 -39
- package/data-structures/event-service/index.d.ts +0 -4
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +3 -4
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +10 -4
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +7 -10
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +2 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +2 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +16 -11
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +66 -64
- package/data-structures/index.d.ts +0 -3
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +13 -8
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +4 -5
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +4 -6
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +0 -1
- package/error-handling/error-codes.constants.mjs +3 -4
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +27 -21
- package/error-handling/handleErrorRestore.cjs +1 -0
- package/error-handling/handleErrorRestore.d.ts +2 -0
- package/error-handling/handleErrorRestore.mjs +11 -0
- package/error-handling/index.d.ts +1 -0
- package/functions/kyc/authentoHelper.cjs +1 -0
- package/functions/kyc/authentoHelper.d.ts +12 -0
- package/functions/kyc/authentoHelper.mjs +30 -0
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.mjs +17 -18
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -2
- package/functions/pre-transaction/constructAdminData.mjs +18 -12
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +2 -1
- package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +36 -21
- package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +9 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +34 -19
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +50 -53
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +6 -3
- package/functions/private-wallet/emporium.helpers.mjs +127 -89
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +4 -1
- package/functions/private-wallet/emporium.swap.helpers.mjs +102 -100
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.mjs +49 -49
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +20 -18
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +10 -11
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +0 -1
- package/functions/utils/addresses.mjs +12 -13
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +1 -1
- package/functions/utils/create-provider.mjs +9 -13
- package/functions/utils/get-hinkal-approvals.cjs +1 -0
- package/functions/utils/get-hinkal-approvals.d.ts +3 -0
- package/functions/utils/get-hinkal-approvals.mjs +38 -0
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +11 -11
- package/functions/utils/index.d.ts +1 -0
- package/functions/utils/involves-permit2-op.cjs +1 -1
- package/functions/utils/involves-permit2-op.d.ts +1 -0
- package/functions/utils/involves-permit2-op.mjs +6 -4
- package/functions/utils/mutexes.utils.cjs +1 -1
- package/functions/utils/mutexes.utils.d.ts +1 -1
- package/functions/utils/mutexes.utils.mjs +3 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +23 -8
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +13 -6
- package/functions/utils/prepareHinkal.mjs +72 -45
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.mjs +54 -49
- 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/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +0 -1
- package/functions/utils/string.utils.mjs +14 -18
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +0 -3
- package/functions/utils/token-check.utils.mjs +7 -18
- package/functions/utils/upToDateState.cjs +1 -1
- package/functions/utils/upToDateState.d.ts +1 -1
- package/functions/utils/upToDateState.mjs +4 -4
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +17 -2
- package/functions/utils/walletBalances.utils.mjs +36 -5
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.d.ts +4 -3
- package/functions/web3/events/getApprovedBalance.mjs +44 -39
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -3
- package/functions/web3/events/getInputUtxoAndBalance.mjs +150 -129
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +75 -73
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.mjs +38 -38
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +10 -13
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +6 -1
- package/functions/web3/functionCalls/accessTokenCalls.mjs +21 -12
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +46 -50
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -1
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- 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/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +40 -36
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +3 -3
- package/functions/web3/functionCalls/transactCallRelayer.mjs +54 -54
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +22 -17
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +6 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +27 -27
- package/functions/web3/index.d.ts +0 -1
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.d.ts +1 -1
- package/functions/web3/lifiAPI.mjs +12 -12
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +19 -6
- package/functions/web3/okxAPI.cjs +1 -1
- package/functions/web3/okxAPI.mjs +13 -13
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +20 -7
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +56 -38
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +34 -22
- package/index.cjs +1 -1
- package/index.mjs +922 -920
- package/package.json +2 -3
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +17 -10
- package/providers/EthersProviderAdapter.mjs +76 -45
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +11 -7
- package/providers/SolanaProviderAdapter.mjs +31 -16
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +17 -11
- package/providers/WagmiProviderAdapter.mjs +117 -86
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +9 -14
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +9 -15
- package/types/TransactionSimulator.types.d.ts +9 -2
- package/types/activities.types.d.ts +0 -2
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +6 -0
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +1 -0
- package/types/bridging.types.d.ts +29 -0
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +3 -6
- package/types/cache.types.mjs +1 -1
- package/types/coingecko.types.d.ts +0 -5
- package/types/duneAPI.types.d.ts +9 -0
- package/types/ethereum-network.types.d.ts +0 -1
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +1 -1
- package/types/hinkal.types.mjs +18 -18
- package/types/index.d.ts +2 -2
- package/types/proxy.types.d.ts +3 -6
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +39 -10
- package/types/sandbox.types.mjs +2 -2
- package/types/scheduled-transactions.types.cjs +1 -1
- package/types/scheduled-transactions.types.d.ts +6 -0
- package/types/scheduled-transactions.types.mjs +3 -2
- package/types/session.types.d.ts +0 -2
- package/types/solana.types.d.ts +0 -9
- package/types/token-prices.types.cjs +1 -1
- package/types/token-prices.types.d.ts +0 -7
- package/types/token-prices.types.mjs +2 -4
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/API/get-token-price-chart-data.cjs +0 -1
- package/API/get-token-price-chart-data.d.ts +0 -16
- package/API/get-token-price-chart-data.mjs +0 -13
- package/API/onrampCalls.cjs +0 -1
- package/API/onrampCalls.d.ts +0 -20
- package/API/onrampCalls.mjs +0 -15
- package/API/unspent-utxos-calls.cjs +0 -1
- package/API/unspent-utxos-calls.d.ts +0 -26
- package/API/unspent-utxos-calls.mjs +0 -26
- package/data-structures/AccountActions/AccountActions.cjs +0 -1
- package/data-structures/AccountActions/AccountActions.d.ts +0 -18
- package/data-structures/AccountActions/AccountActions.mjs +0 -78
- package/data-structures/AccountActions/index.d.ts +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.cjs +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +0 -14
- package/data-structures/BlockchainEvent/BlockchainEvent.mjs +0 -41
- package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +0 -1
- package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +0 -20
- package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +0 -124
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +0 -1
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +0 -15
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +0 -64
- package/data-structures/PublicBalance/index.d.ts +0 -2
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +0 -21
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +0 -16
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/ClientEventHelper.d.ts +0 -11
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +0 -26
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +0 -5
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +0 -14
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +0 -22
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +0 -16
- package/functions/utils/enum.utils.cjs +0 -1
- package/functions/utils/enum.utils.mjs +0 -14
- package/functions/utils/socket.utils.cjs +0 -1
- package/functions/utils/socket.utils.d.ts +0 -1
- package/functions/utils/socket.utils.mjs +0 -12
- package/functions/web3/crypto.cjs +0 -1
- package/functions/web3/crypto.d.ts +0 -1
- package/functions/web3/crypto.mjs +0 -7
- package/types/events.types.cjs +0 -1
- package/types/events.types.d.ts +0 -9
- package/types/events.types.mjs +0 -5
- package/types/onramp.types.cjs +0 -1
- package/types/onramp.types.d.ts +0 -58
- package/types/onramp.types.mjs +0 -4
|
@@ -1,148 +1,146 @@
|
|
|
1
1
|
import { transactionErrorCodes as P } from "../../error-handling/error-codes.constants.mjs";
|
|
2
|
-
import { outputUtxoProcessing as
|
|
3
|
-
import { constructZkProof as
|
|
4
|
-
import { transactCallRelayer as
|
|
5
|
-
import { ExternalActionId as
|
|
6
|
-
import { defaultHinkalLogicArgs as
|
|
7
|
-
import { outputApprovalDataProcessing as
|
|
8
|
-
import { getFeeStructure as
|
|
9
|
-
import { mergeWithFeeStructure as
|
|
2
|
+
import { outputUtxoProcessing as E } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
3
|
+
import { constructZkProof as k } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
4
|
+
import { transactCallRelayer as R } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
5
|
+
import { ExternalActionId as F } from "../../types/external-action.types.mjs";
|
|
6
|
+
import { defaultHinkalLogicArgs as M } from "../../types/hinkal.types.mjs";
|
|
7
|
+
import { outputApprovalDataProcessing as K } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
|
|
8
|
+
import { getFeeStructure as L } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
9
|
+
import { mergeWithFeeStructure as W } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
|
|
10
10
|
import "../../types/circom-data.types.mjs";
|
|
11
|
-
import { ContractType as
|
|
11
|
+
import { ContractType as B } from "../../types/ethereum-network.types.mjs";
|
|
12
12
|
import "../../types/transactions.types.mjs";
|
|
13
|
-
import { AdminTransactionType as
|
|
13
|
+
import { AdminTransactionType as H } from "../../types/admin.types.mjs";
|
|
14
14
|
import "../../types/activities.types.mjs";
|
|
15
15
|
import { getSignatureDataForTransact as N } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
|
|
16
|
-
import { shouldPatchAccessTokenMerkleTree as
|
|
16
|
+
import { shouldPatchAccessTokenMerkleTree as $ } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
|
|
17
17
|
import "../../constants/server.constants.mjs";
|
|
18
|
-
import "../../
|
|
18
|
+
import "../../constants/chains.constants.mjs";
|
|
19
|
+
import "../../constants/vite.constants.mjs";
|
|
19
20
|
import "../http/HttpClient.mjs";
|
|
20
21
|
import "axios";
|
|
21
|
-
import "../../
|
|
22
|
-
import { countTotalAmountInUtxos as _ } from "../../functions/utils/amounts.utils.mjs";
|
|
22
|
+
import { countTotalAmountInUtxos as b } from "../../functions/utils/amounts.utils.mjs";
|
|
23
23
|
import "ethers";
|
|
24
24
|
import "../../constants/token-data/index.mjs";
|
|
25
|
-
import "../../
|
|
26
|
-
import { constructAdminData as q } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
27
|
-
import "@coral-xyz/anchor";
|
|
28
|
-
import "@solana/web3.js";
|
|
25
|
+
import "../../API/getServerURL.mjs";
|
|
29
26
|
import "circomlibjs-hinkal-fork";
|
|
30
|
-
import "
|
|
31
|
-
import "
|
|
32
|
-
import "tweetnacl";
|
|
33
|
-
import "bs58";
|
|
27
|
+
import "libsodium-wrappers";
|
|
28
|
+
import "process";
|
|
34
29
|
import "buffer";
|
|
30
|
+
import "../../constants/save-depths.mjs";
|
|
31
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
32
|
+
import "../../functions/utils/mutexes.utils.mjs";
|
|
33
|
+
import "@coral-xyz/anchor";
|
|
34
|
+
import "@solana/web3.js";
|
|
35
35
|
import "../crypto-keys/keys.mjs";
|
|
36
|
-
import { getCurrentTimeInSeconds as
|
|
37
|
-
import {
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const m = {
|
|
36
|
+
import { getCurrentTimeInSeconds as O } from "../../functions/utils/time.utils.mjs";
|
|
37
|
+
import { constructAdminData as _ } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
38
|
+
import "@solana/spl-token";
|
|
39
|
+
import { getInputUtxoAndBalancePerToken as q } from "../../functions/web3/events/getInputUtxoAndBalance.mjs";
|
|
40
|
+
import { addPaddingToUtxos as z } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
41
|
+
import { encodeTokenWithId as V } from "../../functions/utils/encodeTokenWithId.mjs";
|
|
42
|
+
const Y = async (t, s, m, d) => {
|
|
43
|
+
const r = [s.erc20TokenAddress], p = s.erc20TokenAddress, i = await L(
|
|
44
|
+
t.getCurrentChainId(),
|
|
45
|
+
p,
|
|
46
|
+
r,
|
|
47
|
+
F.Transact
|
|
48
|
+
), c = m - i.flatFee;
|
|
49
|
+
if (c <= 0n)
|
|
50
|
+
throw new Error(`Insufficient balance to cover fee. Balance: ${m}, Fee: ${i.flatFee}`);
|
|
51
|
+
const e = [-c];
|
|
52
|
+
W(t.getCurrentChainId(), r, e, i);
|
|
53
|
+
const o = {
|
|
55
54
|
externalActionId: 0n,
|
|
56
|
-
externalAddress:
|
|
55
|
+
externalAddress: d,
|
|
57
56
|
externalActionMetadata: "0x00"
|
|
58
|
-
},
|
|
59
|
-
...await
|
|
60
|
-
],
|
|
61
|
-
for (let
|
|
62
|
-
const { outputUtxos: S } =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
}, n = [
|
|
58
|
+
...await z(t, r, e, void 0, void 0, !1, !0)
|
|
59
|
+
], x = `swapperM${e.length.toString()}x${n[0].length}x1`, f = M(e.length, t.userKeys), T = O().toString(), A = [];
|
|
60
|
+
for (let a = 0; a < r.length; a += 1) {
|
|
61
|
+
const { outputUtxos: S } = E(
|
|
62
|
+
t.userKeys,
|
|
63
|
+
n[a],
|
|
64
|
+
e[a],
|
|
65
|
+
T,
|
|
67
66
|
void 0,
|
|
68
67
|
!1
|
|
69
68
|
);
|
|
70
|
-
|
|
71
|
-
const { useApprovalUtxoData:
|
|
72
|
-
|
|
69
|
+
A.push(S);
|
|
70
|
+
const { useApprovalUtxoData: g } = K(t, n[a], e[a]);
|
|
71
|
+
g && (f.useApprovalUtxoData[a] = g, f.doPreTxApproval = !0);
|
|
73
72
|
}
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
73
|
+
const l = await t.getRandomRelay(!0);
|
|
74
|
+
if (!l)
|
|
76
75
|
throw Error(P.RELAYER_NOT_AVAILABLE);
|
|
77
|
-
const { patchAccessTokenMerkleTree:
|
|
78
|
-
e,
|
|
76
|
+
const { patchAccessTokenMerkleTree: C, kycRequired: w, hasAccessToken: I } = await $(
|
|
79
77
|
t,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
),
|
|
83
|
-
t,
|
|
84
|
-
await
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
), { zkCallData:
|
|
78
|
+
r,
|
|
79
|
+
e
|
|
80
|
+
), v = await N(
|
|
81
|
+
t.getCurrentChainId(),
|
|
82
|
+
await t.getEthereumAddress(),
|
|
83
|
+
t.userKeys,
|
|
84
|
+
w,
|
|
85
|
+
I
|
|
86
|
+
), { zkCallData: y, circomData: U, dimData: h } = await k(
|
|
89
87
|
"v1x1",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
t.merkleTreeHinkal,
|
|
89
|
+
t.merkleTreeAccessToken,
|
|
90
|
+
n,
|
|
91
|
+
A,
|
|
92
|
+
t.userKeys,
|
|
93
93
|
x,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
g,
|
|
101
|
-
t,
|
|
94
|
+
o.externalActionId,
|
|
95
|
+
o.externalAddress,
|
|
96
|
+
o.externalActionMetadata,
|
|
97
|
+
t.generateProofRemotely,
|
|
98
|
+
l,
|
|
99
|
+
t.getCurrentChainId(),
|
|
102
100
|
void 0,
|
|
103
101
|
void 0,
|
|
104
102
|
void 0,
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
C,
|
|
104
|
+
f,
|
|
107
105
|
void 0,
|
|
108
106
|
i,
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
t.getContractWithFetcher(B.HinkalHelperContract),
|
|
108
|
+
v,
|
|
111
109
|
void 0,
|
|
112
110
|
!1
|
|
113
|
-
), D =
|
|
114
|
-
|
|
115
|
-
t,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
await
|
|
111
|
+
), D = _(
|
|
112
|
+
H.WithdrawOnChainUtxos,
|
|
113
|
+
t.getCurrentChainId(),
|
|
114
|
+
r,
|
|
115
|
+
e,
|
|
116
|
+
await t.getEthereumAddress()
|
|
119
117
|
);
|
|
120
|
-
return { tx: await
|
|
121
|
-
t,
|
|
122
|
-
|
|
123
|
-
E,
|
|
118
|
+
return { tx: await R(
|
|
119
|
+
t.getCurrentChainId(),
|
|
120
|
+
y,
|
|
124
121
|
h,
|
|
122
|
+
U,
|
|
125
123
|
void 0,
|
|
126
124
|
void 0,
|
|
127
125
|
void 0,
|
|
128
126
|
D
|
|
129
|
-
), amountToRecipient:
|
|
130
|
-
},
|
|
131
|
-
const
|
|
127
|
+
), amountToRecipient: c };
|
|
128
|
+
}, Wt = async (t, s, m) => {
|
|
129
|
+
const d = [], r = t.getCurrentChainId(), p = V(r, { erc20TokenAddress: s.erc20TokenAddress, tokenId: 0 });
|
|
132
130
|
for (; ; ) {
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
await t.resetMerkleTreesIfNecessary();
|
|
132
|
+
const c = ((await q({
|
|
133
|
+
hinkal: t,
|
|
135
134
|
sliceIfMore6: !1,
|
|
136
|
-
useBlockedUtxos: !0
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (!o)
|
|
135
|
+
useBlockedUtxos: !0
|
|
136
|
+
}))?.get(p) ?? []).filter((o) => o.amount > 0n).slice(0, 6).sort((o, n) => Number(n.amount - o.amount)), u = b(c);
|
|
137
|
+
if (!u)
|
|
140
138
|
break;
|
|
141
|
-
const
|
|
142
|
-
|
|
139
|
+
const { tx: e } = await Y(t, s, u, m);
|
|
140
|
+
d.push(e);
|
|
143
141
|
}
|
|
144
|
-
return
|
|
142
|
+
return d;
|
|
145
143
|
};
|
|
146
144
|
export {
|
|
147
|
-
|
|
145
|
+
Wt as hinkalWithdrawStuckUtxos
|
|
148
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../constants/chains.constants.cjs");require("../../types/circom-data.types.cjs");const S=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const h=require("../../types/balances.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("../../constants/save-depths.cjs");const m=require("../event-service/evm/BlockchainEventEmitter.cjs"),q=require("../event-service/solana/SolanaBlockchainEventEmitter.cjs"),d=require("@solana/web3.js");require("../crypto-keys/keys.cjs");const T=require("../../functions/web3/events/balanceChangedCustomHandler.cjs"),C=require("../snapshot/SnapshotFetcherService.cjs"),f=require("../snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs"),w=require("../snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs"),E=require("../snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs"),y=require("../snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs"),g=require("../snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs"),F=require("../snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs"),P=require("../snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs"),A=require("../../functions/utils/create-provider.cjs"),I=async e=>{const o=e.getCurrentChainId(),{maxPageSize:s,fetchRpcUrl:p,contractData:l}=u.networkRegistry[e.getCurrentChainId()];e.commitmentsSnapshotService?.intervalClear(),e.nullifierSnapshotService?.intervalClear(),e.accessTokenSnapshotService?.intervalClear(),e.approvalsSnapshotService?.intervalClear();let t,i;if(u.isSolanaLike(o)){const r=l.hinkalAddress;if(!p||!r)throw new Error("Fetch RPC URL or Solana program ID is not set");const c=A.createCustomSolanaConnection(p),n=new d.PublicKey(r);t=new q.SolanaBlockchainEventEmitter(c,n,0,!1,s);const v=l.hinkalIdl;v&&t.setIdl(v);const a=new C.SnapshotFetcherService(o,r);e.commitmentsSnapshotService=new f.ClientSolanaCommitmentsSnapshotService(t,a),e.nullifierSnapshotService=new w.ClientSolanaNullifierSnapshotService(t,a),e.accessTokenSnapshotService=new E.ClientSolanaAccessTokenSnapshotService(t,a),e.approvalsSnapshotService=void 0}else{const r=e.getContractWithFetcher(S.ContractType.HinkalContract),c=e.getContractWithFetcher(S.ContractType.DepositOnChainUtxos);t=new m.BlockchainEventEmitter(r,0,!1,s,c),i=new m.BlockchainEventEmitter(e.getContractWithFetcher(S.ContractType.AccessTokenContract),0,!1,s);const n=new C.SnapshotFetcherService(o,r.address);e.commitmentsSnapshotService=new g.ClientCommitmentsSnapshotService(t,n),e.nullifierSnapshotService=new F.ClientNullifierSnapshotService(t,n),e.accessTokenSnapshotService=new y.ClientAccessTokenSnapshotService(i,n),e.approvalsSnapshotService=new P.ClientApprovalsSnapshotService(t,n)}await Promise.all([e.commitmentsSnapshotService.init(),e.nullifierSnapshotService.init(),e.accessTokenSnapshotService.init(),e.approvalsSnapshotService?.init()]),await Promise.all([t.init(),i?.init()]),e.merkleTreeHinkal=e.commitmentsSnapshotService.merkleTree,e.merkleTreeAccessToken=e.accessTokenSnapshotService.merkleTree,e.nullifiers=e.nullifierSnapshotService.nullifiers,e.encryptedOutputs=e.commitmentsSnapshotService.encryptedOutputs,e.approvalsSnapshotService&&(e.approvals=e.approvalsSnapshotService.approvals),t.onEventsProcessed=r=>{r>0&&T.balanceChangedCustomHandler({updateType:h.PrivateBalanceUpdateType.FreshWithoutLoader,updateTokensListBefore:!0})}};exports.resetMerkleTrees=I;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IHinkal } from './IHinkal';
|
|
2
|
-
export declare const resetMerkleTrees: (hinkal: IHinkal
|
|
2
|
+
export declare const resetMerkleTrees: (hinkal: IHinkal) => Promise<void>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { networkRegistry as
|
|
1
|
+
import { networkRegistry as C, isSolanaLike as h } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import "../../types/circom-data.types.mjs";
|
|
3
|
-
import { ContractType as
|
|
3
|
+
import { ContractType as p } from "../../types/ethereum-network.types.mjs";
|
|
4
4
|
import "../../types/transactions.types.mjs";
|
|
5
5
|
import "../../types/activities.types.mjs";
|
|
6
|
-
import { PrivateBalanceUpdateType as
|
|
7
|
-
import { EventCategory as u } from "../../types/events.types.mjs";
|
|
6
|
+
import { PrivateBalanceUpdateType as u } from "../../types/balances.types.mjs";
|
|
8
7
|
import "ethers";
|
|
9
8
|
import "circomlibjs-hinkal-fork";
|
|
10
9
|
import "libsodium-wrappers";
|
|
@@ -13,110 +12,57 @@ import "buffer";
|
|
|
13
12
|
import "../../constants/vite.constants.mjs";
|
|
14
13
|
import "../../error-handling/error-codes.constants.mjs";
|
|
15
14
|
import "../../constants/save-depths.mjs";
|
|
16
|
-
import "
|
|
17
|
-
import {
|
|
18
|
-
import "@
|
|
19
|
-
import { ClientSolanaBlockchainEventEmitter as A } from "../event-service/solana/ClientSolanaBlockchainEventEmitter.mjs";
|
|
20
|
-
import { PublicKey as R } from "@solana/web3.js";
|
|
15
|
+
import { BlockchainEventEmitter as v } from "../event-service/evm/BlockchainEventEmitter.mjs";
|
|
16
|
+
import { SolanaBlockchainEventEmitter as d } from "../event-service/solana/SolanaBlockchainEventEmitter.mjs";
|
|
17
|
+
import { PublicKey as T } from "@solana/web3.js";
|
|
21
18
|
import "../crypto-keys/keys.mjs";
|
|
22
|
-
import { balanceChangedCustomHandler as
|
|
23
|
-
import { SnapshotFetcherService as
|
|
24
|
-
import { ClientSolanaCommitmentsSnapshotService as
|
|
25
|
-
import { ClientSolanaNullifierSnapshotService as
|
|
26
|
-
import { ClientSolanaAccessTokenSnapshotService as
|
|
27
|
-
import { ClientAccessTokenSnapshotService as
|
|
28
|
-
import { ClientCommitmentsSnapshotService as
|
|
29
|
-
import { ClientNullifierSnapshotService as
|
|
30
|
-
import { ClientApprovalsSnapshotService as
|
|
31
|
-
import { createCustomSolanaConnection as
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const r = t.getContractWithFetcherByChainId(e, v.HinkalContract), l = t.getContractWithFetcherByChainId(
|
|
69
|
-
e,
|
|
70
|
-
v.DepositOnChainUtxos
|
|
71
|
-
), s = g(e);
|
|
72
|
-
o = new w(
|
|
73
|
-
u.MainContractEvents,
|
|
74
|
-
e,
|
|
75
|
-
r,
|
|
76
|
-
0,
|
|
77
|
-
s,
|
|
78
|
-
a,
|
|
79
|
-
l
|
|
80
|
-
), p = new w(
|
|
81
|
-
u.MainContractEvents,
|
|
82
|
-
e,
|
|
83
|
-
t.getContractWithFetcherByChainId(e, v.AccessTokenContract),
|
|
84
|
-
0,
|
|
85
|
-
s,
|
|
86
|
-
a
|
|
87
|
-
);
|
|
88
|
-
const n = new T(e, r.address);
|
|
89
|
-
t.commitmentsSnapshotServiceByChain[e] = new H(
|
|
90
|
-
o,
|
|
91
|
-
n
|
|
92
|
-
), t.nullifierSnapshotServiceByChain[e] = new b(
|
|
93
|
-
o,
|
|
94
|
-
n
|
|
95
|
-
), t.accessTokenSnapshotServiceByChain[e] = new D(
|
|
96
|
-
p,
|
|
97
|
-
n
|
|
98
|
-
), t.approvalsSnapshotServiceByChain[e] = new k(
|
|
99
|
-
o,
|
|
100
|
-
n
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
const i = t.commitmentsSnapshotServiceByChain[e], m = t.nullifierSnapshotServiceByChain[e], c = t.accessTokenSnapshotServiceByChain[e], S = t.approvalsSnapshotServiceByChain[e];
|
|
104
|
-
if (!i || !m || !c)
|
|
105
|
-
throw new Error(`Missing snapshot service for chain ${e}`);
|
|
106
|
-
await Promise.all([
|
|
107
|
-
i.init(),
|
|
108
|
-
m.init(),
|
|
109
|
-
c.init(),
|
|
110
|
-
S?.init()
|
|
111
|
-
]), await Promise.all([o.init(), p?.init()]), t.merkleTreeHinkalByChain[e] = i.merkleTree, t.merkleTreeAccessTokenByChain[e] = c.merkleTree, t.nullifiersByChain[e] = m.nullifiers, t.encryptedOutputsByChain[e] = i.encryptedOutputs, S && (t.approvalsByChain[e] = S.approvals), o.onEventsProcessed = (r) => {
|
|
112
|
-
r > 0 && U({
|
|
113
|
-
updateType: M.FreshWithoutLoader,
|
|
114
|
-
updateTokensListBefore: !0
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
await Promise.allSettled(F);
|
|
19
|
+
import { balanceChangedCustomHandler as w } from "../../functions/web3/events/balanceChangedCustomHandler.mjs";
|
|
20
|
+
import { SnapshotFetcherService as f } from "../snapshot/SnapshotFetcherService.mjs";
|
|
21
|
+
import { ClientSolanaCommitmentsSnapshotService as g } from "../snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs";
|
|
22
|
+
import { ClientSolanaNullifierSnapshotService as E } from "../snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs";
|
|
23
|
+
import { ClientSolanaAccessTokenSnapshotService as y } from "../snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs";
|
|
24
|
+
import { ClientAccessTokenSnapshotService as F } from "../snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs";
|
|
25
|
+
import { ClientCommitmentsSnapshotService as I } from "../snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs";
|
|
26
|
+
import { ClientNullifierSnapshotService as P } from "../snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs";
|
|
27
|
+
import { ClientApprovalsSnapshotService as A } from "../snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs";
|
|
28
|
+
import { createCustomSolanaConnection as U } from "../../functions/utils/create-provider.mjs";
|
|
29
|
+
const oe = async (e) => {
|
|
30
|
+
const n = e.getCurrentChainId(), { maxPageSize: i, fetchRpcUrl: m, contractData: S } = C[e.getCurrentChainId()];
|
|
31
|
+
e.commitmentsSnapshotService?.intervalClear(), e.nullifierSnapshotService?.intervalClear(), e.accessTokenSnapshotService?.intervalClear(), e.approvalsSnapshotService?.intervalClear();
|
|
32
|
+
let t, s;
|
|
33
|
+
if (h(n)) {
|
|
34
|
+
const r = S.hinkalAddress;
|
|
35
|
+
if (!m || !r)
|
|
36
|
+
throw new Error("Fetch RPC URL or Solana program ID is not set");
|
|
37
|
+
const a = U(m), o = new T(r);
|
|
38
|
+
t = new d(a, o, 0, !1, i);
|
|
39
|
+
const l = S.hinkalIdl;
|
|
40
|
+
l && t.setIdl(l);
|
|
41
|
+
const c = new f(n, r);
|
|
42
|
+
e.commitmentsSnapshotService = new g(t, c), e.nullifierSnapshotService = new E(t, c), e.accessTokenSnapshotService = new y(t, c), e.approvalsSnapshotService = void 0;
|
|
43
|
+
} else {
|
|
44
|
+
const r = e.getContractWithFetcher(p.HinkalContract), a = e.getContractWithFetcher(p.DepositOnChainUtxos);
|
|
45
|
+
t = new v(r, 0, !1, i, a), s = new v(
|
|
46
|
+
e.getContractWithFetcher(p.AccessTokenContract),
|
|
47
|
+
0,
|
|
48
|
+
!1,
|
|
49
|
+
i
|
|
50
|
+
);
|
|
51
|
+
const o = new f(n, r.address);
|
|
52
|
+
e.commitmentsSnapshotService = new I(t, o), e.nullifierSnapshotService = new P(t, o), e.accessTokenSnapshotService = new F(s, o), e.approvalsSnapshotService = new A(t, o);
|
|
53
|
+
}
|
|
54
|
+
await Promise.all([
|
|
55
|
+
e.commitmentsSnapshotService.init(),
|
|
56
|
+
e.nullifierSnapshotService.init(),
|
|
57
|
+
e.accessTokenSnapshotService.init(),
|
|
58
|
+
e.approvalsSnapshotService?.init()
|
|
59
|
+
]), await Promise.all([t.init(), s?.init()]), e.merkleTreeHinkal = e.commitmentsSnapshotService.merkleTree, e.merkleTreeAccessToken = e.accessTokenSnapshotService.merkleTree, e.nullifiers = e.nullifierSnapshotService.nullifiers, e.encryptedOutputs = e.commitmentsSnapshotService.encryptedOutputs, e.approvalsSnapshotService && (e.approvals = e.approvalsSnapshotService.approvals), t.onEventsProcessed = (r) => {
|
|
60
|
+
r > 0 && w({
|
|
61
|
+
updateType: u.FreshWithoutLoader,
|
|
62
|
+
updateTokensListBefore: !0
|
|
63
|
+
});
|
|
64
|
+
};
|
|
119
65
|
};
|
|
120
66
|
export {
|
|
121
|
-
|
|
67
|
+
oe as resetMerkleTrees
|
|
122
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("idb-keyval"),m=require("ethers");require("../../types/circom-data.types.cjs");const I=require("../../constants/protocol.constants.cjs");require("../../types/transactions.types.cjs");const y=require("../../types/activities.types.cjs"),d=require("../../types/cache.types.cjs");require("../../constants/token-data/index.cjs");const k=require("../../constants/chains.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");const P=require("../../functions/utils/amounts.utils.cjs");require("circomlibjs-hinkal-fork");require("../http/HttpClient.cjs");const b=require("../../error-handling/logger.cjs"),_=require("../../functions/utils/erc20tokenFunctions.cjs");require("../../functions/utils/convertIntegrationProviderToExternalActionId.cjs");const N=require("../../functions/web3/etherFunctions.cjs");require("../crypto-keys/keys.cjs");require("../../error-handling/error-codes.constants.cjs");require("axios");require("../../API/getServerURL.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../../functions/utils/mutexes.utils.cjs");require("@solana/spl-token");require("../../functions/utils/userAgent.cjs");require("multiformats");const C=require("../../API/API.cjs");require("../../API/tenderly.api.cjs");require("node-forge");require("../../functions/web3/events/getApprovedBalance.cjs");require("../../functions/web3/getTokenHolder.cjs");require("ethers-v6h");class B{generateTxId(){const e=new Date().getTime(),t=Math.random().toString(36).substring(2,15);return`tx_${e}_${t}`}async getTransactionRecord(){return await g.get(d.StorageKeys.TX_ACTIVITY)||{}}async saveTxRequest(e){const{from:t,to:r,gas:a,gasPrice:n,gasInDollar:s,value:o,chainId:u,status:i,txHash:q,activityType:c,tokensReceive:l,tokensSpend:p,tokensApprove:h,ownerPublicAddress:A,activityIcon:S,dappUrl:w,dappName:x,integrationProvider:D}=e,T=this.generateTxId(),f={id:T,from:t,to:r,gas:a,gasPrice:n,gasInDollar:s?.toString(),value:o,chainId:u,txHash:q,activityType:c,status:i??y.ActivityStatus.PENDING,timestamp:new Date,tokensReceive:l,tokensSpend:p,tokensApprove:h,ownerPublicAddress:A,activityIcon:S,dappUrl:w,dappName:x,integrationProvider:D};return await g.update(d.StorageKeys.TX_ACTIVITY,(v={})=>(v[T]=f,v)),T}async getTxRequest(e){return(await this.getTransactionRecord())[e]||null}async getAllTxRequests(e){const t=await this.getTransactionRecord();return Object.values(t).filter(r=>r.chainId===e).sort((r,a)=>new Date(a.timestamp).getTime()-new Date(r.timestamp).getTime())}async updateTxStatusAndHash(e,t,r,a,n,s,o,u){const i=await this.getTxRequest(e);if(!i)throw new Error("Transaction not found");const q=await this.getGasInDollar(o,u,i.chainId),c={...i,status:t,txHash:r,value:i.value??a,from:i.from??n,to:i.to??s,gas:o,gasPrice:u,gasInDollar:i.gasInDollar??q?.toString(),timestamp:new Date};return await g.update(d.StorageKeys.TX_ACTIVITY,(l={})=>(l[e]=c,l)),c}async updateActivity(e,t,r,a,n,s,o,u){try{await this.updateTxStatusAndHash(e,t,r,a,n,s,o,u)}catch(i){console.log("error in updating tx request",i)}}async removePendingTransactions(e){try{await g.update(d.StorageKeys.TX_ACTIVITY,(t={})=>(delete t[e],t))}catch(t){console.log("error in deleting tx requests",t)}}async updatePendingTransactions(e,t){try{if(!e.success){await this.updateActivity(t,y.ActivityStatus.FAILED,"erroredTx"in e?e.erroredTx?.transactionHash:void 0);return}if("tx"in e){const{tx:r}=e;await this.updateActivity(t,y.ActivityStatus.SUCCESSFUL,r.hash,m.BigNumber.from(r.value??0n).toHexString(),r.from,r.to,m.BigNumber.from(r.gas??0n),m.BigNumber.from(r.gasPrice??0n))}}catch(r){console.log("error in updating pending transactions",r)}}getGasInDollar=async(e,t,r)=>{if(!(!e||!t))try{const a=k.isSolanaLike(r)?I.solanaNativeAddress:I.zeroAddress,n=_.getERC20Token(a,r);if(!n)return;const{prices:s}=await C.API.getTokenPrices(r,[n.erc20TokenAddress]),o=s[0];if(!o)return;const i=o*Number(N.getAmountInToken(n,t.toBigInt()))*Number(e.toBigInt());return P.fixDecimalsAmount(i)}catch(a){b.Logger.error("Failed to calculate gas cost in dollars:",{chainId:r,error:a});return}}}const E=new B;exports.activityStorage=E;
|
|
@@ -5,7 +5,6 @@ declare class ActivityStorage {
|
|
|
5
5
|
saveTxRequest(txRequest: ActivityAddRequest): Promise<string>;
|
|
6
6
|
getTxRequest(id: string): Promise<Activity>;
|
|
7
7
|
getAllTxRequests(chainId: number): Promise<Activity[]>;
|
|
8
|
-
updateTxHash(activityId: string, newTxHash: string): Promise<void>;
|
|
9
8
|
private updateTxStatusAndHash;
|
|
10
9
|
private updateActivity;
|
|
11
10
|
removePendingTransactions(pendingActivityId: string): Promise<void>;
|