@hinkal/common 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +14 -14
- package/API/API.mjs +88 -87
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.d.ts +1 -1
- package/API/admin-calls.mjs +4 -4
- package/API/ai-calls.cjs +1 -0
- package/API/ai-calls.d.ts +17 -0
- package/API/ai-calls.mjs +21 -0
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.d.ts +1 -1
- package/API/callLifiAPI.mjs +5 -5
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +1 -1
- package/API/callMonitor.mjs +7 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +11 -11
- package/API/callOkxAPI.cjs +1 -1
- package/API/callOkxAPI.d.ts +1 -1
- package/API/callOkxAPI.mjs +5 -5
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +11 -10
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +5 -6
- package/API/callRelayer.mjs +11 -11
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.d.ts +1 -1
- package/API/checkRisk.mjs +4 -4
- package/API/deposit-and-withdraw-status-calls.cjs +1 -0
- package/API/deposit-and-withdraw-status-calls.d.ts +20 -0
- package/API/deposit-and-withdraw-status-calls.mjs +18 -0
- package/API/duneAPI.cjs +1 -0
- package/API/duneAPI.d.ts +11 -0
- package/API/duneAPI.mjs +25 -0
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +4 -5
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.mjs +9 -9
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.d.ts +1 -1
- package/API/get-token-data.mjs +5 -5
- package/API/getBridgeProtocols.cjs +1 -0
- package/API/getBridgeProtocols.d.ts +7 -0
- package/API/getBridgeProtocols.mjs +8 -0
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.mjs +9 -9
- package/API/getLifiStatus.cjs +1 -0
- package/API/getLifiStatus.d.ts +24 -0
- package/API/getLifiStatus.mjs +15 -0
- package/API/getRelayerURL.cjs +1 -0
- package/API/getRelayerURL.d.ts +1 -0
- package/API/getRelayerURL.mjs +10 -0
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -3
- package/API/getServerURL.mjs +67 -51
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +0 -5
- package/API/getTokenPrice.mjs +7 -14
- package/API/index.d.ts +3 -1
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.d.ts +1 -1
- package/API/is-tx-stateless.mjs +12 -10
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +8 -4
- package/API/kycCalls.mjs +26 -23
- package/API/passwordCalls.cjs +1 -0
- package/API/passwordCalls.d.ts +9 -0
- package/API/passwordCalls.mjs +13 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +2 -7
- package/API/proxyAccountsCalls.mjs +21 -27
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +4 -4
- package/API/restoreSnapshots.cjs +1 -0
- package/API/restoreSnapshots.d.ts +1 -0
- package/API/restoreSnapshots.mjs +10 -0
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +9 -1
- package/API/scheduled-transactions-calls.mjs +9 -5
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.d.ts +2 -2
- package/API/simulate-batch-tx.mjs +6 -7
- package/API/solana-calls.cjs +1 -1
- package/API/solana-calls.d.ts +3 -6
- package/API/solana-calls.mjs +15 -15
- package/API/temporaryWalletCalls.cjs +1 -1
- package/API/temporaryWalletCalls.mjs +19 -13
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +5 -6
- package/README.md +54 -42
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +6 -0
- package/constants/chains.constants.mjs +52 -58
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +0 -1
- package/constants/coingecko.constants.mjs +10 -11
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +2 -28
- package/constants/function-signatures.constants.cjs +1 -1
- package/constants/function-signatures.constants.d.ts +1 -0
- package/constants/function-signatures.constants.mjs +4 -3
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +40 -39
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +0 -1
- package/constants/mediaUrls.constants.mjs +1 -2
- package/constants/permit2.constants.cjs +1 -1
- package/constants/permit2.constants.d.ts +1 -0
- package/constants/permit2.constants.mjs +11 -10
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +123 -19
- package/constants/server.constants.mjs +142 -38
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +13 -36
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +71 -68
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +56 -45
- package/data-structures/Hinkal/Hinkal.mjs +348 -314
- package/data-structures/Hinkal/IHinkal.d.ts +54 -40
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +49 -48
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +7 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +42 -0
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +24 -29
- package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
- package/data-structures/Hinkal/hinkalApprove.d.ts +3 -0
- package/data-structures/Hinkal/hinkalApprove.mjs +114 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +20 -20
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +84 -88
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +96 -77
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +80 -75
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +150 -138
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +5 -4
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +4 -0
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +119 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +118 -114
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +34 -36
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -40
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +32 -37
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +15 -17
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +3 -4
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +95 -84
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +182 -155
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +3 -2
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +40 -43
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +67 -71
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -63
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +45 -48
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +48 -49
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +68 -71
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +78 -71
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +70 -71
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +79 -81
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +103 -105
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +53 -107
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +0 -1
- package/data-structures/IndexedDB/activity-db.mjs +75 -91
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +37 -40
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +13 -16
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +40 -25
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +84 -82
- package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
- package/data-structures/TokenDBs/token-visibility-db.mjs +36 -22
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +11 -0
- package/data-structures/crypto-keys/keys.mjs +107 -47
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +2 -4
- package/data-structures/event-service/evm/AbstractEventService.mjs +19 -19
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +5 -6
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +2 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.mjs +4 -3
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +5 -10
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +35 -39
- package/data-structures/event-service/index.d.ts +0 -4
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +3 -4
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +10 -4
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +7 -10
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +2 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +2 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +16 -11
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +66 -64
- package/data-structures/index.d.ts +0 -3
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +13 -8
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +4 -5
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +4 -6
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +0 -1
- package/error-handling/error-codes.constants.mjs +3 -4
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +27 -21
- package/error-handling/handleErrorRestore.cjs +1 -0
- package/error-handling/handleErrorRestore.d.ts +2 -0
- package/error-handling/handleErrorRestore.mjs +11 -0
- package/error-handling/index.d.ts +1 -0
- package/functions/kyc/authentoHelper.cjs +1 -0
- package/functions/kyc/authentoHelper.d.ts +12 -0
- package/functions/kyc/authentoHelper.mjs +30 -0
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.mjs +17 -18
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -2
- package/functions/pre-transaction/constructAdminData.mjs +18 -12
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +2 -1
- package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +36 -21
- package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +9 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +34 -19
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +50 -53
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +6 -3
- package/functions/private-wallet/emporium.helpers.mjs +127 -89
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +4 -1
- package/functions/private-wallet/emporium.swap.helpers.mjs +102 -100
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.mjs +49 -49
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +20 -18
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +10 -11
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +0 -1
- package/functions/utils/addresses.mjs +12 -13
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +1 -1
- package/functions/utils/create-provider.mjs +9 -13
- package/functions/utils/get-hinkal-approvals.cjs +1 -0
- package/functions/utils/get-hinkal-approvals.d.ts +3 -0
- package/functions/utils/get-hinkal-approvals.mjs +38 -0
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +11 -11
- package/functions/utils/index.d.ts +1 -0
- package/functions/utils/involves-permit2-op.cjs +1 -1
- package/functions/utils/involves-permit2-op.d.ts +1 -0
- package/functions/utils/involves-permit2-op.mjs +6 -4
- package/functions/utils/mutexes.utils.cjs +1 -1
- package/functions/utils/mutexes.utils.d.ts +1 -1
- package/functions/utils/mutexes.utils.mjs +3 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +23 -8
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +13 -6
- package/functions/utils/prepareHinkal.mjs +72 -45
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.mjs +54 -49
- package/functions/utils/replaceAddressInCalldata.cjs +1 -0
- package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
- package/functions/utils/replaceAddressInCalldata.mjs +7 -0
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +0 -1
- package/functions/utils/string.utils.mjs +14 -18
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +0 -3
- package/functions/utils/token-check.utils.mjs +7 -18
- package/functions/utils/upToDateState.cjs +1 -1
- package/functions/utils/upToDateState.d.ts +1 -1
- package/functions/utils/upToDateState.mjs +4 -4
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +17 -2
- package/functions/utils/walletBalances.utils.mjs +36 -5
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.d.ts +4 -3
- package/functions/web3/events/getApprovedBalance.mjs +44 -39
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -3
- package/functions/web3/events/getInputUtxoAndBalance.mjs +150 -129
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +75 -73
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.mjs +38 -38
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +10 -13
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +6 -1
- package/functions/web3/functionCalls/accessTokenCalls.mjs +21 -12
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +46 -50
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -1
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +32 -0
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +40 -36
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +3 -3
- package/functions/web3/functionCalls/transactCallRelayer.mjs +54 -54
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +22 -17
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +6 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +27 -27
- package/functions/web3/index.d.ts +0 -1
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.d.ts +1 -1
- package/functions/web3/lifiAPI.mjs +12 -12
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +19 -6
- package/functions/web3/okxAPI.cjs +1 -1
- package/functions/web3/okxAPI.mjs +13 -13
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +20 -7
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +56 -38
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +34 -22
- package/index.cjs +1 -1
- package/index.mjs +922 -920
- package/package.json +2 -3
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +17 -10
- package/providers/EthersProviderAdapter.mjs +76 -45
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +11 -7
- package/providers/SolanaProviderAdapter.mjs +31 -16
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +17 -11
- package/providers/WagmiProviderAdapter.mjs +117 -86
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +9 -14
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +9 -15
- package/types/TransactionSimulator.types.d.ts +9 -2
- package/types/activities.types.d.ts +0 -2
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +6 -0
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +1 -0
- package/types/bridging.types.d.ts +29 -0
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +3 -6
- package/types/cache.types.mjs +1 -1
- package/types/coingecko.types.d.ts +0 -5
- package/types/duneAPI.types.d.ts +9 -0
- package/types/ethereum-network.types.d.ts +0 -1
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +1 -1
- package/types/hinkal.types.mjs +18 -18
- package/types/index.d.ts +2 -2
- package/types/proxy.types.d.ts +3 -6
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +39 -10
- package/types/sandbox.types.mjs +2 -2
- package/types/scheduled-transactions.types.cjs +1 -1
- package/types/scheduled-transactions.types.d.ts +6 -0
- package/types/scheduled-transactions.types.mjs +3 -2
- package/types/session.types.d.ts +0 -2
- package/types/solana.types.d.ts +0 -9
- package/types/token-prices.types.cjs +1 -1
- package/types/token-prices.types.d.ts +0 -7
- package/types/token-prices.types.mjs +2 -4
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/API/get-token-price-chart-data.cjs +0 -1
- package/API/get-token-price-chart-data.d.ts +0 -16
- package/API/get-token-price-chart-data.mjs +0 -13
- package/API/onrampCalls.cjs +0 -1
- package/API/onrampCalls.d.ts +0 -20
- package/API/onrampCalls.mjs +0 -15
- package/API/unspent-utxos-calls.cjs +0 -1
- package/API/unspent-utxos-calls.d.ts +0 -26
- package/API/unspent-utxos-calls.mjs +0 -26
- package/data-structures/AccountActions/AccountActions.cjs +0 -1
- package/data-structures/AccountActions/AccountActions.d.ts +0 -18
- package/data-structures/AccountActions/AccountActions.mjs +0 -78
- package/data-structures/AccountActions/index.d.ts +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.cjs +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +0 -14
- package/data-structures/BlockchainEvent/BlockchainEvent.mjs +0 -41
- package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +0 -1
- package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +0 -20
- package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +0 -124
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +0 -1
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +0 -15
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +0 -64
- package/data-structures/PublicBalance/index.d.ts +0 -2
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +0 -21
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +0 -16
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/ClientEventHelper.d.ts +0 -11
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +0 -26
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +0 -5
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +0 -14
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +0 -22
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +0 -16
- package/functions/utils/enum.utils.cjs +0 -1
- package/functions/utils/enum.utils.mjs +0 -14
- package/functions/utils/socket.utils.cjs +0 -1
- package/functions/utils/socket.utils.d.ts +0 -1
- package/functions/utils/socket.utils.mjs +0 -12
- package/functions/web3/crypto.cjs +0 -1
- package/functions/web3/crypto.d.ts +0 -1
- package/functions/web3/crypto.mjs +0 -7
- package/types/events.types.cjs +0 -1
- package/types/events.types.d.ts +0 -9
- package/types/events.types.mjs +0 -5
- package/types/onramp.types.cjs +0 -1
- package/types/onramp.types.d.ts +0 -58
- package/types/onramp.types.mjs +0 -4
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
import { Utxo as da } from "../../data-structures/utxo/Utxo.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { UserKeys as la } from "../../data-structures/crypto-keys/keys.mjs";
|
|
3
|
+
import { zeroAddress as A, defaultSignatureData as sa } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
import { chainIds as ca } from "../../constants/chains.constants.mjs";
|
|
5
|
+
import { ZKProofWorkerActionType as pa } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
6
|
+
import { performTaskWithWorker as fa } from "../../webworker/performTaskWithWorker.mjs";
|
|
7
|
+
import { WorkerVariant as Sa } from "../../webworker/worker.registry.mjs";
|
|
8
|
+
import { calcAmountChanges as D, calcEncryptedOutputs as ga, buildOutCommitments as Aa, calcPublicSignalCount as ha, getSlippageValues as Ha, createCallDataHash as wa, calcStealthAddressStructure as Ma } from "./common.snarkjs.mjs";
|
|
8
9
|
import { randomBigInt as _ } from "../web3/etherFunctions.mjs";
|
|
9
|
-
import { encodeEmporiumMetadata as
|
|
10
|
-
import { ExternalActionId as
|
|
11
|
-
import { defaultHookData as
|
|
12
|
-
import { generateCircomData as
|
|
13
|
-
import { generateZkProof as
|
|
10
|
+
import { encodeEmporiumMetadata as Ca, getAuthorizationDataIfNeeded as Da } from "../private-wallet/emporium.helpers.mjs";
|
|
11
|
+
import { ExternalActionId as Ta } from "../../types/external-action.types.mjs";
|
|
12
|
+
import { defaultHookData as ka } from "../../types/circom-data.types.mjs";
|
|
13
|
+
import { generateCircomData as za } from "./generateCircomData.mjs";
|
|
14
|
+
import { generateZkProof as Wa } from "./generateZkProof.mjs";
|
|
14
15
|
import { getCurrentTimeInSeconds as q } from "../utils/time.utils.mjs";
|
|
15
|
-
import { defaultHinkalLogicArgs as
|
|
16
|
-
import { generateFeeStructure as
|
|
17
|
-
import { hinkalCheckTokenRegistry as
|
|
16
|
+
import { defaultHinkalLogicArgs as ba } from "../../types/hinkal.types.mjs";
|
|
17
|
+
import { generateFeeStructure as Ea } from "../utils/fees.utils.mjs";
|
|
18
|
+
import { hinkalCheckTokenRegistry as ya, createHinkalHelperFromData as Ia } from "../../data-structures/Hinkal/hinkalCheckTokenRegistry.mjs";
|
|
18
19
|
import { poseidonFunction as Na } from "../../crypto/poseidon.mjs";
|
|
19
20
|
import "circomlibjs-hinkal-fork";
|
|
20
21
|
import "libsodium-wrappers";
|
|
21
22
|
import "process";
|
|
22
23
|
import "buffer";
|
|
23
24
|
import { getMerkleTreeSiblingsAndRootHashes as Pa } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
K ?? Ia(o),
|
|
25
|
+
const mt = async (i, j, G, l, h, t, a, d, T, J, k, K, Q, z = A, o = ca.localhost, s = t.map(() => !1), H = t.map(() => 0n), c, r = void 0, X = !1, p, f = void 0, Y, W = sa, L, V = !0) => {
|
|
26
|
+
const b = D(t, a), w = ga(a), S = d.getShieldedPrivateKey(), E = da.findCorrectRandomization(_(31), S), x = await ya(
|
|
27
|
+
Y ?? Ia(o),
|
|
28
28
|
l,
|
|
29
29
|
D(t, a, !0)
|
|
30
|
-
),
|
|
30
|
+
), y = t.map((e) => e.map((n) => n.getConstructableParams())), {
|
|
31
31
|
inCommitmentSiblings: U,
|
|
32
32
|
inCommitmentSiblingSides: aa,
|
|
33
|
-
accessTokenSiblings:
|
|
34
|
-
accessTokenSiblingSides:
|
|
35
|
-
rootHashHinkal:
|
|
33
|
+
accessTokenSiblings: I,
|
|
34
|
+
accessTokenSiblingSides: N,
|
|
35
|
+
rootHashHinkal: P,
|
|
36
36
|
rootHashAccessToken: M
|
|
37
37
|
} = await Pa(
|
|
38
38
|
o,
|
|
39
39
|
d,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
y,
|
|
41
|
+
X,
|
|
42
42
|
x,
|
|
43
43
|
j,
|
|
44
44
|
G,
|
|
45
45
|
V
|
|
46
|
-
),
|
|
47
|
-
type:
|
|
46
|
+
), R = await fa({
|
|
47
|
+
type: Sa.ZKProof,
|
|
48
48
|
payload: {
|
|
49
|
-
type:
|
|
50
|
-
data: { inputUtxosSerialized:
|
|
49
|
+
type: pa.BUILD_IN_NULLIFIERS,
|
|
50
|
+
data: { inputUtxosSerialized: y, onChainCreation: s, proverVersion: i }
|
|
51
51
|
}
|
|
52
|
-
}), F =
|
|
53
|
-
rootHashHinkal:
|
|
52
|
+
}), F = Aa(i, a, s), C = L ?? _(31), ta = Na(C), m = {
|
|
53
|
+
rootHashHinkal: P,
|
|
54
54
|
erc20TokenAddresses: l,
|
|
55
55
|
tokenIds: h,
|
|
56
|
-
inNullifiers:
|
|
56
|
+
inNullifiers: R,
|
|
57
57
|
outTimeStamp: a.length > 0 ? BigInt(a[0][0].timeStamp) : q(),
|
|
58
58
|
extraRandomization: E,
|
|
59
59
|
amountChanges: b,
|
|
@@ -61,8 +61,8 @@ const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost
|
|
|
61
61
|
rootHashAccessToken: M,
|
|
62
62
|
calldataHash: 0n,
|
|
63
63
|
shieldedPrivateKey: S,
|
|
64
|
-
accessTokenSiblings:
|
|
65
|
-
accessTokenSiblingSides:
|
|
64
|
+
accessTokenSiblings: I,
|
|
65
|
+
accessTokenSiblingSides: N,
|
|
66
66
|
outAmounts: a.map((e) => e.map((n) => n.amount)),
|
|
67
67
|
outPublicKeys: a.map((e) => e.map((n) => n.getStealthAddress())),
|
|
68
68
|
inAmounts: t.map((e) => e.map((n) => n.amount.toString())),
|
|
@@ -71,14 +71,14 @@ const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost
|
|
|
71
71
|
inCommitmentSiblings: U,
|
|
72
72
|
inCommitmentSiblingSides: aa,
|
|
73
73
|
messageSeed: C
|
|
74
|
-
}, ea = c ?
|
|
74
|
+
}, ea = c ? la.getSignerAddressFromPrivateKey(o, c) : void 0, B = k, u = Ta.Emporium, v = await Ca(
|
|
75
75
|
o,
|
|
76
76
|
k,
|
|
77
77
|
c,
|
|
78
|
-
|
|
78
|
+
K,
|
|
79
79
|
ta,
|
|
80
80
|
ea
|
|
81
|
-
), g = a.length === 0 ? "swapperMWMin0" : `swapperMW${T}x${J}x${a[0].length}`, O =
|
|
81
|
+
), g = a.length === 0 ? "swapperMWMin0" : `swapperMW${T}x${J}x${a[0].length}`, O = ha(
|
|
82
82
|
g,
|
|
83
83
|
m.erc20TokenAddresses,
|
|
84
84
|
m.amountChanges,
|
|
@@ -86,19 +86,19 @@ const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost
|
|
|
86
86
|
m.outCommitments,
|
|
87
87
|
h.length
|
|
88
88
|
);
|
|
89
|
-
if (r || (r =
|
|
89
|
+
if (r || (r = ba(b.length, d), r.interactionAddress = "0x032f580aFFE7a5f17025fAF83c13B4277A880532", r.inHinkalAddress = d.getInHinkalAddress(r.interactionAddress)), i === "v1x1") {
|
|
90
90
|
if (m.interactionAddress = r.interactionAddress, d.getInHinkalAddress(m.interactionAddress) !== r.inHinkalAddress)
|
|
91
91
|
throw new Error("inHinkalAddress mismatch");
|
|
92
92
|
m.externalApprovalAddresses = r?.useApprovalUtxoData?.map(({ externalApprovalAddresses: e }) => e) ?? Array(T).fill([A, A, A]);
|
|
93
93
|
}
|
|
94
|
-
f || (f =
|
|
94
|
+
f || (f = Ea(H, l));
|
|
95
95
|
const Z = D(t, a, !0);
|
|
96
|
-
p || (p =
|
|
96
|
+
p || (p = Ha(Z, r)), m.calldataHash = wa(
|
|
97
97
|
i,
|
|
98
98
|
O,
|
|
99
99
|
z,
|
|
100
|
-
u,
|
|
101
100
|
B,
|
|
101
|
+
u,
|
|
102
102
|
v,
|
|
103
103
|
w,
|
|
104
104
|
H,
|
|
@@ -114,20 +114,20 @@ const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost
|
|
|
114
114
|
rootHashAccessToken: M,
|
|
115
115
|
calldataHash: m.calldataHash,
|
|
116
116
|
shieldedPrivateKey: S,
|
|
117
|
-
accessTokenSiblings:
|
|
118
|
-
accessTokenSiblingSides:
|
|
117
|
+
accessTokenSiblings: I,
|
|
118
|
+
accessTokenSiblingSides: N,
|
|
119
119
|
messageSeed: C
|
|
120
|
-
}, { zkCallData: ma } = await
|
|
120
|
+
}, { zkCallData: ma } = await Wa(
|
|
121
121
|
i,
|
|
122
122
|
o,
|
|
123
123
|
g,
|
|
124
124
|
g === "swapperMWMin0" ? $ : m,
|
|
125
|
-
|
|
126
|
-
), ra =
|
|
125
|
+
Q
|
|
126
|
+
), ra = Ma(E, S), na = await za(
|
|
127
127
|
i,
|
|
128
128
|
F,
|
|
129
|
-
y,
|
|
130
129
|
R,
|
|
130
|
+
P,
|
|
131
131
|
M,
|
|
132
132
|
Z,
|
|
133
133
|
l,
|
|
@@ -136,15 +136,15 @@ const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost
|
|
|
136
136
|
w,
|
|
137
137
|
H,
|
|
138
138
|
O,
|
|
139
|
-
B,
|
|
140
139
|
u,
|
|
140
|
+
B,
|
|
141
141
|
v,
|
|
142
142
|
z,
|
|
143
143
|
m.calldataHash,
|
|
144
144
|
h,
|
|
145
145
|
ra,
|
|
146
146
|
s,
|
|
147
|
-
|
|
147
|
+
ka,
|
|
148
148
|
g === "swapperMWMin0" ? $.outTimeStamp : m.outTimeStamp,
|
|
149
149
|
// although these variables seem to contain the same value, there can actually be a single second difference if the timing is unlucky
|
|
150
150
|
r,
|
|
@@ -155,7 +155,7 @@ const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost
|
|
|
155
155
|
tokenNumber: t.length,
|
|
156
156
|
nullifierAmount: t.length > 0 ? t[0].length : 0,
|
|
157
157
|
outputAmount: a.length > 0 ? a[0].length : 0
|
|
158
|
-
}, oa = await
|
|
158
|
+
}, oa = await Da(
|
|
159
159
|
o,
|
|
160
160
|
c
|
|
161
161
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../../data-structures/crypto-keys/keys.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../../data-structures/crypto-keys/keys.cjs");const te=require("../../constants/chains.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/token-data/index.cjs");require("../../API/getServerURL.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");const i=require("@solana/web3.js"),o=require("../pre-transaction/solana.cjs");require("@solana/spl-token");const ne=require("../utils/solanaMint.utils.cjs"),ae=require("./common.snarkjs.cjs"),oe=require("../../data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.cjs"),ie=require("./generateZkProof.cjs"),ce=require("../../webworker/worker.registry.cjs"),se=require("../../webworker/performTaskWithWorker.cjs"),me=require("../../webworker/zkProofWorker/zkProofWorker.types.cjs"),ue=require("../pre-transaction/getSolanaCalldataHash.cjs"),le=require("./getMerkleTreeSiblingsAndRootHashes.cjs"),pe=async(g,k,S,d,c,f,s,t,n,P,b,h,y,T,a,A,m=te.chainIds.solanaLocalnet,C=!1,B=t.map(()=>!1),I=0n,w=[],K=[],H=!0)=>{const u="v1x1",_=new i.PublicKey(y),R=new i.PublicKey(T),W=c.getShieldedPrivateKey(),l=s.map(e=>ne.formatMintAddress(e)),Z=l.map(e=>e.mintAccountPart1),v=l.map(e=>e.mintAccountPart2),z=ue.getSolanaCalldataHash(a,_,R,A,b,h,w,K),M=`${a.tokenNumber}x${a.nullifierAmount}x${a.outputAmount}`,p=ae.calcAmountChanges(t,n),L=await oe.hinkalCheckSolanaTokenRegistry(f,new i.PublicKey(k),s,p),q=t.map(e=>e.map(r=>r.getConstructableParams())),{inCommitmentSiblings:N,inCommitmentSiblingSides:$,accessTokenSiblings:j,accessTokenSiblingSides:D,rootHashHinkal:V,rootHashAccessToken:E}=await le.getMerkleTreeSiblingsAndRootHashes(m,c,q,C,L,S,d,H),F=await se.performTaskWithWorker({type:ce.WorkerVariant.ZKProof,payload:{type:me.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:q,onChainCreation:B,proverVersion:u}}}),O={rootHashHinkal:V,shieldedPrivateKey:W,rootHashAccessToken:E,accessTokenSiblings:j,accessTokenSiblingSides:D,mintAccountPart1:Z,mintAccountPart2:v,inAmounts:t.map(e=>e.map(r=>r.amount)),inTimeStamps:t.map(e=>e.map(r=>r.timeStamp)),inRandomizations:t.map(e=>e.map(r=>r.randomization)),inNullifiers:F,inCommitmentSiblings:N,inCommitmentSiblingSides:$,outAmounts:n.map(e=>e.map(r=>r.amount.toString())),outTimeStamp:BigInt(n[0][0].timeStamp),outPublicKeys:n.map(e=>e.map(r=>r.getStealthAddress())),extraRandomization:P,amountChanges:p,outCommitments:n.map(e=>e.map(r=>r.amount===0n?0n:r.getCommitment())),calldataHash:z,swapperAccountSalt:I},{publicSignals:G,zkCallData:J}=await ie.generateZkProof(u,m,`basicSolana${M}`,O,g),[Q,X,Y]=J,x=Q.map(BigInt).map(o.encodeToByte32Array).flat(),U=X.flat().map(BigInt).map(o.encodeToByte32Array).flat(),ee=Y.map(BigInt).map(o.encodeToByte32Array).flat(),re=G.map(BigInt).map(o.encodeToByte32Array);return{proofAArr:x,proofBArr:U,proofCArr:ee,publicInputsArr:re}};exports.constructSolanaZkProof=pe;
|
|
@@ -7,21 +7,23 @@ import "../../error-handling/error-codes.constants.mjs";
|
|
|
7
7
|
import "../../data-structures/crypto-keys/keys.mjs";
|
|
8
8
|
import { chainIds as mt } from "../../constants/chains.constants.mjs";
|
|
9
9
|
import "../../constants/server.constants.mjs";
|
|
10
|
-
import "../../
|
|
10
|
+
import "../../constants/vite.constants.mjs";
|
|
11
11
|
import "../../data-structures/http/HttpClient.mjs";
|
|
12
12
|
import "axios";
|
|
13
|
-
import "../../constants/vite.constants.mjs";
|
|
14
13
|
import "../../constants/token-data/index.mjs";
|
|
14
|
+
import "../../API/getServerURL.mjs";
|
|
15
|
+
import "libsodium-wrappers";
|
|
16
|
+
import "process";
|
|
17
|
+
import "buffer";
|
|
18
|
+
import "../../constants/save-depths.mjs";
|
|
19
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
20
|
+
import "../utils/mutexes.utils.mjs";
|
|
21
|
+
import "@coral-xyz/anchor";
|
|
15
22
|
import { PublicKey as r } from "@solana/web3.js";
|
|
16
23
|
import { encodeToByte32Array as n } from "../pre-transaction/solana.mjs";
|
|
17
24
|
import "@solana/spl-token";
|
|
18
|
-
import "
|
|
19
|
-
import "
|
|
20
|
-
import "bs58";
|
|
21
|
-
import "@coral-xyz/anchor";
|
|
22
|
-
import "buffer";
|
|
23
|
-
import { formatMintAddress as at } from "../utils/solanaMint.utils.mjs";
|
|
24
|
-
import { calcAmountChanges as it } from "./common.snarkjs.mjs";
|
|
25
|
+
import { formatMintAddress as it } from "../utils/solanaMint.utils.mjs";
|
|
26
|
+
import { calcAmountChanges as at } from "./common.snarkjs.mjs";
|
|
25
27
|
import { hinkalCheckSolanaTokenRegistry as nt } from "../../data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.mjs";
|
|
26
28
|
import { generateZkProof as rt } from "./generateZkProof.mjs";
|
|
27
29
|
import { WorkerVariant as et } from "../../webworker/worker.registry.mjs";
|
|
@@ -29,9 +31,9 @@ import { performTaskWithWorker as pt } from "../../webworker/performTaskWithWork
|
|
|
29
31
|
import { ZKProofWorkerActionType as ct } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
30
32
|
import { getSolanaCalldataHash as st } from "../pre-transaction/getSolanaCalldataHash.mjs";
|
|
31
33
|
import { getMerkleTreeSiblingsAndRootHashes as lt } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
|
|
32
|
-
const
|
|
33
|
-
const s = "v1x1", v = new r(C), z = new r(I), L = e.getShieldedPrivateKey(), l = p.map((t) =>
|
|
34
|
-
|
|
34
|
+
const jt = async (u, S, k, d, e, P, p, m, i, b, h, A, C, I, a, T, c = mt.solanaLocalnet, B = !1, w = m.map(() => !1), K = 0n, H = [], y = [], R = !0) => {
|
|
35
|
+
const s = "v1x1", v = new r(C), z = new r(I), L = e.getShieldedPrivateKey(), l = p.map((t) => it(t)), N = l.map((t) => t.mintAccountPart1), W = l.map((t) => t.mintAccountPart2), Z = st(
|
|
36
|
+
a,
|
|
35
37
|
v,
|
|
36
38
|
z,
|
|
37
39
|
T,
|
|
@@ -39,7 +41,7 @@ const Et = async (u, S, k, d, e, P, p, m, a, b, h, A, C, I, i, T, c = mt.solanaL
|
|
|
39
41
|
A,
|
|
40
42
|
H,
|
|
41
43
|
y
|
|
42
|
-
), $ = `${
|
|
44
|
+
), $ = `${a.tokenNumber}x${a.nullifierAmount}x${a.outputAmount}`, f = at(m, i), D = await nt(
|
|
43
45
|
P,
|
|
44
46
|
new r(S),
|
|
45
47
|
p,
|
|
@@ -80,12 +82,12 @@ const Et = async (u, S, k, d, e, P, p, m, a, b, h, A, C, I, i, T, c = mt.solanaL
|
|
|
80
82
|
inNullifiers: j,
|
|
81
83
|
inCommitmentSiblings: M,
|
|
82
84
|
inCommitmentSiblingSides: V,
|
|
83
|
-
outAmounts:
|
|
84
|
-
outTimeStamp: BigInt(
|
|
85
|
-
outPublicKeys:
|
|
85
|
+
outAmounts: i.map((t) => t.map((o) => o.amount.toString())),
|
|
86
|
+
outTimeStamp: BigInt(i[0][0].timeStamp),
|
|
87
|
+
outPublicKeys: i.map((t) => t.map((o) => o.getStealthAddress())),
|
|
86
88
|
extraRandomization: b,
|
|
87
89
|
amountChanges: f,
|
|
88
|
-
outCommitments:
|
|
90
|
+
outCommitments: i.map(
|
|
89
91
|
(t) => t.map((o) => o.amount === 0n ? 0n : o.getCommitment())
|
|
90
92
|
),
|
|
91
93
|
calldataHash: Z,
|
|
@@ -100,5 +102,5 @@ const Et = async (u, S, k, d, e, P, p, m, a, b, h, A, C, I, i, T, c = mt.solanaL
|
|
|
100
102
|
return { proofAArr: x, proofBArr: U, proofCArr: tt, publicInputsArr: ot };
|
|
101
103
|
};
|
|
102
104
|
export {
|
|
103
|
-
|
|
105
|
+
jt as constructSolanaZkProof
|
|
104
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../API/getServerURL.cjs"),a=require("../../constants/server.constants.cjs"),l=require("../../data-structures/http/HttpClient.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../API/getServerURL.cjs"),a=require("../../constants/server.constants.cjs"),l=require("../../data-structures/http/HttpClient.cjs"),c=async(t,r,n)=>{const i=r.map(s=>s.map(e=>({...e,amount:e.amount.toString(),randomization:e.randomization?.toString()})));return await l.httpClient.post(`${o.getSnapshotServerURL(t)}${a.API_CONFIG.ROUTES.getMerkleTreeSiblings}`,{inputUtxosSerialized:i,accessKey:n})};exports.fetchMerkleTreeSiblings=c;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSnapshotServerURL as s } from "../../API/getServerURL.mjs";
|
|
2
2
|
import { API_CONFIG as a } from "../../constants/server.constants.mjs";
|
|
3
|
-
import { httpClient as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
(
|
|
3
|
+
import { httpClient as p } from "../../data-structures/http/HttpClient.mjs";
|
|
4
|
+
const c = async (e, r, o) => {
|
|
5
|
+
const n = r.map(
|
|
6
|
+
(i) => i.map((t) => ({
|
|
7
7
|
...t,
|
|
8
8
|
amount: t.amount.toString(),
|
|
9
9
|
randomization: t.randomization?.toString()
|
|
10
10
|
}))
|
|
11
11
|
);
|
|
12
|
-
return await
|
|
13
|
-
`${s}${a.ROUTES.getMerkleTreeSiblings}`,
|
|
12
|
+
return await p.post(
|
|
13
|
+
`${s(e)}${a.ROUTES.getMerkleTreeSiblings}`,
|
|
14
14
|
{
|
|
15
|
-
inputUtxosSerialized:
|
|
16
|
-
accessKey:
|
|
17
|
-
chainId: e
|
|
15
|
+
inputUtxosSerialized: n,
|
|
16
|
+
accessKey: o
|
|
18
17
|
}
|
|
19
18
|
);
|
|
20
19
|
};
|
|
21
20
|
export {
|
|
22
|
-
|
|
21
|
+
c as fetchMerkleTreeSiblings
|
|
23
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),u=require("@solana/web3.js"),h=t=>{const[r,e,s,n,o]=t.split(","),c=!r||!e||!s||!n||!o,a=e?.substring(0,2)!=="0x"||s?.substring(0,2)!=="0x",d=s?.length!==66||e?.length>66||e?.length<64,l=t?.includes('"');return!(c||a||d||l)},g=t=>{const[r,e,,s,n]=t.split(",");return{extraRandomization:BigInt(r),stealthAddress:BigInt(e),H0:BigInt(s),H1:BigInt(n)}},b=t=>i.ethers.utils.keccak256(i.ethers.utils.toUtf8Bytes(t.toLowerCase())),y=t=>{try{return new u.PublicKey(t).toBase58()===t}catch{return!1}};exports.constructStealthAddressStructure=g;exports.hashEthereumAddress=b;exports.isValidPrivateAddress=h;exports.isValidSolanaPublicKey=y;
|
|
@@ -3,4 +3,3 @@ export declare const isValidPrivateAddress: (address: string) => boolean;
|
|
|
3
3
|
export declare const constructStealthAddressStructure: (recipientInfo: string) => StealthAddressStructure;
|
|
4
4
|
export declare const hashEthereumAddress: (ethereumAddress: string) => string;
|
|
5
5
|
export declare const isValidSolanaPublicKey: (str: string) => boolean;
|
|
6
|
-
export declare const formatAddress: (address?: string) => string;
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { ethers as
|
|
2
|
-
import { PublicKey as
|
|
1
|
+
import { ethers as o } from "ethers";
|
|
2
|
+
import { PublicKey as u } from "@solana/web3.js";
|
|
3
3
|
const m = (t) => {
|
|
4
|
-
const [
|
|
5
|
-
return !(c ||
|
|
4
|
+
const [n, s, e, r, i] = t.split(","), c = !n || !s || !e || !r || !i, a = s?.substring(0, 2) !== "0x" || e?.substring(0, 2) !== "0x", l = e?.length !== 66 || s?.length > 66 || s?.length < 64, d = t?.includes('"');
|
|
5
|
+
return !(c || a || l || d);
|
|
6
6
|
}, y = (t) => {
|
|
7
|
-
const [
|
|
7
|
+
const [n, s, , e, r] = t.split(",");
|
|
8
8
|
return {
|
|
9
|
-
extraRandomization: BigInt(
|
|
10
|
-
stealthAddress: BigInt(
|
|
11
|
-
H0: BigInt(
|
|
12
|
-
H1: BigInt(
|
|
9
|
+
extraRandomization: BigInt(n),
|
|
10
|
+
stealthAddress: BigInt(s),
|
|
11
|
+
H0: BigInt(e),
|
|
12
|
+
H1: BigInt(r)
|
|
13
13
|
};
|
|
14
|
-
}, b = (t) =>
|
|
14
|
+
}, b = (t) => o.utils.keccak256(o.utils.toUtf8Bytes(t.toLowerCase())), p = (t) => {
|
|
15
15
|
try {
|
|
16
|
-
return new
|
|
16
|
+
return new u(t).toBase58() === t;
|
|
17
17
|
} catch {
|
|
18
18
|
return !1;
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
export {
|
|
22
22
|
y as constructStealthAddressStructure,
|
|
23
|
-
A as formatAddress,
|
|
24
23
|
b as hashEthereumAddress,
|
|
25
24
|
m as isValidPrivateAddress,
|
|
26
25
|
p as isValidSolanaPublicKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../../types/ethereum-network.types.cjs"),y=require("./getDataFromTransaction.cjs"),A=require("idb-keyval"),T=require("../../constants/chains.constants.cjs"),C={encryptedOutputs:[],lastOutput:""},o=(s,t)=>{const e=s.substring(0,25),r=t.substring(0,25);return{shortPublicKey:e,shortHinkalAddress:r}},k=(s,t,e)=>`hinkalCache-${s}-${t}-${e}`,D=(s,t,e)=>{const{hinkalAddress:r}=T.networkRegistry[t].contractData;if(!t||!e||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(e,r);return JSON.parse(s.cacheDevice.get(k(t,a,n))??JSON.stringify(C))},x=(s,t,e,r)=>{const{hinkalAddress:a}=T.networkRegistry[e].contractData;if(!e||!r||!a)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:c}=o(r,a);t.cacheDevice.set(k(e,n,c),JSON.stringify(s))},S=(s,t,e)=>{x(C,s,t,e)},p=(s,t,e)=>`txsCache-${s}-${t}-${e}`,f=async(s,t,e,r,a,n)=>{if(!t||!e||!r)throw Error("saveTxsCache: incorrect arguments");const{shortPublicKey:c,shortHinkalAddress:i}=o(e,r),l=y.serializeDecodedTxs(s),h=p(t,c,i),g=JSON.stringify({serializedTxs:l,lastHash:a});try{await A.set(h,g)}catch{n.cacheDevice.set(h,g)}},m={serializedTxs:[],lastHash:""},w=async(s,t,e,r)=>{if(!s||!t||!e)throw Error("loadTxsCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(t,e),c=p(s,a,n);let i;try{const d=await A.get(c);if(!d)throw new Error("Empty indexedDB cache");i=d}catch{i=r.cacheDevice.get(c)}const{serializedTxs:l,lastHash:h}=JSON.parse(i??JSON.stringify(m));return{decodedTxs:l.map(d=>y.deserializeDecodedTxs(d)),lastHash:h===""?void 0:h}},u=(s,t,e)=>`hinkalApprovalsCache-${s}-${t}-${e}`,v=(s,t,e,r)=>{const a=t.getContract(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../../types/ethereum-network.types.cjs"),y=require("./getDataFromTransaction.cjs"),A=require("idb-keyval"),T=require("../../constants/chains.constants.cjs"),C={encryptedOutputs:[],lastOutput:""},o=(s,t)=>{const e=s.substring(0,25),r=t.substring(0,25);return{shortPublicKey:e,shortHinkalAddress:r}},k=(s,t,e)=>`hinkalCache-${s}-${t}-${e}`,D=(s,t,e)=>{const{hinkalAddress:r}=T.networkRegistry[t].contractData;if(!t||!e||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(e,r);return JSON.parse(s.cacheDevice.get(k(t,a,n))??JSON.stringify(C))},x=(s,t,e,r)=>{const{hinkalAddress:a}=T.networkRegistry[e].contractData;if(!e||!r||!a)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:c}=o(r,a);t.cacheDevice.set(k(e,n,c),JSON.stringify(s))},S=(s,t,e)=>{x(C,s,t,e)},p=(s,t,e)=>`txsCache-${s}-${t}-${e}`,f=async(s,t,e,r,a,n)=>{if(!t||!e||!r)throw Error("saveTxsCache: incorrect arguments");const{shortPublicKey:c,shortHinkalAddress:i}=o(e,r),l=y.serializeDecodedTxs(s),h=p(t,c,i),g=JSON.stringify({serializedTxs:l,lastHash:a});try{await A.set(h,g)}catch{n.cacheDevice.set(h,g)}},m={serializedTxs:[],lastHash:""},w=async(s,t,e,r)=>{if(!s||!t||!e)throw Error("loadTxsCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(t,e),c=p(s,a,n);let i;try{const d=await A.get(c);if(!d)throw new Error("Empty indexedDB cache");i=d}catch{i=r.cacheDevice.get(c)}const{serializedTxs:l,lastHash:h}=JSON.parse(i??JSON.stringify(m));return{decodedTxs:l.map(d=>y.deserializeDecodedTxs(d)),lastHash:h===""?void 0:h}},u=(s,t,e)=>`hinkalApprovalsCache-${s}-${t}-${e}`,v=(s,t,e,r)=>{const a=t.getContract(H.ContractType.HinkalContract,void 0,e).address;if(!e||!r||!a)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:c}=o(r,a);t.cacheDevice.set(u(e,n,c),JSON.stringify(s))},O=(s,t,e)=>{const r=s.getContract(H.ContractType.HinkalContract,void 0,t).address;if(!t||!e||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(e,r);return JSON.parse(s.cacheDevice.get(u(t,a,n))??JSON.stringify(C))},N=(s,t,e)=>{v({},s,t,e)};exports.getFilePath=k;exports.getHinkalCache=D;exports.getInHinkalAddressesCache=O;exports.getInHinkalAddressesFilePath=u;exports.loadTxsCache=w;exports.resetCache=S;exports.resetInHinkalAddressesCache=N;exports.saveTxsCache=f;exports.setHinkalCache=x;exports.setInHinkalAddressesCache=v;
|
|
@@ -49,7 +49,7 @@ const k = {
|
|
|
49
49
|
const { serializedTxs: l, lastHash: h } = JSON.parse(i ?? JSON.stringify(S));
|
|
50
50
|
return { decodedTxs: l.map((d) => f(d)), lastHash: h === "" ? void 0 : h };
|
|
51
51
|
}, m = (e, s, t) => `hinkalApprovalsCache-${e}-${s}-${t}`, T = (e, s, t, r) => {
|
|
52
|
-
const c = s.getContract(
|
|
52
|
+
const c = s.getContract(C.HinkalContract, void 0, t).address;
|
|
53
53
|
if (!t || !r || !c)
|
|
54
54
|
throw Error("SetHinkalCache: incorrect arguments");
|
|
55
55
|
const { shortPublicKey: n, shortHinkalAddress: o } = a(r, c);
|
|
@@ -58,7 +58,7 @@ const k = {
|
|
|
58
58
|
JSON.stringify(e)
|
|
59
59
|
);
|
|
60
60
|
}, b = (e, s, t) => {
|
|
61
|
-
const r = e.getContract(
|
|
61
|
+
const r = e.getContract(C.HinkalContract, void 0, s).address;
|
|
62
62
|
if (!s || !t || !r)
|
|
63
63
|
throw Error("GetHinkalCache: incorrect arguments");
|
|
64
64
|
const { shortPublicKey: c, shortHinkalAddress: n } = a(t, r);
|
|
@@ -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("../../providers/CustomSolanaConnection.cjs"),n=require("../../providers/CustomEthersProvider.cjs"),o=require("ethers"),s=e=>new o.ethers.providers.JsonRpcProvider(e),c=e=>{const r=new n.CustomEthersProvider(e);return new o.ethers.providers.Web3Provider(r)},i=(e,r="confirmed")=>new t.CustomSolanaConnection(e,r);exports.createCustomRpcProvider=c;exports.createCustomSolanaConnection=i;exports.createProvider=s;
|
|
@@ -2,5 +2,5 @@ import { CustomSolanaConnection } from '../../providers/CustomSolanaConnection';
|
|
|
2
2
|
import { Commitment, ConnectionConfig } from '@solana/web3.js';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
export declare const createProvider: (rpcUrl: string) => ethers.providers.JsonRpcProvider;
|
|
5
|
-
export declare const createCustomRpcProvider: (
|
|
5
|
+
export declare const createCustomRpcProvider: (rpcUrl: string) => ethers.providers.Web3Provider;
|
|
6
6
|
export declare const createCustomSolanaConnection: (endpoint: string, commitmentOrConfig?: Commitment | ConnectionConfig) => CustomSolanaConnection;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { CustomSolanaConnection as
|
|
2
|
-
import { CustomEthersProvider as
|
|
1
|
+
import { CustomSolanaConnection as t } from "../../providers/CustomSolanaConnection.mjs";
|
|
2
|
+
import { CustomEthersProvider as n } from "../../providers/CustomEthersProvider.mjs";
|
|
3
3
|
import { ethers as e } from "ethers";
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
throw new Error("RPC URL not found for the specified chain ID");
|
|
9
|
-
const t = new i(o);
|
|
10
|
-
return new e.providers.Web3Provider(t);
|
|
11
|
-
}, a = (r, o = "confirmed") => new n(r, o);
|
|
4
|
+
const m = (r) => new e.providers.JsonRpcProvider(r), d = (r) => {
|
|
5
|
+
const o = new n(r);
|
|
6
|
+
return new e.providers.Web3Provider(o);
|
|
7
|
+
}, p = (r, o = "confirmed") => new t(r, o);
|
|
12
8
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
d as createCustomRpcProvider,
|
|
10
|
+
p as createCustomSolanaConnection,
|
|
11
|
+
m as createProvider
|
|
16
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../API/getServerURL.cjs");require("axios");require("../../constants/coingecko.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/chains.constants.cjs");require("../../data-structures/http/HttpClient.cjs");require("../../constants/vite.constants.cjs");const a=require("../../API/API.cjs");require("../../constants/token-data/index.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../../API/tenderly.api.cjs");const l=async n=>{const s=n.getCurrentChainId(),r=n.getApprovedUtxos();if(r.length===0)return[];const o=[...new Set(r.map(e=>e.tokenAddress.toLowerCase()))],i=(await a.API.tokensInfoCall(s,o)).filter(e=>!!e),u=new Map(i.map(e=>[e.erc20TokenAddress.toLowerCase(),e]));return r.map(e=>{const t=u.get(e.tokenAddress.toLowerCase());return t?{token:t,spenderAddress:e.interactionAddress,allowance:e.amount}:null}).filter(e=>e!==null&&e.allowance>0n)};exports.getHinkalApprovals=l;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "../../API/getServerURL.mjs";
|
|
2
|
+
import "axios";
|
|
3
|
+
import "../../constants/coingecko.constants.mjs";
|
|
4
|
+
import "../../constants/server.constants.mjs";
|
|
5
|
+
import "../../constants/chains.constants.mjs";
|
|
6
|
+
import "../../data-structures/http/HttpClient.mjs";
|
|
7
|
+
import "../../constants/vite.constants.mjs";
|
|
8
|
+
import { API as a } from "../../API/API.mjs";
|
|
9
|
+
import "../../constants/token-data/index.mjs";
|
|
10
|
+
import "../../constants/contracts.constants.mjs";
|
|
11
|
+
import "../../constants/kyc.constants.mjs";
|
|
12
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
13
|
+
import "../../constants/addresses.constants.mjs";
|
|
14
|
+
import "../../constants/token.limits.constants.mjs";
|
|
15
|
+
import "../../constants/presale.constants.mjs";
|
|
16
|
+
import "../../constants/activity.constants.mjs";
|
|
17
|
+
import "../../constants/tasks.constants.mjs";
|
|
18
|
+
import "../../constants/events.constants.mjs";
|
|
19
|
+
import "../../API/tenderly.api.mjs";
|
|
20
|
+
const y = async (r) => {
|
|
21
|
+
const n = r.getCurrentChainId(), o = r.getApprovedUtxos();
|
|
22
|
+
if (o.length === 0)
|
|
23
|
+
return [];
|
|
24
|
+
const p = [...new Set(o.map((t) => t.tokenAddress.toLowerCase()))], s = (await a.tokensInfoCall(n, p)).filter(
|
|
25
|
+
(t) => !!t
|
|
26
|
+
), i = new Map(s.map((t) => [t.erc20TokenAddress.toLowerCase(), t]));
|
|
27
|
+
return o.map((t) => {
|
|
28
|
+
const e = i.get(t.tokenAddress.toLowerCase());
|
|
29
|
+
return e ? {
|
|
30
|
+
token: e,
|
|
31
|
+
spenderAddress: t.interactionAddress,
|
|
32
|
+
allowance: t.amount
|
|
33
|
+
} : null;
|
|
34
|
+
}).filter((t) => t !== null && t.allowance > 0n);
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
y as getHinkalApprovals
|
|
38
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../data-structures/crypto-keys/decodeUTXO.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../data-structures/crypto-keys/decodeUTXO.cjs"),i=require("./caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const p=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const q=require("./amounts.utils.cjs"),y=(o,t,c)=>{const r=t.getContractWithFetcher(p.ContractType.HinkalContract),u=r.interface,a=t.userKeys.getShieldedPrivateKey(),d=t.getCurrentChainId();return o.logs.filter(e=>i.caseInsensitiveEqual(e.address,r.address)).map(e=>{try{const n=u.parseLog(e);if(n.name==="NewCommitment"){const{encryptedOutput:l,index:g}=n.args;if(q.toBigInt(g)<0n){const s=m.decodeUtxo(l,a,d);if(i.caseInsensitiveEqual(s.erc20TokenAddress,c))return s}}}catch{return null}return null}).filter(e=>e!==null)};exports.getUtxosFromReceipt=y;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { Utxo } from '../../data-structures/utxo/Utxo';
|
|
3
3
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
4
|
-
export declare const getUtxosFromReceipt: (receipt: ethers.providers.TransactionReceipt, hinkal: IHinkal,
|
|
4
|
+
export declare const getUtxosFromReceipt: (receipt: ethers.providers.TransactionReceipt, hinkal: IHinkal, tokenAddress: string) => Utxo[];
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { decodeUtxo as u } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
|
|
2
|
-
import { caseInsensitiveEqual as
|
|
2
|
+
import { caseInsensitiveEqual as i } from "./caseInsensitive.utils.mjs";
|
|
3
3
|
import "../../types/circom-data.types.mjs";
|
|
4
4
|
import { ContractType as f } from "../../types/ethereum-network.types.mjs";
|
|
5
5
|
import "../../types/transactions.types.mjs";
|
|
6
6
|
import "../../types/activities.types.mjs";
|
|
7
7
|
import { toBigInt as g } from "./amounts.utils.mjs";
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
return
|
|
8
|
+
const k = (s, e, c) => {
|
|
9
|
+
const r = e.getContractWithFetcher(f.HinkalContract), a = r.interface, d = e.userKeys.getShieldedPrivateKey(), m = e.getCurrentChainId();
|
|
10
|
+
return s.logs.filter((t) => i(t.address, r.address)).map((t) => {
|
|
11
11
|
try {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
const { encryptedOutput:
|
|
12
|
+
const o = a.parseLog(t);
|
|
13
|
+
if (o.name === "NewCommitment") {
|
|
14
|
+
const { encryptedOutput: p, index: l } = o.args;
|
|
15
15
|
if (g(l) < 0n) {
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
16
|
+
const n = u(p, d, m);
|
|
17
|
+
if (i(n.erc20TokenAddress, c))
|
|
18
|
+
return n;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
} catch {
|
|
@@ -25,5 +25,5 @@ const F = (c, e, r, a) => {
|
|
|
25
25
|
}).filter((t) => t !== null);
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
k as getUtxosFromReceipt
|
|
29
29
|
};
|
|
@@ -37,6 +37,7 @@ export * from './nftTokenFunctions';
|
|
|
37
37
|
export * from './inLogicMetadata';
|
|
38
38
|
export * from './networks.utils';
|
|
39
39
|
export * from './is-valid-url';
|
|
40
|
+
export * from './get-hinkal-approvals';
|
|
40
41
|
export * from './postToOffscreen';
|
|
41
42
|
export * from './get-signature-header';
|
|
42
43
|
export * from './solanaMint.utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../constants/permit2.constants.cjs"),t=require("./caseInsensitive.utils.cjs"),i=e=>r.permit2Addresses.some(s=>t.caseInsensitiveEqual(e,s)),n=e=>e.some(s=>r.uniswapWorkaroundAddresses.some(o=>s.toLowerCase().includes(o.slice(2).toLowerCase())));exports.isPermit2Tx=i;exports.uniswapWorkaround=n;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { uniswapWorkaroundAddresses as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { permit2Addresses as r, uniswapWorkaroundAddresses as i } from "../../constants/permit2.constants.mjs";
|
|
2
|
+
import { caseInsensitiveEqual as t } from "./caseInsensitive.utils.mjs";
|
|
3
|
+
const a = (s) => r.some((e) => t(s, e)), d = (s) => s.some(
|
|
4
|
+
(e) => i.some((o) => e.toLowerCase().includes(o.slice(2).toLowerCase()))
|
|
4
5
|
);
|
|
5
6
|
export {
|
|
6
|
-
a as
|
|
7
|
+
a as isPermit2Tx,
|
|
8
|
+
d as uniswapWorkaround
|
|
7
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("async-mutex"),t=new e.Mutex;exports.balanceFetchingMutex=t;
|