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