@hinkal/common 0.3.1 → 0.3.3
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/README.md +15 -18
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +12 -37
- package/common/src/API/API.mjs +80 -105
- package/common/src/API/callRelayer.d.ts +3 -0
- package/common/src/API/dashboardAccountMemberCalls.cjs +1 -1
- package/common/src/API/dashboardAccountMemberCalls.d.ts +15 -0
- package/common/src/API/dashboardAccountMemberCalls.mjs +5 -2
- package/common/src/API/dashboardPayoutCalls.cjs +1 -1
- package/common/src/API/dashboardPayoutCalls.d.ts +2 -1
- package/common/src/API/dashboardPayoutCalls.mjs +4 -1
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +17 -8
- package/common/src/API/enclaveUtxoCalls.mjs +5 -3
- package/common/src/API/getOdosPriceForToken.cjs +1 -0
- package/common/src/API/getOdosPriceForToken.d.ts +1 -0
- package/common/src/API/getOdosPriceForToken.mjs +14 -0
- package/common/src/API/getWebsiteURL.d.ts +1 -3
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +1 -3
- package/common/src/API/index.mjs +3 -5
- package/common/src/API/payoutNotificationStateCalls.cjs +1 -0
- package/common/src/API/payoutNotificationStateCalls.d.ts +10 -0
- package/common/src/API/payoutNotificationStateCalls.mjs +10 -0
- package/common/src/API/proxyAccountsCalls.cjs +1 -1
- package/common/src/API/proxyAccountsCalls.d.ts +2 -3
- package/common/src/API/proxyAccountsCalls.mjs +11 -10
- package/common/src/API/rewardsUserCalls.cjs +1 -1
- package/common/src/API/rewardsUserCalls.d.ts +1 -40
- package/common/src/API/rewardsUserCalls.mjs +2 -10
- package/common/src/API/scheduled-transactions-calls.d.ts +1 -0
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.mjs +8 -8
- package/common/src/API/tenderly.api.cjs +1 -1
- package/common/src/API/tenderly.api.d.ts +5 -10
- package/common/src/API/tenderly.api.mjs +1 -1
- package/common/src/API/weeklyAnalyticCalls.cjs +1 -1
- package/common/src/API/weeklyAnalyticCalls.d.ts +1 -11
- package/common/src/API/weeklyAnalyticCalls.mjs +2 -5
- package/common/src/constants/addresses.constants.cjs +1 -1
- package/common/src/constants/addresses.constants.d.ts +4 -46
- package/common/src/constants/addresses.constants.mjs +19 -60
- package/common/src/constants/balance.constants.cjs +1 -0
- package/common/src/constants/balance.constants.d.ts +1 -0
- package/common/src/constants/balance.constants.mjs +4 -0
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +3 -1
- package/common/src/constants/chains.constants.mjs +117 -138
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.d.ts +2 -0
- package/common/src/constants/coingecko.constants.mjs +1 -1
- package/common/src/constants/contracts.constants.cjs +1 -1
- package/common/src/constants/contracts.constants.d.ts +0 -109
- package/common/src/constants/contracts.constants.mjs +9 -31
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +6 -9
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +6 -6
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +6 -9
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -0
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +10 -0
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +6 -9
- package/common/src/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-localhost.json.mjs +0 -3
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +6 -9
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.mjs +5 -9
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +6 -9
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.mjs +0 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.mjs +2 -2
- package/common/src/constants/deploy-data/deploy-data-tempo.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tempo.json.mjs +6 -7
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.mjs +2 -4
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.mjs +2 -4
- package/common/src/constants/deploy-data/index.cjs +1 -1
- package/common/src/constants/deploy-data/index.d.ts +2 -1
- package/common/src/constants/deploy-data/index.mjs +16 -15
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.mjs +19 -45
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.mjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.mjs +2 -46
- package/common/src/constants/enclaveAuth.constants.d.ts +5 -0
- package/common/src/constants/events.constants.cjs +1 -1
- package/common/src/constants/events.constants.mjs +3 -2
- package/common/src/constants/fees.constants.cjs +1 -1
- package/common/src/constants/fees.constants.mjs +2 -2
- package/common/src/constants/index.cjs +1 -1
- package/common/src/constants/index.d.ts +1 -3
- package/common/src/constants/index.mjs +1 -1
- package/common/src/constants/mediaUrls.constants.d.ts +0 -1
- package/common/src/constants/pay.constants.d.ts +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -1
- package/common/src/constants/protocol.constants.d.ts +10 -6
- package/common/src/constants/protocol.constants.mjs +4 -11
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +6 -30
- package/common/src/constants/server.constants.mjs +11 -43
- package/common/src/constants/tokens.constants.cjs +1 -1
- package/common/src/constants/tokens.constants.mjs +1 -1
- package/common/src/crypto/ecdh.cjs +1 -1
- package/common/src/crypto/ecdh.mjs +2 -9
- package/common/src/crypto/index.cjs +1 -1
- package/common/src/crypto/index.mjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +4 -8
- package/common/src/data-structures/Hinkal/Hinkal.mjs +88 -100
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +5 -9
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +24 -23
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +3 -3
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +59 -57
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +42 -50
- package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +50 -119
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +108 -100
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +3 -2
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +105 -64
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +33 -43
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +7 -3
- package/common/src/data-structures/Hinkal/hinkalPalEvmDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalPalTronDepositPrepare.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +50 -38
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +2 -3
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.mjs +52 -117
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +26 -32
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +6 -6
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +71 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +47 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +8 -4
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +155 -102
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.mjs +16 -12
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +61 -54
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +87 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +97 -52
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +60 -34
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +29 -32
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +90 -0
- package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +39 -44
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +30 -0
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +35 -49
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +170 -101
- package/common/src/data-structures/Hinkal/index.d.ts +0 -1
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +1 -0
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.d.ts +27 -0
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +31 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +5 -4
- package/common/src/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/contact-db.d.ts +0 -1
- package/common/src/data-structures/IndexedDB/contact-db.mjs +14 -28
- package/common/src/data-structures/IndexedDB/key-val-store.cjs +1 -1
- package/common/src/data-structures/IndexedDB/key-val-store.d.ts +2 -0
- package/common/src/data-structures/IndexedDB/key-val-store.mjs +14 -0
- package/common/src/data-structures/IndexedDB/private-balances-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/private-balances-db.d.ts +1 -0
- package/common/src/data-structures/IndexedDB/private-balances-db.mjs +3 -0
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +25 -25
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +15 -14
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +7 -7
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +30 -30
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +6 -6
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +12 -16
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.d.ts +1 -0
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +22 -18
- package/common/src/data-structures/WalletManager/WalletManager.d.ts +1 -0
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.d.ts +1 -0
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.mjs +3 -0
- package/common/src/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
- package/common/src/data-structures/cacheDevices/FileCacheDevice.d.ts +3 -0
- package/common/src/data-structures/cacheDevices/FileCacheDevice.mjs +12 -3
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.d.ts +9 -9
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +37 -47
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.d.ts +2 -3
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.mjs +26 -22
- package/common/src/data-structures/crypto-keys/keys.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keys.d.ts +12 -27
- package/common/src/data-structures/crypto-keys/keys.mjs +61 -79
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +1 -2
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +14 -20
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +1 -1
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +2 -2
- package/common/src/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -1
- package/common/src/data-structures/event-service/helpers/ClientEventHelper.mjs +6 -6
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +27 -23
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +10 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +9 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +3 -0
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +29 -19
- package/common/src/data-structures/provider-adapter/IProviderAdapter.d.ts +0 -1
- package/common/src/data-structures/utxo/Utxo.cjs +1 -1
- package/common/src/data-structures/utxo/Utxo.d.ts +1 -4
- package/common/src/data-structures/utxo/Utxo.mjs +7 -17
- package/common/src/error-handling/error-codes.constants.cjs +2 -2
- package/common/src/error-handling/error-codes.constants.d.ts +6 -14
- package/common/src/error-handling/error-codes.constants.mjs +21 -31
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +27 -14
- package/common/src/error-handling/index.cjs +1 -1
- package/common/src/error-handling/index.d.ts +1 -0
- package/common/src/error-handling/index.mjs +1 -0
- package/common/src/externalABIs/index.cjs +1 -1
- package/common/src/externalABIs/index.d.ts +1 -113
- package/common/src/externalABIs/index.mjs +2 -6
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.d.ts +0 -1
- package/common/src/functions/index.mjs +13 -16
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -1
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.mjs +36 -38
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +39 -5
- package/common/src/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/common/src/functions/pre-transaction/getExternalSwapAddress.mjs +2 -18
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.d.ts +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.mjs +11 -10
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +12 -12
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +1 -2
- package/common/src/functions/pre-transaction/index.mjs +1 -2
- package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +9 -12
- package/common/src/functions/pre-transaction/solana-public-signals.d.ts +1 -0
- package/common/src/functions/pre-transaction/solana.cjs +1 -1
- package/common/src/functions/pre-transaction/solana.d.ts +13 -0
- package/common/src/functions/pre-transaction/solana.mjs +46 -21
- package/common/src/functions/pre-transaction/store-proof.cjs +1 -1
- package/common/src/functions/pre-transaction/store-proof.d.ts +1 -1
- package/common/src/functions/pre-transaction/store-proof.mjs +1 -0
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +1 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.d.ts +1 -2
- package/common/src/functions/private-wallet/emporium.helpers.mjs +75 -50
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.d.ts +0 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +34 -76
- package/common/src/functions/private-wallet/index.cjs +1 -1
- package/common/src/functions/private-wallet/index.d.ts +0 -1
- package/common/src/functions/private-wallet/index.mjs +0 -1
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +3 -4
- package/common/src/functions/snarkjs/common.snarkjs.mjs +97 -62
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +183 -144
- package/common/src/functions/snarkjs/constant.mjs +183 -145
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +69 -57
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.cjs +1 -0
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.d.ts +7 -0
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.mjs +2 -0
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +4 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +63 -62
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclave.d.ts +32 -0
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +162 -0
- package/common/src/functions/snarkjs/fetchMerkleTreeSiblings.d.ts +1 -3
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.d.ts +1 -0
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.mjs +14 -5
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.cjs +1 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.d.ts +7 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.mjs +13 -0
- package/common/src/functions/snarkjs/generateCircomData.cjs +1 -1
- package/common/src/functions/snarkjs/generateCircomData.d.ts +1 -1
- package/common/src/functions/snarkjs/generateCircomData.mjs +41 -31
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.mjs +7 -7
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.cjs +1 -0
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.d.ts +2 -0
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.mjs +3 -0
- package/common/src/functions/snarkjs/generateZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateZkProof.mjs +9 -16
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +2 -0
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +18 -12
- package/common/src/functions/snarkjs/getZKFiles.cjs +1 -1
- package/common/src/functions/snarkjs/getZKFiles.mjs +9 -3
- package/common/src/functions/snarkjs/index.cjs +1 -1
- package/common/src/functions/snarkjs/index.d.ts +2 -0
- package/common/src/functions/snarkjs/index.mjs +2 -0
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +12 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +23 -3
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.cjs +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.d.ts +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.mjs +11 -0
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.d.ts +1 -1
- package/common/src/functions/utils/addresses.mjs +13 -12
- package/common/src/functions/utils/bridge-flow.utils.d.ts +1 -1
- package/common/src/functions/utils/buildClaimableDepositPlan.d.ts +3 -2
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.mjs +5 -10
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.mjs +3 -1
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.d.ts +3 -0
- package/common/src/functions/utils/enclave-utxo-storage.mjs +1 -1
- package/common/src/functions/utils/enclaveSessionSigning.cjs +1 -0
- package/common/src/functions/utils/enclaveSessionSigning.d.ts +16 -0
- package/common/src/functions/utils/enclaveSessionSigning.mjs +2 -0
- package/common/src/functions/utils/encodeTokenWithId.cjs +1 -1
- package/common/src/functions/utils/encodeTokenWithId.d.ts +1 -2
- package/common/src/functions/utils/encodeTokenWithId.mjs +2 -5
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +1 -0
- package/common/src/functions/utils/fees.utils.mjs +32 -28
- package/common/src/functions/utils/formatter.d.ts +1 -0
- package/common/src/functions/utils/getDataFromTransaction.d.ts +4 -3
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.mjs +2 -3
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +6 -6
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +17 -18
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +7 -3
- package/common/src/functions/utils/index.mjs +16 -11
- package/common/src/functions/utils/legacyKeys.cjs +1 -0
- package/common/src/functions/utils/legacyKeys.d.ts +10 -0
- package/common/src/functions/utils/legacyKeys.mjs +8 -0
- package/common/src/functions/utils/mnemonics.cjs +1 -1
- package/common/src/functions/utils/mnemonics.mjs +4 -6
- package/common/src/functions/utils/nearIntents.utils.cjs +1 -1
- package/common/src/functions/utils/nearIntents.utils.mjs +1 -1
- package/common/src/functions/utils/networks.utils.d.ts +1 -0
- package/common/src/functions/utils/prepareHinkal.cjs +1 -1
- package/common/src/functions/utils/prepareHinkal.d.ts +1 -3
- package/common/src/functions/utils/prepareHinkal.mjs +2 -1
- package/common/src/functions/utils/process.utils.cjs +1 -1
- package/common/src/functions/utils/process.utils.d.ts +0 -1
- package/common/src/functions/utils/process.utils.mjs +2 -11
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +2 -1
- package/common/src/functions/utils/resolve-domain-address.cjs +1 -0
- package/common/src/functions/utils/resolve-domain-address.d.ts +4 -0
- package/common/src/functions/utils/resolve-domain-address.mjs +3 -0
- package/common/src/functions/utils/serialize-utxos.utils.cjs +1 -1
- package/common/src/functions/utils/serialize-utxos.utils.mjs +6 -4
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -2
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +5 -14
- package/common/src/functions/utils/tron.utils.mjs +91 -142
- package/common/src/functions/utils/validateWalletAddress.cjs +1 -0
- package/common/src/functions/utils/validateWalletAddress.d.ts +1 -0
- package/common/src/functions/utils/validateWalletAddress.mjs +2 -0
- package/common/src/functions/utils/voidWallets.utils.cjs +1 -0
- package/common/src/functions/utils/voidWallets.utils.d.ts +4 -0
- package/common/src/functions/utils/voidWallets.utils.mjs +1 -0
- package/common/src/functions/utils/waasStamp.cjs +1 -0
- package/common/src/functions/utils/waasStamp.d.ts +5 -0
- package/common/src/functions/utils/waasStamp.mjs +2 -0
- package/common/src/functions/web3/etherFunctions.d.ts +1 -0
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.d.ts +5 -12
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +50 -61
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.d.ts +4 -3
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +34 -25
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.d.ts +2 -2
- package/common/src/functions/web3/events/getShieldedBalance.mjs +89 -85
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +9 -6
- package/common/src/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.d.ts +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.mjs +21 -107
- package/common/src/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/common/src/functions/web3/functionCalls/constructBatchCall.d.ts +2 -2
- package/common/src/functions/web3/functionCalls/constructBatchCall.mjs +23 -18
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -0
- package/common/src/functions/web3/functionCalls/submitProof.d.ts +5 -0
- package/common/src/functions/web3/functionCalls/submitProof.mjs +26 -0
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.d.ts +7 -3
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.mjs +81 -53
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +6 -11
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +4 -2
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.mjs +1 -1
- package/common/src/functions/web3/getTokenHolder.cjs +1 -1
- package/common/src/functions/web3/getTokenHolder.mjs +3 -2
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +0 -3
- package/common/src/functions/web3/index.mjs +0 -3
- package/common/src/functions/web3/lifiAPI.cjs +1 -1
- package/common/src/functions/web3/lifiAPI.mjs +1 -1
- package/common/src/providers/EthersProviderAdapter.cjs +1 -1
- package/common/src/providers/EthersProviderAdapter.d.ts +0 -1
- package/common/src/providers/EthersProviderAdapter.mjs +0 -3
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.d.ts +0 -1
- package/common/src/providers/SolanaProviderAdapter.mjs +0 -3
- package/common/src/providers/TronProviderAdapter.cjs +1 -1
- package/common/src/providers/TronProviderAdapter.d.ts +0 -1
- package/common/src/providers/TronProviderAdapter.mjs +7 -4
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.d.ts +0 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +0 -4
- package/common/src/types/API.types.d.ts +0 -4
- package/common/src/types/WeeklyAnalytics.types.d.ts +1 -26
- package/common/src/types/activities.types.cjs +1 -1
- package/common/src/types/activities.types.d.ts +0 -9
- package/common/src/types/activities.types.mjs +1 -1
- package/common/src/types/admin.types.cjs +1 -1
- package/common/src/types/admin.types.d.ts +3 -1
- package/common/src/types/admin.types.mjs +1 -1
- package/common/src/types/bridging-tx.types.d.ts +8 -0
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +3 -2
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/circom-data.types.cjs +1 -1
- package/common/src/types/circom-data.types.d.ts +32 -27
- package/common/src/types/circom-data.types.mjs +1 -1
- package/common/src/types/commitments.types.d.ts +2 -0
- package/common/src/types/dashboard-account.d.ts +15 -0
- package/common/src/types/dashboard-payout.types.d.ts +1 -0
- package/common/src/types/dashboard-transaction.types.d.ts +3 -0
- package/common/src/types/enclaveApi.types.d.ts +78 -0
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +8 -27
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +4 -8
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/hinkal.types.cjs +1 -1
- package/common/src/types/hinkal.types.d.ts +12 -29
- package/common/src/types/hinkal.types.mjs +12 -20
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +5 -5
- package/common/src/types/index.mjs +1 -1
- package/common/src/types/near-intents.types.d.ts +1 -0
- package/common/src/types/new-rewards.type.d.ts +0 -70
- package/common/src/types/offscreen.types.cjs +1 -1
- package/common/src/types/offscreen.types.d.ts +0 -1
- package/common/src/types/offscreen.types.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +3 -0
- package/common/src/types/payout-notification.types.d.ts +11 -0
- package/common/src/types/proxy-progress.types.d.ts +5 -0
- package/common/src/types/remote-proof.types.d.ts +0 -6
- package/common/src/types/remote-tx-build.types.d.ts +242 -0
- package/common/src/types/scheduled-transactions.types.d.ts +3 -0
- package/common/src/types/snark.types.d.ts +1 -3
- package/common/src/types/solana.types.d.ts +7 -0
- package/common/src/types/tenderly.api.types.d.ts +70 -0
- package/common/src/types/token.types.cjs +1 -1
- package/common/src/types/token.types.mjs +1 -3
- package/common/src/types/transact.types.cjs +1 -0
- package/common/src/types/transact.types.d.ts +53 -0
- package/common/src/types/transact.types.mjs +6 -0
- package/common/src/types/transaction.types.d.ts +0 -1
- package/common/src/types/transactions.types.d.ts +0 -1
- package/common/src/webworker/logError-CxZzSALU.js +2 -0
- package/common/src/webworker/package.json +12 -12
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
- 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/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +3 -3
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/common/src/webworker/workerProxy-swwPYw6e.js +1 -0
- 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/zkProofWorkerNode.cjs +1 -1
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/internal/swapApi.cjs +1 -1
- package/internal/swapApi.d.ts +3 -3
- package/internal/swapApi.mjs +22 -25
- package/package.json +12 -12
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +4 -5
- package/services/Hinkal.mjs +11 -14
- package/types/IHinkal.d.ts +4 -5
- package/types/swap.types.d.ts +3 -20
- package/common/src/API/accessCodeCalls.cjs +0 -1
- package/common/src/API/accessCodeCalls.d.ts +0 -23
- package/common/src/API/accessCodeCalls.mjs +0 -13
- package/common/src/API/brotherhoodCalls.cjs +0 -1
- package/common/src/API/brotherhoodCalls.d.ts +0 -82
- package/common/src/API/brotherhoodCalls.mjs +0 -17
- package/common/src/API/callOdosAPI.cjs +0 -1
- package/common/src/API/callOdosAPI.d.ts +0 -63
- package/common/src/API/callOdosAPI.mjs +0 -18
- package/common/src/API/callOneInchAPI.cjs +0 -1
- package/common/src/API/callOneInchAPI.d.ts +0 -18
- package/common/src/API/callOneInchAPI.mjs +0 -13
- package/common/src/API/generate-trading-points.cjs +0 -1
- package/common/src/API/generate-trading-points.d.ts +0 -27
- package/common/src/API/generate-trading-points.mjs +0 -23
- package/common/src/API/leaderboardCalls.cjs +0 -1
- package/common/src/API/leaderboardCalls.d.ts +0 -14
- package/common/src/API/leaderboardCalls.mjs +0 -8
- package/common/src/API/referralsCalls.cjs +0 -1
- package/common/src/API/referralsCalls.d.ts +0 -22
- package/common/src/API/referralsCalls.mjs +0 -11
- package/common/src/API/send-telegram-callback.cjs +0 -1
- package/common/src/API/send-telegram-callback.d.ts +0 -7
- package/common/src/API/send-telegram-callback.mjs +0 -11
- package/common/src/constants/mystery-boxes.constants.d.ts +0 -0
- package/common/src/constants/price-impact.constants.d.ts +0 -2
- package/common/src/constants/rewards.constants.d.ts +0 -15
- package/common/src/constants/tasks.constants.cjs +0 -1
- package/common/src/constants/tasks.constants.d.ts +0 -9
- package/common/src/constants/tasks.constants.mjs +0 -124
- package/common/src/data-structures/Hinkal/hinkalMultiSend.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalMultiSend.d.ts +0 -3
- package/common/src/data-structures/Hinkal/hinkalMultiSend.mjs +0 -12
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.d.ts +0 -6
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.mjs +0 -128
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.cjs +0 -1
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.d.ts +0 -22
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.mjs +0 -34
- package/common/src/externalABIs/IQuoterV2.json.cjs +0 -1
- package/common/src/externalABIs/IQuoterV2.json.mjs +0 -203
- package/common/src/externalABIs/ISwapRouter.json.cjs +0 -1
- package/common/src/externalABIs/ISwapRouter.json.mjs +0 -537
- package/common/src/externalABIs/IUniswapV3Factory.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Factory.json.mjs +0 -188
- package/common/src/externalABIs/IUniswapV3Pool.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Pool.json.mjs +0 -938
- package/common/src/externalABIs/UniswapV2PoolAbi.json.cjs +0 -1
- package/common/src/externalABIs/UniswapV2PoolAbi.json.mjs +0 -78
- package/common/src/functions/pre-transaction/interaction-to-action.cjs +0 -1
- package/common/src/functions/pre-transaction/interaction-to-action.d.ts +0 -2
- package/common/src/functions/pre-transaction/interaction-to-action.mjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.cjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.d.ts +0 -3
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.mjs +0 -32
- package/common/src/functions/private-wallet/opProducer.cjs +0 -1
- package/common/src/functions/private-wallet/opProducer.d.ts +0 -5
- package/common/src/functions/private-wallet/opProducer.mjs +0 -3
- package/common/src/functions/snarkjs/generateZkProofEnclave.cjs +0 -1
- package/common/src/functions/snarkjs/generateZkProofEnclave.d.ts +0 -5
- package/common/src/functions/snarkjs/generateZkProofEnclave.mjs +0 -27
- package/common/src/functions/utils/bit.operations.cjs +0 -1
- package/common/src/functions/utils/bit.operations.d.ts +0 -3
- package/common/src/functions/utils/bit.operations.mjs +0 -4
- package/common/src/functions/utils/get-signature-header.cjs +0 -1
- package/common/src/functions/utils/get-signature-header.d.ts +0 -5
- package/common/src/functions/utils/get-signature-header.mjs +0 -4
- package/common/src/functions/web3/odosAPI.cjs +0 -1
- package/common/src/functions/web3/odosAPI.d.ts +0 -5
- package/common/src/functions/web3/odosAPI.mjs +0 -35
- package/common/src/functions/web3/oneInchAPI.cjs +0 -1
- package/common/src/functions/web3/oneInchAPI.d.ts +0 -5
- package/common/src/functions/web3/oneInchAPI.mjs +0 -34
- package/common/src/functions/web3/uniswapAPI.cjs +0 -1
- package/common/src/functions/web3/uniswapAPI.d.ts +0 -16
- package/common/src/functions/web3/uniswapAPI.mjs +0 -60
- package/common/src/types/brotherhood-user.types.d.ts +0 -11
- package/common/src/types/crypto.types.d.ts +0 -8
- package/common/src/types/generatePoints.d.ts +0 -14
- package/common/src/types/new-rewards.type.cjs +0 -1
- package/common/src/types/new-rewards.type.mjs +0 -10
- package/common/src/types/referral.types.d.ts +0 -12
- package/common/src/types/rewards.types.d.ts +0 -34
- package/common/src/types/token-with-id.types.d.ts +0 -4
- package/common/src/webworker/logError-BR5TJP6T.js +0 -2
- package/common/src/webworker/workerProxy-Ddzxn23N.js +0 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { isNode as e } from "../../constants/vite.constants.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { Utxo as
|
|
4
|
-
import { WorkerVariant as
|
|
5
|
-
import { performTaskWithWorker as
|
|
6
|
-
import { UtxoWorkerActionType as
|
|
2
|
+
import { stealthPairCacheDevice as t } from "../crypto-keys/keys.mjs";
|
|
3
|
+
import { Utxo as n } from "../utxo/Utxo.mjs";
|
|
4
|
+
import { WorkerVariant as r } from "../../webworker/worker.registry.mjs";
|
|
5
|
+
import { performTaskWithWorker as i } from "../../webworker/performTaskWithWorker.mjs";
|
|
6
|
+
import { UtxoWorkerActionType as a } from "../../webworker/utxoWorker/utxoWorker.types.mjs";
|
|
7
7
|
//#region libs/shared/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.ts
|
|
8
|
-
var
|
|
8
|
+
var o = 16, s = class {
|
|
9
9
|
NUM_WORKERS;
|
|
10
10
|
NUM_WORKERS_BATCH_PROCESS;
|
|
11
11
|
constructor() {
|
|
12
|
-
e ? (this.NUM_WORKERS = 1, this.NUM_WORKERS_BATCH_PROCESS = 1) : (this.NUM_WORKERS = 3, this.NUM_WORKERS_BATCH_PROCESS = Math.min(
|
|
12
|
+
e ? (this.NUM_WORKERS = 1, this.NUM_WORKERS_BATCH_PROCESS = 1) : (this.NUM_WORKERS = 3, this.NUM_WORKERS_BATCH_PROCESS = Math.min(o, Math.ceil(navigator.deviceMemory ?? 4)));
|
|
13
13
|
}
|
|
14
14
|
async createUtxoPromise(e) {
|
|
15
|
-
return await
|
|
16
|
-
type:
|
|
15
|
+
return await i({
|
|
16
|
+
type: r.UTXO,
|
|
17
17
|
payload: e
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
async batchFilterUtxosWithNullifier(e,
|
|
21
|
-
let
|
|
22
|
-
type:
|
|
20
|
+
async batchFilterUtxosWithNullifier(e, r) {
|
|
21
|
+
let i = this.sliceArrayIntoParts(e, this.NUM_WORKERS).map((e) => this.createUtxoPromise({
|
|
22
|
+
type: a.BATCH_FILTER_UTXOS_WITH_NULLIFIER,
|
|
23
23
|
data: {
|
|
24
24
|
utxos: e.map((e) => e.getConstructableParams()),
|
|
25
|
-
nullifiers:
|
|
25
|
+
nullifiers: r
|
|
26
26
|
}
|
|
27
|
-
})),
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
}),
|
|
27
|
+
})), o = await Promise.all(i);
|
|
28
|
+
return o.forEach((e) => {
|
|
29
|
+
t.mergeWithSerialized(e.stealthPairCache);
|
|
30
|
+
}), o.flatMap((e) => e.utxoConstructors).map((e) => new n(e));
|
|
31
31
|
}
|
|
32
|
-
async buildBatchProcess(e, t,
|
|
32
|
+
async buildBatchProcess(e, t, r) {
|
|
33
33
|
let i = this.sliceArrayIntoParts(e, this.NUM_WORKERS).map((e) => this.createUtxoPromise({
|
|
34
|
-
type:
|
|
34
|
+
type: a.BUILD_UTXOS,
|
|
35
35
|
data: {
|
|
36
36
|
signature: t.getSignature(),
|
|
37
37
|
encryptedOutputs: e,
|
|
38
|
-
chainId:
|
|
38
|
+
chainId: r
|
|
39
39
|
}
|
|
40
40
|
}));
|
|
41
|
-
return (await Promise.all(i)).flat().map((e) => new
|
|
41
|
+
return (await Promise.all(i)).flat().map((e) => new n(e));
|
|
42
42
|
}
|
|
43
43
|
sliceArrayIntoParts(e, t) {
|
|
44
44
|
let n = Math.ceil(e.length / t);
|
|
@@ -51,13 +51,13 @@ var s = 16, c = class {
|
|
|
51
51
|
}), n;
|
|
52
52
|
}
|
|
53
53
|
async batchProcess(e, t, n, r) {
|
|
54
|
-
let i = this.sliceArrayIntoParts(e, this.NUM_WORKERS_BATCH_PROCESS),
|
|
54
|
+
let i = this.sliceArrayIntoParts(e, this.NUM_WORKERS_BATCH_PROCESS), o = n.getSignature(), s = i.map((e) => {
|
|
55
55
|
let n = {
|
|
56
|
-
type:
|
|
56
|
+
type: a.DECIPHER_OUTPUTS,
|
|
57
57
|
data: {
|
|
58
58
|
encryptedOutputs: e,
|
|
59
59
|
lastOutput: t,
|
|
60
|
-
signature:
|
|
60
|
+
signature: o,
|
|
61
61
|
chainId: r
|
|
62
62
|
}
|
|
63
63
|
};
|
|
@@ -70,4 +70,4 @@ var s = 16, c = class {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
//#endregion
|
|
73
|
-
export {
|
|
73
|
+
export { s as MultiThreadedUtxoUtils };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../functions/utils/caseInsensitive.utils.cjs`),r=require(
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../functions/utils/caseInsensitive.utils.cjs`),r=require(`../http/HttpClient.cjs`);require(`../http/index.cjs`);const i=require(`../../types/cache.types.cjs`),a=require(`../../API/API.cjs`),o=require(`../../error-handling/logger.cjs`),s=require(`../../functions/utils/string.utils.cjs`),c=require(`./token-visibility-db.cjs`),l=require(`../../functions/utils/erc20tokenFunctions.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.bnbMainnet]:`bnb-mainnet`,[e.chainIds.ethMainnet]:`eth-mainnet`,[e.chainIds.polygon]:`polygon-mainnet`,[e.chainIds.arbMainnet]:`arb-mainnet`,[e.chainIds.optimism]:`opt-mainnet`,[e.chainIds.optimismTest]:`opt-mainnet`,[e.chainIds.base]:`base-mainnet`,[e.chainIds.solanaMainnet]:`solana-mainnet`,[e.chainIds.sepoliaTestnet]:`eth-sepolia`};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=>n.caseInsensitiveEqual(e,t)):!1}async getPublicTokens(e,t){let n=s.getStateKey(t,e);return l.overlayTokensWithRegistryData((await(0,p.get)(i.StorageKeys.ALCHEMY_PUBLIC_TOKENS))?.[n]||[],e)}async getFetchedTokens(e,t){let n=s.getStateKey(t,e);return l.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],e)}fetchAndUpdatePublicTokens(t,n){return e.isSolanaLike(n)?this.fetchAndUpdateSolanaTokens(t,n):this.fetchAndUpdateEVMTokens(t,n)}async fetchAndUpdateSolanaTokens(e,t){let r=s.getStateKey(e,t),[o,l]=await Promise.all([this.getSolanaTokenAddresses(t,e),this.getNFTAddresses(t,e)]),u=Array.from(new Set([...o,...l]));if(!u.length)return;let d=(await a.API.tokensInfoCall(t,u)).filter(e=>!!e),f=await c.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(t,d),m=d.filter(e=>!n.lowerCaseIncludes(f,e.erc20TokenAddress));await(0,p.update)(i.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 o=s.getStateKey(e,r),l=await this.getEVMTokenAddresses(r,e),u=await this.getNFTTokens(r,e),d=u.map(e=>e.contractAddress),f=[...l,...d];if(!f.length)return;let m=(await a.API.tokensInfoCall(r,f)).map((e,i)=>{if(e)return e;let a=f[i],o=u.find(e=>n.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 c.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(r,m),g=m.filter(e=>!n.lowerCaseIncludes(h,e.erc20TokenAddress)).map(e=>({...e,tokenIds:u.find(t=>n.caseInsensitiveEqual(t.contractAddress,e.erc20TokenAddress))?.tokenIds}));await(0,p.update)(i.StorageKeys.ALCHEMY_PUBLIC_TOKENS,(e={})=>{let t={...e,[o]: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,i){let{fetchRpcUrl:a}=e.networkRegistry[n];if(!a)throw Error(`RPC URL not found for the specified chain ID`);try{let e=[],n=1;do{let{items:o=[],page:s}=(await r.httpClient.post(a,{jsonrpc:`2.0`,id:1,method:`getAssetsByOwner`,params:{ownerAddress:i,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 o.Logger.error(`Failed to fetch NFTs from DAS API`,e),[]}}async getEVMTokenAddresses(n,i){let a=await d.getPublicBalanceByTokenAddress(n,i,t.zeroAddress),o=this.ALCHEMY_URLS[n];if(!o)throw Error(`Alchemy URL not found for the specified chain ID: ${n}`);let s=`https://${o}.g.alchemy.com/v2/${e.ALCHEMY_API_KEY}`,c=[],l;do{let e=[i,`erc20`];l&&e.push({pageKey:l});let{result:t}=await r.httpClient.post(s,{jsonrpc:`2.0`,id:1,method:`alchemy_getTokenBalances`,params:e});c.push(...t?.tokenBalances??[]),l=t?.pageKey}while(l);a&&a>0n&&c.push({contractAddress:t.zeroAddress,tokenBalance:a.toString()});let u={};return c.forEach(e=>{(!u[e.contractAddress]||BigInt(e.tokenBalance)>0n)&&(u[e.contractAddress]=e)}),Object.keys(u)}async getNFTTokens(t,n){let i=`https://${this.ALCHEMY_URLS[t]}.g.alchemy.com/nft/v3/${e.ALCHEMY_API_KEY}/getNFTsForOwner`,a=[],o;do{let e=new URLSearchParams({owner:n,withMetadata:`false`,pageSize:`100`});o&&e.append(`pageKey`,o);let{ownedNfts:t=[],pageKey:s}=await r.httpClient.get(`${i}?${e.toString()}`);a.push(...t),o=s}while(o);let s=a.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;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ALCHEMY_API_KEY as e, chainIds as t, isSolanaLike as n, networkRegistry as r } from "../../constants/chains.constants.mjs";
|
|
2
2
|
import { SOLANA_NFT_INTERFACES as i, TokenType as a, solanaNativeAddress as o, zeroAddress as s } from "../../constants/protocol.constants.mjs";
|
|
3
3
|
import { caseInsensitiveEqual as c, lowerCaseIncludes as l } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { httpClient as d } from "../http/HttpClient.mjs";
|
|
4
|
+
import { httpClient as u } from "../http/HttpClient.mjs";
|
|
6
5
|
import "../http/index.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { API as
|
|
6
|
+
import { StorageKeys as d } from "../../types/cache.types.mjs";
|
|
7
|
+
import { API as f } from "../../API/API.mjs";
|
|
8
|
+
import { Logger as p } from "../../error-handling/logger.mjs";
|
|
9
9
|
import { getStateKey as m } from "../../functions/utils/string.utils.mjs";
|
|
10
10
|
import { tokenVisibilityStorage as h } from "./token-visibility-db.mjs";
|
|
11
11
|
import { overlayTokensWithRegistryData as g } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
@@ -17,6 +17,7 @@ import { TOKEN_2022_PROGRAM_ID as S, TOKEN_PROGRAM_ID as C } from "@solana/spl-t
|
|
|
17
17
|
var w = new class {
|
|
18
18
|
fetchedTokens = {};
|
|
19
19
|
ALCHEMY_URLS = {
|
|
20
|
+
[t.bnbMainnet]: "bnb-mainnet",
|
|
20
21
|
[t.ethMainnet]: "eth-mainnet",
|
|
21
22
|
[t.polygon]: "polygon-mainnet",
|
|
22
23
|
[t.arbMainnet]: "arb-mainnet",
|
|
@@ -35,7 +36,7 @@ var w = new class {
|
|
|
35
36
|
}
|
|
36
37
|
async getPublicTokens(e, t) {
|
|
37
38
|
let n = m(t, e);
|
|
38
|
-
return g((await b(
|
|
39
|
+
return g((await b(d.ALCHEMY_PUBLIC_TOKENS))?.[n] || [], e);
|
|
39
40
|
}
|
|
40
41
|
async getFetchedTokens(e, t) {
|
|
41
42
|
let n = m(t, e);
|
|
@@ -47,8 +48,8 @@ var w = new class {
|
|
|
47
48
|
async fetchAndUpdateSolanaTokens(e, t) {
|
|
48
49
|
let n = m(e, t), [r, i] = await Promise.all([this.getSolanaTokenAddresses(t, e), this.getNFTAddresses(t, e)]), a = Array.from(new Set([...r, ...i]));
|
|
49
50
|
if (!a.length) return;
|
|
50
|
-
let o = (await
|
|
51
|
-
await x(
|
|
51
|
+
let o = (await f.tokensInfoCall(t, a)).filter((e) => !!e), s = await h.hideSpamsAndFetchHiddenTokensAddresses(t, o), c = o.filter((e) => !l(s, e.erc20TokenAddress));
|
|
52
|
+
await x(d.ALCHEMY_PUBLIC_TOKENS, (e = {}) => {
|
|
52
53
|
let t = {
|
|
53
54
|
...e,
|
|
54
55
|
[n]: c
|
|
@@ -62,7 +63,7 @@ var w = new class {
|
|
|
62
63
|
async fetchAndUpdateEVMTokens(e, t) {
|
|
63
64
|
let n = m(e, t), r = await this.getEVMTokenAddresses(t, e), i = await this.getNFTTokens(t, e), o = i.map((e) => e.contractAddress), s = [...r, ...o];
|
|
64
65
|
if (!s.length) return;
|
|
65
|
-
let
|
|
66
|
+
let u = (await f.tokensInfoCall(t, s)).map((e, n) => {
|
|
66
67
|
if (e) return e;
|
|
67
68
|
let r = s[n], o = i.find((e) => c(e.contractAddress, r));
|
|
68
69
|
return o && o.tokenIds && o.tokenIds.length > 0 && this.isWhitelistedNFT(r, t) ? {
|
|
@@ -74,11 +75,11 @@ var w = new class {
|
|
|
74
75
|
nftTokenType: a.ERC721,
|
|
75
76
|
tokenIds: o.tokenIds
|
|
76
77
|
} : null;
|
|
77
|
-
}).filter((e) => !!e),
|
|
78
|
+
}).filter((e) => !!e), p = await h.hideSpamsAndFetchHiddenTokensAddresses(t, u), g = u.filter((e) => !l(p, e.erc20TokenAddress)).map((e) => ({
|
|
78
79
|
...e,
|
|
79
80
|
tokenIds: i.find((t) => c(t.contractAddress, e.erc20TokenAddress))?.tokenIds
|
|
80
81
|
}));
|
|
81
|
-
await x(
|
|
82
|
+
await x(d.ALCHEMY_PUBLIC_TOKENS, (e = {}) => {
|
|
82
83
|
let t = {
|
|
83
84
|
...e,
|
|
84
85
|
[n]: g
|
|
@@ -101,7 +102,7 @@ var w = new class {
|
|
|
101
102
|
try {
|
|
102
103
|
let e = [], r = 1;
|
|
103
104
|
do {
|
|
104
|
-
let { items: a = [], page: o } = (await
|
|
105
|
+
let { items: a = [], page: o } = (await u.post(n, {
|
|
105
106
|
jsonrpc: "2.0",
|
|
106
107
|
id: 1,
|
|
107
108
|
method: "getAssetsByOwner",
|
|
@@ -119,7 +120,7 @@ var w = new class {
|
|
|
119
120
|
} while (r > 0);
|
|
120
121
|
return e;
|
|
121
122
|
} catch (e) {
|
|
122
|
-
return
|
|
123
|
+
return p.error("Failed to fetch NFTs from DAS API", e), [];
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
async getEVMTokenAddresses(t, n) {
|
|
@@ -129,7 +130,7 @@ var w = new class {
|
|
|
129
130
|
do {
|
|
130
131
|
let e = [n, "erc20"];
|
|
131
132
|
c && e.push({ pageKey: c });
|
|
132
|
-
let { result: t } = await
|
|
133
|
+
let { result: t } = await u.post(a, {
|
|
133
134
|
jsonrpc: "2.0",
|
|
134
135
|
id: 1,
|
|
135
136
|
method: "alchemy_getTokenBalances",
|
|
@@ -155,7 +156,7 @@ var w = new class {
|
|
|
155
156
|
pageSize: "100"
|
|
156
157
|
});
|
|
157
158
|
a && e.append("pageKey", a);
|
|
158
|
-
let { ownedNfts: t = [], pageKey: o } = await
|
|
159
|
+
let { ownedNfts: t = [], pageKey: o } = await u.get(`${r}?${e.toString()}`);
|
|
159
160
|
i.push(...t), a = o;
|
|
160
161
|
} while (a);
|
|
161
162
|
let o = i.filter(({ contractAddress: e, tokenId: t }) => e && t).reduce((e, { contractAddress: t, tokenId: n }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/_rolldown/runtime.cjs`),t=require(`../../constants/chains.constants.cjs`),n=require(`../../constants/protocol.constants.cjs`),r=require(`../../functions/utils/caseInsensitive.utils.cjs`),i=require(`../../types/ethereum-network.types.cjs`),a=require(`../../types/cache.types.cjs`),o=require(`../../
|
|
1
|
+
const e=require(`../../../../_virtual/_rolldown/runtime.cjs`),t=require(`../../constants/chains.constants.cjs`),n=require(`../../constants/protocol.constants.cjs`),r=require(`../../functions/utils/caseInsensitive.utils.cjs`),i=require(`../../types/ethereum-network.types.cjs`),a=require(`../../types/cache.types.cjs`),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/web3/getContractMetadata.cjs`);let d=require(`idb-keyval`),f=require(`axios`);f=e.__toESM(f);var p=class{API_BASE=`https://testnet.arcscan.app/api`;fetchedTokens={};async getPublicTokens(e){let n=c.getStateKey(e,t.chainIds.arcTestnet);return(await(0,d.get)(a.StorageKeys.ARC_PUBLIC_TOKENS))?.[n]||[]}getFetchedTokens(e){let n=c.getStateKey(e,t.chainIds.arcTestnet);return this.fetchedTokens[n]||[]}async fetchAndUpdatePublicTokens(e){let i=c.getStateKey(e,t.chainIds.arcTestnet),s=await this.getERC20TokenAddresses(e),u=await this.getNFTTokens(e),f=u.map(e=>e.contractAddress),p=[...s,...f];if(!p.length)return;let m=(await o.API.tokensInfoCall(t.chainIds.arcTestnet,p)).map((e,i)=>{if(e)return e;let a=p[i],o=u.find(e=>r.caseInsensitiveEqual(e.contractAddress,a));return o&&o.tokenIds&&o.tokenIds.length>0?{chainId:t.chainIds.arcTestnet,name:`Unknown NFT`,symbol:`NFT`,erc20TokenAddress:a,decimals:0,nftTokenType:n.TokenType.ERC721,tokenIds:o.tokenIds}:null}).filter(e=>!!e),h=await l.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(t.chainIds.arcTestnet,m),g=m.filter(e=>!r.lowerCaseIncludes(h,e.erc20TokenAddress)).map(e=>({...e,tokenIds:u.find(t=>r.caseInsensitiveEqual(t.contractAddress,e.erc20TokenAddress))?.tokenIds}));await(0,d.update)(a.StorageKeys.ARC_PUBLIC_TOKENS,(e={})=>{let t={...e,[i]:g};return this.fetchedTokens=t,t})}async getERC20TokenAddresses(e){let n=[];try{let r=(await f.default.post(`${this.API_BASE}?module=account&action=tokentx&address=${e}`)).data;if(r.status===`1`&&r.result){let a=[...new Set(r.result.map(({contractAddress:e})=>e))];for(let r of a)try{let a=u.getContractWithFetcherByChainId(t.chainIds.arcTestnet,i.ContractType.ERC20Contract,r),o=BigInt(await a.balanceOf(e));o>0n&&n.push({contractAddress:r,tokenBalance:o.toString()})}catch(e){s.Logger.error(`Error fetching ARC testnet token balance:`,e)}}}catch(e){s.Logger.error(`Error fetching ARC testnet token transactions:`,e)}return n.filter(({tokenBalance:e})=>Number(e)!==0).map(({contractAddress:e})=>e)}async getNFTTokens(e){let t=`${this.API_BASE}/v2/addresses/${e}/nft?type=ERC-721,ERC-1155`,n=[],r;do{let e=r?`&${new URLSearchParams(r)}`:``,{data:i}=await f.default.get(`${t}${e}`),{items:a=[],next_page_params:o}=i;n.push(...a),r=o?{token_contract_address_hash:o.token_contract_address_hash,token_id:o.token_id,token_type:o.token_type}:void 0}while(r);let i=n.reduce((e,t)=>{let n=t.token.address_hash.toLowerCase(),r=t.id;return e.has(n)||e.set(n,[]),e.get(n)?.push(r),e},new Map);return Array.from(i.entries()).map(([e,t])=>({contractAddress:e,tokenIds:t}))}},m=new p;exports.ArcPublicTokensDB=p,exports.arcPublicTokensDB=m;
|
|
@@ -3,8 +3,8 @@ import { TokenType as t } from "../../constants/protocol.constants.mjs";
|
|
|
3
3
|
import { caseInsensitiveEqual as n, lowerCaseIncludes as r } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
4
|
import { ContractType as i } from "../../types/ethereum-network.types.mjs";
|
|
5
5
|
import { StorageKeys as a } from "../../types/cache.types.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { API as o } from "../../API/API.mjs";
|
|
7
|
+
import { Logger as s } from "../../error-handling/logger.mjs";
|
|
8
8
|
import { getStateKey as c } from "../../functions/utils/string.utils.mjs";
|
|
9
9
|
import { tokenVisibilityStorage as l } from "./token-visibility-db.mjs";
|
|
10
10
|
import { getContractWithFetcherByChainId as u } from "../../functions/web3/getContractMetadata.mjs";
|
|
@@ -23,9 +23,9 @@ var m = class {
|
|
|
23
23
|
return this.fetchedTokens[n] || [];
|
|
24
24
|
}
|
|
25
25
|
async fetchAndUpdatePublicTokens(i) {
|
|
26
|
-
let
|
|
26
|
+
let s = c(i, e.arcTestnet), u = await this.getERC20TokenAddresses(i), d = await this.getNFTTokens(i), p = d.map((e) => e.contractAddress), m = [...u, ...p];
|
|
27
27
|
if (!m.length) return;
|
|
28
|
-
let h = (await
|
|
28
|
+
let h = (await o.tokensInfoCall(e.arcTestnet, m)).map((r, i) => {
|
|
29
29
|
if (r) return r;
|
|
30
30
|
let a = m[i], o = d.find((e) => n(e.contractAddress, a));
|
|
31
31
|
return o && o.tokenIds && o.tokenIds.length > 0 ? {
|
|
@@ -44,7 +44,7 @@ var m = class {
|
|
|
44
44
|
await f(a.ARC_PUBLIC_TOKENS, (e = {}) => {
|
|
45
45
|
let t = {
|
|
46
46
|
...e,
|
|
47
|
-
[
|
|
47
|
+
[s]: _
|
|
48
48
|
};
|
|
49
49
|
return this.fetchedTokens = t, t;
|
|
50
50
|
});
|
|
@@ -62,11 +62,11 @@ var m = class {
|
|
|
62
62
|
tokenBalance: o.toString()
|
|
63
63
|
});
|
|
64
64
|
} catch (e) {
|
|
65
|
-
|
|
65
|
+
s.error("Error fetching ARC testnet token balance:", e);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
} catch (e) {
|
|
69
|
-
|
|
69
|
+
s.error("Error fetching ARC testnet token transactions:", e);
|
|
70
70
|
}
|
|
71
71
|
return n.filter(({ tokenBalance: e }) => Number(e) !== 0).map(({ contractAddress: e }) => e);
|
|
72
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../functions/utils/tron.utils.cjs`),r=require(`../../types/cache.types.cjs`),i=require(`../../API/API.cjs`),a=require(`../../error-handling/logger.cjs`),o=require(`../../functions/utils/string.utils.cjs`),s=require(`./token-visibility-db.cjs`),c=require(`../../functions/utils/erc20tokenFunctions.cjs`),l=require(`../../functions/utils/create-provider.cjs`),u=require(`../../constants/events.constants.cjs`);require(`../../functions/index.cjs`);let d=require(`ethers`),f=require(`idb-keyval`),p=require(`async-mutex`);var m=new class{fetchedTokens={};updateMutexes={};transferEventTopic=d.ethers.id(`Transfer(address,address,uint256)`);chunkSize=2e3;getMutex(e){return this.updateMutexes[e]||(this.updateMutexes[e]=new p.Mutex),this.updateMutexes[e]}async getPublicTokens(e,t){let n=o.getStateKey(t,e);return c.overlayTokensWithRegistryData((await(0,f.get)(r.StorageKeys.EVENTS_PUBLIC_TOKENS))?.[n]||[],e)}async getFetchedTokens(e,t){let n=o.getStateKey(t,e);return c.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],e)}async fetchAndUpdatePublicTokens(e,n){let i=o.getStateKey(e,n);await this.getMutex(i).runExclusive(async()=>{try{let a=(await this.getPublicTokens(n,e)).map(e=>e.erc20TokenAddress),{toEvents:o,fromEvents:c,latestBlock:l}=await this.getEvents(e,n),u=[...o,...c],{erc20Tokens:d}=await this.fetchPublicTokens(u,n,a),p=await s.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(n,d),m=d.filter(e=>!t.lowerCaseIncludes(p,e.erc20TokenAddress));await(0,f.update)(r.StorageKeys.EVENTS_PUBLIC_TOKENS,(e={})=>{let n=e[i]||[],r=n.map(e=>e.erc20TokenAddress),a=m.filter(e=>!t.lowerCaseIncludes(r,e.erc20TokenAddress));n.push(...a);let s=this.updateTokenIds(c,o,n),l={...e,[i]:s};return this.fetchedTokens=l,l}),l&&await this.updateLastProcessedBlock(n,e,l)}catch(e){a.Logger.error(`public tokens db error`,e)}})}async getLastProcessedBlock(e,t){return(await(0,f.get)(r.StorageKeys.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS)||{})[o.getStateKey(t,e)]||u.EVENTS_INITIAL_BLOCKS[e]}async updateLastProcessedBlock(e,t,n){await(0,f.update)(r.StorageKeys.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS,(r={})=>{let i=o.getStateKey(t,e);return{...r,[i]:n}})}async getEvents(e,t){try{let r=l.createJsonRpcProvider(t),i=await this.getLastProcessedBlock(t,e)+1,a=await r.getBlockNumber(),o=n.addressToHexFormat(e),s=d.ethers.zeroPadValue(o,32),c=[],u=[];for(let e=i;e<=a;e+=this.chunkSize){let t=Math.min(e+this.chunkSize-1,a),n={topics:[this.transferEventTopic,null,s],fromBlock:e,toBlock:t},i={topics:[this.transferEventTopic,s,null],fromBlock:e,toBlock:t},[o,l]=await Promise.all([r.getLogs(n),r.getLogs(i)]);c.push(...o),u.push(...l)}return{toEvents:c,fromEvents:u,latestBlock:a}}catch(n){return a.Logger.error(`Error fetching events:`,n,`chainId`,t,`walletAddress`,e),{toEvents:[],fromEvents:[],latestBlock:void 0}}}updateTokenIds(e,t,n){let r=new Map;return n.forEach(e=>{if(c.isNFTToken(e)&&e.tokenIds){let t=e.erc20TokenAddress.toLowerCase();r.set(t,[...e.tokenIds])}}),t.forEach(e=>{if(e.topics.length<=3)return;let t=e.address.toLowerCase(),n=BigInt(e.topics[3]).toString();r.has(t)||r.set(t,[]),r.get(t)?.push(n)}),e.forEach(e=>{if(e.topics.length<=3)return;let t=e.address.toLowerCase(),n=r.get(t);if(n?.length){let t=BigInt(e.topics[3]).toString(),r=n.indexOf(t);r!==-1&&n.splice(r,1)}}),n.forEach(e=>{if(c.isNFTToken(e)){let t=e.erc20TokenAddress.toLowerCase(),n=r.get(t);e.tokenIds=n?.length&&n.length>0?n:void 0}}),n}async fetchPublicTokens(n,r,o){try{let a=[e.zeroAddress,...new Set(n.map(e=>e.address))].filter(e=>e&&!t.lowerCaseIncludes(o,e));return a.length?{erc20Tokens:(await i.API.tokensInfoCall(r,a)).filter(e=>!!e)}:{erc20Tokens:[]}}catch(e){return a.Logger.error(`Error fetching public tokens:`,e),{erc20Tokens:[]}}}};exports.eventsPublicTokensDB=m;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { zeroAddress as e } from "../../constants/protocol.constants.mjs";
|
|
2
2
|
import { lowerCaseIncludes as t } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { addressToHexFormat as n } from "../../functions/utils/tron.utils.mjs";
|
|
4
|
+
import { StorageKeys as r } from "../../types/cache.types.mjs";
|
|
5
|
+
import { API as i } from "../../API/API.mjs";
|
|
6
|
+
import { Logger as a } from "../../error-handling/logger.mjs";
|
|
7
7
|
import { getStateKey as o } from "../../functions/utils/string.utils.mjs";
|
|
8
8
|
import { tokenVisibilityStorage as s } from "./token-visibility-db.mjs";
|
|
9
9
|
import { isNFTToken as c, overlayTokensWithRegistryData as l } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
@@ -22,49 +22,49 @@ var g = new class {
|
|
|
22
22
|
return this.updateMutexes[e] || (this.updateMutexes[e] = new h()), this.updateMutexes[e];
|
|
23
23
|
}
|
|
24
24
|
async getPublicTokens(e, t) {
|
|
25
|
-
let
|
|
26
|
-
return l((await p(
|
|
25
|
+
let n = o(t, e);
|
|
26
|
+
return l((await p(r.EVENTS_PUBLIC_TOKENS))?.[n] || [], e);
|
|
27
27
|
}
|
|
28
28
|
async getFetchedTokens(e, t) {
|
|
29
29
|
let n = o(t, e);
|
|
30
30
|
return l(this.fetchedTokens[n] || [], e);
|
|
31
31
|
}
|
|
32
|
-
async fetchAndUpdatePublicTokens(e,
|
|
33
|
-
let
|
|
34
|
-
await this.getMutex(
|
|
32
|
+
async fetchAndUpdatePublicTokens(e, n) {
|
|
33
|
+
let i = o(e, n);
|
|
34
|
+
await this.getMutex(i).runExclusive(async () => {
|
|
35
35
|
try {
|
|
36
|
-
let
|
|
37
|
-
await m(
|
|
38
|
-
let n = e[
|
|
39
|
-
n.push(...
|
|
36
|
+
let a = (await this.getPublicTokens(n, e)).map((e) => e.erc20TokenAddress), { toEvents: o, fromEvents: c, latestBlock: l } = await this.getEvents(e, n), u = [...o, ...c], { erc20Tokens: d } = await this.fetchPublicTokens(u, n, a), f = await s.hideSpamsAndFetchHiddenTokensAddresses(n, d), p = d.filter((e) => !t(f, e.erc20TokenAddress));
|
|
37
|
+
await m(r.EVENTS_PUBLIC_TOKENS, (e = {}) => {
|
|
38
|
+
let n = e[i] || [], r = n.map((e) => e.erc20TokenAddress), a = p.filter((e) => !t(r, e.erc20TokenAddress));
|
|
39
|
+
n.push(...a);
|
|
40
40
|
let s = this.updateTokenIds(c, o, n), l = {
|
|
41
41
|
...e,
|
|
42
|
-
[
|
|
42
|
+
[i]: s
|
|
43
43
|
};
|
|
44
44
|
return this.fetchedTokens = l, l;
|
|
45
|
-
}), l && await this.updateLastProcessedBlock(
|
|
45
|
+
}), l && await this.updateLastProcessedBlock(n, e, l);
|
|
46
46
|
} catch (e) {
|
|
47
|
-
|
|
47
|
+
a.error("public tokens db error", e);
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
async getLastProcessedBlock(e, t) {
|
|
52
|
-
return (await p(
|
|
52
|
+
return (await p(r.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS) || {})[o(t, e)] || d[e];
|
|
53
53
|
}
|
|
54
|
-
async updateLastProcessedBlock(e, t,
|
|
55
|
-
await m(
|
|
54
|
+
async updateLastProcessedBlock(e, t, n) {
|
|
55
|
+
await m(r.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS, (r = {}) => {
|
|
56
56
|
let i = o(t, e);
|
|
57
57
|
return {
|
|
58
|
-
...
|
|
59
|
-
[i]:
|
|
58
|
+
...r,
|
|
59
|
+
[i]: n
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
async getEvents(e, t) {
|
|
64
64
|
try {
|
|
65
|
-
let
|
|
66
|
-
for (let e =
|
|
67
|
-
let t = Math.min(e + this.chunkSize - 1, a),
|
|
65
|
+
let r = u(t), i = await this.getLastProcessedBlock(t, e) + 1, a = await r.getBlockNumber(), o = n(e), s = f.zeroPadValue(o, 32), c = [], l = [];
|
|
66
|
+
for (let e = i; e <= a; e += this.chunkSize) {
|
|
67
|
+
let t = Math.min(e + this.chunkSize - 1, a), n = {
|
|
68
68
|
topics: [
|
|
69
69
|
this.transferEventTopic,
|
|
70
70
|
null,
|
|
@@ -80,7 +80,7 @@ var g = new class {
|
|
|
80
80
|
],
|
|
81
81
|
fromBlock: e,
|
|
82
82
|
toBlock: t
|
|
83
|
-
}, [o, u] = await Promise.all([
|
|
83
|
+
}, [o, u] = await Promise.all([r.getLogs(n), r.getLogs(i)]);
|
|
84
84
|
c.push(...o), l.push(...u);
|
|
85
85
|
}
|
|
86
86
|
return {
|
|
@@ -89,7 +89,7 @@ var g = new class {
|
|
|
89
89
|
latestBlock: a
|
|
90
90
|
};
|
|
91
91
|
} catch (n) {
|
|
92
|
-
return
|
|
92
|
+
return a.error("Error fetching events:", n, "chainId", t, "walletAddress", e), {
|
|
93
93
|
toEvents: [],
|
|
94
94
|
fromEvents: [],
|
|
95
95
|
latestBlock: void 0
|
|
@@ -121,12 +121,12 @@ var g = new class {
|
|
|
121
121
|
}
|
|
122
122
|
}), n;
|
|
123
123
|
}
|
|
124
|
-
async fetchPublicTokens(n,
|
|
124
|
+
async fetchPublicTokens(n, r, o) {
|
|
125
125
|
try {
|
|
126
|
-
let
|
|
127
|
-
return
|
|
126
|
+
let a = [e, ...new Set(n.map((e) => e.address))].filter((e) => e && !t(o, e));
|
|
127
|
+
return a.length ? { erc20Tokens: (await i.tokensInfoCall(r, a)).filter((e) => !!e) } : { erc20Tokens: [] };
|
|
128
128
|
} catch (e) {
|
|
129
|
-
return
|
|
129
|
+
return a.error("Error fetching public tokens:", e), { erc20Tokens: [] };
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../types/cache.types.cjs`),n=require(`../../
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../types/cache.types.cjs`),n=require(`../../API/API.cjs`),r=require(`../../error-handling/logger.cjs`),i=require(`../../functions/utils/string.utils.cjs`),a=require(`./token-visibility-db.cjs`);let o=require(`idb-keyval`);var s=class{fetchedTokens={};initalFetched=!1;async updateFetchedTokens(){let e=await(0,o.get)(t.StorageKeys.PRIVATE_TOKENS);this.fetchedTokens=e??{},this.initalFetched=!0}async getPrivateTokens(e,n){let r=i.getStateKey(n,e);return(await(0,o.get)(t.StorageKeys.PRIVATE_TOKENS))?.[r]||[]}async fetchPrivateTokens(t,i,a){try{let r=[...new Set(i)].filter(t=>t&&!e.lowerCaseIncludes(a,t));if(!r.length)return[];let o=(await n.API.tokensInfoCall(t,r)).filter(e=>!!e),s=new Map;return o.forEach(e=>{s.set(e.erc20TokenAddress.toLowerCase(),e)}),Array.from(s.values())}catch(e){return r.Logger.error(`Error fetching private tokens:`,e),[]}}async fetchAndUpdatePrivateTokens(n,r,s,c){let l=(await this.getPrivateTokens(r,s)).map(e=>e.erc20TokenAddress),u=c??await this.fetchPrivateTokens(r,n,l),d=await a.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(r,u),f=i.getStateKey(s,r);await(0,o.update)(t.StorageKeys.PRIVATE_TOKENS,(t={})=>{let n=t?.[f]||[],r=n.map(e=>e.erc20TokenAddress),i=u.filter(t=>!e.lowerCaseIncludes(r,t.erc20TokenAddress));n.push(...i);let a=n.filter(t=>!e.lowerCaseIncludes(d,t.erc20TokenAddress)),o={...t,[f]:a};return this.fetchedTokens=o,o})}getFetchedTokens(e,t){let n=i.getStateKey(t,e);return this.fetchedTokens[n]||[]}},c=new s;exports.PrivateTokensDB=s,exports.privateTokensDB=c;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { lowerCaseIncludes as e } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
2
2
|
import { StorageKeys as t } from "../../types/cache.types.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { API as n } from "../../API/API.mjs";
|
|
4
|
+
import { Logger as r } from "../../error-handling/logger.mjs";
|
|
5
5
|
import { getStateKey as i } from "../../functions/utils/string.utils.mjs";
|
|
6
6
|
import { tokenVisibilityStorage as a } from "./token-visibility-db.mjs";
|
|
7
7
|
import { get as o, update as s } from "idb-keyval";
|
|
@@ -19,14 +19,14 @@ var c = class {
|
|
|
19
19
|
}
|
|
20
20
|
async fetchPrivateTokens(t, i, a) {
|
|
21
21
|
try {
|
|
22
|
-
let
|
|
23
|
-
if (!
|
|
24
|
-
let o = (await
|
|
22
|
+
let r = [...new Set(i)].filter((t) => t && !e(a, t));
|
|
23
|
+
if (!r.length) return [];
|
|
24
|
+
let o = (await n.tokensInfoCall(t, r)).filter((e) => !!e), s = /* @__PURE__ */ new Map();
|
|
25
25
|
return o.forEach((e) => {
|
|
26
26
|
s.set(e.erc20TokenAddress.toLowerCase(), e);
|
|
27
27
|
}), Array.from(s.values());
|
|
28
28
|
} catch (e) {
|
|
29
|
-
return
|
|
29
|
+
return r.error("Error fetching private tokens:", e), [];
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
async fetchAndUpdatePrivateTokens(n, r, o, c) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../types/cache.types.cjs`),n=require(`../../API/API.cjs`),r=require(`../../functions/utils/string.utils.cjs`),i=require(`./token-visibility-db.cjs`),a=require(`../../functions/utils/erc20tokenFunctions.cjs`)
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../types/cache.types.cjs`),n=require(`../../API/API.cjs`),r=require(`../../functions/utils/string.utils.cjs`),i=require(`./token-visibility-db.cjs`),a=require(`../../functions/utils/erc20tokenFunctions.cjs`);let o=require(`idb-keyval`);var s=class{fetchedTokens={};async getPublicTokens(e,n){let i=r.getStateKey(e,n);return a.overlayTokensWithRegistryData((await(0,o.get)(t.StorageKeys.TEMPO_PUBLIC_TOKENS))?.[i]||[],n)}async getFetchedTokens(e,t){let n=r.getStateKey(e,t);return a.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],t)}async fetchAndUpdatePublicTokens(a,s){let c=r.getStateKey(a,s),l=await this.getHeldTokenAddresses(s);if(!l.length)return;let u=(await n.API.tokensInfoCall(s,l)).filter(e=>!!e),d=await i.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(s,u),f=u.filter(t=>!e.lowerCaseIncludes(d,t.erc20TokenAddress));await(0,o.update)(t.StorageKeys.TEMPO_PUBLIC_TOKENS,(e={})=>{let t={...e,[c]:f};return this.fetchedTokens=t,t})}async getHeldTokenAddresses(e){let t=await a.getErc20TokensForChainAPI(e);return Array.from(new Set(t.map(({erc20TokenAddress:e})=>e)))}},c=new s;exports.TempoPublicTokensDB=s,exports.tempoPublicTokensDB=c;
|
|
@@ -4,24 +4,23 @@ import { API as n } from "../../API/API.mjs";
|
|
|
4
4
|
import { getStateKey as r } from "../../functions/utils/string.utils.mjs";
|
|
5
5
|
import { tokenVisibilityStorage as i } from "./token-visibility-db.mjs";
|
|
6
6
|
import { getErc20TokensForChainAPI as a, overlayTokensWithRegistryData as o } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { get as c, update as l } from "idb-keyval";
|
|
7
|
+
import { get as s, update as c } from "idb-keyval";
|
|
9
8
|
//#region libs/shared/common/src/data-structures/TokenDBs/TempoPublicTokensDB.ts
|
|
10
|
-
var
|
|
9
|
+
var l = class {
|
|
11
10
|
fetchedTokens = {};
|
|
12
11
|
async getPublicTokens(e, n) {
|
|
13
12
|
let i = r(e, n);
|
|
14
|
-
return o((await
|
|
13
|
+
return o((await s(t.TEMPO_PUBLIC_TOKENS))?.[i] || [], n);
|
|
15
14
|
}
|
|
16
15
|
async getFetchedTokens(e, t) {
|
|
17
16
|
let n = r(e, t);
|
|
18
17
|
return o(this.fetchedTokens[n] || [], t);
|
|
19
18
|
}
|
|
20
19
|
async fetchAndUpdatePublicTokens(a, o) {
|
|
21
|
-
let s = r(a, o),
|
|
22
|
-
if (!
|
|
23
|
-
let u = (await n.tokensInfoCall(o,
|
|
24
|
-
await
|
|
20
|
+
let s = r(a, o), l = await this.getHeldTokenAddresses(o);
|
|
21
|
+
if (!l.length) return;
|
|
22
|
+
let u = (await n.tokensInfoCall(o, l)).filter((e) => !!e), d = await i.hideSpamsAndFetchHiddenTokensAddresses(o, u), f = u.filter((t) => !e(d, t.erc20TokenAddress));
|
|
23
|
+
await c(t.TEMPO_PUBLIC_TOKENS, (e = {}) => {
|
|
25
24
|
let t = {
|
|
26
25
|
...e,
|
|
27
26
|
[s]: f
|
|
@@ -29,13 +28,10 @@ var u = class {
|
|
|
29
28
|
return this.fetchedTokens = t, t;
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
|
-
async getHeldTokenAddresses(e
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
return r && r > 0n ? n.erc20TokenAddress : null;
|
|
36
|
-
}));
|
|
37
|
-
return Array.from(new Set(r.filter((e) => !!e)));
|
|
31
|
+
async getHeldTokenAddresses(e) {
|
|
32
|
+
let t = await a(e);
|
|
33
|
+
return Array.from(new Set(t.map(({ erc20TokenAddress: e }) => e)));
|
|
38
34
|
}
|
|
39
|
-
},
|
|
35
|
+
}, u = new l();
|
|
40
36
|
//#endregion
|
|
41
|
-
export {
|
|
37
|
+
export { l as TempoPublicTokensDB, u as tempoPublicTokensDB };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../http/HttpClient.cjs`);require(`../http/index.cjs`);const r=require(`../../functions/utils/tron.utils.cjs`),i=require(`../../types/cache.types.cjs`),a=require(`../../API/API.cjs`),o=require(`../../functions/utils/string.utils.cjs`),s=require(`./token-visibility-db.cjs`),c=require(`../../functions/utils/erc20tokenFunctions.cjs`);let l=require(`idb-keyval`);var u=200,d=class{fetchedTokens={};async getPublicTokens(e,t){let n=o.getStateKey(e,t);return c.overlayTokensWithRegistryData((await(0,l.get)(i.StorageKeys.TRON_PUBLIC_TOKENS))?.[n]||[],t)}async getFetchedTokens(e,t){let n=o.getStateKey(e,t);return c.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],t)}async fetchAndUpdatePublicTokens(e,n){let r=o.getStateKey(e,n),c=await this.getHeldTokenAddresses(e,n);if(!c.length)return;let u=(await a.API.tokensInfoCall(n,c)).filter(e=>!!e),d=await s.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(n,u),f=u.filter(e=>!t.lowerCaseIncludes(d,e.erc20TokenAddress));await(0,l.update)(i.StorageKeys.TRON_PUBLIC_TOKENS,(e={})=>{let t={...e,[r]:f};return this.fetchedTokens=t,t})}async getHeldTokenAddresses(t,i){let a=r.toTronBase58IfHex(t),o=`${r.getTronWalletRpcUrl(i)}/v1/accounts/${a}`,s=(await n.httpClient.get(o))?.data?.[0];if(!s)return this.getTokenAddressesFromTransferHistory(a,i);let c=[];return s.balance&&s.balance>0&&c.push(e.zeroAddress),(s.trc20??[]).forEach(e=>{Object.entries(e).forEach(([e,t])=>{BigInt(t)>0n&&c.push(r.addressToHexFormat(e))})}),Array.from(new Set(c))}async getTokenAddressesFromTransferHistory(e,t){let i=`${r.getTronWalletRpcUrl(t)}/v1/accounts/${e}/transactions/trc20?only_to=true&limit=${u}`,a=((await n.httpClient.get(i))?.data??[]).map(e=>e.token_info?.address).filter(e=>!!e).map(r.addressToHexFormat);return Array.from(new Set(a))}},f=new d;exports.TronPublicTokensDB=d,exports.tronPublicTokensDB=f;
|
|
@@ -5,5 +5,6 @@ export declare class TronPublicTokensDB {
|
|
|
5
5
|
getFetchedTokens(walletAddress: string, chainId: number): Promise<ERC20Token[]>;
|
|
6
6
|
fetchAndUpdatePublicTokens(walletAddress: string, chainId: number): Promise<void>;
|
|
7
7
|
private getHeldTokenAddresses;
|
|
8
|
+
private getTokenAddressesFromTransferHistory;
|
|
8
9
|
}
|
|
9
10
|
export declare const tronPublicTokensDB: TronPublicTokensDB;
|
|
@@ -1,47 +1,51 @@
|
|
|
1
1
|
import { zeroAddress as e } from "../../constants/protocol.constants.mjs";
|
|
2
2
|
import { lowerCaseIncludes as t } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { httpClient as r } from "../http/HttpClient.mjs";
|
|
3
|
+
import { httpClient as n } from "../http/HttpClient.mjs";
|
|
5
4
|
import "../http/index.mjs";
|
|
6
|
-
import { addressToHexFormat as
|
|
5
|
+
import { addressToHexFormat as r, getTronWalletRpcUrl as i, toTronBase58IfHex as a } from "../../functions/utils/tron.utils.mjs";
|
|
6
|
+
import { StorageKeys as o } from "../../types/cache.types.mjs";
|
|
7
7
|
import { API as s } from "../../API/API.mjs";
|
|
8
8
|
import { getStateKey as c } from "../../functions/utils/string.utils.mjs";
|
|
9
9
|
import { tokenVisibilityStorage as l } from "./token-visibility-db.mjs";
|
|
10
10
|
import { overlayTokensWithRegistryData as u } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
11
11
|
import { get as d, update as f } from "idb-keyval";
|
|
12
12
|
//#region libs/shared/common/src/data-structures/TokenDBs/TronPublicTokensDB.ts
|
|
13
|
-
var p = class {
|
|
13
|
+
var p = 200, m = class {
|
|
14
14
|
fetchedTokens = {};
|
|
15
15
|
async getPublicTokens(e, t) {
|
|
16
|
-
let
|
|
17
|
-
return u((await d(
|
|
16
|
+
let n = c(e, t);
|
|
17
|
+
return u((await d(o.TRON_PUBLIC_TOKENS))?.[n] || [], t);
|
|
18
18
|
}
|
|
19
19
|
async getFetchedTokens(e, t) {
|
|
20
20
|
let n = c(e, t);
|
|
21
21
|
return u(this.fetchedTokens[n] || [], t);
|
|
22
22
|
}
|
|
23
|
-
async fetchAndUpdatePublicTokens(e,
|
|
24
|
-
let
|
|
25
|
-
if (!
|
|
26
|
-
let
|
|
27
|
-
await f(
|
|
23
|
+
async fetchAndUpdatePublicTokens(e, n) {
|
|
24
|
+
let r = c(e, n), i = await this.getHeldTokenAddresses(e, n);
|
|
25
|
+
if (!i.length) return;
|
|
26
|
+
let a = (await s.tokensInfoCall(n, i)).filter((e) => !!e), u = await l.hideSpamsAndFetchHiddenTokensAddresses(n, a), d = a.filter((e) => !t(u, e.erc20TokenAddress));
|
|
27
|
+
await f(o.TRON_PUBLIC_TOKENS, (e = {}) => {
|
|
28
28
|
let t = {
|
|
29
29
|
...e,
|
|
30
|
-
[
|
|
30
|
+
[r]: d
|
|
31
31
|
};
|
|
32
32
|
return this.fetchedTokens = t, t;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
async getHeldTokenAddresses(t,
|
|
36
|
-
let s =
|
|
37
|
-
if (!l) return
|
|
35
|
+
async getHeldTokenAddresses(t, o) {
|
|
36
|
+
let s = a(t), c = `${i(o)}/v1/accounts/${s}`, l = (await n.get(c))?.data?.[0];
|
|
37
|
+
if (!l) return this.getTokenAddressesFromTransferHistory(s, o);
|
|
38
38
|
let u = [];
|
|
39
39
|
return l.balance && l.balance > 0 && u.push(e), (l.trc20 ?? []).forEach((e) => {
|
|
40
40
|
Object.entries(e).forEach(([e, t]) => {
|
|
41
|
-
BigInt(t) > 0n && u.push(
|
|
41
|
+
BigInt(t) > 0n && u.push(r(e));
|
|
42
42
|
});
|
|
43
43
|
}), Array.from(new Set(u));
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
async getTokenAddressesFromTransferHistory(e, t) {
|
|
46
|
+
let a = `${i(t)}/v1/accounts/${e}/transactions/trc20?only_to=true&limit=${p}`, o = ((await n.get(a))?.data ?? []).map((e) => e.token_info?.address).filter((e) => !!e).map(r);
|
|
47
|
+
return Array.from(new Set(o));
|
|
48
|
+
}
|
|
49
|
+
}, h = new m();
|
|
46
50
|
//#endregion
|
|
47
|
-
export {
|
|
51
|
+
export { m as TronPublicTokensDB, h as tronPublicTokensDB };
|