@kapa123456789/sdk 0.0.25 → 0.0.36
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/common/src/API/accessCodeCalls.cjs +1 -1
- package/common/src/API/accessCodeCalls.mjs +0 -1
- package/common/src/API/admin-calls.cjs +1 -1
- package/common/src/API/admin-calls.mjs +0 -1
- package/common/src/API/brotherhoodCalls.cjs +1 -1
- package/common/src/API/brotherhoodCalls.mjs +0 -1
- package/common/src/API/callLifiAPI.cjs +1 -1
- package/common/src/API/callLifiAPI.mjs +0 -1
- package/common/src/API/callMonitor.cjs +1 -1
- package/common/src/API/callMonitor.mjs +0 -1
- package/common/src/API/callOdosAPI.cjs +1 -1
- package/common/src/API/callOdosAPI.mjs +0 -1
- package/common/src/API/callOkxAPI.cjs +1 -1
- package/common/src/API/callOkxAPI.mjs +0 -1
- package/common/src/API/callOneInchAPI.cjs +1 -1
- package/common/src/API/callOneInchAPI.mjs +0 -1
- package/common/src/API/callRelayer.cjs +1 -1
- package/common/src/API/callRelayer.mjs +0 -1
- package/common/src/API/dashboardAccountCalls.cjs +1 -1
- package/common/src/API/dashboardAccountCalls.mjs +0 -1
- package/common/src/API/dashboardAccountMemberCalls.cjs +1 -1
- package/common/src/API/dashboardAccountMemberCalls.mjs +0 -1
- package/common/src/API/dashboardBalanceCalls.cjs +1 -1
- package/common/src/API/dashboardBalanceCalls.mjs +0 -1
- package/common/src/API/dashboardContactCalls.cjs +1 -1
- package/common/src/API/dashboardContactCalls.mjs +0 -1
- package/common/src/API/dashboardPayoutCalls.cjs +1 -1
- package/common/src/API/dashboardPayoutCalls.mjs +0 -1
- package/common/src/API/dashboardTransactionCalls.cjs +1 -1
- package/common/src/API/dashboardTransactionCalls.mjs +0 -1
- package/common/src/API/enclaveSignatureCalls.cjs +1 -1
- package/common/src/API/enclaveSignatureCalls.mjs +0 -1
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.mjs +0 -1
- package/common/src/API/fetchCommitmentsCache.cjs +1 -1
- package/common/src/API/fetchCommitmentsCache.mjs +0 -1
- package/common/src/API/generate-trading-points.cjs +1 -1
- package/common/src/API/generate-trading-points.mjs +0 -1
- package/common/src/API/get-token-data.cjs +1 -1
- package/common/src/API/get-token-data.mjs +0 -1
- package/common/src/API/getGasEstimates.cjs +1 -1
- package/common/src/API/getGasEstimates.mjs +0 -1
- package/common/src/API/getTokenPrice.cjs +1 -1
- package/common/src/API/getTokenPrice.mjs +0 -1
- package/common/src/API/kycCalls.cjs +1 -1
- package/common/src/API/kycCalls.mjs +0 -1
- package/common/src/API/leaderboardCalls.cjs +1 -1
- package/common/src/API/leaderboardCalls.mjs +0 -1
- package/common/src/API/onrampCalls.cjs +1 -1
- package/common/src/API/onrampCalls.mjs +0 -1
- package/common/src/API/privacy-score-calls.cjs +1 -1
- package/common/src/API/privacy-score-calls.mjs +0 -1
- package/common/src/API/privateSendEmailNotificationsCalls.cjs +1 -1
- package/common/src/API/privateSendEmailNotificationsCalls.mjs +0 -1
- package/common/src/API/privateSendNonceCalls.cjs +1 -1
- package/common/src/API/privateSendNonceCalls.mjs +0 -1
- package/common/src/API/privateSendRecipientInfoCalls.cjs +1 -1
- package/common/src/API/privateSendRecipientInfoCalls.mjs +0 -1
- package/common/src/API/proxyAccountsCalls.cjs +1 -1
- package/common/src/API/proxyAccountsCalls.mjs +0 -1
- package/common/src/API/referralsCalls.cjs +1 -1
- package/common/src/API/referralsCalls.mjs +0 -1
- package/common/src/API/relayCalls.cjs +1 -1
- package/common/src/API/relayCalls.mjs +0 -1
- package/common/src/API/rewardsUserCalls.cjs +1 -1
- package/common/src/API/rewardsUserCalls.mjs +0 -1
- package/common/src/API/seedless-calls.cjs +1 -1
- package/common/src/API/seedless-calls.mjs +0 -1
- package/common/src/API/send-telegram-callback.cjs +1 -1
- package/common/src/API/send-telegram-callback.mjs +0 -1
- package/common/src/API/simulate-batch-tx.cjs +1 -1
- package/common/src/API/simulate-batch-tx.mjs +0 -1
- package/common/src/API/simulate-transaction.cjs +1 -1
- package/common/src/API/simulate-transaction.mjs +0 -1
- package/common/src/API/snapshot-event-calls.cjs +1 -1
- package/common/src/API/snapshot-event-calls.mjs +0 -1
- package/common/src/API/solana-calls.cjs +1 -1
- package/common/src/API/solana-calls.mjs +0 -1
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.mjs +0 -1
- package/common/src/API/token-calls.cjs +1 -1
- package/common/src/API/token-calls.mjs +0 -1
- package/common/src/API/tronSubsidyCalls.cjs +1 -1
- package/common/src/API/tronSubsidyCalls.mjs +0 -1
- package/common/src/API/weeklyAnalyticCalls.cjs +1 -1
- package/common/src/API/weeklyAnalyticCalls.mjs +0 -1
- package/common/src/constants/addresses.constants.cjs +1 -1
- package/common/src/constants/addresses.constants.mjs +0 -1
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.mjs +30 -30
- package/common/src/constants/contracts.constants.cjs +1 -1
- package/common/src/constants/contracts.constants.mjs +1 -1
- package/common/src/constants/kyc.constants.cjs +1 -1
- package/common/src/constants/kyc.constants.mjs +1 -1
- package/common/src/constants/lifi.constants.cjs +1 -1
- package/common/src/constants/lifi.constants.mjs +1 -1
- package/common/src/constants/permit2.constants.cjs +1 -1
- package/common/src/constants/permit2.constants.mjs +7 -8
- package/common/src/constants/protocol.constants.cjs +1 -1
- package/common/src/constants/protocol.constants.mjs +3 -8
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.mjs +1 -2
- package/common/src/constants/vite.constants.cjs +1 -1
- package/common/src/constants/vite.constants.mjs +2 -2
- package/common/src/crypto/babyJub.cjs +1 -1
- package/common/src/crypto/babyJub.mjs +6 -5
- package/common/src/crypto/poseidon.cjs +1 -1
- package/common/src/crypto/poseidon.mjs +11 -10
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +0 -4
- package/common/src/data-structures/Hinkal/Hinkal.mjs +2 -13
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +0 -3
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +0 -4
- package/common/src/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +0 -4
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +0 -3
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +0 -2
- package/common/src/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSignSubAccount.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +0 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +0 -4
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +0 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +0 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +0 -3
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +0 -2
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +0 -2
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +0 -2
- package/common/src/data-structures/Hinkal/index.d.ts +0 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +0 -3
- package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/activity-db.mjs +3 -7
- package/common/src/data-structures/IndexedDB/index.d.ts +0 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +3 -4
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +1 -2
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.mjs +0 -2
- package/common/src/data-structures/crypto-keys/keyUtils.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keyUtils.mjs +1 -1
- package/common/src/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +0 -2
- package/common/src/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +0 -2
- package/common/src/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +0 -2
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +0 -2
- package/common/src/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
- package/common/src/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +0 -1
- package/common/src/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +0 -1
- package/common/src/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
- package/common/src/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +0 -1
- package/common/src/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
- package/common/src/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +0 -1
- package/common/src/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +0 -1
- package/common/src/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
- package/common/src/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +0 -1
- package/common/src/error-handling/customErrors/customErrors.helpers.cjs +1 -1
- package/common/src/error-handling/customErrors/customErrors.helpers.mjs +0 -2
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +1 -3
- package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.mjs +0 -2
- package/common/src/functions/auto-deposit-back-helpers/get-tokens-to-deposit-back.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/get-tokens-to-deposit-back.mjs +0 -1
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.mjs +0 -4
- package/common/src/functions/kyc/checkTokenLimitsUSD.cjs +1 -1
- package/common/src/functions/kyc/checkTokenLimitsUSD.mjs +0 -5
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +0 -1
- package/common/src/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/common/src/functions/pre-transaction/sendV0Transaction.mjs +1 -1
- package/common/src/functions/pre-transaction/solana.cjs +1 -1
- package/common/src/functions/pre-transaction/solana.mjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.mjs +1 -2
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +1 -2
- package/common/src/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructEmporiumProof.mjs +0 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +0 -1
- package/common/src/functions/snarkjs/generateZkProofEnclave.cjs +1 -1
- package/common/src/functions/snarkjs/generateZkProofEnclave.mjs +0 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +0 -1
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.mjs +0 -1
- package/common/src/functions/utils/cacheDevice.utils.cjs +1 -1
- package/common/src/functions/utils/cacheDevice.utils.mjs +0 -2
- package/common/src/functions/utils/cacheFunctions.cjs +1 -1
- package/common/src/functions/utils/cacheFunctions.mjs +1 -1
- package/common/src/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/common/src/functions/utils/encryptInputForEnclave.mjs +0 -1
- package/common/src/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/common/src/functions/utils/erc20tokenFunctions.mjs +2 -14
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.mjs +0 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +0 -3
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +0 -1
- package/common/src/functions/utils/process.utils.cjs +1 -1
- package/common/src/functions/utils/process.utils.mjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +6 -20
- package/common/src/functions/utils/solanaMint.utils.cjs +1 -1
- package/common/src/functions/utils/solanaMint.utils.mjs +1 -1
- package/common/src/functions/utils/string.utils.cjs +1 -1
- package/common/src/functions/utils/string.utils.mjs +7 -10
- package/common/src/functions/utils/token-check.utils.cjs +1 -1
- package/common/src/functions/utils/token-check.utils.mjs +0 -2
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.mjs +1 -1
- package/common/src/functions/utils/tx-confirmation.utils.cjs +1 -1
- package/common/src/functions/utils/tx-confirmation.utils.mjs +1 -2
- package/common/src/functions/web3/events/balanceChangedHandler.cjs +1 -1
- package/common/src/functions/web3/events/balanceChangedHandler.d.ts +1 -1
- package/common/src/functions/web3/events/balanceChangedHandler.mjs +0 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.mjs +0 -1
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +0 -1
- package/common/src/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/common/src/functions/web3/functionCalls/accessTokenCalls.mjs +0 -1
- package/common/src/functions/web3/functionCalls/recoverTransactionFromError.cjs +1 -1
- package/common/src/functions/web3/functionCalls/recoverTransactionFromError.mjs +0 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +0 -2
- package/common/src/functions/web3/getSolanaPriorityFee.cjs +1 -1
- package/common/src/functions/web3/getSolanaPriorityFee.mjs +0 -1
- package/common/src/functions/web3/odosAPI.cjs +1 -1
- package/common/src/functions/web3/odosAPI.mjs +0 -2
- package/common/src/functions/web3/okxAPI.cjs +1 -1
- package/common/src/functions/web3/okxAPI.mjs +1 -1
- package/common/src/functions/web3/oneInchAPI.cjs +1 -1
- package/common/src/functions/web3/oneInchAPI.mjs +0 -3
- package/common/src/functions/web3/uniswapAPI.cjs +1 -1
- package/common/src/functions/web3/uniswapAPI.mjs +1 -4
- package/common/src/providers/TronProviderAdapter.cjs +1 -1
- package/common/src/providers/TronProviderAdapter.mjs +0 -1
- package/common/src/types/balances.types.d.ts +0 -22
- package/common/src/types/hinkal.types.cjs +1 -1
- package/common/src/types/hinkal.types.mjs +1 -1
- package/common/src/types/kyc.types.cjs +1 -1
- package/common/src/types/kyc.types.mjs +1 -1
- package/common/src/types/new-rewards.type.cjs +1 -1
- package/common/src/types/new-rewards.type.mjs +1 -5
- package/common/src/webworker/logError-FeCdVeea.js +1 -0
- package/common/src/webworker/package.json +1 -1
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerNode.d.ts +1 -0
- package/common/src/webworker/snarkjsWorkerNode.cjs +122 -11
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerNode.d.ts +1 -0
- package/common/src/webworker/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/workerProxy-5NFtWSKK.js +1 -0
- package/common/src/webworker/workerThreadsPatch.d.ts +2 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerNode.d.ts +1 -0
- package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
- package/functions/index.mjs +0 -1
- package/functions/utils/index.mjs +0 -1
- package/index.cjs +1 -1
- package/index.mjs +0 -1
- package/package.json +1 -1
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +3 -3
- package/services/Hinkal.mjs +7 -10
- package/types/IHinkal.d.ts +3 -4
- package/types/balances.types.d.ts +1 -1
- package/common/src/API/checkRisk.cjs +0 -1
- package/common/src/API/checkRisk.mjs +0 -3
- package/common/src/API/enclaveRecipientInfoCalls.cjs +0 -1
- package/common/src/API/enclaveRecipientInfoCalls.mjs +0 -2
- package/common/src/API/getCoingeckoPrice.cjs +0 -1
- package/common/src/API/getCoingeckoPrice.mjs +0 -2
- package/common/src/API/getWebsiteURL.cjs +0 -1
- package/common/src/API/getWebsiteURL.mjs +0 -1
- package/common/src/API/index.cjs +0 -1
- package/common/src/API/index.mjs +0 -24
- package/common/src/API/resolve-sns.cjs +0 -1
- package/common/src/API/resolve-sns.mjs +0 -1
- package/common/src/API/tenderly.api.cjs +0 -1
- package/common/src/API/tenderly.api.mjs +0 -4
- package/common/src/constants/activity.constants.cjs +0 -1
- package/common/src/constants/activity.constants.mjs +0 -4
- package/common/src/constants/assets.constants.cjs +0 -1
- package/common/src/constants/assets.constants.mjs +0 -4
- package/common/src/constants/coingecko.constants.cjs +0 -1
- package/common/src/constants/coingecko.constants.mjs +0 -6
- package/common/src/constants/events.constants.cjs +0 -1
- package/common/src/constants/events.constants.mjs +0 -12
- package/common/src/constants/index.cjs +0 -1
- package/common/src/constants/index.mjs +0 -34
- package/common/src/constants/presale.constants.cjs +0 -1
- package/common/src/constants/presale.constants.mjs +0 -3
- package/common/src/constants/schedule.constants.cjs +0 -1
- package/common/src/constants/schedule.constants.mjs +0 -3
- package/common/src/constants/tasks.constants.cjs +0 -1
- package/common/src/constants/tasks.constants.mjs +0 -124
- package/common/src/constants/token-data/arbMainnetRegistryFixed.json.cjs +0 -1
- package/common/src/constants/token-data/arbMainnetRegistryFixed.json.mjs +0 -1841
- package/common/src/constants/token-data/baseRegistryFixed.json.cjs +0 -1
- package/common/src/constants/token-data/baseRegistryFixed.json.mjs +0 -1142
- package/common/src/constants/token-data/ethMainnetRegistryFixed.json.cjs +0 -1
- package/common/src/constants/token-data/ethMainnetRegistryFixed.json.mjs +0 -4274
- package/common/src/constants/token-data/index.cjs +0 -1
- package/common/src/constants/token-data/index.mjs +0 -17
- package/common/src/constants/token-data/optimismRegistryFixed.json.cjs +0 -1
- package/common/src/constants/token-data/optimismRegistryFixed.json.mjs +0 -709
- package/common/src/constants/token-data/polygonRegistryFixed.json.cjs +0 -1
- package/common/src/constants/token-data/polygonRegistryFixed.json.mjs +0 -2317
- package/common/src/constants/token.limits.constants.cjs +0 -1
- package/common/src/constants/token.limits.constants.mjs +0 -5
- package/common/src/constants/tokens.constants.cjs +0 -1
- package/common/src/constants/tokens.constants.mjs +0 -3
- package/common/src/crypto/index.cjs +0 -1
- package/common/src/crypto/index.mjs +0 -3
- package/common/src/data-structures/AccountActions/index.cjs +0 -1
- package/common/src/data-structures/AccountActions/index.mjs +0 -1
- package/common/src/data-structures/Hinkal/HinkalPrivateBalanceController.cjs +0 -1
- package/common/src/data-structures/Hinkal/HinkalPrivateBalanceController.d.ts +0 -19
- package/common/src/data-structures/Hinkal/HinkalPrivateBalanceController.mjs +0 -239
- package/common/src/data-structures/IndexedDB/balances-db.cjs +0 -1
- package/common/src/data-structures/IndexedDB/balances-db.mjs +0 -47
- package/common/src/data-structures/IndexedDB/contact-db.cjs +0 -1
- package/common/src/data-structures/IndexedDB/contact-db.mjs +0 -45
- package/common/src/data-structures/IndexedDB/index.cjs +0 -1
- package/common/src/data-structures/IndexedDB/index.mjs +0 -8
- package/common/src/data-structures/IndexedDB/key-val-store.cjs +0 -1
- package/common/src/data-structures/IndexedDB/key-val-store.d.ts +0 -6
- package/common/src/data-structures/IndexedDB/key-val-store.mjs +0 -41
- package/common/src/data-structures/IndexedDB/pay-activity-db.cjs +0 -1
- package/common/src/data-structures/IndexedDB/pay-activity-db.mjs +0 -21
- package/common/src/data-structures/IndexedDB/prices-db.cjs +0 -1
- package/common/src/data-structures/IndexedDB/prices-db.mjs +0 -54
- package/common/src/data-structures/IndexedDB/private-balances-db.cjs +0 -1
- package/common/src/data-structures/IndexedDB/private-balances-db.mjs +0 -21
- package/common/src/data-structures/IndexedDB/signatures-db.cjs +0 -1
- package/common/src/data-structures/IndexedDB/signatures-db.mjs +0 -40
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +0 -168
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +0 -94
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +0 -144
- package/common/src/data-structures/TokenDBs/PublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/PublicTokensDB.mjs +0 -29
- package/common/src/data-structures/TokenDBs/index.cjs +0 -1
- package/common/src/data-structures/TokenDBs/index.mjs +0 -4
- package/common/src/data-structures/cacheDevices/index.cjs +0 -1
- package/common/src/data-structures/cacheDevices/index.mjs +0 -2
- package/common/src/data-structures/crypto-keys/index.cjs +0 -1
- package/common/src/data-structures/crypto-keys/index.mjs +0 -4
- package/common/src/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +0 -1
- package/common/src/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +0 -1
- package/common/src/data-structures/event-service/index.cjs +0 -1
- package/common/src/data-structures/event-service/index.mjs +0 -16
- package/common/src/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +0 -1
- package/common/src/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +0 -1
- package/common/src/data-structures/http/index.cjs +0 -1
- package/common/src/data-structures/http/index.mjs +0 -2
- package/common/src/data-structures/merkle-tree/index.cjs +0 -1
- package/common/src/data-structures/merkle-tree/index.mjs +0 -3
- package/common/src/data-structures/snapshot/index.cjs +0 -1
- package/common/src/data-structures/snapshot/index.mjs +0 -7
- package/common/src/error-handling/customErrors/index.cjs +0 -1
- package/common/src/error-handling/customErrors/index.mjs +0 -4
- package/common/src/error-handling/index.cjs +0 -1
- package/common/src/error-handling/index.mjs +0 -10
- package/common/src/functions/auto-deposit-back-helpers/index.cjs +0 -1
- package/common/src/functions/auto-deposit-back-helpers/index.mjs +0 -4
- package/common/src/functions/index.cjs +0 -1
- package/common/src/functions/index.mjs +0 -82
- package/common/src/functions/kyc/index.cjs +0 -1
- package/common/src/functions/kyc/index.mjs +0 -4
- package/common/src/functions/kyc/passportHelper.cjs +0 -1
- package/common/src/functions/kyc/passportHelper.mjs +0 -1
- package/common/src/functions/pre-transaction/addressTableLookup.cjs +0 -1
- package/common/src/functions/pre-transaction/addressTableLookup.mjs +0 -2
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +0 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +0 -5
- package/common/src/functions/pre-transaction/getFlatFees.cjs +0 -1
- package/common/src/functions/pre-transaction/getFlatFees.mjs +0 -4
- package/common/src/functions/pre-transaction/index.cjs +0 -1
- package/common/src/functions/pre-transaction/index.mjs +0 -21
- package/common/src/functions/pre-transaction/initTokenLimitIfNeeded.cjs +0 -1
- package/common/src/functions/pre-transaction/initTokenLimitIfNeeded.mjs +0 -3
- package/common/src/functions/pre-transaction/interaction-to-action.cjs +0 -1
- package/common/src/functions/pre-transaction/interaction-to-action.mjs +0 -1
- package/common/src/functions/pre-transaction/sendInitNullifiersTransaction.cjs +0 -1
- package/common/src/functions/pre-transaction/sendInitNullifiersTransaction.mjs +0 -3
- package/common/src/functions/pre-transaction/store-instructions.cjs +0 -1
- package/common/src/functions/pre-transaction/store-instructions.mjs +0 -2
- package/common/src/functions/pre-transaction/store-proof.cjs +0 -1
- package/common/src/functions/pre-transaction/store-proof.mjs +0 -3
- package/common/src/functions/private-wallet/index.cjs +0 -1
- package/common/src/functions/private-wallet/index.mjs +0 -3
- package/common/src/functions/private-wallet/opProducer.cjs +0 -1
- package/common/src/functions/private-wallet/opProducer.mjs +0 -3
- package/common/src/functions/snarkjs/index.cjs +0 -1
- package/common/src/functions/snarkjs/index.mjs +0 -7
- package/common/src/functions/snarkjs/verifyCommitmentValidationData.cjs +0 -1
- package/common/src/functions/snarkjs/verifyCommitmentValidationData.mjs +0 -6
- package/common/src/functions/utils/buildClaimableDepositPlan.cjs +0 -1
- package/common/src/functions/utils/buildClaimableDepositPlan.mjs +0 -3
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.cjs +0 -1
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.mjs +0 -4
- package/common/src/functions/utils/deposit-claimable.utils.cjs +0 -1
- package/common/src/functions/utils/deposit-claimable.utils.mjs +0 -12
- package/common/src/functions/utils/dispatchBalanceRefreshes.cjs +0 -1
- package/common/src/functions/utils/dispatchBalanceRefreshes.mjs +0 -4
- package/common/src/functions/utils/enclave-recipient-info-storage.cjs +0 -1
- package/common/src/functions/utils/enclave-recipient-info-storage.mjs +0 -2
- package/common/src/functions/utils/enclave-signature-storage.cjs +0 -1
- package/common/src/functions/utils/enclave-signature-storage.mjs +0 -2
- package/common/src/functions/utils/enclave-utxo-storage.cjs +0 -1
- package/common/src/functions/utils/enclave-utxo-storage.mjs +0 -4
- package/common/src/functions/utils/evmNetworkFunctions.cjs +0 -1
- package/common/src/functions/utils/evmNetworkFunctions.mjs +0 -1
- package/common/src/functions/utils/formatter.cjs +0 -1
- package/common/src/functions/utils/formatter.mjs +0 -1
- package/common/src/functions/utils/getBlockExplorerUrl.cjs +0 -1
- package/common/src/functions/utils/getBlockExplorerUrl.mjs +0 -1
- package/common/src/functions/utils/inLogicMetadata.cjs +0 -1
- package/common/src/functions/utils/inLogicMetadata.mjs +0 -1
- package/common/src/functions/utils/index.cjs +0 -1
- package/common/src/functions/utils/index.mjs +0 -68
- package/common/src/functions/utils/ipfs.cjs +0 -1
- package/common/src/functions/utils/ipfs.mjs +0 -1
- package/common/src/functions/utils/lifi.utils.cjs +0 -1
- package/common/src/functions/utils/lifi.utils.mjs +0 -4
- package/common/src/functions/utils/networks.utils.cjs +0 -1
- package/common/src/functions/utils/networks.utils.mjs +0 -1
- package/common/src/functions/utils/nftTokenFunctions.cjs +0 -1
- package/common/src/functions/utils/nftTokenFunctions.mjs +0 -2
- package/common/src/functions/utils/prepareHinkal.cjs +0 -1
- package/common/src/functions/utils/prepareHinkal.mjs +0 -7
- package/common/src/functions/utils/rpc-int-encode.cjs +0 -1
- package/common/src/functions/utils/rpc-int-encode.mjs +0 -1
- package/common/src/functions/utils/transfer-claimable.utils.cjs +0 -1
- package/common/src/functions/utils/transfer-claimable.utils.mjs +0 -12
- package/common/src/functions/utils/userAgent.cjs +0 -1
- package/common/src/functions/utils/userAgent.mjs +0 -3
- package/common/src/functions/utils/walletBalances.utils.cjs +0 -1
- package/common/src/functions/utils/walletBalances.utils.mjs +0 -1
- package/common/src/functions/web3/EIP-712.cjs +0 -1
- package/common/src/functions/web3/EIP-712.mjs +0 -1
- package/common/src/functions/web3/connectors.utils.cjs +0 -1
- package/common/src/functions/web3/connectors.utils.mjs +0 -1
- package/common/src/functions/web3/events/getTransactionLogEvents.cjs +0 -1
- package/common/src/functions/web3/events/getTransactionLogEvents.mjs +0 -2
- package/common/src/functions/web3/events/index.cjs +0 -1
- package/common/src/functions/web3/events/index.mjs +0 -4
- package/common/src/functions/web3/getTokenHolder.cjs +0 -1
- package/common/src/functions/web3/getTokenHolder.mjs +0 -7
- package/common/src/functions/web3/index.cjs +0 -1
- package/common/src/functions/web3/index.mjs +0 -16
- package/common/src/functions/web3/runContractFunction.cjs +0 -1
- package/common/src/functions/web3/runContractFunction.mjs +0 -1
- package/common/src/mutexes/mutex.cjs +0 -1
- package/common/src/mutexes/mutex.mjs +0 -3
- package/common/src/types/index.cjs +0 -1
- package/common/src/types/index.mjs +0 -19
- package/common/src/types/schedule.types.cjs +0 -1
- package/common/src/types/schedule.types.mjs +0 -6
- package/common/src/webworker/workerProxy-DPSmXOIl.js +0 -122
- package/functions/integrations/index.mjs +0 -5
- package/functions/utils/getFeeStructure.mjs +0 -1
- package/types/balances.types.cjs +0 -1
- package/types/balances.types.mjs +0 -2
- package/types/external-action.types.cjs +0 -1
- package/types/external-action.types.mjs +0 -2
- package/types/index.cjs +0 -1
- package/types/index.mjs +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chains.constants.cjs`);require(`../functions/web3/etherFunctions.cjs`),require(`../functions/utils/erc20tokenFunctions.cjs`),e.chainIds.optimism;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chains.constants.cjs`);e.chainIds.ethMainnet,e.chainIds.arbMainnet,e.chainIds.optimism,e.chainIds.base,e.chainIds.arcTestnet,e.chainIds.polygon,e.chainIds.solanaMainnet;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./poseidon.cjs`),require(`./babyJub.cjs`),require(`./preProcessing.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./AccountActions.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./AccountActions.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../types/balances.types.cjs`),t=require(`../../functions/web3/etherFunctions.cjs`),n=require(`../../functions/utils/upToDateState.cjs`),r=require(`../../error-handling/logger.cjs`),i=require(`../../functions/utils/string.utils.cjs`),a=require(`../../functions/utils/token-check.utils.cjs`),o=require(`../../functions/web3/events/balanceChangedHandler.cjs`),s=require(`../IndexedDB/private-balances-db.cjs`),c=require(`../IndexedDB/prices-db.cjs`);var l=(e,t)=>{switch(t.type){case`SET_BALANCES`:{let n=e[t.chainId];if(t.balances===void 0){let n={...e};return delete n[t.chainId],Object.keys(n).length>0?n:{}}if(n===void 0)return{...e,[t.chainId]:t.balances};let r=t.balances,i=r.filter(e=>!n.some(t=>a.isSameERC20Token(e.token,t.token))),o=n.map(e=>({...e,balance:r.find(t=>a.isSameERC20Token(t.token,e.token))?.balance??0n})).filter(e=>e.balance>0n);return o=[...o,...i],{...e,[t.chainId]:o}}case`SET_USD_BALANCES`:{let n=e[t.chainId];if(n===void 0||t.balances===void 0)return e;let r=t.balances,i=n.map(e=>({...e,usdValue:r.find(t=>a.isSameERC20Token(t.token,e.token))?.usdValue??0}));return{...e,[t.chainId]:i}}case`CLEAR_BALANCES`:{if(t.chainId===void 0)return{};let n={...e};return delete n[t.chainId],Object.keys(n).length>0?n:{}}case`SET_LOADING`:{let n=e[t.chainId];if(n===void 0)return e;if(n.length===0&&t.newValue)return{...e,[t.chainId]:void 0};let r=n.map(e=>({...e,isBalanceLoading:t.newValue}));return{...e,[t.chainId]:r}}case`SET_USD_LOADING`:{let n=e[t.chainId];if(n===void 0)return e;let r=n.map(e=>({...e,isUsdValueLoading:t.newValue}));return{...e,[t.chainId]:r}}default:return e}},u=class{privateBalancesState={};privateBalancesListeners=new Set;constructor(e){this.hinkal=e,o.subscribeToBalanceChange(e=>{this.applyRefreshFromBalanceChangeEvent(e).catch(e=>{r.Logger.error(`Private balance refresh from balance change failed:`,e)})})}getSnapshot(){return this.privateBalancesState}onPrivateBalancesWithUSDChange(e){return this.privateBalancesListeners.add(e),()=>this.privateBalancesListeners.delete(e)}async applyRefreshFromBalanceChangeEvent(t){if(!t){await this.refreshInternal(e.PrivateBalanceUpdateType.FreshWithoutLoader);return}let{updateType:n,balanceChangeState:r,chainIdToUpdate:i,resetCacheBefore:a,updateTokensListBefore:o}=t;await this.refreshInternal(n,r,a,o,i)}dispatch(e){this.privateBalancesState=l(this.privateBalancesState,e);let t=this.privateBalancesState;this.privateBalancesListeners.forEach(e=>e(t))}async getAddressAndChain(e){return{ethAdd:e?.ethereumAddress??await this.hinkal.getEthereumAddress(),userKeys:e?.userKeys??this.hinkal.userKeys}}async hasCache(e,t){return await s.privateBalancesStorage.getBalancesByWallet(e,t)!==void 0}async getBalancesWithUsdValues(e,n){try{if(!n)return[];let r=e.map(e=>e.token.erc20TokenAddress);if(!r.length)return[];let i=await c.pricesStorage.getAndUpdatePrices(n,r),a=new Map(r.map((e,t)=>[e,i[t]]));return[...e.map(e=>{try{let n=e.token.erc20TokenAddress,r=a.get(n)??0,i=e.balance,o=Number(t.getAmountInToken(e.token,i))*r;return{...e,usdValue:o}}catch{return{...e,usdValue:0}}})]}catch{return r.Logger.log(`Error fetching private token balances`),[]}}handleCached=async(e,a)=>{try{await n.checkAddressNotUpdated(this.hinkal,e),this.dispatch({type:`SET_BALANCES`,chainId:a,balances:void 0});let r=await s.privateBalancesStorage.getBalancesByWallet(e,a),o=await c.pricesStorage.getPrices();if(await n.checkAddressNotUpdated(this.hinkal,e),!r||(this.dispatch({type:`SET_BALANCES`,chainId:a,balances:r}),!o))return;let l=r.map(e=>{let n=i.getTokenStateKey(e.token.erc20TokenAddress,a);return{...e,usdValue:o[n]?Number(t.getAmountInToken(e.token,e.balance))*o[n]:0}});this.dispatch({type:`SET_USD_BALANCES`,chainId:a,balances:l})}catch(e){r.Logger.error(`Error refreshing cached private balance:`,e)}};handleFresh=async(e,t,i,a,o,c)=>{let l=o;try{await n.checkAddressNotUpdated(this.hinkal,e);let r=await this.hasCache(e,t);await n.checkAddressNotUpdated(this.hinkal,e),l=o||!r,l&&this.dispatch({type:`SET_LOADING`,chainId:t,newValue:!0}),await n.checkAddressNotUpdated(this.hinkal,e),a&&await this.hinkal.resetMerkle([t]);let u=await this.hinkal.getTotalBalance(t,i,e,a,c);await n.checkAddressNotUpdated(this.hinkal,e);let d=u.filter(e=>e.balance>0n);this.dispatch({type:`SET_BALANCES`,chainId:t,balances:d}),await s.privateBalancesStorage.setBalances(e,t,d),await n.checkAddressNotUpdated(this.hinkal,e),l&&(this.dispatch({type:`SET_USD_LOADING`,chainId:t,newValue:!0}),this.dispatch({type:`SET_LOADING`,chainId:t,newValue:!1})),await n.checkAddressNotUpdated(this.hinkal,e);let f=await this.getBalancesWithUsdValues(d,t);await n.checkAddressNotUpdated(this.hinkal,e),f.length>0&&this.dispatch({type:`SET_USD_BALANCES`,chainId:t,balances:f})}catch(e){r.Logger.error(`Error refreshing private balance:`,e)}finally{l&&(this.dispatch({type:`SET_LOADING`,chainId:t,newValue:!1}),this.dispatch({type:`SET_USD_LOADING`,chainId:t,newValue:!1}))}};getSupportedChainsToUpdate(e){let t=this.hinkal.getSupportedChains();return e?t.includes(e)?[e]:[]:t}async refreshInternal(t=e.PrivateBalanceUpdateType.FreshWithoutLoader,n,r=!1,i=!1,a){let{ethAdd:o,userKeys:s}=await this.getAddressAndChain(n);!o||!s?.getShieldedPublicKey()||await Promise.all(this.getSupportedChainsToUpdate(a).map(async n=>{switch(t){case e.PrivateBalanceUpdateType.OnlyCache:await this.handleCached(o,n);break;case e.PrivateBalanceUpdateType.Fresh:await this.handleFresh(o,n,s,r,!0,i);break;case e.PrivateBalanceUpdateType.FreshWithoutLoader:await this.handleFresh(o,n,s,r,!1,i);break;default:break}}))}};exports.HinkalPrivateBalanceController=u;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { PrivateBalancesState } from '../../types/balances.types';
|
|
2
|
-
import { IHinkal } from './IHinkal';
|
|
3
|
-
export declare class HinkalPrivateBalanceController {
|
|
4
|
-
private readonly hinkal;
|
|
5
|
-
private privateBalancesState;
|
|
6
|
-
private readonly privateBalancesListeners;
|
|
7
|
-
constructor(hinkal: IHinkal);
|
|
8
|
-
getSnapshot(): PrivateBalancesState;
|
|
9
|
-
onPrivateBalancesWithUSDChange(callback: (state: PrivateBalancesState) => void): () => void;
|
|
10
|
-
private applyRefreshFromBalanceChangeEvent;
|
|
11
|
-
private dispatch;
|
|
12
|
-
private getAddressAndChain;
|
|
13
|
-
private hasCache;
|
|
14
|
-
private getBalancesWithUsdValues;
|
|
15
|
-
private handleCached;
|
|
16
|
-
private handleFresh;
|
|
17
|
-
private getSupportedChainsToUpdate;
|
|
18
|
-
private refreshInternal;
|
|
19
|
-
}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { PrivateBalanceUpdateType as e } from "../../types/balances.types.mjs";
|
|
2
|
-
import { getAmountInToken as t } from "../../functions/web3/etherFunctions.mjs";
|
|
3
|
-
import { checkAddressNotUpdated as n } from "../../functions/utils/upToDateState.mjs";
|
|
4
|
-
import { Logger as r } from "../../error-handling/logger.mjs";
|
|
5
|
-
import { getTokenStateKey as i } from "../../functions/utils/string.utils.mjs";
|
|
6
|
-
import { isSameERC20Token as a } from "../../functions/utils/token-check.utils.mjs";
|
|
7
|
-
import { subscribeToBalanceChange as o } from "../../functions/web3/events/balanceChangedHandler.mjs";
|
|
8
|
-
import { privateBalancesStorage as s } from "../IndexedDB/private-balances-db.mjs";
|
|
9
|
-
import { pricesStorage as c } from "../IndexedDB/prices-db.mjs";
|
|
10
|
-
//#region libs/shared/common/src/data-structures/Hinkal/HinkalPrivateBalanceController.ts
|
|
11
|
-
var l = (e, t) => {
|
|
12
|
-
switch (t.type) {
|
|
13
|
-
case "SET_BALANCES": {
|
|
14
|
-
let n = e[t.chainId];
|
|
15
|
-
if (t.balances === void 0) {
|
|
16
|
-
let n = { ...e };
|
|
17
|
-
return delete n[t.chainId], Object.keys(n).length > 0 ? n : {};
|
|
18
|
-
}
|
|
19
|
-
if (n === void 0) return {
|
|
20
|
-
...e,
|
|
21
|
-
[t.chainId]: t.balances
|
|
22
|
-
};
|
|
23
|
-
let r = t.balances, i = r.filter((e) => !n.some((t) => a(e.token, t.token))), o = n.map((e) => ({
|
|
24
|
-
...e,
|
|
25
|
-
balance: r.find((t) => a(t.token, e.token))?.balance ?? 0n
|
|
26
|
-
})).filter((e) => e.balance > 0n);
|
|
27
|
-
return o = [...o, ...i], {
|
|
28
|
-
...e,
|
|
29
|
-
[t.chainId]: o
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
case "SET_USD_BALANCES": {
|
|
33
|
-
let n = e[t.chainId];
|
|
34
|
-
if (n === void 0 || t.balances === void 0) return e;
|
|
35
|
-
let r = t.balances, i = n.map((e) => ({
|
|
36
|
-
...e,
|
|
37
|
-
usdValue: r.find((t) => a(t.token, e.token))?.usdValue ?? 0
|
|
38
|
-
}));
|
|
39
|
-
return {
|
|
40
|
-
...e,
|
|
41
|
-
[t.chainId]: i
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
case "CLEAR_BALANCES": {
|
|
45
|
-
if (t.chainId === void 0) return {};
|
|
46
|
-
let n = { ...e };
|
|
47
|
-
return delete n[t.chainId], Object.keys(n).length > 0 ? n : {};
|
|
48
|
-
}
|
|
49
|
-
case "SET_LOADING": {
|
|
50
|
-
let n = e[t.chainId];
|
|
51
|
-
if (n === void 0) return e;
|
|
52
|
-
if (n.length === 0 && t.newValue) return {
|
|
53
|
-
...e,
|
|
54
|
-
[t.chainId]: void 0
|
|
55
|
-
};
|
|
56
|
-
let r = n.map((e) => ({
|
|
57
|
-
...e,
|
|
58
|
-
isBalanceLoading: t.newValue
|
|
59
|
-
}));
|
|
60
|
-
return {
|
|
61
|
-
...e,
|
|
62
|
-
[t.chainId]: r
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
case "SET_USD_LOADING": {
|
|
66
|
-
let n = e[t.chainId];
|
|
67
|
-
if (n === void 0) return e;
|
|
68
|
-
let r = n.map((e) => ({
|
|
69
|
-
...e,
|
|
70
|
-
isUsdValueLoading: t.newValue
|
|
71
|
-
}));
|
|
72
|
-
return {
|
|
73
|
-
...e,
|
|
74
|
-
[t.chainId]: r
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
default: return e;
|
|
78
|
-
}
|
|
79
|
-
}, u = class {
|
|
80
|
-
privateBalancesState = {};
|
|
81
|
-
privateBalancesListeners = /* @__PURE__ */ new Set();
|
|
82
|
-
constructor(e) {
|
|
83
|
-
this.hinkal = e, o((e) => {
|
|
84
|
-
this.applyRefreshFromBalanceChangeEvent(e).catch((e) => {
|
|
85
|
-
r.error("Private balance refresh from balance change failed:", e);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
getSnapshot() {
|
|
90
|
-
return this.privateBalancesState;
|
|
91
|
-
}
|
|
92
|
-
onPrivateBalancesWithUSDChange(e) {
|
|
93
|
-
return this.privateBalancesListeners.add(e), () => this.privateBalancesListeners.delete(e);
|
|
94
|
-
}
|
|
95
|
-
async applyRefreshFromBalanceChangeEvent(t) {
|
|
96
|
-
if (!t) {
|
|
97
|
-
await this.refreshInternal(e.FreshWithoutLoader);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
let { updateType: n, balanceChangeState: r, chainIdToUpdate: i, resetCacheBefore: a, updateTokensListBefore: o } = t;
|
|
101
|
-
await this.refreshInternal(n, r, a, o, i);
|
|
102
|
-
}
|
|
103
|
-
dispatch(e) {
|
|
104
|
-
this.privateBalancesState = l(this.privateBalancesState, e);
|
|
105
|
-
let t = this.privateBalancesState;
|
|
106
|
-
this.privateBalancesListeners.forEach((e) => e(t));
|
|
107
|
-
}
|
|
108
|
-
async getAddressAndChain(e) {
|
|
109
|
-
return {
|
|
110
|
-
ethAdd: e?.ethereumAddress ?? await this.hinkal.getEthereumAddress(),
|
|
111
|
-
userKeys: e?.userKeys ?? this.hinkal.userKeys
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
async hasCache(e, t) {
|
|
115
|
-
return await s.getBalancesByWallet(e, t) !== void 0;
|
|
116
|
-
}
|
|
117
|
-
async getBalancesWithUsdValues(e, n) {
|
|
118
|
-
try {
|
|
119
|
-
if (!n) return [];
|
|
120
|
-
let r = e.map((e) => e.token.erc20TokenAddress);
|
|
121
|
-
if (!r.length) return [];
|
|
122
|
-
let i = await c.getAndUpdatePrices(n, r), a = new Map(r.map((e, t) => [e, i[t]]));
|
|
123
|
-
return [...e.map((e) => {
|
|
124
|
-
try {
|
|
125
|
-
let n = e.token.erc20TokenAddress, r = a.get(n) ?? 0, i = e.balance, o = Number(t(e.token, i)) * r;
|
|
126
|
-
return {
|
|
127
|
-
...e,
|
|
128
|
-
usdValue: o
|
|
129
|
-
};
|
|
130
|
-
} catch {
|
|
131
|
-
return {
|
|
132
|
-
...e,
|
|
133
|
-
usdValue: 0
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
})];
|
|
137
|
-
} catch {
|
|
138
|
-
return r.log("Error fetching private token balances"), [];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
handleCached = async (e, a) => {
|
|
142
|
-
try {
|
|
143
|
-
await n(this.hinkal, e), this.dispatch({
|
|
144
|
-
type: "SET_BALANCES",
|
|
145
|
-
chainId: a,
|
|
146
|
-
balances: void 0
|
|
147
|
-
});
|
|
148
|
-
let r = await s.getBalancesByWallet(e, a), o = await c.getPrices();
|
|
149
|
-
if (await n(this.hinkal, e), !r || (this.dispatch({
|
|
150
|
-
type: "SET_BALANCES",
|
|
151
|
-
chainId: a,
|
|
152
|
-
balances: r
|
|
153
|
-
}), !o)) return;
|
|
154
|
-
let l = r.map((e) => {
|
|
155
|
-
let n = i(e.token.erc20TokenAddress, a);
|
|
156
|
-
return {
|
|
157
|
-
...e,
|
|
158
|
-
usdValue: o[n] ? Number(t(e.token, e.balance)) * o[n] : 0
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
this.dispatch({
|
|
162
|
-
type: "SET_USD_BALANCES",
|
|
163
|
-
chainId: a,
|
|
164
|
-
balances: l
|
|
165
|
-
});
|
|
166
|
-
} catch (e) {
|
|
167
|
-
r.error("Error refreshing cached private balance:", e);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
handleFresh = async (e, t, i, a, o, c) => {
|
|
171
|
-
let l = o;
|
|
172
|
-
try {
|
|
173
|
-
await n(this.hinkal, e);
|
|
174
|
-
let r = await this.hasCache(e, t);
|
|
175
|
-
await n(this.hinkal, e), l = o || !r, l && this.dispatch({
|
|
176
|
-
type: "SET_LOADING",
|
|
177
|
-
chainId: t,
|
|
178
|
-
newValue: !0
|
|
179
|
-
}), await n(this.hinkal, e), a && await this.hinkal.resetMerkle([t]);
|
|
180
|
-
let u = await this.hinkal.getTotalBalance(t, i, e, a, c);
|
|
181
|
-
await n(this.hinkal, e);
|
|
182
|
-
let d = u.filter((e) => e.balance > 0n);
|
|
183
|
-
this.dispatch({
|
|
184
|
-
type: "SET_BALANCES",
|
|
185
|
-
chainId: t,
|
|
186
|
-
balances: d
|
|
187
|
-
}), await s.setBalances(e, t, d), await n(this.hinkal, e), l && (this.dispatch({
|
|
188
|
-
type: "SET_USD_LOADING",
|
|
189
|
-
chainId: t,
|
|
190
|
-
newValue: !0
|
|
191
|
-
}), this.dispatch({
|
|
192
|
-
type: "SET_LOADING",
|
|
193
|
-
chainId: t,
|
|
194
|
-
newValue: !1
|
|
195
|
-
})), await n(this.hinkal, e);
|
|
196
|
-
let f = await this.getBalancesWithUsdValues(d, t);
|
|
197
|
-
await n(this.hinkal, e), f.length > 0 && this.dispatch({
|
|
198
|
-
type: "SET_USD_BALANCES",
|
|
199
|
-
chainId: t,
|
|
200
|
-
balances: f
|
|
201
|
-
});
|
|
202
|
-
} catch (e) {
|
|
203
|
-
r.error("Error refreshing private balance:", e);
|
|
204
|
-
} finally {
|
|
205
|
-
l && (this.dispatch({
|
|
206
|
-
type: "SET_LOADING",
|
|
207
|
-
chainId: t,
|
|
208
|
-
newValue: !1
|
|
209
|
-
}), this.dispatch({
|
|
210
|
-
type: "SET_USD_LOADING",
|
|
211
|
-
chainId: t,
|
|
212
|
-
newValue: !1
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
getSupportedChainsToUpdate(e) {
|
|
217
|
-
let t = this.hinkal.getSupportedChains();
|
|
218
|
-
return e ? t.includes(e) ? [e] : [] : t;
|
|
219
|
-
}
|
|
220
|
-
async refreshInternal(t = e.FreshWithoutLoader, n, r = !1, i = !1, a) {
|
|
221
|
-
let { ethAdd: o, userKeys: s } = await this.getAddressAndChain(n);
|
|
222
|
-
!o || !s?.getShieldedPublicKey() || await Promise.all(this.getSupportedChainsToUpdate(a).map(async (n) => {
|
|
223
|
-
switch (t) {
|
|
224
|
-
case e.OnlyCache:
|
|
225
|
-
await this.handleCached(o, n);
|
|
226
|
-
break;
|
|
227
|
-
case e.Fresh:
|
|
228
|
-
await this.handleFresh(o, n, s, r, !0, i);
|
|
229
|
-
break;
|
|
230
|
-
case e.FreshWithoutLoader:
|
|
231
|
-
await this.handleFresh(o, n, s, r, !1, i);
|
|
232
|
-
break;
|
|
233
|
-
default: break;
|
|
234
|
-
}
|
|
235
|
-
}));
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
//#endregion
|
|
239
|
-
export { u as HinkalPrivateBalanceController };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../error-handling/logger.cjs`),t=require(`../../functions/utils/string.utils.cjs`);require(`../../functions/utils/index.cjs`);let n=require(`idb-keyval`);new class{balancesRecordLabel=`walletsBalances`;async getBalances(){return await(0,n.get)(this.balancesRecordLabel)}async getBalancesByWallet(e,n){let r=await this.getBalances();if(r)return r[t.getStateKey(e,n)]}async setBalances(r,i,a,o){let s=[];if(!o)return await(0,n.update)(this.balancesRecordLabel,(e={})=>{let n=t.getStateKey(i,r);return{...e,[n]:a}}),a;if(o.length===0)return await this.getBalancesByWallet(i,r)??[];try{await(0,n.update)(this.balancesRecordLabel,(e={})=>{let n=t.getStateKey(i,r),c=this.createBalanceLookup(e[n]),l=this.createBalanceLookup(a);return o.forEach(({erc20TokenAddress:e})=>{let t=e.toLowerCase();t in l?c[t]=l[t]:delete c[t]}),s=Object.values(c),{...e,[n]:s}})}catch(t){e.Logger.error(`Failed to update wallet balances:`,t)}return s}createBalanceLookup(e=[]){return e.reduce((e,t)=>({...e,[t.token.erc20TokenAddress.toLowerCase()]:t}),{})}};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Logger as e } from "../../error-handling/logger.mjs";
|
|
2
|
-
import { getStateKey as t } from "../../functions/utils/string.utils.mjs";
|
|
3
|
-
import "../../functions/utils/index.mjs";
|
|
4
|
-
import { get as n, update as r } from "idb-keyval";
|
|
5
|
-
new class {
|
|
6
|
-
balancesRecordLabel = "walletsBalances";
|
|
7
|
-
async getBalances() {
|
|
8
|
-
return await n(this.balancesRecordLabel);
|
|
9
|
-
}
|
|
10
|
-
async getBalancesByWallet(e, n) {
|
|
11
|
-
let r = await this.getBalances();
|
|
12
|
-
if (r) return r[t(e, n)];
|
|
13
|
-
}
|
|
14
|
-
async setBalances(n, i, a, o) {
|
|
15
|
-
let s = [];
|
|
16
|
-
if (!o) return await r(this.balancesRecordLabel, (e = {}) => {
|
|
17
|
-
let r = t(i, n);
|
|
18
|
-
return {
|
|
19
|
-
...e,
|
|
20
|
-
[r]: a
|
|
21
|
-
};
|
|
22
|
-
}), a;
|
|
23
|
-
if (o.length === 0) return await this.getBalancesByWallet(i, n) ?? [];
|
|
24
|
-
try {
|
|
25
|
-
await r(this.balancesRecordLabel, (e = {}) => {
|
|
26
|
-
let r = t(i, n), c = this.createBalanceLookup(e[r]), l = this.createBalanceLookup(a);
|
|
27
|
-
return o.forEach(({ erc20TokenAddress: e }) => {
|
|
28
|
-
let t = e.toLowerCase();
|
|
29
|
-
t in l ? c[t] = l[t] : delete c[t];
|
|
30
|
-
}), s = Object.values(c), {
|
|
31
|
-
...e,
|
|
32
|
-
[r]: s
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
} catch (t) {
|
|
36
|
-
e.error("Failed to update wallet balances:", t);
|
|
37
|
-
}
|
|
38
|
-
return s;
|
|
39
|
-
}
|
|
40
|
-
createBalanceLookup(e = []) {
|
|
41
|
-
return e.reduce((e, t) => ({
|
|
42
|
-
...e,
|
|
43
|
-
[t.token.erc20TokenAddress.toLowerCase()]: t
|
|
44
|
-
}), {});
|
|
45
|
-
}
|
|
46
|
-
}();
|
|
47
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../error-handling/logger.cjs`);require(`../../functions/index.cjs`);let n=require(`idb-keyval`);new class{STORAGE_KEY=`contacts`;checkForDuplicate(e,t,n){if(e.find(({ethereumAddress:e,nickname:r})=>(e===t.ethereumAddress||r===t.nickname)&&e!==n)!==void 0)throw Error(`Duplicate Contact attribute`)}async createContact(e,t){let r=e.toLowerCase();await(0,n.update)(this.STORAGE_KEY,e=>{let n=e??{},i=n[r]??[];return this.checkForDuplicate(i,t),i.push(t),n[r]=i,n})}async getContacts(e){try{let t=e.toLowerCase(),r=await(0,n.get)(this.STORAGE_KEY);return!r||!r[t]?[]:r[t]}catch(e){return t.Logger.error(`Error while getting contacts:`,e),[]}}async editContact(t,r,i){let a=t.toLowerCase();await(0,n.update)(this.STORAGE_KEY,t=>{let n=t??{},o=n[a];if(!n||!o)throw Error(`Contacts could not be fetched`);this.checkForDuplicate(o,i,r);let s=o.findIndex(({ethereumAddress:t})=>e.caseInsensitiveEqual(t,r));if(s===-1)throw Error(`Contact to be edited was not found`);return o[s]=i,n[a]=o,n})}async deleteContact(e,t){let r=e.toLowerCase();await(0,n.update)(this.STORAGE_KEY,e=>{let n=e??{},i=n[r];if(!n||!i)throw Error(`Contacts could not be fetched`);return n[r]=i.filter(({ethereumAddress:e})=>e!==t),n})}};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { caseInsensitiveEqual as e } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
2
|
-
import { Logger as t } from "../../error-handling/logger.mjs";
|
|
3
|
-
import "../../functions/index.mjs";
|
|
4
|
-
import { get as n, update as r } from "idb-keyval";
|
|
5
|
-
new class {
|
|
6
|
-
STORAGE_KEY = "contacts";
|
|
7
|
-
checkForDuplicate(e, t, n) {
|
|
8
|
-
if (e.find(({ ethereumAddress: e, nickname: r }) => (e === t.ethereumAddress || r === t.nickname) && e !== n) !== void 0) throw Error("Duplicate Contact attribute");
|
|
9
|
-
}
|
|
10
|
-
async createContact(e, t) {
|
|
11
|
-
let n = e.toLowerCase();
|
|
12
|
-
await r(this.STORAGE_KEY, (e) => {
|
|
13
|
-
let r = e ?? {}, i = r[n] ?? [];
|
|
14
|
-
return this.checkForDuplicate(i, t), i.push(t), r[n] = i, r;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
async getContacts(e) {
|
|
18
|
-
try {
|
|
19
|
-
let t = e.toLowerCase(), r = await n(this.STORAGE_KEY);
|
|
20
|
-
return !r || !r[t] ? [] : r[t];
|
|
21
|
-
} catch (e) {
|
|
22
|
-
return t.error("Error while getting contacts:", e), [];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async editContact(t, n, i) {
|
|
26
|
-
let a = t.toLowerCase();
|
|
27
|
-
await r(this.STORAGE_KEY, (t) => {
|
|
28
|
-
let r = t ?? {}, o = r[a];
|
|
29
|
-
if (!r || !o) throw Error("Contacts could not be fetched");
|
|
30
|
-
this.checkForDuplicate(o, i, n);
|
|
31
|
-
let s = o.findIndex(({ ethereumAddress: t }) => e(t, n));
|
|
32
|
-
if (s === -1) throw Error("Contact to be edited was not found");
|
|
33
|
-
return o[s] = i, r[a] = o, r;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
async deleteContact(e, t) {
|
|
37
|
-
let n = e.toLowerCase();
|
|
38
|
-
await r(this.STORAGE_KEY, (e) => {
|
|
39
|
-
let r = e ?? {}, i = r[n];
|
|
40
|
-
if (!r || !i) throw Error("Contacts could not be fetched");
|
|
41
|
-
return r[n] = i.filter(({ ethereumAddress: e }) => e !== t), r;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}();
|
|
45
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./key-val-store.cjs`),require(`./activity-db.cjs`),require(`./balances-db.cjs`),require(`./private-balances-db.cjs`),require(`./prices-db.cjs`),require(`./contact-db.cjs`),require(`./signatures-db.cjs`),require(`./pay-activity-db.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../functions/utils/serialize.utils.cjs`),t=require(`../cacheDevices/FileCacheDevice.cjs`);var n=()=>typeof globalThis<`u`&&`indexedDB`in globalThis&&globalThis.indexedDB!=null,r=class{idbPromise=null;idb(){return this.idbPromise||=import(`idb-keyval`),this.idbPromise}async get(e){let{get:t}=await this.idb();return t(e)}async set(e,t){let{set:n}=await this.idb();await n(e,t)}async update(e,t){let{update:n}=await this.idb(),r;return await n(e,e=>(r=t(e),r)),r}},i=class{device;constructor(){let e=require(`path`);this.device=new t.FileCacheDevice(!0,e.resolve(process.cwd(),`hinkalKeyValCache.json`))}async get(t){let n=this.device.get(t);if(n)return e.CustomJSONParse(n)}async set(t,n){this.device.set(t,e.CustomJSONStringify(n))}async update(e,t){let n=t(await this.get(e));return await this.set(e,n),n}},a=n()?new r:new i;exports.keyValStore=a;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { __require as e } from "../../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { CustomJSONParse as t, CustomJSONStringify as n } from "../../functions/utils/serialize.utils.mjs";
|
|
3
|
-
import { FileCacheDevice as r } from "../cacheDevices/FileCacheDevice.mjs";
|
|
4
|
-
//#region libs/shared/common/src/data-structures/IndexedDB/key-val-store.ts
|
|
5
|
-
var i = () => typeof globalThis < "u" && "indexedDB" in globalThis && globalThis.indexedDB != null, a = class {
|
|
6
|
-
idbPromise = null;
|
|
7
|
-
idb() {
|
|
8
|
-
return this.idbPromise ||= import("idb-keyval"), this.idbPromise;
|
|
9
|
-
}
|
|
10
|
-
async get(e) {
|
|
11
|
-
let { get: t } = await this.idb();
|
|
12
|
-
return t(e);
|
|
13
|
-
}
|
|
14
|
-
async set(e, t) {
|
|
15
|
-
let { set: n } = await this.idb();
|
|
16
|
-
await n(e, t);
|
|
17
|
-
}
|
|
18
|
-
async update(e, t) {
|
|
19
|
-
let { update: n } = await this.idb(), r;
|
|
20
|
-
return await n(e, (e) => (r = t(e), r)), r;
|
|
21
|
-
}
|
|
22
|
-
}, o = class {
|
|
23
|
-
device;
|
|
24
|
-
constructor() {
|
|
25
|
-
let t = e("path");
|
|
26
|
-
this.device = new r(!0, t.resolve(process.cwd(), "hinkalKeyValCache.json"));
|
|
27
|
-
}
|
|
28
|
-
async get(e) {
|
|
29
|
-
let n = this.device.get(e);
|
|
30
|
-
if (n) return t(n);
|
|
31
|
-
}
|
|
32
|
-
async set(e, t) {
|
|
33
|
-
this.device.set(e, n(t));
|
|
34
|
-
}
|
|
35
|
-
async update(e, t) {
|
|
36
|
-
let n = t(await this.get(e));
|
|
37
|
-
return await this.set(e, n), n;
|
|
38
|
-
}
|
|
39
|
-
}, s = i() ? new a() : new o();
|
|
40
|
-
//#endregion
|
|
41
|
-
export { s as keyValStore };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../types/cache.types.cjs`);require(`../../types/index.cjs`);const t=require(`./activity-db.cjs`);let n=require(`idb-keyval`);new class extends t.ActivityStorage{async savePrivateSendTx(t){let r=this.generateTxId(),i={timestamp:new Date,...t};return await(0,n.update)(e.StorageKeys.TX_ACTIVITY,(e={})=>(e[r]=i,e)),r}async saveMultiplePrivateSendTxs(e){let t=e.map(e=>this.savePrivateSendTx(e));return Promise.all(t)}async getTransactionRecords(){return await(0,n.get)(e.StorageKeys.TX_ACTIVITY)||[]}};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { StorageKeys as e } from "../../types/cache.types.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
|
-
import { ActivityStorage as t } from "./activity-db.mjs";
|
|
4
|
-
import { get as n, update as r } from "idb-keyval";
|
|
5
|
-
new class extends t {
|
|
6
|
-
async savePrivateSendTx(t) {
|
|
7
|
-
let n = this.generateTxId(), i = {
|
|
8
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9
|
-
...t
|
|
10
|
-
};
|
|
11
|
-
return await r(e.TX_ACTIVITY, (e = {}) => (e[n] = i, e)), n;
|
|
12
|
-
}
|
|
13
|
-
async saveMultiplePrivateSendTxs(e) {
|
|
14
|
-
let t = e.map((e) => this.savePrivateSendTx(e));
|
|
15
|
-
return Promise.all(t);
|
|
16
|
-
}
|
|
17
|
-
async getTransactionRecords() {
|
|
18
|
-
return await n(e.TX_ACTIVITY) || [];
|
|
19
|
-
}
|
|
20
|
-
}();
|
|
21
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../API/API.cjs`),t=require(`../../functions/utils/string.utils.cjs`),n=require(`./key-val-store.cjs`);var r=new class{tokenPricesRecordLabel=`tokenPrices`;async getPrices(){return n.keyValStore.get(this.tokenPricesRecordLabel)}async updatePrices(r,i){if(!i.length)return[];let{prices:a}=await e.API.getTokenPrices(r,i);return await n.keyValStore.update(this.tokenPricesRecordLabel,(e={})=>{let n={...e};return a.forEach((e,a)=>{n[t.getTokenStateKey(i[a],r)]=e}),n}),a}async getAndUpdatePrices(e,n){let r=await this.getPrices(),i=Array(n.length).fill(0);if(!r)i=await this.updatePrices(e,n);else{let a=[],o=[];n.forEach((n,s)=>{let c=t.getTokenStateKey(n,e);r[c]?i[s]=r[c]:(a.push(n),o.push(s))});let s=await this.updatePrices(e,a);o.forEach((e,t)=>{i[e]=s[t]})}return i}async updateCachedPricesByChain(r){let i=await this.getPrices();if(!i||Object.keys(i).length===0)return;let a=Object.entries(i).filter(([e])=>{let[,t]=e.split(`-`);return parseInt(t,10)===r}).map(([e])=>e.split(`-`)[0]);if(a.length===0)return;let{prices:o}=await e.API.getTokenPrices(r,a);await n.keyValStore.update(this.tokenPricesRecordLabel,(e={})=>{let n={...e};return o.forEach((e,i)=>{let o=t.getTokenStateKey(a[i],r);n[o]=e}),n})}};exports.pricesStorage=r;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { API as e } from "../../API/API.mjs";
|
|
2
|
-
import { getTokenStateKey as t } from "../../functions/utils/string.utils.mjs";
|
|
3
|
-
import { keyValStore as n } from "./key-val-store.mjs";
|
|
4
|
-
var r = new class {
|
|
5
|
-
tokenPricesRecordLabel = "tokenPrices";
|
|
6
|
-
async getPrices() {
|
|
7
|
-
return n.get(this.tokenPricesRecordLabel);
|
|
8
|
-
}
|
|
9
|
-
async updatePrices(r, i) {
|
|
10
|
-
if (!i.length) return [];
|
|
11
|
-
let { prices: a } = await e.getTokenPrices(r, i);
|
|
12
|
-
return await n.update(this.tokenPricesRecordLabel, (e = {}) => {
|
|
13
|
-
let n = { ...e };
|
|
14
|
-
return a.forEach((e, a) => {
|
|
15
|
-
n[t(i[a], r)] = e;
|
|
16
|
-
}), n;
|
|
17
|
-
}), a;
|
|
18
|
-
}
|
|
19
|
-
async getAndUpdatePrices(e, n) {
|
|
20
|
-
let r = await this.getPrices(), i = Array(n.length).fill(0);
|
|
21
|
-
if (!r) i = await this.updatePrices(e, n);
|
|
22
|
-
else {
|
|
23
|
-
let a = [], o = [];
|
|
24
|
-
n.forEach((n, s) => {
|
|
25
|
-
let c = t(n, e);
|
|
26
|
-
r[c] ? i[s] = r[c] : (a.push(n), o.push(s));
|
|
27
|
-
});
|
|
28
|
-
let s = await this.updatePrices(e, a);
|
|
29
|
-
o.forEach((e, t) => {
|
|
30
|
-
i[e] = s[t];
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return i;
|
|
34
|
-
}
|
|
35
|
-
async updateCachedPricesByChain(r) {
|
|
36
|
-
let i = await this.getPrices();
|
|
37
|
-
if (!i || Object.keys(i).length === 0) return;
|
|
38
|
-
let a = Object.entries(i).filter(([e]) => {
|
|
39
|
-
let [, t] = e.split("-");
|
|
40
|
-
return parseInt(t, 10) === r;
|
|
41
|
-
}).map(([e]) => e.split("-")[0]);
|
|
42
|
-
if (a.length === 0) return;
|
|
43
|
-
let { prices: o } = await e.getTokenPrices(r, a);
|
|
44
|
-
await n.update(this.tokenPricesRecordLabel, (e = {}) => {
|
|
45
|
-
let n = { ...e };
|
|
46
|
-
return o.forEach((e, i) => {
|
|
47
|
-
let o = t(a[i], r);
|
|
48
|
-
n[o] = e;
|
|
49
|
-
}), n;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}();
|
|
53
|
-
//#endregion
|
|
54
|
-
export { r as pricesStorage };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../functions/utils/string.utils.cjs`),t=require(`./key-val-store.cjs`);var n=new class{balancesRecordLabel=`privateWalletsBalances`;async getBalances(){return t.keyValStore.get(this.balancesRecordLabel)}async getBalancesByWallet(t,n){let r=await this.getBalances();if(r)return r[e.getStateKey(t,n,!0)]}async setBalances(n,r,i){let a=e.getStateKey(n,r,!0);await t.keyValStore.update(this.balancesRecordLabel,(e={})=>({...e,[a]:i}))}};exports.privateBalancesStorage=n;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getStateKey as e } from "../../functions/utils/string.utils.mjs";
|
|
2
|
-
import { keyValStore as t } from "./key-val-store.mjs";
|
|
3
|
-
var n = new class {
|
|
4
|
-
balancesRecordLabel = "privateWalletsBalances";
|
|
5
|
-
async getBalances() {
|
|
6
|
-
return t.get(this.balancesRecordLabel);
|
|
7
|
-
}
|
|
8
|
-
async getBalancesByWallet(t, n) {
|
|
9
|
-
let r = await this.getBalances();
|
|
10
|
-
if (r) return r[e(t, n, !0)];
|
|
11
|
-
}
|
|
12
|
-
async setBalances(n, r, i) {
|
|
13
|
-
let a = e(n, r, !0);
|
|
14
|
-
await t.update(this.balancesRecordLabel, (e = {}) => ({
|
|
15
|
-
...e,
|
|
16
|
-
[a]: i
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
}();
|
|
20
|
-
//#endregion
|
|
21
|
-
export { n as privateBalancesStorage };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../types/cache.types.cjs`);require(`../../types/index.cjs`);const t=require(`../../error-handling/logger.cjs`);require(`../../error-handling/index.cjs`);let n=require(`idb-keyval`);new class{generateMessageId(){return`msg_${new Date().getTime()}_${Math.random().toString(36).substring(2,15)}`}async saveSignedMessage(r,i,a,o,s,c){try{let t=this.generateMessageId(),l=await(0,n.get)(e.StorageKeys.SIGNED_MESSAGES)||{},u={chainId:r,messageText:i,messageType:a,subAccountAddress:o,signature:s,appMetaData:c};l[t]={timestamp:new Date().toISOString(),...u},await(0,n.set)(e.StorageKeys.SIGNED_MESSAGES,l)}catch(e){t.Logger.error(`Failed to save signed message:`,e,{chainId:r,messageType:a})}}async getAllSignedMessages(){try{let t=await(0,n.get)(e.StorageKeys.SIGNED_MESSAGES)||{};return Object.values(t).sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime())}catch(e){return t.Logger.error(`Failed to retrieve signed messages:`,e),[]}}};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { StorageKeys as e } from "../../types/cache.types.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
|
-
import { Logger as t } from "../../error-handling/logger.mjs";
|
|
4
|
-
import "../../error-handling/index.mjs";
|
|
5
|
-
import { get as n, set as r } from "idb-keyval";
|
|
6
|
-
new class {
|
|
7
|
-
generateMessageId() {
|
|
8
|
-
return `msg_${(/* @__PURE__ */ new Date()).getTime()}_${Math.random().toString(36).substring(2, 15)}`;
|
|
9
|
-
}
|
|
10
|
-
async saveSignedMessage(i, a, o, s, c, l) {
|
|
11
|
-
try {
|
|
12
|
-
let t = this.generateMessageId(), u = await n(e.SIGNED_MESSAGES) || {}, d = {
|
|
13
|
-
chainId: i,
|
|
14
|
-
messageText: a,
|
|
15
|
-
messageType: o,
|
|
16
|
-
subAccountAddress: s,
|
|
17
|
-
signature: c,
|
|
18
|
-
appMetaData: l
|
|
19
|
-
};
|
|
20
|
-
u[t] = {
|
|
21
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22
|
-
...d
|
|
23
|
-
}, await r(e.SIGNED_MESSAGES, u);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
t.error("Failed to save signed message:", e, {
|
|
26
|
-
chainId: i,
|
|
27
|
-
messageType: o
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async getAllSignedMessages() {
|
|
32
|
-
try {
|
|
33
|
-
let t = await n(e.SIGNED_MESSAGES) || {};
|
|
34
|
-
return Object.values(t).sort((e, t) => new Date(t.timestamp).getTime() - new Date(e.timestamp).getTime());
|
|
35
|
-
} catch (e) {
|
|
36
|
-
return t.error("Failed to retrieve signed messages:", e), [];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}();
|
|
40
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../types/cache.types.cjs`),r=require(`../../functions/utils/erc20tokenFunctions.cjs`),i=require(`../../functions/utils/caseInsensitive.utils.cjs`),a=require(`../http/HttpClient.cjs`);require(`../http/index.cjs`);const o=require(`../../API/API.cjs`),s=require(`../../error-handling/logger.cjs`),c=require(`../../functions/utils/string.utils.cjs`),l=require(`./token-visibility-db.cjs`),u=require(`../../functions/utils/create-provider.cjs`),d=require(`../../functions/utils/publicBalance.utils.cjs`);let f=require(`@solana/web3.js`),p=require(`idb-keyval`),m=require(`@solana/spl-token`);var h=new class{fetchedTokens={};ALCHEMY_URLS={[e.chainIds.ethMainnet]:`eth-mainnet`,[e.chainIds.polygon]:`polygon-mainnet`,[e.chainIds.arbMainnet]:`arb-mainnet`,[e.chainIds.optimism]:`opt-mainnet`,[e.chainIds.base]:`base-mainnet`,[e.chainIds.solanaMainnet]:`solana-mainnet`};KNOWN_GOOD_NFTS={[e.chainIds.base]:[`0x20bc8d248fe9c18a947406cea50d716828ab821f`],[e.chainIds.optimism]:[`0x3c3e0e73b53a19bcaf4178b8f9c9428fd2a2775e`]};isWhitelistedNFT(e,t){return this.KNOWN_GOOD_NFTS[t]?this.KNOWN_GOOD_NFTS[t].some(t=>i.caseInsensitiveEqual(e,t)):!1}async getPublicTokens(e,t){let i=c.getStateKey(t,e);return((await(0,p.get)(n.StorageKeys.ALCHEMY_PUBLIC_TOKENS))?.[i]||[]).map(t=>r.overlayTokenWithRegistryData(t,e))}getFetchedTokens(e,t){let n=c.getStateKey(t,e);return(this.fetchedTokens[n]||[]).map(t=>r.overlayTokenWithRegistryData(t,e))}fetchAndUpdatePublicTokens(t,n){return e.isSolanaLike(n)?this.fetchAndUpdateSolanaTokens(t,n):this.fetchAndUpdateEVMTokens(t,n)}async fetchAndUpdateSolanaTokens(e,t){let r=c.getStateKey(e,t),[a,s]=await Promise.all([this.getSolanaTokenAddresses(t,e),this.getNFTAddresses(t,e)]),u=Array.from(new Set([...a,...s]));if(!u.length)return;let d=(await o.API.tokensInfoCall(t,u)).filter(e=>!!e),f=await l.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(t,d),m=d.filter(e=>!i.lowerCaseIncludes(f,e.erc20TokenAddress));await(0,p.update)(n.StorageKeys.ALCHEMY_PUBLIC_TOKENS,(e={})=>{let t={...e,[r]:m};return this.fetchedTokens=t,t})}async getWalletTokenAddresses(t,n){return e.isSolanaLike(t)?this.getSolanaTokenAddresses(t,n):this.getEVMTokenAddresses(t,n)}async fetchAndUpdateEVMTokens(e,r){let a=c.getStateKey(e,r),s=await this.getEVMTokenAddresses(r,e),u=await this.getNFTTokens(r,e),d=u.map(e=>e.contractAddress),f=[...s,...d];if(!f.length)return;let m=(await o.API.tokensInfoCall(r,f)).map((e,n)=>{if(e)return e;let a=f[n],o=u.find(e=>i.caseInsensitiveEqual(e.contractAddress,a));return o&&o.tokenIds&&o.tokenIds.length>0&&this.isWhitelistedNFT(a,r)?{chainId:r,name:`Unknown NFT`,symbol:`NFT`,erc20TokenAddress:a,decimals:0,nftTokenType:t.TokenType.ERC721,tokenIds:o.tokenIds}:null}).filter(e=>!!e),h=await l.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(r,m),g=m.filter(e=>!i.lowerCaseIncludes(h,e.erc20TokenAddress)).map(e=>({...e,tokenIds:u.find(t=>i.caseInsensitiveEqual(t.contractAddress,e.erc20TokenAddress))?.tokenIds}));await(0,p.update)(n.StorageKeys.ALCHEMY_PUBLIC_TOKENS,(e={})=>{let t={...e,[a]:g};return this.fetchedTokens=t,t})}async getSolanaTokenAddresses(n,r){let{fetchRpcUrl:i}=e.networkRegistry[n];if(!i)throw Error(`RPC URL not found for the specified chain ID`);let a=u.createCustomSolanaConnection(i),o=await a.getBalance(new f.PublicKey(r)),[s,c]=await Promise.all([a.getParsedTokenAccountsByOwner(new f.PublicKey(r),{programId:m.TOKEN_PROGRAM_ID}),a.getParsedTokenAccountsByOwner(new f.PublicKey(r),{programId:m.TOKEN_2022_PROGRAM_ID})]),l=[...s.value,...c.value].filter(e=>{let{amount:t}=e.account.data.parsed.info.tokenAmount;return BigInt(t)>0n}).map(e=>e.account.data.parsed.info.mint);return o>0&&l.unshift(t.solanaNativeAddress),Array.from(new Set(l))}async getNFTAddresses(n,r){let{fetchRpcUrl:i}=e.networkRegistry[n];if(!i)throw Error(`RPC URL not found for the specified chain ID`);try{let e=[],n=1;do{let{items:o=[],page:s}=(await a.httpClient.post(i,{jsonrpc:`2.0`,id:1,method:`getAssetsByOwner`,params:{ownerAddress:r,page:n,limit:1e3,displayOptions:{showFungible:!1,showCollectionMetadata:!0}}})).result||{},c=o.filter(e=>e.interface&&t.SOLANA_NFT_INTERFACES.includes(e.interface)).map(e=>e.id);e.push(...c),n=s&&s>n?s:0}while(n>0);return e}catch(e){return s.Logger.error(`Failed to fetch NFTs from DAS API`,e),[]}}async getEVMTokenAddresses(n,r){let i=await d.getPublicBalanceByTokenAddress(n,r,t.zeroAddress),o=`https://${this.ALCHEMY_URLS[n]}.g.alchemy.com/v2/${e.ALCHEMY_API_KEY}`,s=[],c;do{let e=[r,`erc20`];c&&e.push({pageKey:c});let{result:t}=await a.httpClient.post(o,{jsonrpc:`2.0`,id:1,method:`alchemy_getTokenBalances`,params:e});s.push(...t?.tokenBalances??[]),c=t?.pageKey}while(c);i&&i>0n&&s.push({contractAddress:t.zeroAddress,tokenBalance:i.toString()});let l={};return s.forEach(e=>{(!l[e.contractAddress]||BigInt(e.tokenBalance)>0n)&&(l[e.contractAddress]=e)}),Object.keys(l)}async getNFTTokens(t,n){let r=`https://${this.ALCHEMY_URLS[t]}.g.alchemy.com/nft/v3/${e.ALCHEMY_API_KEY}/getNFTsForOwner`,i=[],o;do{let e=new URLSearchParams({owner:n,withMetadata:`false`,pageSize:`100`});o&&e.append(`pageKey`,o);let{ownedNfts:t=[],pageKey:s}=await a.httpClient.get(`${r}?${e.toString()}`);i.push(...t),o=s}while(o);let s=i.filter(({contractAddress:e,tokenId:t})=>e&&t).reduce((e,{contractAddress:t,tokenId:n})=>{let r=t.toLowerCase();return e.has(r)||e.set(r,[]),e.get(r)?.push(n),e},new Map);return Array.from(s.entries()).map(([e,t])=>({contractAddress:e,tokenIds:t}))}};exports.alchemyPublicTokensDB=h;
|