@hinkal/common 0.2.21 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +14 -14
- package/API/API.mjs +88 -87
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.d.ts +1 -1
- package/API/admin-calls.mjs +4 -4
- package/API/ai-calls.cjs +1 -0
- package/API/ai-calls.d.ts +17 -0
- package/API/ai-calls.mjs +21 -0
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.d.ts +1 -1
- package/API/callLifiAPI.mjs +5 -5
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +1 -1
- package/API/callMonitor.mjs +7 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +11 -11
- package/API/callOkxAPI.cjs +1 -1
- package/API/callOkxAPI.d.ts +1 -1
- package/API/callOkxAPI.mjs +5 -5
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +11 -10
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +5 -6
- package/API/callRelayer.mjs +11 -11
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.d.ts +1 -1
- package/API/checkRisk.mjs +4 -4
- package/API/deposit-and-withdraw-status-calls.cjs +1 -0
- package/API/deposit-and-withdraw-status-calls.d.ts +20 -0
- package/API/deposit-and-withdraw-status-calls.mjs +18 -0
- package/API/duneAPI.cjs +1 -0
- package/API/duneAPI.d.ts +11 -0
- package/API/duneAPI.mjs +25 -0
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +4 -5
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.mjs +9 -9
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.d.ts +1 -1
- package/API/get-token-data.mjs +5 -5
- package/API/getBridgeProtocols.cjs +1 -0
- package/API/getBridgeProtocols.d.ts +7 -0
- package/API/getBridgeProtocols.mjs +8 -0
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.mjs +9 -9
- package/API/getLifiStatus.cjs +1 -0
- package/API/getLifiStatus.d.ts +24 -0
- package/API/getLifiStatus.mjs +15 -0
- package/API/getRelayerURL.cjs +1 -0
- package/API/getRelayerURL.d.ts +1 -0
- package/API/getRelayerURL.mjs +10 -0
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -3
- package/API/getServerURL.mjs +67 -51
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +0 -5
- package/API/getTokenPrice.mjs +7 -14
- package/API/index.d.ts +3 -1
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.d.ts +1 -1
- package/API/is-tx-stateless.mjs +12 -10
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +8 -4
- package/API/kycCalls.mjs +26 -23
- package/API/passwordCalls.cjs +1 -0
- package/API/passwordCalls.d.ts +9 -0
- package/API/passwordCalls.mjs +13 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +2 -7
- package/API/proxyAccountsCalls.mjs +21 -27
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +4 -4
- package/API/restoreSnapshots.cjs +1 -0
- package/API/restoreSnapshots.d.ts +1 -0
- package/API/restoreSnapshots.mjs +10 -0
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +9 -1
- package/API/scheduled-transactions-calls.mjs +9 -5
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.d.ts +2 -2
- package/API/simulate-batch-tx.mjs +6 -7
- package/API/solana-calls.cjs +1 -1
- package/API/solana-calls.d.ts +3 -6
- package/API/solana-calls.mjs +15 -15
- package/API/temporaryWalletCalls.cjs +1 -1
- package/API/temporaryWalletCalls.mjs +19 -13
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +5 -6
- package/README.md +64 -256
- package/constants/activity.constants.cjs +1 -1
- package/constants/activity.constants.mjs +0 -1
- package/constants/addresses.constants.cjs +1 -1
- package/constants/addresses.constants.mjs +9 -10
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +6 -0
- package/constants/chains.constants.mjs +52 -58
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +0 -1
- package/constants/coingecko.constants.mjs +10 -11
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.d.ts +3 -3
- package/constants/contracts.constants.mjs +29 -29
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +2 -28
- package/constants/function-signatures.constants.cjs +1 -1
- package/constants/function-signatures.constants.d.ts +1 -0
- package/constants/function-signatures.constants.mjs +4 -3
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +40 -39
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +0 -1
- package/constants/mediaUrls.constants.mjs +1 -2
- package/constants/permit2.constants.cjs +1 -1
- package/constants/permit2.constants.d.ts +1 -0
- package/constants/permit2.constants.mjs +11 -10
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +123 -19
- package/constants/server.constants.mjs +138 -35
- package/constants/tasks.constants.cjs +1 -1
- package/constants/tasks.constants.mjs +4 -5
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +13 -36
- package/crypto/poseidon.cjs +1 -1
- package/crypto/poseidon.mjs +10 -10
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +86 -83
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +56 -45
- package/data-structures/Hinkal/Hinkal.mjs +348 -315
- package/data-structures/Hinkal/IHinkal.d.ts +56 -42
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +49 -48
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +7 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +42 -0
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +24 -29
- package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
- package/data-structures/Hinkal/hinkalApprove.d.ts +3 -0
- package/data-structures/Hinkal/hinkalApprove.mjs +114 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +19 -20
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +84 -89
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +96 -78
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +79 -75
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +151 -140
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +5 -4
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +4 -0
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +120 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +118 -115
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +29 -30
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -40
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +32 -37
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +15 -17
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +3 -4
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +95 -84
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +180 -154
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +3 -2
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +40 -43
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +67 -71
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -63
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +46 -50
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +50 -52
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +65 -69
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +77 -71
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +70 -72
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +78 -81
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +103 -106
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +54 -108
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +0 -1
- package/data-structures/IndexedDB/activity-db.mjs +79 -97
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +39 -43
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +31 -36
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +40 -26
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +82 -82
- package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
- package/data-structures/TokenDBs/token-visibility-db.mjs +36 -22
- package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/data-structures/crypto-keys/decodeUTXO.mjs +45 -45
- package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +28 -27
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +10 -0
- package/data-structures/crypto-keys/keys.mjs +106 -47
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +2 -4
- package/data-structures/event-service/evm/AbstractEventService.mjs +13 -13
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +3 -3
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +2 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.mjs +6 -2
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +5 -10
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +40 -40
- package/data-structures/event-service/index.d.ts +0 -4
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +3 -4
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +10 -4
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +7 -10
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +2 -2
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +2 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +2 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +16 -11
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +66 -64
- package/data-structures/index.d.ts +0 -3
- package/data-structures/presale/PresaleContractWrapper.cjs +1 -1
- package/data-structures/presale/PresaleContractWrapper.d.ts +3 -3
- package/data-structures/presale/PresaleContractWrapper.mjs +10 -10
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +16 -11
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +18 -18
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +9 -9
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +4 -5
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +4 -6
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +0 -1
- package/error-handling/error-codes.constants.mjs +3 -4
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +27 -22
- package/error-handling/handleErrorRestore.cjs +1 -0
- package/error-handling/handleErrorRestore.d.ts +2 -0
- package/error-handling/handleErrorRestore.mjs +11 -0
- package/error-handling/index.d.ts +1 -0
- package/functions/kyc/authentoHelper.cjs +1 -0
- package/functions/kyc/authentoHelper.d.ts +12 -0
- package/functions/kyc/authentoHelper.mjs +30 -0
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.mjs +16 -17
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -2
- package/functions/pre-transaction/constructAdminData.mjs +18 -12
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +2 -1
- package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.mjs +2 -3
- package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/functions/pre-transaction/getSolanaCalldataHash.mjs +21 -21
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +36 -22
- package/functions/pre-transaction/interaction-to-action.cjs +1 -1
- package/functions/pre-transaction/interaction-to-action.mjs +2 -3
- package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +9 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +34 -19
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +50 -53
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +12 -10
- package/functions/private-wallet/emporium.helpers.mjs +139 -102
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +4 -1
- package/functions/private-wallet/emporium.swap.helpers.mjs +106 -103
- package/functions/private-wallet/opProducer.cjs +1 -1
- package/functions/private-wallet/opProducer.mjs +1 -1
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.mjs +21 -18
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.mjs +49 -49
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +11 -10
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +10 -11
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +0 -1
- package/functions/utils/addresses.mjs +11 -12
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.d.ts +1 -1
- package/functions/utils/cacheFunctions.mjs +55 -54
- package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
- package/functions/utils/convertEmporiumOpToCallInfo.mjs +5 -5
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +2 -2
- package/functions/utils/create-provider.mjs +7 -11
- package/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/functions/utils/encryptInputForEnclave.mjs +9 -9
- package/functions/utils/ethers-formatter.utils.d.ts +1 -1
- package/functions/utils/external-action.utils.cjs +1 -1
- package/functions/utils/external-action.utils.mjs +2 -2
- package/functions/utils/get-hinkal-approvals.cjs +1 -0
- package/functions/utils/get-hinkal-approvals.d.ts +3 -0
- package/functions/utils/get-hinkal-approvals.mjs +38 -0
- package/functions/utils/getContractAddress.cjs +1 -0
- package/functions/utils/getContractAddress.d.ts +2 -0
- package/functions/utils/getContractAddress.mjs +9 -0
- package/functions/utils/getDataFromTransaction.cjs +1 -1
- package/functions/utils/getDataFromTransaction.d.ts +0 -11
- package/functions/utils/getDataFromTransaction.mjs +26 -50
- package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/functions/utils/getRecipientInfoFromUserKeys.mjs +1 -1
- package/functions/utils/getSignerFromContract.cjs +1 -0
- package/functions/utils/getSignerFromContract.d.ts +3 -0
- package/functions/utils/getSignerFromContract.mjs +16 -0
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +14 -15
- package/functions/utils/inLogicMetadata.cjs +1 -1
- package/functions/utils/inLogicMetadata.mjs +2 -2
- package/functions/utils/index.d.ts +1 -0
- package/functions/utils/involves-permit2-op.cjs +1 -1
- package/functions/utils/involves-permit2-op.d.ts +1 -0
- package/functions/utils/involves-permit2-op.mjs +6 -4
- package/functions/utils/mutexes.utils.cjs +1 -1
- package/functions/utils/mutexes.utils.d.ts +1 -1
- package/functions/utils/mutexes.utils.mjs +3 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +23 -9
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +13 -6
- package/functions/utils/prepareHinkal.mjs +72 -45
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.d.ts +1 -1
- package/functions/utils/publicBalance.utils.mjs +62 -57
- package/functions/utils/replaceAddressInCalldata.cjs +1 -0
- package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
- package/functions/utils/replaceAddressInCalldata.mjs +7 -0
- package/functions/utils/rpc-int-encode.cjs +1 -1
- package/functions/utils/rpc-int-encode.d.ts +1 -2
- package/functions/utils/rpc-int-encode.mjs +3 -6
- package/functions/utils/solanaMint.utils.cjs +1 -1
- package/functions/utils/solanaMint.utils.mjs +6 -6
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +0 -1
- package/functions/utils/string.utils.mjs +14 -18
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +0 -3
- package/functions/utils/token-check.utils.mjs +7 -18
- package/functions/utils/upToDateState.cjs +1 -1
- package/functions/utils/upToDateState.d.ts +1 -1
- package/functions/utils/upToDateState.mjs +4 -4
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +17 -2
- package/functions/utils/walletBalances.utils.mjs +36 -5
- package/functions/web3/EIP-712.cjs +1 -1
- package/functions/web3/EIP-712.d.ts +4 -4
- package/functions/web3/EIP-712.mjs +1 -1
- package/functions/web3/etherFunctions.cjs +1 -1
- package/functions/web3/etherFunctions.mjs +32 -29
- package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedCustomHandler.mjs +4 -5
- package/functions/web3/events/balanceChangedHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedHandler.mjs +2 -3
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.d.ts +4 -3
- package/functions/web3/events/getApprovedBalance.mjs +44 -39
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -3
- package/functions/web3/events/getInputUtxoAndBalance.mjs +150 -129
- package/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/functions/web3/events/getInputUtxosEnclave.mjs +20 -20
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +75 -73
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.d.ts +3 -3
- package/functions/web3/events/getTransactionLogEvents.mjs +41 -40
- package/functions/web3/events/index.d.ts +0 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.d.ts +1 -2
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +12 -16
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +6 -1
- package/functions/web3/functionCalls/accessTokenCalls.mjs +20 -12
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +68 -69
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/functions/web3/functionCalls/constructBatchCall.d.ts +2 -2
- package/functions/web3/functionCalls/constructBatchCall.mjs +10 -9
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -1
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +29 -0
- package/functions/web3/functionCalls/recoverTransactionFromError.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +47 -39
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +3 -3
- package/functions/web3/functionCalls/transactCallRelayer.mjs +54 -56
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.d.ts +1 -1
- package/functions/web3/getContractMetadata.mjs +21 -16
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +7 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +32 -31
- package/functions/web3/index.d.ts +0 -1
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.d.ts +1 -1
- package/functions/web3/lifiAPI.mjs +12 -12
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +15 -3
- package/functions/web3/okxAPI.cjs +1 -1
- package/functions/web3/okxAPI.mjs +13 -13
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +20 -8
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.d.ts +6 -5
- package/functions/web3/runContractFunction.mjs +60 -46
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.d.ts +2 -2
- package/functions/web3/uniswapAPI.mjs +49 -38
- package/index.cjs +1 -1
- package/index.mjs +912 -914
- package/package.json +4 -6
- package/providers/CustomEthersProvider.d.ts +1 -1
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +21 -14
- package/providers/EthersProviderAdapter.mjs +86 -53
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +12 -8
- package/providers/SolanaProviderAdapter.mjs +31 -16
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +20 -14
- package/providers/WagmiProviderAdapter.mjs +126 -91
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.d.ts +2 -2
- package/providers/prepareEthersHinkal.mjs +9 -16
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +9 -17
- package/types/TransactionSimulator.types.d.ts +9 -2
- package/types/activities.types.d.ts +2 -5
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +6 -0
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +1 -0
- package/types/big-intable.types.d.ts +3 -2
- package/types/bridging.types.d.ts +29 -0
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +3 -6
- package/types/cache.types.mjs +1 -1
- package/types/coingecko.types.d.ts +0 -5
- package/types/duneAPI.types.d.ts +9 -0
- package/types/ethereum-network.types.d.ts +10 -11
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +1 -1
- package/types/hinkal.types.mjs +18 -18
- package/types/index.d.ts +2 -2
- package/types/proxy.types.d.ts +3 -6
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +39 -10
- package/types/sandbox.types.mjs +2 -2
- package/types/scheduled-transactions.types.cjs +1 -1
- package/types/scheduled-transactions.types.d.ts +6 -0
- package/types/scheduled-transactions.types.mjs +3 -2
- package/types/session.types.d.ts +0 -2
- package/types/solana.types.d.ts +0 -9
- package/types/token-prices.types.cjs +1 -1
- package/types/token-prices.types.d.ts +0 -7
- package/types/token-prices.types.mjs +2 -4
- package/types/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +2 -3
- package/types/transactions.types.mjs +6 -7
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +1 -1
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/API/get-token-price-chart-data.cjs +0 -1
- package/API/get-token-price-chart-data.d.ts +0 -16
- package/API/get-token-price-chart-data.mjs +0 -13
- package/API/onrampCalls.cjs +0 -1
- package/API/onrampCalls.d.ts +0 -20
- package/API/onrampCalls.mjs +0 -15
- package/API/unspent-utxos-calls.cjs +0 -1
- package/API/unspent-utxos-calls.d.ts +0 -26
- package/API/unspent-utxos-calls.mjs +0 -26
- package/data-structures/AccountActions/AccountActions.cjs +0 -1
- package/data-structures/AccountActions/AccountActions.d.ts +0 -18
- package/data-structures/AccountActions/AccountActions.mjs +0 -78
- package/data-structures/AccountActions/index.d.ts +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.cjs +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +0 -14
- package/data-structures/BlockchainEvent/BlockchainEvent.mjs +0 -41
- package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +0 -1
- package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +0 -20
- package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +0 -124
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +0 -1
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +0 -15
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +0 -64
- package/data-structures/PublicBalance/index.d.ts +0 -2
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +0 -21
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +0 -16
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/ClientEventHelper.d.ts +0 -11
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +0 -26
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +0 -5
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +0 -14
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +0 -22
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +0 -16
- package/functions/utils/enum.utils.cjs +0 -1
- package/functions/utils/enum.utils.mjs +0 -14
- package/functions/utils/socket.utils.cjs +0 -1
- package/functions/utils/socket.utils.d.ts +0 -1
- package/functions/utils/socket.utils.mjs +0 -12
- package/functions/web3/crypto.cjs +0 -1
- package/functions/web3/crypto.d.ts +0 -1
- package/functions/web3/crypto.mjs +0 -7
- package/functions/web3/events/web3RetrieveEvents.cjs +0 -1
- package/functions/web3/events/web3RetrieveEvents.d.ts +0 -14
- package/functions/web3/events/web3RetrieveEvents.mjs +0 -9
- package/types/events.types.cjs +0 -1
- package/types/events.types.d.ts +0 -9
- package/types/events.types.mjs +0 -5
- package/types/onramp.types.cjs +0 -1
- package/types/onramp.types.d.ts +0 -58
- package/types/onramp.types.mjs +0 -4
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { MerkleTree, MerkleTreeJson } from '../../merkle-tree';
|
|
2
|
-
import { CommitmentEvent, EncryptedOutputWithSign } from '../../../types';
|
|
2
|
+
import { CommitmentEvent, EncryptedOutputWithSign, SolanaCommitmentEvent } from '../../../types';
|
|
3
3
|
import { AbstractSolanaSnapshotService, SolanaSnapshot } from './AbstractSolanaSnapshotService';
|
|
4
4
|
import { SolanaBlockchainEventEmitter } from './SolanaBlockchainEventEmitter';
|
|
5
|
-
import { BlockchainEvent } from '../../BlockchainEvent/BlockchainEvent';
|
|
6
5
|
export type SolanaCommitmentsSnapshotPayload = {
|
|
7
6
|
readonly merkleTree: MerkleTree<bigint>;
|
|
8
7
|
readonly encryptedOutputs: EncryptedOutputWithSign[];
|
|
@@ -12,7 +11,7 @@ export type SolanaCommitmentsSerializedSnapshot = {
|
|
|
12
11
|
merkleTree?: MerkleTreeJson;
|
|
13
12
|
encryptedOutputs?: EncryptedOutputWithSign<string>[];
|
|
14
13
|
};
|
|
15
|
-
export declare abstract class AbstractSolanaCommitmentsSnapshotService extends AbstractSolanaSnapshotService<CommitmentEvent<bigint>, SolanaCommitmentsSnapshotPayload, SolanaCommitmentsSerializedSnapshot> {
|
|
14
|
+
export declare abstract class AbstractSolanaCommitmentsSnapshotService extends AbstractSolanaSnapshotService<CommitmentEvent<bigint>, SolanaCommitmentEvent, SolanaCommitmentsSnapshotPayload, SolanaCommitmentsSerializedSnapshot> {
|
|
16
15
|
constructor(solanaEventEmitter: SolanaBlockchainEventEmitter);
|
|
17
16
|
private _merkleTree;
|
|
18
17
|
private _encryptedOutputs;
|
|
@@ -25,6 +24,6 @@ export declare abstract class AbstractSolanaCommitmentsSnapshotService extends A
|
|
|
25
24
|
encryptedOutputs: EncryptedOutputWithSign<boolean>[];
|
|
26
25
|
};
|
|
27
26
|
protected populateSnapshot({ payload: { merkleTree, encryptedOutputs }, }: SolanaSnapshot<SolanaCommitmentsSnapshotPayload>): void;
|
|
28
|
-
protected mapEvent(event:
|
|
27
|
+
protected mapEvent(event: SolanaCommitmentEvent): Promise<CommitmentEvent<bigint>>;
|
|
29
28
|
protected acceptEvent(event: CommitmentEvent<bigint>, _slot: number, _signature?: string, isBlocked?: boolean): boolean;
|
|
30
29
|
}
|
|
@@ -6,11 +6,11 @@ import "buffer";
|
|
|
6
6
|
import { MerkleTree as a } from "../../merkle-tree/MerkleTree.mjs";
|
|
7
7
|
import "ethers";
|
|
8
8
|
import "../../../error-handling/error-codes.constants.mjs";
|
|
9
|
-
import { advancedToBigInt as
|
|
9
|
+
import { advancedToBigInt as u } from "../../../functions/utils/amounts.utils.mjs";
|
|
10
10
|
import { AbstractSolanaSnapshotService as l } from "./AbstractSolanaSnapshotService.mjs";
|
|
11
11
|
import { contructMerkleTreeFromSerialized as d } from "../../../functions/utils/merkleTree.utils.mjs";
|
|
12
12
|
import { encodeSolanaOnChainUtxo as y, isSolanaOnChainUtxo as O } from "../../crypto-keys/decodeUTXO.mjs";
|
|
13
|
-
class
|
|
13
|
+
class I extends l {
|
|
14
14
|
constructor(e) {
|
|
15
15
|
super(e, "NewCommitment");
|
|
16
16
|
}
|
|
@@ -61,20 +61,20 @@ class P extends l {
|
|
|
61
61
|
this._merkleTree = e, this._encryptedOutputs = t;
|
|
62
62
|
}
|
|
63
63
|
async mapEvent(e) {
|
|
64
|
-
const
|
|
64
|
+
const { commitment: t, index: n, encrypted_output: r, on_chain_data: i } = e, s = u(t), o = u(n);
|
|
65
65
|
if (r.length === 0) {
|
|
66
|
-
const
|
|
66
|
+
const m = y(i);
|
|
67
67
|
return {
|
|
68
68
|
commitment: s,
|
|
69
69
|
index: o,
|
|
70
|
-
encryptedOutput:
|
|
70
|
+
encryptedOutput: m
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const c = `0x${Buffer.from(r).toString("hex")}`;
|
|
74
74
|
return {
|
|
75
75
|
commitment: s,
|
|
76
76
|
index: o,
|
|
77
|
-
encryptedOutput:
|
|
77
|
+
encryptedOutput: c
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
acceptEvent(e, t, n, r) {
|
|
@@ -92,5 +92,5 @@ class P extends l {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
export {
|
|
95
|
-
|
|
95
|
+
I as AbstractSolanaCommitmentsSnapshotService
|
|
96
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i{solanaBlockchainEventEmitter;eventName;constructor(e,s){this.solanaBlockchainEventEmitter=e,this.eventName=s,e.addEventProcessorFunction(this.processEventsPage.bind(this))}get latestBlockNumber(){return this.solanaBlockchainEventEmitter.latestBlockNumber}intervalClear(){this.solanaBlockchainEventEmitter.intervalClear()}async processEventsPage(e){const s=[],n=new Set;e.forEach(({eventName:t,signature:a})=>{t==="BlockedUtxosCreated"&&n.add(a)});const c=e.filter(t=>t.eventName===this.eventName).map(async t=>{try{const a=await this.mapEvent(t.data),o=n.has(t.signature);return await this.acceptEvent(a,t.slot,t.signature,o)?a:null}catch{return null}}),r=(await Promise.all(c)).filter(t=>t!==null);s.push(...r);const l=s.length;return await this.afterEventsAccepted(l),s.length}}exports.AbstractSolanaEventService=i;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { BlockchainEvent } from '../../BlockchainEvent/BlockchainEvent';
|
|
2
1
|
import { SolanaBlockchainEventEmitter } from './SolanaBlockchainEventEmitter';
|
|
2
|
+
export interface SolanaEvent {
|
|
3
|
+
signature: string;
|
|
4
|
+
slot: number;
|
|
5
|
+
blockTime: number;
|
|
6
|
+
programId: any;
|
|
7
|
+
data: any;
|
|
8
|
+
eventName: string;
|
|
9
|
+
}
|
|
3
10
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
4
|
-
export declare abstract class AbstractSolanaEventService<EventType> {
|
|
11
|
+
export declare abstract class AbstractSolanaEventService<EventType, SerializedEventType = unknown> {
|
|
5
12
|
protected solanaBlockchainEventEmitter: SolanaBlockchainEventEmitter;
|
|
6
13
|
protected readonly eventName: string;
|
|
7
14
|
protected constructor(solanaBlockchainEventEmitter: SolanaBlockchainEventEmitter, eventName: string);
|
|
8
15
|
get latestBlockNumber(): number;
|
|
9
|
-
get chainId(): number;
|
|
10
16
|
intervalClear(): void;
|
|
11
17
|
private processEventsPage;
|
|
12
18
|
protected abstract acceptEvent(event: EventType, slot: number, signature?: string, isBlocked?: boolean): boolean | Promise<boolean>;
|
|
13
|
-
protected abstract mapEvent(event:
|
|
19
|
+
protected abstract mapEvent(event: SerializedEventType): PromiseOrValue<EventType>;
|
|
14
20
|
protected abstract afterEventsAccepted(eventsCount: number): Promise<void>;
|
|
15
21
|
}
|
|
16
22
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class E {
|
|
2
2
|
solanaBlockchainEventEmitter;
|
|
3
3
|
eventName;
|
|
4
4
|
constructor(e, s) {
|
|
@@ -7,30 +7,27 @@ class u {
|
|
|
7
7
|
get latestBlockNumber() {
|
|
8
8
|
return this.solanaBlockchainEventEmitter.latestBlockNumber;
|
|
9
9
|
}
|
|
10
|
-
get chainId() {
|
|
11
|
-
return this.solanaBlockchainEventEmitter.chainId;
|
|
12
|
-
}
|
|
13
10
|
intervalClear() {
|
|
14
11
|
this.solanaBlockchainEventEmitter.intervalClear();
|
|
15
12
|
}
|
|
16
13
|
async processEventsPage(e) {
|
|
17
14
|
const s = [], a = /* @__PURE__ */ new Set();
|
|
18
|
-
e.forEach(({ eventName: t,
|
|
15
|
+
e.forEach(({ eventName: t, signature: n }) => {
|
|
19
16
|
t === "BlockedUtxosCreated" && a.add(n);
|
|
20
17
|
});
|
|
21
18
|
const c = e.filter((t) => t.eventName === this.eventName).map(async (t) => {
|
|
22
19
|
try {
|
|
23
|
-
const n = await this.mapEvent(t),
|
|
24
|
-
return await this.acceptEvent(n, t.
|
|
20
|
+
const n = await this.mapEvent(t.data), o = a.has(t.signature);
|
|
21
|
+
return await this.acceptEvent(n, t.slot, t.signature, o) ? n : null;
|
|
25
22
|
} catch {
|
|
26
23
|
return null;
|
|
27
24
|
}
|
|
28
25
|
}), r = (await Promise.all(c)).filter((t) => t !== null);
|
|
29
26
|
s.push(...r);
|
|
30
|
-
const
|
|
31
|
-
return await this.afterEventsAccepted(
|
|
27
|
+
const l = s.length;
|
|
28
|
+
return await this.afterEventsAccepted(l), s.length;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
export {
|
|
35
|
-
|
|
32
|
+
E as AbstractSolanaEventService
|
|
36
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers"),i=require("../../../functions/utils/amounts.utils.cjs"),s=require("./AbstractSolanaSnapshotService.cjs");class n extends s.AbstractSolanaSnapshotService{constructor(e){super(e,"Nullified")}_nullifiers;get nullifiers(){return this._nullifiers}serializeSnapshot(e){return{nullifiers:Array.from(e.payload.nullifiers).map(r=>r.toString()),latestBlockNumber:e.latestBlockNumber}}deserializeSnapshot(e){return{latestBlockNumber:e.latestBlockNumber??0,payload:{nullifiers:new Set(e.nullifiers??[])}}}acceptEvent(e,r){try{return this._nullifiers.has(e.nullifier)?!1:(this._nullifiers.add(e.nullifier),!0)}catch(l){return console.error(l),!1}}mapEvent(e){return{nullifier:t.ethers.toBeHex(i.advancedToBigInt(e.nullifier))}}getSnapshotPayload(){return{nullifiers:this._nullifiers}}populateSnapshot({payload:{nullifiers:e}}){this._nullifiers=e}}exports.AbstractSolanaNullifierSnapshotService=n;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NullifierEvent } from '../../../types/commitments.types';
|
|
2
2
|
import { AbstractSolanaSnapshotService, SolanaSnapshot } from './AbstractSolanaSnapshotService';
|
|
3
3
|
import { SolanaBlockchainEventEmitter } from './SolanaBlockchainEventEmitter';
|
|
4
|
-
import { BlockchainEvent } from '../../BlockchainEvent/BlockchainEvent';
|
|
5
4
|
export type SolanaNullifierSnapshotPayload = {
|
|
6
5
|
readonly nullifiers: Set<string>;
|
|
7
6
|
};
|
|
@@ -9,14 +8,14 @@ export type SolanaNullifierSerializedSnapshot = {
|
|
|
9
8
|
latestBlockNumber?: number;
|
|
10
9
|
nullifiers?: string[];
|
|
11
10
|
};
|
|
12
|
-
export declare abstract class AbstractSolanaNullifierSnapshotService extends AbstractSolanaSnapshotService<NullifierEvent<string>, SolanaNullifierSnapshotPayload, SolanaNullifierSerializedSnapshot> {
|
|
11
|
+
export declare abstract class AbstractSolanaNullifierSnapshotService extends AbstractSolanaSnapshotService<NullifierEvent<string>, NullifierEvent<number[]>, SolanaNullifierSnapshotPayload, SolanaNullifierSerializedSnapshot> {
|
|
13
12
|
constructor(solanaEventEmitter: SolanaBlockchainEventEmitter);
|
|
14
13
|
private _nullifiers;
|
|
15
14
|
get nullifiers(): Set<string>;
|
|
16
15
|
protected serializeSnapshot(snapshot: SolanaSnapshot<SolanaNullifierSnapshotPayload>): SolanaNullifierSerializedSnapshot;
|
|
17
16
|
protected deserializeSnapshot(serializedSnapshot: SolanaNullifierSerializedSnapshot): SolanaSnapshot<SolanaNullifierSnapshotPayload>;
|
|
18
17
|
protected acceptEvent(event: NullifierEvent<string>, _slot: number): boolean;
|
|
19
|
-
protected mapEvent(event:
|
|
18
|
+
protected mapEvent(event: NullifierEvent<number[]>): NullifierEvent<string>;
|
|
20
19
|
protected getSnapshotPayload(): SolanaNullifierSnapshotPayload;
|
|
21
20
|
protected populateSnapshot({ payload: { nullifiers } }: SolanaSnapshot<SolanaNullifierSnapshotPayload>): void;
|
|
22
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ethers as i } from "ethers";
|
|
2
2
|
import { advancedToBigInt as t } from "../../../functions/utils/amounts.utils.mjs";
|
|
3
3
|
import { AbstractSolanaSnapshotService as n } from "./AbstractSolanaSnapshotService.mjs";
|
|
4
4
|
class f extends n {
|
|
@@ -32,7 +32,7 @@ class f extends n {
|
|
|
32
32
|
}
|
|
33
33
|
mapEvent(r) {
|
|
34
34
|
return {
|
|
35
|
-
nullifier: i.
|
|
35
|
+
nullifier: i.toBeHex(t(r.nullifier))
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
getSnapshotPayload() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./AbstractSolanaEventService.cjs"),e=require("../../../constants/save-depths.cjs");class o extends a.AbstractSolanaEventService{savedLatestSlot=0;chainId=0;constructor(t,s){super(t,s)}async init(){await this.loadSnapshot(),this.chainId=this.solanaBlockchainEventEmitter.chainId}async retrieveEventsFromLatestBlock(){await this.solanaBlockchainEventEmitter.retrieveEvents(this.latestBlockNumber)}async loadSnapshot(){const t=await this.fetchSnapshot(),s=this.deserializeSnapshot(t);this.populateSnapshot(s),this.solanaBlockchainEventEmitter.syncFromAtMost(s.latestBlockNumber),this.savedLatestSlot=s.latestBlockNumber}saveSnapshot(){return this.savedLatestSlot=this.latestBlockNumber,this.persistSnapshot(this.serializeSnapshot({latestBlockNumber:this.latestBlockNumber,payload:this.getSnapshotPayload()}))}async afterEventsAccepted(t){(t>0||this.savedLatestSlot+e.saveDepths[this.chainId]<this.latestBlockNumber)&&await this.saveSnapshot()}}exports.AbstractSolanaSnapshotService=o;
|
|
@@ -4,8 +4,9 @@ export interface SolanaSnapshot<SnapshotPayloadType> {
|
|
|
4
4
|
readonly latestBlockNumber: number;
|
|
5
5
|
readonly payload: SnapshotPayloadType;
|
|
6
6
|
}
|
|
7
|
-
export declare abstract class AbstractSolanaSnapshotService<EventType, SnapshotPayloadType, SerializedSnapshotType> extends AbstractSolanaEventService<EventType> {
|
|
7
|
+
export declare abstract class AbstractSolanaSnapshotService<EventType, SerializedEventType, SnapshotPayloadType, SerializedSnapshotType> extends AbstractSolanaEventService<EventType, SerializedEventType> {
|
|
8
8
|
private savedLatestSlot;
|
|
9
|
+
private chainId;
|
|
9
10
|
protected constructor(solanaBlockchainEventEmitter: SolanaBlockchainEventEmitter, eventName: string);
|
|
10
11
|
init(): Promise<void>;
|
|
11
12
|
retrieveEventsFromLatestBlock(): Promise<void>;
|
|
@@ -2,11 +2,12 @@ import { AbstractSolanaEventService as a } from "./AbstractSolanaEventService.mj
|
|
|
2
2
|
import { saveDepths as e } from "../../../constants/save-depths.mjs";
|
|
3
3
|
class n extends a {
|
|
4
4
|
savedLatestSlot = 0;
|
|
5
|
+
chainId = 0;
|
|
5
6
|
constructor(t, s) {
|
|
6
7
|
super(t, s);
|
|
7
8
|
}
|
|
8
9
|
async init() {
|
|
9
|
-
await this.loadSnapshot();
|
|
10
|
+
await this.loadSnapshot(), this.chainId = this.solanaBlockchainEventEmitter.chainId;
|
|
10
11
|
}
|
|
11
12
|
async retrieveEventsFromLatestBlock() {
|
|
12
13
|
await this.solanaBlockchainEventEmitter.retrieveEvents(this.latestBlockNumber);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@coral-xyz/anchor"),m=require("../../../functions/utils/resolve-sync.utils.cjs"),p=require("../../../functions/utils/mutexes.utils.cjs"),l=require("../../../error-handling/logger.cjs"),g=require("../../../constants/chains.constants.cjs"),f=require("../../../functions/utils/caseInsensitive.utils.cjs"),d=1e3;class y{connection;programId;_latestSlot;_initialSlot;onEventsProcessed;eventProcessors=new Set;maxPageSize;isReady=!1;isServer;intervalId;inProgress;anchorParser;eventsFetchingMutex;constructor(e,r,a,s,n,o=p.balanceFetchingMutex){this.connection=e,this.programId=r,this._initialSlot=a,this.maxPageSize=n,this.isServer=s,this.inProgress=!1,this.eventsFetchingMutex=o}get latestBlockNumber(){return this._latestSlot??this._initialSlot}setIdl(e){try{const r=new v.BorshCoder(e);this.anchorParser=new v.EventParser(this.programId,r)}catch(r){l.Logger.error("Failed to initialize Anchor EventParser:",r),this.anchorParser=void 0}}syncFromAtMost(e){(this._latestSlot===void 0||e<this._latestSlot)&&(this._latestSlot=e)}intervalClear(){this.isReady=!1,this.eventProcessors=new Set,clearInterval(this.intervalId)}async init(){if(this.isReady)throw new Error("Already initialized");this.isReady=!0,await this.retrieveEvents(this.latestBlockNumber+1),this.intervalId=setInterval(async()=>{await this.retrieveEvents(this.latestBlockNumber)},3500)}requireReady(){if(!this.isReady)throw new Error("Not ready")}get chainId(){const e=this.connection.rpcEndpoint;return f.caseInsensitiveEqual(e,g.networkRegistry[g.chainIds.solanaMainnet].fetchRpcUrl)?g.chainIds.solanaMainnet:g.chainIds.solanaLocalnet}addEventProcessorFunction(e){if(this.isReady)throw new Error("Can't add event processor after event emitter initialized");this.eventProcessors.add(e)}async getLastSlotForEventRequest(){const e=await this.connection.getSlot();return this.isServer?Math.max(this.latestBlockNumber,e-32+1):e}async retrieveEvents(e,r=!1){const a=e;return this.requireReady(),await this.eventsFetchingMutex.runExclusive(async()=>{try{if(this.inProgress&&!r)return!1;this.inProgress=!0;let n=0;const o=await this.getLastSlotForEventRequest();if(o<a)return this.inProgress=!1,!1;const c=m.getSequence(a,o,this.maxPageSize),h=[];await m.resolveSync(c.map(({from:t,to:u})=>async()=>{const S=await this.getProgramEvents(t,u);h.push(...S)}));const i=await Promise.all([...this.eventProcessors].map(t=>t(h)));return this._latestSlot=o,n+=i.reduce((t,u)=>t+u,0),this.onEventsProcessed?.(n),this.inProgress=!1,!0}catch(n){return l.Logger.error("retrieveEvents error:",n),this.inProgress=!1,!1}})}async getProgramEvents(e,r){const a=[];try{const s=await this.connection.getSignaturesForAddress(this.programId,{limit:d,before:void 0});let n=s.length;for(;n>=d;){const i=s[s.length-1],t=await this.connection.getSignaturesForAddress(this.programId,{limit:d,before:i.signature});if(t.length===0)break;s.push(...t),n=t.length}const c=s.filter(i=>i.slot>=e&&i.slot<=r).map(async i=>{try{const t=await this.connection.getTransaction(i.signature,{commitment:"confirmed",maxSupportedTransactionVersion:0});return t&&t.meta&&t.meta.logMessages?this.parseLogsForEvents(t.meta.logMessages,i.signature,i.slot,t.blockTime||null):[]}catch(t){return l.Logger.error(`Failed to get transaction ${i.signature}:`,t),[]}}),h=await Promise.all(c);a.push(...h.flat())}catch(s){l.Logger.error("Error getting program events:",s)}return a}parseLogsForEvents(e,r,a,s){if(!this.anchorParser)return[];try{return Array.from(this.anchorParser.parseLogs(e)).map(({name:o,data:c})=>({signature:r,slot:a,blockTime:s||0,programId:this.programId,data:c,eventName:o}))}catch(n){return l.Logger.error("Anchor EventParser failed; falling back to generic parsing:",n),[]}}}exports.SolanaBlockchainEventEmitter=y;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import type { Idl } from '@coral-xyz/anchor';
|
|
3
3
|
import { Mutex } from 'async-mutex';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
interface SolanaEvent {
|
|
5
|
+
signature: string;
|
|
6
|
+
slot: number;
|
|
7
|
+
blockTime: number;
|
|
8
|
+
programId: PublicKey;
|
|
9
|
+
data: any;
|
|
10
|
+
eventName: string;
|
|
11
|
+
}
|
|
12
|
+
export type SolanaEventProcessorFunction = (events: SolanaEvent[]) => Promise<number> | number;
|
|
13
|
+
export declare class SolanaBlockchainEventEmitter {
|
|
8
14
|
readonly connection: Connection;
|
|
9
15
|
readonly programId: PublicKey;
|
|
10
16
|
private _latestSlot;
|
|
@@ -14,23 +20,22 @@ export declare abstract class SolanaBlockchainEventEmitter {
|
|
|
14
20
|
private readonly maxPageSize?;
|
|
15
21
|
private isReady;
|
|
16
22
|
private isServer;
|
|
23
|
+
private intervalId?;
|
|
17
24
|
private inProgress;
|
|
18
25
|
private anchorParser?;
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
get chainId(): number;
|
|
26
|
+
private eventsFetchingMutex;
|
|
27
|
+
constructor(connection: Connection, programId: PublicKey, initialSlot: number, isServer: boolean, maxPageSize?: number, eventsFetchingMutex?: Mutex);
|
|
22
28
|
get latestBlockNumber(): number;
|
|
23
29
|
setIdl(idl: Idl): void;
|
|
24
30
|
syncFromAtMost(slot: number): void;
|
|
25
31
|
intervalClear(): void;
|
|
26
32
|
init(): Promise<void>;
|
|
27
33
|
private requireReady;
|
|
28
|
-
|
|
34
|
+
get chainId(): number;
|
|
35
|
+
addEventProcessorFunction(eventProcessorFunction: SolanaEventProcessorFunction): void;
|
|
29
36
|
private getLastSlotForEventRequest;
|
|
30
37
|
retrieveEvents(fromBlock: number, useForce?: boolean): Promise<boolean>;
|
|
31
38
|
private getProgramEvents;
|
|
32
39
|
private parseLogsForEvents;
|
|
33
|
-
protected processEvents(events: BlockchainEvent[]): Promise<void>;
|
|
34
|
-
protected abstract clear(): void;
|
|
35
|
-
protected abstract startUpdateListener(): Promise<void> | void;
|
|
36
40
|
}
|
|
41
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { BorshCoder as
|
|
2
|
-
import { getSequence as
|
|
1
|
+
import { BorshCoder as v, EventParser as p } from "@coral-xyz/anchor";
|
|
2
|
+
import { getSequence as f, resolveSync as S } from "../../../functions/utils/resolve-sync.utils.mjs";
|
|
3
|
+
import { balanceFetchingMutex as P } from "../../../functions/utils/mutexes.utils.mjs";
|
|
3
4
|
import { Logger as l } from "../../../error-handling/logger.mjs";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { networkRegistry as y, chainIds as u } from "../../../constants/chains.constants.mjs";
|
|
6
|
+
import { caseInsensitiveEqual as E } from "../../../functions/utils/caseInsensitive.utils.mjs";
|
|
7
|
+
const d = 1e3;
|
|
8
|
+
class A {
|
|
8
9
|
connection;
|
|
9
10
|
programId;
|
|
10
11
|
_latestSlot;
|
|
@@ -14,42 +15,46 @@ class _ {
|
|
|
14
15
|
maxPageSize;
|
|
15
16
|
isReady = !1;
|
|
16
17
|
isServer;
|
|
18
|
+
intervalId;
|
|
17
19
|
inProgress;
|
|
18
20
|
// to remove race conditions
|
|
19
21
|
anchorParser;
|
|
20
22
|
eventsFetchingMutex;
|
|
21
|
-
constructor(t,
|
|
22
|
-
this.
|
|
23
|
-
}
|
|
24
|
-
get chainId() {
|
|
25
|
-
return this._chainId;
|
|
23
|
+
constructor(t, r, a, s, n, o = P) {
|
|
24
|
+
this.connection = t, this.programId = r, this._initialSlot = a, this.maxPageSize = n, this.isServer = s, this.inProgress = !1, this.eventsFetchingMutex = o;
|
|
26
25
|
}
|
|
27
26
|
get latestBlockNumber() {
|
|
28
27
|
return this._latestSlot ?? this._initialSlot;
|
|
29
28
|
}
|
|
30
29
|
setIdl(t) {
|
|
31
30
|
try {
|
|
32
|
-
const
|
|
33
|
-
this.anchorParser = new
|
|
34
|
-
} catch (
|
|
35
|
-
l.error("Failed to initialize Anchor EventParser:",
|
|
31
|
+
const r = new v(t);
|
|
32
|
+
this.anchorParser = new p(this.programId, r);
|
|
33
|
+
} catch (r) {
|
|
34
|
+
l.error("Failed to initialize Anchor EventParser:", r), this.anchorParser = void 0;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
syncFromAtMost(t) {
|
|
39
38
|
(this._latestSlot === void 0 || t < this._latestSlot) && (this._latestSlot = t);
|
|
40
39
|
}
|
|
41
40
|
intervalClear() {
|
|
42
|
-
this.isReady = !1, this.eventProcessors = /* @__PURE__ */ new Set(), this.
|
|
41
|
+
this.isReady = !1, this.eventProcessors = /* @__PURE__ */ new Set(), clearInterval(this.intervalId);
|
|
43
42
|
}
|
|
44
43
|
async init() {
|
|
45
44
|
if (this.isReady)
|
|
46
45
|
throw new Error("Already initialized");
|
|
47
|
-
this.isReady = !0, await this.retrieveEvents(this.latestBlockNumber + 1),
|
|
46
|
+
this.isReady = !0, await this.retrieveEvents(this.latestBlockNumber + 1), this.intervalId = setInterval(async () => {
|
|
47
|
+
await this.retrieveEvents(this.latestBlockNumber);
|
|
48
|
+
}, 3500);
|
|
48
49
|
}
|
|
49
50
|
requireReady() {
|
|
50
51
|
if (!this.isReady)
|
|
51
52
|
throw new Error("Not ready");
|
|
52
53
|
}
|
|
54
|
+
get chainId() {
|
|
55
|
+
const t = this.connection.rpcEndpoint;
|
|
56
|
+
return E(t, y[u.solanaMainnet].fetchRpcUrl) ? u.solanaMainnet : u.solanaLocalnet;
|
|
57
|
+
}
|
|
53
58
|
addEventProcessorFunction(t) {
|
|
54
59
|
if (this.isReady)
|
|
55
60
|
throw new Error("Can't add event processor after event emitter initialized");
|
|
@@ -60,93 +65,90 @@ class _ {
|
|
|
60
65
|
return this.isServer ? Math.max(this.latestBlockNumber, t - 32 + 1) : t;
|
|
61
66
|
}
|
|
62
67
|
// Implementation for IBlockchainEventEmitter interface (blockNumber terminology)
|
|
63
|
-
async retrieveEvents(t,
|
|
68
|
+
async retrieveEvents(t, r = !1) {
|
|
64
69
|
const a = t;
|
|
65
70
|
return this.requireReady(), await this.eventsFetchingMutex.runExclusive(async () => {
|
|
66
71
|
try {
|
|
67
|
-
if (this.inProgress && !
|
|
72
|
+
if (this.inProgress && !r)
|
|
68
73
|
return !1;
|
|
69
74
|
this.inProgress = !0;
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
let n = 0;
|
|
76
|
+
const o = await this.getLastSlotForEventRequest();
|
|
77
|
+
if (o < a)
|
|
72
78
|
return this.inProgress = !1, !1;
|
|
73
|
-
const c =
|
|
74
|
-
await
|
|
75
|
-
c.map(({ from:
|
|
76
|
-
const
|
|
77
|
-
|
|
79
|
+
const c = f(a, o, this.maxPageSize), h = [];
|
|
80
|
+
await S(
|
|
81
|
+
c.map(({ from: e, to: g }) => async () => {
|
|
82
|
+
const m = await this.getProgramEvents(e, g);
|
|
83
|
+
h.push(...m);
|
|
78
84
|
})
|
|
79
85
|
);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
86
|
+
const i = await Promise.all(
|
|
87
|
+
[...this.eventProcessors].map((e) => e(h))
|
|
88
|
+
);
|
|
89
|
+
return this._latestSlot = o, n += i.reduce((e, g) => e + g, 0), this.onEventsProcessed?.(n), this.inProgress = !1, !0;
|
|
90
|
+
} catch (n) {
|
|
91
|
+
return l.error("retrieveEvents error:", n), this.inProgress = !1, !1;
|
|
84
92
|
}
|
|
85
93
|
});
|
|
86
94
|
}
|
|
87
|
-
async getProgramEvents(t,
|
|
95
|
+
async getProgramEvents(t, r) {
|
|
88
96
|
const a = [];
|
|
89
97
|
try {
|
|
90
|
-
const
|
|
91
|
-
limit:
|
|
98
|
+
const s = await this.connection.getSignaturesForAddress(this.programId, {
|
|
99
|
+
limit: d,
|
|
92
100
|
before: void 0
|
|
93
101
|
// Start from the latest
|
|
94
102
|
});
|
|
95
|
-
let
|
|
96
|
-
for (;
|
|
97
|
-
const i =
|
|
98
|
-
limit:
|
|
103
|
+
let n = s.length;
|
|
104
|
+
for (; n >= d; ) {
|
|
105
|
+
const i = s[s.length - 1], e = await this.connection.getSignaturesForAddress(this.programId, {
|
|
106
|
+
limit: d,
|
|
99
107
|
before: i.signature
|
|
100
108
|
});
|
|
101
|
-
if (
|
|
109
|
+
if (e.length === 0)
|
|
102
110
|
break;
|
|
103
|
-
|
|
111
|
+
s.push(...e), n = e.length;
|
|
104
112
|
}
|
|
105
|
-
const
|
|
113
|
+
const c = s.filter((i) => i.slot >= t && i.slot <= r).map(async (i) => {
|
|
106
114
|
try {
|
|
107
|
-
const
|
|
115
|
+
const e = await this.connection.getTransaction(i.signature, {
|
|
108
116
|
commitment: "confirmed",
|
|
109
117
|
maxSupportedTransactionVersion: 0
|
|
110
118
|
});
|
|
111
|
-
return
|
|
112
|
-
|
|
119
|
+
return e && e.meta && e.meta.logMessages ? this.parseLogsForEvents(
|
|
120
|
+
e.meta.logMessages,
|
|
113
121
|
i.signature,
|
|
114
122
|
i.slot,
|
|
115
|
-
|
|
123
|
+
e.blockTime || null
|
|
116
124
|
) : [];
|
|
117
|
-
} catch (
|
|
118
|
-
return l.error(`Failed to get transaction ${i.signature}:`,
|
|
125
|
+
} catch (e) {
|
|
126
|
+
return l.error(`Failed to get transaction ${i.signature}:`, e), [];
|
|
119
127
|
}
|
|
120
|
-
}), h = await Promise.all(
|
|
128
|
+
}), h = await Promise.all(c);
|
|
121
129
|
a.push(...h.flat());
|
|
122
|
-
} catch (
|
|
123
|
-
l.error("Error getting program events:",
|
|
130
|
+
} catch (s) {
|
|
131
|
+
l.error("Error getting program events:", s);
|
|
124
132
|
}
|
|
125
133
|
return a;
|
|
126
134
|
}
|
|
127
|
-
parseLogsForEvents(t,
|
|
135
|
+
parseLogsForEvents(t, r, a, s) {
|
|
128
136
|
if (!this.anchorParser)
|
|
129
137
|
return [];
|
|
130
138
|
try {
|
|
131
|
-
return Array.from(this.anchorParser.parseLogs(t)).map(({ name:
|
|
132
|
-
signature:
|
|
139
|
+
return Array.from(this.anchorParser.parseLogs(t)).map(({ name: o, data: c }) => ({
|
|
140
|
+
signature: r,
|
|
133
141
|
slot: a,
|
|
134
|
-
blockTime:
|
|
142
|
+
blockTime: s || 0,
|
|
135
143
|
programId: this.programId,
|
|
136
|
-
data:
|
|
137
|
-
eventName:
|
|
144
|
+
data: c,
|
|
145
|
+
eventName: o
|
|
138
146
|
}));
|
|
139
|
-
} catch (
|
|
140
|
-
return l.error("Anchor EventParser failed; falling back to generic parsing:",
|
|
147
|
+
} catch (n) {
|
|
148
|
+
return l.error("Anchor EventParser failed; falling back to generic parsing:", n), [];
|
|
141
149
|
}
|
|
142
150
|
}
|
|
143
|
-
async processEvents(t) {
|
|
144
|
-
const a = (await Promise.all(
|
|
145
|
-
[...this.eventProcessors].map((e) => e(t))
|
|
146
|
-
)).reduce((e, r) => e + r, 0);
|
|
147
|
-
this.onEventsProcessed?.(a);
|
|
148
|
-
}
|
|
149
151
|
}
|
|
150
152
|
export {
|
|
151
|
-
|
|
153
|
+
A as SolanaBlockchainEventEmitter
|
|
152
154
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../constants/presale.constants.cjs"),n=require("ethers");class o{contract;eventsFrom;constructor(t,e){const{address:r,eventsFrom:a}=s.presaleContractInfoByChain[e];this.contract=new n.ethers.Contract(r,s.presaleABI,t),this.eventsFrom=a}deposit(t,e,r){return this.contract.deposit(t.erc20TokenAddress,e,r)}withdraw(t,e){return this.contract.withdraw(t,e)}moveToNextStage(t){return this.contract.moveToNextStage(t||{})}async estimateMoveToNextStageGas(){return this.contract.moveToNextStage.estimateGas()}async getTotalDeposit(){return await this.contract.totalDeposit()}async getDeposits(t,e){return await this.contract.deposits(t,e.erc20TokenAddress)}async getTotalHINK(t){return await this.contract.totalHINK(t)}async getCurrentPresaleStageIndex(){const t=await this.contract.currentPresaleStageIndex();return Number(t)}async getCurrentMaxDepositAmount(){return await this.contract.currentMaxDepositAmount()}async currentPresaleStage(){const[t,e]=await this.contract.currentPresaleStage(),[r,a]=[t,e].map(BigInt);return{amountToRaise:r,priceMultiplier:a}}async calculateHINK(t){return await this.contract.calculateHINK(t)}async queryDeposits(){return this.contract.queryFilter(this.contract.filters.Deposit(),this.eventsFrom)}onEvent(t,e){this.contract.on(t,e)}}exports.PresaleContractWrapper=o;
|
|
@@ -3,7 +3,7 @@ import { ethers } from 'ethers';
|
|
|
3
3
|
export declare class PresaleContractWrapper {
|
|
4
4
|
contract: ethers.Contract;
|
|
5
5
|
eventsFrom: number;
|
|
6
|
-
constructor(signerOrProvider: ethers.Signer | ethers.
|
|
6
|
+
constructor(signerOrProvider: ethers.Signer | ethers.Provider, chainId: number);
|
|
7
7
|
deposit(token: ERC20Token, amount: bigint, minHINK: bigint): Promise<ethers.ContractTransaction>;
|
|
8
8
|
withdraw(token: string, amount: bigint): Promise<ethers.ContractTransaction>;
|
|
9
9
|
moveToNextStage(overrides?: ethers.Overrides): Promise<ethers.ContractTransaction>;
|
|
@@ -18,6 +18,6 @@ export declare class PresaleContractWrapper {
|
|
|
18
18
|
priceMultiplier: bigint;
|
|
19
19
|
}>;
|
|
20
20
|
calculateHINK(amount: bigint): Promise<bigint>;
|
|
21
|
-
queryDeposits(): Promise<ethers.
|
|
22
|
-
onEvent(eventName: string, handleEvent: ethers.
|
|
21
|
+
queryDeposits(): Promise<(ethers.Log | ethers.EventLog)[]>;
|
|
22
|
+
onEvent(eventName: string, handleEvent: ethers.Listener): void;
|
|
23
23
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { presaleContractInfoByChain as
|
|
2
|
-
import { ethers as
|
|
1
|
+
import { presaleContractInfoByChain as s, presaleABI as n } from "../../constants/presale.constants.mjs";
|
|
2
|
+
import { ethers as o } from "ethers";
|
|
3
3
|
class l {
|
|
4
4
|
contract;
|
|
5
5
|
eventsFrom;
|
|
6
6
|
constructor(t, e) {
|
|
7
|
-
const { address: r, eventsFrom: a } =
|
|
8
|
-
this.contract = new
|
|
7
|
+
const { address: r, eventsFrom: a } = s[e];
|
|
8
|
+
this.contract = new o.Contract(r, n, t), this.eventsFrom = a;
|
|
9
9
|
}
|
|
10
10
|
deposit(t, e, r) {
|
|
11
11
|
return this.contract.deposit(t.erc20TokenAddress, e, r);
|
|
@@ -17,30 +17,30 @@ class l {
|
|
|
17
17
|
return this.contract.moveToNextStage(t || {});
|
|
18
18
|
}
|
|
19
19
|
async estimateMoveToNextStageGas() {
|
|
20
|
-
return
|
|
20
|
+
return this.contract.moveToNextStage.estimateGas();
|
|
21
21
|
}
|
|
22
22
|
async getTotalDeposit() {
|
|
23
|
-
return
|
|
23
|
+
return await this.contract.totalDeposit();
|
|
24
24
|
}
|
|
25
25
|
async getDeposits(t, e) {
|
|
26
|
-
return
|
|
26
|
+
return await this.contract.deposits(t, e.erc20TokenAddress);
|
|
27
27
|
}
|
|
28
28
|
async getTotalHINK(t) {
|
|
29
|
-
return
|
|
29
|
+
return await this.contract.totalHINK(t);
|
|
30
30
|
}
|
|
31
31
|
async getCurrentPresaleStageIndex() {
|
|
32
32
|
const t = await this.contract.currentPresaleStageIndex();
|
|
33
33
|
return Number(t);
|
|
34
34
|
}
|
|
35
35
|
async getCurrentMaxDepositAmount() {
|
|
36
|
-
return
|
|
36
|
+
return await this.contract.currentMaxDepositAmount();
|
|
37
37
|
}
|
|
38
38
|
async currentPresaleStage() {
|
|
39
39
|
const [t, e] = await this.contract.currentPresaleStage(), [r, a] = [t, e].map(BigInt);
|
|
40
40
|
return { amountToRaise: r, priceMultiplier: a };
|
|
41
41
|
}
|
|
42
42
|
async calculateHINK(t) {
|
|
43
|
-
return
|
|
43
|
+
return await this.contract.calculateHINK(t);
|
|
44
44
|
}
|
|
45
45
|
async queryDeposits() {
|
|
46
46
|
return this.contract.queryFilter(this.contract.filters.Deposit(), this.eventsFrom);
|