@hinkal/common 0.2.31 → 0.2.32
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 +26 -11
- package/API/API.mjs +103 -88
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +8 -0
- package/API/callMonitor.mjs +2 -2
- package/API/callRelayer.d.ts +4 -1
- package/API/dashboardAccountCalls.cjs +1 -0
- package/API/dashboardAccountCalls.d.ts +24 -0
- package/API/dashboardAccountCalls.mjs +10 -0
- package/API/dashboardAccountMemberCalls.cjs +1 -0
- package/API/dashboardAccountMemberCalls.d.ts +34 -0
- package/API/dashboardAccountMemberCalls.mjs +16 -0
- package/API/dashboardBalanceCalls.cjs +1 -0
- package/API/dashboardBalanceCalls.d.ts +12 -0
- package/API/dashboardBalanceCalls.mjs +13 -0
- package/API/dashboardContactCalls.cjs +1 -0
- package/API/dashboardContactCalls.d.ts +9 -0
- package/API/dashboardContactCalls.mjs +13 -0
- package/API/dashboardPayoutCalls.cjs +1 -0
- package/API/dashboardPayoutCalls.d.ts +14 -0
- package/API/dashboardPayoutCalls.mjs +13 -0
- package/API/dashboardTransactionCalls.cjs +1 -0
- package/API/dashboardTransactionCalls.d.ts +3 -0
- package/API/dashboardTransactionCalls.mjs +10 -0
- package/API/enclaveRecipientInfoCalls.cjs +1 -0
- package/API/enclaveRecipientInfoCalls.d.ts +14 -0
- package/API/enclaveRecipientInfoCalls.mjs +7 -0
- package/API/enclaveSignatureCalls.cjs +1 -1
- package/API/enclaveSignatureCalls.d.ts +3 -8
- package/API/enclaveSignatureCalls.mjs +6 -8
- package/API/enclaveUtxoCalls.cjs +1 -1
- package/API/enclaveUtxoCalls.d.ts +8 -2
- package/API/enclaveUtxoCalls.mjs +5 -3
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.d.ts +1 -19
- package/API/fetchCommitmentsCache.mjs +9 -22
- package/API/getAnyRecipientInfo.d.ts +1 -0
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -0
- package/API/getServerURL.mjs +15 -32
- package/API/getWebsiteURL.cjs +1 -1
- package/API/getWebsiteURL.d.ts +3 -2
- package/API/getWebsiteURL.mjs +12 -5
- package/API/index.cjs +1 -1
- package/API/index.d.ts +2 -0
- package/API/index.mjs +2 -0
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +0 -5
- package/API/kycCalls.mjs +3 -10
- package/API/privateSendRecipientInfoCalls.cjs +1 -1
- package/API/privateSendRecipientInfoCalls.d.ts +0 -10
- package/API/privateSendRecipientInfoCalls.mjs +2 -2
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +8 -2
- package/API/scheduled-transactions-calls.mjs +5 -4
- package/API/tenderly.api.cjs +1 -1
- package/API/tenderly.api.d.ts +1 -1
- package/API/tenderly.api.mjs +1 -1
- package/constants/addresses.constants.cjs +1 -1
- package/constants/addresses.constants.d.ts +10 -7
- package/constants/addresses.constants.mjs +11 -8
- package/constants/assets.constants.cjs +1 -1
- package/constants/assets.constants.mjs +1 -1
- package/constants/auth.constants.cjs +1 -0
- package/constants/auth.constants.d.ts +2 -0
- package/constants/auth.constants.mjs +4 -0
- package/constants/backend.constants.cjs +1 -1
- package/constants/backend.constants.d.ts +0 -1
- package/constants/backend.constants.mjs +0 -1
- package/constants/bridging.constants.cjs +1 -1
- package/constants/bridging.constants.d.ts +2 -0
- package/constants/bridging.constants.mjs +7 -3
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +25 -8
- package/constants/chains.constants.mjs +168 -127
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +5 -3
- package/constants/coingecko.constants.mjs +8 -5
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +0 -4
- package/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-arbMainnet.json.mjs +125 -850
- package/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-arcTestnet.json.mjs +97 -1013
- package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-base.json.mjs +132 -869
- package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +132 -871
- package/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-localhost.json.mjs +6 -808
- package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-optimism.json.mjs +132 -869
- package/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -0
- package/constants/deploy-data/deploy-data-optimismTest.json.mjs +3565 -0
- package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-polygon.json.mjs +132 -869
- package/constants/deploy-data/deploy-data-sepoliaTestnet.json.cjs +1 -0
- package/constants/deploy-data/deploy-data-sepoliaTestnet.json.mjs +3561 -0
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +1 -1
- package/constants/deploy-data/deploy-data-tempo.json.cjs +1 -0
- package/constants/deploy-data/deploy-data-tempo.json.mjs +3563 -0
- package/constants/deploy-data/deploy-data-tronMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-tronMainnet.json.mjs +133 -870
- package/constants/deploy-data/deploy-data-tronNile.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-tronNile.json.mjs +133 -870
- package/constants/deploy-data/index.d.ts +4 -1
- package/constants/events.constants.cjs +1 -1
- package/constants/events.constants.mjs +4 -1
- package/constants/fees.constants.cjs +1 -1
- package/constants/fees.constants.d.ts +5 -1
- package/constants/fees.constants.mjs +9 -5
- package/constants/index.cjs +1 -1
- package/constants/index.d.ts +2 -1
- package/constants/index.mjs +6 -2
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.d.ts +1 -1
- package/constants/kyc.constants.mjs +38 -37
- package/constants/lifi.constants.cjs +1 -1
- package/constants/lifi.constants.d.ts +2 -0
- package/constants/lifi.constants.mjs +7 -2
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +7 -1
- package/constants/mediaUrls.constants.mjs +9 -3
- package/constants/price-impact.constants.cjs +1 -0
- package/constants/price-impact.constants.d.ts +2 -0
- package/constants/price-impact.constants.mjs +4 -0
- package/constants/protocol.constants.cjs +1 -1
- package/constants/protocol.constants.d.ts +4 -1
- package/constants/protocol.constants.mjs +2 -2
- package/constants/reorg-depths.constants.cjs +1 -1
- package/constants/reorg-depths.constants.d.ts +3 -1
- package/constants/reorg-depths.constants.mjs +3 -1
- package/constants/save-depths.cjs +1 -1
- package/constants/save-depths.d.ts +3 -1
- package/constants/save-depths.mjs +3 -1
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +33 -8
- package/constants/server.constants.mjs +44 -24
- package/constants/token-data/ERC20Registry.cjs +1 -1
- package/constants/token-data/ERC20Registry.mjs +20 -9
- package/constants/token-data/arbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistry.json.mjs +24 -24
- package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistryFixed.json.mjs +24 -24
- package/constants/token-data/arcTestnetRegistry.json.cjs +1 -1
- package/constants/token-data/arcTestnetRegistry.json.mjs +3 -3
- package/constants/token-data/baseRegistry.json.cjs +1 -1
- package/constants/token-data/baseRegistry.json.mjs +20 -12
- package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
- package/constants/token-data/baseRegistryFixed.json.mjs +18 -10
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +38 -38
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +38 -38
- package/constants/token-data/localhostRegistry.json.cjs +1 -1
- package/constants/token-data/localhostRegistry.json.mjs +211 -211
- package/constants/token-data/optimismRegistry.json.cjs +1 -1
- package/constants/token-data/optimismRegistry.json.mjs +36 -28
- package/constants/token-data/optimismRegistryFixed.json.cjs +1 -1
- package/constants/token-data/optimismRegistryFixed.json.mjs +36 -28
- package/constants/token-data/polygonRegistry.json.cjs +1 -1
- package/constants/token-data/polygonRegistry.json.mjs +34 -26
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +34 -26
- package/constants/token-data/sepoliaTestnetRegistry.json.cjs +1 -0
- package/constants/token-data/sepoliaTestnetRegistry.json.mjs +21 -0
- package/constants/token-data/solanaMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/solanaMainnetRegistry.json.mjs +1 -1
- package/constants/token-data/tempoRegistry.json.cjs +1 -0
- package/constants/token-data/tempoRegistry.json.mjs +37 -0
- package/constants/token-data/tronMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/tronMainnetRegistry.json.mjs +26 -15
- package/constants/token-data/tronNileRegistry.json.cjs +1 -1
- package/constants/token-data/tronNileRegistry.json.mjs +2 -2
- package/constants/tokens.constants.cjs +1 -1
- package/constants/tokens.constants.d.ts +1 -0
- package/constants/tokens.constants.mjs +10 -3
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +23 -5
- package/constants/wallet.constants.cjs +1 -1
- package/constants/wallet.constants.d.ts +1 -1
- package/constants/wallet.constants.mjs +2 -18
- package/crypto/babyJub.d.ts +1 -1
- package/crypto/ecdh-dual-path.cjs +1 -0
- package/crypto/ecdh-dual-path.d.ts +13 -0
- package/crypto/ecdh-dual-path.mjs +39 -0
- package/crypto/ecdh-sealed-keys.cjs +1 -0
- package/crypto/ecdh-sealed-keys.d.ts +22 -0
- package/crypto/ecdh-sealed-keys.mjs +33 -0
- package/crypto/ecdh.cjs +1 -0
- package/crypto/ecdh.d.ts +2 -0
- package/crypto/ecdh.mjs +9 -0
- package/crypto/eddsa.cjs +1 -0
- package/crypto/eddsa.d.ts +8 -0
- package/crypto/eddsa.mjs +12 -0
- package/crypto/index.cjs +1 -1
- package/crypto/index.d.ts +4 -0
- package/crypto/index.mjs +4 -0
- package/crypto/preProcessing.cjs +1 -1
- package/crypto/preProcessing.d.ts +1 -1
- package/crypto/preProcessing.mjs +10 -8
- package/data-structures/AccountActions/AccountActions.cjs +1 -1
- package/data-structures/AccountActions/AccountActions.mjs +3 -2
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +2 -3
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +16 -21
- package/data-structures/Hinkal/Hinkal.mjs +144 -160
- package/data-structures/Hinkal/IHinkal.d.ts +13 -19
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +15 -15
- package/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/data-structures/Hinkal/hinkalClaimUtxo.d.ts +1 -2
- package/data-structures/Hinkal/hinkalClaimUtxo.mjs +49 -47
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.d.ts +5 -3
- package/data-structures/Hinkal/hinkalDeposit.mjs +106 -50
- package/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndBridge.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepositAndBridge.mjs +94 -87
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +3 -2
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +48 -48
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +41 -63
- package/data-structures/Hinkal/hinkalPalEvmDeposit.cjs +1 -0
- package/data-structures/Hinkal/hinkalPalEvmDeposit.d.ts +9 -0
- package/data-structures/Hinkal/hinkalPalEvmDeposit.mjs +19 -0
- package/data-structures/Hinkal/hinkalPalSolanaDepositPrepare.cjs +1 -0
- package/data-structures/Hinkal/hinkalPalSolanaDepositPrepare.d.ts +9 -0
- package/data-structures/Hinkal/hinkalPalSolanaDepositPrepare.mjs +18 -0
- package/data-structures/Hinkal/hinkalPalTronDepositPrepare.cjs +1 -0
- package/data-structures/Hinkal/hinkalPalTronDepositPrepare.d.ts +9 -0
- package/data-structures/Hinkal/hinkalPalTronDepositPrepare.mjs +17 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +46 -50
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +4 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +84 -128
- package/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -0
- package/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +7 -0
- package/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +51 -0
- package/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.cjs +1 -0
- package/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.d.ts +6 -0
- package/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.mjs +128 -0
- package/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaClaimUtxo.d.ts +2 -2
- package/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +68 -69
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +4 -3
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +96 -57
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +20 -2
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +114 -122
- package/data-structures/Hinkal/hinkalSolanaProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProoflessDeposit.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProoflessDeposit.mjs +12 -17
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +38 -40
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +4 -3
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +68 -52
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.d.ts +2 -2
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +67 -72
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +56 -61
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +38 -48
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +32 -42
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +41 -54
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +43 -56
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +87 -108
- package/data-structures/Hinkal/index.cjs +1 -1
- package/data-structures/Hinkal/index.d.ts +5 -0
- package/data-structures/Hinkal/index.mjs +5 -0
- package/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.cjs +1 -0
- package/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.d.ts +22 -0
- package/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.mjs +34 -0
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +33 -40
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.mjs +25 -24
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.d.ts +1 -0
- package/data-structures/IndexedDB/contact-db.mjs +30 -16
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.d.ts +1 -1
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +4 -4
- package/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +37 -34
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.d.ts +2 -0
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +65 -50
- package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/PrivateTokensDB.mjs +2 -1
- package/data-structures/WalletManager/WalletManager.cjs +1 -0
- package/data-structures/WalletManager/WalletManager.d.ts +51 -0
- package/data-structures/WalletManager/WalletManager.mjs +99 -0
- package/data-structures/WalletManager/index.cjs +1 -0
- package/data-structures/WalletManager/index.d.ts +1 -0
- package/data-structures/WalletManager/index.mjs +1 -0
- package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/data-structures/crypto-keys/decodeUTXO.d.ts +5 -3
- package/data-structures/crypto-keys/decodeUTXO.mjs +49 -46
- package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +32 -40
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +51 -24
- package/data-structures/crypto-keys/keys.mjs +104 -43
- package/data-structures/custom-token-registry/CustomTokenRegistry.cjs +1 -1
- package/data-structures/custom-token-registry/CustomTokenRegistry.mjs +2 -2
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +2 -2
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +4 -4
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +1 -1
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -1
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +3 -3
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +1 -1
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +2 -0
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +7 -3
- package/data-structures/event-service/index.cjs +1 -1
- package/data-structures/event-service/index.d.ts +0 -3
- package/data-structures/event-service/index.mjs +0 -3
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +2 -2
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +5 -5
- package/data-structures/index.cjs +1 -1
- package/data-structures/index.d.ts +1 -0
- package/data-structures/index.mjs +10 -10
- package/data-structures/merkle-tree/index.cjs +1 -1
- package/data-structures/merkle-tree/index.d.ts +0 -1
- package/data-structures/merkle-tree/index.mjs +0 -1
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +6 -0
- package/data-structures/snapshot/SnapshotFetcherService.cjs +1 -1
- package/data-structures/snapshot/SnapshotFetcherService.d.ts +0 -2
- package/data-structures/snapshot/SnapshotFetcherService.mjs +0 -6
- package/data-structures/snapshot/index.cjs +1 -1
- package/data-structures/snapshot/index.d.ts +0 -3
- package/data-structures/snapshot/index.mjs +0 -3
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +16 -10
- package/data-structures/utxo/Utxo.mjs +40 -38
- package/error-handling/customErrors/HttpError.cjs +1 -0
- package/error-handling/customErrors/HttpError.d.ts +4 -0
- package/error-handling/customErrors/HttpError.mjs +8 -0
- package/error-handling/customErrors/index.cjs +1 -1
- package/error-handling/customErrors/index.d.ts +1 -0
- package/error-handling/customErrors/index.mjs +1 -0
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +11 -0
- package/error-handling/error-codes.constants.mjs +13 -2
- package/error-handling/index.cjs +1 -1
- package/error-handling/index.mjs +1 -0
- package/error-handling/retrySolanaError.cjs +1 -0
- package/error-handling/retrySolanaError.d.ts +1 -0
- package/error-handling/retrySolanaError.mjs +4 -0
- package/externalABIs/index.cjs +1 -1
- package/externalABIs/index.d.ts +1 -16
- package/externalABIs/index.mjs +4 -5
- package/functions/auto-deposit-back-helpers/get-gas-token-records.d.ts +1 -1
- package/functions/auto-deposit-back-helpers/get-tokens-to-deposit-back.d.ts +1 -1
- package/functions/index.cjs +1 -1
- package/functions/index.mjs +28 -19
- package/functions/kyc/checkTokenLimitsUSD.cjs +1 -1
- package/functions/kyc/checkTokenLimitsUSD.mjs +15 -15
- package/functions/kyc/index.cjs +1 -1
- package/functions/kyc/index.d.ts +0 -1
- package/functions/kyc/index.mjs +0 -1
- package/functions/pre-transaction/addressTableLookup.cjs +1 -1
- package/functions/pre-transaction/addressTableLookup.mjs +21 -18
- package/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -0
- package/functions/pre-transaction/buildCommitmentValidationData.d.ts +4 -0
- package/functions/pre-transaction/buildCommitmentValidationData.mjs +58 -0
- package/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -0
- package/functions/pre-transaction/calculateSolanaNullifierCount.d.ts +2 -0
- package/functions/pre-transaction/calculateSolanaNullifierCount.mjs +23 -0
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.mjs +4 -4
- package/functions/pre-transaction/index.cjs +1 -1
- package/functions/pre-transaction/index.d.ts +2 -3
- package/functions/pre-transaction/index.mjs +3 -4
- package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.mjs +22 -19
- package/functions/pre-transaction/recipientUtxoProcessing.cjs +1 -1
- package/functions/pre-transaction/recipientUtxoProcessing.mjs +11 -9
- package/functions/pre-transaction/sendInitNullifiersTransaction.cjs +1 -1
- package/functions/pre-transaction/sendInitNullifiersTransaction.mjs +9 -9
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +45 -43
- package/functions/pre-transaction/solana-public-signals.cjs +1 -1
- package/functions/pre-transaction/solana-public-signals.d.ts +7 -6
- package/functions/pre-transaction/solana-public-signals.mjs +22 -19
- package/functions/pre-transaction/solana.cjs +1 -1
- package/functions/pre-transaction/solana.d.ts +0 -4
- package/functions/pre-transaction/solana.mjs +7 -27
- package/functions/pre-transaction/store-proof.cjs +1 -1
- package/functions/pre-transaction/store-proof.mjs +3 -3
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +13 -3
- package/functions/private-wallet/emporium.helpers.mjs +84 -74
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.mjs +6 -6
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.d.ts +8 -13
- package/functions/snarkjs/common.snarkjs.mjs +65 -74
- package/functions/snarkjs/constant.cjs +1 -1
- package/functions/snarkjs/constant.d.ts +146 -426
- package/functions/snarkjs/constant.mjs +149 -430
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +2 -3
- package/functions/snarkjs/constructGeneralZkProof.mjs +74 -57
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.d.ts +1 -2
- package/functions/snarkjs/constructSolanaZkProof.mjs +65 -37
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.d.ts +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +6 -10
- package/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/functions/snarkjs/fetchOnChainRootHashes.d.ts +0 -1
- package/functions/snarkjs/fetchOnChainRootHashes.mjs +22 -7
- package/functions/snarkjs/generateCircomData.cjs +1 -1
- package/functions/snarkjs/generateCircomData.d.ts +2 -2
- package/functions/snarkjs/generateCircomData.mjs +29 -31
- package/functions/snarkjs/generateZkProof.cjs +1 -1
- package/functions/snarkjs/generateZkProof.mjs +20 -10
- package/functions/snarkjs/generateZkProofEnclave.cjs +1 -1
- package/functions/snarkjs/generateZkProofEnclave.mjs +15 -18
- package/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +2 -9
- package/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +40 -94
- package/functions/snarkjs/getZKFiles.cjs +1 -1
- package/functions/snarkjs/getZKFiles.d.ts +1 -0
- package/functions/snarkjs/getZKFiles.mjs +2 -2
- package/functions/snarkjs/index.cjs +1 -1
- package/functions/snarkjs/index.d.ts +2 -1
- package/functions/snarkjs/index.mjs +2 -1
- package/functions/snarkjs/signedMessageHash.cjs +1 -0
- package/functions/snarkjs/signedMessageHash.d.ts +31 -0
- package/functions/snarkjs/signedMessageHash.mjs +49 -0
- package/functions/snarkjs/verifyCommitmentValidationData.cjs +1 -0
- package/functions/snarkjs/verifyCommitmentValidationData.d.ts +4 -0
- package/functions/snarkjs/verifyCommitmentValidationData.mjs +43 -0
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +2 -0
- package/functions/utils/addresses.mjs +12 -8
- package/functions/utils/aggregateTokenAmounts.cjs +1 -0
- package/functions/utils/aggregateTokenAmounts.d.ts +2 -0
- package/functions/utils/aggregateTokenAmounts.mjs +26 -0
- package/functions/utils/amounts.utils.cjs +1 -1
- package/functions/utils/amounts.utils.d.ts +0 -1
- package/functions/utils/amounts.utils.mjs +18 -18
- package/functions/utils/auth.utils.cjs +1 -0
- package/functions/utils/auth.utils.d.ts +5 -0
- package/functions/utils/auth.utils.mjs +7 -0
- package/functions/utils/bit.operations.cjs +1 -0
- package/functions/utils/bit.operations.d.ts +3 -0
- package/functions/utils/bit.operations.mjs +4 -0
- package/functions/utils/buildClaimableDepositPlan.cjs +1 -1
- package/functions/utils/buildClaimableDepositPlan.d.ts +3 -2
- package/functions/utils/buildClaimableDepositPlan.mjs +32 -24
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.d.ts +0 -4
- package/functions/utils/cacheFunctions.mjs +33 -47
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +2 -3
- package/functions/utils/create-provider.mjs +8 -10
- package/functions/utils/customEnclaveFunctionsRegister.cjs +1 -0
- package/functions/utils/customEnclaveFunctionsRegister.d.ts +18 -0
- package/functions/utils/customEnclaveFunctionsRegister.mjs +8 -0
- package/functions/utils/deposit-claimable.utils.cjs +1 -0
- package/functions/utils/deposit-claimable.utils.d.ts +6 -0
- package/functions/utils/deposit-claimable.utils.mjs +106 -0
- package/functions/utils/dispatchBalanceRefreshes.cjs +1 -0
- package/functions/utils/dispatchBalanceRefreshes.d.ts +4 -0
- package/functions/utils/dispatchBalanceRefreshes.mjs +44 -0
- package/functions/utils/enclave-recipient-info-storage.cjs +1 -0
- package/functions/utils/enclave-recipient-info-storage.d.ts +2 -0
- package/functions/utils/enclave-recipient-info-storage.mjs +17 -0
- package/functions/utils/enclave-signature-storage.cjs +1 -1
- package/functions/utils/enclave-signature-storage.d.ts +1 -2
- package/functions/utils/enclave-signature-storage.mjs +6 -9
- package/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/functions/utils/enclave-utxo-storage.d.ts +3 -2
- package/functions/utils/enclave-utxo-storage.mjs +18 -21
- package/functions/utils/encodeTokenWithId.cjs +1 -1
- package/functions/utils/encodeTokenWithId.mjs +1 -1
- package/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/functions/utils/encryptInputForEnclave.mjs +17 -23
- package/functions/utils/enum.utils.cjs +1 -0
- package/functions/utils/enum.utils.mjs +12 -0
- package/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/functions/utils/erc20tokenFunctions.d.ts +2 -0
- package/functions/utils/erc20tokenFunctions.mjs +26 -16
- package/functions/utils/evmNetworkFunctions.d.ts +1 -2
- package/functions/utils/fees.utils.cjs +1 -1
- package/functions/utils/fees.utils.d.ts +2 -1
- package/functions/utils/fees.utils.mjs +30 -16
- package/functions/utils/formatter.cjs +1 -0
- package/functions/utils/formatter.d.ts +1 -0
- package/functions/utils/formatter.mjs +15 -0
- package/functions/utils/getBlockExplorerUrl.cjs +1 -1
- package/functions/utils/getBlockExplorerUrl.mjs +1 -1
- package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/functions/utils/getRecipientInfoFromUserKeys.d.ts +2 -0
- package/functions/utils/getRecipientInfoFromUserKeys.mjs +14 -9
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -0
- package/functions/utils/getUtxosFromReceipt.utils.mjs +43 -27
- package/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/functions/utils/getUtxosFromReceiptSolana.d.ts +1 -0
- package/functions/utils/getUtxosFromReceiptSolana.mjs +36 -21
- package/functions/utils/getWalletGroupKey.utils.cjs +1 -1
- package/functions/utils/getWalletGroupKey.utils.mjs +4 -1
- package/functions/utils/index.cjs +1 -1
- package/functions/utils/index.d.ts +14 -1
- package/functions/utils/index.mjs +21 -9
- package/functions/utils/lifi.utils.cjs +1 -0
- package/functions/utils/lifi.utils.d.ts +3 -0
- package/functions/utils/lifi.utils.mjs +30 -0
- package/functions/utils/mnemonics.cjs +1 -0
- package/functions/utils/mnemonics.d.ts +1 -0
- package/functions/utils/mnemonics.mjs +8 -0
- package/functions/utils/pay-routing.utils.cjs +1 -0
- package/functions/utils/pay-routing.utils.d.ts +4 -0
- package/functions/utils/pay-routing.utils.mjs +17 -0
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.mjs +29 -29
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.mjs +5 -5
- package/functions/utils/serialize-utxos.utils.cjs +1 -1
- package/functions/utils/serialize-utxos.utils.mjs +6 -2
- package/functions/utils/solana-memo.cjs +1 -0
- package/functions/utils/solana-memo.d.ts +3 -0
- package/functions/utils/solana-memo.mjs +15 -0
- package/functions/utils/solanaSendPreflight.utils.cjs +1 -0
- package/functions/utils/solanaSendPreflight.utils.d.ts +6 -0
- package/functions/utils/solanaSendPreflight.utils.mjs +21 -0
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.mjs +1 -1
- package/functions/utils/time.utils.cjs +1 -1
- package/functions/utils/time.utils.d.ts +6 -0
- package/functions/utils/time.utils.mjs +23 -16
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +1 -0
- package/functions/utils/token-check.utils.mjs +9 -8
- package/functions/utils/transfer-claimable.utils.cjs +1 -0
- package/functions/utils/transfer-claimable.utils.d.ts +9 -0
- package/functions/utils/transfer-claimable.utils.mjs +93 -0
- package/functions/utils/tron.utils.cjs +1 -1
- package/functions/utils/tron.utils.d.ts +11 -1
- package/functions/utils/tron.utils.mjs +85 -40
- package/functions/utils/tx-confirmation.utils.cjs +1 -1
- package/functions/utils/tx-confirmation.utils.mjs +5 -5
- package/functions/utils/userAgent.cjs +1 -1
- package/functions/utils/userAgent.d.ts +1 -0
- package/functions/utils/userAgent.mjs +4 -1
- package/functions/web3/connectors.utils.cjs +1 -1
- package/functions/web3/connectors.utils.d.ts +1 -0
- package/functions/web3/connectors.utils.mjs +5 -2
- package/functions/web3/events/balanceChangedHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedHandler.d.ts +2 -1
- package/functions/web3/events/balanceChangedHandler.mjs +3 -3
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.mjs +21 -20
- package/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/functions/web3/events/getInputUtxosEnclave.d.ts +2 -1
- package/functions/web3/events/getInputUtxosEnclave.mjs +25 -18
- package/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +15 -17
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.mjs +1 -1
- package/functions/web3/events/index.cjs +1 -1
- package/functions/web3/events/index.d.ts +0 -2
- package/functions/web3/events/index.mjs +0 -2
- package/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/functions/web3/functionCalls/constructBatchCall.d.ts +1 -0
- package/functions/web3/functionCalls/constructBatchCall.mjs +10 -2
- package/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirectTron.d.ts +4 -1
- package/functions/web3/functionCalls/transactCallDirectTron.mjs +89 -55
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +5 -4
- package/functions/web3/functionCalls/transactCallRelayer.mjs +17 -13
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +1 -1
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +1 -1
- package/functions/web3/index.cjs +1 -1
- package/functions/web3/index.d.ts +0 -1
- package/functions/web3/index.mjs +0 -3
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.mjs +28 -19
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +1 -1
- package/index.cjs +1 -1
- package/index.mjs +331 -309
- package/package.json +5 -2
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.mjs +1 -1
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +10 -1
- package/providers/SolanaProviderAdapter.mjs +38 -2
- package/providers/TronProviderAdapter.cjs +1 -1
- package/providers/TronProviderAdapter.mjs +2 -2
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +3 -1
- package/providers/WagmiProviderAdapter.mjs +62 -52
- package/providers/prepareSolanaHinkal.cjs +1 -1
- package/providers/prepareSolanaHinkal.mjs +3 -3
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +1 -8
- package/types/admin.types.mjs +1 -1
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +2 -1
- package/types/cache.types.mjs +1 -1
- package/types/chains.types.cjs +1 -0
- package/types/chains.types.d.ts +11 -0
- package/types/chains.types.mjs +8 -0
- package/types/circom-data.types.d.ts +13 -0
- package/types/commitments.types.d.ts +0 -6
- package/types/contacts.types.d.ts +1 -0
- package/types/dashboard-account.cjs +1 -0
- package/types/dashboard-account.d.ts +101 -0
- package/types/dashboard-account.mjs +8 -0
- package/types/dashboard-payout.types.cjs +1 -0
- package/types/dashboard-payout.types.d.ts +29 -0
- package/types/dashboard-payout.types.mjs +8 -0
- package/types/dashboard-transaction.types.d.ts +22 -0
- package/types/ethereum-network.types.cjs +1 -1
- package/types/ethereum-network.types.d.ts +15 -18
- package/types/ethereum-network.types.mjs +1 -1
- package/types/events.types.cjs +1 -1
- package/types/events.types.d.ts +2 -3
- package/types/events.types.mjs +1 -1
- package/types/external-action.types.cjs +1 -1
- package/types/external-action.types.d.ts +2 -1
- package/types/external-action.types.mjs +1 -1
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +6 -17
- package/types/hinkal.types.mjs +16 -18
- package/types/index.cjs +1 -1
- package/types/index.d.ts +6 -0
- package/types/index.mjs +3 -0
- package/types/pay-activities.types.d.ts +3 -0
- package/types/pay-routing.types.d.ts +9 -0
- package/types/scheduled-transactions.types.d.ts +7 -0
- package/types/solana.types.d.ts +5 -6
- package/types/token-prices.types.d.ts +4 -0
- package/types/transaction.types.d.ts +1 -3
- package/webworker/WorkerWrapper.cjs +1 -0
- package/webworker/WorkerWrapper.d.ts +9 -0
- package/webworker/WorkerWrapper.mjs +22 -0
- package/webworker/logError-fCJ4HXQz.js +22 -0
- package/webworker/package.json +112 -0
- package/webworker/performTaskWithWorker.cjs +1 -1
- package/webworker/performTaskWithWorker.mjs +4 -4
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.d.ts +0 -3
- package/webworker/snarkjsWorker/snarkjsWorkerNode.d.ts +0 -0
- package/webworker/snarkjsWorkerNode.cjs +3 -0
- package/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.d.ts +0 -3
- package/webworker/utxoWorker/utxoWorkerNode.d.ts +0 -0
- package/webworker/utxoWorkerNode.cjs +1 -0
- package/webworker/viteWorkerURL.constant.cjs +4 -4
- package/webworker/viteWorkerURL.constant.mjs +4 -4
- package/webworker/worker.registry.cjs +1 -1
- package/webworker/worker.registry.mjs +6 -3
- package/webworker/workerFactory.cjs +1 -1
- package/webworker/workerFactory.d.ts +4 -1
- package/webworker/workerFactory.mjs +31 -17
- package/webworker/workerProxy-BNBqYien.js +130 -0
- package/webworker/workerProxy.d.ts +1 -1
- package/webworker/workerThreadsPatch.d.ts +1 -0
- package/webworker/zkProofWorker/zkProofWorker.types.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorker.types.d.ts +3 -13
- package/webworker/zkProofWorker/zkProofWorker.types.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.d.ts +1 -5
- package/webworker/zkProofWorker/zkProofWorkerNode.d.ts +0 -0
- package/webworker/zkProofWorkerNode.cjs +1 -0
- package/API/solana-calls.cjs +0 -1
- package/API/solana-calls.d.ts +0 -38
- package/API/solana-calls.mjs +0 -8
- package/constants/non-circular-tokens.constants.cjs +0 -1
- package/constants/non-circular-tokens.constants.d.ts +0 -1
- package/constants/non-circular-tokens.constants.mjs +0 -4
- package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.cjs +0 -1
- package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.d.ts +0 -3
- package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.mjs +0 -15
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +0 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.d.ts +0 -4
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +0 -18
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +0 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +0 -35
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +0 -75
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +0 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +0 -30
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +0 -81
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +0 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +0 -35
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +0 -76
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs +0 -1
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.ts +0 -2
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs +0 -13
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +0 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.d.ts +0 -8
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +0 -29
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +0 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.d.ts +0 -8
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +0 -30
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +0 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.d.ts +0 -8
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +0 -26
- package/externalABIs/transactionsProver.json.cjs +0 -1
- package/externalABIs/transactionsProver.json.mjs +0 -43
- package/functions/pre-transaction/getKycAndSignatureData.cjs +0 -1
- package/functions/pre-transaction/getKycAndSignatureData.d.ts +0 -5
- package/functions/pre-transaction/getKycAndSignatureData.mjs +0 -12
- package/functions/pre-transaction/getSignatureDataForTransact.cjs +0 -1
- package/functions/pre-transaction/getSignatureDataForTransact.d.ts +0 -3
- package/functions/pre-transaction/getSignatureDataForTransact.mjs +0 -6
- package/functions/pre-transaction/initTokenLimitIfNeeded.cjs +0 -1
- package/functions/pre-transaction/initTokenLimitIfNeeded.d.ts +0 -3
- package/functions/pre-transaction/initTokenLimitIfNeeded.mjs +0 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +0 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +0 -10
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +0 -22
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +0 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +0 -6
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +0 -11
- package/functions/snarkjs/constructEmporiumProof.cjs +0 -1
- package/functions/snarkjs/constructEmporiumProof.d.ts +0 -13
- package/functions/snarkjs/constructEmporiumProof.mjs +0 -74
- package/functions/utils/processUseApprovalUtxoData.cjs +0 -1
- package/functions/utils/processUseApprovalUtxoData.d.ts +0 -3
- package/functions/utils/processUseApprovalUtxoData.mjs +0 -13
- package/functions/web3/events/balanceChangedCustomHandler.cjs +0 -1
- package/functions/web3/events/balanceChangedCustomHandler.d.ts +0 -2
- package/functions/web3/events/balanceChangedCustomHandler.mjs +0 -9
- package/functions/web3/events/getApprovedBalance.cjs +0 -1
- package/functions/web3/events/getApprovedBalance.d.ts +0 -6
- package/functions/web3/events/getApprovedBalance.mjs +0 -37
- package/functions/web3/functionCalls/accessTokenCalls.cjs +0 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +0 -2
- package/functions/web3/functionCalls/accessTokenCalls.mjs +0 -19
- package/functions/web3/tron-wagmi-adapter.cjs +0 -1
- package/functions/web3/tron-wagmi-adapter.d.ts +0 -8
- package/functions/web3/tron-wagmi-adapter.mjs +0 -27
- package/providers/CustomEthersProvider.cjs +0 -1
- package/providers/CustomEthersProvider.d.ts +0 -10
- package/providers/CustomEthersProvider.mjs +0 -28
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +0 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +0 -30
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +0 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +0 -69
- package/webworker/workerProxy.cjs +0 -1
- package/webworker/workerProxy.mjs +0 -33
- package/webworker/zkProofWorker/zkProofWorkerLogic.cjs +0 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.mjs +0 -45
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { CIRCOM_P as e } from "../../constants/protocol.constants.mjs";
|
|
2
2
|
import { poseidonHash as t } from "../../crypto/poseidon.mjs";
|
|
3
3
|
import { babyJubInstance as n } from "../../crypto/babyJub.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import s from "
|
|
9
|
-
import
|
|
4
|
+
import { eddsaInstance as r } from "../../crypto/eddsa.mjs";
|
|
5
|
+
import { AttachableMemoryCacheDevice as i } from "../cacheDevices/AttachableMemoryCacheDevice.mjs";
|
|
6
|
+
import { getCircomSign as a } from "./keyUtils.mjs";
|
|
7
|
+
import { ethers as o } from "ethers";
|
|
8
|
+
import { Keypair as s, PublicKey as c } from "@solana/web3.js";
|
|
9
|
+
import { Trx as l } from "tronweb";
|
|
10
|
+
import u from "libsodium-wrappers";
|
|
11
|
+
import d from "bs58";
|
|
12
|
+
import f from "tweetnacl";
|
|
10
13
|
//#region libs/shared/common/src/data-structures/crypto-keys/keys.ts
|
|
11
|
-
var
|
|
14
|
+
var p = new i(), m = new i(), h = new i(), g = {
|
|
12
15
|
privateKey: "",
|
|
13
16
|
publicKey: ""
|
|
14
|
-
},
|
|
17
|
+
}, _ = class {
|
|
15
18
|
signature;
|
|
16
|
-
|
|
19
|
+
nullifyingKey;
|
|
20
|
+
PREFIX_FOR_SPENDING_PAIR = "1";
|
|
21
|
+
PREFIX_FOR_NULLIFYING_PAIR = "2";
|
|
17
22
|
constructor(e, t) {
|
|
18
|
-
this.signature = e, this.
|
|
23
|
+
this.signature = e, this.nullifyingKey = t;
|
|
19
24
|
}
|
|
20
25
|
getSignature() {
|
|
21
26
|
return this.requireSignature(), this.signature;
|
|
@@ -27,70 +32,126 @@ var l = new r(), u = new r(), d = {
|
|
|
27
32
|
if (!this.signature) throw Error("No signature provided");
|
|
28
33
|
}
|
|
29
34
|
requireKeyMaterial() {
|
|
30
|
-
if (!this.signature && !this.
|
|
35
|
+
if (!this.signature && !this.nullifyingKey) throw Error("No signature or private key provided");
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
return this.requireSignature(),
|
|
37
|
+
verifyTronMessage(e, t) {
|
|
38
|
+
return this.requireSignature(), t === l.verifyMessageV2(e, this.signature);
|
|
34
39
|
}
|
|
35
|
-
getShieldedPrivateKey = () => (this.requireKeyMaterial(), this.
|
|
40
|
+
getShieldedPrivateKey = () => (this.requireKeyMaterial(), this.nullifyingKey ||= o.keccak256(this.signature), this.nullifyingKey);
|
|
36
41
|
getShieldedPublicKey = () => (this.requireKeyMaterial(), t(this.getShieldedPrivateKey()));
|
|
42
|
+
getSpendingKeyPair = () => {
|
|
43
|
+
this.requireSignature();
|
|
44
|
+
let e = r(), i = n(), a = t(this.PREFIX_FOR_SPENDING_PAIR, this.getSignature()), s = Buffer.from(o.getBytes(a)), c = e.prv2pub(s);
|
|
45
|
+
return {
|
|
46
|
+
privSpendingKey: a,
|
|
47
|
+
pubSpendingBJJPoint: [BigInt(i.F.toString(c[0])), BigInt(i.F.toString(c[1]))]
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
signEddsa = (e) => {
|
|
51
|
+
this.requireSignature();
|
|
52
|
+
let t = n(), i = r(), a = Buffer.from(o.getBytes(this.getSpendingKeyPair().privSpendingKey)), s = t.F.e(e), c = i.signPoseidon(a, s);
|
|
53
|
+
return {
|
|
54
|
+
R8: [BigInt(t.F.toString(c.R8[0])), BigInt(t.F.toString(c.R8[1]))],
|
|
55
|
+
S: BigInt(c.S)
|
|
56
|
+
};
|
|
57
|
+
};
|
|
37
58
|
getShieldedPrivateKeyFromNonce = (e) => {
|
|
38
59
|
this.requireKeyMaterial();
|
|
39
60
|
let n = t(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
|
|
40
|
-
return
|
|
61
|
+
return o.keccak256(o.toUtf8Bytes(`hinkal-offchain-shielded-key:${n}`));
|
|
41
62
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
getClaimableSignatureFromNonce = (e) => {
|
|
64
|
+
this.requireKeyMaterial();
|
|
65
|
+
let n = t(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
|
|
66
|
+
return o.keccak256(o.toUtf8Bytes(`hinkal-claimable-utxo-signature:${n}`));
|
|
67
|
+
};
|
|
68
|
+
getDerivedEthereumAddress = () => (this.requireKeyMaterial(), new o.Wallet(this.getShieldedPrivateKey()).address);
|
|
69
|
+
getDerivedSolanaPublicKey = () => (this.requireKeyMaterial(), s.fromSeed(o.getBytes(this.getShieldedPrivateKey())).publicKey.toBase58());
|
|
45
70
|
getSignerPrivateKeyFromNonce = (e) => {
|
|
46
71
|
this.requireKeyMaterial();
|
|
47
72
|
let n = t(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
|
|
48
|
-
return
|
|
73
|
+
return o.keccak256(o.toUtf8Bytes(n));
|
|
49
74
|
};
|
|
50
75
|
getSignerSolanaPrivateKeyFromNonce = (e) => {
|
|
51
|
-
let t = this.getSignerPrivateKeyFromNonce(e), n =
|
|
52
|
-
return
|
|
53
|
-
};
|
|
54
|
-
getWalletSalt = (e) => (this.requireKeyMaterial(), t(this.getShieldedPublicKey(), this.getShieldedPrivateKey(), e));
|
|
55
|
-
getInHinkalAddress = (e) => {
|
|
56
|
-
this.requireKeyMaterial();
|
|
57
|
-
let n = t(this.getShieldedPrivateKey(), e);
|
|
58
|
-
return BigInt(n);
|
|
76
|
+
let t = this.getSignerPrivateKeyFromNonce(e), n = o.getBytes(t), r = s.fromSeed(n);
|
|
77
|
+
return d.encode(r.secretKey);
|
|
59
78
|
};
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
verifyMessage(e) {
|
|
80
|
+
return this.requireSignature(), o.verifyMessage(e, this.signature);
|
|
81
|
+
}
|
|
82
|
+
verifySolanaMessage(e, t) {
|
|
83
|
+
this.requireSignature();
|
|
84
|
+
let n = new TextEncoder().encode(e), r = o.getBytes(this.signature), i = new c(t).toBytes();
|
|
85
|
+
return f.sign.detached.verify(n, r, i);
|
|
86
|
+
}
|
|
87
|
+
static getRandomizedStealthPairOld = m.attach((t, r) => {
|
|
62
88
|
let i = n(), a = t * (BigInt(r) % e) % e, o = i.mulPointEscalar(i.Base8, t), s = i.mulPointEscalar(i.Base8, a);
|
|
63
89
|
return {
|
|
64
90
|
H0: [BigInt(i.F.toString(o[0])), BigInt(i.F.toString(o[1]))],
|
|
65
91
|
H1: [BigInt(i.F.toString(s[0])), BigInt(i.F.toString(s[1]))]
|
|
66
92
|
};
|
|
67
93
|
});
|
|
94
|
+
static getRandomizedStealthPair = p.attach((t, r) => {
|
|
95
|
+
let i = n(), a = BigInt(r) % e, o = i.mulPointEscalar(i.Base8, t), s = i.mulPointEscalar(o, a);
|
|
96
|
+
return {
|
|
97
|
+
H0: [BigInt(i.F.toString(o[0])), BigInt(i.F.toString(o[1]))],
|
|
98
|
+
H1: [BigInt(i.F.toString(s[0])), BigInt(i.F.toString(s[1]))]
|
|
99
|
+
};
|
|
100
|
+
});
|
|
68
101
|
static getStealthAddressCompressedPoints = (e, t) => {
|
|
69
|
-
let { H0: n, H1: r } = this.
|
|
102
|
+
let { H0: n, H1: r } = this.getRandomizedStealthPairOld(e, t), [i, o] = [n, r].map((e) => BigInt(e[1]) + 2n ** 255n * a(e[0]));
|
|
70
103
|
return {
|
|
71
|
-
h0:
|
|
104
|
+
h0: i,
|
|
72
105
|
h1: o
|
|
73
106
|
};
|
|
74
107
|
};
|
|
75
|
-
static getStealthAddress = u.attach((e, n) => {
|
|
76
|
-
let { H0: r, H1: a } = this.getRandomizedStealthPair(e, n);
|
|
77
|
-
return t(2n * i(r[0]) + i(a[0]), r[1], a[1]);
|
|
78
|
-
});
|
|
79
|
-
static getStealthAddressWithEKey = (e, t) => ({
|
|
80
|
-
stealthAddress: this.getStealthAddress(e, t),
|
|
81
|
-
encryptionKey: this.getEncryptionKeyPair(t).publicKey
|
|
82
|
-
});
|
|
83
108
|
static checkSignature = (e, t, n, r) => {
|
|
84
109
|
let { h0: i, h1: a } = this.getStealthAddressCompressedPoints(e, r);
|
|
85
110
|
return t === i && n === a;
|
|
86
111
|
};
|
|
112
|
+
static getStealthAddress = h.attach((e, n) => {
|
|
113
|
+
let { H0: r, H1: i } = this.getRandomizedStealthPairOld(e, n);
|
|
114
|
+
return t(2n * a(r[0]) + a(i[0]), r[1], i[1]);
|
|
115
|
+
});
|
|
116
|
+
static getH1FromH0 = (t, r) => {
|
|
117
|
+
let i = n(), a = BigInt(r) % e, o = [i.F.e(t[0]), i.F.e(t[1])], s = i.mulPointEscalar(o, a);
|
|
118
|
+
return [BigInt(i.F.toString(s[0])), BigInt(i.F.toString(s[1]))];
|
|
119
|
+
};
|
|
120
|
+
static verifyStealthPair = (e, t, n, r = !0) => {
|
|
121
|
+
let i = this.getH1FromH0(e, n);
|
|
122
|
+
return r ? i[1] === t[1] : i === t;
|
|
123
|
+
};
|
|
124
|
+
static getStealthAddressNewStyle = (e, n, r) => {
|
|
125
|
+
if (r?.length !== 2) throw Error("Spending public key must be an array of 2 elements");
|
|
126
|
+
let i = this.getH1FromH0(e, n);
|
|
127
|
+
return t(2n * a(e[0]) + a(i[0]), e[1], i[1], r[0], r[1], n);
|
|
128
|
+
};
|
|
129
|
+
static findCorrectRandomization(t, n) {
|
|
130
|
+
if (!n) throw Error("No Private Shielded Key Provided");
|
|
131
|
+
let r = BigInt(n) % e, i, a, o = 0n;
|
|
132
|
+
do
|
|
133
|
+
i = t * 10n ** o % e, a = i * r % e, o += 1n;
|
|
134
|
+
while (a >= 2n ** 253n || i >= 2n ** 253n);
|
|
135
|
+
return i;
|
|
136
|
+
}
|
|
137
|
+
static getH0FromRandomization = (e) => {
|
|
138
|
+
let t = n(), r = t.mulPointEscalar(t.Base8, e);
|
|
139
|
+
return [BigInt(t.F.toString(r[0])), BigInt(t.F.toString(r[1]))];
|
|
140
|
+
};
|
|
141
|
+
static findH0(e, t) {
|
|
142
|
+
if (!t) return;
|
|
143
|
+
let { H0: n } = this.getRandomizedStealthPair(e, t);
|
|
144
|
+
return n;
|
|
145
|
+
}
|
|
87
146
|
static getEncryptionKeyPair = (e) => {
|
|
88
|
-
let t =
|
|
147
|
+
let t = u.crypto_box_seed_keypair(o.getBytes(e));
|
|
89
148
|
return {
|
|
90
|
-
privateKey:
|
|
91
|
-
publicKey:
|
|
149
|
+
privateKey: o.hexlify(t.privateKey),
|
|
150
|
+
publicKey: o.hexlify(t.publicKey)
|
|
92
151
|
};
|
|
93
152
|
};
|
|
153
|
+
getAccessKey = () => (this.requireKeyMaterial(), t(this.getShieldedPrivateKey(), this.getShieldedPublicKey()));
|
|
154
|
+
getBackendToken = () => (this.requireKeyMaterial(), t(this.getAccessKey(), this.getShieldedPublicKey()));
|
|
94
155
|
};
|
|
95
156
|
//#endregion
|
|
96
|
-
export {
|
|
157
|
+
export { g as EncryptionKeyPairDefaultValue, _ as UserKeys, h as stealthAddressCacheDevice, p as stealthPairCacheDevice, m as stealthPairOldCacheDevice };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=new class{tokenRegistry;constructor(){this.tokenRegistry=[]}setTokensFromCache(e){this.tokenRegistry=e}getCustomTokens(e){return this.tokenRegistry.filter(t=>t.chainId===e)}tokenExists(e,t){return e.find(e=>e.erc20TokenAddress===t.erc20TokenAddress||e.symbol===t.symbol||e.name===t.name)}addCustomToken(e){let{chainId:t}=e,n=this.getCustomTokens(t);this.tokenExists(n,e)||this.tokenRegistry.push(e)}removeCustomToken(e){let{chainId:t}=e
|
|
1
|
+
var e=new class{tokenRegistry;constructor(){this.tokenRegistry=[]}setTokensFromCache(e){this.tokenRegistry=e}getCustomTokens(e){return this.tokenRegistry.filter(t=>t.chainId===e)}tokenExists(e,t){return e.find(e=>e.erc20TokenAddress===t.erc20TokenAddress||e.symbol===t.symbol||e.name===t.name)}addCustomToken(e){let{chainId:t}=e,n=this.getCustomTokens(t);this.tokenExists(n,e)||this.tokenRegistry.push(e)}removeCustomToken(e){let{chainId:t}=e,n=this.getCustomTokens(t).filter(t=>t.erc20TokenAddress!==e.erc20TokenAddress);this.tokenRegistry=n}};exports.customTokenRegistry=e;
|
|
@@ -17,8 +17,8 @@ var e = new class {
|
|
|
17
17
|
this.tokenExists(n, e) || this.tokenRegistry.push(e);
|
|
18
18
|
}
|
|
19
19
|
removeCustomToken(e) {
|
|
20
|
-
let { chainId: t } = e;
|
|
21
|
-
this.tokenRegistry =
|
|
20
|
+
let { chainId: t } = e, n = this.getCustomTokens(t).filter((t) => t.erc20TokenAddress !== e.erc20TokenAddress);
|
|
21
|
+
this.tokenRegistry = n;
|
|
22
22
|
}
|
|
23
23
|
}();
|
|
24
24
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants/reorg-depths.constants.cjs`),t=require(`../../../error-handling/logger.cjs`),n=require(`../../../functions/utils/resolve-sync.utils.cjs`),r=require(`../../../functions/utils/getSignerFromContract.cjs`),i=require(`../../BlockchainEvent/BlockchainEvent.cjs`);let a=require(`ethers`);var o=class{RETRY_MIN_PAGE_SIZE=100;MAX_RETRIES=20;_chainId;contract;depositOnChainUtxosContract;_latestBlockNumber;_initialBlockNumber;onEventsProcessed;eventProcessors=new Set;maxPageSize;_isReady=!1;isServer;inProgress;eventsFetchingMutex;constructor(e,t,n,r,i,a,o){this.contract=t,this.depositOnChainUtxosContract=o,this._chainId=e,this._initialBlockNumber=n,this.maxPageSize=a,this.isServer=r,this.inProgress=!1,this.eventsFetchingMutex=i}get latestBlockNumber(){return this._latestBlockNumber??this._initialBlockNumber}get chainId(){return this._chainId}get isReady(){return this._isReady}syncFromAtMost(e){(this._latestBlockNumber===void 0||e<this._latestBlockNumber)&&(this._latestBlockNumber=e)}advanceLatestBlockNumber(e){e>(this._latestBlockNumber??this._initialBlockNumber)&&(this._latestBlockNumber=e)}intervalClear(){this._isReady=!1,this.eventProcessors=new Set,this.clear()}async init(){if(this._isReady)throw Error(`Already initialized`);this._isReady=!0,await this.retrieveEvents(this.latestBlockNumber+1),this.startUpdateListener()}requireReady(){if(!this._isReady)throw Error(`Not ready`)}async getEventsForSingleContract(e,t,n,r=0){try{return(await e.queryFilter(`*`,t,n)).filter(e=>e instanceof a.ethers.EventLog)}catch(i){if(r<this.MAX_RETRIES&&n-t>this.RETRY_MIN_PAGE_SIZE){let i=Math.floor((t+n)/2),a=await this.getEventsForSingleContract(e,t,i,r+1),o=await this.getEventsForSingleContract(e,i+1,n,r+1);return[...a,...o]}throw i}}addEventProcessorFunction(e){if(this._isReady)throw Error(`Can't add event processor after event emitter initialized`);this.eventProcessors.add(e)}async getEventsInRange(e,t){let r=[],a=n.getSequence(e,t,this.maxPageSize);await n.resolveSync(a.map(({from:e,to:t})=>async()=>{let n=await this.getEventsForSingleContract(this.contract,e,t);r.push(...n)}));let o=this.depositOnChainUtxosContract;return o&&await n.resolveSync(a.map(({from:e,to:t})=>async()=>{let n=await this.getEventsForSingleContract(o,e,t);r.push(...n)})),r.map(e=>i.BlockchainEvent.fromEthers(e))}async getLastBlockNumberForEventRequest(){let t=await r.getProviderFromContract(this.contract).getBlockNumber();if(!this.isServer)return t;let{chainId:n}=await r.getProviderFromContract(this.contract).getNetwork();return Math.max(this.latestBlockNumber,t-e.blockReorgDepth[Number(n)]+1)}async retrieveEvents(e,n=!1){return this.requireReady(),await this.eventsFetchingMutex.runExclusive(async()=>{try{if(this.inProgress&&!n)return!1;this.inProgress=!0;let t=await this.getLastBlockNumberForEventRequest();if(t<e)return this.inProgress=!1,!1;let r=await this.getEventsInRange(e,t);return await this.processEvents(r),this._latestBlockNumber=t,this.inProgress=!1,!0}catch(e){return t.Logger.error(`retrieveEvents error`,e),this.inProgress=!1,!1}})}async processEvents(e){let
|
|
1
|
+
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants/reorg-depths.constants.cjs`),t=require(`../../../error-handling/logger.cjs`),n=require(`../../../functions/utils/resolve-sync.utils.cjs`),r=require(`../../../functions/utils/getSignerFromContract.cjs`),i=require(`../../BlockchainEvent/BlockchainEvent.cjs`);let a=require(`ethers`);var o=class{RETRY_MIN_PAGE_SIZE=100;MAX_RETRIES=20;_chainId;contract;depositOnChainUtxosContract;_latestBlockNumber;_initialBlockNumber;onEventsProcessed;eventProcessors=new Set;maxPageSize;_isReady=!1;isServer;inProgress;eventsFetchingMutex;constructor(e,t,n,r,i,a,o){this.contract=t,this.depositOnChainUtxosContract=o,this._chainId=e,this._initialBlockNumber=n,this.maxPageSize=a,this.isServer=r,this.inProgress=!1,this.eventsFetchingMutex=i}get latestBlockNumber(){return this._latestBlockNumber??this._initialBlockNumber}get chainId(){return this._chainId}get isReady(){return this._isReady}syncFromAtMost(e){(this._latestBlockNumber===void 0||e<this._latestBlockNumber)&&(this._latestBlockNumber=e)}advanceLatestBlockNumber(e){e>(this._latestBlockNumber??this._initialBlockNumber)&&(this._latestBlockNumber=e)}intervalClear(){this._isReady=!1,this.eventProcessors=new Set,this.clear()}async init(){if(this._isReady)throw Error(`Already initialized`);this._isReady=!0,await this.retrieveEvents(this.latestBlockNumber+1),this.startUpdateListener()}requireReady(){if(!this._isReady)throw Error(`Not ready`)}async getEventsForSingleContract(e,t,n,r=0){try{return(await e.queryFilter(`*`,t,n)).filter(e=>e instanceof a.ethers.EventLog)}catch(i){if(r<this.MAX_RETRIES&&n-t>this.RETRY_MIN_PAGE_SIZE){let i=Math.floor((t+n)/2),a=await this.getEventsForSingleContract(e,t,i,r+1),o=await this.getEventsForSingleContract(e,i+1,n,r+1);return[...a,...o]}throw i}}addEventProcessorFunction(e){if(this._isReady)throw Error(`Can't add event processor after event emitter initialized`);this.eventProcessors.add(e)}async getEventsInRange(e,t){let r=[],a=n.getSequence(e,t,this.maxPageSize);await n.resolveSync(a.map(({from:e,to:t})=>async()=>{let n=await this.getEventsForSingleContract(this.contract,e,t);r.push(...n)}));let o=this.depositOnChainUtxosContract;return o&&await n.resolveSync(a.map(({from:e,to:t})=>async()=>{let n=await this.getEventsForSingleContract(o,e,t);r.push(...n)})),r.map(e=>i.BlockchainEvent.fromEthers(e))}async getLastBlockNumberForEventRequest(){let t=await r.getProviderFromContract(this.contract).getBlockNumber();if(!this.isServer)return t;let{chainId:n}=await r.getProviderFromContract(this.contract).getNetwork();return Math.max(this.latestBlockNumber,t-e.blockReorgDepth[Number(n)]+1)}async retrieveEvents(e,n=!1){return this.requireReady(),await this.eventsFetchingMutex.runExclusive(async()=>{try{if(this.inProgress&&!n)return!1;this.inProgress=!0;let t=await this.getLastBlockNumberForEventRequest();if(t<e)return this.inProgress=!1,!1;let r=await this.getEventsInRange(e,t);return await this.processEvents(r,t),this._latestBlockNumber=t,this.inProgress=!1,!0}catch(e){return t.Logger.error(`retrieveEvents error`,e),this.inProgress=!1,!1}})}async processEvents(e,t){let n=(await Promise.all([...this.eventProcessors].map(n=>n(e,t)))).reduce((e,t)=>e+t,0);this.onEventsProcessed?.(n)}};exports.BlockchainEventEmitter=o;
|
|
@@ -14,7 +14,7 @@ export declare abstract class BlockchainEventEmitter {
|
|
|
14
14
|
private eventProcessors;
|
|
15
15
|
private readonly maxPageSize?;
|
|
16
16
|
private _isReady;
|
|
17
|
-
|
|
17
|
+
protected isServer: boolean;
|
|
18
18
|
private inProgress;
|
|
19
19
|
protected eventsFetchingMutex: Mutex;
|
|
20
20
|
constructor(chainId: number, contract: ethers.Contract, initialBlockNumber: number, isServer: boolean, eventsFetchingMutex: Mutex, maxPageSize?: number, depositOnChainUtxosContract?: ethers.Contract);
|
|
@@ -31,7 +31,7 @@ export declare abstract class BlockchainEventEmitter {
|
|
|
31
31
|
getEventsInRange(fromBlockNumber: number, toBlockNumber: number): Promise<BlockchainEvent[]>;
|
|
32
32
|
getLastBlockNumberForEventRequest(): Promise<number>;
|
|
33
33
|
retrieveEvents(fromBlockNumber: number, useForce?: boolean): Promise<boolean>;
|
|
34
|
-
protected processEvents(events: BlockchainEvent[]): Promise<void>;
|
|
34
|
+
protected processEvents(events: BlockchainEvent[], scannedToBlock?: number): Promise<void>;
|
|
35
35
|
protected abstract clear(): void;
|
|
36
36
|
protected abstract startUpdateListener(): void;
|
|
37
37
|
}
|
|
@@ -89,15 +89,15 @@ var s = class {
|
|
|
89
89
|
let t = await this.getLastBlockNumberForEventRequest();
|
|
90
90
|
if (t < e) return this.inProgress = !1, !1;
|
|
91
91
|
let r = await this.getEventsInRange(e, t);
|
|
92
|
-
return await this.processEvents(r), this._latestBlockNumber = t, this.inProgress = !1, !0;
|
|
92
|
+
return await this.processEvents(r, t), this._latestBlockNumber = t, this.inProgress = !1, !0;
|
|
93
93
|
} catch (e) {
|
|
94
94
|
return t.error("retrieveEvents error", e), this.inProgress = !1, !1;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
async processEvents(e) {
|
|
99
|
-
let
|
|
100
|
-
this.onEventsProcessed?.(
|
|
98
|
+
async processEvents(e, t) {
|
|
99
|
+
let n = (await Promise.all([...this.eventProcessors].map((n) => n(e, t)))).reduce((e, t) => e + t, 0);
|
|
100
|
+
this.onEventsProcessed?.(n);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./BlockchainEventEmitter.cjs`),t=require(`../helpers/PollingEventHelper.cjs`);var n=class extends e.BlockchainEventEmitter{pollingEventHelper=new t.PollingEventHelper;clear(){this.pollingEventHelper.clear()}startUpdateListener(){this.pollingEventHelper.startUpdateListener(async()=>{await this.retrieveEvents(this.latestBlockNumber)})}};exports.PollingBlockchainEventEmitter=n;
|
|
1
|
+
const e=require(`./BlockchainEventEmitter.cjs`),t=require(`../helpers/PollingEventHelper.cjs`);var n=class extends e.BlockchainEventEmitter{pollingEventHelper=new t.PollingEventHelper(this.isServer);clear(){this.pollingEventHelper.clear()}startUpdateListener(){this.pollingEventHelper.startUpdateListener(async()=>{await this.retrieveEvents(this.latestBlockNumber)})}};exports.PollingBlockchainEventEmitter=n;
|
|
@@ -2,7 +2,7 @@ import { BlockchainEventEmitter as e } from "./BlockchainEventEmitter.mjs";
|
|
|
2
2
|
import { PollingEventHelper as t } from "../helpers/PollingEventHelper.mjs";
|
|
3
3
|
//#region libs/shared/common/src/data-structures/event-service/evm/PollingBlockchainEventEmitter.ts
|
|
4
4
|
var n = class extends e {
|
|
5
|
-
pollingEventHelper = new t();
|
|
5
|
+
pollingEventHelper = new t(this.isServer);
|
|
6
6
|
clear() {
|
|
7
7
|
this.pollingEventHelper.clear();
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../API/API.cjs`),t=require(`../../../error-handling/logger.cjs`),n=require(`../../BlockchainEvent/BlockchainEvent.cjs`);var r=5e3,i=class{chainId;eventCategory;pollIntervalId;constructor(e,t){this.chainId=e,this.eventCategory=t}clear(){this.pollIntervalId!=null&&(clearInterval(this.pollIntervalId),this.pollIntervalId=void 0)}startUpdateListener(i,a,o){let s=a
|
|
1
|
+
const e=require(`../../../API/API.cjs`),t=require(`../../../error-handling/logger.cjs`),n=require(`../../BlockchainEvent/BlockchainEvent.cjs`);var r=5e3,i=class{chainId;eventCategory;pollIntervalId;constructor(e,t){this.chainId=e,this.eventCategory=t}clear(){this.pollIntervalId!=null&&(clearInterval(this.pollIntervalId),this.pollIntervalId=void 0)}startUpdateListener(i,a,o){let s=a,c=async()=>{try{let{events:t,latestBlockNumber:r}=await e.API.getSnapshotServerEvents(this.chainId,this.eventCategory,s);t.length>0&&await i(t.map(e=>n.BlockchainEvent.fromSerialized(e))),r>=s&&(s=r+1,o(s))}catch(e){t.Logger.error(`Snapshot events poll error`,e)}};this.pollIntervalId=setInterval(c,r)}};exports.ClientEventHelper=i;
|
|
@@ -13,15 +13,15 @@ var r = 5e3, i = class {
|
|
|
13
13
|
this.pollIntervalId != null && (clearInterval(this.pollIntervalId), this.pollIntervalId = void 0);
|
|
14
14
|
}
|
|
15
15
|
startUpdateListener(i, a, o) {
|
|
16
|
-
let s = a
|
|
17
|
-
this.pollIntervalId = setInterval(async () => {
|
|
16
|
+
let s = a, c = async () => {
|
|
18
17
|
try {
|
|
19
18
|
let { events: t, latestBlockNumber: r } = await e.getSnapshotServerEvents(this.chainId, this.eventCategory, s);
|
|
20
19
|
t.length > 0 && await i(t.map((e) => n.fromSerialized(e))), r >= s && (s = r + 1, o(s));
|
|
21
20
|
} catch (e) {
|
|
22
21
|
t.error("Snapshot events poll error", e);
|
|
23
22
|
}
|
|
24
|
-
}
|
|
23
|
+
};
|
|
24
|
+
this.pollIntervalId = setInterval(c, r);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{intervalId;clear(){this.intervalId!==void 0&&clearInterval(this.intervalId),this.intervalId=void 0}startUpdateListener(e){this.intervalId=setInterval(async()=>{await e()},
|
|
1
|
+
var e=6e4,t=3500,n=class{intervalId;pollIntervalMs;constructor(n){this.pollIntervalMs=n?e:t}clear(){this.intervalId!==void 0&&clearInterval(this.intervalId),this.intervalId=void 0}startUpdateListener(e){this.intervalId=setInterval(async()=>{await e()},this.pollIntervalMs)}};exports.PollingEventHelper=n;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
//#region libs/shared/common/src/data-structures/event-service/helpers/PollingEventHelper.ts
|
|
2
|
-
var e = class {
|
|
2
|
+
var e = 6e4, t = 3500, n = class {
|
|
3
3
|
intervalId;
|
|
4
|
+
pollIntervalMs;
|
|
5
|
+
constructor(n) {
|
|
6
|
+
this.pollIntervalMs = n ? e : t;
|
|
7
|
+
}
|
|
4
8
|
clear() {
|
|
5
9
|
this.intervalId !== void 0 && clearInterval(this.intervalId), this.intervalId = void 0;
|
|
6
10
|
}
|
|
7
11
|
startUpdateListener(e) {
|
|
8
12
|
this.intervalId = setInterval(async () => {
|
|
9
13
|
await e();
|
|
10
|
-
},
|
|
14
|
+
}, this.pollIntervalMs);
|
|
11
15
|
}
|
|
12
16
|
};
|
|
13
17
|
//#endregion
|
|
14
|
-
export {
|
|
18
|
+
export { n as PollingEventHelper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./evm/AbstractEventService.cjs`),require(`./evm/AbstractSnapshotService.cjs`),require(`./evm/
|
|
1
|
+
require(`./evm/AbstractEventService.cjs`),require(`./evm/AbstractSnapshotService.cjs`),require(`./evm/AbstractCommitmentsSnapshotService.cjs`),require(`./evm/AbstractNullifierSnapshotService.cjs`),require(`./evm/BlockchainEventEmitter.cjs`),require(`./evm/PollingBlockchainEventEmitter.cjs`),require(`./evm/ClientBlockchainEventEmitter.cjs`),require(`./solana/SolanaBlockchainEventEmitter.cjs`),require(`./solana/ClientSolanaBlockchainEventEmitter.cjs`),require(`./solana/PollingSolanaBlockchainEventEmitter.cjs`),require(`./solana/AbstractSolanaEventService.cjs`),require(`./solana/AbstractSolanaSnapshotService.cjs`),require(`./solana/AbstractSolanaNullifierSnapshotService.cjs`),require(`./solana/AbstractSolanaCommitmentsSnapshotService.cjs`);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export * from './evm/AbstractAccessTokenSnapshotService';
|
|
2
1
|
export * from './evm/AbstractCommitmentsSnapshotService';
|
|
3
|
-
export * from './evm/AbstractApprovalsSnapshotService';
|
|
4
2
|
export * from './evm/AbstractNullifierSnapshotService';
|
|
5
3
|
export * from './evm/AbstractSnapshotService';
|
|
6
4
|
export * from './evm/AbstractEventService';
|
|
@@ -14,4 +12,3 @@ export * from './solana/AbstractSolanaEventService';
|
|
|
14
12
|
export * from './solana/AbstractSolanaSnapshotService';
|
|
15
13
|
export * from './solana/AbstractSolanaNullifierSnapshotService';
|
|
16
14
|
export * from './solana/AbstractSolanaCommitmentsSnapshotService';
|
|
17
|
-
export * from './solana/AbstractSolanaAccessTokenSnapshotService';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import "./evm/AbstractEventService.mjs";
|
|
2
2
|
import "./evm/AbstractSnapshotService.mjs";
|
|
3
|
-
import "./evm/AbstractAccessTokenSnapshotService.mjs";
|
|
4
3
|
import "./evm/AbstractCommitmentsSnapshotService.mjs";
|
|
5
|
-
import "./evm/AbstractApprovalsSnapshotService.mjs";
|
|
6
4
|
import "./evm/AbstractNullifierSnapshotService.mjs";
|
|
7
5
|
import "./evm/BlockchainEventEmitter.mjs";
|
|
8
6
|
import "./evm/PollingBlockchainEventEmitter.mjs";
|
|
@@ -14,4 +12,3 @@ import "./solana/AbstractSolanaEventService.mjs";
|
|
|
14
12
|
import "./solana/AbstractSolanaSnapshotService.mjs";
|
|
15
13
|
import "./solana/AbstractSolanaNullifierSnapshotService.mjs";
|
|
16
14
|
import "./solana/AbstractSolanaCommitmentsSnapshotService.mjs";
|
|
17
|
-
import "./solana/AbstractSolanaAccessTokenSnapshotService.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../helpers/PollingEventHelper.cjs`),t=require(`./SolanaBlockchainEventEmitter.cjs`);var n=class extends t.SolanaBlockchainEventEmitter{pollingEventHelper=new e.PollingEventHelper;clear(){this.pollingEventHelper.clear()}startUpdateListener(){this.pollingEventHelper.startUpdateListener(async()=>{await this.retrieveEvents(this.latestBlockNumber)})}};exports.PollingSolanaBlockchainEventEmitter=n;
|
|
1
|
+
const e=require(`../helpers/PollingEventHelper.cjs`),t=require(`./SolanaBlockchainEventEmitter.cjs`);var n=class extends t.SolanaBlockchainEventEmitter{pollingEventHelper=new e.PollingEventHelper(this.isServer);clear(){this.pollingEventHelper.clear()}startUpdateListener(){this.pollingEventHelper.startUpdateListener(async()=>{await this.retrieveEvents(this.latestBlockNumber)})}};exports.PollingSolanaBlockchainEventEmitter=n;
|
|
@@ -2,7 +2,7 @@ import { PollingEventHelper as e } from "../helpers/PollingEventHelper.mjs";
|
|
|
2
2
|
import { SolanaBlockchainEventEmitter as t } from "./SolanaBlockchainEventEmitter.mjs";
|
|
3
3
|
//#region libs/shared/common/src/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.ts
|
|
4
4
|
var n = class extends t {
|
|
5
|
-
pollingEventHelper = new e();
|
|
5
|
+
pollingEventHelper = new e(this.isServer);
|
|
6
6
|
clear() {
|
|
7
7
|
this.pollingEventHelper.clear();
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../functions/utils/serialize.utils.cjs`),t=require(`../../../error-handling/logger.cjs`),n=require(`../../../functions/utils/resolve-sync.utils.cjs`),r=require(`../../BlockchainEvent/BlockchainEvent.cjs`);let i=require(`@coral-xyz/anchor`);var a=1e3,o=20,s=class{_chainId;connection;programId;_latestSlot;_initialSlot;onEventsProcessed;eventProcessors=new Set;maxPageSize;_isReady=!1;isServer;inProgress;anchorParser;anchorCoder;eventsFetchingMutex;constructor(e,t,n,r,i,a,o){this._chainId=e,this.connection=t,this.programId=n,this._initialSlot=r,this.maxPageSize=o,this.isServer=i,this.inProgress=!1,this.eventsFetchingMutex=a}get chainId(){return this._chainId}get latestBlockNumber(){return this._latestSlot??this._initialSlot}get isReady(){return this._isReady}setIdl(e){try{let t=new i.BorshCoder(e);this.anchorCoder=t,this.anchorParser=new i.EventParser(this.programId,t)}catch(e){t.Logger.error(`Failed to initialize Anchor EventParser:`,e),this.anchorParser=void 0,this.anchorCoder=void 0}}syncFromAtMost(e){(this._latestSlot===void 0||e<this._latestSlot)&&(this._latestSlot=e)}advanceLatestBlockNumber(e){e>(this._latestSlot??this._initialSlot)&&(this._latestSlot=e)}intervalClear(){this._isReady=!1,this.eventProcessors=new Set,this.clear()}async init(){if(this._isReady)throw Error(`Already initialized`);this._isReady=!0,await this.retrieveEvents(this.latestBlockNumber+1,!1,!0),this.startUpdateListener()}requireReady(){if(!this._isReady)throw Error(`Not ready`)}addEventProcessorFunction(e){if(this._isReady)throw Error(`Can't add event processor after event emitter initialized`);this.eventProcessors.add(e)}async getEventsInRange(e,t){return(await this.getProgramEvents(e,t)).map(e=>r.BlockchainEvent.fromSolanaEvent(e))}async getLastBlockNumberForEventRequest(){let e=await this.connection.getSlot();return this.isServer?Math.max(this.latestBlockNumber,e-32+1):e}async retrieveEvents(e,i=!1,a=!1){let o=e;return this.requireReady(),await this.eventsFetchingMutex.runExclusive(async()=>{try{if(this.inProgress&&!i)return!1;this.inProgress=!0;let e=await this.getLastBlockNumberForEventRequest();if(e<o)return this.inProgress=!1,!1;let t=n.getSequence(o,e,this.maxPageSize),s=[];await n.resolveSync(t.map(({from:e,to:t})=>async()=>{let n=await this.getProgramEvents(e,t,a);s.push(...n)}));let c=s.map(e=>r.BlockchainEvent.fromSolanaEvent(e));return await this.processEvents(c),this._latestSlot=e,this.inProgress=!1,!0}catch(e){return t.Logger.error(`retrieveEvents error:`,e),this.inProgress=!1,!1}})}async getProgramEvents(e,n,r=!1){let i=[],s=r?a:o;try{let r=await this.connection.getSignaturesForAddress(this.programId,{limit:s,before:void 0}),a=r.length;for(;a>=s&&r[r.length-1].slot>=e;){let e=r[r.length-1],t=await this.connection.getSignaturesForAddress(this.programId,{limit:s,before:e.signature});if(t.length===0)break;r.push(...t),a=t.length}let o=r.filter(t=>t.slot>=e&&t.slot<=n).map(async e=>{try{let t=await this.connection.getTransaction(e.signature,{commitment:`confirmed`,maxSupportedTransactionVersion:0});return t&&t.meta&&!t.meta.err?this.parseTransactionForEvents(t,e.signature,e.slot,t.blockTime||null):[]}catch(n){return t.Logger.error(`Failed to get transaction ${e.signature}:`,n),[]}}),c=await Promise.all(o);i.push(...c.flat())}catch(e){t.Logger.error(`Error getting program events:`,e)}return i}parseTransactionForEvents(t,n,r,i){let a=this.parseLogsForEvents(t?.meta?.logMessages??[],n,r,i),o=this.parseCpiForEvents(t,n,r,i),s=[...a,...o];if(s.length===0)return[];let c=new Set;return s.filter(t=>{let n=`${t.signature}:${t.eventName}:${e.safeJsonStringify(t.data)}`;return c.has(n)?!1:(c.add(n),!0)})}parseLogsForEvents(e,n,r,i){if(!this.anchorParser)return[];try{return Array.from(this.anchorParser.parseLogs(e)).map(({name:e,data:t})=>({signature:n,slot:r,blockTime:i||0,programId:this.programId,data:t,eventName:e}))}catch(e){return t.Logger.error(`Anchor EventParser failed; falling back to generic parsing:`,e),[]}}parseCpiForEvents(e,n,r,a){if(!e||!this.anchorCoder)return[];let o=e.meta?.innerInstructions??[];if(o.length===0)return[];try{return o.flatMap(e=>e.instructions??[]).map(e=>{try{if(!e?.data)return null;let t=i.utils.bytes.bs58.decode(e.data);if(t.length<=8)return null;let o=i.utils.bytes.base64.encode(t.subarray(8)),s=this.anchorCoder?.events.decode(o);return s?{signature:n,slot:r,blockTime:a||0,programId:this.programId,data:s.data,eventName:s.name}:null}catch{return null}}).filter(e=>e!==null)}catch(e){return t.Logger.error(`Failed to parse emit_cpi events:`,e),[]}}async processEvents(e){let
|
|
1
|
+
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../functions/utils/serialize.utils.cjs`),t=require(`../../../error-handling/logger.cjs`),n=require(`../../../functions/utils/resolve-sync.utils.cjs`),r=require(`../../BlockchainEvent/BlockchainEvent.cjs`);let i=require(`@coral-xyz/anchor`);var a=1e3,o=20,s=class{_chainId;connection;programId;_latestSlot;_initialSlot;onEventsProcessed;eventProcessors=new Set;maxPageSize;_isReady=!1;isServer;inProgress;anchorParser;anchorCoder;eventsFetchingMutex;constructor(e,t,n,r,i,a,o){this._chainId=e,this.connection=t,this.programId=n,this._initialSlot=r,this.maxPageSize=o,this.isServer=i,this.inProgress=!1,this.eventsFetchingMutex=a}get chainId(){return this._chainId}get latestBlockNumber(){return this._latestSlot??this._initialSlot}get isReady(){return this._isReady}setIdl(e){try{let t=new i.BorshCoder(e);this.anchorCoder=t,this.anchorParser=new i.EventParser(this.programId,t)}catch(e){t.Logger.error(`Failed to initialize Anchor EventParser:`,e),this.anchorParser=void 0,this.anchorCoder=void 0}}syncFromAtMost(e){(this._latestSlot===void 0||e<this._latestSlot)&&(this._latestSlot=e)}advanceLatestBlockNumber(e){e>(this._latestSlot??this._initialSlot)&&(this._latestSlot=e)}intervalClear(){this._isReady=!1,this.eventProcessors=new Set,this.clear()}async init(){if(this._isReady)throw Error(`Already initialized`);this._isReady=!0,await this.retrieveEvents(this.latestBlockNumber+1,!1,!0),this.startUpdateListener()}requireReady(){if(!this._isReady)throw Error(`Not ready`)}addEventProcessorFunction(e){if(this._isReady)throw Error(`Can't add event processor after event emitter initialized`);this.eventProcessors.add(e)}async getEventsInRange(e,t){return(await this.getProgramEvents(e,t)).map(e=>r.BlockchainEvent.fromSolanaEvent(e))}async getLastBlockNumberForEventRequest(){let e=await this.connection.getSlot();return this.isServer?Math.max(this.latestBlockNumber,e-32+1):e}async retrieveEvents(e,i=!1,a=!1){let o=e;return this.requireReady(),await this.eventsFetchingMutex.runExclusive(async()=>{try{if(this.inProgress&&!i)return!1;this.inProgress=!0;let e=await this.getLastBlockNumberForEventRequest();if(e<o)return this.inProgress=!1,!1;let t=n.getSequence(o,e,this.maxPageSize),s=[];await n.resolveSync(t.map(({from:e,to:t})=>async()=>{let n=await this.getProgramEvents(e,t,a);s.push(...n)})),s.sort((e,t)=>e.slot-t.slot);let c=s.map(e=>r.BlockchainEvent.fromSolanaEvent(e));return await this.processEvents(c,e),this._latestSlot=e,this.inProgress=!1,!0}catch(e){return t.Logger.error(`retrieveEvents error:`,e),this.inProgress=!1,!1}})}async getProgramEvents(e,n,r=!1){let i=[],s=r?a:o;try{let r=await this.connection.getSignaturesForAddress(this.programId,{limit:s,before:void 0}),a=r.length;for(;a>=s&&r[r.length-1].slot>=e;){let e=r[r.length-1],t=await this.connection.getSignaturesForAddress(this.programId,{limit:s,before:e.signature});if(t.length===0)break;r.push(...t),a=t.length}let o=r.filter(t=>t.slot>=e&&t.slot<=n).map(async e=>{try{let t=await this.connection.getTransaction(e.signature,{commitment:`confirmed`,maxSupportedTransactionVersion:0});return t&&t.meta&&!t.meta.err?this.parseTransactionForEvents(t,e.signature,e.slot,t.blockTime||null):[]}catch(n){return t.Logger.error(`Failed to get transaction ${e.signature}:`,n),[]}}),c=await Promise.all(o);i.push(...c.flat())}catch(e){t.Logger.error(`Error getting program events:`,e)}return i}parseTransactionForEvents(t,n,r,i){let a=this.parseLogsForEvents(t?.meta?.logMessages??[],n,r,i),o=this.parseCpiForEvents(t,n,r,i),s=[...a,...o];if(s.length===0)return[];let c=new Set;return s.filter(t=>{let n=`${t.signature}:${t.eventName}:${e.safeJsonStringify(t.data)}`;return c.has(n)?!1:(c.add(n),!0)})}parseLogsForEvents(e,n,r,i){if(!this.anchorParser)return[];try{return Array.from(this.anchorParser.parseLogs(e)).map(({name:e,data:t})=>({signature:n,slot:r,blockTime:i||0,programId:this.programId,data:t,eventName:e}))}catch(e){return t.Logger.error(`Anchor EventParser failed; falling back to generic parsing:`,e),[]}}parseCpiForEvents(e,n,r,a){if(!e||!this.anchorCoder)return[];let o=e.meta?.innerInstructions??[];if(o.length===0)return[];try{return o.flatMap(e=>e.instructions??[]).map(e=>{try{if(!e?.data)return null;let t=i.utils.bytes.bs58.decode(e.data);if(t.length<=8)return null;let o=i.utils.bytes.base64.encode(t.subarray(8)),s=this.anchorCoder?.events.decode(o);return s?{signature:n,slot:r,blockTime:a||0,programId:this.programId,data:s.data,eventName:s.name}:null}catch{return null}}).filter(e=>e!==null)}catch(e){return t.Logger.error(`Failed to parse emit_cpi events:`,e),[]}}async processEvents(e,t){let n=(await Promise.all([...this.eventProcessors].map(n=>n(e,t)))).reduce((e,t)=>e+t,0);this.onEventsProcessed?.(n)}};exports.SolanaBlockchainEventEmitter=s;
|
|
@@ -13,7 +13,7 @@ export declare abstract class SolanaBlockchainEventEmitter {
|
|
|
13
13
|
private eventProcessors;
|
|
14
14
|
private readonly maxPageSize?;
|
|
15
15
|
private _isReady;
|
|
16
|
-
|
|
16
|
+
protected isServer: boolean;
|
|
17
17
|
private inProgress;
|
|
18
18
|
private anchorParser?;
|
|
19
19
|
private anchorCoder?;
|
|
@@ -36,7 +36,7 @@ export declare abstract class SolanaBlockchainEventEmitter {
|
|
|
36
36
|
private parseTransactionForEvents;
|
|
37
37
|
private parseLogsForEvents;
|
|
38
38
|
private parseCpiForEvents;
|
|
39
|
-
protected processEvents(events: BlockchainEvent[]): Promise<void>;
|
|
39
|
+
protected processEvents(events: BlockchainEvent[], scannedToBlock?: number): Promise<void>;
|
|
40
40
|
protected abstract clear(): void;
|
|
41
41
|
protected abstract startUpdateListener(): void;
|
|
42
42
|
}
|
|
@@ -78,9 +78,9 @@ var c = 1e3, l = 20, u = class {
|
|
|
78
78
|
await r(t.map(({ from: e, to: t }) => async () => {
|
|
79
79
|
let n = await this.getProgramEvents(e, t, o);
|
|
80
80
|
c.push(...n);
|
|
81
|
-
}));
|
|
81
|
+
})), c.sort((e, t) => e.slot - t.slot);
|
|
82
82
|
let l = c.map((e) => i.fromSolanaEvent(e));
|
|
83
|
-
return await this.processEvents(l), this._latestSlot = e, this.inProgress = !1, !0;
|
|
83
|
+
return await this.processEvents(l, e), this._latestSlot = e, this.inProgress = !1, !0;
|
|
84
84
|
} catch (e) {
|
|
85
85
|
return t.error("retrieveEvents error:", e), this.inProgress = !1, !1;
|
|
86
86
|
}
|
|
@@ -169,9 +169,9 @@ var c = 1e3, l = 20, u = class {
|
|
|
169
169
|
return t.error("Failed to parse emit_cpi events:", e), [];
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
async processEvents(e) {
|
|
173
|
-
let
|
|
174
|
-
this.onEventsProcessed?.(
|
|
172
|
+
async processEvents(e, t) {
|
|
173
|
+
let n = (await Promise.all([...this.eventProcessors].map((n) => n(e, t)))).reduce((e, t) => e + t, 0);
|
|
174
|
+
this.onEventsProcessed?.(n);
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./http/BasicHttpClient.cjs`),require(`./http/HttpClient.cjs`),require(`./http/index.cjs`),require(`./custom-token-registry/CustomTokenRegistry.cjs`),require(`./ValueCache/ValueCache.cjs`),require(`./crypto-keys/keyUtils.cjs`),require(`./crypto-keys/keys.cjs`),require(`./utxo/Utxo.cjs`),require(`./crypto-keys/decodeUTXO.cjs`),require(`./crypto-keys/encryptDecryptUtxo.cjs`),require(`./crypto-keys/index.cjs`),require(`./TokenDBs/token-visibility-db.cjs`),require(`./TokenDBs/PrivateTokensDB.cjs`),require(`./token-price-fetcher/TokenChecker.cjs`),require(`./AccountActions/AccountActions.cjs`),require(`./cacheDevices/FileCacheDevice.cjs`),require(`./cacheDevices/LocalStorageCacheDevice.cjs`),require(`./cacheDevices/index.cjs`),require(`./
|
|
1
|
+
require(`./http/BasicHttpClient.cjs`),require(`./http/HttpClient.cjs`),require(`./http/index.cjs`),require(`./custom-token-registry/CustomTokenRegistry.cjs`),require(`./ValueCache/ValueCache.cjs`),require(`./crypto-keys/keyUtils.cjs`),require(`./crypto-keys/keys.cjs`),require(`./utxo/Utxo.cjs`),require(`./crypto-keys/decodeUTXO.cjs`),require(`./crypto-keys/encryptDecryptUtxo.cjs`),require(`./crypto-keys/index.cjs`),require(`./TokenDBs/token-visibility-db.cjs`),require(`./TokenDBs/PrivateTokensDB.cjs`),require(`./token-price-fetcher/TokenChecker.cjs`),require(`./AccountActions/AccountActions.cjs`),require(`./cacheDevices/FileCacheDevice.cjs`),require(`./cacheDevices/LocalStorageCacheDevice.cjs`),require(`./cacheDevices/index.cjs`),require(`./Hinkal/hinkalDeposit.cjs`),require(`./Hinkal/prepareDepositOnChainUtxosZkProof.cjs`),require(`./Hinkal/hinkalDepositAndWithdraw.cjs`),require(`./Hinkal/hinkalSwap.cjs`),require(`./Hinkal/hinkalWithdraw.cjs`),require(`./merkle-tree/MerkleTreeIncompleteError.cjs`),require(`./merkle-tree/MerkleTree.cjs`),require(`./merkle-tree/index.cjs`),require(`./event-service/evm/AbstractEventService.cjs`),require(`./event-service/evm/AbstractSnapshotService.cjs`),require(`./event-service/evm/AbstractCommitmentsSnapshotService.cjs`),require(`./event-service/evm/AbstractNullifierSnapshotService.cjs`),require(`./BlockchainEvent/BlockchainEvent.cjs`),require(`./event-service/evm/BlockchainEventEmitter.cjs`),require(`./event-service/evm/PollingBlockchainEventEmitter.cjs`),require(`./event-service/evm/ClientBlockchainEventEmitter.cjs`),require(`./event-service/solana/SolanaBlockchainEventEmitter.cjs`),require(`./event-service/solana/ClientSolanaBlockchainEventEmitter.cjs`),require(`./event-service/solana/PollingSolanaBlockchainEventEmitter.cjs`),require(`./event-service/solana/AbstractSolanaEventService.cjs`),require(`./event-service/solana/AbstractSolanaSnapshotService.cjs`),require(`./event-service/solana/AbstractSolanaNullifierSnapshotService.cjs`),require(`./event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs`),require(`./event-service/index.cjs`),require(`./snapshot/SnapshotFetcherService.cjs`),require(`./snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs`),require(`./snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs`),require(`./snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs`),require(`./snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs`),require(`./snapshot/index.cjs`),require(`./Hinkal/resetMerkleTrees.cjs`),require(`./MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs`),require(`./IndexedDB/activity-db.cjs`),require(`./IndexedDB/balances-db.cjs`),require(`./IndexedDB/private-balances-db.cjs`),require(`./IndexedDB/prices-db.cjs`),require(`./IndexedDB/contact-db.cjs`),require(`./IndexedDB/signatures-db.cjs`),require(`./IndexedDB/pay-activity-db.cjs`),require(`./IndexedDB/index.cjs`),require(`./Hinkal/hinkalPrivateWallet.cjs`),require(`./AccountActions/index.cjs`),require(`./TokenDBs/ArcPublicTokensDB.cjs`),require(`./TokenDBs/PublicTokensDB.cjs`),require(`./TokenDBs/index.cjs`),require(`./Hinkal/hinkalProxySwap.cjs`),require(`./Hinkal/hinkalTransfer.cjs`),require(`./Hinkal/hinkalSolanaDepositAndWithdraw.cjs`),require(`./Hinkal/hinkalSolanaTransfer.cjs`),require(`./Hinkal/hinkalSolanaProxySend.cjs`),require(`./Hinkal/hinkalSolanaProxySwap.cjs`),require(`./Hinkal/hinkalSolanaProxyShield.cjs`),require(`./Hinkal/hinkalClaimUtxo.cjs`),require(`./Hinkal/hinkalSolanaProoflessDeposit.cjs`),require(`./Hinkal/hinkalSolanaClaimUtxo.cjs`),require(`./Hinkal/hinkalWithdrawStuckUtxos.cjs`),require(`./Hinkal/Hinkal.cjs`),require(`./Hinkal/hinkalPalSolanaDepositPrepare.cjs`),require(`./Hinkal/hinkalPalEvmDeposit.cjs`),require(`./Hinkal/hinkalPalTronDepositPrepare.cjs`),require(`./Hinkal/index.cjs`),require(`./token-price-fetcher/index.cjs`),require(`./transactions-manager/history/history.types.cjs`),require(`./presale/PresaleContractWrapper.cjs`),require(`./presale/index.cjs`),require(`./ApprovalDBs/EventsPublicApprovalsDB.cjs`),require(`./ApprovalDBs/index.cjs`),require(`./WalletManager/WalletManager.cjs`),require(`./WalletManager/index.cjs`);
|
|
@@ -16,19 +16,17 @@ import "./AccountActions/AccountActions.mjs";
|
|
|
16
16
|
import "./cacheDevices/FileCacheDevice.mjs";
|
|
17
17
|
import "./cacheDevices/LocalStorageCacheDevice.mjs";
|
|
18
18
|
import "./cacheDevices/index.mjs";
|
|
19
|
-
import "./merkle-tree/MerkleTreeIncompleteError.mjs";
|
|
20
|
-
import "./merkle-tree/MerkleTree.mjs";
|
|
21
|
-
import "./merkle-tree/getPatchedAccessTokenMerkleTree.mjs";
|
|
22
|
-
import "./merkle-tree/index.mjs";
|
|
23
19
|
import "./Hinkal/hinkalDeposit.mjs";
|
|
20
|
+
import "./Hinkal/prepareDepositOnChainUtxosZkProof.mjs";
|
|
24
21
|
import "./Hinkal/hinkalDepositAndWithdraw.mjs";
|
|
25
22
|
import "./Hinkal/hinkalSwap.mjs";
|
|
26
23
|
import "./Hinkal/hinkalWithdraw.mjs";
|
|
24
|
+
import "./merkle-tree/MerkleTreeIncompleteError.mjs";
|
|
25
|
+
import "./merkle-tree/MerkleTree.mjs";
|
|
26
|
+
import "./merkle-tree/index.mjs";
|
|
27
27
|
import "./event-service/evm/AbstractEventService.mjs";
|
|
28
28
|
import "./event-service/evm/AbstractSnapshotService.mjs";
|
|
29
|
-
import "./event-service/evm/AbstractAccessTokenSnapshotService.mjs";
|
|
30
29
|
import "./event-service/evm/AbstractCommitmentsSnapshotService.mjs";
|
|
31
|
-
import "./event-service/evm/AbstractApprovalsSnapshotService.mjs";
|
|
32
30
|
import "./event-service/evm/AbstractNullifierSnapshotService.mjs";
|
|
33
31
|
import "./BlockchainEvent/BlockchainEvent.mjs";
|
|
34
32
|
import "./event-service/evm/BlockchainEventEmitter.mjs";
|
|
@@ -41,16 +39,12 @@ import "./event-service/solana/AbstractSolanaEventService.mjs";
|
|
|
41
39
|
import "./event-service/solana/AbstractSolanaSnapshotService.mjs";
|
|
42
40
|
import "./event-service/solana/AbstractSolanaNullifierSnapshotService.mjs";
|
|
43
41
|
import "./event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs";
|
|
44
|
-
import "./event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs";
|
|
45
42
|
import "./event-service/index.mjs";
|
|
46
43
|
import "./snapshot/SnapshotFetcherService.mjs";
|
|
47
44
|
import "./snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs";
|
|
48
45
|
import "./snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs";
|
|
49
|
-
import "./snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs";
|
|
50
|
-
import "./snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs";
|
|
51
46
|
import "./snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs";
|
|
52
47
|
import "./snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs";
|
|
53
|
-
import "./snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs";
|
|
54
48
|
import "./snapshot/index.mjs";
|
|
55
49
|
import "./Hinkal/resetMerkleTrees.mjs";
|
|
56
50
|
import "./MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
|
|
@@ -69,6 +63,7 @@ import "./TokenDBs/PublicTokensDB.mjs";
|
|
|
69
63
|
import "./TokenDBs/index.mjs";
|
|
70
64
|
import "./Hinkal/hinkalProxySwap.mjs";
|
|
71
65
|
import "./Hinkal/hinkalTransfer.mjs";
|
|
66
|
+
import "./Hinkal/hinkalSolanaDepositAndWithdraw.mjs";
|
|
72
67
|
import "./Hinkal/hinkalSolanaTransfer.mjs";
|
|
73
68
|
import "./Hinkal/hinkalSolanaProxySend.mjs";
|
|
74
69
|
import "./Hinkal/hinkalSolanaProxySwap.mjs";
|
|
@@ -78,6 +73,9 @@ import "./Hinkal/hinkalSolanaProoflessDeposit.mjs";
|
|
|
78
73
|
import "./Hinkal/hinkalSolanaClaimUtxo.mjs";
|
|
79
74
|
import "./Hinkal/hinkalWithdrawStuckUtxos.mjs";
|
|
80
75
|
import "./Hinkal/Hinkal.mjs";
|
|
76
|
+
import "./Hinkal/hinkalPalSolanaDepositPrepare.mjs";
|
|
77
|
+
import "./Hinkal/hinkalPalEvmDeposit.mjs";
|
|
78
|
+
import "./Hinkal/hinkalPalTronDepositPrepare.mjs";
|
|
81
79
|
import "./Hinkal/index.mjs";
|
|
82
80
|
import "./token-price-fetcher/index.mjs";
|
|
83
81
|
import "./transactions-manager/history/history.types.mjs";
|
|
@@ -85,3 +83,5 @@ import "./presale/PresaleContractWrapper.mjs";
|
|
|
85
83
|
import "./presale/index.mjs";
|
|
86
84
|
import "./ApprovalDBs/EventsPublicApprovalsDB.mjs";
|
|
87
85
|
import "./ApprovalDBs/index.mjs";
|
|
86
|
+
import "./WalletManager/WalletManager.mjs";
|
|
87
|
+
import "./WalletManager/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./MerkleTreeIncompleteError.cjs`),require(`./MerkleTree.cjs`)
|
|
1
|
+
require(`./MerkleTreeIncompleteError.cjs`),require(`./MerkleTree.cjs`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ContractType, EthereumNetwork } from '../../types/ethereum-network.types';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { Call } from '../../types/eip5792.types';
|
|
4
|
+
import { Transaction } from '@solana/web3.js';
|
|
4
5
|
export interface ChainEventListener {
|
|
5
6
|
onAccountChanged(): void;
|
|
6
7
|
onChainChanged(chainId?: number): void;
|
|
@@ -31,4 +32,9 @@ export interface IProviderAdapter<ConnectorType = unknown> {
|
|
|
31
32
|
signTypedData(domain: ethers.TypedDataDomain, types: Record<string, ethers.TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
|
|
32
33
|
sendBatchCallsTransaction?(chainId: number, calls: Call[]): Promise<ethers.TransactionResponse>;
|
|
33
34
|
supportsBatchCall?(chainId: number): Promise<boolean>;
|
|
35
|
+
signTransactionWithoutBroadcast?(tx: Transaction): Promise<{
|
|
36
|
+
signature: string;
|
|
37
|
+
transactionMessageB64: string;
|
|
38
|
+
}>;
|
|
39
|
+
isSolanaLedger?(): boolean;
|
|
34
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../API/fetchCommitmentsCache.cjs`);var n=300*1e3,r=class{chainId;contractAddress;snapshotsPromise;lastFetchedAt;cacheDurationMs;constructor(e,t,r=n){this.chainId=e,this.contractAddress=t,this.cacheDurationMs=r}async fetchSnapshots(){return this.lastFetchedAt=Date.now(),t.fetchSnapshots(this.chainId)}async ensureSnapshots(t=!1){let n=Date.now(),r=!this.lastFetchedAt||n-this.lastFetchedAt>this.cacheDurationMs;(t||!this.snapshotsPromise||r)&&(this.snapshotsPromise=this.fetchSnapshots());let i=await this.snapshotsPromise;if(!e.caseInsensitiveEqual(i.commitments.hinkalAddress,this.contractAddress)||i.commitments.chainId!==this.chainId)throw Error(`Snapshots: incorrect contract or chain id`);return i}async getAll(e=!1){return this.ensureSnapshots(e)}async getCommitments(e=!1){return(await this.ensureSnapshots(e)).commitments}async
|
|
1
|
+
const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../API/fetchCommitmentsCache.cjs`);var n=300*1e3,r=class{chainId;contractAddress;snapshotsPromise;lastFetchedAt;cacheDurationMs;constructor(e,t,r=n){this.chainId=e,this.contractAddress=t,this.cacheDurationMs=r}async fetchSnapshots(){return this.lastFetchedAt=Date.now(),t.fetchSnapshots(this.chainId)}async ensureSnapshots(t=!1){let n=Date.now(),r=!this.lastFetchedAt||n-this.lastFetchedAt>this.cacheDurationMs;(t||!this.snapshotsPromise||r)&&(this.snapshotsPromise=this.fetchSnapshots());let i=await this.snapshotsPromise;if(!e.caseInsensitiveEqual(i.commitments.hinkalAddress,this.contractAddress)||i.commitments.chainId!==this.chainId)throw Error(`Snapshots: incorrect contract or chain id`);return i}async getAll(e=!1){return this.ensureSnapshots(e)}async getCommitments(e=!1){return(await this.ensureSnapshots(e)).commitments}async getNullifiers(e=!1){return(await this.ensureSnapshots(e)).nullifiers}};exports.SnapshotFetcherService=r;
|