@hinkal/common 0.2.21 → 0.2.22
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 +54 -42
- 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/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 +142 -38
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +13 -36
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
- package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +71 -68
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +56 -45
- package/data-structures/Hinkal/Hinkal.mjs +348 -314
- package/data-structures/Hinkal/IHinkal.d.ts +54 -40
- 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 +20 -20
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +84 -88
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +96 -77
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -1
- package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +80 -75
- package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +1 -1
- package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +150 -138
- 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 +119 -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 -114
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +34 -36
- 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 +182 -155
- 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 +45 -48
- package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +48 -49
- package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -2
- package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +68 -71
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +78 -71
- package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/data-structures/Hinkal/hinkalTransfer.mjs +70 -71
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +79 -81
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +103 -105
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +53 -107
- 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 +75 -91
- package/data-structures/IndexedDB/balances-db.cjs +1 -1
- package/data-structures/IndexedDB/balances-db.mjs +37 -40
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +13 -16
- package/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/data-structures/IndexedDB/signatures-db.mjs +40 -25
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +84 -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/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +11 -0
- package/data-structures/crypto-keys/keys.mjs +107 -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 +19 -19
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
- package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +5 -6
- 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 +4 -3
- 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 +35 -39
- 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 +1 -1
- 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/provider-adapter/IProviderAdapter.d.ts +13 -8
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +4 -6
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +4 -6
- 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 -21
- 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 +17 -18
- 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/getVolatileTransferAmount.cjs +1 -1
- package/functions/pre-transaction/getVolatileTransferAmount.mjs +36 -21
- 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 +6 -3
- package/functions/private-wallet/emporium.helpers.mjs +127 -89
- 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 +102 -100
- 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 +20 -18
- 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 +12 -13
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +2 -2
- package/functions/utils/create-provider.cjs +1 -1
- package/functions/utils/create-provider.d.ts +1 -1
- package/functions/utils/create-provider.mjs +9 -13
- 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/getUtxosFromReceipt.utils.cjs +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/functions/utils/getUtxosFromReceipt.utils.mjs +11 -11
- package/functions/utils/index.d.ts +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 -8
- 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.mjs +54 -49
- 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/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/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/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.mjs +38 -38
- package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +10 -13
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +6 -1
- package/functions/web3/functionCalls/accessTokenCalls.mjs +21 -12
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +46 -50
- 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 +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 +32 -0
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +40 -36
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +3 -3
- package/functions/web3/functionCalls/transactCallRelayer.mjs +54 -54
- package/functions/web3/getContractMetadata.cjs +1 -1
- package/functions/web3/getContractMetadata.mjs +22 -17
- package/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/functions/web3/getPublicAddressBalance.d.ts +1 -1
- package/functions/web3/getPublicAddressBalance.mjs +6 -6
- package/functions/web3/getTokenHolder.cjs +1 -1
- package/functions/web3/getTokenHolder.mjs +27 -27
- package/functions/web3/index.d.ts +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 +19 -6
- 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 -7
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +56 -38
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +34 -22
- package/index.cjs +1 -1
- package/index.mjs +922 -920
- package/package.json +2 -3
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +17 -10
- package/providers/EthersProviderAdapter.mjs +76 -45
- package/providers/SolanaProviderAdapter.cjs +1 -1
- package/providers/SolanaProviderAdapter.d.ts +11 -7
- package/providers/SolanaProviderAdapter.mjs +31 -16
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +17 -11
- package/providers/WagmiProviderAdapter.mjs +117 -86
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +9 -14
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +9 -15
- package/types/TransactionSimulator.types.d.ts +9 -2
- package/types/activities.types.d.ts +0 -2
- 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/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 +0 -1
- 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/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/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/types/events.types.cjs +0 -1
- package/types/events.types.d.ts +0 -9
- package/types/events.types.mjs +0 -5
- package/types/onramp.types.cjs +0 -1
- package/types/onramp.types.d.ts +0 -58
- package/types/onramp.types.mjs +0 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Mutex } from 'async-mutex';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const balanceFetchingMutex: Mutex;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Mutex as
|
|
2
|
-
const
|
|
1
|
+
import { Mutex as e } from "async-mutex";
|
|
2
|
+
const n = new e();
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
n as balanceFetchingMutex
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants/protocol.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");require("../../types/transactions.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("./mutexes.utils.cjs");require("@coral-xyz/anchor");const s=require("../../error-handling/logger.cjs");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const q=u=>{const e={};return u.forEach(({assetInfo:t,id:i})=>{if(o.NFT_TRANSACTION_TYPES.includes(t.standard)&&i)try{if(t?.contractAddress){const r=t.contractAddress.toLowerCase();e[r]||(e[r]=[]),e[r].push(BigInt(i).toString())}}catch(r){s.Logger.error(`Failed to parse tokenId: ${i}`,r)}}),e};exports.extractTokenIdsFromAssetChanges=q;
|
|
@@ -1,25 +1,40 @@
|
|
|
1
|
-
import { NFT_TRANSACTION_TYPES as
|
|
1
|
+
import { NFT_TRANSACTION_TYPES as p } from "../../constants/protocol.constants.mjs";
|
|
2
2
|
import "../../error-handling/error-codes.constants.mjs";
|
|
3
3
|
import "ethers";
|
|
4
4
|
import "../../types/circom-data.types.mjs";
|
|
5
5
|
import "../../types/transactions.types.mjs";
|
|
6
6
|
import "../../types/activities.types.mjs";
|
|
7
|
+
import "../../constants/server.constants.mjs";
|
|
8
|
+
import "../../API/getServerURL.mjs";
|
|
9
|
+
import "../../data-structures/http/HttpClient.mjs";
|
|
10
|
+
import "axios";
|
|
11
|
+
import "../../constants/chains.constants.mjs";
|
|
12
|
+
import "circomlibjs-hinkal-fork";
|
|
13
|
+
import "libsodium-wrappers";
|
|
14
|
+
import "process";
|
|
15
|
+
import "buffer";
|
|
7
16
|
import "../../constants/vite.constants.mjs";
|
|
8
|
-
import
|
|
9
|
-
|
|
17
|
+
import "../../constants/save-depths.mjs";
|
|
18
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
19
|
+
import "./mutexes.utils.mjs";
|
|
20
|
+
import "@coral-xyz/anchor";
|
|
21
|
+
import { Logger as e } from "../../error-handling/logger.mjs";
|
|
22
|
+
import "@solana/web3.js";
|
|
23
|
+
import "../../data-structures/crypto-keys/keys.mjs";
|
|
24
|
+
const y = (m) => {
|
|
10
25
|
const t = {};
|
|
11
|
-
return
|
|
12
|
-
if (
|
|
26
|
+
return m.forEach(({ assetInfo: o, id: i }) => {
|
|
27
|
+
if (p.includes(o.standard) && i)
|
|
13
28
|
try {
|
|
14
29
|
if (o?.contractAddress) {
|
|
15
30
|
const r = o.contractAddress.toLowerCase();
|
|
16
|
-
t[r] || (t[r] = []), t[r].push(BigInt(
|
|
31
|
+
t[r] || (t[r] = []), t[r].push(BigInt(i).toString());
|
|
17
32
|
}
|
|
18
33
|
} catch (r) {
|
|
19
|
-
|
|
34
|
+
e.error(`Failed to parse tokenId: ${i}`, r);
|
|
20
35
|
}
|
|
21
36
|
}), t;
|
|
22
37
|
};
|
|
23
38
|
export {
|
|
24
|
-
|
|
39
|
+
y as extractTokenIdsFromAssetChanges
|
|
25
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("ethers"),v=require("@solana/web3.js"),o=require("../../crypto/preProcessing.cjs"),s=require("../../providers/EthersProviderAdapter.cjs"),c=require("../../constants/chains.constants.cjs"),g=require("../../data-structures/crypto-keys/keys.cjs"),d=require("./create-provider.cjs"),u=require("../../providers/SolanaProviderAdapter.cjs"),h=(e,t)=>{const r=c.networkRegistry[t].fetchRpcUrl;if(!r)throw new Error("RPC URL not found for the specified chain ID");const n=d.createCustomRpcProvider(r);return new w.ethers.Wallet(e,n)},l=(e,t)=>{const r=c.networkRegistry[t].fetchRpcUrl;if(!r)throw new Error("RPC URL not found for the specified chain ID");const n=d.createCustomRpcProvider(r);return new w.ethers.VoidSigner(e,n)},y=async(e,t)=>{await o.preProcessing();const r=s.default();r.initSigner?.(t),await e.initProviderAdapter(void 0,r),await e.initUserKeys()},P=async(e,t,r)=>{const n=s.default(),i=l(r,t);n.initSigner?.(i),await e.initProviderAdapter(void 0,n)},A=async(e,t,r,n)=>{await o.preProcessing(),await P(e,r,t),await e.initUserKeysWithPassword(n)},R=async(e,t)=>{await o.preProcessing();const r=e.getSelectedNetwork()?.chainId;if(!r)throw Error("chainId is undefined");const n=h(t,r),i=s.default();return i.initSigner?.(n),{userKeys:new g.UserKeys(await i.signMessage(e.signingMessage)),signer:n}},U=async(e,t,r)=>{await o.preProcessing();const n=e.getSelectedNetwork()?.chainId;if(!n)throw Error("chainId is undefined");const i=l(t,n);s.default().initSigner?.(i);const p=new g.UserKeys(r);return await e.switchAccount(i),p},S=e=>{const t=e.userKeys.getDerivedSolanaPublicKey();return{publicKey:new v.PublicKey(t),signTransaction:()=>{throw new Error("Void wallet cannot sign transactions")},signAllTransactions:()=>{throw new Error("Void wallet cannot sign transactions")},signMessage:()=>{throw new Error("Void wallet cannot sign messages")}}},f=async(e,t,r)=>{const n=c.networkRegistry[t].fetchRpcUrl;if(!n)throw new Error("RPC URL not found for the specified chain ID");const i=d.createCustomSolanaConnection(n),a=S(e),p=new u.SolanaProviderAdapter(i,t,a,r);await e.initProviderAdapter(a,p)},W=async(e,t,r)=>{await o.preProcessing();const n=c.networkRegistry[t].fetchRpcUrl;if(!n)throw new Error("RPC URL not found for the specified chain ID");const i=d.createCustomSolanaConnection(n),a=new u.SolanaProviderAdapter(i,t,r);await e.initProviderAdapter(r,a),await e.initUserKeys()},K=async(e,t,r,n)=>{await e.initUserKeysWithPassword(n),await o.preProcessing(),await f(e,r,t)};exports.createSigner=h;exports.createVoidSigner=l;exports.createVoidSolanaWallet=S;exports.prepareEthersProviderAdapter=P;exports.prepareHinkal=y;exports.prepareHinkalWithSignature=A;exports.prepareSolanaHinkal=W;exports.prepareSolanaHinkalWithSignature=K;exports.prepareSolanaProviderAdapter=f;exports.prepareToAccessNewWallet=R;exports.prepareToAccessNewWalletWithSignature=U;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
3
|
+
import { UserKeys } from '../../data-structures/crypto-keys/keys';
|
|
3
4
|
import { SolanaWallet } from '../../types/solana.types';
|
|
4
|
-
export declare const createSigner: (privateKey: string) => ethers.Wallet;
|
|
5
|
-
export declare const createVoidSigner: (address: string) => ethers.VoidSigner;
|
|
5
|
+
export declare const createSigner: (privateKey: string, chainId: number) => ethers.Wallet;
|
|
6
|
+
export declare const createVoidSigner: (address: string, chainId: number) => ethers.VoidSigner;
|
|
6
7
|
export declare const prepareHinkal: (hinkal: IHinkal, signer: ethers.Wallet) => Promise<void>;
|
|
7
|
-
export declare const prepareEthersProviderAdapter: (hinkal: IHinkal, ethereumAddress: string) => Promise<void>;
|
|
8
|
+
export declare const prepareEthersProviderAdapter: (hinkal: IHinkal, chainId: number, ethereumAddress: string) => Promise<void>;
|
|
9
|
+
export declare const prepareHinkalWithSignature: (hinkal: IHinkal, address: string, chainId: number, signature: string) => Promise<void>;
|
|
10
|
+
export declare const prepareToAccessNewWallet: (hinkal: IHinkal, privateKey: string) => Promise<{
|
|
11
|
+
userKeys: UserKeys;
|
|
12
|
+
signer: ethers.Wallet;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const prepareToAccessNewWalletWithSignature: (hinkal: IHinkal, address: string, signature: string) => Promise<UserKeys>;
|
|
8
15
|
export declare const createVoidSolanaWallet: (hinkal: IHinkal) => SolanaWallet;
|
|
9
|
-
export declare const prepareSolanaProviderAdapter: (hinkal: IHinkal, ethereumAddress: string) => Promise<void>;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
16
|
+
export declare const prepareSolanaProviderAdapter: (hinkal: IHinkal, chainId: number, ethereumAddress: string) => Promise<void>;
|
|
17
|
+
export declare const prepareSolanaHinkal: (hinkal: IHinkal, chainId: number, wallet: SolanaWallet) => Promise<void>;
|
|
18
|
+
export declare const prepareSolanaHinkalWithSignature: (hinkal: IHinkal, ethereumAddress: string, chainId: number, signature: string) => Promise<void>;
|
|
@@ -1,27 +1,52 @@
|
|
|
1
|
-
import { ethers as
|
|
2
|
-
import { PublicKey as
|
|
3
|
-
import { preProcessing as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
1
|
+
import { ethers as p } from "ethers";
|
|
2
|
+
import { PublicKey as u } from "@solana/web3.js";
|
|
3
|
+
import { preProcessing as a } from "../../crypto/preProcessing.mjs";
|
|
4
|
+
import s from "../../providers/EthersProviderAdapter.mjs";
|
|
5
|
+
import { networkRegistry as c } from "../../constants/chains.constants.mjs";
|
|
6
|
+
import { UserKeys as w } from "../../data-structures/crypto-keys/keys.mjs";
|
|
7
|
+
import { createCustomRpcProvider as l, createCustomSolanaConnection as f } from "./create-provider.mjs";
|
|
8
|
+
import { SolanaProviderAdapter as g } from "../../providers/SolanaProviderAdapter.mjs";
|
|
9
|
+
const v = (r, t) => {
|
|
10
|
+
const e = c[t].fetchRpcUrl;
|
|
11
|
+
if (!e)
|
|
12
|
+
throw new Error("RPC URL not found for the specified chain ID");
|
|
13
|
+
const n = l(e);
|
|
14
|
+
return new p.Wallet(r, n);
|
|
15
|
+
}, h = (r, t) => {
|
|
16
|
+
const e = c[t].fetchRpcUrl;
|
|
17
|
+
if (!e)
|
|
18
|
+
throw new Error("RPC URL not found for the specified chain ID");
|
|
19
|
+
const n = l(e);
|
|
20
|
+
return new p.VoidSigner(r, n);
|
|
21
|
+
}, C = async (r, t) => {
|
|
22
|
+
await a();
|
|
23
|
+
const e = s();
|
|
24
|
+
e.initSigner?.(t), await r.initProviderAdapter(void 0, e), await r.initUserKeys();
|
|
25
|
+
}, y = async (r, t, e) => {
|
|
26
|
+
const n = s(), o = h(e, t);
|
|
27
|
+
n.initSigner?.(o), await r.initProviderAdapter(void 0, n);
|
|
28
|
+
}, V = async (r, t, e, n) => {
|
|
29
|
+
await a(), await y(r, e, t), await r.initUserKeysWithPassword(n);
|
|
30
|
+
}, D = async (r, t) => {
|
|
31
|
+
await a();
|
|
32
|
+
const e = r.getSelectedNetwork()?.chainId;
|
|
33
|
+
if (!e)
|
|
34
|
+
throw Error("chainId is undefined");
|
|
35
|
+
const n = v(t, e), o = s();
|
|
36
|
+
return o.initSigner?.(n), { userKeys: new w(await o.signMessage(r.signingMessage)), signer: n };
|
|
37
|
+
}, b = async (r, t, e) => {
|
|
38
|
+
await a();
|
|
39
|
+
const n = r.getSelectedNetwork()?.chainId;
|
|
40
|
+
if (!n)
|
|
41
|
+
throw Error("chainId is undefined");
|
|
42
|
+
const o = h(t, n);
|
|
43
|
+
s().initSigner?.(o);
|
|
44
|
+
const d = new w(e);
|
|
45
|
+
return await r.switchAccount(o), d;
|
|
46
|
+
}, A = (r) => {
|
|
47
|
+
const t = r.userKeys.getDerivedSolanaPublicKey();
|
|
23
48
|
return {
|
|
24
|
-
publicKey: new
|
|
49
|
+
publicKey: new u(t),
|
|
25
50
|
signTransaction: () => {
|
|
26
51
|
throw new Error("Void wallet cannot sign transactions");
|
|
27
52
|
},
|
|
@@ -32,30 +57,32 @@ const V = (e) => {
|
|
|
32
57
|
throw new Error("Void wallet cannot sign messages");
|
|
33
58
|
}
|
|
34
59
|
};
|
|
35
|
-
},
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
60
|
+
}, P = async (r, t, e) => {
|
|
61
|
+
const n = c[t].fetchRpcUrl;
|
|
62
|
+
if (!n)
|
|
63
|
+
throw new Error("RPC URL not found for the specified chain ID");
|
|
64
|
+
const o = f(n), i = A(r), d = new g(o, t, i, e);
|
|
65
|
+
await r.initProviderAdapter(i, d);
|
|
66
|
+
}, H = async (r, t, e) => {
|
|
67
|
+
await a();
|
|
68
|
+
const n = c[t].fetchRpcUrl;
|
|
69
|
+
if (!n)
|
|
38
70
|
throw new Error("RPC URL not found for the specified chain ID");
|
|
39
|
-
const
|
|
40
|
-
await
|
|
41
|
-
},
|
|
42
|
-
await n(), await e
|
|
43
|
-
const o = e.userKeys.getDerivedSolanaPublicKey();
|
|
44
|
-
await w(e, o), await p(e, r);
|
|
45
|
-
}, W = async (e, r) => {
|
|
46
|
-
await n(), await e.initUserKeysFromSeedPhrases(r);
|
|
47
|
-
const t = e.userKeys.getDerivedSolanaPublicKey();
|
|
48
|
-
await w(e, t);
|
|
49
|
-
const o = e.userKeys.getDerivedEthereumAddress();
|
|
50
|
-
await p(e, o);
|
|
71
|
+
const o = f(n), i = new g(o, t, e);
|
|
72
|
+
await r.initProviderAdapter(e, i), await r.initUserKeys();
|
|
73
|
+
}, L = async (r, t, e, n) => {
|
|
74
|
+
await r.initUserKeysWithPassword(n), await a(), await P(r, e, t);
|
|
51
75
|
};
|
|
52
76
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
77
|
+
v as createSigner,
|
|
78
|
+
h as createVoidSigner,
|
|
55
79
|
A as createVoidSolanaWallet,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
80
|
+
y as prepareEthersProviderAdapter,
|
|
81
|
+
C as prepareHinkal,
|
|
82
|
+
V as prepareHinkalWithSignature,
|
|
83
|
+
H as prepareSolanaHinkal,
|
|
84
|
+
L as prepareSolanaHinkalWithSignature,
|
|
85
|
+
P as prepareSolanaProviderAdapter,
|
|
86
|
+
D as prepareToAccessNewWallet,
|
|
87
|
+
b as prepareToAccessNewWalletWithSignature
|
|
61
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("ethers"),y=require("../../constants/chains.constants.cjs"),g=require("../../constants/protocol.constants.cjs"),b=require("./erc20tokenFunctions.cjs"),P=require("../../externalABIs/swapAbi.cjs"),m=require("../../error-handling/logger.cjs"),p=require("../../externalABIs/index.cjs"),w=require("./ipfs.cjs"),C=require("./create-provider.cjs"),k=require("../../data-structures/http/HttpClient.cjs");require("axios");const f=require("@solana/web3.js"),d=require("@solana/spl-token"),T=a=>{const{fetchRpcUrl:e}=y.networkRegistry[a];if(!e)throw new Error(`No RPC URL configured for chain ${a}`);return C.createCustomRpcProvider(e)},R=async(a,e,n)=>{try{const s=n.erc20TokenAddress;let r;const o=new B.ethers.Contract(n.erc20TokenAddress,P.ERC20ABI,a);s!==g.zeroAddress?r=await o?.balanceOf(e):r=await o.provider.getBalance(e);const c=r.toBigInt();return c<=0n?null:{token:n,balance:c}}catch{return null}},q=async(a,e)=>{const n=e.nftTokenType===g.TokenType.ERC721,s=new B.ethers.Contract(e.erc20TokenAddress,n?p.ERC721ABI:p.ERC1155ABI,a),{tokenIds:r}=e;if(!r?.length)return null;const o=await Promise.all(r.map(async c=>{try{const t=await s[n?"tokenURI":"uri"](c),l=t.startsWith("ipfs://")?w.getFormattedIpfsUrl(t,!1):t,u=n?l:l.replace("{id}",c);if(u){const i=await k.httpClient.get(u);return i?.image?.startsWith("ipfs://")&&(i.image=w.getFormattedIpfsUrl(i.image,!1)),{image:i.image,tokenId:Number(c),name:i.name}}return{tokenId:Number(c)}}catch{return{tokenId:Number(c)}}}));return{token:e,balance:r?.length?BigInt(r.length):0n,nfts:o}},v=async(a,e,n)=>{const s=n??b.getErc20TokensForChain(a),r=T(a);return(await Promise.all(s.map(async c=>b.isNFTToken(c)?q(r,c):R(r,e,c)))).filter(c=>c!==null)},E=async(a,e,n)=>{try{const s=T(a),r=new B.ethers.Contract(n,P.ERC20ABI,s);let o;return n!==g.zeroAddress?o=await r?.balanceOf(e):o=await s.getBalance(e),o.toBigInt()}catch{return m.Logger.error(`Failed to fetch public balance for address ${e}`),null}},N=async(a,e)=>{try{return await T(a).getTransactionCount(e)}catch(n){return m.Logger.error(`Failed to fetch transaction count for address ${e} on chain ${a}`,n),null}},U=async(a,e,n)=>{const r=y.networkRegistry[a].fetchRpcUrl??"",o=C.createCustomSolanaConnection(r);return(await Promise.all(n.map(async t=>{if(b.isNFTToken(t))return{token:t,balance:1n,nfts:[{image:t.logoURI,tokenId:0,name:t.symbol}]};if(t.erc20TokenAddress===g.solanaNativeAddress){const I=BigInt(await o.getBalance(new f.PublicKey(e)));return{token:t,balance:I}}const l=new f.PublicKey(t.erc20TokenAddress),u=new f.PublicKey(e),i=await d.getAssociatedTokenAddress(l,u,!0,t.is2022Program?d.TOKEN_2022_PROGRAM_ID:d.TOKEN_PROGRAM_ID);if(!await o.getAccountInfo(i))return{token:t,balance:0n};const h=await o.getTokenAccountBalance(i),A=BigInt(h.value.amount);return{token:t,balance:A}}))).filter(t=>t.balance>0n)};exports.getPublicBalance=R;exports.getPublicBalanceByTokenAddress=E;exports.getPublicBalancesOfTokens=v;exports.getPublicTransactionCount=N;exports.getSolanaPublicBalances=U;
|
|
@@ -1,100 +1,105 @@
|
|
|
1
1
|
import { ethers as m } from "ethers";
|
|
2
|
-
import { networkRegistry as
|
|
3
|
-
import { zeroAddress as
|
|
4
|
-
import { getErc20TokensForChain as
|
|
2
|
+
import { networkRegistry as d } from "../../constants/chains.constants.mjs";
|
|
3
|
+
import { zeroAddress as b, solanaNativeAddress as P, TokenType as I } from "../../constants/protocol.constants.mjs";
|
|
4
|
+
import { getErc20TokensForChain as h, isNFTToken as w } from "./erc20tokenFunctions.mjs";
|
|
5
5
|
import { ERC20ABI as B } from "../../externalABIs/swapAbi.mjs";
|
|
6
|
-
import { Logger as
|
|
7
|
-
import { ERC721ABI as
|
|
6
|
+
import { Logger as T } from "../../error-handling/logger.mjs";
|
|
7
|
+
import { ERC721ABI as A, ERC1155ABI as v } from "../../externalABIs/index.mjs";
|
|
8
8
|
import { getFormattedIpfsUrl as p } from "./ipfs.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import { httpClient as
|
|
9
|
+
import { createCustomSolanaConnection as E, createCustomRpcProvider as N } from "./create-provider.mjs";
|
|
10
|
+
import { httpClient as U } from "../../data-structures/http/HttpClient.mjs";
|
|
11
11
|
import "axios";
|
|
12
12
|
import { PublicKey as u } from "@solana/web3.js";
|
|
13
|
-
import { getAssociatedTokenAddress as k, TOKEN_2022_PROGRAM_ID as O, TOKEN_PROGRAM_ID as
|
|
14
|
-
const
|
|
13
|
+
import { getAssociatedTokenAddress as k, TOKEN_2022_PROGRAM_ID as O, TOKEN_PROGRAM_ID as F } from "@solana/spl-token";
|
|
14
|
+
const g = (e) => {
|
|
15
|
+
const { fetchRpcUrl: t } = d[e];
|
|
16
|
+
if (!t)
|
|
17
|
+
throw new Error(`No RPC URL configured for chain ${e}`);
|
|
18
|
+
return N(t);
|
|
19
|
+
}, _ = async (e, t, n) => {
|
|
15
20
|
try {
|
|
16
21
|
const s = n.erc20TokenAddress;
|
|
17
|
-
let
|
|
18
|
-
const o = new m.Contract(n.erc20TokenAddress, B,
|
|
19
|
-
s !==
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
+
let r;
|
|
23
|
+
const o = new m.Contract(n.erc20TokenAddress, B, e);
|
|
24
|
+
s !== b ? r = await o?.balanceOf(t) : r = await o.provider.getBalance(t);
|
|
25
|
+
const c = r.toBigInt();
|
|
26
|
+
return c <= 0n ? null : { token: n, balance: c };
|
|
22
27
|
} catch {
|
|
23
28
|
return null;
|
|
24
29
|
}
|
|
25
|
-
},
|
|
26
|
-
const n = t.nftTokenType ===
|
|
27
|
-
if (!
|
|
30
|
+
}, $ = async (e, t) => {
|
|
31
|
+
const n = t.nftTokenType === I.ERC721, s = new m.Contract(t.erc20TokenAddress, n ? A : v, e), { tokenIds: r } = t;
|
|
32
|
+
if (!r?.length)
|
|
28
33
|
return null;
|
|
29
34
|
const o = await Promise.all(
|
|
30
|
-
|
|
35
|
+
r.map(async (c) => {
|
|
31
36
|
try {
|
|
32
|
-
const a = await s[n ? "tokenURI" : "uri"](
|
|
37
|
+
const a = await s[n ? "tokenURI" : "uri"](c), l = a.startsWith("ipfs://") ? p(a, !1) : a, f = n ? l : l.replace("{id}", c);
|
|
33
38
|
if (f) {
|
|
34
|
-
const i = await
|
|
35
|
-
return i?.image?.startsWith("ipfs://") && (i.image = p(i.image, !1)), { image: i.image, tokenId: Number(
|
|
39
|
+
const i = await U.get(f);
|
|
40
|
+
return i?.image?.startsWith("ipfs://") && (i.image = p(i.image, !1)), { image: i.image, tokenId: Number(c), name: i.name };
|
|
36
41
|
}
|
|
37
|
-
return { tokenId: Number(
|
|
42
|
+
return { tokenId: Number(c) };
|
|
38
43
|
} catch {
|
|
39
|
-
return { tokenId: Number(
|
|
44
|
+
return { tokenId: Number(c) };
|
|
40
45
|
}
|
|
41
46
|
})
|
|
42
47
|
);
|
|
43
48
|
return {
|
|
44
49
|
token: t,
|
|
45
|
-
balance:
|
|
50
|
+
balance: r?.length ? BigInt(r.length) : 0n,
|
|
46
51
|
nfts: o
|
|
47
52
|
};
|
|
48
|
-
},
|
|
49
|
-
const s = n ??
|
|
53
|
+
}, V = async (e, t, n) => {
|
|
54
|
+
const s = n ?? h(e), r = g(e);
|
|
50
55
|
return (await Promise.all(
|
|
51
|
-
s.map(async (
|
|
52
|
-
)).filter((
|
|
53
|
-
},
|
|
56
|
+
s.map(async (c) => w(c) ? $(r, c) : _(r, t, c))
|
|
57
|
+
)).filter((c) => c !== null);
|
|
58
|
+
}, X = async (e, t, n) => {
|
|
54
59
|
try {
|
|
55
|
-
const s = g(
|
|
60
|
+
const s = g(e), r = new m.Contract(n, B, s);
|
|
56
61
|
let o;
|
|
57
|
-
return n !==
|
|
62
|
+
return n !== b ? o = await r?.balanceOf(t) : o = await s.getBalance(t), o.toBigInt();
|
|
58
63
|
} catch {
|
|
59
|
-
return
|
|
64
|
+
return T.error(`Failed to fetch public balance for address ${t}`), null;
|
|
60
65
|
}
|
|
61
|
-
},
|
|
66
|
+
}, Y = async (e, t) => {
|
|
62
67
|
try {
|
|
63
|
-
return await g(
|
|
68
|
+
return await g(e).getTransactionCount(t);
|
|
64
69
|
} catch (n) {
|
|
65
|
-
return
|
|
70
|
+
return T.error(`Failed to fetch transaction count for address ${t} on chain ${e}`, n), null;
|
|
66
71
|
}
|
|
67
|
-
},
|
|
68
|
-
const
|
|
72
|
+
}, Z = async (e, t, n) => {
|
|
73
|
+
const r = d[e].fetchRpcUrl ?? "", o = E(r);
|
|
69
74
|
return (await Promise.all(
|
|
70
75
|
n.map(async (a) => {
|
|
71
|
-
if (
|
|
76
|
+
if (w(a))
|
|
72
77
|
return {
|
|
73
78
|
token: a,
|
|
74
79
|
balance: 1n,
|
|
75
80
|
nfts: [{ image: a.logoURI, tokenId: 0, name: a.symbol }]
|
|
76
81
|
};
|
|
77
|
-
if (a.erc20TokenAddress ===
|
|
78
|
-
const
|
|
79
|
-
return { token: a, balance:
|
|
82
|
+
if (a.erc20TokenAddress === P) {
|
|
83
|
+
const R = BigInt(await o.getBalance(new u(t)));
|
|
84
|
+
return { token: a, balance: R };
|
|
80
85
|
}
|
|
81
86
|
const l = new u(a.erc20TokenAddress), f = new u(t), i = await k(
|
|
82
87
|
l,
|
|
83
88
|
f,
|
|
84
89
|
!0,
|
|
85
|
-
a.is2022Program ? O :
|
|
90
|
+
a.is2022Program ? O : F
|
|
86
91
|
);
|
|
87
92
|
if (!await o.getAccountInfo(i))
|
|
88
93
|
return { token: a, balance: 0n };
|
|
89
|
-
const
|
|
90
|
-
return { token: a, balance:
|
|
94
|
+
const y = await o.getTokenAccountBalance(i), C = BigInt(y.value.amount);
|
|
95
|
+
return { token: a, balance: C };
|
|
91
96
|
})
|
|
92
97
|
)).filter((a) => a.balance > 0n);
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
_ as getPublicBalance,
|
|
101
|
+
X as getPublicBalanceByTokenAddress,
|
|
102
|
+
V as getPublicBalancesOfTokens,
|
|
103
|
+
Y as getPublicTransactionCount,
|
|
104
|
+
Z as getSolanaPublicBalances
|
|
100
105
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=(e,t,s)=>{const o=t.slice(2),r=s.slice(2);return e.toLowerCase().split(o.toLowerCase()).join(r.toLowerCase())};exports.replaceAddressesInCalldata=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replaceAddressesInCalldata: (callDataString: string, searchFor: string, replacement: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants/chains.constants.cjs");function i(t){return t?.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" ")}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){return!t||t===null||Array.isArray(t)&&t.length===0?!0:Object.keys(t).length===0&&t.constructor===Object}const l=t=>{t.startsWith("0x")&&(t=t.slice(2));const e=[];for(let r=0;r<t.length;r+=2){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../constants/chains.constants.cjs");function i(t){return t?.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" ")}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){return!t||t===null||Array.isArray(t)&&t.length===0?!0:Object.keys(t).length===0&&t.constructor===Object}const l=t=>{t.startsWith("0x")&&(t=t.slice(2));const e=[];for(let r=0;r<t.length;r+=2){const s=parseInt(t.slice(r,r+2),16);e.push(s)}return new TextDecoder("utf-8").decode(new Uint8Array(e))},u=(t,e,n=!1)=>{const r=`${t}-${e}`;if(n){const{hinkalAddress:s}=a.networkRegistry[e].contractData;return`${r}-${s}`.toLowerCase()}return r.toLowerCase()},p=t=>{const[,e]=t.split("-");return Number(e)},f=(t,e,n)=>{if(!e||!n)throw Error("oldPart and newPart must be provided");return t.toLowerCase().split(e.toLowerCase()).join(n.toLowerCase())},g=t=>!t||t.trim().length===0?null:t.toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()),y=t=>t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t):!1;exports.capitalizeFirstLetter=o;exports.capitalizeName=g;exports.getChainIdFromStateKey=p;exports.getStateKey=u;exports.hexToUtf8=l;exports.isNullOrEmpty=c;exports.replaceAllInstances=f;exports.toTitleCase=i;exports.validateEmail=y;
|
|
@@ -9,7 +9,6 @@ export declare function isNullOrEmpty(obj: unknown): boolean;
|
|
|
9
9
|
export declare const hexToUtf8: (hex: string) => string;
|
|
10
10
|
export declare const getStateKey: (address: string, chainId: number, withHinkalContractAddress?: boolean) => string;
|
|
11
11
|
export declare const getChainIdFromStateKey: (stateKey: string) => number;
|
|
12
|
-
export declare const getAddressFromStateKey: (stateKey: string) => string;
|
|
13
12
|
export declare const replaceAllInstances: (text: string, oldPart: string, newPart: string) => string;
|
|
14
13
|
export declare const capitalizeName: (name: string | undefined | null) => string | null;
|
|
15
14
|
export declare const validateEmail: (email: string | undefined | null) => boolean;
|
|
@@ -12,37 +12,33 @@ const l = (t) => {
|
|
|
12
12
|
t.startsWith("0x") && (t = t.slice(2));
|
|
13
13
|
const e = [];
|
|
14
14
|
for (let r = 0; r < t.length; r += 2) {
|
|
15
|
-
const
|
|
16
|
-
e.push(
|
|
15
|
+
const s = parseInt(t.slice(r, r + 2), 16);
|
|
16
|
+
e.push(s);
|
|
17
17
|
}
|
|
18
18
|
return new TextDecoder("utf-8").decode(new Uint8Array(e));
|
|
19
|
-
},
|
|
19
|
+
}, f = (t, e, n = !1) => {
|
|
20
20
|
const r = `${t}-${e}`;
|
|
21
|
-
if (
|
|
22
|
-
const { hinkalAddress:
|
|
23
|
-
return `${r}-${
|
|
21
|
+
if (n) {
|
|
22
|
+
const { hinkalAddress: s } = o[e].contractData;
|
|
23
|
+
return `${r}-${s}`.toLowerCase();
|
|
24
24
|
}
|
|
25
25
|
return r.toLowerCase();
|
|
26
|
-
},
|
|
26
|
+
}, p = (t) => {
|
|
27
27
|
const [, e] = t.split("-");
|
|
28
28
|
return Number(e);
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
return e;
|
|
32
|
-
}, g = (t, e, s) => {
|
|
33
|
-
if (!e || !s)
|
|
29
|
+
}, g = (t, e, n) => {
|
|
30
|
+
if (!e || !n)
|
|
34
31
|
throw Error("oldPart and newPart must be provided");
|
|
35
|
-
return t.toLowerCase().split(e.toLowerCase()).join(
|
|
36
|
-
}, w = (t) => !t || t.trim().length === 0 ? null : t.toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase()),
|
|
32
|
+
return t.toLowerCase().split(e.toLowerCase()).join(n.toLowerCase());
|
|
33
|
+
}, w = (t) => !t || t.trim().length === 0 ? null : t.toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase()), C = (t) => t ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t) : !1;
|
|
37
34
|
export {
|
|
38
35
|
c as capitalizeFirstLetter,
|
|
39
36
|
w as capitalizeName,
|
|
40
|
-
|
|
41
|
-
f as
|
|
42
|
-
p as getStateKey,
|
|
37
|
+
p as getChainIdFromStateKey,
|
|
38
|
+
f as getStateKey,
|
|
43
39
|
l as hexToUtf8,
|
|
44
40
|
u as isNullOrEmpty,
|
|
45
41
|
g as replaceAllInstances,
|
|
46
42
|
a as toTitleCase,
|
|
47
|
-
|
|
43
|
+
C as validateEmail
|
|
48
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../API/API.cjs"),l=async(t,o)=>{const a=await i.API.tokensInfoCall(t,o),n=[];return a.forEach((e,c)=>{(!e||!e.balanceStorageOffset||!e.allowanceStorageOffset)&&n.push(o[c])}),n};exports.checkTokensForShielding=l;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import { ERC20Token } from '../../types/token.types';
|
|
2
1
|
export declare const checkTokensForShielding: (chainId: number, erc20Addresses: string[]) => Promise<string[]>;
|
|
3
|
-
export declare const validateAndGetChainId: (tokens: ERC20Token[]) => number;
|
|
4
|
-
export declare const isSameERC20Token: (a?: ERC20Token, b?: ERC20Token) => boolean;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { API as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return o.forEach((r, t) => {
|
|
7
|
-
(!r || !r.balanceStorageOffset || !r.allowanceStorageOffset) && a.push(n[t]);
|
|
1
|
+
import { API as f } from "../../API/API.mjs";
|
|
2
|
+
const s = async (t, n) => {
|
|
3
|
+
const e = await f.tokensInfoCall(t, n), a = [];
|
|
4
|
+
return e.forEach((o, c) => {
|
|
5
|
+
(!o || !o.balanceStorageOffset || !o.allowanceStorageOffset) && a.push(n[c]);
|
|
8
6
|
}), a;
|
|
9
|
-
}
|
|
10
|
-
if (e.length === 0)
|
|
11
|
-
throw new Error("Token array cannot be empty");
|
|
12
|
-
const n = e.map((r) => r.chainId), o = n[0];
|
|
13
|
-
if (!n.every((r) => r === o))
|
|
14
|
-
throw new Error(s.TOKENS_DO_NOT_BELONG_SAME_CHAIN);
|
|
15
|
-
return o;
|
|
16
|
-
}, E = (e, n) => !e || !n ? !1 : c(e.erc20TokenAddress, n.erc20TokenAddress) && e.chainId === n.chainId;
|
|
7
|
+
};
|
|
17
8
|
export {
|
|
18
|
-
|
|
19
|
-
E as isSameERC20Token,
|
|
20
|
-
m as validateAndGetChainId
|
|
9
|
+
s as checkTokensForShielding
|
|
21
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 n=require("../../error-handling/error-codes.constants.cjs"),d=require("./caseInsensitive.utils.cjs"),o=async(e,r,t)=>{const s=await e.getEthereumAddress();if(e.getCurrentChainId()!==r||!d.caseInsensitiveEqual(s,t))throw Error(n.transactionErrorCodes.ERROR_MESSAGE_CHAIN_ADDRESS_CHANGED);return!0};exports.checkChainOrAddressNotUpdated=o;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const checkChainOrAddressNotUpdated: (hinkal: IHinkal, oldChainId: number, oldEthAddress: string) => Promise<boolean>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { transactionErrorCodes as s } from "../../error-handling/error-codes.constants.mjs";
|
|
2
2
|
import { caseInsensitiveEqual as o } from "./caseInsensitive.utils.mjs";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
if (!o(
|
|
3
|
+
const E = async (r, e, t) => {
|
|
4
|
+
const n = await r.getEthereumAddress();
|
|
5
|
+
if (r.getCurrentChainId() !== e || !o(n, t))
|
|
6
6
|
throw Error(s.ERROR_MESSAGE_CHAIN_ADDRESS_CHANGED);
|
|
7
7
|
return !0;
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
E as checkChainOrAddressNotUpdated
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../constants/protocol.constants.cjs"),d=require("./amounts.utils.cjs"),f=require("./caseInsensitive.utils.cjs"),v=require("./publicBalance.utils.cjs"),p=require("../web3/etherFunctions.cjs"),y=require("../../data-structures/crypto-keys/keys.cjs"),A=(s,t)=>s?.length?s.reduce((e,{amount:u,token:r})=>{if(u>=0n)return e;const o=-u,c=t.find(i=>f.caseInsensitiveEqual(i.token.erc20TokenAddress,r.erc20TokenAddress))?.balance??0n;return c<o&&(e.tokensToFund.push(r),e.fundAmounts.push(o-c)),e},{fundAmounts:[],tokensToFund:[]}):{fundAmounts:[],tokensToFund:[]},F=async(s,t,n)=>{if(!n?.length)return{fundAmounts:[],tokensToFund:[],approveTokenAddresses:[],approvedTokenAmounts:[]};const e=s.getCurrentChainId(),u=y.UserKeys.getSignerAddressFromPrivateKey(e,t.privateKey),r=await v.getPublicBalancesOfTokens(e,u,n.map(({token:a})=>a)),{fundAmounts:o,tokensToFund:c}=A(n,r),i=n.length?n.filter(({amount:a,token:g})=>a<0n&&g.erc20TokenAddress!==m.zeroAddress).map(({token:a})=>a.erc20TokenAddress):[],l=i.map(()=>2n**256n-1n);return{fundAmounts:o,tokensToFund:c,approveTokenAddresses:i,approvedTokenAmounts:l}},T=(s,t,n)=>{const e=t.map(r=>r.amount<0n?s.getMyApprovalAmountForInteraction(n,r.token.erc20TokenAddress):0n);return{approvalChanges:t.map((r,o)=>r.amount<0n&&e[o]>0n?d.absBigInt(r.amount)<d.absBigInt(e[o])?r.amount:-e[o]:0n)}};function h(s,t,n,e,u){try{return!n||!s?!0:e?u?+s*u<=+t:!0:p.getAmountInWei(n,s)<=p.getAmountInWei(n,t)}catch{return!0}}exports.getNecessaryApprovalChangesData=T;exports.getNecessaryAssetsForFunding=F;exports.getNecessaryAssetsForFundingFromBalance=A;exports.hasEnoughBalance=h;
|