@hinkal/common 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +14 -14
- package/API/API.mjs +92 -93
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.d.ts +1 -1
- package/API/admin-calls.mjs +4 -4
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.d.ts +1 -1
- package/API/callLifiAPI.mjs +5 -5
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +1 -1
- package/API/callMonitor.mjs +7 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +11 -11
- package/API/callOkxAPI.cjs +1 -1
- package/API/callOkxAPI.d.ts +1 -1
- package/API/callOkxAPI.mjs +5 -5
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +10 -11
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +6 -3
- package/API/callRelayer.mjs +11 -11
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.d.ts +1 -1
- package/API/checkRisk.mjs +4 -4
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +5 -4
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.mjs +9 -9
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.d.ts +1 -1
- package/API/get-token-data.mjs +5 -5
- package/API/get-token-price-chart-data.cjs +1 -0
- package/API/get-token-price-chart-data.d.ts +16 -0
- package/API/get-token-price-chart-data.mjs +13 -0
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.mjs +9 -9
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -3
- package/API/getServerURL.mjs +51 -67
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +5 -0
- package/API/getTokenPrice.mjs +14 -7
- package/API/index.d.ts +1 -3
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.d.ts +1 -1
- package/API/is-tx-stateless.mjs +10 -12
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +4 -8
- package/API/kycCalls.mjs +23 -26
- package/API/onrampCalls.cjs +1 -0
- package/API/onrampCalls.d.ts +20 -0
- package/API/onrampCalls.mjs +15 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +7 -2
- package/API/proxyAccountsCalls.mjs +27 -21
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +4 -4
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +1 -1
- package/API/scheduled-transactions-calls.mjs +4 -4
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.d.ts +2 -2
- package/API/simulate-batch-tx.mjs +7 -6
- package/API/solana-calls.cjs +1 -1
- package/API/solana-calls.d.ts +6 -3
- package/API/solana-calls.mjs +15 -15
- package/API/temporaryWalletCalls.cjs +1 -0
- package/API/temporaryWalletCalls.d.ts +13 -0
- package/API/temporaryWalletCalls.mjs +20 -0
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +6 -5
- package/API/unspent-utxos-calls.cjs +1 -1
- package/API/unspent-utxos-calls.d.ts +2 -2
- package/API/unspent-utxos-calls.mjs +17 -18
- package/README.md +239 -64
- package/constants/addresses.constants.cjs +1 -1
- package/constants/addresses.constants.d.ts +0 -1
- package/constants/addresses.constants.mjs +7 -8
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +1 -6
- package/constants/chains.constants.mjs +63 -50
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +1 -0
- package/constants/coingecko.constants.mjs +11 -10
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +34 -41
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +28 -2
- package/constants/function-signatures.constants.cjs +1 -1
- package/constants/function-signatures.constants.d.ts +0 -1
- package/constants/function-signatures.constants.mjs +3 -4
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +39 -40
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +1 -0
- package/constants/mediaUrls.constants.mjs +2 -1
- package/constants/mystery-boxes.constants.d.ts +0 -0
- package/constants/permit2.constants.cjs +1 -1
- package/constants/permit2.constants.d.ts +0 -1
- package/constants/permit2.constants.mjs +10 -11
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +20 -123
- package/constants/server.constants.mjs +39 -142
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +0 -24
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +0 -24
- package/constants/token-data/index.d.ts +32 -88
- package/constants/token-data/localhostRegistry.json.cjs +1 -1
- package/constants/token-data/localhostRegistry.json.mjs +0 -26
- package/constants/token-data/polygonRegistry.json.cjs +1 -1
- package/constants/token-data/polygonRegistry.json.mjs +4 -4
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +4 -4
- package/constants/token-data/popularTokens.constants.cjs +1 -1
- package/constants/token-data/popularTokens.constants.mjs +0 -1
- package/data-structures/AccountActions/AccountActions.cjs +1 -0
- package/data-structures/AccountActions/AccountActions.d.ts +18 -0
- package/data-structures/AccountActions/AccountActions.mjs +78 -0
- package/data-structures/AccountActions/index.d.ts +1 -0
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +68 -71
- package/data-structures/BlockchainEvent/BlockchainEvent.cjs +1 -0
- package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +14 -0
- package/data-structures/BlockchainEvent/BlockchainEvent.mjs +41 -0
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +45 -54
- package/data-structures/Hinkal/Hinkal.mjs +314 -341
- package/data-structures/Hinkal/IHinkal.d.ts +40 -52
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +49 -50
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +29 -24
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +20 -20
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +87 -85
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +78 -169
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -0
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -0
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +103 -0
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -0
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +4 -0
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +214 -0
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +4 -5
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +113 -117
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +36 -34
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +40 -36
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +37 -32
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +17 -15
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +4 -3
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +84 -95
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +157 -155
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +2 -3
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +43 -40
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +71 -67
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +63 -59
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +81 -77
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +49 -48
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +71 -68
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +71 -79
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +72 -71
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +81 -79
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +108 -108
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +107 -53
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +1 -0
- package/data-structures/IndexedDB/activity-db.mjs +92 -76
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +40 -37
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +18 -15
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +25 -40
- package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +1 -0
- package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +20 -0
- package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +124 -0
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +1 -0
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +15 -0
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +64 -0
- package/data-structures/PublicBalance/index.d.ts +2 -0
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +83 -85
- package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
- package/data-structures/TokenDBs/token-visibility-db.mjs +22 -36
- package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.d.ts +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +14 -14
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +0 -11
- package/data-structures/crypto-keys/keys.mjs +47 -107
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +3 -2
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +4 -2
- package/data-structures/event-service/evm/AbstractEventService.mjs +19 -19
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +6 -5
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +1 -2
- package/data-structures/event-service/evm/AbstractSnapshotService.mjs +3 -4
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +10 -5
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +39 -35
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +11 -0
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +21 -0
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +6 -0
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +16 -0
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -0
- package/data-structures/event-service/helpers/ClientEventHelper.d.ts +11 -0
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +26 -0
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +1 -0
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +5 -0
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +14 -0
- package/data-structures/event-service/index.d.ts +4 -0
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +3 -2
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +4 -3
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +4 -10
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +10 -7
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +3 -2
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +1 -2
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +1 -2
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +11 -0
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +22 -0
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +1 -0
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +6 -0
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +16 -0
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +11 -16
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +64 -66
- package/data-structures/index.d.ts +3 -0
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +8 -13
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +6 -4
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +6 -4
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +6 -4
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +6 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +6 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +5 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +6 -4
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +2 -7
- package/data-structures/utxo/Utxo.mjs +40 -36
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +1 -0
- package/error-handling/error-codes.constants.mjs +4 -3
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +21 -27
- package/error-handling/index.d.ts +0 -1
- package/functions/index.d.ts +0 -1
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.mjs +18 -17
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -2
- package/functions/pre-transaction/constructAdminData.mjs +12 -18
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +1 -2
- package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.mjs +22 -30
- package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/functions/pre-transaction/getSolanaCalldataHash.mjs +22 -22
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +21 -36
- package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +1 -9
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +19 -34
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +53 -50
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
- package/functions/pre-transaction/solana-public-signals.cjs +1 -1
- package/functions/pre-transaction/solana-public-signals.d.ts +1 -0
- package/functions/pre-transaction/solana-public-signals.mjs +29 -26
- package/functions/pre-transaction/solana.cjs +1 -1
- package/functions/pre-transaction/solana.d.ts +2 -1
- package/functions/pre-transaction/solana.mjs +89 -80
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +4 -5
- package/functions/private-wallet/emporium.helpers.mjs +94 -109
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +1 -4
- package/functions/private-wallet/emporium.swap.helpers.mjs +100 -102
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.d.ts +1 -1
- package/functions/snarkjs/common.snarkjs.mjs +64 -64
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.d.ts +1 -2
- package/functions/snarkjs/constructEmporiumProof.mjs +89 -89
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +1 -2
- package/functions/snarkjs/constructGeneralZkProof.mjs +117 -121
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.d.ts +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +58 -59
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +11 -10
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +1 -0
- package/functions/utils/addresses.mjs +13 -12
- package/functions/utils/bytes32.utils.cjs +1 -1
- package/functions/utils/bytes32.utils.mjs +8 -7
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +1 -1
- package/functions/utils/create-provider.mjs +13 -9
- package/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/functions/utils/erc20tokenFunctions.d.ts +0 -1
- package/functions/utils/erc20tokenFunctions.mjs +22 -29
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +11 -11
- package/functions/utils/index.d.ts +0 -1
- package/functions/utils/involves-permit2-op.cjs +1 -1
- package/functions/utils/involves-permit2-op.d.ts +0 -1
- package/functions/utils/involves-permit2-op.mjs +4 -6
- package/functions/utils/mutexes.utils.cjs +1 -1
- package/functions/utils/mutexes.utils.d.ts +1 -1
- package/functions/utils/mutexes.utils.mjs +3 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +8 -23
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +6 -13
- package/functions/utils/prepareHinkal.mjs +45 -72
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.mjs +49 -54
- package/functions/utils/socket.utils.cjs +1 -0
- package/functions/utils/socket.utils.d.ts +1 -0
- package/functions/utils/socket.utils.mjs +12 -0
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +1 -0
- package/functions/utils/string.utils.mjs +18 -14
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +3 -0
- package/functions/utils/token-check.utils.mjs +18 -7
- package/functions/utils/upToDateState.cjs +1 -1
- package/functions/utils/upToDateState.d.ts +1 -1
- package/functions/utils/upToDateState.mjs +4 -4
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +2 -17
- package/functions/utils/walletBalances.utils.mjs +5 -36
- package/functions/web3/crypto.cjs +1 -0
- package/functions/web3/crypto.d.ts +1 -0
- package/functions/web3/crypto.mjs +7 -0
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.d.ts +3 -4
- package/functions/web3/events/getApprovedBalance.mjs +39 -44
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.mjs +107 -112
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +71 -70
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.mjs +38 -38
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +13 -10
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +1 -6
- package/functions/web3/functionCalls/accessTokenCalls.mjs +12 -21
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +50 -46
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +1 -2
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +36 -40
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.mjs +36 -34
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +17 -22
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +6 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +27 -27
- package/functions/web3/index.d.ts +1 -0
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.d.ts +1 -1
- package/functions/web3/lifiAPI.mjs +12 -12
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +6 -19
- package/functions/web3/okxAPI.cjs +1 -1
- package/functions/web3/okxAPI.mjs +22 -22
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +7 -20
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +38 -56
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +22 -34
- package/index.cjs +1 -1
- package/index.mjs +941 -949
- package/package.json +3 -2
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +10 -17
- package/providers/EthersProviderAdapter.mjs +45 -76
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +7 -11
- package/providers/SolanaProviderAdapter.mjs +16 -31
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +11 -17
- package/providers/WagmiProviderAdapter.mjs +86 -117
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +15 -9
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +16 -9
- package/types/TransactionSimulator.types.d.ts +2 -9
- package/types/activities.types.d.ts +2 -0
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +0 -6
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +0 -1
- package/types/bridging-tx.types.d.ts +17 -0
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +6 -3
- package/types/cache.types.mjs +1 -1
- package/types/coingecko.types.d.ts +5 -0
- package/types/ethereum-network.types.cjs +1 -1
- package/types/ethereum-network.types.d.ts +2 -8
- package/types/ethereum-network.types.mjs +1 -1
- package/types/events.types.cjs +1 -0
- package/types/events.types.d.ts +9 -0
- package/types/events.types.mjs +5 -0
- package/types/external-action.types.cjs +1 -1
- package/types/external-action.types.d.ts +0 -1
- package/types/external-action.types.mjs +1 -1
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +1 -7
- package/types/hinkal.types.mjs +22 -23
- package/types/index.d.ts +3 -3
- package/types/onramp.types.cjs +1 -0
- package/types/onramp.types.d.ts +58 -0
- package/types/onramp.types.mjs +4 -0
- package/types/proxy.types.d.ts +11 -3
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +10 -39
- package/types/sandbox.types.mjs +2 -2
- package/types/session.types.d.ts +2 -0
- package/types/solana.types.d.ts +9 -0
- package/types/token-prices.types.cjs +1 -1
- package/types/token-prices.types.d.ts +7 -0
- package/types/token-prices.types.mjs +4 -2
- package/types/token.types.d.ts +5 -0
- package/types/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +2 -4
- package/types/transactions.types.mjs +3 -3
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +2 -2
- package/API/ai-calls.cjs +0 -1
- package/API/ai-calls.d.ts +0 -17
- package/API/ai-calls.mjs +0 -21
- package/API/duneAPI.cjs +0 -1
- package/API/duneAPI.d.ts +0 -11
- package/API/duneAPI.mjs +0 -25
- package/API/getBridgeProtocols.cjs +0 -1
- package/API/getBridgeProtocols.d.ts +0 -7
- package/API/getBridgeProtocols.mjs +0 -8
- package/API/getLifiStatus.cjs +0 -1
- package/API/getLifiStatus.d.ts +0 -24
- package/API/getLifiStatus.mjs +0 -15
- package/API/getRelayerURL.cjs +0 -1
- package/API/getRelayerURL.d.ts +0 -1
- package/API/getRelayerURL.mjs +0 -10
- package/API/passwordCalls.cjs +0 -1
- package/API/passwordCalls.d.ts +0 -9
- package/API/passwordCalls.mjs +0 -13
- package/API/restoreSnapshots.cjs +0 -1
- package/API/restoreSnapshots.d.ts +0 -1
- package/API/restoreSnapshots.mjs +0 -10
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +0 -1
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +0 -7
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +0 -42
- package/data-structures/Hinkal/hinkalActionStake.d.ts +0 -3
- package/data-structures/Hinkal/hinkalApprove.cjs +0 -1
- package/data-structures/Hinkal/hinkalApprove.d.ts +0 -3
- package/data-structures/Hinkal/hinkalApprove.mjs +0 -115
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +0 -1
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +0 -4
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +0 -121
- package/error-handling/handleErrorRestore.cjs +0 -1
- package/error-handling/handleErrorRestore.d.ts +0 -2
- package/error-handling/handleErrorRestore.mjs +0 -11
- package/functions/kyc/authentoHelper.cjs +0 -1
- package/functions/kyc/authentoHelper.d.ts +0 -12
- package/functions/kyc/authentoHelper.mjs +0 -30
- package/functions/staking/index.cjs +0 -1
- package/functions/staking/index.d.ts +0 -11
- package/functions/staking/index.mjs +0 -42
- package/functions/utils/get-hinkal-approvals.cjs +0 -1
- package/functions/utils/get-hinkal-approvals.d.ts +0 -3
- package/functions/utils/get-hinkal-approvals.mjs +0 -38
- package/functions/utils/replaceAddressInCalldata.cjs +0 -1
- package/functions/utils/replaceAddressInCalldata.d.ts +0 -1
- package/functions/utils/replaceAddressInCalldata.mjs +0 -7
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +0 -1
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +0 -5
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +0 -32
- package/types/bridging.types.d.ts +0 -29
- package/types/duneAPI.types.d.ts +0 -9
- package/types/hinkal.stake.types.cjs +0 -1
- package/types/hinkal.stake.types.d.ts +0 -11
- package/types/hinkal.stake.types.mjs +0 -4
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
import { Utxo as da } from "../../data-structures/utxo/Utxo.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { randomBigInt as $ } from "../web3/etherFunctions.mjs";
|
|
2
|
+
import { zeroAddress as A, defaultSignatureData as la } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { chainIds as sa } from "../../constants/chains.constants.mjs";
|
|
4
|
+
import { ZKProofWorkerActionType as ca } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
5
|
+
import { performTaskWithWorker as pa } from "../../webworker/performTaskWithWorker.mjs";
|
|
6
|
+
import { WorkerVariant as fa } from "../../webworker/worker.registry.mjs";
|
|
7
|
+
import { calcAmountChanges as D, calcEncryptedOutputs as Sa, buildOutCommitments as ga, calcPublicSignalCount as Aa, getSlippageValues as ha, createCallDataHash as Ha, calcStealthAddressStructure as wa } from "./common.snarkjs.mjs";
|
|
8
|
+
import { randomBigInt as _ } from "../web3/etherFunctions.mjs";
|
|
10
9
|
import { encodeEmporiumMetadata as Ma, getAuthorizationDataIfNeeded as Ca } from "../private-wallet/emporium.helpers.mjs";
|
|
11
10
|
import { ExternalActionId as Da } from "../../types/external-action.types.mjs";
|
|
12
11
|
import { defaultHookData as Ta } from "../../types/circom-data.types.mjs";
|
|
13
|
-
import { generateCircomData as
|
|
14
|
-
import { generateZkProof as
|
|
15
|
-
import { getCurrentTimeInSeconds as
|
|
16
|
-
import { defaultHinkalLogicArgs as
|
|
17
|
-
import { generateFeeStructure as
|
|
18
|
-
import { hinkalCheckTokenRegistry as
|
|
19
|
-
import { poseidonFunction as
|
|
12
|
+
import { generateCircomData as ka } from "./generateCircomData.mjs";
|
|
13
|
+
import { generateZkProof as za } from "./generateZkProof.mjs";
|
|
14
|
+
import { getCurrentTimeInSeconds as q } from "../utils/time.utils.mjs";
|
|
15
|
+
import { defaultHinkalLogicArgs as Wa } from "../../types/hinkal.types.mjs";
|
|
16
|
+
import { generateFeeStructure as ba } from "../utils/fees.utils.mjs";
|
|
17
|
+
import { hinkalCheckTokenRegistry as Ea, createHinkalHelperFromData as Ia } from "../../data-structures/Hinkal/hinkalCheckTokenRegistry.mjs";
|
|
18
|
+
import { poseidonFunction as Na } from "../../crypto/poseidon.mjs";
|
|
20
19
|
import "circomlibjs-hinkal-fork";
|
|
21
20
|
import "libsodium-wrappers";
|
|
22
21
|
import "process";
|
|
23
22
|
import "buffer";
|
|
24
|
-
import { getMerkleTreeSiblingsAndRootHashes as
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
import { getMerkleTreeSiblingsAndRootHashes as Pa } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
|
|
24
|
+
import { AccountActions as Ra } from "../../data-structures/AccountActions/AccountActions.mjs";
|
|
25
|
+
const mt = async (i, j, G, l, h, t, a, d, T, J, k, Q, X, z = A, o = sa.localhost, s = t.map(() => !1), H = t.map(() => 0n), c, r = void 0, Y = !1, p, f = void 0, K, W = la, L, V = !0) => {
|
|
26
|
+
const b = D(t, a), w = Sa(a), S = d.getShieldedPrivateKey(), E = da.findCorrectRandomization(_(31), S), x = await Ea(
|
|
27
|
+
K ?? Ia(o),
|
|
28
28
|
l,
|
|
29
|
-
|
|
30
|
-
),
|
|
29
|
+
D(t, a, !0)
|
|
30
|
+
), I = t.map((e) => e.map((n) => n.getConstructableParams())), {
|
|
31
31
|
inCommitmentSiblings: U,
|
|
32
32
|
inCommitmentSiblingSides: aa,
|
|
33
|
-
accessTokenSiblings:
|
|
34
|
-
accessTokenSiblingSides:
|
|
35
|
-
rootHashHinkal:
|
|
36
|
-
rootHashAccessToken:
|
|
37
|
-
} = await
|
|
33
|
+
accessTokenSiblings: N,
|
|
34
|
+
accessTokenSiblingSides: P,
|
|
35
|
+
rootHashHinkal: R,
|
|
36
|
+
rootHashAccessToken: M
|
|
37
|
+
} = await Pa(
|
|
38
38
|
o,
|
|
39
39
|
d,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
I,
|
|
41
|
+
Y,
|
|
42
42
|
x,
|
|
43
|
-
q,
|
|
44
43
|
j,
|
|
44
|
+
G,
|
|
45
45
|
V
|
|
46
|
-
),
|
|
47
|
-
type:
|
|
46
|
+
), y = await pa({
|
|
47
|
+
type: fa.ZKProof,
|
|
48
48
|
payload: {
|
|
49
|
-
type:
|
|
50
|
-
data: { inputUtxosSerialized:
|
|
49
|
+
type: ca.BUILD_IN_NULLIFIERS,
|
|
50
|
+
data: { inputUtxosSerialized: I, onChainCreation: s, proverVersion: i }
|
|
51
51
|
}
|
|
52
|
-
}),
|
|
53
|
-
rootHashHinkal:
|
|
52
|
+
}), F = ga(i, a, s), C = L ?? _(31), ta = Na(C), m = {
|
|
53
|
+
rootHashHinkal: R,
|
|
54
54
|
erc20TokenAddresses: l,
|
|
55
55
|
tokenIds: h,
|
|
56
|
-
inNullifiers:
|
|
57
|
-
outTimeStamp: a.length > 0 ? BigInt(a[0][0].timeStamp) :
|
|
58
|
-
extraRandomization:
|
|
59
|
-
amountChanges:
|
|
60
|
-
outCommitments:
|
|
61
|
-
rootHashAccessToken:
|
|
56
|
+
inNullifiers: y,
|
|
57
|
+
outTimeStamp: a.length > 0 ? BigInt(a[0][0].timeStamp) : q(),
|
|
58
|
+
extraRandomization: E,
|
|
59
|
+
amountChanges: b,
|
|
60
|
+
outCommitments: F,
|
|
61
|
+
rootHashAccessToken: M,
|
|
62
62
|
calldataHash: 0n,
|
|
63
63
|
shieldedPrivateKey: S,
|
|
64
|
-
accessTokenSiblings:
|
|
65
|
-
accessTokenSiblingSides:
|
|
66
|
-
outAmounts: a.map((e) => e.map((
|
|
67
|
-
outPublicKeys: a.map((e) => e.map((
|
|
68
|
-
inAmounts: t.map((e) => e.map((
|
|
69
|
-
inTimeStamps: t.map((e) => e.map((
|
|
70
|
-
inRandomizations: t.map((e) => e.map((
|
|
64
|
+
accessTokenSiblings: N,
|
|
65
|
+
accessTokenSiblingSides: P,
|
|
66
|
+
outAmounts: a.map((e) => e.map((n) => n.amount)),
|
|
67
|
+
outPublicKeys: a.map((e) => e.map((n) => n.getStealthAddress())),
|
|
68
|
+
inAmounts: t.map((e) => e.map((n) => n.amount.toString())),
|
|
69
|
+
inTimeStamps: t.map((e) => e.map((n) => n.timeStamp)),
|
|
70
|
+
inRandomizations: t.map((e) => e.map((n) => n.randomization)),
|
|
71
71
|
inCommitmentSiblings: U,
|
|
72
72
|
inCommitmentSiblingSides: aa,
|
|
73
|
-
messageSeed:
|
|
74
|
-
}, ea = c ?
|
|
73
|
+
messageSeed: C
|
|
74
|
+
}, ea = c ? Ra.getSignerAddressFromPrivateKey(o, c) : void 0, u = k, B = Da.Emporium, v = await Ma(
|
|
75
75
|
o,
|
|
76
|
-
|
|
77
|
-
c
|
|
78
|
-
|
|
76
|
+
k,
|
|
77
|
+
c,
|
|
78
|
+
Q,
|
|
79
79
|
ta,
|
|
80
80
|
ea
|
|
81
|
-
), g = a.length === 0 ? "swapperMWMin0" : `swapperMW${
|
|
81
|
+
), g = a.length === 0 ? "swapperMWMin0" : `swapperMW${T}x${J}x${a[0].length}`, O = Aa(
|
|
82
82
|
g,
|
|
83
83
|
m.erc20TokenAddresses,
|
|
84
84
|
m.amountChanges,
|
|
@@ -86,20 +86,20 @@ const mt = async (n, q, j, l, h, t, a, d, D, G, T, J, Q, P = A, o = ca.localhost
|
|
|
86
86
|
m.outCommitments,
|
|
87
87
|
h.length
|
|
88
88
|
);
|
|
89
|
-
if (r || (r =
|
|
89
|
+
if (r || (r = Wa(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
|
-
m.externalApprovalAddresses = r?.useApprovalUtxoData?.map(({ externalApprovalAddresses: e }) => e) ?? Array(
|
|
92
|
+
m.externalApprovalAddresses = r?.useApprovalUtxoData?.map(({ externalApprovalAddresses: e }) => e) ?? Array(T).fill([A, A, A]);
|
|
93
93
|
}
|
|
94
|
-
f || (f =
|
|
95
|
-
const
|
|
96
|
-
p || (p =
|
|
97
|
-
|
|
94
|
+
f || (f = ba(H, l));
|
|
95
|
+
const Z = D(t, a, !0);
|
|
96
|
+
p || (p = ha(Z, r)), m.calldataHash = Ha(
|
|
97
|
+
i,
|
|
98
|
+
O,
|
|
99
|
+
z,
|
|
98
100
|
u,
|
|
99
|
-
P,
|
|
100
|
-
F,
|
|
101
|
-
K,
|
|
102
101
|
B,
|
|
102
|
+
v,
|
|
103
103
|
w,
|
|
104
104
|
H,
|
|
105
105
|
void 0,
|
|
@@ -107,59 +107,59 @@ const mt = async (n, q, j, l, h, t, a, d, D, G, T, J, Q, P = A, o = ca.localhost
|
|
|
107
107
|
s,
|
|
108
108
|
r,
|
|
109
109
|
f,
|
|
110
|
-
|
|
110
|
+
W
|
|
111
111
|
);
|
|
112
|
-
const
|
|
113
|
-
outTimeStamp:
|
|
114
|
-
rootHashAccessToken:
|
|
112
|
+
const $ = {
|
|
113
|
+
outTimeStamp: q(),
|
|
114
|
+
rootHashAccessToken: M,
|
|
115
115
|
calldataHash: m.calldataHash,
|
|
116
116
|
shieldedPrivateKey: S,
|
|
117
|
-
accessTokenSiblings:
|
|
118
|
-
accessTokenSiblingSides:
|
|
119
|
-
messageSeed:
|
|
120
|
-
}, { zkCallData: ma } = await
|
|
121
|
-
|
|
117
|
+
accessTokenSiblings: N,
|
|
118
|
+
accessTokenSiblingSides: P,
|
|
119
|
+
messageSeed: C
|
|
120
|
+
}, { zkCallData: ma } = await za(
|
|
121
|
+
i,
|
|
122
122
|
o,
|
|
123
123
|
g,
|
|
124
|
-
g === "swapperMWMin0" ?
|
|
125
|
-
|
|
126
|
-
), ra =
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
N,
|
|
130
|
-
I,
|
|
124
|
+
g === "swapperMWMin0" ? $ : m,
|
|
125
|
+
X
|
|
126
|
+
), ra = wa(E, S), na = await ka(
|
|
127
|
+
i,
|
|
128
|
+
F,
|
|
131
129
|
y,
|
|
132
|
-
|
|
130
|
+
R,
|
|
131
|
+
M,
|
|
132
|
+
Z,
|
|
133
133
|
l,
|
|
134
134
|
t,
|
|
135
135
|
a,
|
|
136
136
|
w,
|
|
137
137
|
H,
|
|
138
|
-
|
|
139
|
-
K,
|
|
140
|
-
F,
|
|
138
|
+
O,
|
|
141
139
|
B,
|
|
142
|
-
|
|
140
|
+
u,
|
|
141
|
+
v,
|
|
142
|
+
z,
|
|
143
143
|
m.calldataHash,
|
|
144
144
|
h,
|
|
145
145
|
ra,
|
|
146
146
|
s,
|
|
147
147
|
Ta,
|
|
148
|
-
g === "swapperMWMin0" ?
|
|
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,
|
|
151
151
|
p,
|
|
152
152
|
f,
|
|
153
|
-
|
|
154
|
-
),
|
|
153
|
+
W
|
|
154
|
+
), ia = {
|
|
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
158
|
}, oa = await Ca(
|
|
159
159
|
o,
|
|
160
|
-
c
|
|
160
|
+
c
|
|
161
161
|
);
|
|
162
|
-
return { zkCallData: ma, circomData:
|
|
162
|
+
return { zkCallData: ma, circomData: na, dimData: ia, encryptedOutputs: w, authorizationData: oa };
|
|
163
163
|
};
|
|
164
164
|
export {
|
|
165
165
|
mt as constructEmporiumProof
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("../../constants/chains.constants.cjs"),i=require("../../constants/protocol.constants.cjs"),ne=require("../../data-structures/utxo/Utxo.cjs"),ae=require("../../webworker/performTaskWithWorker.cjs"),re=require("../../webworker/worker.registry.cjs"),oe=require("../../webworker/zkProofWorker/zkProofWorker.types.cjs"),se=require("../web3/etherFunctions.cjs"),s=require("./common.snarkjs.cjs"),ie=require("./generateCircomData.cjs"),ce=require("./generateZkProof.cjs"),de=require("../../types/hinkal.types.cjs"),me=require("../utils/fees.utils.cjs"),E=require("../../data-structures/Hinkal/hinkalCheckTokenRegistry.cjs"),q=require("../../error-handling/logger.cjs"),le=require("./getMerkleTreeSiblingsAndRootHashes.cjs"),ke=async(c,j,F,t,o,d,b,C,m,p,M,P=i.zeroAddress,S=te.chainIds.localhost,l=t.map(()=>!1),A=t.map(()=>0n),y=void 0,K=!1,a=void 0,k,g=void 0,G,z=i.defaultSignatureData,I,J=!0)=>{const R=s.calcAmountChanges(t,o),h=t.map(e=>e[0].erc20TokenAddress),f=s.calcEncryptedOutputs(o),H=d.getShieldedPrivateKey(),_=ne.Utxo.findCorrectRandomization(se.randomBigInt(31),H),Q=await E.hinkalCheckTokenRegistry(G??E.createHinkalHelperFromData(S),h,s.calcAmountChanges(t,o,!0)),w=t.map(e=>e.map(n=>n.getConstructableParams())),{inCommitmentSiblings:X,inCommitmentSiblingSides:Y,accessTokenSiblings:$,accessTokenSiblingSides:L,rootHashHinkal:D,rootHashAccessToken:W}=await le.getMerkleTreeSiblingsAndRootHashes(S,d,w,K,Q,j,F,J),Z=await ae.performTaskWithWorker({type:re.WorkerVariant.ZKProof,payload:{type:oe.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:w,onChainCreation:l,proverVersion:c}}}),v=s.buildOutCommitments(c,o,l),r={rootHashHinkal:D,shieldedPrivateKey:H,erc20TokenAddresses:h,inAmounts:t.map(e=>e.map(n=>n.amount.toString())),inTimeStamps:t.map(e=>e.map(n=>n.timeStamp)),inRandomizations:t.map(e=>e.map(n=>n.randomization)),inNullifiers:Z,inCommitmentSiblings:X,inCommitmentSiblingSides:Y,outAmounts:o.map(e=>e.map(n=>n.amount.toString())),outTimeStamp:BigInt(o[0][0].timeStamp),outPublicKeys:o.map(e=>e.map(n=>n.getStealthAddress())),extraRandomization:_,amountChanges:R,outCommitments:v,rootHashAccessToken:W,accessTokenSiblings:$,accessTokenSiblingSides:L,calldataHash:0n},u=t.map(e=>e[0].tokenId??0),B=u.reduce((e,n)=>e+n,0)>0?u.length:0;B>0&&(r.tokenIds=u);const T=s.calcPublicSignalCount(b,r.erc20TokenAddresses,r.amountChanges,r.inNullifiers,r.outCommitments,B);if(!a){a=de.defaultHinkalLogicArgs(R.length,d),a.interactionAddress=m??i.zeroAddress;const e=d.getInHinkalAddress(a.interactionAddress);a.inHinkalAddress=e}if(c==="v1x1"){if(r.interactionAddress=a?.interactionAddress??m??i.zeroAddress,d.getInHinkalAddress(r.interactionAddress)!==a.inHinkalAddress)throw new Error("inHinkalAddress mismatch");r.externalApprovalAddresses=a.useApprovalUtxoData?.map(({externalApprovalAddresses:e})=>e)??[i.zeroAddress,i.zeroAddress,i.zeroAddress]}g||(g=me.generateFeeStructure(A,t.map(e=>e[0].erc20TokenAddress)));const N=s.calcAmountChanges(t,o,!0);k||(k=s.getSlippageValues(N,a)),q.Logger.log({publicSignalCount:T}),r.calldataHash=s.createCallDataHash(c,T,P,m,C,p,f,A,y,k,l,a,g,z,I);const{zkCallData:V,publicSignals:U}=await ce.generateZkProof(c,S,b,r,M);q.Logger.log({publicSignals:U});const x=s.calcStealthAddressStructure(_,H),O=await ie.generateCircomData(c,v,Z,D,W,N,h,t,o,f,A,T,C,m,p,P,r.calldataHash,u,x,l,y,void 0,a,k,g,z,I);q.Logger.log({circomData:O});const ee={tokenNumber:t.length,nullifierAmount:t[0].length,outputAmount:o[0].length};return{zkCallData:V,circomData:O,dimData:ee,encryptedOutputs:f}};exports.constructZkProof=ke;
|
|
@@ -3,10 +3,9 @@ import { UserKeys } from '../../data-structures/crypto-keys/keys';
|
|
|
3
3
|
import { Utxo } from '../../data-structures/utxo/Utxo';
|
|
4
4
|
import { CircomDataV1x1, DimDataType, HookDataType } from '../../types/circom-data.types';
|
|
5
5
|
import { ExternalActionId } from '../../types/external-action.types';
|
|
6
|
-
import { StakeArgs } from '../../types/hinkal.stake.types';
|
|
7
6
|
import { FeeStructure, HinkalLogicArgs, ProverVersion } from '../../types/hinkal.types';
|
|
8
7
|
import { ethers } from 'ethers';
|
|
9
|
-
export declare const constructZkProof: <T = CircomDataV1x1>(proverVersion: ProverVersion, merkleTree: MerkleTree<bigint>, merkleTreeAccessToken: MerkleTree<bigint>, inputUtxos: Utxo[][], outputUtxos: Utxo[][], userKeys: UserKeys, verifierName: string, externalActionId: ExternalActionId | 0n, externalAddress: string | undefined, externalActionMetadata: string, generateProofRemotely: boolean, relay?: string, chainId?: number, onChainCreation?: boolean[], flatFees?: bigint[], hookData?: HookDataType | undefined,
|
|
8
|
+
export declare const constructZkProof: <T = CircomDataV1x1>(proverVersion: ProverVersion, merkleTree: MerkleTree<bigint>, merkleTreeAccessToken: MerkleTree<bigint>, inputUtxos: Utxo[][], outputUtxos: Utxo[][], userKeys: UserKeys, verifierName: string, externalActionId: ExternalActionId | 0n, externalAddress: string | undefined, externalActionMetadata: string, generateProofRemotely: boolean, relay?: string, chainId?: number, onChainCreation?: boolean[], flatFees?: bigint[], hookData?: HookDataType | undefined, patchAccessTokenMerkleTree?: boolean, hinkalLogicArgs?: HinkalLogicArgs | undefined, slippageValues?: bigint[], feeStructure?: FeeStructure | undefined, hinkalHelper?: ethers.Contract, signatureData?: import('../../index.ts').SignatureData, originalSender?: string, hasLocalTrees?: boolean) => Promise<{
|
|
10
9
|
zkCallData: import('../../index.ts').NewZkCallDataType;
|
|
11
10
|
circomData: T;
|
|
12
11
|
dimData: DimDataType;
|
|
@@ -1,158 +1,154 @@
|
|
|
1
|
-
import { chainIds as
|
|
2
|
-
import { zeroAddress as
|
|
3
|
-
import { Utxo as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
n,
|
|
20
|
-
(i && i.mode !== S.Deposit) ?? !1
|
|
21
|
-
), C = c.getShieldedPrivateKey(), v = me.findCorrectRandomization(re(31), C), X = await he(
|
|
22
|
-
J ?? Ce(H),
|
|
23
|
-
b,
|
|
24
|
-
A(o, n, !0)
|
|
25
|
-
), N = o.map((e) => e.map((a) => a.getConstructableParams())), {
|
|
26
|
-
inCommitmentSiblings: Y,
|
|
27
|
-
inCommitmentSiblingSides: $,
|
|
28
|
-
accessTokenSiblings: L,
|
|
29
|
-
accessTokenSiblingSides: V,
|
|
30
|
-
rootHashHinkal: W,
|
|
31
|
-
rootHashAccessToken: Z
|
|
32
|
-
} = await ge(
|
|
1
|
+
import { chainIds as tt } from "../../constants/chains.constants.mjs";
|
|
2
|
+
import { zeroAddress as i, defaultSignatureData as at } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { Utxo as et } from "../../data-structures/utxo/Utxo.mjs";
|
|
4
|
+
import { performTaskWithWorker as mt } from "../../webworker/performTaskWithWorker.mjs";
|
|
5
|
+
import { WorkerVariant as ot } from "../../webworker/worker.registry.mjs";
|
|
6
|
+
import { ZKProofWorkerActionType as nt } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
|
|
7
|
+
import { randomBigInt as rt } from "../web3/etherFunctions.mjs";
|
|
8
|
+
import { calcAmountChanges as b, calcEncryptedOutputs as it, buildOutCommitments as dt, calcPublicSignalCount as st, getSlippageValues as ct, createCallDataHash as lt, calcStealthAddressStructure as ft } from "./common.snarkjs.mjs";
|
|
9
|
+
import { generateCircomData as pt } from "./generateCircomData.mjs";
|
|
10
|
+
import { generateZkProof as kt } from "./generateZkProof.mjs";
|
|
11
|
+
import { defaultHinkalLogicArgs as St } from "../../types/hinkal.types.mjs";
|
|
12
|
+
import { generateFeeStructure as Ht } from "../utils/fees.utils.mjs";
|
|
13
|
+
import { hinkalCheckTokenRegistry as gt, createHinkalHelperFromData as At } from "../../data-structures/Hinkal/hinkalCheckTokenRegistry.mjs";
|
|
14
|
+
import { Logger as h } from "../../error-handling/logger.mjs";
|
|
15
|
+
import { getMerkleTreeSiblingsAndRootHashes as Tt } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
|
|
16
|
+
const Zt = async (r, q, F, a, n, d, C, I, s, P, K, u = i, k = tt.localhost, c = a.map(() => !1), S = a.map(() => 0n), w = void 0, j = !1, m = void 0, l, f = void 0, G, y = at, z, J = !0) => {
|
|
17
|
+
const D = b(a, n), H = a.map((t) => t[0].erc20TokenAddress), g = it(n), A = d.getShieldedPrivateKey(), R = et.findCorrectRandomization(rt(31), A), M = await gt(
|
|
18
|
+
G ?? At(k),
|
|
33
19
|
H,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
X,
|
|
38
|
-
|
|
20
|
+
b(a, n, !0)
|
|
21
|
+
), v = a.map((t) => t.map((e) => e.getConstructableParams())), {
|
|
22
|
+
inCommitmentSiblings: Q,
|
|
23
|
+
inCommitmentSiblingSides: X,
|
|
24
|
+
accessTokenSiblings: Y,
|
|
25
|
+
accessTokenSiblingSides: $,
|
|
26
|
+
rootHashHinkal: B,
|
|
27
|
+
rootHashAccessToken: N
|
|
28
|
+
} = await Tt(
|
|
29
|
+
k,
|
|
30
|
+
d,
|
|
31
|
+
v,
|
|
32
|
+
j,
|
|
39
33
|
M,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
q,
|
|
35
|
+
F,
|
|
36
|
+
J
|
|
37
|
+
), W = await mt({
|
|
38
|
+
type: ot.ZKProof,
|
|
43
39
|
payload: {
|
|
44
|
-
type:
|
|
45
|
-
data: { inputUtxosSerialized:
|
|
40
|
+
type: nt.BUILD_IN_NULLIFIERS,
|
|
41
|
+
data: { inputUtxosSerialized: v, onChainCreation: c, proverVersion: r }
|
|
46
42
|
}
|
|
47
|
-
}),
|
|
48
|
-
rootHashHinkal:
|
|
49
|
-
shieldedPrivateKey:
|
|
50
|
-
erc20TokenAddresses:
|
|
51
|
-
inAmounts:
|
|
52
|
-
inTimeStamps:
|
|
53
|
-
inRandomizations:
|
|
54
|
-
inNullifiers:
|
|
55
|
-
inCommitmentSiblings:
|
|
56
|
-
inCommitmentSiblingSides:
|
|
57
|
-
outAmounts: n.map((
|
|
43
|
+
}), Z = dt(r, n, c), o = {
|
|
44
|
+
rootHashHinkal: B,
|
|
45
|
+
shieldedPrivateKey: A,
|
|
46
|
+
erc20TokenAddresses: H,
|
|
47
|
+
inAmounts: a.map((t) => t.map((e) => e.amount.toString())),
|
|
48
|
+
inTimeStamps: a.map((t) => t.map((e) => e.timeStamp)),
|
|
49
|
+
inRandomizations: a.map((t) => t.map((e) => e.randomization)),
|
|
50
|
+
inNullifiers: W,
|
|
51
|
+
inCommitmentSiblings: Q,
|
|
52
|
+
inCommitmentSiblingSides: X,
|
|
53
|
+
outAmounts: n.map((t) => t.map((e) => e.amount.toString())),
|
|
58
54
|
outTimeStamp: BigInt(n[0][0].timeStamp),
|
|
59
|
-
outPublicKeys: n.map((
|
|
60
|
-
extraRandomization:
|
|
61
|
-
amountChanges:
|
|
62
|
-
outCommitments:
|
|
63
|
-
rootHashAccessToken:
|
|
64
|
-
accessTokenSiblings:
|
|
65
|
-
accessTokenSiblingSides:
|
|
55
|
+
outPublicKeys: n.map((t) => t.map((e) => e.getStealthAddress())),
|
|
56
|
+
extraRandomization: R,
|
|
57
|
+
amountChanges: D,
|
|
58
|
+
outCommitments: Z,
|
|
59
|
+
rootHashAccessToken: N,
|
|
60
|
+
accessTokenSiblings: Y,
|
|
61
|
+
accessTokenSiblingSides: $,
|
|
66
62
|
calldataHash: 0n
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
}, p = a.map((t) => t[0].tokenId ?? 0), E = p.reduce((t, e) => t + e, 0) > 0 ? p.length : 0;
|
|
64
|
+
E > 0 && (o.tokenIds = p);
|
|
65
|
+
const T = st(
|
|
66
|
+
C,
|
|
67
|
+
o.erc20TokenAddresses,
|
|
68
|
+
o.amountChanges,
|
|
69
|
+
o.inNullifiers,
|
|
70
|
+
o.outCommitments,
|
|
71
|
+
E
|
|
76
72
|
);
|
|
77
73
|
if (!m) {
|
|
78
|
-
m =
|
|
79
|
-
const
|
|
80
|
-
m.inHinkalAddress =
|
|
74
|
+
m = St(D.length, d), m.interactionAddress = s ?? i;
|
|
75
|
+
const t = d.getInHinkalAddress(m.interactionAddress);
|
|
76
|
+
m.inHinkalAddress = t;
|
|
81
77
|
}
|
|
82
|
-
if (
|
|
83
|
-
if (
|
|
78
|
+
if (r === "v1x1") {
|
|
79
|
+
if (o.interactionAddress = m?.interactionAddress ?? s ?? i, d.getInHinkalAddress(o.interactionAddress) !== m.inHinkalAddress)
|
|
84
80
|
throw new Error("inHinkalAddress mismatch");
|
|
85
|
-
|
|
86
|
-
({ externalApprovalAddresses:
|
|
87
|
-
) ?? [
|
|
81
|
+
o.externalApprovalAddresses = m.useApprovalUtxoData?.map(
|
|
82
|
+
({ externalApprovalAddresses: t }) => t
|
|
83
|
+
) ?? [i, i, i];
|
|
88
84
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
f || (f = Ht(
|
|
86
|
+
S,
|
|
87
|
+
a.map((t) => t[0].erc20TokenAddress)
|
|
92
88
|
));
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
const O = b(a, n, !0);
|
|
90
|
+
l || (l = ct(O, m)), h.log({ publicSignalCount: T }), o.calldataHash = lt(
|
|
91
|
+
r,
|
|
92
|
+
T,
|
|
97
93
|
u,
|
|
98
94
|
s,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
I,
|
|
96
|
+
P,
|
|
97
|
+
g,
|
|
98
|
+
S,
|
|
103
99
|
w,
|
|
104
|
-
f,
|
|
105
100
|
l,
|
|
101
|
+
c,
|
|
106
102
|
m,
|
|
107
|
-
|
|
103
|
+
f,
|
|
108
104
|
y,
|
|
109
105
|
z
|
|
110
|
-
), i && (i.mode === S.Deposit && (t.mode = 0), i.mode === S.Stake && (t.mode = 1), i.mode === S.Unstake && (t.mode = 2), t.stakedTokenRecipient = i.stakedTokenRecipient, t.stakeBlinding = i.stakeBlinding, t.depositorAddress = i.depositorAddress);
|
|
111
|
-
const { zkCallData: U, publicSignals: x } = await He(
|
|
112
|
-
d,
|
|
113
|
-
H,
|
|
114
|
-
P,
|
|
115
|
-
t,
|
|
116
|
-
j
|
|
117
106
|
);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
E,
|
|
123
|
-
W,
|
|
124
|
-
Z,
|
|
125
|
-
q,
|
|
126
|
-
b,
|
|
107
|
+
const { zkCallData: L, publicSignals: V } = await kt(
|
|
108
|
+
r,
|
|
109
|
+
k,
|
|
110
|
+
C,
|
|
127
111
|
o,
|
|
112
|
+
K
|
|
113
|
+
);
|
|
114
|
+
h.log({ publicSignals: V });
|
|
115
|
+
const U = ft(R, A), _ = await pt(
|
|
116
|
+
r,
|
|
117
|
+
Z,
|
|
118
|
+
W,
|
|
119
|
+
B,
|
|
120
|
+
N,
|
|
121
|
+
O,
|
|
122
|
+
H,
|
|
123
|
+
a,
|
|
128
124
|
n,
|
|
129
|
-
h,
|
|
130
|
-
T,
|
|
131
125
|
g,
|
|
132
|
-
|
|
126
|
+
S,
|
|
127
|
+
T,
|
|
128
|
+
I,
|
|
133
129
|
s,
|
|
134
|
-
|
|
130
|
+
P,
|
|
135
131
|
u,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
o.calldataHash,
|
|
133
|
+
p,
|
|
134
|
+
U,
|
|
135
|
+
c,
|
|
140
136
|
w,
|
|
141
137
|
void 0,
|
|
142
138
|
m,
|
|
139
|
+
l,
|
|
143
140
|
f,
|
|
144
|
-
p,
|
|
145
141
|
y,
|
|
146
142
|
z
|
|
147
143
|
);
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
tokenNumber:
|
|
151
|
-
nullifierAmount:
|
|
144
|
+
h.log({ circomData: _ });
|
|
145
|
+
const x = {
|
|
146
|
+
tokenNumber: a.length,
|
|
147
|
+
nullifierAmount: a[0].length,
|
|
152
148
|
outputAmount: n[0].length
|
|
153
149
|
};
|
|
154
|
-
return { zkCallData:
|
|
150
|
+
return { zkCallData: L, circomData: _, dimData: x, encryptedOutputs: g };
|
|
155
151
|
};
|
|
156
152
|
export {
|
|
157
|
-
|
|
153
|
+
Zt as constructZkProof
|
|
158
154
|
};
|
|
@@ -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 re=require("../../constants/chains.constants.cjs");require("../../constants/server.constants.cjs");require("../../
|
|
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 re=require("../../constants/chains.constants.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");require("../../constants/token-data/index.cjs");const i=require("@solana/web3.js"),o=require("../pre-transaction/solana.cjs");require("@solana/spl-token");require("ethers-v6h");require("tweetnacl");require("bs58");require("@coral-xyz/anchor");require("buffer");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(q,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),g=r.map(e=>e.map(t=>t.getConstructableParams())),{inCommitmentSiblings:N,inCommitmentSiblingSides:$,accessTokenSiblings:j,accessTokenSiblingSides:D,rootHashHinkal:V,rootHashAccessToken:E}=await le.getMerkleTreeSiblingsAndRootHashes(m,c,g,C,L,S,d,H),F=await se.performTaskWithWorker({type:ce.WorkerVariant.ZKProof,payload:{type:me.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:g,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,q),[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;
|
|
@@ -5,7 +5,7 @@ import { DimDataType } from '../../types/circom-data.types';
|
|
|
5
5
|
import { MerkleTree } from '../../data-structures/merkle-tree';
|
|
6
6
|
import { UserKeys } from '../../data-structures/crypto-keys/keys';
|
|
7
7
|
import { Program } from '@coral-xyz/anchor';
|
|
8
|
-
export declare const constructSolanaZkProof: (generateProofRemotely: boolean, originalDeployer: string, merkleTreeHinkal: MerkleTree<bigint>, merkleTreeAccessToken: MerkleTree<bigint>, userKeys: UserKeys, hinkalProgram: Program, mintAddresses: string[], inputUtxosArray: Utxo[][], outputUtxosArray: Utxo[][], extraRandomization: bigint, relayerFee: bigint, variableRate: bigint, recipientAddress: string, signerAddress: string, dimensions: DimDataType, encryptedOutputs: number[][], chainId?: number, patchAccessTokenMerkleTree?: boolean, onChainCreation?: boolean[], instructions?: HinkalInstruction[], remainingAccounts?: AccountMeta[], hasLocalTrees?: boolean) => Promise<{
|
|
8
|
+
export declare const constructSolanaZkProof: (generateProofRemotely: boolean, originalDeployer: string, merkleTreeHinkal: MerkleTree<bigint>, merkleTreeAccessToken: MerkleTree<bigint>, userKeys: UserKeys, hinkalProgram: Program, mintAddresses: string[], inputUtxosArray: Utxo[][], outputUtxosArray: Utxo[][], extraRandomization: bigint, relayerFee: bigint, variableRate: bigint, recipientAddress: string, signerAddress: string, dimensions: DimDataType, encryptedOutputs: number[][], chainId?: number, patchAccessTokenMerkleTree?: boolean, onChainCreation?: boolean[], swapperAccountSalt?: bigint, instructions?: HinkalInstruction[], remainingAccounts?: AccountMeta[], hasLocalTrees?: boolean) => Promise<{
|
|
9
9
|
proofAArr: number[];
|
|
10
10
|
proofBArr: number[];
|
|
11
11
|
proofCArr: number[];
|