@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,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/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.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 re=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,r,n,P,b,h,y,T,a,A,m=re.chainIds.solanaLocalnet,C=!1,B=r.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(r,n),L=await oe.hinkalCheckSolanaTokenRegistry(f,new i.PublicKey(k),s,p),q=r.map(e=>e.map(t=>t.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:r.map(e=>e.map(t=>t.amount)),inTimeStamps:r.map(e=>e.map(t=>t.timeStamp)),inRandomizations:r.map(e=>e.map(t=>t.randomization)),inNullifiers:F,inCommitmentSiblings:N,inCommitmentSiblingSides:$,outAmounts:n.map(e=>e.map(t=>t.amount.toString())),outTimeStamp:BigInt(n[0][0].timeStamp),outPublicKeys:n.map(e=>e.map(t=>t.getStealthAddress())),extraRandomization:P,amountChanges:p,outCommitments:n.map(e=>e.map(t=>t.amount===0n?0n:t.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(),te=G.map(BigInt).map(o.encodeToByte32Array);return{proofAArr:x,proofBArr:U,proofCArr:ee,publicInputsArr:te}};exports.constructSolanaZkProof=pe;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "../../types/circom-data.types.mjs";
|
|
2
|
-
import "../../types/transactions.types.mjs";
|
|
3
2
|
import "../../types/activities.types.mjs";
|
|
4
3
|
import "ethers";
|
|
5
4
|
import "circomlibjs-hinkal-fork";
|
|
@@ -7,19 +6,21 @@ import "../../error-handling/error-codes.constants.mjs";
|
|
|
7
6
|
import "../../data-structures/crypto-keys/keys.mjs";
|
|
8
7
|
import { chainIds as mt } from "../../constants/chains.constants.mjs";
|
|
9
8
|
import "../../constants/server.constants.mjs";
|
|
10
|
-
import "../../
|
|
9
|
+
import "../../constants/vite.constants.mjs";
|
|
11
10
|
import "../../data-structures/http/HttpClient.mjs";
|
|
12
11
|
import "axios";
|
|
13
|
-
import "../../constants/vite.constants.mjs";
|
|
14
12
|
import "../../constants/token-data/index.mjs";
|
|
13
|
+
import "../../API/getServerURL.mjs";
|
|
14
|
+
import "libsodium-wrappers";
|
|
15
|
+
import "process";
|
|
16
|
+
import "buffer";
|
|
17
|
+
import "../../constants/save-depths.mjs";
|
|
18
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
19
|
+
import "../utils/mutexes.utils.mjs";
|
|
20
|
+
import "@coral-xyz/anchor";
|
|
15
21
|
import { PublicKey as r } from "@solana/web3.js";
|
|
16
22
|
import { encodeToByte32Array as n } from "../pre-transaction/solana.mjs";
|
|
17
23
|
import "@solana/spl-token";
|
|
18
|
-
import "ethers-v6h";
|
|
19
|
-
import "tweetnacl";
|
|
20
|
-
import "bs58";
|
|
21
|
-
import "@coral-xyz/anchor";
|
|
22
|
-
import "buffer";
|
|
23
24
|
import { formatMintAddress as at } from "../utils/solanaMint.utils.mjs";
|
|
24
25
|
import { calcAmountChanges as it } from "./common.snarkjs.mjs";
|
|
25
26
|
import { hinkalCheckSolanaTokenRegistry as nt } from "../../data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.mjs";
|
|
@@ -29,7 +30,7 @@ import { performTaskWithWorker as pt } from "../../webworker/performTaskWithWork
|
|
|
29
30
|
import { ZKProofWorkerActionType as ct } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
30
31
|
import { getSolanaCalldataHash as st } from "../pre-transaction/getSolanaCalldataHash.mjs";
|
|
31
32
|
import { getMerkleTreeSiblingsAndRootHashes as lt } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
|
|
32
|
-
const
|
|
33
|
+
const Ft = async (u, S, k, d, e, P, p, m, a, b, h, A, C, I, i, T, c = mt.solanaLocalnet, B = !1, w = m.map(() => !1), K = 0n, H = [], y = [], R = !0) => {
|
|
33
34
|
const s = "v1x1", v = new r(C), z = new r(I), L = e.getShieldedPrivateKey(), l = p.map((t) => at(t)), N = l.map((t) => t.mintAccountPart1), W = l.map((t) => t.mintAccountPart2), Z = st(
|
|
34
35
|
i,
|
|
35
36
|
v,
|
|
@@ -100,5 +101,5 @@ const Et = async (u, S, k, d, e, P, p, m, a, b, h, A, C, I, i, T, c = mt.solanaL
|
|
|
100
101
|
return { proofAArr: x, proofBArr: U, proofCArr: tt, publicInputsArr: ot };
|
|
101
102
|
};
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
Ft as constructSolanaZkProof
|
|
104
105
|
};
|
|
@@ -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.keccak256(i.ethers.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, e, s, r, i] = t.split(","), c = !n || !e || !s || !r || !i, a = e?.substring(0, 2) !== "0x" || s?.substring(0, 2) !== "0x", d = s?.length !== 66 || e?.length > 66 || e?.length < 64, l = t?.includes('"');
|
|
5
|
+
return !(c || a || d || l);
|
|
6
6
|
}, y = (t) => {
|
|
7
|
-
const [
|
|
7
|
+
const [n, e, , s, r] = t.split(",");
|
|
8
8
|
return {
|
|
9
|
-
extraRandomization: BigInt(
|
|
9
|
+
extraRandomization: BigInt(n),
|
|
10
10
|
stealthAddress: BigInt(e),
|
|
11
|
-
H0: BigInt(
|
|
12
|
-
H1: BigInt(
|
|
11
|
+
H0: BigInt(s),
|
|
12
|
+
H1: BigInt(r)
|
|
13
13
|
};
|
|
14
|
-
}, b = (t) =>
|
|
14
|
+
}, b = (t) => o.keccak256(o.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,
|
|
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"),x=require("./getContractAddress.cjs"),C={encryptedOutputs:[],lastOutput:""},o=(s,e)=>{const t=s.substring(0,25),r=e.substring(0,25);return{shortPublicKey:t,shortHinkalAddress:r}},k=(s,e,t)=>`hinkalCache-${s}-${e}-${t}`,S=(s,e,t)=>{const{hinkalAddress:r}=T.networkRegistry[e].contractData;if(!e||!t||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:a}=o(t,r);return JSON.parse(s.cacheDevice.get(k(e,n,a))??JSON.stringify(C))},p=(s,e,t,r)=>{const{hinkalAddress:n}=T.networkRegistry[t].contractData;if(!t||!r||!n)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:c}=o(r,n);e.cacheDevice.set(k(t,a,c),JSON.stringify(s))},f=(s,e,t)=>{p(C,s,e,t)},v=(s,e,t)=>`txsCache-${s}-${e}-${t}`,m=async(s,e,t,r,n,a)=>{if(!e||!t||!r)throw Error("saveTxsCache: incorrect arguments");const{shortPublicKey:c,shortHinkalAddress:i}=o(t,r),l=y.serializeDecodedTxs(s),h=v(e,c,i),g=JSON.stringify({serializedTxs:l,lastHash:n});try{await A.set(h,g)}catch{a.cacheDevice.set(h,g)}},w={serializedTxs:[],lastHash:""},O=async(s,e,t,r)=>{if(!s||!e||!t)throw Error("loadTxsCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:a}=o(e,t),c=v(s,n,a);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(w));return{decodedTxs:l.map(d=>y.deserializeDecodedTxs(d)),lastHash:h===""?void 0:h}},u=(s,e,t)=>`hinkalApprovalsCache-${s}-${e}-${t}`,D=(s,e,t,r)=>{const n=x.getContractAddress(e.getContract(H.ContractType.HinkalContract,void 0,t));if(!t||!r||!n)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:c}=o(r,n);e.cacheDevice.set(u(t,a,c),JSON.stringify(s))},N=(s,e,t)=>{const r=x.getContractAddress(s.getContract(H.ContractType.HinkalContract,void 0,e));if(!e||!t||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:a}=o(t,r);return JSON.parse(s.cacheDevice.get(u(e,n,a))??JSON.stringify(C))},J=(s,e,t)=>{D({},s,e,t)};exports.getFilePath=k;exports.getHinkalCache=S;exports.getInHinkalAddressesCache=N;exports.getInHinkalAddressesFilePath=u;exports.loadTxsCache=O;exports.resetCache=f;exports.resetInHinkalAddressesCache=J;exports.saveTxsCache=m;exports.setHinkalCache=p;exports.setInHinkalAddressesCache=D;
|
|
@@ -11,7 +11,7 @@ export declare const setHinkalCache: (hinkalCache: HinkalCacheInterface, hinkal:
|
|
|
11
11
|
export declare const resetCache: (hinkal: IHinkal, chainId: number, shieldedPublicKey: string) => void;
|
|
12
12
|
export declare const saveTxsCache: (txs: DecodedTx[], chainId: number, shieldedPublicKey: string, hinkalAddress: string, lastHash: string, hinkal: IHinkal) => Promise<void>;
|
|
13
13
|
export declare const loadTxsCache: (chainId: number, shieldedPublicKey: string, hinkalAddress: string, hinkal: IHinkal) => Promise<{
|
|
14
|
-
decodedTxs: import("../../types/transactions.types").DecodedTxWithUtxos<bigint,
|
|
14
|
+
decodedTxs: import("../../types/transactions.types").DecodedTxWithUtxos<bigint, bigint>[];
|
|
15
15
|
lastHash: string | undefined;
|
|
16
16
|
}>;
|
|
17
17
|
export declare const getInHinkalAddressesFilePath: (chainId: number, shortPublicKey: string, shortHinkalAddress: string) => string;
|
|
@@ -1,82 +1,83 @@
|
|
|
1
|
-
import { ContractType as
|
|
2
|
-
import { serializeDecodedTxs as
|
|
3
|
-
import { set as x, get as
|
|
1
|
+
import { ContractType as k } from "../../types/ethereum-network.types.mjs";
|
|
2
|
+
import { serializeDecodedTxs as f, deserializeDecodedTxs as A } from "./getDataFromTransaction.mjs";
|
|
3
|
+
import { set as x, get as D } from "idb-keyval";
|
|
4
4
|
import { networkRegistry as H } from "../../constants/chains.constants.mjs";
|
|
5
|
-
|
|
5
|
+
import { getContractAddress as u } from "./getContractAddress.mjs";
|
|
6
|
+
const C = {
|
|
6
7
|
encryptedOutputs: [],
|
|
7
8
|
lastOutput: ""
|
|
8
|
-
}, a = (
|
|
9
|
-
const t =
|
|
10
|
-
return { shortPublicKey: t, shortHinkalAddress:
|
|
11
|
-
},
|
|
12
|
-
const { hinkalAddress:
|
|
13
|
-
if (!
|
|
9
|
+
}, a = (s, r) => {
|
|
10
|
+
const t = s.substring(0, 25), e = r.substring(0, 25);
|
|
11
|
+
return { shortPublicKey: t, shortHinkalAddress: e };
|
|
12
|
+
}, y = (s, r, t) => `hinkalCache-${s}-${r}-${t}`, E = (s, r, t) => {
|
|
13
|
+
const { hinkalAddress: e } = H[r].contractData;
|
|
14
|
+
if (!r || !t || !e)
|
|
14
15
|
throw Error("GetHinkalCache: incorrect arguments");
|
|
15
|
-
const { shortPublicKey: c, shortHinkalAddress: n } = a(t,
|
|
16
|
+
const { shortPublicKey: c, shortHinkalAddress: n } = a(t, e);
|
|
16
17
|
return JSON.parse(
|
|
17
|
-
|
|
18
|
+
s.cacheDevice.get(y(r, c, n)) ?? JSON.stringify(C)
|
|
18
19
|
);
|
|
19
|
-
},
|
|
20
|
+
}, S = (s, r, t, e) => {
|
|
20
21
|
const { hinkalAddress: c } = H[t].contractData;
|
|
21
|
-
if (!t || !
|
|
22
|
+
if (!t || !e || !c)
|
|
22
23
|
throw Error("SetHinkalCache: incorrect arguments");
|
|
23
|
-
const { shortPublicKey: n, shortHinkalAddress: o } = a(
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
if (!
|
|
24
|
+
const { shortPublicKey: n, shortHinkalAddress: o } = a(e, c);
|
|
25
|
+
r.cacheDevice.set(y(t, n, o), JSON.stringify(s));
|
|
26
|
+
}, z = (s, r, t) => {
|
|
27
|
+
S(C, s, r, t);
|
|
28
|
+
}, m = (s, r, t) => `txsCache-${s}-${r}-${t}`, b = async (s, r, t, e, c, n) => {
|
|
29
|
+
if (!r || !t || !e)
|
|
29
30
|
throw Error("saveTxsCache: incorrect arguments");
|
|
30
|
-
const { shortPublicKey: o, shortHinkalAddress: i } = a(t,
|
|
31
|
+
const { shortPublicKey: o, shortHinkalAddress: i } = a(t, e), d = f(s), h = m(r, o, i), g = JSON.stringify({ serializedTxs: d, lastHash: c });
|
|
31
32
|
try {
|
|
32
33
|
await x(h, g);
|
|
33
34
|
} catch {
|
|
34
35
|
n.cacheDevice.set(h, g);
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
-
if (!
|
|
37
|
+
}, T = { serializedTxs: [], lastHash: "" }, P = async (s, r, t, e) => {
|
|
38
|
+
if (!s || !r || !t)
|
|
38
39
|
throw Error("loadTxsCache: incorrect arguments");
|
|
39
|
-
const { shortPublicKey: c, shortHinkalAddress: n } = a(
|
|
40
|
+
const { shortPublicKey: c, shortHinkalAddress: n } = a(r, t), o = m(s, c, n);
|
|
40
41
|
let i;
|
|
41
42
|
try {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
43
|
+
const l = await D(o);
|
|
44
|
+
if (!l)
|
|
44
45
|
throw new Error("Empty indexedDB cache");
|
|
45
|
-
i =
|
|
46
|
+
i = l;
|
|
46
47
|
} catch {
|
|
47
|
-
i =
|
|
48
|
+
i = e.cacheDevice.get(o);
|
|
48
49
|
}
|
|
49
|
-
const { serializedTxs:
|
|
50
|
-
return { decodedTxs:
|
|
51
|
-
},
|
|
52
|
-
const c =
|
|
53
|
-
if (!t || !
|
|
50
|
+
const { serializedTxs: d, lastHash: h } = JSON.parse(i ?? JSON.stringify(T));
|
|
51
|
+
return { decodedTxs: d.map((l) => A(l)), lastHash: h === "" ? void 0 : h };
|
|
52
|
+
}, p = (s, r, t) => `hinkalApprovalsCache-${s}-${r}-${t}`, v = (s, r, t, e) => {
|
|
53
|
+
const c = u(r.getContract(k.HinkalContract, void 0, t));
|
|
54
|
+
if (!t || !e || !c)
|
|
54
55
|
throw Error("SetHinkalCache: incorrect arguments");
|
|
55
|
-
const { shortPublicKey: n, shortHinkalAddress: o } = a(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
JSON.stringify(
|
|
56
|
+
const { shortPublicKey: n, shortHinkalAddress: o } = a(e, c);
|
|
57
|
+
r.cacheDevice.set(
|
|
58
|
+
p(t, n, o),
|
|
59
|
+
JSON.stringify(s)
|
|
59
60
|
);
|
|
60
|
-
},
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
61
|
+
}, K = (s, r, t) => {
|
|
62
|
+
const e = u(s.getContract(k.HinkalContract, void 0, r));
|
|
63
|
+
if (!r || !t || !e)
|
|
63
64
|
throw Error("GetHinkalCache: incorrect arguments");
|
|
64
|
-
const { shortPublicKey: c, shortHinkalAddress: n } = a(t,
|
|
65
|
+
const { shortPublicKey: c, shortHinkalAddress: n } = a(t, e);
|
|
65
66
|
return JSON.parse(
|
|
66
|
-
|
|
67
|
+
s.cacheDevice.get(p(r, c, n)) ?? JSON.stringify(C)
|
|
67
68
|
);
|
|
68
|
-
},
|
|
69
|
-
|
|
69
|
+
}, B = (s, r, t) => {
|
|
70
|
+
v({}, s, r, t);
|
|
70
71
|
};
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
y as getFilePath,
|
|
74
|
+
E as getHinkalCache,
|
|
75
|
+
K as getInHinkalAddressesCache,
|
|
76
|
+
p as getInHinkalAddressesFilePath,
|
|
77
|
+
P as loadTxsCache,
|
|
78
|
+
z as resetCache,
|
|
79
|
+
B as resetInHinkalAddressesCache,
|
|
80
|
+
b as saveTxsCache,
|
|
81
|
+
S as setHinkalCache,
|
|
82
|
+
v as setInHinkalAddressesCache
|
|
82
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),p=require("../../constants/chains.constants.cjs"),d=(o,s,n)=>{const{hinkalAddress:c}=p.networkRegistry[n].contractData,t=e.ethers.getBytes(o),l=t.slice(0,20),a=t.slice(20,21),r=t.slice(21,37),i=t.slice(37),[u,y,v,B]=[l,r,a,i].map(m=>e.ethers.hexlify(m));return{from:BigInt(v)>0?s:c,to:u,value:BigInt(y),calldata:B}};exports.convertEmporiumOpToCallInfo=d;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ethers as e } from "ethers";
|
|
2
2
|
import { networkRegistry as f } from "../../constants/chains.constants.mjs";
|
|
3
|
-
const
|
|
4
|
-
const { hinkalAddress:
|
|
5
|
-
(
|
|
3
|
+
const g = (o, s, l) => {
|
|
4
|
+
const { hinkalAddress: n } = f[l].contractData, t = e.getBytes(o), a = t.slice(0, 20), c = t.slice(20, 21), r = t.slice(21, 37), i = t.slice(37), [m, y, B, p] = [a, r, c, i].map(
|
|
5
|
+
(v) => e.hexlify(v)
|
|
6
6
|
);
|
|
7
|
-
return { from: BigInt(
|
|
7
|
+
return { from: BigInt(B) > 0 ? s : n, to: m, value: BigInt(y), calldata: p };
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
g as convertEmporiumOpToCallInfo
|
|
11
11
|
};
|
|
@@ -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.JsonRpcProvider(e),c=e=>{const r=new n.CustomEthersProvider(e);return new o.ethers.BrowserProvider(r)},i=(e,r="confirmed")=>new t.CustomSolanaConnection(e,r);exports.createCustomRpcProvider=c;exports.createCustomSolanaConnection=i;exports.createProvider=s;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomSolanaConnection } from '../../providers/CustomSolanaConnection';
|
|
2
2
|
import { Commitment, ConnectionConfig } from '@solana/web3.js';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
|
-
export declare const createProvider: (rpcUrl: string) => ethers.
|
|
5
|
-
export declare const createCustomRpcProvider: (
|
|
4
|
+
export declare const createProvider: (rpcUrl: string) => ethers.JsonRpcProvider;
|
|
5
|
+
export declare const createCustomRpcProvider: (rpcUrl: string) => ethers.BrowserProvider;
|
|
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.JsonRpcProvider(r), u = (r) => {
|
|
5
|
+
const o = new n(r);
|
|
6
|
+
return new e.BrowserProvider(o);
|
|
7
|
+
}, a = (r, o = "confirmed") => new t(r, o);
|
|
12
8
|
export {
|
|
13
9
|
u as createCustomRpcProvider,
|
|
14
10
|
a as createCustomSolanaConnection,
|
|
15
|
-
|
|
11
|
+
m as createProvider
|
|
16
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("node-forge"),m=require("../snarkjs/constant.cjs"),a=require("ethers"),o=require("libsodium-wrappers"),h=require("../../data-structures/http/HttpClient.cjs");require("axios");function b(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("node-forge"),m=require("../snarkjs/constant.cjs"),a=require("ethers"),o=require("libsodium-wrappers"),h=require("../../data-structures/http/HttpClient.cjs");require("axios");function b(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const s=b(l),f=214,p=async()=>{const t=(await h.httpClient.get(`${m.ENCLAVE_EC2_URL}/handshake`)).public_key,n=s.util.decode64(t),r=s.asn1.fromDer(n);return s.pki.publicKeyFromAsn1(r)},i=e=>typeof e=="bigint"||typeof e=="number"?e.toString():e,y=e=>s.util.hexToBytes(e.replace("0x","")),E=e=>{const t=structuredClone(e);return Object.entries(t).forEach(([n,r])=>{t[n]=i(r),Array.isArray(r)&&(Array.isArray(r[0])?t[n]=r.map(c=>c.map(i)):t[n]=r.map(i))}),t},k=(e,t)=>{const n=a.ethers.hexlify(t).slice(2),r=y(n);if(r.length>f)throw new Error("too many bytes passed to assymetric_encrypt");const c=e.encrypt(r,"RSA-OAEP",{md:s.md.sha1.create(),mgf1:{md:s.md.sha1.create()},label:null});return s.util.encode64(c)},A=(e,t)=>{const n=o.randombytes_buf(o.crypto_secretbox_NONCEBYTES),r=o.crypto_secretbox_easy(t,n,e),c=a.ethers.hexlify(n)+a.ethers.hexlify(r).slice(2),d=y(c);return s.util.encode64(d)},u=(e,t)=>{const n=o.randombytes_buf(o.crypto_secretbox_KEYBYTES),r=k(t,n),c=A(n,e);return{keyCiphertext:r,inputCiphertext:c}},g=(e,t)=>{const n=E(e),r=JSON.stringify(n),c=new TextEncoder().encode(r);return u(c,t)},x=async e=>{const t=await p();return g(e,t)},_=async e=>{const t=await p();return u(e,t)};exports.makeEnclaveHandshakeAndEncryptInput=x;exports.makeEnclaveHandshakeAndEncryptUint8Array=_;
|