@hinkal/common 0.2.18 → 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/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 +233 -64
- package/constants/addresses.constants.cjs +1 -1
- package/constants/addresses.constants.d.ts +0 -1
- package/constants/addresses.constants.mjs +7 -8
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +0 -5
- package/constants/chains.constants.mjs +19 -24
- 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/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/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +33 -48
- package/data-structures/Hinkal/Hinkal.mjs +237 -300
- package/data-structures/Hinkal/IHinkal.d.ts +32 -47
- 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 +111 -115
- 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.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.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.mjs +75 -87
- package/data-structures/Hinkal/hinkalTransfer.cjs +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.mjs +98 -102
- 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 +1 -0
- package/error-handling/error-codes.constants.mjs +2 -1
- 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.mjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +1 -2
- package/functions/snarkjs/constructGeneralZkProof.mjs +117 -121
- package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/functions/snarkjs/constructSolanaZkProof.d.ts +1 -1
- package/functions/snarkjs/constructSolanaZkProof.mjs +54 -59
- package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
- package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +11 -10
- package/functions/utils/addresses.cjs +1 -1
- package/functions/utils/addresses.d.ts +1 -0
- package/functions/utils/addresses.mjs +13 -12
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- 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/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/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 +50 -46
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +1 -2
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +38 -42
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.mjs +34 -34
- 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 +939 -970
- package/package.json +1 -1
- 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 +0 -6
- 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 +1 -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 +2 -4
- package/types/transactions.types.mjs +3 -3
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +2 -2
- package/API/ai-calls.cjs +0 -1
- package/API/ai-calls.d.ts +0 -17
- package/API/ai-calls.mjs +0 -21
- package/API/duneAPI.cjs +0 -1
- package/API/duneAPI.d.ts +0 -11
- package/API/duneAPI.mjs +0 -25
- package/API/getBridgeProtocols.cjs +0 -1
- package/API/getBridgeProtocols.d.ts +0 -7
- package/API/getBridgeProtocols.mjs +0 -8
- package/API/getLifiStatus.cjs +0 -1
- package/API/getLifiStatus.d.ts +0 -24
- package/API/getLifiStatus.mjs +0 -15
- package/API/getRelayerURL.cjs +0 -1
- package/API/getRelayerURL.d.ts +0 -1
- package/API/getRelayerURL.mjs +0 -10
- package/API/passwordCalls.cjs +0 -1
- package/API/passwordCalls.d.ts +0 -9
- package/API/passwordCalls.mjs +0 -13
- package/API/restoreSnapshots.cjs +0 -1
- package/API/restoreSnapshots.d.ts +0 -1
- package/API/restoreSnapshots.mjs +0 -10
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +0 -1
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +0 -7
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +0 -42
- package/data-structures/Hinkal/hinkalActionStake.d.ts +0 -3
- package/data-structures/Hinkal/hinkalApprove.cjs +0 -1
- package/data-structures/Hinkal/hinkalApprove.d.ts +0 -3
- package/data-structures/Hinkal/hinkalApprove.mjs +0 -115
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +0 -1
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +0 -4
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +0 -121
- package/error-handling/handleErrorRestore.cjs +0 -1
- package/error-handling/handleErrorRestore.d.ts +0 -2
- package/error-handling/handleErrorRestore.mjs +0 -11
- package/functions/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,96 +1,105 @@
|
|
|
1
1
|
import { BN as u } from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey as c } from "@solana/web3.js";
|
|
3
|
+
import { poseidonFunction as i } from "../../crypto/poseidon.mjs";
|
|
3
4
|
const f = (e) => {
|
|
4
5
|
const t = [];
|
|
5
|
-
let
|
|
6
|
-
for (;
|
|
7
|
-
t.unshift(Number(
|
|
6
|
+
let o = e;
|
|
7
|
+
for (; o > 0n; )
|
|
8
|
+
t.unshift(Number(o % 256n)), o /= 256n;
|
|
8
9
|
for (; t.length < 32; )
|
|
9
10
|
t.unshift(0);
|
|
10
11
|
return t;
|
|
11
|
-
},
|
|
12
|
+
}, m = (e) => ({
|
|
12
13
|
extraRandomization: f(e.extraRandomization),
|
|
13
14
|
stealthAddress: f(e.stealthAddress),
|
|
14
15
|
h0: f(e.H0),
|
|
15
16
|
h1: f(e.H1)
|
|
16
|
-
}),
|
|
17
|
-
const
|
|
17
|
+
}), B = (e, t, o) => {
|
|
18
|
+
const r = f(e), n = [Buffer.from("hinkal_nullifier"), t.toBuffer(), Buffer.from(r)], [s] = c.findProgramAddressSync(n, o);
|
|
18
19
|
return s;
|
|
19
|
-
}, A = (e, t) => {
|
|
20
|
-
const r = [Buffer.from("hinkal"), t.toBuffer()], [o] = c.findProgramAddressSync(r, e);
|
|
21
|
-
return o;
|
|
22
|
-
}, B = (e, t) => {
|
|
23
|
-
const r = [Buffer.from("hinkal_merkle"), t.toBuffer()], [o] = c.findProgramAddressSync(r, e);
|
|
24
|
-
return o;
|
|
25
|
-
}, m = (e, t) => {
|
|
26
|
-
const r = [Buffer.from("hinkal_merkle_access_token"), t.toBuffer()], [o] = c.findProgramAddressSync(r, e);
|
|
27
|
-
return o;
|
|
28
20
|
}, g = (e, t) => {
|
|
29
|
-
const
|
|
30
|
-
return
|
|
21
|
+
const o = [Buffer.from("hinkal"), t.toBuffer()], [r] = c.findProgramAddressSync(o, e);
|
|
22
|
+
return r;
|
|
31
23
|
}, y = (e, t) => {
|
|
32
|
-
const
|
|
33
|
-
return
|
|
24
|
+
const o = [Buffer.from("hinkal_merkle"), t.toBuffer()], [r] = c.findProgramAddressSync(o, e);
|
|
25
|
+
return r;
|
|
34
26
|
}, P = (e, t) => {
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
}, k = (e, t
|
|
38
|
-
const o =
|
|
27
|
+
const o = [Buffer.from("hinkal_merkle_access_token"), t.toBuffer()], [r] = c.findProgramAddressSync(o, e);
|
|
28
|
+
return r;
|
|
29
|
+
}, k = (e, t) => {
|
|
30
|
+
const o = [Buffer.from("hinkal_access_token"), t.toBuffer()], [r] = c.findProgramAddressSync(o, e);
|
|
31
|
+
return r;
|
|
32
|
+
}, d = (e, t, o) => {
|
|
33
|
+
const r = [
|
|
34
|
+
Buffer.from("hinkal_swapper"),
|
|
35
|
+
t.toBytes(),
|
|
36
|
+
new u(o.toString()).toBuffer("be", 32)
|
|
37
|
+
], [n] = c.findProgramAddressSync(r, e);
|
|
38
|
+
return n;
|
|
39
|
+
}, S = (e, t, o) => {
|
|
40
|
+
const r = i(o);
|
|
41
|
+
return d(e, t, r);
|
|
42
|
+
}, p = (e, t) => {
|
|
43
|
+
const o = [Buffer.from("hinkal_vault"), t.toBuffer()], [r] = c.findProgramAddressSync(o, e);
|
|
44
|
+
return r;
|
|
45
|
+
}, h = (e, t, o) => {
|
|
46
|
+
const r = f(e), n = [Buffer.from("hinkal_access_keys"), o.toBuffer(), Buffer.from(r)], [s] = c.findProgramAddressSync(n, t);
|
|
39
47
|
return s;
|
|
40
|
-
},
|
|
48
|
+
}, b = (e, t, o, r) => {
|
|
41
49
|
const n = [
|
|
42
50
|
Buffer.from("hinkal_proof_part1"),
|
|
43
51
|
t.toBuffer(),
|
|
44
|
-
|
|
45
|
-
new u(
|
|
52
|
+
o.toBuffer(),
|
|
53
|
+
new u(r.toString()).toBuffer("be", 4)
|
|
46
54
|
// 4 here because type of id is u32
|
|
47
55
|
], [s] = c.findProgramAddressSync(n, e);
|
|
48
56
|
return s;
|
|
49
|
-
},
|
|
57
|
+
}, _ = (e, t, o, r) => {
|
|
50
58
|
const n = [
|
|
51
59
|
Buffer.from("hinkal_proof_part2"),
|
|
52
60
|
t.toBuffer(),
|
|
53
|
-
|
|
54
|
-
new u(
|
|
61
|
+
o.toBuffer(),
|
|
62
|
+
new u(r.toString()).toBuffer("be", 4)
|
|
55
63
|
// 4 here because type of id is u32
|
|
56
64
|
], [s] = c.findProgramAddressSync(n, e);
|
|
57
65
|
return s;
|
|
58
|
-
},
|
|
66
|
+
}, K = (e, t, o, r) => {
|
|
59
67
|
const n = [
|
|
60
68
|
Buffer.from("hinkal_encrypted_outputs"),
|
|
61
69
|
t.toBuffer(),
|
|
62
|
-
|
|
63
|
-
new u(
|
|
70
|
+
o.toBuffer(),
|
|
71
|
+
new u(r.toString()).toBuffer("be", 4)
|
|
64
72
|
// 4 here because type of id is u32
|
|
65
73
|
], [s] = c.findProgramAddressSync(n, e);
|
|
66
74
|
return s;
|
|
67
|
-
},
|
|
68
|
-
const
|
|
75
|
+
}, w = (e, t, o) => {
|
|
76
|
+
const r = [Buffer.from("hinkal_token_limit"), t.toBuffer(), o.toBuffer()], [n] = c.findProgramAddressSync(r, e);
|
|
69
77
|
return n;
|
|
70
|
-
},
|
|
78
|
+
}, T = (e, t, o, r) => {
|
|
71
79
|
const n = [
|
|
72
80
|
Buffer.from("hinkal_instructions"),
|
|
73
81
|
t.toBuffer(),
|
|
74
|
-
|
|
75
|
-
new u(
|
|
82
|
+
o.toBuffer(),
|
|
83
|
+
new u(r.toString()).toBuffer("be", 4)
|
|
76
84
|
// 4 here because type of id is u32
|
|
77
85
|
], [s] = c.findProgramAddressSync(n, e);
|
|
78
86
|
return s;
|
|
79
87
|
};
|
|
80
88
|
export {
|
|
81
|
-
|
|
89
|
+
m as buildAnchorStealthAddressStructure,
|
|
82
90
|
f as encodeToByte32Array,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
h as getAccessTokenAccountPublicKey,
|
|
92
|
+
P as getAccessTokenMerkleAccountPublicKey,
|
|
93
|
+
k as getAccessTokenStorageAccountPublicKey,
|
|
94
|
+
K as getEncryptedOutputsAccountPublicKey,
|
|
95
|
+
T as getInstructionsAccountPublicKey,
|
|
96
|
+
y as getMerkleAccountPublicKey,
|
|
97
|
+
B as getNullifierAccount,
|
|
98
|
+
b as getProofAccountPart1PublicKey,
|
|
99
|
+
_ as getProofAccountPart2PublicKey,
|
|
100
|
+
g as getStorageAccountPublicKey,
|
|
101
|
+
p as getStorageVaultPublicKey,
|
|
102
|
+
d as getSwapperAccountPublicKey,
|
|
103
|
+
S as getSwapperAccountPublicKeyFromSalt,
|
|
104
|
+
w as getTokenLimitStorageAccountPublicKey
|
|
96
105
|
};
|
|
@@ -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("ethers"),g=require("../../constants/protocol.constants.cjs"),p=require("../../types/ethereum-network.types.cjs");require("idb-keyval");const y=require("../../constants/chains.constants.cjs"),E=require("../utils/create-provider.cjs");require("../../constants/token-data/index.cjs");require("../../error-handling/error-codes.constants.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");const d=require("../../data-structures/crypto-keys/keys.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");const f=require("../utils/caseInsensitive.utils.cjs"),w=require("../../error-handling/logger.cjs");require("@solana/web3.js");require("@coral-xyz/anchor");require("@solana/spl-token");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../utils/userAgent.cjs");const D=require("../utils/string.utils.cjs");require("libsodium-wrappers");require("multiformats");require("async-mutex");require("../../API/tenderly.api.cjs");require("process");require("buffer");require("../../providers/EthersProviderAdapter.cjs");const P=require("ethers-v6h"),l=({contract:e,func:r,args:t,callDataString:i,invokeWallet:s,value:n})=>{let o=new Uint8Array,u=i?a.utils.arrayify(i):new Uint8Array;if(typeof e=="object"&&"address"in e){if(o=a.utils.arrayify(e.address),i?.length&&i?.length>0)throw Error("If function and args are providedm no calldata is needed");r&&t&&!i&&(u=a.utils.arrayify(e.interface.encodeFunctionData(r,t)))}else o=a.utils.arrayify(e);const c=a.utils.arrayify([s?1:0]),m=a.utils.zeroPad(a.utils.arrayify(a.BigNumber.from(n??0n)),16),A=a.utils.concat([o,c,m,u]);return a.utils.hexlify(A)},k=async(e,r,t,i,s,n)=>{const o=t?await d.UserKeys.signTypedDataFromPrivateKey(e,t,{name:"Emporium",version:"1.0.0",chainId:e,verifyingContract:r},{EmporiumSignature:[{name:"message",type:"uint256"}]},{message:s}):void 0,{v:u,r:c,s:m}=o?a.utils.splitSignature(o):{v:0,r:"0x",s:"0x"};return a.utils.defaultAbiCoder.encode(["tuple(uint8 v,bytes32 r, bytes32 s, uint256 message, address signerAddress, bytes[] ops)"],[{v:u,r:c,s:m,message:s??0n,signerAddress:n??g.zeroAddress,ops:i}])},q=(e,r,t,i)=>l(e?{contract:e,func:"transfer",args:[r,t],invokeWallet:i}:{contract:r,value:t,invokeWallet:i}),C=(e,r,t,i,s)=>{const n=e.getContractWithFetcher(r,p.ContractType.HinkalContract);return t.map((o,u)=>{const c=f.caseInsensitiveEqual(o,g.zeroAddress)?void 0:e.getContractWithFetcher(r,p.ContractType.ERC20Contract,o);return q(c,s??n.address,i[u],!0)})},O=(e,r,t,i)=>l({contract:e,func:"approve",args:[r,t],invokeWallet:i}),h=(e,r,t)=>{const{hinkalAddress:i}=y.networkRegistry[e].contractData;if(!i)throw Error("No Hinkal Address Provided to modifyDataForProxy");return D.replaceAllInstances(t,i.slice(2),r.slice(2))},x=(e,r,t)=>{if(!r)throw Error("No private key provided to modifyDataForProxy");const i=d.UserKeys.getSignerAddressFromPrivateKey(e,r);return h(e,i,t)},F="0xef0100",v=async(e,r)=>{try{const{fetchRpcUrl:t}=y.networkRegistry[e];if(!t)throw new Error("RPC URL not found for the specified chain ID");const i=E.createCustomRpcProvider(t),s=await i.getCode(r);if(s==="0x"||!s)return{delegated:!1,implementation:void 0,nonce:void 0};if(s.toLowerCase().startsWith(F)&&s.length===48){const n=`0x${s.slice(8)}`,o=await i.getTransactionCount(r);return{delegated:!0,implementation:a.utils.getAddress(n),nonce:o}}else throw Error("checkEOAWithDelegation: It is a contract")}catch(t){throw w.Logger.error("checkEOAWithDelegation error",{error:t}),t}},I=e=>{const{hinkalWalletAddress:r}=y.networkRegistry[e].contractData;if(!r||f.caseInsensitiveEqual(r,g.zeroAddress))throw Error("Hinkal Wallet Address is not set");return r},W=async(e,r)=>{if(e===y.chainIds.localhost||!r)return;const t=d.UserKeys.getSignerAddressFromPrivateKey(e,r),{delegated:i,implementation:s}=await v(e,t),n=I(e);if(!i||!f.caseInsensitiveEqual(s,n)){const o=await d.UserKeys.authorizeDelegation(e,r,n);return{v:o.signature.v.toString(),r:o.signature.r,s:o.signature.s,nonce:o.nonce.toString(),address:n,chainId:String(e)}}},T=e=>{if(!e)return;const{v:r,r:t,s:i,nonce:s,chainId:n,address:o}=e;return{signature:P.ethers.Signature.from({v:r,r:t,s:i}),nonce:BigInt(s),chainId:BigInt(n),address:o}};exports.checkEOAWithDelegation=v;exports.createApproveEmporiumOp=O;exports.createTransaferEmporiumOpsBatch=C;exports.createTransferToEmporiumOp=q;exports.emporiumOp=l;exports.encodeEmporiumMetadata=k;exports.getAuthorizationDataIfNeeded=W;exports.modifyDataForProxy=h;exports.modifyDataForProxyWithPrivateKey=x;exports.recoverAuthorizationData=T;
|
|
@@ -12,12 +12,10 @@ export declare const emporiumOp: <ContractInstance extends Contract, ContractFun
|
|
|
12
12
|
}) => string;
|
|
13
13
|
export declare const encodeEmporiumMetadata: (chainId: number, emporiumAddress: string, privateKey: string | undefined, ops: string[], message?: bigint, signerAddress?: string) => Promise<string>;
|
|
14
14
|
export declare const createTransferToEmporiumOp: (tokenContract: ethers.Contract | undefined, to: string, amount: bigint, invokeWallet: boolean) => string;
|
|
15
|
-
export declare const createTransaferEmporiumOpsBatch: (hinkal: IHinkal, erc20TokenAddresses: string[], amounts: bigint[], to?: string) => string[];
|
|
15
|
+
export declare const createTransaferEmporiumOpsBatch: (hinkal: IHinkal, chainId: number, erc20TokenAddresses: string[], amounts: bigint[], to?: string) => string[];
|
|
16
16
|
export declare const createApproveEmporiumOp: (tokenContract: ethers.Contract, to: string, amount: bigint, invokeWallet: boolean) => string;
|
|
17
|
-
export declare const modifyDataForProxy: (
|
|
18
|
-
export declare const modifyDataForProxyWithPrivateKey: (
|
|
19
|
-
export declare const generateFundAndApproveOps: (hinkal: IHinkal, erc20AddressesToFund: string[], fundAmounts: bigint[], approveTokenAddresses: string[], approveAmounts: bigint[], walletAddress: string, spenderAddress: string | undefined) => string[];
|
|
20
|
-
export declare const generateFundApproveAndTransactOps: (hinkal: IHinkal, erc20AddressesToFund: string[], fundAmounts: bigint[], approveTokenAddresses: string[], approveAmounts: bigint[], walletAddress: string, spenderAddress: string | undefined, to?: string, callDataString?: string, value?: bigint) => string[];
|
|
17
|
+
export declare const modifyDataForProxy: (chainId: number, userAddress: string, data: string) => string;
|
|
18
|
+
export declare const modifyDataForProxyWithPrivateKey: (chainId: number, privateKey: string | undefined, data: string) => string;
|
|
21
19
|
export declare const checkEOAWithDelegation: (chainId: number, eoaAddress: string) => Promise<{
|
|
22
20
|
delegated: boolean;
|
|
23
21
|
implementation: undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { utils as
|
|
2
|
-
import { zeroAddress as
|
|
3
|
-
import { ContractType as
|
|
1
|
+
import { utils as a, BigNumber as v } from "ethers";
|
|
2
|
+
import { zeroAddress as f } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { ContractType as y } from "../../types/ethereum-network.types.mjs";
|
|
4
4
|
import "idb-keyval";
|
|
5
|
-
import { networkRegistry as
|
|
6
|
-
import { createCustomRpcProvider as
|
|
5
|
+
import { networkRegistry as l, chainIds as A } from "../../constants/chains.constants.mjs";
|
|
6
|
+
import { createCustomRpcProvider as E } from "../utils/create-provider.mjs";
|
|
7
7
|
import "../../constants/token-data/index.mjs";
|
|
8
8
|
import "../../error-handling/error-codes.constants.mjs";
|
|
9
9
|
import "../utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
@@ -11,26 +11,21 @@ import "../../types/circom-data.types.mjs";
|
|
|
11
11
|
import "../../types/transactions.types.mjs";
|
|
12
12
|
import "../../types/activities.types.mjs";
|
|
13
13
|
import "circomlibjs-hinkal-fork";
|
|
14
|
-
import { UserKeys as
|
|
14
|
+
import { UserKeys as p } from "../../data-structures/crypto-keys/keys.mjs";
|
|
15
15
|
import "../../constants/server.constants.mjs";
|
|
16
|
-
import "../../
|
|
16
|
+
import "../../API/getServerURL.mjs";
|
|
17
17
|
import "../../data-structures/http/HttpClient.mjs";
|
|
18
18
|
import "axios";
|
|
19
|
-
import
|
|
20
|
-
import "
|
|
21
|
-
import "
|
|
22
|
-
import "process";
|
|
23
|
-
import "buffer";
|
|
24
|
-
import "../../constants/save-depths.mjs";
|
|
25
|
-
import "../../constants/reorg-depths.constants.mjs";
|
|
26
|
-
import "../utils/mutexes.utils.mjs";
|
|
27
|
-
import "@coral-xyz/anchor";
|
|
28
|
-
import { Logger as k } from "../../error-handling/logger.mjs";
|
|
19
|
+
import "../../constants/vite.constants.mjs";
|
|
20
|
+
import { caseInsensitiveEqual as g } from "../utils/caseInsensitive.utils.mjs";
|
|
21
|
+
import { Logger as w } from "../../error-handling/logger.mjs";
|
|
29
22
|
import "@solana/web3.js";
|
|
23
|
+
import "@coral-xyz/anchor";
|
|
30
24
|
import "@solana/spl-token";
|
|
31
25
|
import "../../constants/contracts.constants.mjs";
|
|
32
26
|
import "../../constants/kyc.constants.mjs";
|
|
33
27
|
import "../../constants/coingecko.constants.mjs";
|
|
28
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
34
29
|
import "../../constants/addresses.constants.mjs";
|
|
35
30
|
import "../../constants/token.limits.constants.mjs";
|
|
36
31
|
import "../../constants/presale.constants.mjs";
|
|
@@ -38,165 +33,130 @@ import "../../constants/activity.constants.mjs";
|
|
|
38
33
|
import "../../constants/tasks.constants.mjs";
|
|
39
34
|
import "../../constants/events.constants.mjs";
|
|
40
35
|
import "../utils/userAgent.mjs";
|
|
41
|
-
import { replaceAllInstances as
|
|
36
|
+
import { replaceAllInstances as C } from "../utils/string.utils.mjs";
|
|
37
|
+
import "libsodium-wrappers";
|
|
42
38
|
import "multiformats";
|
|
39
|
+
import "async-mutex";
|
|
43
40
|
import "../../API/tenderly.api.mjs";
|
|
44
|
-
import
|
|
41
|
+
import "process";
|
|
42
|
+
import "buffer";
|
|
43
|
+
import "../../providers/EthersProviderAdapter.mjs";
|
|
45
44
|
import { ethers as D } from "ethers-v6h";
|
|
46
|
-
const
|
|
45
|
+
const u = ({
|
|
47
46
|
contract: t,
|
|
48
47
|
func: r,
|
|
49
|
-
args:
|
|
50
|
-
callDataString:
|
|
51
|
-
invokeWallet:
|
|
52
|
-
value:
|
|
48
|
+
args: e,
|
|
49
|
+
callDataString: o,
|
|
50
|
+
invokeWallet: n,
|
|
51
|
+
value: s
|
|
53
52
|
}) => {
|
|
54
|
-
let
|
|
53
|
+
let i = new Uint8Array(), m = o ? a.arrayify(o) : new Uint8Array();
|
|
55
54
|
if (typeof t == "object" && "address" in t) {
|
|
56
|
-
if (
|
|
55
|
+
if (i = a.arrayify(t.address), o?.length && o?.length > 0)
|
|
57
56
|
throw Error("If function and args are providedm no calldata is needed");
|
|
58
|
-
r &&
|
|
57
|
+
r && e && !o && (m = a.arrayify(t.interface.encodeFunctionData(r, e)));
|
|
59
58
|
} else
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
return
|
|
63
|
-
},
|
|
64
|
-
const
|
|
59
|
+
i = a.arrayify(t);
|
|
60
|
+
const c = a.arrayify([n ? 1 : 0]), d = a.zeroPad(a.arrayify(v.from(s ?? 0n)), 16), h = a.concat([i, c, d, m]);
|
|
61
|
+
return a.hexlify(h);
|
|
62
|
+
}, At = async (t, r, e, o, n, s) => {
|
|
63
|
+
const i = e ? await p.signTypedDataFromPrivateKey(
|
|
65
64
|
t,
|
|
66
|
-
|
|
65
|
+
e,
|
|
67
66
|
{ name: "Emporium", version: "1.0.0", chainId: t, verifyingContract: r },
|
|
68
67
|
{ EmporiumSignature: [{ name: "message", type: "uint256" }] },
|
|
69
|
-
{ message:
|
|
70
|
-
) : void 0, { v:
|
|
71
|
-
return
|
|
68
|
+
{ message: n }
|
|
69
|
+
) : void 0, { v: m, r: c, s: d } = i ? a.splitSignature(i) : { v: 0, r: "0x", s: "0x" };
|
|
70
|
+
return a.defaultAbiCoder.encode(
|
|
72
71
|
["tuple(uint8 v,bytes32 r, bytes32 s, uint256 message, address signerAddress, bytes[] ops)"],
|
|
73
72
|
[
|
|
74
73
|
{
|
|
75
|
-
v:
|
|
76
|
-
r:
|
|
77
|
-
s:
|
|
78
|
-
message:
|
|
79
|
-
signerAddress:
|
|
80
|
-
ops:
|
|
74
|
+
v: m,
|
|
75
|
+
r: c,
|
|
76
|
+
s: d,
|
|
77
|
+
message: n ?? 0n,
|
|
78
|
+
signerAddress: s ?? f,
|
|
79
|
+
ops: o
|
|
81
80
|
}
|
|
82
81
|
]
|
|
83
82
|
);
|
|
84
|
-
},
|
|
83
|
+
}, P = (t, r, e, o) => u(t ? {
|
|
85
84
|
contract: t,
|
|
86
85
|
func: "transfer",
|
|
87
|
-
args: [r,
|
|
88
|
-
invokeWallet:
|
|
89
|
-
} : { contract: r, value:
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
const c =
|
|
93
|
-
return
|
|
86
|
+
args: [r, e],
|
|
87
|
+
invokeWallet: o
|
|
88
|
+
} : { contract: r, value: e, invokeWallet: o }), Et = (t, r, e, o, n) => {
|
|
89
|
+
const s = t.getContractWithFetcher(r, y.HinkalContract);
|
|
90
|
+
return e.map((i, m) => {
|
|
91
|
+
const c = g(i, f) ? void 0 : t.getContractWithFetcher(r, y.ERC20Contract, i);
|
|
92
|
+
return P(c, n ?? s.address, o[m], !0);
|
|
94
93
|
});
|
|
95
|
-
},
|
|
94
|
+
}, wt = (t, r, e, o) => u({
|
|
96
95
|
contract: t,
|
|
97
96
|
func: "approve",
|
|
98
|
-
args: [r,
|
|
99
|
-
invokeWallet:
|
|
100
|
-
}),
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
97
|
+
args: [r, e],
|
|
98
|
+
invokeWallet: o
|
|
99
|
+
}), k = (t, r, e) => {
|
|
100
|
+
const { hinkalAddress: o } = l[t].contractData;
|
|
101
|
+
if (!o)
|
|
103
102
|
throw Error("No Hinkal Address Provided to modifyDataForProxy");
|
|
104
|
-
return
|
|
105
|
-
},
|
|
103
|
+
return C(e, o.slice(2), r.slice(2));
|
|
104
|
+
}, Ct = (t, r, e) => {
|
|
106
105
|
if (!r)
|
|
107
106
|
throw Error("No private key provided to modifyDataForProxy");
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
}, x =
|
|
111
|
-
const c = [];
|
|
112
|
-
for (let s = 0; s < r.length; s += 1) {
|
|
113
|
-
const p = r[s], d = l(p, u) ? void 0 : t.getContractWithFetcher(f.ERC20Contract, p);
|
|
114
|
-
c.push(v(d, a, o[s], !1));
|
|
115
|
-
}
|
|
116
|
-
if (n)
|
|
117
|
-
for (let s = 0; s < e.length; s += 1) {
|
|
118
|
-
const p = e[s];
|
|
119
|
-
if (!l(p, u)) {
|
|
120
|
-
const d = t.getContractWithFetcher(f.ERC20Contract, p);
|
|
121
|
-
c.push(P(d, n, i[s], !0));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return c;
|
|
125
|
-
}, It = (t, r, o, e, i, a, n, c, s, p) => {
|
|
126
|
-
const d = x(
|
|
127
|
-
t,
|
|
128
|
-
r,
|
|
129
|
-
o,
|
|
130
|
-
e,
|
|
131
|
-
i,
|
|
132
|
-
a,
|
|
133
|
-
n
|
|
134
|
-
);
|
|
135
|
-
if (!!c && !!s) {
|
|
136
|
-
const C = t.getContractWithFetcher(f.HinkalContract);
|
|
137
|
-
d.push(
|
|
138
|
-
h({
|
|
139
|
-
contract: c,
|
|
140
|
-
callDataString: F(s, C.address, a),
|
|
141
|
-
value: p,
|
|
142
|
-
invokeWallet: !0
|
|
143
|
-
})
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
return d;
|
|
147
|
-
}, O = "0xef0100", B = async (t, r) => {
|
|
107
|
+
const o = p.getSignerAddressFromPrivateKey(t, r);
|
|
108
|
+
return k(t, o, e);
|
|
109
|
+
}, x = "0xef0100", F = async (t, r) => {
|
|
148
110
|
try {
|
|
149
|
-
const { fetchRpcUrl:
|
|
150
|
-
if (!
|
|
111
|
+
const { fetchRpcUrl: e } = l[t];
|
|
112
|
+
if (!e)
|
|
151
113
|
throw new Error("RPC URL not found for the specified chain ID");
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
114
|
+
const o = E(e), n = await o.getCode(r);
|
|
115
|
+
if (n === "0x" || !n)
|
|
154
116
|
return { delegated: !1, implementation: void 0, nonce: void 0 };
|
|
155
|
-
if (
|
|
156
|
-
const
|
|
157
|
-
return { delegated: !0, implementation:
|
|
117
|
+
if (n.toLowerCase().startsWith(x) && n.length === 48) {
|
|
118
|
+
const s = `0x${n.slice(8)}`, i = await o.getTransactionCount(r);
|
|
119
|
+
return { delegated: !0, implementation: a.getAddress(s), nonce: i };
|
|
158
120
|
} else
|
|
159
121
|
throw Error("checkEOAWithDelegation: It is a contract");
|
|
160
|
-
} catch (
|
|
161
|
-
throw
|
|
122
|
+
} catch (e) {
|
|
123
|
+
throw w.error("checkEOAWithDelegation error", { error: e }), e;
|
|
162
124
|
}
|
|
163
|
-
},
|
|
164
|
-
const { hinkalWalletAddress: r } =
|
|
165
|
-
if (!r ||
|
|
125
|
+
}, W = (t) => {
|
|
126
|
+
const { hinkalWalletAddress: r } = l[t].contractData;
|
|
127
|
+
if (!r || g(r, f))
|
|
166
128
|
throw Error("Hinkal Wallet Address is not set");
|
|
167
129
|
return r;
|
|
168
|
-
},
|
|
169
|
-
if (t ===
|
|
130
|
+
}, Dt = async (t, r) => {
|
|
131
|
+
if (t === A.localhost || !r)
|
|
170
132
|
return;
|
|
171
|
-
const
|
|
172
|
-
if (!
|
|
173
|
-
const
|
|
133
|
+
const e = p.getSignerAddressFromPrivateKey(t, r), { delegated: o, implementation: n } = await F(t, e), s = W(t);
|
|
134
|
+
if (!o || !g(n, s)) {
|
|
135
|
+
const i = await p.authorizeDelegation(t, r, s);
|
|
174
136
|
return {
|
|
175
|
-
v:
|
|
176
|
-
r:
|
|
177
|
-
s:
|
|
178
|
-
nonce:
|
|
179
|
-
address:
|
|
137
|
+
v: i.signature.v.toString(),
|
|
138
|
+
r: i.signature.r,
|
|
139
|
+
s: i.signature.s,
|
|
140
|
+
nonce: i.nonce.toString(),
|
|
141
|
+
address: s,
|
|
180
142
|
chainId: String(t)
|
|
181
143
|
};
|
|
182
144
|
}
|
|
183
|
-
},
|
|
145
|
+
}, Pt = (t) => {
|
|
184
146
|
if (!t)
|
|
185
147
|
return;
|
|
186
|
-
const { v: r, r:
|
|
187
|
-
return { signature: D.Signature.from({ v: r, r:
|
|
148
|
+
const { v: r, r: e, s: o, nonce: n, chainId: s, address: i } = t;
|
|
149
|
+
return { signature: D.Signature.from({ v: r, r: e, s: o }), nonce: BigInt(n), chainId: BigInt(s), address: i };
|
|
188
150
|
};
|
|
189
151
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Pt as modifyDataForProxyWithPrivateKey,
|
|
201
|
-
Ot as recoverAuthorizationData
|
|
152
|
+
F as checkEOAWithDelegation,
|
|
153
|
+
wt as createApproveEmporiumOp,
|
|
154
|
+
Et as createTransaferEmporiumOpsBatch,
|
|
155
|
+
P as createTransferToEmporiumOp,
|
|
156
|
+
u as emporiumOp,
|
|
157
|
+
At as encodeEmporiumMetadata,
|
|
158
|
+
Dt as getAuthorizationDataIfNeeded,
|
|
159
|
+
k as modifyDataForProxy,
|
|
160
|
+
Ct as modifyDataForProxyWithPrivateKey,
|
|
161
|
+
Pt as recoverAuthorizationData
|
|
202
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("ethers"),m=require("./emporium.helpers.cjs"),F=require("../../constants/addresses.constants.cjs"),h=require("../../types/external-action.types.cjs"),g=require("../../types/ethereum-network.types.cjs"),L=require("../pre-transaction/getExternalSwapAddress.cjs"),U=require("../utils/string.utils.cjs"),w=require("../../constants/protocol.constants.cjs");require("../../constants/token-data/index.cjs");const A=require("../utils/caseInsensitive.utils.cjs"),I=require("../../error-handling/logger.cjs"),v=require("../../constants/token-data/ERC20Registry.cjs"),P=(a,e,t,n,s,r,i=!1)=>{const o=_.BigNumber.from(r).toBigInt(),c={tokenIn:e,tokenOut:n,fee:o,recipient:s,amountIn:t,amountOutMinimum:0,sqrtPriceLimitX96:0},C=["function exactInputSingle(tuple(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)) external payable returns (uint256 amountOut)"],E=new _.ethers.Contract(a,C);return m.emporiumOp({contract:E,func:"exactInputSingle",args:[c],invokeWallet:i})},T=(a,e,t,n,s,r,i=!1)=>{const o=L.getExternalSwapAddress(a,e),c=U.replaceAllInstances(n,o.slice(2),s.slice(2));return m.emporiumOp({contract:t,callDataString:c,value:r,invokeWallet:i})},z=(a,e)=>{const n=v.getERC20Registry(e).find(s=>s.symbol==="USDT");return n?A.caseInsensitiveEqual(a,n.erc20TokenAddress):!1},x=async(a,e,t,n,s,r)=>{const i=t.address;if(z(i,a))try{(await t.allowance(n,s)).toBigInt()>0n&&e.push(m.createApproveEmporiumOp(t,s,0n,r))}catch(o){I.Logger.error("Error in nullifyUsdtApprovalIfNeeded",o)}},B=async(a,e,t,n,s,r,i,o)=>{if(t!==w.zeroAddress){const c=F.SWAP_FEE_TAKER_ADDRESSES[e],C=a.getContractWithFetcher(e,g.ContractType.ERC20Contract,t),E=await C.balanceOf(n);await x(e,r,C,n,c,i),r.push(m.createApproveEmporiumOp(C,c,2n**256n-1n,i));const y=["function takeSwapFee(address token, uint256 beforeBalance, uint256 variableRate, address relay) external payable"],p=new _.ethers.Contract(c,y),O=s;r.push(m.emporiumOp({contract:p,func:"takeSwapFee",args:[t,E,w.HINKAL_SWAP_VARIABLE_RATE,O],invokeWallet:i}))}else{const c=s;r.push(m.emporiumOp({contract:c,value:o*w.HINKAL_SWAP_VARIABLE_RATE/10000n,invokeWallet:i}))}},K=async(a,e,t,n,s,r,i,o,c,C,E,y,p=!1)=>{const O=i<0n?-1n*i:i,f=[],S=F.NATIVE_TOKEN_WRAPPER_ADDRESSES[e];let q=!1,R;if(t===h.ExternalActionId.OneInch||t===h.ExternalActionId.Lifi){if(r!==w.zeroAddress){const b=a.getContractWithFetcher(e,g.ContractType.ERC20Contract,r);f.push(m.createApproveEmporiumOp(b,n,O,p))}let u=0n;r===w.zeroAddress&&(u+=O),o&&c===w.zeroAddress&&o<0n&&(u+=-1n*o);const l=u>0n?u:void 0;return R=T(e,t,n,s,E,l,p),f.push(R),(t===h.ExternalActionId.OneInch||C&&t===h.ExternalActionId.Lifi)&&c&&o!==void 0&&await B(a,e,c,E,y,f,p,o),f}if(!c||!o)throw Error("There should be output token for UniSwap and Odos");if(r===w.zeroAddress){const u=a.getContractWithFetcher(e,g.ContractType.ERC20Contract,S);f.push(m.emporiumOp({contract:u,func:"deposit",value:O,invokeWallet:p})),r=S}let D=0n;if(c===w.zeroAddress&&(c=S,q=!0,D=await a.getContractWithFetcher(e,g.ContractType.ERC20Contract,S).balanceOf(E)),r!==w.zeroAddress){const u=a.getContractWithFetcher(e,g.ContractType.ERC20Contract,r);await x(e,f,u,E,n,p),f.push(m.createApproveEmporiumOp(u,n,O,p))}if(t===h.ExternalActionId.Uniswap?R=P(n,r,O,c,E,s,p):R=T(e,t,n,s,E,void 0,p),f.push(R),await B(a,e,c,E,y,f,p,o),q){const u=F.WRAPPER_TOKEN_EXCHANGE_ADDRESSES[e],l=a.getContractWithFetcher(e,g.ContractType.ERC20Contract,S);f.push(m.createApproveEmporiumOp(l,u,2n**256n-1n,p));const b=["function withdrawBalanceDifference(uint256 beforeBalance) external"],N=new _.ethers.Contract(u,b);f.push(m.emporiumOp({contract:N,func:"withdrawBalanceDifference",args:[D],invokeWallet:p}))}return f};exports.createSwapToEmporiumOpForUniswap=P;exports.createSwapToEmporiumOps=K;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
1
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
3
2
|
import { ExternalActionId } from '../../types/external-action.types';
|
|
4
3
|
export declare const createSwapToEmporiumOpForUniswap: (routerAddress: string, inputTokenAddress: string, positiveAmountInput: bigint, outputTokenAddress: string, recipient: string, data: string, invokeWallet?: boolean) => string;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const nullifyUsdtApprovalIfNeeded: (hinkal: IHinkal, ops: string[], tokenContract: ethers.Contract, walletAddress: string, spenderAddress: string, invokeWallet: boolean) => Promise<void>;
|
|
7
|
-
export declare const createSwapToEmporiumOps: (hinkal: IHinkal, externalActionId: ExternalActionId, routerAddress: string, data: string, inputTokenAddress: string, inputAmount: bigint, outputAmount: bigint | undefined, outputTokenAddress: string | undefined, isTheSameChainSwap: boolean, walletAddress: string, relay: string, invokeWallet?: boolean) => Promise<string[]>;
|
|
4
|
+
export declare const createSwapToEmporiumOps: (hinkal: IHinkal, chainId: number, externalActionId: ExternalActionId, routerAddress: string, data: string, inputTokenAddress: string, inputAmount: bigint, outputAmount: bigint | undefined, outputTokenAddress: string | undefined, isTheSameChainSwap: boolean, walletAddress: string, relay: string, invokeWallet?: boolean) => Promise<string[]>;
|