@gurge/sdk 0.3.150 → 0.3.151
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 +43 -29
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +21 -46
- package/common/src/API/API.mjs +96 -121
- package/common/src/API/admin-calls.cjs +1 -1
- package/common/src/API/admin-calls.d.ts +1 -1
- package/common/src/API/admin-calls.mjs +3 -1
- package/common/src/API/callLifiAPI.cjs +1 -1
- package/common/src/API/callLifiAPI.d.ts +4 -0
- package/common/src/API/callLifiAPI.mjs +7 -2
- package/common/src/API/callNearIntentsAPI.cjs +1 -1
- package/common/src/API/callNearIntentsAPI.mjs +2 -2
- package/common/src/API/callRelayer.cjs +1 -1
- package/common/src/API/callRelayer.d.ts +36 -1
- package/common/src/API/callRelayer.mjs +7 -1
- 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/dashboardTransactionCalls.cjs +1 -1
- package/common/src/API/dashboardTransactionCalls.d.ts +4 -1
- package/common/src/API/dashboardTransactionCalls.mjs +2 -2
- package/common/src/API/enclaveRecipientInfoCalls.d.ts +0 -2
- package/common/src/API/enclaveSignatureCalls.cjs +1 -1
- package/common/src/API/enclaveSignatureCalls.d.ts +2 -1
- package/common/src/API/enclaveSignatureCalls.mjs +5 -8
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +40 -27
- package/common/src/API/enclaveUtxoCalls.mjs +16 -17
- package/common/src/API/evm-rpc-fallback.cjs +1 -0
- package/common/src/API/evm-rpc-fallback.d.ts +1 -0
- package/common/src/API/evm-rpc-fallback.mjs +17 -0
- package/common/src/API/evm-token-assets.d.ts +8 -0
- 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 +2 -3
- package/common/src/API/index.mjs +4 -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/privateSendRecipientInfoCalls.cjs +1 -1
- package/common/src/API/privateSendRecipientInfoCalls.d.ts +3 -6
- package/common/src/API/privateSendRecipientInfoCalls.mjs +12 -6
- 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/route-config.cjs +1 -0
- package/common/src/API/route-config.d.ts +1 -0
- package/common/src/API/route-config.mjs +26 -0
- package/common/src/API/scheduled-transactions-calls.cjs +1 -1
- package/common/src/API/scheduled-transactions-calls.d.ts +2 -5
- package/common/src/API/scheduled-transactions-calls.mjs +2 -6
- package/common/src/API/solana-nft-assets.d.ts +1 -0
- package/common/src/API/solana-priority-fee.cjs +1 -0
- package/common/src/API/solana-priority-fee.d.ts +3 -0
- package/common/src/API/solana-priority-fee.mjs +20 -0
- package/common/src/API/solana-rpc-fallback.cjs +1 -0
- package/common/src/API/solana-rpc-fallback.d.ts +1 -0
- package/common/src/API/solana-rpc-fallback.mjs +13 -0
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.d.ts +3 -5
- package/common/src/API/temporaryWalletCalls.mjs +8 -9
- 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 +3 -0
- package/common/src/constants/balance.constants.mjs +4 -0
- package/common/src/constants/bridging.constants.cjs +1 -1
- package/common/src/constants/bridging.constants.d.ts +10 -0
- package/common/src/constants/bridging.constants.mjs +2 -1
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +21 -19
- package/common/src/constants/chains.constants.mjs +175 -198
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.d.ts +3 -1
- 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 +1 -109
- package/common/src/constants/contracts.constants.mjs +16 -34
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +8 -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 +7 -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 +8 -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 +12 -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 +8 -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 +8 -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 +8 -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 +7 -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 +36 -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 +1 -15
- 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/lifi.constants.cjs +1 -1
- package/common/src/constants/lifi.constants.mjs +6 -3
- package/common/src/constants/mediaUrls.constants.d.ts +0 -1
- package/common/src/constants/okx.constants.d.ts +1 -0
- 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 +22 -12
- package/common/src/constants/protocol.constants.mjs +3 -15
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +14 -36
- package/common/src/constants/server.constants.mjs +19 -49
- package/common/src/constants/tokens.constants.cjs +1 -1
- package/common/src/constants/tokens.constants.d.ts +1 -0
- package/common/src/constants/tokens.constants.mjs +4 -1
- package/common/src/constants/tx-confirmation.constants.cjs +1 -1
- package/common/src/constants/tx-confirmation.constants.d.ts +1 -0
- package/common/src/constants/tx-confirmation.constants.mjs +2 -2
- package/common/src/crypto/ecdh-sealed-keys.cjs +1 -1
- package/common/src/crypto/ecdh-sealed-keys.mjs +17 -2
- package/common/src/crypto/index.cjs +1 -1
- package/common/src/crypto/index.d.ts +0 -1
- package/common/src/crypto/index.mjs +1 -2
- package/common/src/data-structures/ApprovalDBs/EventsPublicApprovalsDB.d.ts +1 -2
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +18 -23
- package/common/src/data-structures/Hinkal/Hinkal.mjs +142 -174
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +18 -24
- 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 +36 -35
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +13 -11
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.d.ts +6 -0
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +100 -0
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +40 -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.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +113 -109
- 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 +98 -64
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +20 -7
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +50 -48
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +8 -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/hinkalProxySend.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalProxySend.d.ts +6 -0
- package/common/src/data-structures/Hinkal/hinkalProxySend.mjs +16 -0
- package/common/src/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxySwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxySwap.mjs +13 -12
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +19 -17
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +50 -79
- 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 +115 -133
- 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/hinkalSolanaProxySend.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +24 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +82 -56
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +11 -13
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.mjs +32 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +58 -79
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.mjs +119 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +2 -30
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +46 -77
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +46 -57
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +32 -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 +106 -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/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +38 -49
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +160 -102
- package/common/src/data-structures/Hinkal/index.d.ts +2 -1
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.d.ts +27 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +7 -6
- package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/activity-db.mjs +34 -34
- 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/index.cjs +1 -1
- package/common/src/data-structures/IndexedDB/index.d.ts +1 -0
- package/common/src/data-structures/IndexedDB/index.mjs +1 -0
- 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/pay-activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/pay-activity-db.mjs +43 -1
- 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/IndexedDB/scheduled-transactions-db.cjs +1 -0
- package/common/src/data-structures/IndexedDB/scheduled-transactions-db.d.ts +11 -0
- package/common/src/data-structures/IndexedDB/scheduled-transactions-db.mjs +34 -0
- package/common/src/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/signatures-db.mjs +11 -11
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.d.ts +1 -0
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +29 -26
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +0 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +17 -18
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.d.ts +1 -0
- 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 +11 -71
- 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 +39 -23
- package/common/src/data-structures/crypto-keys/keys.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keys.d.ts +13 -27
- package/common/src/data-structures/crypto-keys/keys.mjs +64 -79
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +3 -2
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +46 -38
- 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/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 +11 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +12 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +4 -0
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +100 -86
- package/common/src/data-structures/provider-adapter/IProviderAdapter.d.ts +1 -5
- package/common/src/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
- package/common/src/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -0
- package/common/src/data-structures/token-price-fetcher/TokenChecker.mjs +5 -3
- 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 +14 -14
- package/common/src/error-handling/error-codes.constants.mjs +30 -32
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +28 -18
- 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/auto-deposit-back-helpers/get-gas-token-records.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.mjs +7 -6
- 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 +8 -8
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.d.ts +0 -1
- package/common/src/functions/index.mjs +21 -20
- 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 +38 -5
- package/common/src/functions/pre-transaction/ensureAmountChanges.cjs +1 -1
- package/common/src/functions/pre-transaction/ensureAmountChanges.mjs +3 -10
- 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 +1 -1
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +2 -2
- package/common/src/functions/pre-transaction/index.mjs +2 -3
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +2 -2
- package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +2 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +19 -18
- package/common/src/functions/pre-transaction/sendV0Transaction.cjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.d.ts +5 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.mjs +4 -4
- 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/solanaTransfer.utils.cjs +1 -1
- package/common/src/functions/pre-transaction/solanaTransfer.utils.mjs +16 -15
- package/common/src/functions/pre-transaction/speculativeUtxo.cjs +1 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.d.ts +9 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.mjs +19 -0
- 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/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.d.ts +9 -3
- package/common/src/functions/private-wallet/emporium.helpers.mjs +116 -72
- 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 +38 -80
- 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 +4 -4
- package/common/src/functions/snarkjs/common.snarkjs.mjs +104 -65
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +231 -144
- package/common/src/functions/snarkjs/constant.mjs +231 -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 +85 -69
- 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 +62 -61
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclave.d.ts +34 -0
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +95 -0
- package/common/src/functions/snarkjs/constructTxEnclaveVerify.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclaveVerify.d.ts +5 -0
- package/common/src/functions/snarkjs/constructTxEnclaveVerify.mjs +295 -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 +16 -18
- 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 +4 -2
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +19 -13
- 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 +16 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +36 -7
- 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 +2 -1
- package/common/src/functions/utils/addresses.mjs +30 -21
- package/common/src/functions/utils/bridge-arrival.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.d.ts +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.mjs +16 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.d.ts +19 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.mjs +24 -0
- package/common/src/functions/utils/bridge-claimable.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-claimable.utils.d.ts +15 -0
- package/common/src/functions/utils/bridge-claimable.utils.mjs +3 -0
- package/common/src/functions/utils/bridge-flow.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-flow.utils.d.ts +4 -0
- package/common/src/functions/utils/bridge-flow.utils.mjs +2 -0
- 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/create-provider.cjs +1 -1
- package/common/src/functions/utils/create-provider.d.ts +9 -2
- package/common/src/functions/utils/create-provider.mjs +45 -9
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +2 -5
- package/common/src/functions/utils/deposit-claimable.utils.mjs +3 -6
- package/common/src/functions/utils/enclave-recipient-info-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-recipient-info-storage.d.ts +4 -1
- package/common/src/functions/utils/enclave-recipient-info-storage.mjs +1 -0
- package/common/src/functions/utils/enclave-signature-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-signature-storage.d.ts +1 -1
- package/common/src/functions/utils/enclave-signature-storage.mjs +3 -3
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.d.ts +6 -7
- package/common/src/functions/utils/enclave-utxo-storage.mjs +16 -2
- 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/encryptInputForEnclave.cjs +1 -1
- package/common/src/functions/utils/encryptInputForEnclave.d.ts +8 -0
- package/common/src/functions/utils/encryptInputForEnclave.mjs +43 -23
- package/common/src/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/common/src/functions/utils/erc20tokenFunctions.mjs +2 -15
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +3 -0
- package/common/src/functions/utils/fees.utils.mjs +42 -29
- package/common/src/functions/utils/formatter.d.ts +2 -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.d.ts +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +2 -26
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +7 -24
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +17 -3
- package/common/src/functions/utils/index.mjs +27 -13
- package/common/src/functions/utils/ipfs.d.ts +2 -3
- 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/lifi.utils.d.ts +3 -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 +27 -13
- 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/proxyAvatar.utils.cjs +1 -0
- package/common/src/functions/utils/proxyAvatar.utils.mjs +3 -0
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.d.ts +0 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +37 -23
- package/common/src/functions/utils/recovery-balance.utils.cjs +1 -0
- package/common/src/functions/utils/recovery-balance.utils.d.ts +2 -0
- package/common/src/functions/utils/recovery-balance.utils.mjs +1 -0
- 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/solana-program.utils.cjs +1 -0
- package/common/src/functions/utils/solana-program.utils.d.ts +3 -0
- package/common/src/functions/utils/solana-program.utils.mjs +17 -0
- package/common/src/functions/utils/solana-sponsored.utils.cjs +1 -0
- package/common/src/functions/utils/solana-sponsored.utils.d.ts +22 -0
- package/common/src/functions/utils/solana-sponsored.utils.mjs +30 -0
- package/common/src/functions/utils/solanaMint.utils.cjs +1 -1
- package/common/src/functions/utils/solanaMint.utils.d.ts +7 -0
- package/common/src/functions/utils/solanaMint.utils.mjs +18 -8
- package/common/src/functions/utils/sponsored-shield.utils.cjs +1 -0
- package/common/src/functions/utils/sponsored-shield.utils.d.ts +3 -0
- package/common/src/functions/utils/sponsored-shield.utils.mjs +3 -0
- package/common/src/functions/utils/temp-wallet.utils.cjs +1 -0
- package/common/src/functions/utils/temp-wallet.utils.d.ts +8 -0
- package/common/src/functions/utils/temp-wallet.utils.mjs +43 -0
- package/common/src/functions/utils/temporary-wallet-recovery.utils.cjs +1 -0
- package/common/src/functions/utils/temporary-wallet-recovery.utils.d.ts +7 -0
- package/common/src/functions/utils/temporary-wallet-recovery.utils.mjs +10 -0
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.d.ts +1 -2
- package/common/src/functions/utils/transfer-claimable.utils.mjs +1 -4
- 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 +89 -152
- package/common/src/functions/utils/tronSimulation.utils.cjs +1 -1
- package/common/src/functions/utils/tronSimulation.utils.mjs +4 -6
- package/common/src/functions/utils/tx-confirmation.utils.cjs +1 -1
- package/common/src/functions/utils/tx-confirmation.utils.d.ts +1 -0
- package/common/src/functions/utils/tx-confirmation.utils.mjs +16 -13
- 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/connectors.utils.d.ts +1 -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 +42 -35
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.d.ts +4 -4
- package/common/src/functions/web3/events/getShieldedBalance.mjs +109 -93
- 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 +8 -13
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +12 -8
- package/common/src/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.d.ts +1 -2
- package/common/src/functions/web3/getPublicAddressBalance.mjs +6 -5
- 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 +1 -4
- package/common/src/functions/web3/index.mjs +1 -4
- package/common/src/functions/web3/lifiAPI.cjs +1 -1
- package/common/src/functions/web3/lifiAPI.mjs +38 -7
- 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 +1 -5
- package/common/src/providers/SolanaProviderAdapter.mjs +4 -11
- 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 +32 -39
- 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 +4 -1
- package/common/src/types/admin.types.mjs +1 -1
- package/common/src/types/bridging-tx.types.d.ts +26 -3
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +4 -3
- 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 +77 -0
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +13 -29
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/events.types.d.ts +1 -0
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +4 -7
- 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 +6 -5
- package/common/src/types/index.mjs +3 -2
- package/common/src/types/near-intents.types.d.ts +2 -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 +24 -4
- 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 +5 -6
- package/common/src/types/remote-tx-build.types.d.ts +298 -0
- package/common/src/types/scheduled-transactions.types.d.ts +25 -12
- package/common/src/types/snark.types.d.ts +1 -3
- package/common/src/types/solana-transact.types.cjs +1 -0
- package/common/src/types/solana-transact.types.d.ts +35 -0
- package/common/src/types/solana-transact.types.mjs +6 -0
- package/common/src/types/solana.types.cjs +1 -0
- package/common/src/types/solana.types.d.ts +12 -3
- package/common/src/types/solana.types.mjs +6 -0
- package/common/src/types/temp-wallet.types.d.ts +9 -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.d.ts +10 -0
- package/common/src/types/token.types.mjs +2 -2
- 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-ScFy7p5w.js +2 -0
- package/common/src/webworker/package.json +26 -25
- 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/utxoWorker.types.d.ts +4 -2
- 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-B_eSl85g.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 +26 -25
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.d.ts +1 -0
- package/providers/prepareEthersHinkal.mjs +2 -2
- package/providers/prepareSolanaHinkal.cjs +1 -1
- package/providers/prepareSolanaHinkal.d.ts +1 -0
- package/providers/prepareSolanaHinkal.mjs +2 -2
- package/providers/prepareTronHinkal.cjs +1 -1
- package/providers/prepareTronHinkal.d.ts +1 -0
- package/providers/prepareTronHinkal.mjs +2 -2
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.d.ts +1 -0
- package/providers/prepareWagmiHinkal.mjs +2 -2
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +16 -10
- package/services/Hinkal.mjs +29 -17
- package/types/IHinkal.d.ts +16 -10
- 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/deposit-and-withdraw-status-calls.cjs +0 -1
- package/common/src/API/deposit-and-withdraw-status-calls.d.ts +0 -21
- package/common/src/API/deposit-and-withdraw-status-calls.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/getAnyRecipientInfo.d.ts +0 -1
- 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/crypto/ecdh-dual-path.cjs +0 -1
- package/common/src/crypto/ecdh-dual-path.d.ts +0 -13
- package/common/src/crypto/ecdh-dual-path.mjs +0 -6
- 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/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +0 -172
- 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 -134
- package/common/src/data-structures/TokenDBs/PublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/PublicTokensDB.mjs +0 -32
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +0 -41
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +0 -1
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +0 -47
- package/common/src/data-structures/TokenDBs/index.cjs +0 -1
- package/common/src/data-structures/TokenDBs/index.mjs +0 -6
- 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/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +0 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +0 -29
- 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/utils/ipfs.cjs +0 -1
- package/common/src/functions/utils/ipfs.mjs +0 -1
- package/common/src/functions/utils/reloadPage.cjs +0 -1
- package/common/src/functions/utils/reloadPage.mjs +0 -4
- package/common/src/functions/web3/getSolanaPriorityFee.cjs +0 -1
- package/common/src/functions/web3/getSolanaPriorityFee.d.ts +0 -3
- package/common/src/functions/web3/getSolanaPriorityFee.mjs +0 -26
- 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/scheduled-transactions.types.cjs +0 -1
- package/common/src/types/scheduled-transactions.types.mjs +0 -6
- package/common/src/types/token-with-id.types.d.ts +0 -4
- package/common/src/webworker/logError-CZYZ3oyV.js +0 -2
- package/common/src/webworker/workerProxy-DPeuP2Mg.js +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as e } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { TRON_DEFAULT_FEE_LIMIT_SUN as t, zeroAddress as n } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { caseInsensitiveEqual as r } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
|
-
import { insufficientResourcesErrorCodes as i } from "../../error-handling/error-codes.constants.mjs";
|
|
5
|
-
import { ContractType as a } from "../../types/ethereum-network.types.mjs";
|
|
6
|
-
import { Logger as o } from "../../error-handling/logger.mjs";
|
|
7
|
-
import { createTronCallData as s, estimateTronFeeSunWithPadding as c, evmHexToTronBase58Address as l } from "../../functions/utils/tron.utils.mjs";
|
|
8
|
-
import { constructAdminData as u } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
9
|
-
import { simulateTronTransaction as d } from "../../functions/utils/tronSimulation.utils.mjs";
|
|
10
|
-
import { buildApproveAndDepositWrapperCalls as f } from "../../functions/web3/functionCalls/constructBatchCall.mjs";
|
|
11
|
-
import { waitForErc20Approvals as p, waitForTronErc20Approvals as m } from "../../functions/web3/functionCalls/waitForErc20Approvals.mjs";
|
|
12
|
-
import { emitTxPublicData as h } from "../../API/admin-calls.mjs";
|
|
13
|
-
import { aggregateAmountsForApproval as g, approveTokens as _, approveTronTokens as v, assertNoDuplicateStealthAddressStructures as y } from "./hinkalProoflessDeposit.utils.mjs";
|
|
14
|
-
//#region libs/shared/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.ts
|
|
15
|
-
var b = (e, t, i, a) => {
|
|
16
|
-
let o = r(e, n), s = i.reduce((e, t, i) => r(t.erc20TokenAddress, n) ? e + a[i] : e, 0n) + (o ? t : 0n), c = g(i, a), l = c.filter(({ token: e }) => !r(e.erc20TokenAddress, n)).map((n) => !o && r(n.token.erc20TokenAddress, e) ? {
|
|
17
|
-
token: n.token,
|
|
18
|
-
balance: n.balance + t
|
|
19
|
-
} : n).filter(({ balance: e }) => e > 0n);
|
|
20
|
-
return !o && t > 0n && (c.some(({ token: t }) => r(t.erc20TokenAddress, e)) || l.push({
|
|
21
|
-
token: {
|
|
22
|
-
erc20TokenAddress: e,
|
|
23
|
-
chainId: i[0]?.chainId
|
|
24
|
-
},
|
|
25
|
-
balance: t
|
|
26
|
-
})), {
|
|
27
|
-
tokensForApproval: l,
|
|
28
|
-
ethValue: s
|
|
29
|
-
};
|
|
30
|
-
}, x = (e, t, n, r) => {
|
|
31
|
-
if (t.length !== n.length || n.length !== r.length) throw Error(`${e}: array length mismatch`);
|
|
32
|
-
}, S = async (a, f, p, g, _, S, C, w) => {
|
|
33
|
-
x("hinkalTronProoflessDepositViaWrapper", _, S, C), y(C);
|
|
34
|
-
let { hinkalWrapperAddress: T, hinkalWrapperABI: E } = e[f]?.contractData ?? {};
|
|
35
|
-
if (!T || !E) throw Error(`No HinkalWrapper configured for chainId ${f}`);
|
|
36
|
-
let D = await a.getRandomRelay(f, !1);
|
|
37
|
-
if (!D) throw Error(`No relay available for chainId ${f}`);
|
|
38
|
-
let O = a.getTronWeb(), k = await a.getEthereumAddressByChain(f), A = l(T), j = r(p, n) ? p : l(p), { tokensForApproval: M, ethValue: N } = b(p, g, _, S), P = _.map((e) => e.erc20TokenAddress), F = S.map(() => "0"), I = C.map((e) => [
|
|
39
|
-
e.extraRandomization.toString(),
|
|
40
|
-
e.stealthAddress.toString(),
|
|
41
|
-
e.H0.toString(),
|
|
42
|
-
e.H1.toString()
|
|
43
|
-
]);
|
|
44
|
-
if (N > 0n) {
|
|
45
|
-
let e = BigInt(await O.trx.getBalance(k)), n = BigInt(t);
|
|
46
|
-
try {
|
|
47
|
-
n = await c(O, f, A, k, s(E, "prooflessDeposit", [
|
|
48
|
-
l(D),
|
|
49
|
-
j,
|
|
50
|
-
g.toString(),
|
|
51
|
-
P,
|
|
52
|
-
S.map(String),
|
|
53
|
-
F,
|
|
54
|
-
I
|
|
55
|
-
]), N);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
o.error("Error estimating Tron wrapper deposit fee", e);
|
|
58
|
-
}
|
|
59
|
-
if (e < N + n) throw Error(i.INSUFFICIENT_TRON_BALANCE_FOR_FEE);
|
|
60
|
-
}
|
|
61
|
-
let { transaction: L } = await O.transactionBuilder.triggerSmartContract(A, "prooflessDeposit(address,address,uint256,address[],uint256[],uint256[],(uint256,uint256,uint256,uint256)[])", {
|
|
62
|
-
feeLimit: t,
|
|
63
|
-
callValue: N > 0n ? Number(N) : 0
|
|
64
|
-
}, [
|
|
65
|
-
{
|
|
66
|
-
type: "address",
|
|
67
|
-
value: l(D)
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "address",
|
|
71
|
-
value: j
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: "uint256",
|
|
75
|
-
value: g.toString()
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: "address[]",
|
|
79
|
-
value: P
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: "uint256[]",
|
|
83
|
-
value: S.map(String)
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: "uint256[]",
|
|
87
|
-
value: F
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: "tuple(uint256,uint256,uint256,uint256)[]",
|
|
91
|
-
value: I
|
|
92
|
-
}
|
|
93
|
-
], k), R = new Map(M.map(({ token: e, balance: t }) => [l(e.erc20TokenAddress), t]));
|
|
94
|
-
await v(O, k, A, R), R.size > 0 && await m(O, k, A, Array.from(R.entries()).map(([e, t]) => ({
|
|
95
|
-
tokenAddress: e,
|
|
96
|
-
requiredAmount: t
|
|
97
|
-
}))), await d(f, A, "prooflessDeposit", E, [
|
|
98
|
-
l(D),
|
|
99
|
-
j,
|
|
100
|
-
g.toString(),
|
|
101
|
-
P,
|
|
102
|
-
S.map(String),
|
|
103
|
-
F,
|
|
104
|
-
I
|
|
105
|
-
], k, N > 0n ? N : void 0);
|
|
106
|
-
let z = await O.trx.sign(L), B = await O.trx.sendRawTransaction(z);
|
|
107
|
-
if (!B.result) throw Error("Tron wrapper deposit failed");
|
|
108
|
-
let V = typeof B == "string" ? B : B?.txid ?? B?.transaction?.txID;
|
|
109
|
-
if (!V) throw Error("Tron wrapper deposit failed (missing txid)");
|
|
110
|
-
return h(u(w, f, P, S, k)), V;
|
|
111
|
-
}, C = async (t, n, r, i, o, s, c, l) => {
|
|
112
|
-
x("hinkalEvmProoflessDepositViaWrapper", o, s, c), y(c);
|
|
113
|
-
let d = e[n]?.contractData?.hinkalWrapperAddress;
|
|
114
|
-
if (!d) throw Error(`No HinkalWrapper configured for chainId ${n}`);
|
|
115
|
-
let m = await t.getRandomRelay(n, !1);
|
|
116
|
-
if (!m) throw Error(`No relay available for chainId ${n}`);
|
|
117
|
-
let g = o.map((e) => e.erc20TokenAddress), v = s.map(() => 0n), { tokensForApproval: S, ethValue: C } = b(r, i, o, s), w = await t.getEthereumAddressByChain(n), T = t.getProviderAdapter(n), E = t.getContractWithSigner(n, a.HinkalWrapper), D;
|
|
118
|
-
if (S.length > 0 && await T.supportsBatchCall?.(n) && T.sendBatchCallsTransaction) {
|
|
119
|
-
let e = f(S.map(({ token: e }) => e.erc20TokenAddress), S.map(({ balance: e }) => e), d, E.interface, m, r, i, g, s, v, c, C);
|
|
120
|
-
D = await T.sendBatchCallsTransaction(n, e);
|
|
121
|
-
} else await _(t, n, d, S), await p(t, n, w, d, S.map(({ token: e, balance: t }) => ({
|
|
122
|
-
tokenAddress: e.erc20TokenAddress,
|
|
123
|
-
requiredAmount: t
|
|
124
|
-
}))), D = await E.prooflessDeposit(m, r, i, g, s, v, c, { value: C > 0n ? C : void 0 });
|
|
125
|
-
return h(u(l, n, g, s, w)), D.hash;
|
|
126
|
-
};
|
|
127
|
-
//#endregion
|
|
128
|
-
export { C as hinkalEvmProoflessDepositViaWrapper, S as hinkalTronProoflessDepositViaWrapper };
|
|
@@ -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/hinkal.types.cjs`),r=require(`../../types/external-action.types.cjs`),i=require(`../../functions/web3/events/getShieldedBalance.cjs`),a=require(`../../functions/pre-transaction/outputUtxoProcessing.cjs`),o=require(`../../functions/utils/fees.utils.cjs`),s=require(`../../functions/snarkjs/constructGeneralZkProof.cjs`);let c=require(`ethers`);var l=async(l,u,d,f,p,m={})=>{let h=d.erc20TokenAddress,g=f.map(e=>e+o.calculateTotalFee(e,p)),_=g.reduce((e,t)=>e+t,0n),v=[h],y=[0n],b=[!0],x=c.ethers.AbiCoder.defaultAbiCoder().encode([`uint256[]`],[g]),{hinkalWrapperAddress:S,hinkalWrapperABI:C,depositOnChainUtxosExternalActionAddress:w,depositOnChainUtxosExternalActionABI:T}=e.networkRegistry[u].contractData;if(!S||!C||!w||!T)throw Error(`contract data not set in networkRegistry`);let E=[...await i.addPaddingToUtxos(l,u,v,y,2,void 0,!0)],D=[];for(let e=0;e<E.length;e+=1){let{outputUtxos:t}=a.outputUtxoProcessing(l.userKeys,E[e],y[e]);D.push(t)}let{zkCallData:O,circomData:k,dimData:A}=await s.constructZkProof(l.merkleTreeHinkalByChain[u],E,D,l.userKeys,r.ExternalActionId.DepositOnChainUtxos,w,x,l.generateProofRemotely,n.zeroFeeStructure,t.zeroAddress,u,b,m.hookData,S);return{zkCallData:O,circomData:k,dimData:A,utxoAmounts:g,totalAmount:_,hinkalWrapperAddress:S,depositOnChainUtxosExternalActionAddress:w,hinkalWrapperABI:C,depositOnChainUtxosExternalActionABI:T,inputUtxosArray:E}};exports.prepareDepositOnChainUtxosZkProof=l;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { ERC20Token } from '../../types';
|
|
3
|
-
import { FeeStructure } from '../../types/hinkal.types';
|
|
4
|
-
import { HookDataType } from '../../types/circom-data.types';
|
|
5
|
-
import { Utxo } from '../utxo/Utxo';
|
|
6
|
-
import { IHinkal } from './IHinkal';
|
|
7
|
-
interface PrepareOptions {
|
|
8
|
-
hookData?: HookDataType;
|
|
9
|
-
}
|
|
10
|
-
export declare const prepareDepositOnChainUtxosZkProof: (hinkal: IHinkal, chainId: number, erc20Token: ERC20Token, recipientAmounts: bigint[], feeStructure: FeeStructure, options?: PrepareOptions) => Promise<{
|
|
11
|
-
zkCallData: import('../..').NewZkCallDataType;
|
|
12
|
-
circomData: import('../..').CircomDataType;
|
|
13
|
-
dimData: import('../..').DimDataType;
|
|
14
|
-
utxoAmounts: bigint[];
|
|
15
|
-
totalAmount: bigint;
|
|
16
|
-
hinkalWrapperAddress: string;
|
|
17
|
-
depositOnChainUtxosExternalActionAddress: string;
|
|
18
|
-
hinkalWrapperABI: ethers.InterfaceAbi;
|
|
19
|
-
depositOnChainUtxosExternalActionABI: ethers.InterfaceAbi;
|
|
20
|
-
inputUtxosArray: Utxo[][];
|
|
21
|
-
}>;
|
|
22
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as e } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { zeroAddress as t } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { zeroFeeStructure as n } from "../../types/hinkal.types.mjs";
|
|
4
|
-
import { ExternalActionId as r } from "../../types/external-action.types.mjs";
|
|
5
|
-
import { addPaddingToUtxos as i } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
6
|
-
import { outputUtxoProcessing as a } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
7
|
-
import { calculateTotalFee as o } from "../../functions/utils/fees.utils.mjs";
|
|
8
|
-
import { constructZkProof as s } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
9
|
-
import { ethers as c } from "ethers";
|
|
10
|
-
//#region libs/shared/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.ts
|
|
11
|
-
var l = async (l, u, d, f, p, m = {}) => {
|
|
12
|
-
let h = d.erc20TokenAddress, g = f.map((e) => e + o(e, p)), _ = g.reduce((e, t) => e + t, 0n), v = [h], y = [0n], b = [!0], x = c.AbiCoder.defaultAbiCoder().encode(["uint256[]"], [g]), { hinkalWrapperAddress: S, hinkalWrapperABI: C, depositOnChainUtxosExternalActionAddress: w, depositOnChainUtxosExternalActionABI: T } = e[u].contractData;
|
|
13
|
-
if (!S || !C || !w || !T) throw Error("contract data not set in networkRegistry");
|
|
14
|
-
let E = [...await i(l, u, v, y, 2, void 0, !0)], D = [];
|
|
15
|
-
for (let e = 0; e < E.length; e += 1) {
|
|
16
|
-
let { outputUtxos: t } = a(l.userKeys, E[e], y[e]);
|
|
17
|
-
D.push(t);
|
|
18
|
-
}
|
|
19
|
-
let { zkCallData: O, circomData: k, dimData: A } = await s(l.merkleTreeHinkalByChain[u], E, D, l.userKeys, r.DepositOnChainUtxos, w, x, l.generateProofRemotely, n, t, u, b, m.hookData, S);
|
|
20
|
-
return {
|
|
21
|
-
zkCallData: O,
|
|
22
|
-
circomData: k,
|
|
23
|
-
dimData: A,
|
|
24
|
-
utxoAmounts: g,
|
|
25
|
-
totalAmount: _,
|
|
26
|
-
hinkalWrapperAddress: S,
|
|
27
|
-
depositOnChainUtxosExternalActionAddress: w,
|
|
28
|
-
hinkalWrapperABI: C,
|
|
29
|
-
depositOnChainUtxosExternalActionABI: T,
|
|
30
|
-
inputUtxosArray: E
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
//#endregion
|
|
34
|
-
export { l as prepareDepositOnChainUtxosZkProof };
|
|
@@ -1 +0,0 @@
|
|
|
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(`../../types/cache.types.cjs`),i=require(`../http/HttpClient.cjs`);require(`../http/index.cjs`);const a=require(`../../error-handling/logger.cjs`),o=require(`../../API/API.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.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)(r.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 i=s.getStateKey(e,t),[a,l]=await Promise.all([this.getSolanaTokenAddresses(t,e),this.getNFTAddresses(t,e)]),u=Array.from(new Set([...a,...l]));if(!u.length)return;let d=(await o.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)(r.StorageKeys.ALCHEMY_PUBLIC_TOKENS,(e={})=>{let t={...e,[i]: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,i){let a=s.getStateKey(e,i),l=await this.getEVMTokenAddresses(i,e),u=await this.getNFTTokens(i,e),d=u.map(e=>e.contractAddress),f=[...l,...d];if(!f.length)return;let m=(await o.API.tokensInfoCall(i,f)).map((e,r)=>{if(e)return e;let a=f[r],o=u.find(e=>n.caseInsensitiveEqual(e.contractAddress,a));return o&&o.tokenIds&&o.tokenIds.length>0&&this.isWhitelistedNFT(a,i)?{chainId:i,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(i,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)(r.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:o}=e.networkRegistry[n];if(!o)throw Error(`RPC URL not found for the specified chain ID`);try{let e=[],n=1;do{let{items:a=[],page:s}=(await i.httpClient.post(o,{jsonrpc:`2.0`,id:1,method:`getAssetsByOwner`,params:{ownerAddress:r,page:n,limit:1e3,displayOptions:{showFungible:!1,showCollectionMetadata:!0}}})).result||{},c=a.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 a.Logger.error(`Failed to fetch NFTs from DAS API`,e),[]}}async getEVMTokenAddresses(n,r){let a=await d.getPublicBalanceByTokenAddress(n,r,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=[r,`erc20`];l&&e.push({pageKey:l});let{result:t}=await i.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 r=`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 i.httpClient.get(`${r}?${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,172 +0,0 @@
|
|
|
1
|
-
import { ALCHEMY_API_KEY as e, chainIds as t, isSolanaLike as n, networkRegistry as r } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { SOLANA_NFT_INTERFACES as i, TokenType as a, solanaNativeAddress as o, zeroAddress as s } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { caseInsensitiveEqual as c, lowerCaseIncludes as l } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
|
-
import { StorageKeys as u } from "../../types/cache.types.mjs";
|
|
5
|
-
import { httpClient as d } from "../http/HttpClient.mjs";
|
|
6
|
-
import "../http/index.mjs";
|
|
7
|
-
import { Logger as f } from "../../error-handling/logger.mjs";
|
|
8
|
-
import { API as p } from "../../API/API.mjs";
|
|
9
|
-
import { getStateKey as m } from "../../functions/utils/string.utils.mjs";
|
|
10
|
-
import { tokenVisibilityStorage as h } from "./token-visibility-db.mjs";
|
|
11
|
-
import { overlayTokensWithRegistryData as g } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
12
|
-
import { createCustomSolanaConnection as _ } from "../../functions/utils/create-provider.mjs";
|
|
13
|
-
import { getPublicBalanceByTokenAddress as v } from "../../functions/utils/publicBalance.utils.mjs";
|
|
14
|
-
import { PublicKey as y } from "@solana/web3.js";
|
|
15
|
-
import { get as b, update as x } from "idb-keyval";
|
|
16
|
-
import { TOKEN_2022_PROGRAM_ID as S, TOKEN_PROGRAM_ID as C } from "@solana/spl-token";
|
|
17
|
-
var w = new class {
|
|
18
|
-
fetchedTokens = {};
|
|
19
|
-
ALCHEMY_URLS = {
|
|
20
|
-
[t.ethMainnet]: "eth-mainnet",
|
|
21
|
-
[t.polygon]: "polygon-mainnet",
|
|
22
|
-
[t.arbMainnet]: "arb-mainnet",
|
|
23
|
-
[t.optimism]: "opt-mainnet",
|
|
24
|
-
[t.optimismTest]: "opt-mainnet",
|
|
25
|
-
[t.base]: "base-mainnet",
|
|
26
|
-
[t.solanaMainnet]: "solana-mainnet",
|
|
27
|
-
[t.sepoliaTestnet]: "eth-sepolia"
|
|
28
|
-
};
|
|
29
|
-
KNOWN_GOOD_NFTS = {
|
|
30
|
-
[t.base]: ["0x20bc8d248fe9c18a947406cea50d716828ab821f"],
|
|
31
|
-
[t.optimism]: ["0x3c3e0e73b53a19bcaf4178b8f9c9428fd2a2775e"]
|
|
32
|
-
};
|
|
33
|
-
isWhitelistedNFT(e, t) {
|
|
34
|
-
return this.KNOWN_GOOD_NFTS[t] ? this.KNOWN_GOOD_NFTS[t].some((t) => c(e, t)) : !1;
|
|
35
|
-
}
|
|
36
|
-
async getPublicTokens(e, t) {
|
|
37
|
-
let n = m(t, e);
|
|
38
|
-
return g((await b(u.ALCHEMY_PUBLIC_TOKENS))?.[n] || [], e);
|
|
39
|
-
}
|
|
40
|
-
async getFetchedTokens(e, t) {
|
|
41
|
-
let n = m(t, e);
|
|
42
|
-
return g(this.fetchedTokens[n] || [], e);
|
|
43
|
-
}
|
|
44
|
-
fetchAndUpdatePublicTokens(e, t) {
|
|
45
|
-
return n(t) ? this.fetchAndUpdateSolanaTokens(e, t) : this.fetchAndUpdateEVMTokens(e, t);
|
|
46
|
-
}
|
|
47
|
-
async fetchAndUpdateSolanaTokens(e, t) {
|
|
48
|
-
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
|
-
if (!a.length) return;
|
|
50
|
-
let o = (await p.tokensInfoCall(t, a)).filter((e) => !!e), s = await h.hideSpamsAndFetchHiddenTokensAddresses(t, o), c = o.filter((e) => !l(s, e.erc20TokenAddress));
|
|
51
|
-
await x(u.ALCHEMY_PUBLIC_TOKENS, (e = {}) => {
|
|
52
|
-
let t = {
|
|
53
|
-
...e,
|
|
54
|
-
[n]: c
|
|
55
|
-
};
|
|
56
|
-
return this.fetchedTokens = t, t;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async getWalletTokenAddresses(e, t) {
|
|
60
|
-
return n(e) ? this.getSolanaTokenAddresses(e, t) : this.getEVMTokenAddresses(e, t);
|
|
61
|
-
}
|
|
62
|
-
async fetchAndUpdateEVMTokens(e, t) {
|
|
63
|
-
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
|
-
if (!s.length) return;
|
|
65
|
-
let d = (await p.tokensInfoCall(t, s)).map((e, n) => {
|
|
66
|
-
if (e) return e;
|
|
67
|
-
let r = s[n], o = i.find((e) => c(e.contractAddress, r));
|
|
68
|
-
return o && o.tokenIds && o.tokenIds.length > 0 && this.isWhitelistedNFT(r, t) ? {
|
|
69
|
-
chainId: t,
|
|
70
|
-
name: "Unknown NFT",
|
|
71
|
-
symbol: "NFT",
|
|
72
|
-
erc20TokenAddress: r,
|
|
73
|
-
decimals: 0,
|
|
74
|
-
nftTokenType: a.ERC721,
|
|
75
|
-
tokenIds: o.tokenIds
|
|
76
|
-
} : null;
|
|
77
|
-
}).filter((e) => !!e), f = await h.hideSpamsAndFetchHiddenTokensAddresses(t, d), g = d.filter((e) => !l(f, e.erc20TokenAddress)).map((e) => ({
|
|
78
|
-
...e,
|
|
79
|
-
tokenIds: i.find((t) => c(t.contractAddress, e.erc20TokenAddress))?.tokenIds
|
|
80
|
-
}));
|
|
81
|
-
await x(u.ALCHEMY_PUBLIC_TOKENS, (e = {}) => {
|
|
82
|
-
let t = {
|
|
83
|
-
...e,
|
|
84
|
-
[n]: g
|
|
85
|
-
};
|
|
86
|
-
return this.fetchedTokens = t, t;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
async getSolanaTokenAddresses(e, t) {
|
|
90
|
-
let { fetchRpcUrl: n } = r[e];
|
|
91
|
-
if (!n) throw Error("RPC URL not found for the specified chain ID");
|
|
92
|
-
let i = _(n), a = await i.getBalance(new y(t)), [s, c] = await Promise.all([i.getParsedTokenAccountsByOwner(new y(t), { programId: C }), i.getParsedTokenAccountsByOwner(new y(t), { programId: S })]), l = [...s.value, ...c.value].filter((e) => {
|
|
93
|
-
let { amount: t } = e.account.data.parsed.info.tokenAmount;
|
|
94
|
-
return BigInt(t) > 0n;
|
|
95
|
-
}).map((e) => e.account.data.parsed.info.mint);
|
|
96
|
-
return a > 0 && l.unshift(o), Array.from(new Set(l));
|
|
97
|
-
}
|
|
98
|
-
async getNFTAddresses(e, t) {
|
|
99
|
-
let { fetchRpcUrl: n } = r[e];
|
|
100
|
-
if (!n) throw Error("RPC URL not found for the specified chain ID");
|
|
101
|
-
try {
|
|
102
|
-
let e = [], r = 1;
|
|
103
|
-
do {
|
|
104
|
-
let { items: a = [], page: o } = (await d.post(n, {
|
|
105
|
-
jsonrpc: "2.0",
|
|
106
|
-
id: 1,
|
|
107
|
-
method: "getAssetsByOwner",
|
|
108
|
-
params: {
|
|
109
|
-
ownerAddress: t,
|
|
110
|
-
page: r,
|
|
111
|
-
limit: 1e3,
|
|
112
|
-
displayOptions: {
|
|
113
|
-
showFungible: !1,
|
|
114
|
-
showCollectionMetadata: !0
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
})).result || {}, s = a.filter((e) => e.interface && i.includes(e.interface)).map((e) => e.id);
|
|
118
|
-
e.push(...s), r = o && o > r ? o : 0;
|
|
119
|
-
} while (r > 0);
|
|
120
|
-
return e;
|
|
121
|
-
} catch (e) {
|
|
122
|
-
return f.error("Failed to fetch NFTs from DAS API", e), [];
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async getEVMTokenAddresses(t, n) {
|
|
126
|
-
let r = await v(t, n, s), i = this.ALCHEMY_URLS[t];
|
|
127
|
-
if (!i) throw Error(`Alchemy URL not found for the specified chain ID: ${t}`);
|
|
128
|
-
let a = `https://${i}.g.alchemy.com/v2/${e}`, o = [], c;
|
|
129
|
-
do {
|
|
130
|
-
let e = [n, "erc20"];
|
|
131
|
-
c && e.push({ pageKey: c });
|
|
132
|
-
let { result: t } = await d.post(a, {
|
|
133
|
-
jsonrpc: "2.0",
|
|
134
|
-
id: 1,
|
|
135
|
-
method: "alchemy_getTokenBalances",
|
|
136
|
-
params: e
|
|
137
|
-
});
|
|
138
|
-
o.push(...t?.tokenBalances ?? []), c = t?.pageKey;
|
|
139
|
-
} while (c);
|
|
140
|
-
r && r > 0n && o.push({
|
|
141
|
-
contractAddress: s,
|
|
142
|
-
tokenBalance: r.toString()
|
|
143
|
-
});
|
|
144
|
-
let l = {};
|
|
145
|
-
return o.forEach((e) => {
|
|
146
|
-
(!l[e.contractAddress] || BigInt(e.tokenBalance) > 0n) && (l[e.contractAddress] = e);
|
|
147
|
-
}), Object.keys(l);
|
|
148
|
-
}
|
|
149
|
-
async getNFTTokens(t, n) {
|
|
150
|
-
let r = `https://${this.ALCHEMY_URLS[t]}.g.alchemy.com/nft/v3/${e}/getNFTsForOwner`, i = [], a;
|
|
151
|
-
do {
|
|
152
|
-
let e = new URLSearchParams({
|
|
153
|
-
owner: n,
|
|
154
|
-
withMetadata: "false",
|
|
155
|
-
pageSize: "100"
|
|
156
|
-
});
|
|
157
|
-
a && e.append("pageKey", a);
|
|
158
|
-
let { ownedNfts: t = [], pageKey: o } = await d.get(`${r}?${e.toString()}`);
|
|
159
|
-
i.push(...t), a = o;
|
|
160
|
-
} while (a);
|
|
161
|
-
let o = i.filter(({ contractAddress: e, tokenId: t }) => e && t).reduce((e, { contractAddress: t, tokenId: n }) => {
|
|
162
|
-
let r = t.toLowerCase();
|
|
163
|
-
return e.has(r) || e.set(r, []), e.get(r)?.push(n), e;
|
|
164
|
-
}, /* @__PURE__ */ new Map());
|
|
165
|
-
return Array.from(o.entries()).map(([e, t]) => ({
|
|
166
|
-
contractAddress: e,
|
|
167
|
-
tokenIds: t
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
}();
|
|
171
|
-
//#endregion
|
|
172
|
-
export { w as alchemyPublicTokensDB };
|
|
@@ -1 +0,0 @@
|
|
|
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(`../../error-handling/logger.cjs`),s=require(`../../API/API.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),o=await this.getERC20TokenAddresses(e),u=await this.getNFTTokens(e),f=u.map(e=>e.contractAddress),p=[...o,...f];if(!p.length)return;let m=(await s.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){o.Logger.error(`Error fetching ARC testnet token balance:`,e)}}}catch(e){o.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;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { chainIds as e } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { TokenType as t } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { caseInsensitiveEqual as n, lowerCaseIncludes as r } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
|
-
import { ContractType as i } from "../../types/ethereum-network.types.mjs";
|
|
5
|
-
import { StorageKeys as a } from "../../types/cache.types.mjs";
|
|
6
|
-
import { Logger as o } from "../../error-handling/logger.mjs";
|
|
7
|
-
import { API as s } from "../../API/API.mjs";
|
|
8
|
-
import { getStateKey as c } from "../../functions/utils/string.utils.mjs";
|
|
9
|
-
import { tokenVisibilityStorage as l } from "./token-visibility-db.mjs";
|
|
10
|
-
import { getContractWithFetcherByChainId as u } from "../../functions/web3/getContractMetadata.mjs";
|
|
11
|
-
import { get as d, update as f } from "idb-keyval";
|
|
12
|
-
import p from "axios";
|
|
13
|
-
//#region libs/shared/common/src/data-structures/TokenDBs/ArcPublicTokensDB.ts
|
|
14
|
-
var m = class {
|
|
15
|
-
API_BASE = "https://testnet.arcscan.app/api";
|
|
16
|
-
fetchedTokens = {};
|
|
17
|
-
async getPublicTokens(t) {
|
|
18
|
-
let n = c(t, e.arcTestnet);
|
|
19
|
-
return (await d(a.ARC_PUBLIC_TOKENS))?.[n] || [];
|
|
20
|
-
}
|
|
21
|
-
getFetchedTokens(t) {
|
|
22
|
-
let n = c(t, e.arcTestnet);
|
|
23
|
-
return this.fetchedTokens[n] || [];
|
|
24
|
-
}
|
|
25
|
-
async fetchAndUpdatePublicTokens(i) {
|
|
26
|
-
let o = c(i, e.arcTestnet), u = await this.getERC20TokenAddresses(i), d = await this.getNFTTokens(i), p = d.map((e) => e.contractAddress), m = [...u, ...p];
|
|
27
|
-
if (!m.length) return;
|
|
28
|
-
let h = (await s.tokensInfoCall(e.arcTestnet, m)).map((r, i) => {
|
|
29
|
-
if (r) return r;
|
|
30
|
-
let a = m[i], o = d.find((e) => n(e.contractAddress, a));
|
|
31
|
-
return o && o.tokenIds && o.tokenIds.length > 0 ? {
|
|
32
|
-
chainId: e.arcTestnet,
|
|
33
|
-
name: "Unknown NFT",
|
|
34
|
-
symbol: "NFT",
|
|
35
|
-
erc20TokenAddress: a,
|
|
36
|
-
decimals: 0,
|
|
37
|
-
nftTokenType: t.ERC721,
|
|
38
|
-
tokenIds: o.tokenIds
|
|
39
|
-
} : null;
|
|
40
|
-
}).filter((e) => !!e), g = await l.hideSpamsAndFetchHiddenTokensAddresses(e.arcTestnet, h), _ = h.filter((e) => !r(g, e.erc20TokenAddress)).map((e) => ({
|
|
41
|
-
...e,
|
|
42
|
-
tokenIds: d.find((t) => n(t.contractAddress, e.erc20TokenAddress))?.tokenIds
|
|
43
|
-
}));
|
|
44
|
-
await f(a.ARC_PUBLIC_TOKENS, (e = {}) => {
|
|
45
|
-
let t = {
|
|
46
|
-
...e,
|
|
47
|
-
[o]: _
|
|
48
|
-
};
|
|
49
|
-
return this.fetchedTokens = t, t;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
async getERC20TokenAddresses(t) {
|
|
53
|
-
let n = [];
|
|
54
|
-
try {
|
|
55
|
-
let r = (await p.post(`${this.API_BASE}?module=account&action=tokentx&address=${t}`)).data;
|
|
56
|
-
if (r.status === "1" && r.result) {
|
|
57
|
-
let a = [...new Set(r.result.map(({ contractAddress: e }) => e))];
|
|
58
|
-
for (let r of a) try {
|
|
59
|
-
let a = u(e.arcTestnet, i.ERC20Contract, r), o = BigInt(await a.balanceOf(t));
|
|
60
|
-
o > 0n && n.push({
|
|
61
|
-
contractAddress: r,
|
|
62
|
-
tokenBalance: o.toString()
|
|
63
|
-
});
|
|
64
|
-
} catch (e) {
|
|
65
|
-
o.error("Error fetching ARC testnet token balance:", e);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
} catch (e) {
|
|
69
|
-
o.error("Error fetching ARC testnet token transactions:", e);
|
|
70
|
-
}
|
|
71
|
-
return n.filter(({ tokenBalance: e }) => Number(e) !== 0).map(({ contractAddress: e }) => e);
|
|
72
|
-
}
|
|
73
|
-
async getNFTTokens(e) {
|
|
74
|
-
let t = `${this.API_BASE}/v2/addresses/${e}/nft?type=ERC-721,ERC-1155`, n = [], r;
|
|
75
|
-
do {
|
|
76
|
-
let e = r ? `&${new URLSearchParams(r)}` : "", { data: i } = await p.get(`${t}${e}`), { items: a = [], next_page_params: o } = i;
|
|
77
|
-
n.push(...a), r = o ? {
|
|
78
|
-
token_contract_address_hash: o.token_contract_address_hash,
|
|
79
|
-
token_id: o.token_id,
|
|
80
|
-
token_type: o.token_type
|
|
81
|
-
} : void 0;
|
|
82
|
-
} while (r);
|
|
83
|
-
let i = n.reduce((e, t) => {
|
|
84
|
-
let n = t.token.address_hash.toLowerCase(), r = t.id;
|
|
85
|
-
return e.has(n) || e.set(n, []), e.get(n)?.push(r), e;
|
|
86
|
-
}, /* @__PURE__ */ new Map());
|
|
87
|
-
return Array.from(i.entries()).map(([e, t]) => ({
|
|
88
|
-
contractAddress: e,
|
|
89
|
-
tokenIds: t
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
}, h = new m();
|
|
93
|
-
//#endregion
|
|
94
|
-
export { m as ArcPublicTokensDB, h as arcPublicTokensDB };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../types/cache.types.cjs`),r=require(`../../error-handling/logger.cjs`),i=require(`../../functions/utils/tron.utils.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`),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 r=o.getStateKey(t,e);return c.overlayTokensWithRegistryData((await(0,f.get)(n.StorageKeys.EVENTS_PUBLIC_TOKENS))?.[r]||[],e)}async getFetchedTokens(e,t){let n=o.getStateKey(t,e);return c.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],e)}async fetchAndUpdatePublicTokens(e,i){let a=o.getStateKey(e,i);await this.getMutex(a).runExclusive(async()=>{try{let r=(await this.getPublicTokens(i,e)).map(e=>e.erc20TokenAddress),{toEvents:o,fromEvents:c,latestBlock:l}=await this.getEvents(e,i),u=[...o,...c],{erc20Tokens:d}=await this.fetchPublicTokens(u,i,r),p=await s.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(i,d),m=d.filter(e=>!t.lowerCaseIncludes(p,e.erc20TokenAddress));await(0,f.update)(n.StorageKeys.EVENTS_PUBLIC_TOKENS,(e={})=>{let n=e[a]||[],r=n.map(e=>e.erc20TokenAddress),i=m.filter(e=>!t.lowerCaseIncludes(r,e.erc20TokenAddress));n.push(...i);let s=this.updateTokenIds(c,o,n),l={...e,[a]:s};return this.fetchedTokens=l,l}),l&&await this.updateLastProcessedBlock(i,e,l)}catch(e){r.Logger.error(`public tokens db error`,e)}})}async getLastProcessedBlock(e,t){return(await(0,f.get)(n.StorageKeys.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS)||{})[o.getStateKey(t,e)]||u.EVENTS_INITIAL_BLOCKS[e]}async updateLastProcessedBlock(e,t,r){await(0,f.update)(n.StorageKeys.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS,(n={})=>{let i=o.getStateKey(t,e);return{...n,[i]:r}})}async getEvents(e,t){try{let n=l.createJsonRpcProvider(t),r=await this.getLastProcessedBlock(t,e)+1,a=await n.getBlockNumber(),o=i.addressToHexFormat(e),s=d.ethers.zeroPadValue(o,32),c=[],u=[];for(let e=r;e<=a;e+=this.chunkSize){let t=Math.min(e+this.chunkSize-1,a),r={topics:[this.transferEventTopic,null,s],fromBlock:e,toBlock:t},i={topics:[this.transferEventTopic,s,null],fromBlock:e,toBlock:t},[o,l]=await Promise.all([n.getLogs(r),n.getLogs(i)]);c.push(...o),u.push(...l)}return{toEvents:c,fromEvents:u,latestBlock:a}}catch(n){return r.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,i,o){try{let r=[e.zeroAddress,...new Set(n.map(e=>e.address))].filter(e=>e&&!t.lowerCaseIncludes(o,e));return r.length?{erc20Tokens:(await a.API.tokensInfoCall(i,r)).filter(e=>!!e)}:{erc20Tokens:[]}}catch(e){return r.Logger.error(`Error fetching public tokens:`,e),{erc20Tokens:[]}}}};exports.eventsPublicTokensDB=m;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { zeroAddress as e } from "../../constants/protocol.constants.mjs";
|
|
2
|
-
import { lowerCaseIncludes as t } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
3
|
-
import { StorageKeys as n } from "../../types/cache.types.mjs";
|
|
4
|
-
import { Logger as r } from "../../error-handling/logger.mjs";
|
|
5
|
-
import { addressToHexFormat as i } from "../../functions/utils/tron.utils.mjs";
|
|
6
|
-
import { API as a } from "../../API/API.mjs";
|
|
7
|
-
import { getStateKey as o } from "../../functions/utils/string.utils.mjs";
|
|
8
|
-
import { tokenVisibilityStorage as s } from "./token-visibility-db.mjs";
|
|
9
|
-
import { isNFTToken as c, overlayTokensWithRegistryData as l } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
10
|
-
import { createJsonRpcProvider as u } from "../../functions/utils/create-provider.mjs";
|
|
11
|
-
import { EVENTS_INITIAL_BLOCKS as d } from "../../constants/events.constants.mjs";
|
|
12
|
-
import "../../functions/index.mjs";
|
|
13
|
-
import { ethers as f } from "ethers";
|
|
14
|
-
import { get as p, update as m } from "idb-keyval";
|
|
15
|
-
import { Mutex as h } from "async-mutex";
|
|
16
|
-
var g = new class {
|
|
17
|
-
fetchedTokens = {};
|
|
18
|
-
updateMutexes = {};
|
|
19
|
-
transferEventTopic = f.id("Transfer(address,address,uint256)");
|
|
20
|
-
chunkSize = 2e3;
|
|
21
|
-
getMutex(e) {
|
|
22
|
-
return this.updateMutexes[e] || (this.updateMutexes[e] = new h()), this.updateMutexes[e];
|
|
23
|
-
}
|
|
24
|
-
async getPublicTokens(e, t) {
|
|
25
|
-
let r = o(t, e);
|
|
26
|
-
return l((await p(n.EVENTS_PUBLIC_TOKENS))?.[r] || [], e);
|
|
27
|
-
}
|
|
28
|
-
async getFetchedTokens(e, t) {
|
|
29
|
-
let n = o(t, e);
|
|
30
|
-
return l(this.fetchedTokens[n] || [], e);
|
|
31
|
-
}
|
|
32
|
-
async fetchAndUpdatePublicTokens(e, i) {
|
|
33
|
-
let a = o(e, i);
|
|
34
|
-
await this.getMutex(a).runExclusive(async () => {
|
|
35
|
-
try {
|
|
36
|
-
let r = (await this.getPublicTokens(i, e)).map((e) => e.erc20TokenAddress), { toEvents: o, fromEvents: c, latestBlock: l } = await this.getEvents(e, i), u = [...o, ...c], { erc20Tokens: d } = await this.fetchPublicTokens(u, i, r), f = await s.hideSpamsAndFetchHiddenTokensAddresses(i, d), p = d.filter((e) => !t(f, e.erc20TokenAddress));
|
|
37
|
-
await m(n.EVENTS_PUBLIC_TOKENS, (e = {}) => {
|
|
38
|
-
let n = e[a] || [], r = n.map((e) => e.erc20TokenAddress), i = p.filter((e) => !t(r, e.erc20TokenAddress));
|
|
39
|
-
n.push(...i);
|
|
40
|
-
let s = this.updateTokenIds(c, o, n), l = {
|
|
41
|
-
...e,
|
|
42
|
-
[a]: s
|
|
43
|
-
};
|
|
44
|
-
return this.fetchedTokens = l, l;
|
|
45
|
-
}), l && await this.updateLastProcessedBlock(i, e, l);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
r.error("public tokens db error", e);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
async getLastProcessedBlock(e, t) {
|
|
52
|
-
return (await p(n.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS) || {})[o(t, e)] || d[e];
|
|
53
|
-
}
|
|
54
|
-
async updateLastProcessedBlock(e, t, r) {
|
|
55
|
-
await m(n.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS, (n = {}) => {
|
|
56
|
-
let i = o(t, e);
|
|
57
|
-
return {
|
|
58
|
-
...n,
|
|
59
|
-
[i]: r
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async getEvents(e, t) {
|
|
64
|
-
try {
|
|
65
|
-
let n = u(t), r = await this.getLastProcessedBlock(t, e) + 1, a = await n.getBlockNumber(), o = i(e), s = f.zeroPadValue(o, 32), c = [], l = [];
|
|
66
|
-
for (let e = r; e <= a; e += this.chunkSize) {
|
|
67
|
-
let t = Math.min(e + this.chunkSize - 1, a), r = {
|
|
68
|
-
topics: [
|
|
69
|
-
this.transferEventTopic,
|
|
70
|
-
null,
|
|
71
|
-
s
|
|
72
|
-
],
|
|
73
|
-
fromBlock: e,
|
|
74
|
-
toBlock: t
|
|
75
|
-
}, i = {
|
|
76
|
-
topics: [
|
|
77
|
-
this.transferEventTopic,
|
|
78
|
-
s,
|
|
79
|
-
null
|
|
80
|
-
],
|
|
81
|
-
fromBlock: e,
|
|
82
|
-
toBlock: t
|
|
83
|
-
}, [o, u] = await Promise.all([n.getLogs(r), n.getLogs(i)]);
|
|
84
|
-
c.push(...o), l.push(...u);
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
toEvents: c,
|
|
88
|
-
fromEvents: l,
|
|
89
|
-
latestBlock: a
|
|
90
|
-
};
|
|
91
|
-
} catch (n) {
|
|
92
|
-
return r.error("Error fetching events:", n, "chainId", t, "walletAddress", e), {
|
|
93
|
-
toEvents: [],
|
|
94
|
-
fromEvents: [],
|
|
95
|
-
latestBlock: void 0
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
updateTokenIds(e, t, n) {
|
|
100
|
-
let r = /* @__PURE__ */ new Map();
|
|
101
|
-
return n.forEach((e) => {
|
|
102
|
-
if (c(e) && e.tokenIds) {
|
|
103
|
-
let t = e.erc20TokenAddress.toLowerCase();
|
|
104
|
-
r.set(t, [...e.tokenIds]);
|
|
105
|
-
}
|
|
106
|
-
}), t.forEach((e) => {
|
|
107
|
-
if (e.topics.length <= 3) return;
|
|
108
|
-
let t = e.address.toLowerCase(), n = BigInt(e.topics[3]).toString();
|
|
109
|
-
r.has(t) || r.set(t, []), r.get(t)?.push(n);
|
|
110
|
-
}), e.forEach((e) => {
|
|
111
|
-
if (e.topics.length <= 3) return;
|
|
112
|
-
let t = e.address.toLowerCase(), n = r.get(t);
|
|
113
|
-
if (n?.length) {
|
|
114
|
-
let t = BigInt(e.topics[3]).toString(), r = n.indexOf(t);
|
|
115
|
-
r !== -1 && n.splice(r, 1);
|
|
116
|
-
}
|
|
117
|
-
}), n.forEach((e) => {
|
|
118
|
-
if (c(e)) {
|
|
119
|
-
let t = e.erc20TokenAddress.toLowerCase(), n = r.get(t);
|
|
120
|
-
e.tokenIds = n?.length && n.length > 0 ? n : void 0;
|
|
121
|
-
}
|
|
122
|
-
}), n;
|
|
123
|
-
}
|
|
124
|
-
async fetchPublicTokens(n, i, o) {
|
|
125
|
-
try {
|
|
126
|
-
let r = [e, ...new Set(n.map((e) => e.address))].filter((e) => e && !t(o, e));
|
|
127
|
-
return r.length ? { erc20Tokens: (await a.tokensInfoCall(i, r)).filter((e) => !!e) } : { erc20Tokens: [] };
|
|
128
|
-
} catch (e) {
|
|
129
|
-
return r.error("Error fetching public tokens:", e), { erc20Tokens: [] };
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}();
|
|
133
|
-
//#endregion
|
|
134
|
-
export { g as eventsPublicTokensDB };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../error-handling/logger.cjs`),n=require(`../../functions/utils/string.utils.cjs`),r=require(`./AlchemyPublicTokensDB.cjs`),i=require(`./EventsPublicTokensDB.cjs`),a=require(`./ArcPublicTokensDB.cjs`),o=require(`./TronPublicTokensDB.cjs`),s=require(`./TempoPublicTokensDB.cjs`);var c=class{useAlternativeDB={};async getPublicTokens(t,c){let l=n.getStateKey(c,t);return this.useAlternativeDB[l]?i.eventsPublicTokensDB.getPublicTokens(t,c):t===e.chainIds.arcTestnet?a.arcPublicTokensDB.getPublicTokens(c):e.isTronLike(t)?o.tronPublicTokensDB.getPublicTokens(c,t):e.isTempo(t)?s.tempoPublicTokensDB.getPublicTokens(c,t):r.alchemyPublicTokensDB.getPublicTokens(t,c)}async getFetchedTokens(t,c){let l=n.getStateKey(c,t);return this.useAlternativeDB[l]?i.eventsPublicTokensDB.getFetchedTokens(t,c):t===e.chainIds.arcTestnet?a.arcPublicTokensDB.getFetchedTokens(c):e.isTronLike(t)?o.tronPublicTokensDB.getFetchedTokens(c,t):e.isTempo(t)?s.tempoPublicTokensDB.getFetchedTokens(c,t):r.alchemyPublicTokensDB.getFetchedTokens(t,c)}async fetchAndUpdatePublicTokens(c,l){let u=n.getStateKey(c,l);try{l===e.chainIds.arcTestnet?await a.arcPublicTokensDB.fetchAndUpdatePublicTokens(c):e.isTronLike(l)?await o.tronPublicTokensDB.fetchAndUpdatePublicTokens(c,l):e.isTempo(l)?await s.tempoPublicTokensDB.fetchAndUpdatePublicTokens(c,l):await r.alchemyPublicTokensDB.fetchAndUpdatePublicTokens(c,l),this.useAlternativeDB[u]=!1}catch(n){if(t.Logger.error(`error`,n),e.isSolanaLike(l))return;await i.eventsPublicTokensDB.fetchAndUpdatePublicTokens(c,l),this.useAlternativeDB[u]=!0}}};new c,exports.PublicTokensDB=c;
|