@hinkal/common 0.2.21 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API/API.cjs +1 -1
- package/API/API.d.ts +14 -14
- package/API/API.mjs +88 -87
- package/API/admin-calls.cjs +1 -1
- package/API/admin-calls.d.ts +1 -1
- package/API/admin-calls.mjs +4 -4
- package/API/ai-calls.cjs +1 -0
- package/API/ai-calls.d.ts +17 -0
- package/API/ai-calls.mjs +21 -0
- package/API/callLifiAPI.cjs +1 -1
- package/API/callLifiAPI.d.ts +1 -1
- package/API/callLifiAPI.mjs +5 -5
- package/API/callMonitor.cjs +1 -1
- package/API/callMonitor.d.ts +1 -1
- package/API/callMonitor.mjs +7 -7
- package/API/callOdosAPI.cjs +1 -1
- package/API/callOdosAPI.mjs +11 -11
- package/API/callOkxAPI.cjs +1 -1
- package/API/callOkxAPI.d.ts +1 -1
- package/API/callOkxAPI.mjs +5 -5
- package/API/callOneInchAPI.cjs +1 -1
- package/API/callOneInchAPI.mjs +11 -10
- package/API/callRelayer.cjs +1 -1
- package/API/callRelayer.d.ts +5 -6
- package/API/callRelayer.mjs +11 -11
- package/API/checkRisk.cjs +1 -1
- package/API/checkRisk.d.ts +1 -1
- package/API/checkRisk.mjs +4 -4
- package/API/deposit-and-withdraw-status-calls.cjs +1 -0
- package/API/deposit-and-withdraw-status-calls.d.ts +20 -0
- package/API/deposit-and-withdraw-status-calls.mjs +18 -0
- package/API/duneAPI.cjs +1 -0
- package/API/duneAPI.d.ts +11 -0
- package/API/duneAPI.mjs +25 -0
- package/API/enclaveCalls.cjs +1 -1
- package/API/enclaveCalls.mjs +4 -5
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.mjs +9 -9
- package/API/get-token-data.cjs +1 -1
- package/API/get-token-data.d.ts +1 -1
- package/API/get-token-data.mjs +5 -5
- package/API/getBridgeProtocols.cjs +1 -0
- package/API/getBridgeProtocols.d.ts +7 -0
- package/API/getBridgeProtocols.mjs +8 -0
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.mjs +9 -9
- package/API/getLifiStatus.cjs +1 -0
- package/API/getLifiStatus.d.ts +24 -0
- package/API/getLifiStatus.mjs +15 -0
- package/API/getRelayerURL.cjs +1 -0
- package/API/getRelayerURL.d.ts +1 -0
- package/API/getRelayerURL.mjs +10 -0
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +3 -3
- package/API/getServerURL.mjs +67 -51
- package/API/getTokenPrice.cjs +1 -1
- package/API/getTokenPrice.d.ts +0 -5
- package/API/getTokenPrice.mjs +7 -14
- package/API/index.d.ts +3 -1
- package/API/is-tx-stateless.cjs +1 -1
- package/API/is-tx-stateless.d.ts +1 -1
- package/API/is-tx-stateless.mjs +12 -10
- package/API/kycCalls.cjs +1 -1
- package/API/kycCalls.d.ts +8 -4
- package/API/kycCalls.mjs +26 -23
- package/API/passwordCalls.cjs +1 -0
- package/API/passwordCalls.d.ts +9 -0
- package/API/passwordCalls.mjs +13 -0
- package/API/proxyAccountsCalls.cjs +1 -1
- package/API/proxyAccountsCalls.d.ts +2 -7
- package/API/proxyAccountsCalls.mjs +21 -27
- package/API/relayCalls.cjs +1 -1
- package/API/relayCalls.mjs +4 -4
- package/API/restoreSnapshots.cjs +1 -0
- package/API/restoreSnapshots.d.ts +1 -0
- package/API/restoreSnapshots.mjs +10 -0
- package/API/scheduled-transactions-calls.cjs +1 -1
- package/API/scheduled-transactions-calls.d.ts +9 -1
- package/API/scheduled-transactions-calls.mjs +9 -5
- package/API/simulate-batch-tx.cjs +1 -1
- package/API/simulate-batch-tx.d.ts +2 -2
- package/API/simulate-batch-tx.mjs +6 -7
- package/API/solana-calls.cjs +1 -1
- package/API/solana-calls.d.ts +3 -6
- package/API/solana-calls.mjs +15 -15
- package/API/temporaryWalletCalls.cjs +1 -1
- package/API/temporaryWalletCalls.mjs +19 -13
- package/API/token-calls.cjs +1 -1
- package/API/token-calls.mjs +5 -6
- package/README.md +64 -256
- package/constants/activity.constants.cjs +1 -1
- package/constants/activity.constants.mjs +0 -1
- package/constants/addresses.constants.cjs +1 -1
- package/constants/addresses.constants.mjs +9 -10
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +6 -0
- package/constants/chains.constants.mjs +52 -58
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +0 -1
- package/constants/coingecko.constants.mjs +10 -11
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.d.ts +3 -3
- package/constants/contracts.constants.mjs +29 -29
- package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-solana.json.mjs +2 -28
- package/constants/function-signatures.constants.cjs +1 -1
- package/constants/function-signatures.constants.d.ts +1 -0
- package/constants/function-signatures.constants.mjs +4 -3
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +40 -39
- package/constants/mediaUrls.constants.cjs +1 -1
- package/constants/mediaUrls.constants.d.ts +0 -1
- package/constants/mediaUrls.constants.mjs +1 -2
- package/constants/permit2.constants.cjs +1 -1
- package/constants/permit2.constants.d.ts +1 -0
- package/constants/permit2.constants.mjs +11 -10
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +123 -19
- package/constants/server.constants.mjs +138 -35
- package/constants/tasks.constants.cjs +1 -1
- package/constants/tasks.constants.mjs +4 -5
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +13 -36
- package/crypto/poseidon.cjs +1 -1
- package/crypto/poseidon.mjs +10 -10
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +86 -83
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +56 -45
- package/data-structures/Hinkal/Hinkal.mjs +348 -315
- package/data-structures/Hinkal/IHinkal.d.ts +56 -42
- package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/data-structures/Hinkal/handleAutoDepositBack.mjs +49 -48
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +7 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +42 -0
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionReceive.mjs +24 -29
- package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
- package/data-structures/Hinkal/hinkalApprove.d.ts +3 -0
- package/data-structures/Hinkal/hinkalApprove.mjs +114 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +19 -20
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +84 -89
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +96 -78
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +79 -75
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +151 -140
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +5 -4
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +4 -0
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +120 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +118 -115
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +29 -30
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -40
- package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +32 -37
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +15 -17
- package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +3 -4
- package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +95 -84
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +180 -154
- package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +3 -2
- package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +40 -43
- package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +67 -71
- package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -63
- package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaSwap.mjs +46 -50
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +50 -52
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +65 -69
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +77 -71
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +70 -72
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +78 -81
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +103 -106
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +54 -108
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.d.ts +0 -1
- package/data-structures/IndexedDB/activity-db.mjs +79 -97
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +39 -43
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +31 -36
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +40 -26
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +82 -82
- package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
- package/data-structures/TokenDBs/token-visibility-db.mjs +36 -22
- package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/data-structures/crypto-keys/decodeUTXO.mjs +45 -45
- package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +28 -27
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +10 -0
- package/data-structures/crypto-keys/keys.mjs +106 -47
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
- package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractEventService.d.ts +2 -4
- package/data-structures/event-service/evm/AbstractEventService.mjs +13 -13
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +2 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +3 -3
- package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +2 -1
- package/data-structures/event-service/evm/AbstractSnapshotService.mjs +6 -2
- package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +5 -10
- package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +40 -40
- package/data-structures/event-service/index.d.ts +0 -4
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +3 -4
- package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
- package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +10 -4
- package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +7 -10
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +2 -3
- package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +2 -2
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +2 -1
- package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +2 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +16 -11
- package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +66 -64
- package/data-structures/index.d.ts +0 -3
- package/data-structures/presale/PresaleContractWrapper.cjs +1 -1
- package/data-structures/presale/PresaleContractWrapper.d.ts +3 -3
- package/data-structures/presale/PresaleContractWrapper.mjs +10 -10
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +16 -11
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +18 -18
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +9 -9
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +4 -5
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +4 -6
- package/error-handling/error-codes.constants.cjs +1 -1
- package/error-handling/error-codes.constants.d.ts +0 -1
- package/error-handling/error-codes.constants.mjs +3 -4
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +27 -22
- package/error-handling/handleErrorRestore.cjs +1 -0
- package/error-handling/handleErrorRestore.d.ts +2 -0
- package/error-handling/handleErrorRestore.mjs +11 -0
- package/error-handling/index.d.ts +1 -0
- package/functions/kyc/authentoHelper.cjs +1 -0
- package/functions/kyc/authentoHelper.d.ts +12 -0
- package/functions/kyc/authentoHelper.mjs +30 -0
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.mjs +16 -17
- package/functions/pre-transaction/constructAdminData.cjs +1 -1
- package/functions/pre-transaction/constructAdminData.d.ts +2 -2
- package/functions/pre-transaction/constructAdminData.mjs +18 -12
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +2 -1
- package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.mjs +2 -3
- package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/functions/pre-transaction/getSolanaCalldataHash.mjs +21 -21
- package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +36 -22
- package/functions/pre-transaction/interaction-to-action.cjs +1 -1
- package/functions/pre-transaction/interaction-to-action.mjs +2 -3
- package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
- package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +9 -1
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +34 -19
- package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/functions/pre-transaction/sendV0Transaction.mjs +50 -53
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +12 -10
- package/functions/private-wallet/emporium.helpers.mjs +139 -102
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.swap.helpers.d.ts +4 -1
- package/functions/private-wallet/emporium.swap.helpers.mjs +106 -103
- package/functions/private-wallet/opProducer.cjs +1 -1
- package/functions/private-wallet/opProducer.mjs +1 -1
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.mjs +21 -18
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.mjs +49 -49
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +11 -10
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +10 -11
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +0 -1
- package/functions/utils/addresses.mjs +11 -12
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.d.ts +1 -1
- package/functions/utils/cacheFunctions.mjs +55 -54
- package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
- package/functions/utils/convertEmporiumOpToCallInfo.mjs +5 -5
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +2 -2
- package/functions/utils/create-provider.mjs +7 -11
- package/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/functions/utils/encryptInputForEnclave.mjs +9 -9
- package/functions/utils/ethers-formatter.utils.d.ts +1 -1
- package/functions/utils/external-action.utils.cjs +1 -1
- package/functions/utils/external-action.utils.mjs +2 -2
- package/functions/utils/get-hinkal-approvals.cjs +1 -0
- package/functions/utils/get-hinkal-approvals.d.ts +3 -0
- package/functions/utils/get-hinkal-approvals.mjs +38 -0
- package/functions/utils/getContractAddress.cjs +1 -0
- package/functions/utils/getContractAddress.d.ts +2 -0
- package/functions/utils/getContractAddress.mjs +9 -0
- package/functions/utils/getDataFromTransaction.cjs +1 -1
- package/functions/utils/getDataFromTransaction.d.ts +0 -11
- package/functions/utils/getDataFromTransaction.mjs +26 -50
- package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/functions/utils/getRecipientInfoFromUserKeys.mjs +1 -1
- package/functions/utils/getSignerFromContract.cjs +1 -0
- package/functions/utils/getSignerFromContract.d.ts +3 -0
- package/functions/utils/getSignerFromContract.mjs +16 -0
- package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +14 -15
- package/functions/utils/inLogicMetadata.cjs +1 -1
- package/functions/utils/inLogicMetadata.mjs +2 -2
- package/functions/utils/index.d.ts +1 -0
- package/functions/utils/involves-permit2-op.cjs +1 -1
- package/functions/utils/involves-permit2-op.d.ts +1 -0
- package/functions/utils/involves-permit2-op.mjs +6 -4
- package/functions/utils/mutexes.utils.cjs +1 -1
- package/functions/utils/mutexes.utils.d.ts +1 -1
- package/functions/utils/mutexes.utils.mjs +3 -3
- package/functions/utils/nftTokenFunctions.cjs +1 -1
- package/functions/utils/nftTokenFunctions.mjs +23 -9
- package/functions/utils/prepareHinkal.cjs +1 -1
- package/functions/utils/prepareHinkal.d.ts +13 -6
- package/functions/utils/prepareHinkal.mjs +72 -45
- package/functions/utils/publicBalance.utils.cjs +1 -1
- package/functions/utils/publicBalance.utils.d.ts +1 -1
- package/functions/utils/publicBalance.utils.mjs +62 -57
- package/functions/utils/replaceAddressInCalldata.cjs +1 -0
- package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
- package/functions/utils/replaceAddressInCalldata.mjs +7 -0
- package/functions/utils/rpc-int-encode.cjs +1 -1
- package/functions/utils/rpc-int-encode.d.ts +1 -2
- package/functions/utils/rpc-int-encode.mjs +3 -6
- package/functions/utils/solanaMint.utils.cjs +1 -1
- package/functions/utils/solanaMint.utils.mjs +6 -6
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +0 -1
- package/functions/utils/string.utils.mjs +14 -18
- package/functions/utils/token-check.utils.cjs +1 -1
- package/functions/utils/token-check.utils.d.ts +0 -3
- package/functions/utils/token-check.utils.mjs +7 -18
- package/functions/utils/upToDateState.cjs +1 -1
- package/functions/utils/upToDateState.d.ts +1 -1
- package/functions/utils/upToDateState.mjs +4 -4
- package/functions/utils/walletBalances.utils.cjs +1 -1
- package/functions/utils/walletBalances.utils.d.ts +17 -2
- package/functions/utils/walletBalances.utils.mjs +36 -5
- package/functions/web3/EIP-712.cjs +1 -1
- package/functions/web3/EIP-712.d.ts +4 -4
- package/functions/web3/EIP-712.mjs +1 -1
- package/functions/web3/etherFunctions.cjs +1 -1
- package/functions/web3/etherFunctions.mjs +32 -29
- package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedCustomHandler.mjs +4 -5
- package/functions/web3/events/balanceChangedHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedHandler.mjs +2 -3
- package/functions/web3/events/getApprovedBalance.cjs +1 -1
- package/functions/web3/events/getApprovedBalance.d.ts +4 -3
- package/functions/web3/events/getApprovedBalance.mjs +44 -39
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -3
- package/functions/web3/events/getInputUtxoAndBalance.mjs +150 -129
- package/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/functions/web3/events/getInputUtxosEnclave.mjs +20 -20
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +75 -73
- package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
- package/functions/web3/events/getTransactionLogEvents.d.ts +3 -3
- package/functions/web3/events/getTransactionLogEvents.mjs +41 -40
- package/functions/web3/events/index.d.ts +0 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.d.ts +1 -2
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +12 -16
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +6 -1
- package/functions/web3/functionCalls/accessTokenCalls.mjs +20 -12
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +68 -69
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/functions/web3/functionCalls/constructBatchCall.d.ts +2 -2
- package/functions/web3/functionCalls/constructBatchCall.mjs +10 -9
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -1
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +29 -0
- package/functions/web3/functionCalls/recoverTransactionFromError.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +47 -39
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +3 -3
- package/functions/web3/functionCalls/transactCallRelayer.mjs +54 -56
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.d.ts +1 -1
- package/functions/web3/getContractMetadata.mjs +21 -16
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +7 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +32 -31
- package/functions/web3/index.d.ts +0 -1
- package/functions/web3/lifiAPI.cjs +1 -1
- package/functions/web3/lifiAPI.d.ts +1 -1
- package/functions/web3/lifiAPI.mjs +12 -12
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.mjs +15 -3
- package/functions/web3/okxAPI.cjs +1 -1
- package/functions/web3/okxAPI.mjs +13 -13
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.mjs +20 -8
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.d.ts +6 -5
- package/functions/web3/runContractFunction.mjs +60 -46
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.d.ts +2 -2
- package/functions/web3/uniswapAPI.mjs +49 -38
- package/index.cjs +1 -1
- package/index.mjs +912 -914
- package/package.json +4 -6
- package/providers/CustomEthersProvider.d.ts +1 -1
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +21 -14
- package/providers/EthersProviderAdapter.mjs +86 -53
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +12 -8
- package/providers/SolanaProviderAdapter.mjs +31 -16
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +20 -14
- package/providers/WagmiProviderAdapter.mjs +126 -91
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.d.ts +2 -2
- package/providers/prepareEthersHinkal.mjs +9 -16
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +9 -17
- package/types/TransactionSimulator.types.d.ts +9 -2
- package/types/activities.types.d.ts +2 -5
- package/types/admin.types.cjs +1 -1
- package/types/admin.types.d.ts +6 -0
- package/types/admin.types.mjs +2 -2
- package/types/balances.types.d.ts +1 -0
- package/types/big-intable.types.d.ts +3 -2
- package/types/bridging.types.d.ts +29 -0
- package/types/cache.types.cjs +1 -1
- package/types/cache.types.d.ts +3 -6
- package/types/cache.types.mjs +1 -1
- package/types/coingecko.types.d.ts +0 -5
- package/types/duneAPI.types.d.ts +9 -0
- package/types/ethereum-network.types.d.ts +10 -11
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +1 -1
- package/types/hinkal.types.mjs +18 -18
- package/types/index.d.ts +2 -2
- package/types/proxy.types.d.ts +3 -6
- package/types/sandbox.types.cjs +1 -1
- package/types/sandbox.types.d.ts +39 -10
- package/types/sandbox.types.mjs +2 -2
- package/types/scheduled-transactions.types.cjs +1 -1
- package/types/scheduled-transactions.types.d.ts +6 -0
- package/types/scheduled-transactions.types.mjs +3 -2
- package/types/session.types.d.ts +0 -2
- package/types/solana.types.d.ts +0 -9
- package/types/token-prices.types.cjs +1 -1
- package/types/token-prices.types.d.ts +0 -7
- package/types/token-prices.types.mjs +2 -4
- package/types/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +2 -3
- package/types/transactions.types.mjs +6 -7
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +1 -1
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/API/get-token-price-chart-data.cjs +0 -1
- package/API/get-token-price-chart-data.d.ts +0 -16
- package/API/get-token-price-chart-data.mjs +0 -13
- package/API/onrampCalls.cjs +0 -1
- package/API/onrampCalls.d.ts +0 -20
- package/API/onrampCalls.mjs +0 -15
- package/API/unspent-utxos-calls.cjs +0 -1
- package/API/unspent-utxos-calls.d.ts +0 -26
- package/API/unspent-utxos-calls.mjs +0 -26
- package/data-structures/AccountActions/AccountActions.cjs +0 -1
- package/data-structures/AccountActions/AccountActions.d.ts +0 -18
- package/data-structures/AccountActions/AccountActions.mjs +0 -78
- package/data-structures/AccountActions/index.d.ts +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.cjs +0 -1
- package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +0 -14
- package/data-structures/BlockchainEvent/BlockchainEvent.mjs +0 -41
- package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +0 -1
- package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +0 -20
- package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +0 -124
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +0 -1
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +0 -15
- package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +0 -64
- package/data-structures/PublicBalance/index.d.ts +0 -2
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +0 -21
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +0 -16
- package/data-structures/event-service/helpers/ClientEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/ClientEventHelper.d.ts +0 -11
- package/data-structures/event-service/helpers/ClientEventHelper.mjs +0 -26
- package/data-structures/event-service/helpers/PollingEventHelper.cjs +0 -1
- package/data-structures/event-service/helpers/PollingEventHelper.d.ts +0 -5
- package/data-structures/event-service/helpers/PollingEventHelper.mjs +0 -14
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +0 -11
- package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +0 -22
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +0 -1
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +0 -6
- package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +0 -16
- package/functions/utils/enum.utils.cjs +0 -1
- package/functions/utils/enum.utils.mjs +0 -14
- package/functions/utils/socket.utils.cjs +0 -1
- package/functions/utils/socket.utils.d.ts +0 -1
- package/functions/utils/socket.utils.mjs +0 -12
- package/functions/web3/crypto.cjs +0 -1
- package/functions/web3/crypto.d.ts +0 -1
- package/functions/web3/crypto.mjs +0 -7
- package/functions/web3/events/web3RetrieveEvents.cjs +0 -1
- package/functions/web3/events/web3RetrieveEvents.d.ts +0 -14
- package/functions/web3/events/web3RetrieveEvents.mjs +0 -9
- package/types/events.types.cjs +0 -1
- package/types/events.types.d.ts +0 -9
- package/types/events.types.mjs +0 -5
- package/types/onramp.types.cjs +0 -1
- package/types/onramp.types.d.ts +0 -58
- package/types/onramp.types.mjs +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("uuid"),g=require("./openDefaultPassportWindow.cjs"),t={verifyMessageText:"Sign this message to prove your ownership of this address and proceed with the identity verification process.",domainName:"Hinkal",type:{Message:[{name:"content",type:"string"},{name:"for",type:"string"},{name:"timestamp",type:"string"},{name:"nonce",type:"string"}]}},l=async(n,r,a)=>{try{const{domainName:e,type:i}=t,s=u.v4(),o=Date.now().toString(),c={name:e},d={content:t.verifyMessageText,for:e,timestamp:o,nonce:s},p=await n.signTypedData(c,i,d),m=await n.getEthereumAddress(),y=`${a}verify/${e}?address=${m}&ts=${o}&nonce=${s}&signature=${p}&levelType=BASIC`;g.openDefaultPassportWindow(y,r,700,510)}catch(e){console.error("authentoHelper error: ",e)}};exports.AUTHENTO=t;exports.authentoKycHandler=l;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
2
|
+
export declare const AUTHENTO: {
|
|
3
|
+
verifyMessageText: string;
|
|
4
|
+
domainName: string;
|
|
5
|
+
type: {
|
|
6
|
+
Message: {
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const authentoKycHandler: (hinkal: IHinkal, shortName: string, onboardURL: string) => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { v4 as g } from "uuid";
|
|
2
|
+
import { openDefaultPassportWindow as f } from "./openDefaultPassportWindow.mjs";
|
|
3
|
+
const o = {
|
|
4
|
+
verifyMessageText: "Sign this message to prove your ownership of this address and proceed with the identity verification process.",
|
|
5
|
+
domainName: "Hinkal",
|
|
6
|
+
type: {
|
|
7
|
+
Message: [
|
|
8
|
+
{ name: "content", type: "string" },
|
|
9
|
+
{ name: "for", type: "string" },
|
|
10
|
+
{ name: "timestamp", type: "string" },
|
|
11
|
+
{ name: "nonce", type: "string" }
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}, l = async (t, r, a) => {
|
|
15
|
+
try {
|
|
16
|
+
const { domainName: e, type: i } = o, n = g(), s = Date.now().toString(), c = { name: e }, m = {
|
|
17
|
+
content: o.verifyMessageText,
|
|
18
|
+
for: e,
|
|
19
|
+
timestamp: s,
|
|
20
|
+
nonce: n
|
|
21
|
+
}, p = await t.signTypedData(c, i, m), d = await t.getEthereumAddress(), y = `${a}verify/${e}?address=${d}&ts=${s}&nonce=${n}&signature=${p}&levelType=BASIC`;
|
|
22
|
+
f(y, r, 700, 510);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error("authentoHelper error: ", e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
o as AUTHENTO,
|
|
29
|
+
l as authentoKycHandler
|
|
30
|
+
};
|
|
@@ -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("../../data-structures/Hinkal/hinkalGetZkMeProvider.cjs"),u=require("./openDefaultPassportWindow.cjs");async function l(e,a){if(e.origin==="https://widget.zk.me"){if(e.data.method==="getUserAccounts"){const t=await a.getUserAccounts();e.source?.postMessage({id:e.data.id,message:"ok",data:t},{targetOrigin:e.origin})}if(e.data.method==="getAccessToken"){const t=await a.getAccessToken();e.source?.postMessage({id:e.data.id,message:"ok",data:t},{targetOrigin:e.origin})}if(e.data.method==="delegateTransaction"){const t=e.data.params;if(a.delegateTransaction){const s=await a.delegateTransaction(t);e.source?.postMessage({id:e.data.id,message:"ok",data:s},{targetOrigin:e.origin})}}}}const m=async(e,a,n,t)=>{const s=k.getHinkalZkMeProvider(e),o=await s.getAccessToken(),i=e.getCurrentChainId(),c=g.ethers.toBeHex(i);window.addEventListener("message",d=>l(d,s));const r=`${n}?mchNo=${t.merchId}&name=HinkalProtocol&chainId=${c}&accessToken=${o}`;u.openDefaultPassportWindow(r,a,700,510)};exports.zkMeKycHandler=m;
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { ethers as
|
|
2
|
-
import { getHinkalZkMeProvider as
|
|
3
|
-
import { openDefaultPassportWindow as
|
|
4
|
-
|
|
5
|
-
async function l(t, e) {
|
|
1
|
+
import { ethers as d } from "ethers";
|
|
2
|
+
import { getHinkalZkMeProvider as m } from "../../data-structures/Hinkal/hinkalGetZkMeProvider.mjs";
|
|
3
|
+
import { openDefaultPassportWindow as k } from "./openDefaultPassportWindow.mjs";
|
|
4
|
+
async function u(t, a) {
|
|
6
5
|
if (t.origin === "https://widget.zk.me") {
|
|
7
6
|
if (t.data.method === "getUserAccounts") {
|
|
8
|
-
const
|
|
7
|
+
const e = await a.getUserAccounts();
|
|
9
8
|
t.source?.postMessage(
|
|
10
9
|
{
|
|
11
10
|
id: t.data.id,
|
|
12
11
|
message: "ok",
|
|
13
|
-
data:
|
|
12
|
+
data: e
|
|
14
13
|
},
|
|
15
14
|
{ targetOrigin: t.origin }
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
17
|
if (t.data.method === "getAccessToken") {
|
|
19
|
-
const
|
|
18
|
+
const e = await a.getAccessToken();
|
|
20
19
|
t.source?.postMessage(
|
|
21
20
|
{
|
|
22
21
|
id: t.data.id,
|
|
23
22
|
message: "ok",
|
|
24
|
-
data:
|
|
23
|
+
data: e
|
|
25
24
|
},
|
|
26
25
|
{ targetOrigin: t.origin }
|
|
27
26
|
);
|
|
28
27
|
}
|
|
29
28
|
if (t.data.method === "delegateTransaction") {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const s = await
|
|
29
|
+
const e = t.data.params;
|
|
30
|
+
if (a.delegateTransaction) {
|
|
31
|
+
const s = await a.delegateTransaction(e);
|
|
33
32
|
t.source?.postMessage(
|
|
34
33
|
{
|
|
35
34
|
id: t.data.id,
|
|
@@ -42,11 +41,11 @@ async function l(t, e) {
|
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
const T = async (t,
|
|
46
|
-
const s =
|
|
47
|
-
window.addEventListener("message", (
|
|
48
|
-
const
|
|
49
|
-
|
|
44
|
+
const T = async (t, a, n, e) => {
|
|
45
|
+
const s = m(t), o = await s.getAccessToken(), i = t.getCurrentChainId(), c = d.toBeHex(i);
|
|
46
|
+
window.addEventListener("message", (g) => u(g, s));
|
|
47
|
+
const r = `${n}?mchNo=${e.merchId}&name=HinkalProtocol&chainId=${c}&accessToken=${o}`;
|
|
48
|
+
k(r, a, 700, 510);
|
|
50
49
|
};
|
|
51
50
|
export {
|
|
52
51
|
T as zkMeKycHandler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../utils/addresses.cjs"),i=(t,o,s,d,m,e,u,a,c)=>{if(!t)return;let r;return e&&(r={tokenIn:{symbol:e[0].symbol,address:e[0].erc20TokenAddress.toLowerCase()},tokenOut:{symbol:e[1].symbol,address:e[1].erc20TokenAddress.toLowerCase()}}),{hashedOwner:A.hashEthereumAddress(m),chainId:o,timestamp:Date.now(),action:t,erc20TokenAddresses:s,erc20TokenAmount:d.map(String),fundApproveAndTransactFundAmounts:u?.map(String),fundApproveAndTransactFundAddresses:a,fundApproveAndTransactEmporiumChanges:c?.map(n=>({token:n.token,amount:String(n.amount)})),swapPair:r}};exports.constructAdminData=i;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AdminDataType, AdminTransactionType } from '../../types/admin.types';
|
|
2
|
-
import { ERC20Token } from '../../types';
|
|
3
|
-
export declare const constructAdminData: (action: AdminTransactionType | undefined, chainId: number, erc20TokenAddresses: string[], amountChanges: bigint[], ethereumAddress: string, swapPairTokens?: ERC20Token[]) => AdminDataType | undefined;
|
|
2
|
+
import { ERC20Token, TokenChanges } from '../../types';
|
|
3
|
+
export declare const constructAdminData: (action: AdminTransactionType | undefined, chainId: number, erc20TokenAddresses: string[], amountChanges: bigint[], ethereumAddress: string, swapPairTokens?: ERC20Token[], fundApproveAndTransactFundAmounts?: bigint[], fundApproveAndTransactFundAddresses?: string[], fundApproveAndTransactEmporiumChanges?: TokenChanges<bigint>[]) => AdminDataType | undefined;
|
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import { hashEthereumAddress as
|
|
2
|
-
const
|
|
3
|
-
if (!
|
|
1
|
+
import { hashEthereumAddress as p } from "../utils/addresses.mjs";
|
|
2
|
+
const i = (e, o, m, d, s, t, u, a, A) => {
|
|
3
|
+
if (!e)
|
|
4
4
|
return;
|
|
5
5
|
let r;
|
|
6
|
-
return
|
|
6
|
+
return t && (r = {
|
|
7
7
|
tokenIn: {
|
|
8
|
-
symbol:
|
|
9
|
-
address:
|
|
8
|
+
symbol: t[0].symbol,
|
|
9
|
+
address: t[0].erc20TokenAddress.toLowerCase()
|
|
10
10
|
},
|
|
11
11
|
tokenOut: {
|
|
12
|
-
symbol:
|
|
13
|
-
address:
|
|
12
|
+
symbol: t[1].symbol,
|
|
13
|
+
address: t[1].erc20TokenAddress.toLowerCase()
|
|
14
14
|
}
|
|
15
15
|
}), {
|
|
16
|
-
hashedOwner:
|
|
16
|
+
hashedOwner: p(s),
|
|
17
17
|
chainId: o,
|
|
18
18
|
timestamp: Date.now(),
|
|
19
|
-
action:
|
|
20
|
-
erc20TokenAddresses:
|
|
19
|
+
action: e,
|
|
20
|
+
erc20TokenAddresses: m,
|
|
21
21
|
erc20TokenAmount: d.map(String),
|
|
22
|
+
fundApproveAndTransactFundAmounts: u?.map(String),
|
|
23
|
+
fundApproveAndTransactFundAddresses: a,
|
|
24
|
+
fundApproveAndTransactEmporiumChanges: A?.map((n) => ({
|
|
25
|
+
token: n.token,
|
|
26
|
+
amount: String(n.amount)
|
|
27
|
+
})),
|
|
22
28
|
swapPair: r
|
|
23
29
|
};
|
|
24
30
|
};
|
|
25
31
|
export {
|
|
26
|
-
|
|
32
|
+
i as constructAdminData
|
|
27
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants/chains.constants.cjs"),n=require("../../types/external-action.types.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants/chains.constants.cjs"),n=require("../../types/external-action.types.cjs"),d=(r,s)=>{const{contractData:t}=a.networkRegistry[r.getCurrentChainId()];let e;switch(s){case n.ExternalActionId.Uniswap:e=t?.uniswapExternalActionAddress;break;case n.ExternalActionId.Odos:e=t?.odosExternalActionInstanceAddress;break;case n.ExternalActionId.OneInch:e=t?.oneInchExternalActionInstanceAddress;break;case n.ExternalActionId.Lifi:e=t?.hinkalAddress;break;default:e=t?.uniswapExternalActionAddress;break}if(!e)throw new Error("No external Address set during swap");return e};exports.getExternalSwapAddress=d;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
1
2
|
import { ExternalActionId } from '../../types/external-action.types';
|
|
2
|
-
export declare const getExternalSwapAddress: (
|
|
3
|
+
export declare const getExternalSwapAddress: (hinkal: IHinkal, externalActionId: ExternalActionId) => string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { networkRegistry as a } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { ExternalActionId as
|
|
3
|
-
const c = (
|
|
4
|
-
const { contractData: r } = a[
|
|
2
|
+
import { ExternalActionId as n } from "../../types/external-action.types.mjs";
|
|
3
|
+
const c = (t, s) => {
|
|
4
|
+
const { contractData: r } = a[t.getCurrentChainId()];
|
|
5
5
|
let e;
|
|
6
|
-
switch (
|
|
7
|
-
case
|
|
6
|
+
switch (s) {
|
|
7
|
+
case n.Uniswap:
|
|
8
8
|
e = r?.uniswapExternalActionAddress;
|
|
9
9
|
break;
|
|
10
|
-
case
|
|
10
|
+
case n.Odos:
|
|
11
11
|
e = r?.odosExternalActionInstanceAddress;
|
|
12
12
|
break;
|
|
13
|
-
case
|
|
13
|
+
case n.OneInch:
|
|
14
14
|
e = r?.oneInchExternalActionInstanceAddress;
|
|
15
15
|
break;
|
|
16
|
-
case
|
|
16
|
+
case n.Lifi:
|
|
17
17
|
e = r?.hinkalAddress;
|
|
18
18
|
break;
|
|
19
19
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const e=require("../../types/hinkal.types.cjs");require("../../types/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const e=require("../../types/hinkal.types.cjs");require("../../types/activities.types.cjs");const i=require("../utils/erc20tokenFunctions.cjs"),O=require("./process-gas-estimates.cjs"),A=require("./interaction-to-action.cjs"),l=async(o,s,c,I,C,k=[])=>{let t;const T=A.getInteractionFromAction(c);if(T===e.INTERACTION.NONE)throw Error("No interaction was choosen");let r;switch(T){case e.INTERACTION.WITHDRAW:t=i.getERC20Token(s[0],o);break;case e.INTERACTION.SWAP:t=i.getERC20Token(s[1],o);break;case e.INTERACTION.CLAIMING:t=i.getERC20Token(s[1],o);break;case e.INTERACTION.EMPORIUM:r=I.findIndex(R=>R>0n),t=i.getERC20Token(s[r],o);break}let n,N;const E=I.length;t&&({priceOfTransactionInToken:n,priceOfTransactionInUSD:N}=await O.processGasEstimates(o,t,c,E,void 0,k));const a=new Array(E).fill(0n);switch(T){case e.INTERACTION.WITHDRAW:a[0]=n||0n;break;case e.INTERACTION.SWAP:a[1]=n||0n;break;case e.INTERACTION.CLAIMING:a[1]=n||0n;break;case e.INTERACTION.EMPORIUM:r!==void 0&&r!==-1&&(a[r]=n||0n);break}return{flatFees:a,priceOfTransactionInToken:n,feeUnit:t,priceOfTransactionInUSD:N}};exports.getFlatFees=l;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "../../types/circom-data.types.mjs";
|
|
2
2
|
import { INTERACTION as e } from "../../types/hinkal.types.mjs";
|
|
3
|
-
import "../../types/transactions.types.mjs";
|
|
4
3
|
import "../../types/activities.types.mjs";
|
|
5
4
|
import { getERC20Token as s } from "../utils/erc20tokenFunctions.mjs";
|
|
6
5
|
import { processGasEstimates as b } from "./process-gas-estimates.mjs";
|
|
7
6
|
import { getInteractionFromAction as l } from "./interaction-to-action.mjs";
|
|
8
|
-
const
|
|
7
|
+
const W = async (r, i, f, m, E, I = []) => {
|
|
9
8
|
let t;
|
|
10
9
|
const c = l(f);
|
|
11
10
|
if (c === e.NONE)
|
|
@@ -53,5 +52,5 @@ const F = async (r, i, f, m, E, I = []) => {
|
|
|
53
52
|
return { flatFees: a, priceOfTransactionInToken: o, feeUnit: t, priceOfTransactionInUSD: k };
|
|
54
53
|
};
|
|
55
54
|
export {
|
|
56
|
-
|
|
55
|
+
W as getFlatFees
|
|
57
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@coral-xyz/anchor"),N=require("ethers"),p=require("../../constants/protocol.constants.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@coral-xyz/anchor"),N=require("ethers"),p=require("../../constants/protocol.constants.cjs"),w=(o,r,a,s,c,d,l,u)=>{const y=new t.BN(c.toString()),i=new t.BN(d.toString()),b=s.reduce((n,e)=>[...n,...new t.BN(e.length).toArray("be",8),...e],[]),g=l.reduce((n,e)=>{const h=[...new t.BN(e.programIndex).toArray("be",1),...new t.BN(e.accountIndexes.length).toArray("be",8),...e.accountIndexes,...new t.BN(e.data.length).toArray("be",8),...e.data];return[...n,...h]},[]),B=u.reduce((n,e)=>[...n,e.isWritable?1:0,...e.pubkey.toBytes()],[]),A=[o.tokenNumber,o.nullifierAmount,o.outputAmount,...r.toBytes(),...a.toBytes(),...b,...y.toArray("be",8),...i.toArray("be",8),...g,...B];return BigInt(N.ethers.sha256(new Uint8Array(A)))%p.CIRCOM_P};exports.getSolanaCalldataHash=w;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { BN as
|
|
2
|
-
import { ethers as
|
|
3
|
-
import { CIRCOM_P as
|
|
4
|
-
const x = (o, r, a, s, c, d,
|
|
5
|
-
const
|
|
6
|
-
(n,
|
|
1
|
+
import { BN as t } from "@coral-xyz/anchor";
|
|
2
|
+
import { ethers as w } from "ethers";
|
|
3
|
+
import { CIRCOM_P as B } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
const x = (o, r, a, s, c, d, y, u) => {
|
|
5
|
+
const b = new t(c.toString()), i = new t(d.toString()), l = s.reduce(
|
|
6
|
+
(n, e) => [...n, ...new t(e.length).toArray("be", 8), ...e],
|
|
7
7
|
[]
|
|
8
|
-
), m =
|
|
9
|
-
const
|
|
10
|
-
...new e
|
|
11
|
-
...new e
|
|
12
|
-
...
|
|
13
|
-
...new e
|
|
14
|
-
...
|
|
8
|
+
), m = y.reduce((n, e) => {
|
|
9
|
+
const p = [
|
|
10
|
+
...new t(e.programIndex).toArray("be", 1),
|
|
11
|
+
...new t(e.accountIndexes.length).toArray("be", 8),
|
|
12
|
+
...e.accountIndexes,
|
|
13
|
+
...new t(e.data.length).toArray("be", 8),
|
|
14
|
+
...e.data
|
|
15
15
|
];
|
|
16
|
-
return [...n, ...
|
|
17
|
-
}, []),
|
|
18
|
-
(n,
|
|
16
|
+
return [...n, ...p];
|
|
17
|
+
}, []), A = u.reduce(
|
|
18
|
+
(n, e) => [...n, e.isWritable ? 1 : 0, ...e.pubkey.toBytes()],
|
|
19
19
|
[]
|
|
20
|
-
),
|
|
20
|
+
), g = [
|
|
21
21
|
o.tokenNumber,
|
|
22
22
|
o.nullifierAmount,
|
|
23
23
|
o.outputAmount,
|
|
24
24
|
...r.toBytes(),
|
|
25
25
|
...a.toBytes(),
|
|
26
|
-
...
|
|
27
|
-
...l.toArray("be", 8),
|
|
26
|
+
...l,
|
|
28
27
|
...b.toArray("be", 8),
|
|
28
|
+
...i.toArray("be", 8),
|
|
29
29
|
...m,
|
|
30
|
-
...
|
|
30
|
+
...A
|
|
31
31
|
];
|
|
32
|
-
return BigInt(
|
|
32
|
+
return BigInt(w.sha256(new Uint8Array(g))) % B;
|
|
33
33
|
};
|
|
34
34
|
export {
|
|
35
35
|
x as getSolanaCalldataHash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");require("../../types/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/chains.constants.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");const q=require("../../error-handling/logger.cjs");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const c=require("../../API/is-tx-stateless.cjs"),f=require("../../data-structures/token-price-fetcher/TokenChecker.cjs"),d=async(s,a,n,o)=>{try{const r=a.map((e,t)=>{const i=n[t];return e&&f.TokenChecker.isPotentiallyVolatile(e)?{tokenAddress:e.erc20TokenAddress,amount:i.toString(),...o!==void 0?{targetAddress:o}:{},originalIndex:t}:null}).filter(e=>e!==null);if(r.length===0)return n;const l=await c.simulateVolatileTokenTransfer(s,r);return n.map((e,t)=>{const i=r.findIndex(u=>u.originalIndex===t);if(i!==-1&&l[i].success){const u=l[i].balanceDifference;return u?BigInt(u):e}return e})}catch(r){return q.Logger.error("Volatile transfer simulation failed:",r),n}};exports.modifyVolatileTokenAmountChanges=d;
|
|
@@ -1,38 +1,52 @@
|
|
|
1
1
|
import "../../error-handling/error-codes.constants.mjs";
|
|
2
2
|
import "ethers";
|
|
3
3
|
import "../../types/circom-data.types.mjs";
|
|
4
|
-
import "../../types/transactions.types.mjs";
|
|
5
4
|
import "../../types/activities.types.mjs";
|
|
5
|
+
import "../../constants/server.constants.mjs";
|
|
6
|
+
import "../../API/getServerURL.mjs";
|
|
7
|
+
import "../../data-structures/http/HttpClient.mjs";
|
|
8
|
+
import "axios";
|
|
9
|
+
import "../../constants/chains.constants.mjs";
|
|
10
|
+
import "circomlibjs-hinkal-fork";
|
|
11
|
+
import "libsodium-wrappers";
|
|
12
|
+
import "process";
|
|
13
|
+
import "buffer";
|
|
6
14
|
import "../../constants/vite.constants.mjs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
15
|
+
import "../../constants/save-depths.mjs";
|
|
16
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
17
|
+
import "../utils/mutexes.utils.mjs";
|
|
18
|
+
import "@coral-xyz/anchor";
|
|
19
|
+
import { Logger as a } from "../../error-handling/logger.mjs";
|
|
20
|
+
import "@solana/web3.js";
|
|
21
|
+
import "../../data-structures/crypto-keys/keys.mjs";
|
|
22
|
+
import { simulateVolatileTokenTransfer as c } from "../../API/is-tx-stateless.mjs";
|
|
23
|
+
import { TokenChecker as u } from "../../data-structures/token-price-fetcher/TokenChecker.mjs";
|
|
24
|
+
const z = async (l, s, i, m) => {
|
|
11
25
|
try {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
return r &&
|
|
26
|
+
const t = s.map((r, e) => {
|
|
27
|
+
const o = i[e];
|
|
28
|
+
return r && u.isPotentiallyVolatile(r) ? {
|
|
15
29
|
tokenAddress: r.erc20TokenAddress,
|
|
16
|
-
amount:
|
|
17
|
-
...
|
|
18
|
-
originalIndex:
|
|
30
|
+
amount: o.toString(),
|
|
31
|
+
...m !== void 0 ? { targetAddress: m } : {},
|
|
32
|
+
originalIndex: e
|
|
19
33
|
} : null;
|
|
20
34
|
}).filter((r) => r !== null);
|
|
21
|
-
if (
|
|
22
|
-
return
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
return
|
|
35
|
+
if (t.length === 0)
|
|
36
|
+
return i;
|
|
37
|
+
const p = await c(l, t);
|
|
38
|
+
return i.map((r, e) => {
|
|
39
|
+
const o = t.findIndex((n) => n.originalIndex === e);
|
|
40
|
+
if (o !== -1 && p[o].success) {
|
|
41
|
+
const n = p[o].balanceDifference;
|
|
42
|
+
return n ? BigInt(n) : r;
|
|
29
43
|
}
|
|
30
44
|
return r;
|
|
31
45
|
});
|
|
32
|
-
} catch (
|
|
33
|
-
return
|
|
46
|
+
} catch (t) {
|
|
47
|
+
return a.error("Volatile transfer simulation failed:", t), i;
|
|
34
48
|
}
|
|
35
49
|
};
|
|
36
50
|
export {
|
|
37
|
-
|
|
51
|
+
z as modifyVolatileTokenAmountChanges
|
|
38
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const e=require("../../types/external-action.types.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const e=require("../../types/external-action.types.cjs"),t=require("../../types/hinkal.types.cjs");require("../../types/activities.types.cjs");const n=r=>r===e.ExternalActionId.Transact?t.INTERACTION.WITHDRAW:[e.ExternalActionId.Uniswap,e.ExternalActionId.Odos,e.ExternalActionId.OneInch].includes(r)?t.INTERACTION.SWAP:r===e.ExternalActionId.Emporium?t.INTERACTION.EMPORIUM:t.INTERACTION.NONE;exports.getInteractionFromAction=n;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "../../types/circom-data.types.mjs";
|
|
2
2
|
import { ExternalActionId as r } from "../../types/external-action.types.mjs";
|
|
3
3
|
import { INTERACTION as t } from "../../types/hinkal.types.mjs";
|
|
4
|
-
import "../../types/transactions.types.mjs";
|
|
5
4
|
import "../../types/activities.types.mjs";
|
|
6
|
-
const
|
|
5
|
+
const p = (o) => o === r.Transact ? t.WITHDRAW : [r.Uniswap, r.Odos, r.OneInch].includes(
|
|
7
6
|
o
|
|
8
7
|
) ? t.SWAP : o === r.Emporium ? t.EMPORIUM : t.NONE;
|
|
9
8
|
export {
|
|
10
|
-
|
|
9
|
+
p as getInteractionFromAction
|
|
11
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../web3/getPublicAddressBalance.cjs"),l=require("./merge-with-fee-structure.cjs"),g=require("../private-wallet/emporium.helpers.cjs"),p=require("../../constants/protocol.constants.cjs"),F=require("../../types/ethereum-network.types.cjs"),T=require("../utils/amounts.utils.cjs"),d=async(r,n,i,c,u,e,o)=>{let t=0n;const a=o<0n?o:0n,s=await m.getPublicAddressBalance(r,e.feeToken,n)+a;s<0?t=e.flatFee:t=T.maxBigInt(e.flatFee-s,0n),t!==0n&&(l.mergeWithFeeStructure(r.getCurrentChainId(),c,u,{...e,flatFee:t}),i.push(g.createTransferToEmporiumOp(e.feeToken===p.zeroAddress?void 0:r.getContractWithFetcher(F.ContractType.ERC20Contract,e.feeToken),n,t,!1)))};exports.mergeWithFeeStructureEmporium=d;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FeeStructure } from '../../types/hinkal.types';
|
|
2
2
|
import { type IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
3
|
-
export declare const mergeWithFeeStructureEmporium: (hinkal: IHinkal,
|
|
3
|
+
export declare const mergeWithFeeStructureEmporium: (hinkal: IHinkal, walletAddress: string, emporiumOps: string[], erc20Addresses: string[], amountChanges: bigint[], feeStructure: FeeStructure, feeTokenChange: bigint) => Promise<void>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { getPublicAddressBalance as
|
|
2
|
-
import { mergeWithFeeStructure as
|
|
3
|
-
import { createTransferToEmporiumOp as
|
|
4
|
-
import { zeroAddress as
|
|
5
|
-
import { ContractType as
|
|
1
|
+
import { getPublicAddressBalance as s } from "../web3/getPublicAddressBalance.mjs";
|
|
2
|
+
import { mergeWithFeeStructure as c } from "./merge-with-fee-structure.mjs";
|
|
3
|
+
import { createTransferToEmporiumOp as T } from "../private-wallet/emporium.helpers.mjs";
|
|
4
|
+
import { zeroAddress as F } from "../../constants/protocol.constants.mjs";
|
|
5
|
+
import { ContractType as g } from "../../types/ethereum-network.types.mjs";
|
|
6
6
|
import { maxBigInt as C } from "../utils/amounts.utils.mjs";
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
...
|
|
12
|
-
flatFee:
|
|
13
|
-
}),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
const u = async (t, r, i, a, f, e, n) => {
|
|
8
|
+
let o = 0n;
|
|
9
|
+
const p = n < 0n ? n : 0n, m = await s(t, e.feeToken, r) + p;
|
|
10
|
+
m < 0 ? o = e.flatFee : o = C(e.flatFee - m, 0n), o !== 0n && (c(t.getCurrentChainId(), a, f, {
|
|
11
|
+
...e,
|
|
12
|
+
flatFee: o
|
|
13
|
+
}), i.push(
|
|
14
|
+
T(
|
|
15
|
+
e.feeToken === F ? void 0 : t.getContractWithFetcher(g.ERC20Contract, e.feeToken),
|
|
16
|
+
r,
|
|
17
|
+
o,
|
|
18
18
|
!1
|
|
19
19
|
)
|
|
20
20
|
));
|
|
21
21
|
};
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
u as mergeWithFeeStructureEmporium
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("../../error-handling/error-codes.constants.cjs"),p=require("../../constants/conversion.constants.cjs"),_=require("../../types/hinkal.types.cjs"),D=require("../utils/processUseApprovalUtxoData.cjs"),T=require("../utils/amounts.utils.cjs"),f=require("../utils/caseInsensitive.utils.cjs"),m=(i,d,s,O,A)=>{if(A&&A>0)throw new Error(U.transactionErrorCodes.INSUFFICIENT_FUNDS);const l=T.countTotalAmountInUtxos(d),{erc20TokenAddress:N}=d[0],c=i.getApprovedUtxosForToken(N).filter(n=>!f.caseInsensitiveEqual(n.interactionAddress,O)),r=_.defaultUseApprovalUTXOData(p.APPROVED_UTXO_CONVERSION_COUNT,0n);if(s<0n&&l+s<0n){let n=-(l+s);for(let t=0;t<Math.min(c.length,p.APPROVED_UTXO_CONVERSION_COUNT)&&n!==0n;t+=1){const a=c[t],u=a.amount>=n?-n:-a.amount;n+=u,r.approvalChanges[t]=u,r.externalApprovalAddresses[t]=a.interactionAddress,r.conversionInHinkalAddress[t]=a.inHinkalAddress}if(n!==0n)throw new Error(U.transactionErrorCodes.INSUFFICIENT_FUNDS)}return{useApprovalUtxoData:D.isUseApprovalDataEmpty(r)?void 0:r}},k=(i,d,s,O,A,l)=>{if(l&&l>0)throw new Error(U.transactionErrorCodes.INSUFFICIENT_FUNDS);const N=T.countTotalAmountInUtxos(d),{erc20TokenAddress:c}=d[0],r=_.defaultUseApprovalUTXOData(p.APPROVED_UTXO_CONVERSION_COUNT,0n),n=i.userKeys.getInHinkalAddress(s),t=i.getApprovedUtxosForToken(c).sort((e,o)=>e.inHinkalAddress===n?-1:o.inHinkalAddress===n?1:e.amount===o.amount?0:e.amount<o.amount?-1:1),a=t[0]?.inHinkalAddress===n,u=a?t[0].amount:0n,C=O-u;r.approvalChanges[0]=C,r.externalApprovalAddresses[0]=s,r.conversionInHinkalAddress[0]=i.userKeys.getInHinkalAddress(s);const E=a?1:0,v=E===0?1:0;let I=A;for(let e=E;e<Math.min(p.APPROVED_UTXO_CONVERSION_COUNT,t.length)&&!(e+v>=p.APPROVED_UTXO_CONVERSION_COUNT);e+=1){const o=t[e];I+=o.amount,r.approvalChanges[e+v]=-o.amount,r.externalApprovalAddresses[e+v]=o.interactionAddress,r.conversionInHinkalAddress[e+v]=o.inHinkalAddress}if(N+I<0n)throw new Error(U.transactionErrorCodes.INSUFFICIENT_FUNDS);return{useApprovalUtxoData:r,deltaAmountOverride:I}};exports.outputApprovalDataProcessing=m;exports.outputApprovalDataProcessingForHinkalApprove=k;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { Utxo } from '../../data-structures/utxo/Utxo';
|
|
2
2
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
3
|
-
export declare const outputApprovalDataProcessing: (hinkal: IHinkal,
|
|
3
|
+
export declare const outputApprovalDataProcessing: (hinkal: IHinkal, inputUtxos: Utxo[], amountChange: bigint, interactionToIgnore?: string, tokenId?: number) => {
|
|
4
4
|
useApprovalUtxoData: {
|
|
5
5
|
approvalChanges: bigint[];
|
|
6
6
|
externalApprovalAddresses: string[];
|
|
7
7
|
conversionInHinkalAddress: bigint[];
|
|
8
8
|
} | undefined;
|
|
9
9
|
};
|
|
10
|
+
export declare const outputApprovalDataProcessingForHinkalApprove: (hinkal: IHinkal, inputUtxos: Utxo[], approvedTo: string, approvalAmount: bigint, deltaAmount: bigint, tokenId?: number) => {
|
|
11
|
+
useApprovalUtxoData: {
|
|
12
|
+
approvalChanges: bigint[];
|
|
13
|
+
externalApprovalAddresses: string[];
|
|
14
|
+
conversionInHinkalAddress: bigint[];
|
|
15
|
+
};
|
|
16
|
+
deltaAmountOverride: bigint;
|
|
17
|
+
};
|
|
@@ -1,24 +1,39 @@
|
|
|
1
|
-
import { transactionErrorCodes as
|
|
2
|
-
import { APPROVED_UTXO_CONVERSION_COUNT as
|
|
3
|
-
import { defaultUseApprovalUTXOData as
|
|
4
|
-
import { isUseApprovalDataEmpty as
|
|
5
|
-
import { countTotalAmountInUtxos as
|
|
6
|
-
import { caseInsensitiveEqual as
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
throw new Error(
|
|
10
|
-
const p =
|
|
11
|
-
if (
|
|
12
|
-
let
|
|
13
|
-
for (let
|
|
14
|
-
const
|
|
15
|
-
|
|
1
|
+
import { transactionErrorCodes as v } from "../../error-handling/error-codes.constants.mjs";
|
|
2
|
+
import { APPROVED_UTXO_CONVERSION_COUNT as l } from "../../constants/conversion.constants.mjs";
|
|
3
|
+
import { defaultUseApprovalUTXOData as F } from "../../types/hinkal.types.mjs";
|
|
4
|
+
import { isUseApprovalDataEmpty as D } from "../utils/processUseApprovalUtxoData.mjs";
|
|
5
|
+
import { countTotalAmountInUtxos as N } from "../utils/amounts.utils.mjs";
|
|
6
|
+
import { caseInsensitiveEqual as E } from "../utils/caseInsensitive.utils.mjs";
|
|
7
|
+
const S = (i, d, s, f, A) => {
|
|
8
|
+
if (A && A > 0)
|
|
9
|
+
throw new Error(v.INSUFFICIENT_FUNDS);
|
|
10
|
+
const p = N(d), { erc20TokenAddress: U } = d[0], c = i.getApprovedUtxosForToken(U).filter((n) => !E(n.interactionAddress, f)), r = F(l, 0n);
|
|
11
|
+
if (s < 0n && p + s < 0n) {
|
|
12
|
+
let n = -(p + s);
|
|
13
|
+
for (let o = 0; o < Math.min(c.length, l) && n !== 0n; o += 1) {
|
|
14
|
+
const a = c[o], u = a.amount >= n ? -n : -a.amount;
|
|
15
|
+
n += u, r.approvalChanges[o] = u, r.externalApprovalAddresses[o] = a.interactionAddress, r.conversionInHinkalAddress[o] = a.inHinkalAddress;
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
18
|
-
throw new Error(
|
|
17
|
+
if (n !== 0n)
|
|
18
|
+
throw new Error(v.INSUFFICIENT_FUNDS);
|
|
19
19
|
}
|
|
20
|
-
return { useApprovalUtxoData:
|
|
20
|
+
return { useApprovalUtxoData: D(r) ? void 0 : r };
|
|
21
|
+
}, O = (i, d, s, f, A, p) => {
|
|
22
|
+
if (p && p > 0)
|
|
23
|
+
throw new Error(v.INSUFFICIENT_FUNDS);
|
|
24
|
+
const U = N(d), { erc20TokenAddress: c } = d[0], r = F(l, 0n), n = i.userKeys.getInHinkalAddress(s), o = i.getApprovedUtxosForToken(c).sort((t, e) => t.inHinkalAddress === n ? -1 : e.inHinkalAddress === n ? 1 : t.amount === e.amount ? 0 : t.amount < e.amount ? -1 : 1), a = o[0]?.inHinkalAddress === n, u = a ? o[0].amount : 0n, x = f - u;
|
|
25
|
+
r.approvalChanges[0] = x, r.externalApprovalAddresses[0] = s, r.conversionInHinkalAddress[0] = i.userKeys.getInHinkalAddress(s);
|
|
26
|
+
const k = a ? 1 : 0, m = k === 0 ? 1 : 0;
|
|
27
|
+
let I = A;
|
|
28
|
+
for (let t = k; t < Math.min(l, o.length) && !(t + m >= l); t += 1) {
|
|
29
|
+
const e = o[t];
|
|
30
|
+
I += e.amount, r.approvalChanges[t + m] = -e.amount, r.externalApprovalAddresses[t + m] = e.interactionAddress, r.conversionInHinkalAddress[t + m] = e.inHinkalAddress;
|
|
31
|
+
}
|
|
32
|
+
if (U + I < 0n)
|
|
33
|
+
throw new Error(v.INSUFFICIENT_FUNDS);
|
|
34
|
+
return { useApprovalUtxoData: r, deltaAmountOverride: I };
|
|
21
35
|
};
|
|
22
36
|
export {
|
|
23
|
-
|
|
37
|
+
S as outputApprovalDataProcessing,
|
|
38
|
+
O as outputApprovalDataProcessingForHinkalApprove
|
|
24
39
|
};
|