@hinkal/common 0.2.17 → 0.2.19
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 +8 -13
- package/API/API.mjs +86 -94
- 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/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/getWebsiteURL.d.ts +1 -1
- package/API/index.d.ts +0 -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 +2 -2
- package/API/proxyAccountsCalls.mjs +19 -19
- 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/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 +1 -1
- package/API/unspent-utxos-calls.mjs +15 -18
- package/README.md +237 -61
- 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 +0 -5
- package/constants/chains.constants.mjs +21 -26
- 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/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/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +2 -0
- package/constants/mediaUrls.constants.mjs +3 -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 +14 -122
- package/constants/server.constants.mjs +44 -152
- 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/popularTokens.constants.cjs +1 -1
- package/constants/token-data/popularTokens.constants.mjs +0 -1
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +36 -13
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +34 -49
- package/data-structures/Hinkal/Hinkal.mjs +238 -301
- package/data-structures/Hinkal/IHinkal.d.ts +33 -48
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +42 -42
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +25 -23
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +9 -9
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +95 -93
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +147 -133
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +1 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +107 -115
- 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 +34 -33
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.d.ts +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +26 -24
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +8 -9
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +4 -3
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +86 -97
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +146 -146
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +2 -3
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +38 -38
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +57 -56
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -58
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +83 -79
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +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 +67 -64
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +75 -87
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.d.ts +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +55 -58
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +80 -82
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.d.ts +2 -2
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +87 -90
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +105 -53
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.mjs +7 -7
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +8 -8
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +10 -10
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +25 -40
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +10 -11
- 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/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +1 -0
- package/data-structures/event-service/evm/AbstractEventService.mjs +7 -4
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +0 -1
- 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 +3 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +17 -14
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +1 -0
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +9 -6
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +0 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +1 -2
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +3 -2
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +42 -45
- 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 +3 -4
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +3 -4
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +3 -4
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +3 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +3 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +2 -4
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +3 -4
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +1 -7
- package/data-structures/utxo/Utxo.mjs +26 -36
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +3 -0
- package/error-handling/error-codes.constants.mjs +5 -2
- 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/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/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 +60 -51
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +3 -5
- package/functions/private-wallet/emporium.helpers.mjs +95 -135
- 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 +2 -2
- package/functions/snarkjs/constructEmporiumProof.mjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +2 -3
- 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 +54 -59
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +11 -10
- package/functions/snarkjs/generateCircomData.d.ts +1 -1
- 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/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- package/functions/utils/enum.utils.cjs +1 -0
- package/functions/utils/enum.utils.mjs +14 -0
- 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/get-hinkal-approvals.cjs +1 -1
- package/functions/utils/get-hinkal-approvals.d.ts +1 -1
- package/functions/utils/get-hinkal-approvals.mjs +16 -16
- package/functions/utils/getDataFromTransaction.d.ts +3 -3
- 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/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 +0 -6
- package/functions/utils/prepareHinkal.mjs +41 -60
- 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 +1 -16
- package/functions/utils/walletBalances.utils.mjs +4 -35
- 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 +114 -121
- package/functions/web3/events/getInputUtxosEnclave.d.ts +1 -1
- 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 +7 -7
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +7 -7
- 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 +71 -63
- 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/recoverTransactionFromError.cjs +1 -0
- package/functions/web3/functionCalls/recoverTransactionFromError.d.ts +2 -0
- package/functions/web3/functionCalls/recoverTransactionFromError.mjs +23 -0
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +45 -36
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.mjs +44 -43
- 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 +8 -8
- 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 +937 -967
- package/package.json +2 -2
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +10 -17
- package/providers/EthersProviderAdapter.mjs +48 -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 +6 -7
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +5 -5
- package/types/TransactionSimulator.types.d.ts +2 -9
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +3 -7
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +0 -1
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +2 -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 +1 -8
- package/types/ethereum-network.types.mjs +1 -1
- 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 +1 -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 +1 -0
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +8 -39
- package/types/sandbox.types.mjs +2 -2
- package/types/session.types.d.ts +2 -0
- package/types/solana.types.d.ts +3 -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/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +6 -4
- package/types/transactions.types.mjs +4 -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 +1 -1
- 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/staking/index.cjs +0 -1
- package/functions/staking/index.d.ts +0 -11
- package/functions/staking/index.mjs +0 -42
- 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,149 +1,151 @@
|
|
|
1
|
-
import { zeroAddress as
|
|
2
|
-
import { outputUtxoProcessing as
|
|
3
|
-
import { constructZkProof as
|
|
4
|
-
import { addPaddingToUtxos as
|
|
5
|
-
import { transactCallDirect as
|
|
6
|
-
import { Utxo as
|
|
7
|
-
import { transactionErrorCodes as
|
|
1
|
+
import { zeroAddress as P } from "../../constants/protocol.constants.mjs";
|
|
2
|
+
import { outputUtxoProcessing as H } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
3
|
+
import { constructZkProof as K } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
4
|
+
import { addPaddingToUtxos as z } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
5
|
+
import { transactCallDirect as M } from "../../functions/web3/functionCalls/transactCallDirect.mjs";
|
|
6
|
+
import { Utxo as D } from "../utxo/Utxo.mjs";
|
|
7
|
+
import { transactionErrorCodes as B } from "../../error-handling/error-codes.constants.mjs";
|
|
8
8
|
import "../../types/circom-data.types.mjs";
|
|
9
|
-
import { ContractType as
|
|
9
|
+
import { ContractType as C } from "../../types/ethereum-network.types.mjs";
|
|
10
10
|
import "../../types/transactions.types.mjs";
|
|
11
|
-
import { AdminTransactionType as
|
|
11
|
+
import { AdminTransactionType as E } from "../../types/admin.types.mjs";
|
|
12
12
|
import "../../types/activities.types.mjs";
|
|
13
13
|
import { getSignatureDataForTransact as F } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
|
|
14
14
|
import { isValidPrivateAddress as N } from "../../functions/utils/addresses.mjs";
|
|
15
15
|
import { shouldPatchAccessTokenMerkleTree as O } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
|
|
16
16
|
import { getCurrentTimeInSeconds as $ } from "../../functions/utils/time.utils.mjs";
|
|
17
|
-
import { emitTxPublicData as
|
|
18
|
-
import { constructAdminData as
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
import { emitTxPublicData as I } from "../../API/admin-calls.mjs";
|
|
18
|
+
import { constructAdminData as S } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
19
|
+
import { validateAndGetChainId as U } from "../../functions/utils/token-check.utils.mjs";
|
|
20
|
+
const R = async (t, a, e, o) => {
|
|
21
|
+
const { patchAccessTokenMerkleTree: r, kycRequired: s, hasAccessToken: A } = await O(
|
|
21
22
|
t,
|
|
22
|
-
|
|
23
|
-
e
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
a,
|
|
24
|
+
e,
|
|
25
|
+
o
|
|
26
|
+
), n = void 0, l = await t.getEthereumAddress(), d = await F(
|
|
27
|
+
a,
|
|
28
|
+
l,
|
|
27
29
|
t.userKeys,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
),
|
|
30
|
+
s,
|
|
31
|
+
A
|
|
32
|
+
), c = {
|
|
31
33
|
externalActionId: 0n,
|
|
32
34
|
externalAddress: await t.getEthereumAddress(),
|
|
33
35
|
externalActionMetadata: "0x00"
|
|
34
36
|
};
|
|
35
37
|
return {
|
|
36
|
-
signatureData:
|
|
37
|
-
externalActionData:
|
|
38
|
-
contractTransaction:
|
|
39
|
-
contractToApprove:
|
|
40
|
-
patchAccessTokenMerkleTree:
|
|
38
|
+
signatureData: d,
|
|
39
|
+
externalActionData: c,
|
|
40
|
+
contractTransaction: n,
|
|
41
|
+
contractToApprove: n,
|
|
42
|
+
patchAccessTokenMerkleTree: r
|
|
41
43
|
};
|
|
42
|
-
},
|
|
43
|
-
const o =
|
|
44
|
-
for (let
|
|
45
|
-
const { outputUtxos:
|
|
46
|
-
|
|
44
|
+
}, st = async (t, a, e) => {
|
|
45
|
+
const o = U(a), r = a.map((i) => i.erc20TokenAddress), { externalActionData: s, contractTransaction: A, contractToApprove: n, patchAccessTokenMerkleTree: l, signatureData: d } = await R(t, o, r, e), c = [...await z(t, o, r, e)], x = `swapperM${e.length.toString()}x${c[0].length}x1`, m = [], u = $().toString();
|
|
46
|
+
for (let i = 0; i < r.length; i += 1) {
|
|
47
|
+
const { outputUtxos: w } = H(t.userKeys, c[i], e[i], u);
|
|
48
|
+
m.push(w);
|
|
47
49
|
}
|
|
48
|
-
const { zkCallData:
|
|
50
|
+
const { zkCallData: y, circomData: T, dimData: v } = await K(
|
|
49
51
|
"v1x1",
|
|
50
|
-
t.
|
|
51
|
-
t.
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
t.merkleTreeHinkalByChain[o],
|
|
53
|
+
t.merkleTreeAccessTokenByChain[o],
|
|
54
|
+
c,
|
|
55
|
+
m,
|
|
54
56
|
t.userKeys,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
x,
|
|
58
|
+
s.externalActionId,
|
|
59
|
+
s.externalAddress,
|
|
60
|
+
s.externalActionMetadata,
|
|
59
61
|
t.generateProofRemotely,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
void 0,
|
|
62
|
+
P,
|
|
63
|
+
o,
|
|
63
64
|
void 0,
|
|
64
65
|
void 0,
|
|
65
66
|
void 0,
|
|
66
|
-
|
|
67
|
+
l,
|
|
67
68
|
void 0,
|
|
68
69
|
void 0,
|
|
69
70
|
void 0,
|
|
70
|
-
t.getContractWithFetcher(
|
|
71
|
-
|
|
72
|
-
),
|
|
71
|
+
t.getContractWithFetcher(o, C.HinkalHelperContract),
|
|
72
|
+
d
|
|
73
|
+
), f = await M(
|
|
73
74
|
t,
|
|
75
|
+
o,
|
|
74
76
|
e,
|
|
75
77
|
// for volotile tokens: amountChanges != amountOfTokenToApprove
|
|
76
|
-
|
|
78
|
+
a,
|
|
79
|
+
y,
|
|
77
80
|
T,
|
|
78
|
-
g,
|
|
79
81
|
v,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
),
|
|
83
|
-
|
|
84
|
-
t.getCurrentChainId(),
|
|
82
|
+
n,
|
|
83
|
+
A
|
|
84
|
+
), g = S(
|
|
85
|
+
E.Onboarding,
|
|
85
86
|
o,
|
|
87
|
+
r,
|
|
86
88
|
e,
|
|
87
89
|
await t.getEthereumAddress()
|
|
88
90
|
);
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
const r = s.map((
|
|
91
|
+
return I(g), f;
|
|
92
|
+
}, it = async (t, a, e, o) => {
|
|
93
|
+
const r = U(a), s = a.map((p) => p.erc20TokenAddress), [A, n, l] = o.split(",");
|
|
92
94
|
if (!N(o))
|
|
93
|
-
throw Error(
|
|
94
|
-
const
|
|
95
|
-
new
|
|
96
|
-
new
|
|
97
|
-
]),
|
|
98
|
-
new
|
|
99
|
-
amount: e[
|
|
100
|
-
erc20TokenAddress:
|
|
101
|
-
randomization: BigInt(
|
|
102
|
-
stealthAddress:
|
|
103
|
-
encryptionKey:
|
|
95
|
+
throw Error(B.RECIPIENT_FORMAT_INCORRECT);
|
|
96
|
+
const d = s.map((p) => [
|
|
97
|
+
new D({ amount: 0n, erc20TokenAddress: p, shieldedPrivateKey: t.userKeys.getShieldedPrivateKey() }),
|
|
98
|
+
new D({ amount: 0n, erc20TokenAddress: p, shieldedPrivateKey: t.userKeys.getShieldedPrivateKey() })
|
|
99
|
+
]), c = `swapperM${e.length.toString()}x${d[0].length}x1`, x = s.map((p, h) => [
|
|
100
|
+
new D({
|
|
101
|
+
amount: e[h],
|
|
102
|
+
erc20TokenAddress: p,
|
|
103
|
+
randomization: BigInt(A),
|
|
104
|
+
stealthAddress: n,
|
|
105
|
+
encryptionKey: l
|
|
104
106
|
})
|
|
105
|
-
]), { externalActionData:
|
|
107
|
+
]), { externalActionData: m, contractTransaction: u, contractToApprove: y, patchAccessTokenMerkleTree: T } = await R(t, r, s, e), { zkCallData: v, circomData: f, dimData: g } = await K(
|
|
106
108
|
"v1x1",
|
|
107
|
-
t.
|
|
108
|
-
t.
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
t.merkleTreeHinkalByChain[r],
|
|
110
|
+
t.merkleTreeAccessTokenByChain[r],
|
|
111
|
+
d,
|
|
112
|
+
x,
|
|
111
113
|
t.userKeys,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
c,
|
|
115
|
+
m.externalActionId,
|
|
116
|
+
m.externalAddress,
|
|
117
|
+
m.externalActionMetadata,
|
|
116
118
|
t.generateProofRemotely,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
void 0,
|
|
119
|
+
P,
|
|
120
|
+
r,
|
|
120
121
|
void 0,
|
|
121
122
|
void 0,
|
|
122
123
|
void 0,
|
|
123
|
-
|
|
124
|
+
T,
|
|
124
125
|
void 0,
|
|
125
126
|
void 0,
|
|
126
127
|
void 0,
|
|
127
|
-
t.getContractWithFetcher(
|
|
128
|
-
),
|
|
128
|
+
t.getContractWithFetcher(r, C.HinkalHelperContract)
|
|
129
|
+
), i = await M(
|
|
129
130
|
t,
|
|
131
|
+
r,
|
|
130
132
|
e,
|
|
131
|
-
|
|
133
|
+
a,
|
|
132
134
|
v,
|
|
135
|
+
f,
|
|
136
|
+
g,
|
|
133
137
|
y,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
), f = E(
|
|
138
|
-
K.PaymentLink,
|
|
139
|
-
t.getCurrentChainId(),
|
|
138
|
+
u
|
|
139
|
+
), w = S(
|
|
140
|
+
E.PaymentLink,
|
|
140
141
|
r,
|
|
142
|
+
s,
|
|
141
143
|
e,
|
|
142
144
|
await t.getEthereumAddress()
|
|
143
145
|
);
|
|
144
|
-
return
|
|
146
|
+
return I(w), i;
|
|
145
147
|
};
|
|
146
148
|
export {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
st as hinkalDeposit,
|
|
150
|
+
it as hinkalDepositForOther
|
|
149
151
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("ethers"),K=require("../../constants/protocol.constants.cjs"),j=require("../../error-handling/error-codes.constants.cjs"),V=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),B=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),X=require("../../functions/web3/events/getShieldedBalance.cjs"),Y=require("../../functions/web3/functionCalls/transactCallDirect.cjs"),J=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),H=require("../../types/external-action.types.cjs"),Q=require("../utxo/Utxo.cjs");require("../../types/circom-data.types.cjs");const k=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");const W=require("../../types/admin.types.cjs");require("../../types/activities.types.cjs");const z=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),Z=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),I=require("../../functions/utils/time.utils.cjs"),tt=require("../../functions/utils/getUtxosFromReceipt.utils.cjs"),et=require("../../functions/pre-transaction/getFeeStructure.cjs"),rt=require("../../functions/utils/fees.utils.cjs"),st=require("../../API/unspent-utxos-calls.cjs"),ot=require("../../functions/utils/addresses.cjs"),$=require("../../functions/pre-transaction/constructAdminData.cjs"),at=require("../../API/admin-calls.cjs"),nt=require("../../functions/utils/token-check.utils.cjs"),ct=async(t,e,u,c,A,m,d)=>{const s=u.erc20TokenAddress,a=await t.getEthereumAddress(),o=c.map(r=>r+rt.calculateTotalFee(r,m)),i=[s],l=[0n],T=[!0],{patchAccessTokenMerkleTree:p,kycRequired:v,hasAccessToken:P}=await Z.shouldPatchAccessTokenMerkleTree(t,e,i,l),S=await z.getSignatureDataForTransact(e,a,t.userKeys,v,P),n=[...await X.addPaddingToUtxos(t,e,i,l)],g=[];for(let r=0;r<n.length;r+=1){const{outputUtxos:C}=V.outputUtxoProcessing(t.userKeys,n[r],l[r]);g.push(C)}const x=o.reduce((r,C)=>r+C,0n),h=G.ethers.utils.defaultAbiCoder.encode(["uint256[]"],[o]),D=t.getContractWithSigner(e,k.ContractType.HinkalWrapper),q=t.getContractWithSigner(e,k.ContractType.DepositOnChainUtxos),{zkCallData:w,circomData:E,dimData:R}=await B.constructZkProof("v1x1",t.merkleTreeHinkalByChain[e],t.merkleTreeAccessTokenByChain[e],n,g,t.userKeys,`swapperM1x${n[0].length}x1`,H.ExternalActionId.DepositOnChainUtxos,q.address,h,t.generateProofRemotely,K.zeroAddress,e,T,void 0,void 0,p,void 0,void 0,void 0,t.getContractWithFetcher(e,k.ContractType.HinkalHelperContract),S,D.address,!1),M=await(await Y.transactCallDirect(t,e,x,u,w,E,R,q,D)).wait(),U=tt.getUtxosFromReceipt(M,t,e,s),f=[],y=[...U];A.forEach((r,C)=>{const F=o[C],_=y.find(N=>N.amount===F);if(!_)throw new Error(`Could not find newly created UTXO with amount ${F} for recipient ${r}.`);f.push({recipientAddress:r,utxo:_});const L=y.indexOf(_);y.splice(L,1)}),await st.storeUnspentUtxos({hashedEthereumAddress:d,chainId:e,utxos:U});const O=$.constructAdminData(W.AdminTransactionType.DepositOnChainUtxos,e,i,[x],a);return at.emitTxPublicData(O),f},it=async(t,e,u,c,A,m,d)=>{if(c.length===0)throw new Error("userDepositedUtxos must not be empty");const s=u.erc20TokenAddress,a=await t.getRandomRelay(e);if(!a)throw Error(j.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const o=await t.getEthereumAddress(),i=I.getCurrentTimeInSeconds().toString(),l=t.generateProofRemotely?5:1,T=[];for(let p=0;p<c.length;p+=l){const v=c.slice(p,p+l),P=await Promise.all(v.map(async({recipientAddress:S,utxo:n})=>{const g=[-n.amount],x=new Q.Utxo({amount:0n,erc20TokenAddress:s,shieldedPrivateKey:t.userKeys.getShieldedPrivateKey(),timeStamp:i,tokenId:0}),h=[[n,x]],D=[[x]],q=`swapperM1x${h[0].length}x1`,w={externalActionId:0n,externalAddress:S,externalActionMetadata:"0x00"},{patchAccessTokenMerkleTree:E,kycRequired:R,hasAccessToken:b}=await Z.shouldPatchAccessTokenMerkleTree(t,e,[s],g),M=await z.getSignatureDataForTransact(e,o,t.userKeys,R,b),U=$.constructAdminData(W.AdminTransactionType.WithdrawOnChainUtxos,e,[s],[-n.amount],o),{zkCallData:f,circomData:y,dimData:O}=await B.constructZkProof("v1x1",t.merkleTreeHinkalByChain[e],t.merkleTreeAccessTokenByChain[e],h,D,t.userKeys,q,w.externalActionId,w.externalAddress,w.externalActionMetadata,t.generateProofRemotely,a??K.zeroAddress,e,void 0,void 0,void 0,E,void 0,void 0,A,t.getContractWithFetcher(e,k.ContractType.HinkalHelperContract),M,void 0,!1);return{zkCallData:f,dimData:O,circomData:y,adminData:U}}));T.push(...P)}return J.transactCallRelayerBatch(e,T,m,d)},ut=async(t,e,u,c,A,m)=>{const d=e.erc20TokenAddress,s=nt.validateAndGetChainId([e]),a=ot.hashEthereumAddress(await t.getEthereumAddress()),o=m??await et.getFeeStructure(s,d,[d],H.ExternalActionId.Transact),i=await ct(t,s,e,u,c,o,a);return it(t,s,e,i,o,a,A)};exports.hinkalDepositAndWithdraw=ut;
|
|
@@ -1,188 +1,202 @@
|
|
|
1
|
-
import { ethers as
|
|
2
|
-
import { zeroAddress as
|
|
3
|
-
import { transactionErrorCodes as
|
|
4
|
-
import { outputUtxoProcessing as
|
|
5
|
-
import { constructZkProof as
|
|
6
|
-
import { addPaddingToUtxos as
|
|
7
|
-
import { transactCallDirect as
|
|
8
|
-
import { transactCallRelayerBatch as
|
|
9
|
-
import { ExternalActionId as
|
|
10
|
-
import { Utxo as
|
|
1
|
+
import { ethers as G } from "ethers";
|
|
2
|
+
import { zeroAddress as W } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { transactionErrorCodes as V } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import { outputUtxoProcessing as X } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
5
|
+
import { constructZkProof as F } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
6
|
+
import { addPaddingToUtxos as Y } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
7
|
+
import { transactCallDirect as j } from "../../functions/web3/functionCalls/transactCallDirect.mjs";
|
|
8
|
+
import { transactCallRelayerBatch as J } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
9
|
+
import { ExternalActionId as z } from "../../types/external-action.types.mjs";
|
|
10
|
+
import { Utxo as Q } from "../utxo/Utxo.mjs";
|
|
11
11
|
import "../../types/circom-data.types.mjs";
|
|
12
|
-
import { ContractType as
|
|
12
|
+
import { ContractType as E } from "../../types/ethereum-network.types.mjs";
|
|
13
13
|
import "../../types/transactions.types.mjs";
|
|
14
|
+
import { AdminTransactionType as $ } from "../../types/admin.types.mjs";
|
|
14
15
|
import "../../types/activities.types.mjs";
|
|
15
|
-
import { getSignatureDataForTransact as
|
|
16
|
-
import { shouldPatchAccessTokenMerkleTree as
|
|
17
|
-
import { getCurrentTimeInSeconds as
|
|
18
|
-
import { getUtxosFromReceipt as
|
|
19
|
-
import { getFeeStructure as
|
|
20
|
-
import { calculateTotalFee as
|
|
21
|
-
import { storeUnspentUtxos as
|
|
22
|
-
import { hashEthereumAddress as
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
import { getSignatureDataForTransact as q } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
|
|
17
|
+
import { shouldPatchAccessTokenMerkleTree as L } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
|
|
18
|
+
import { getCurrentTimeInSeconds as I } from "../../functions/utils/time.utils.mjs";
|
|
19
|
+
import { getUtxosFromReceipt as tt } from "../../functions/utils/getUtxosFromReceipt.utils.mjs";
|
|
20
|
+
import { getFeeStructure as et } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
21
|
+
import { calculateTotalFee as ot } from "../../functions/utils/fees.utils.mjs";
|
|
22
|
+
import { storeUnspentUtxos as rt } from "../../API/unspent-utxos-calls.mjs";
|
|
23
|
+
import { hashEthereumAddress as st } from "../../functions/utils/addresses.mjs";
|
|
24
|
+
import { constructAdminData as N } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
25
|
+
import { emitTxPublicData as at } from "../../API/admin-calls.mjs";
|
|
26
|
+
import { validateAndGetChainId as nt } from "../../functions/utils/token-check.utils.mjs";
|
|
27
|
+
const it = async (t, e, m, i, A, l, d) => {
|
|
28
|
+
const r = m.erc20TokenAddress, a = await t.getEthereumAddress(), s = i.map((o) => o + ot(o, l)), c = [r], p = [0n], C = [!0], { patchAccessTokenMerkleTree: u, kycRequired: R, hasAccessToken: P } = await L(
|
|
25
29
|
t,
|
|
30
|
+
e,
|
|
26
31
|
c,
|
|
27
|
-
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
p
|
|
33
|
+
), S = await q(
|
|
34
|
+
e,
|
|
35
|
+
a,
|
|
31
36
|
t.userKeys,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
),
|
|
35
|
-
for (let
|
|
36
|
-
const { outputUtxos:
|
|
37
|
-
|
|
37
|
+
R,
|
|
38
|
+
P
|
|
39
|
+
), n = [...await Y(t, e, c, p)], g = [];
|
|
40
|
+
for (let o = 0; o < n.length; o += 1) {
|
|
41
|
+
const { outputUtxos: y } = X(t.userKeys, n[o], p[o]);
|
|
42
|
+
g.push(y);
|
|
38
43
|
}
|
|
39
|
-
const
|
|
40
|
-
zkCallData:
|
|
41
|
-
circomData:
|
|
42
|
-
dimData:
|
|
43
|
-
} = await
|
|
44
|
+
const w = s.reduce((o, y) => o + y, 0n), h = G.utils.defaultAbiCoder.encode(["uint256[]"], [s]), T = t.getContractWithSigner(e, E.HinkalWrapper), D = t.getContractWithSigner(e, E.DepositOnChainUtxos), {
|
|
45
|
+
zkCallData: x,
|
|
46
|
+
circomData: k,
|
|
47
|
+
dimData: O
|
|
48
|
+
} = await F(
|
|
44
49
|
"v1x1",
|
|
45
|
-
t.
|
|
46
|
-
t.
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
t.merkleTreeHinkalByChain[e],
|
|
51
|
+
t.merkleTreeAccessTokenByChain[e],
|
|
52
|
+
n,
|
|
53
|
+
g,
|
|
49
54
|
t.userKeys,
|
|
50
|
-
`swapperM1x${
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
`swapperM1x${n[0].length}x1`,
|
|
56
|
+
z.DepositOnChainUtxos,
|
|
57
|
+
D.address,
|
|
58
|
+
h,
|
|
54
59
|
t.generateProofRemotely,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
void 0,
|
|
60
|
+
W,
|
|
61
|
+
e,
|
|
62
|
+
C,
|
|
59
63
|
void 0,
|
|
60
64
|
void 0,
|
|
61
|
-
|
|
65
|
+
u,
|
|
62
66
|
void 0,
|
|
63
67
|
void 0,
|
|
64
68
|
void 0,
|
|
65
|
-
t.getContractWithFetcher(
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
t.getContractWithFetcher(e, E.HinkalHelperContract),
|
|
70
|
+
S,
|
|
71
|
+
T.address,
|
|
68
72
|
!1
|
|
69
|
-
), K = await (await
|
|
73
|
+
), K = await (await j(
|
|
70
74
|
t,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
e,
|
|
76
|
+
w,
|
|
77
|
+
m,
|
|
78
|
+
x,
|
|
79
|
+
k,
|
|
80
|
+
O,
|
|
81
|
+
D,
|
|
82
|
+
T
|
|
83
|
+
)).wait(), U = tt(K, t, e, r), v = [], f = [...U];
|
|
84
|
+
A.forEach((o, y) => {
|
|
85
|
+
const B = s[y], H = f.find((_) => _.amount === B);
|
|
81
86
|
if (!H)
|
|
82
|
-
throw new Error(`Could not find newly created UTXO with amount ${
|
|
83
|
-
|
|
84
|
-
recipientAddress:
|
|
87
|
+
throw new Error(`Could not find newly created UTXO with amount ${B} for recipient ${o}.`);
|
|
88
|
+
v.push({
|
|
89
|
+
recipientAddress: o,
|
|
85
90
|
utxo: H
|
|
86
91
|
});
|
|
87
|
-
const
|
|
88
|
-
|
|
92
|
+
const Z = f.indexOf(H);
|
|
93
|
+
f.splice(Z, 1);
|
|
94
|
+
}), await rt({
|
|
95
|
+
hashedEthereumAddress: d,
|
|
96
|
+
chainId: e,
|
|
97
|
+
utxos: U
|
|
89
98
|
});
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
const b = N(
|
|
100
|
+
$.DepositOnChainUtxos,
|
|
101
|
+
e,
|
|
102
|
+
c,
|
|
103
|
+
[w],
|
|
104
|
+
a
|
|
105
|
+
);
|
|
106
|
+
return at(b), v;
|
|
107
|
+
}, ct = async (t, e, m, i, A, l, d) => {
|
|
108
|
+
if (i.length === 0)
|
|
98
109
|
throw new Error("userDepositedUtxos must not be empty");
|
|
99
|
-
const r =
|
|
100
|
-
if (!
|
|
101
|
-
throw Error(
|
|
102
|
-
const
|
|
103
|
-
for (let
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
110
|
+
const r = m.erc20TokenAddress, a = await t.getRandomRelay(e);
|
|
111
|
+
if (!a)
|
|
112
|
+
throw Error(V.RELAYER_NOT_AVAILABLE);
|
|
113
|
+
const s = await t.getEthereumAddress(), c = I().toString(), p = t.generateProofRemotely ? 5 : 1, C = [];
|
|
114
|
+
for (let u = 0; u < i.length; u += p) {
|
|
115
|
+
const R = i.slice(u, u + p), P = await Promise.all(
|
|
116
|
+
R.map(async ({ recipientAddress: S, utxo: n }) => {
|
|
117
|
+
const g = [-n.amount], w = new Q({
|
|
107
118
|
amount: 0n,
|
|
108
119
|
erc20TokenAddress: r,
|
|
109
120
|
shieldedPrivateKey: t.userKeys.getShieldedPrivateKey(),
|
|
110
|
-
timeStamp:
|
|
121
|
+
timeStamp: c,
|
|
111
122
|
tokenId: 0
|
|
112
|
-
}),
|
|
123
|
+
}), h = [[n, w]], T = [[w]], D = `swapperM1x${h[0].length}x1`, x = {
|
|
113
124
|
externalActionId: 0n,
|
|
114
|
-
externalAddress:
|
|
125
|
+
externalAddress: S,
|
|
115
126
|
externalActionMetadata: "0x00"
|
|
116
127
|
}, {
|
|
117
|
-
patchAccessTokenMerkleTree:
|
|
118
|
-
kycRequired:
|
|
119
|
-
hasAccessToken:
|
|
120
|
-
} = await
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
patchAccessTokenMerkleTree: k,
|
|
129
|
+
kycRequired: O,
|
|
130
|
+
hasAccessToken: M
|
|
131
|
+
} = await L(t, e, [r], g), K = await q(
|
|
132
|
+
e,
|
|
133
|
+
s,
|
|
123
134
|
t.userKeys,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
),
|
|
135
|
+
O,
|
|
136
|
+
M
|
|
137
|
+
), U = N(
|
|
138
|
+
$.WithdrawOnChainUtxos,
|
|
139
|
+
e,
|
|
140
|
+
[r],
|
|
141
|
+
[-n.amount],
|
|
142
|
+
s
|
|
143
|
+
), { zkCallData: v, circomData: f, dimData: b } = await F(
|
|
127
144
|
"v1x1",
|
|
128
|
-
t.
|
|
129
|
-
t.
|
|
130
|
-
|
|
145
|
+
t.merkleTreeHinkalByChain[e],
|
|
146
|
+
t.merkleTreeAccessTokenByChain[e],
|
|
147
|
+
h,
|
|
131
148
|
T,
|
|
132
149
|
t.userKeys,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
150
|
+
D,
|
|
151
|
+
x.externalActionId,
|
|
152
|
+
x.externalAddress,
|
|
153
|
+
x.externalActionMetadata,
|
|
137
154
|
t.generateProofRemotely,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
void 0,
|
|
155
|
+
a ?? W,
|
|
156
|
+
e,
|
|
141
157
|
void 0,
|
|
142
158
|
void 0,
|
|
143
159
|
void 0,
|
|
144
|
-
|
|
160
|
+
k,
|
|
145
161
|
void 0,
|
|
146
162
|
void 0,
|
|
147
|
-
|
|
148
|
-
t.getContractWithFetcher(
|
|
149
|
-
|
|
163
|
+
A,
|
|
164
|
+
t.getContractWithFetcher(e, E.HinkalHelperContract),
|
|
165
|
+
K,
|
|
150
166
|
void 0,
|
|
151
167
|
!1
|
|
152
168
|
);
|
|
153
169
|
return {
|
|
154
|
-
zkCallData:
|
|
155
|
-
dimData:
|
|
156
|
-
circomData:
|
|
170
|
+
zkCallData: v,
|
|
171
|
+
dimData: b,
|
|
172
|
+
circomData: f,
|
|
173
|
+
adminData: U
|
|
157
174
|
};
|
|
158
175
|
})
|
|
159
176
|
);
|
|
160
|
-
|
|
177
|
+
C.push(...P);
|
|
161
178
|
}
|
|
162
|
-
return
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
p,
|
|
166
|
-
w
|
|
167
|
-
);
|
|
168
|
-
}, vt = async (t, o, n, u, p, w) => {
|
|
169
|
-
const r = o.erc20TokenAddress, s = t.getCurrentChainId(), c = tt(await t.getEthereumAddress()), a = w ?? await G(s, r, [r], F.Transact), i = await et(
|
|
179
|
+
return J(e, C, l, d);
|
|
180
|
+
}, Mt = async (t, e, m, i, A, l) => {
|
|
181
|
+
const d = e.erc20TokenAddress, r = nt([e]), a = st(await t.getEthereumAddress()), s = l ?? await et(r, d, [d], z.Transact), c = await it(
|
|
170
182
|
t,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
r,
|
|
184
|
+
e,
|
|
185
|
+
m,
|
|
186
|
+
i,
|
|
187
|
+
s,
|
|
188
|
+
a
|
|
176
189
|
);
|
|
177
|
-
return
|
|
190
|
+
return ct(
|
|
178
191
|
t,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
a,
|
|
192
|
+
r,
|
|
193
|
+
e,
|
|
182
194
|
c,
|
|
183
|
-
|
|
195
|
+
s,
|
|
196
|
+
a,
|
|
197
|
+
A
|
|
184
198
|
);
|
|
185
199
|
};
|
|
186
200
|
export {
|
|
187
|
-
|
|
201
|
+
Mt as hinkalDepositAndWithdraw
|
|
188
202
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../API/API.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../API/API.cjs"),o=r=>({async getAccessToken(){return a.API.getZkMeAccessToken()},async getUserAccounts(){return[await r.getEthereumAddress()]},async delegateTransaction(e){const s=await r.getProviderAdapter(),t={...e,chainId:Number(e.chainId),type:e.type?e.type:void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?e.maxPriorityFeePerGas:void 0,maxFeePerGas:e.maxFeePerGas?e.maxFeePerGas:void 0};return(await s.sendTransaction(t)).hash}});exports.getHinkalZkMeProvider=o;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { API as a } from "../../API/API.mjs";
|
|
2
2
|
const d = (r) => ({
|
|
3
3
|
async getAccessToken() {
|
|
4
|
-
|
|
5
|
-
return a.getZkMeAccessToken(e);
|
|
4
|
+
return a.getZkMeAccessToken();
|
|
6
5
|
},
|
|
7
6
|
async getUserAccounts() {
|
|
8
7
|
return [await r.getEthereumAddress()];
|