@hinkal/common 0.3.8 → 0.3.10

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.
Files changed (230) hide show
  1. package/README.md +2 -8
  2. package/common/src/API/API.cjs +1 -1
  3. package/common/src/API/API.d.ts +4 -5
  4. package/common/src/API/API.mjs +79 -80
  5. package/common/src/API/dashboardTransactionCalls.cjs +1 -1
  6. package/common/src/API/dashboardTransactionCalls.d.ts +4 -1
  7. package/common/src/API/dashboardTransactionCalls.mjs +2 -2
  8. package/common/src/API/enclaveRecipientInfoCalls.d.ts +0 -2
  9. package/common/src/API/enclaveSignatureCalls.cjs +1 -1
  10. package/common/src/API/enclaveSignatureCalls.d.ts +2 -1
  11. package/common/src/API/enclaveSignatureCalls.mjs +5 -8
  12. package/common/src/API/enclaveUtxoCalls.cjs +1 -1
  13. package/common/src/API/enclaveUtxoCalls.d.ts +12 -8
  14. package/common/src/API/enclaveUtxoCalls.mjs +17 -20
  15. package/common/src/API/privateSendRecipientInfoCalls.cjs +1 -1
  16. package/common/src/API/privateSendRecipientInfoCalls.d.ts +3 -6
  17. package/common/src/API/privateSendRecipientInfoCalls.mjs +12 -6
  18. package/common/src/API/scheduled-transactions-calls.cjs +1 -1
  19. package/common/src/API/scheduled-transactions-calls.d.ts +1 -5
  20. package/common/src/API/scheduled-transactions-calls.mjs +2 -6
  21. package/common/src/constants/bridging.constants.cjs +1 -1
  22. package/common/src/constants/bridging.constants.d.ts +1 -0
  23. package/common/src/constants/bridging.constants.mjs +1 -1
  24. package/common/src/constants/chains.constants.cjs +1 -1
  25. package/common/src/constants/chains.constants.d.ts +18 -17
  26. package/common/src/constants/chains.constants.mjs +108 -89
  27. package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
  28. package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +2 -1
  29. package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
  30. package/common/src/constants/deploy-data/deploy-data-base.json.mjs +2 -1
  31. package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
  32. package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +2 -1
  33. package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
  34. package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +2 -1
  35. package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
  36. package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +2 -1
  37. package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
  38. package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +2 -1
  39. package/common/src/constants/events.constants.cjs +1 -1
  40. package/common/src/constants/events.constants.mjs +1 -16
  41. package/common/src/constants/protocol.constants.d.ts +1 -3
  42. package/common/src/constants/server.constants.cjs +1 -1
  43. package/common/src/constants/server.constants.d.ts +1 -4
  44. package/common/src/constants/server.constants.mjs +1 -4
  45. package/common/src/constants/tx-confirmation.constants.cjs +1 -1
  46. package/common/src/constants/tx-confirmation.constants.d.ts +1 -0
  47. package/common/src/constants/tx-confirmation.constants.mjs +2 -2
  48. package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
  49. package/common/src/data-structures/Hinkal/Hinkal.d.ts +6 -9
  50. package/common/src/data-structures/Hinkal/Hinkal.mjs +129 -160
  51. package/common/src/data-structures/Hinkal/IHinkal.d.ts +5 -9
  52. package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
  53. package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +23 -23
  54. package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
  55. package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +1 -1
  56. package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  57. package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +10 -10
  58. package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
  59. package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +18 -18
  60. package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
  61. package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +3 -2
  62. package/common/src/data-structures/Hinkal/hinkalProxySend.cjs +1 -0
  63. package/common/src/data-structures/Hinkal/hinkalProxySend.d.ts +6 -0
  64. package/common/src/data-structures/Hinkal/hinkalProxySend.mjs +16 -0
  65. package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
  66. package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +44 -47
  67. package/common/src/data-structures/Hinkal/hinkalSolanaTransact.cjs +1 -1
  68. package/common/src/data-structures/Hinkal/hinkalSolanaTransact.mjs +2 -2
  69. package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -1
  70. package/common/src/data-structures/Hinkal/hinkalTransact.mjs +1 -1
  71. package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
  72. package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +4 -4
  73. package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
  74. package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +101 -94
  75. package/common/src/data-structures/Hinkal/index.d.ts +0 -1
  76. package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
  77. package/common/src/data-structures/IndexedDB/activity-db.mjs +34 -34
  78. package/common/src/data-structures/IndexedDB/index.cjs +1 -1
  79. package/common/src/data-structures/IndexedDB/index.d.ts +1 -0
  80. package/common/src/data-structures/IndexedDB/index.mjs +1 -0
  81. package/common/src/data-structures/IndexedDB/scheduled-transactions-db.cjs +1 -0
  82. package/common/src/data-structures/IndexedDB/scheduled-transactions-db.d.ts +11 -0
  83. package/common/src/data-structures/IndexedDB/scheduled-transactions-db.mjs +34 -0
  84. package/common/src/data-structures/IndexedDB/signatures-db.cjs +1 -1
  85. package/common/src/data-structures/IndexedDB/signatures-db.mjs +11 -11
  86. package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
  87. package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +18 -19
  88. package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
  89. package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +11 -11
  90. package/common/src/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -1
  91. package/common/src/data-structures/event-service/helpers/ClientEventHelper.mjs +6 -6
  92. package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
  93. package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +1 -0
  94. package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +79 -75
  95. package/common/src/data-structures/provider-adapter/IProviderAdapter.d.ts +1 -4
  96. package/common/src/error-handling/error-codes.constants.cjs +1 -1
  97. package/common/src/error-handling/error-codes.constants.d.ts +6 -0
  98. package/common/src/error-handling/error-codes.constants.mjs +10 -4
  99. package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.cjs +1 -1
  100. package/common/src/functions/auto-deposit-back-helpers/get-gas-token-records.mjs +7 -6
  101. package/common/src/functions/auto-deposit-back-helpers/select-gas-token.cjs +1 -1
  102. package/common/src/functions/auto-deposit-back-helpers/select-gas-token.mjs +8 -8
  103. package/common/src/functions/index.cjs +1 -1
  104. package/common/src/functions/index.mjs +1 -2
  105. package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
  106. package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +12 -12
  107. package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
  108. package/common/src/functions/private-wallet/emporium.helpers.mjs +13 -13
  109. package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
  110. package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +13 -13
  111. package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
  112. package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +4 -4
  113. package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
  114. package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +5 -5
  115. package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -1
  116. package/common/src/functions/snarkjs/constructTxEnclave.d.ts +1 -1
  117. package/common/src/functions/snarkjs/constructTxEnclave.mjs +61 -133
  118. package/common/src/functions/snarkjs/constructTxEnclaveVerify.cjs +1 -0
  119. package/common/src/functions/snarkjs/constructTxEnclaveVerify.d.ts +5 -0
  120. package/common/src/functions/snarkjs/constructTxEnclaveVerify.mjs +295 -0
  121. package/common/src/functions/utils/addresses.cjs +1 -1
  122. package/common/src/functions/utils/addresses.d.ts +1 -0
  123. package/common/src/functions/utils/addresses.mjs +13 -12
  124. package/common/src/functions/utils/bridge-arrival.utils.cjs +1 -1
  125. package/common/src/functions/utils/bridge-arrival.utils.mjs +12 -11
  126. package/common/src/functions/utils/create-provider.cjs +1 -1
  127. package/common/src/functions/utils/create-provider.mjs +4 -1
  128. package/common/src/functions/utils/enclave-recipient-info-storage.cjs +1 -1
  129. package/common/src/functions/utils/enclave-recipient-info-storage.d.ts +4 -1
  130. package/common/src/functions/utils/enclave-recipient-info-storage.mjs +1 -0
  131. package/common/src/functions/utils/enclave-signature-storage.cjs +1 -1
  132. package/common/src/functions/utils/enclave-signature-storage.d.ts +1 -1
  133. package/common/src/functions/utils/enclave-signature-storage.mjs +3 -3
  134. package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
  135. package/common/src/functions/utils/enclave-utxo-storage.d.ts +3 -3
  136. package/common/src/functions/utils/enclave-utxo-storage.mjs +8 -5
  137. package/common/src/functions/utils/encryptInputForEnclave.cjs +1 -1
  138. package/common/src/functions/utils/encryptInputForEnclave.d.ts +8 -0
  139. package/common/src/functions/utils/encryptInputForEnclave.mjs +43 -23
  140. package/common/src/functions/utils/erc20tokenFunctions.cjs +1 -1
  141. package/common/src/functions/utils/erc20tokenFunctions.mjs +2 -15
  142. package/common/src/functions/utils/fees.utils.cjs +1 -1
  143. package/common/src/functions/utils/fees.utils.mjs +6 -6
  144. package/common/src/functions/utils/index.cjs +1 -1
  145. package/common/src/functions/utils/index.d.ts +1 -0
  146. package/common/src/functions/utils/index.mjs +3 -3
  147. package/common/src/functions/utils/ipfs.d.ts +2 -3
  148. package/common/src/functions/utils/lifi.utils.d.ts +2 -0
  149. package/common/src/functions/utils/nearIntents.utils.cjs +1 -1
  150. package/common/src/functions/utils/nearIntents.utils.mjs +6 -6
  151. package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
  152. package/common/src/functions/utils/publicBalance.utils.mjs +9 -10
  153. package/common/src/functions/utils/temporary-wallet-recovery.utils.cjs +1 -0
  154. package/common/src/functions/utils/temporary-wallet-recovery.utils.d.ts +7 -0
  155. package/common/src/functions/utils/temporary-wallet-recovery.utils.mjs +10 -0
  156. package/common/src/functions/utils/tron.utils.cjs +1 -1
  157. package/common/src/functions/utils/tron.utils.mjs +16 -29
  158. package/common/src/functions/utils/tx-confirmation.utils.cjs +1 -1
  159. package/common/src/functions/utils/tx-confirmation.utils.d.ts +1 -0
  160. package/common/src/functions/utils/tx-confirmation.utils.mjs +16 -13
  161. package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  162. package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +5 -5
  163. package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
  164. package/common/src/functions/web3/events/getInputUtxosEnclave.d.ts +1 -1
  165. package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +19 -11
  166. package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
  167. package/common/src/functions/web3/events/getShieldedBalance.d.ts +4 -4
  168. package/common/src/functions/web3/events/getShieldedBalance.mjs +113 -102
  169. package/common/src/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
  170. package/common/src/functions/web3/functionCalls/transactCallDirectTron.mjs +16 -16
  171. package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
  172. package/common/src/providers/SolanaProviderAdapter.d.ts +1 -4
  173. package/common/src/providers/SolanaProviderAdapter.mjs +3 -6
  174. package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
  175. package/common/src/providers/WagmiProviderAdapter.mjs +5 -5
  176. package/common/src/types/cache.types.cjs +1 -1
  177. package/common/src/types/cache.types.d.ts +2 -1
  178. package/common/src/types/cache.types.mjs +1 -1
  179. package/common/src/types/enclaveApi.types.d.ts +2 -3
  180. package/common/src/types/ethereum-network.types.d.ts +1 -0
  181. package/common/src/types/events.types.d.ts +1 -0
  182. package/common/src/types/near-intents.types.d.ts +1 -0
  183. package/common/src/types/remote-proof.types.d.ts +5 -0
  184. package/common/src/types/remote-tx-build.types.d.ts +37 -4
  185. package/common/src/types/scheduled-transactions.types.d.ts +18 -0
  186. package/common/src/types/solana.types.d.ts +0 -3
  187. package/common/src/webworker/{logError-RKYfeI6h.js → logError-CIIt1CO3.js} +1 -1
  188. package/common/src/webworker/package.json +5 -6
  189. package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
  190. package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
  191. package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
  192. package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
  193. package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
  194. package/common/src/webworker/utxoWorkerNode.cjs +1 -1
  195. package/common/src/webworker/viteWorkerURL.constant.cjs +3 -3
  196. package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
  197. package/common/src/webworker/workerProxy-BHzCZ9HT.js +1 -0
  198. package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
  199. package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
  200. package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
  201. package/package.json +5 -6
  202. package/services/Hinkal.cjs +1 -1
  203. package/services/Hinkal.d.ts +6 -2
  204. package/services/Hinkal.mjs +9 -4
  205. package/types/IHinkal.d.ts +6 -2
  206. package/common/src/API/evm-token-assets.cjs +0 -1
  207. package/common/src/API/evm-token-assets.mjs +0 -20
  208. package/common/src/API/getAnyRecipientInfo.d.ts +0 -1
  209. package/common/src/API/solana-nft-assets.cjs +0 -1
  210. package/common/src/API/solana-nft-assets.mjs +0 -11
  211. package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredProxySend.d.ts +0 -5
  212. package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +0 -1
  213. package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +0 -109
  214. package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +0 -1
  215. package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +0 -94
  216. package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +0 -1
  217. package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +0 -134
  218. package/common/src/data-structures/TokenDBs/PublicTokensDB.cjs +0 -1
  219. package/common/src/data-structures/TokenDBs/PublicTokensDB.mjs +0 -32
  220. package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +0 -1
  221. package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +0 -37
  222. package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +0 -1
  223. package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +0 -51
  224. package/common/src/data-structures/TokenDBs/index.cjs +0 -1
  225. package/common/src/data-structures/TokenDBs/index.mjs +0 -6
  226. package/common/src/functions/utils/ipfs.cjs +0 -1
  227. package/common/src/functions/utils/ipfs.mjs +0 -1
  228. package/common/src/functions/utils/reloadPage.cjs +0 -1
  229. package/common/src/functions/utils/reloadPage.mjs +0 -4
  230. package/common/src/webworker/workerProxy-COB7g4Qc.js +0 -1
@@ -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 { API as o } from "../../API/API.mjs";
7
- import { Logger as s } from "../../error-handling/logger.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 s = c(i, e.arcTestnet), u = await this.getERC20TokenAddresses(i), d = await this.getNFTTokens(i), p = d.map((e) => e.contractAddress), m = [...u, ...p];
27
- if (!m.length) return;
28
- let h = (await o.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
- [s]: _
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
- s.error("Error fetching ARC testnet token balance:", e);
66
- }
67
- }
68
- } catch (e) {
69
- s.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(`../../functions/utils/tron.utils.cjs`),r=require(`../../types/cache.types.cjs`),i=require(`../../API/API.cjs`),a=require(`../../error-handling/logger.cjs`),o=require(`../../functions/utils/string.utils.cjs`),s=require(`./token-visibility-db.cjs`),c=require(`../../functions/utils/erc20tokenFunctions.cjs`),l=require(`../../functions/utils/create-provider.cjs`),u=require(`../../constants/events.constants.cjs`);require(`../../functions/index.cjs`);let d=require(`ethers`),f=require(`idb-keyval`),p=require(`async-mutex`);var m=new class{fetchedTokens={};updateMutexes={};transferEventTopic=d.ethers.id(`Transfer(address,address,uint256)`);chunkSize=2e3;getMutex(e){return this.updateMutexes[e]||(this.updateMutexes[e]=new p.Mutex),this.updateMutexes[e]}async getPublicTokens(e,t){let n=o.getStateKey(t,e);return c.overlayTokensWithRegistryData((await(0,f.get)(r.StorageKeys.EVENTS_PUBLIC_TOKENS))?.[n]||[],e)}async getFetchedTokens(e,t){let n=o.getStateKey(t,e);return c.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],e)}async fetchAndUpdatePublicTokens(e,n){let i=o.getStateKey(e,n);await this.getMutex(i).runExclusive(async()=>{try{let a=(await this.getPublicTokens(n,e)).map(e=>e.erc20TokenAddress),{toEvents:o,fromEvents:c,latestBlock:l}=await this.getEvents(e,n),u=[...o,...c],{erc20Tokens:d}=await this.fetchPublicTokens(u,n,a),p=await s.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(n,d),m=d.filter(e=>!t.lowerCaseIncludes(p,e.erc20TokenAddress));await(0,f.update)(r.StorageKeys.EVENTS_PUBLIC_TOKENS,(e={})=>{let n=e[i]||[],r=n.map(e=>e.erc20TokenAddress),a=m.filter(e=>!t.lowerCaseIncludes(r,e.erc20TokenAddress));n.push(...a);let s=this.updateTokenIds(c,o,n),l={...e,[i]:s};return this.fetchedTokens=l,l}),l&&await this.updateLastProcessedBlock(n,e,l)}catch(e){a.Logger.error(`public tokens db error`,e)}})}async getLastProcessedBlock(e,t){return(await(0,f.get)(r.StorageKeys.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS)||{})[o.getStateKey(t,e)]||u.EVENTS_INITIAL_BLOCKS[e]}async updateLastProcessedBlock(e,t,n){await(0,f.update)(r.StorageKeys.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS,(r={})=>{let i=o.getStateKey(t,e);return{...r,[i]:n}})}async getEvents(e,t){try{let r=l.createJsonRpcProvider(t),i=await this.getLastProcessedBlock(t,e)+1,a=await r.getBlockNumber(),o=n.addressToHexFormat(e),s=d.ethers.zeroPadValue(o,32),c=[],u=[];for(let e=i;e<=a;e+=this.chunkSize){let t=Math.min(e+this.chunkSize-1,a),n={topics:[this.transferEventTopic,null,s],fromBlock:e,toBlock:t},i={topics:[this.transferEventTopic,s,null],fromBlock:e,toBlock:t},[o,l]=await Promise.all([r.getLogs(n),r.getLogs(i)]);c.push(...o),u.push(...l)}return{toEvents:c,fromEvents:u,latestBlock:a}}catch(n){return a.Logger.error(`Error fetching events:`,n,`chainId`,t,`walletAddress`,e),{toEvents:[],fromEvents:[],latestBlock:void 0}}}updateTokenIds(e,t,n){let r=new Map;return n.forEach(e=>{if(c.isNFTToken(e)&&e.tokenIds){let t=e.erc20TokenAddress.toLowerCase();r.set(t,[...e.tokenIds])}}),t.forEach(e=>{if(e.topics.length<=3)return;let t=e.address.toLowerCase(),n=BigInt(e.topics[3]).toString();r.has(t)||r.set(t,[]),r.get(t)?.push(n)}),e.forEach(e=>{if(e.topics.length<=3)return;let t=e.address.toLowerCase(),n=r.get(t);if(n?.length){let t=BigInt(e.topics[3]).toString(),r=n.indexOf(t);r!==-1&&n.splice(r,1)}}),n.forEach(e=>{if(c.isNFTToken(e)){let t=e.erc20TokenAddress.toLowerCase(),n=r.get(t);e.tokenIds=n?.length&&n.length>0?n:void 0}}),n}async fetchPublicTokens(n,r,o){try{let a=[e.zeroAddress,...new Set(n.map(e=>e.address))].filter(e=>e&&!t.lowerCaseIncludes(o,e));return a.length?{erc20Tokens:(await i.API.tokensInfoCall(r,a)).filter(e=>!!e)}:{erc20Tokens:[]}}catch(e){return a.Logger.error(`Error fetching public tokens:`,e),{erc20Tokens:[]}}}};exports.eventsPublicTokensDB=m;
@@ -1,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 { addressToHexFormat as n } from "../../functions/utils/tron.utils.mjs";
4
- import { StorageKeys as r } from "../../types/cache.types.mjs";
5
- import { API as i } from "../../API/API.mjs";
6
- import { Logger as a } from "../../error-handling/logger.mjs";
7
- 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 n = o(t, e);
26
- return l((await p(r.EVENTS_PUBLIC_TOKENS))?.[n] || [], 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, n) {
33
- let i = o(e, n);
34
- await this.getMutex(i).runExclusive(async () => {
35
- try {
36
- let a = (await this.getPublicTokens(n, e)).map((e) => e.erc20TokenAddress), { toEvents: o, fromEvents: c, latestBlock: l } = await this.getEvents(e, n), u = [...o, ...c], { erc20Tokens: d } = await this.fetchPublicTokens(u, n, a), f = await s.hideSpamsAndFetchHiddenTokensAddresses(n, d), p = d.filter((e) => !t(f, e.erc20TokenAddress));
37
- await m(r.EVENTS_PUBLIC_TOKENS, (e = {}) => {
38
- let n = e[i] || [], r = n.map((e) => e.erc20TokenAddress), a = p.filter((e) => !t(r, e.erc20TokenAddress));
39
- n.push(...a);
40
- let s = this.updateTokenIds(c, o, n), l = {
41
- ...e,
42
- [i]: s
43
- };
44
- return this.fetchedTokens = l, l;
45
- }), l && await this.updateLastProcessedBlock(n, e, l);
46
- } catch (e) {
47
- a.error("public tokens db error", e);
48
- }
49
- });
50
- }
51
- async getLastProcessedBlock(e, t) {
52
- return (await p(r.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS) || {})[o(t, e)] || d[e];
53
- }
54
- async updateLastProcessedBlock(e, t, n) {
55
- await m(r.PUBLIC_TOKENS_LAST_PROCESSED_BLOCKS, (r = {}) => {
56
- let i = o(t, e);
57
- return {
58
- ...r,
59
- [i]: n
60
- };
61
- });
62
- }
63
- async getEvents(e, t) {
64
- try {
65
- let r = u(t), i = await this.getLastProcessedBlock(t, e) + 1, a = await r.getBlockNumber(), o = n(e), s = f.zeroPadValue(o, 32), c = [], l = [];
66
- for (let e = i; e <= a; e += this.chunkSize) {
67
- let t = Math.min(e + this.chunkSize - 1, a), n = {
68
- 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([r.getLogs(n), r.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 a.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, r, o) {
125
- try {
126
- let a = [e, ...new Set(n.map((e) => e.address))].filter((e) => e && !t(o, e));
127
- return a.length ? { erc20Tokens: (await i.tokensInfoCall(r, a)).filter((e) => !!e) } : { erc20Tokens: [] };
128
- } catch (e) {
129
- return a.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;
@@ -1,32 +0,0 @@
1
- import { chainIds as e, isSolanaLike as t, isTempo as n, isTronLike as r } from "../../constants/chains.constants.mjs";
2
- import { Logger as i } from "../../error-handling/logger.mjs";
3
- import { getStateKey as a } from "../../functions/utils/string.utils.mjs";
4
- import { alchemyPublicTokensDB as o } from "./AlchemyPublicTokensDB.mjs";
5
- import { eventsPublicTokensDB as s } from "./EventsPublicTokensDB.mjs";
6
- import { arcPublicTokensDB as c } from "./ArcPublicTokensDB.mjs";
7
- import { tronPublicTokensDB as l } from "./TronPublicTokensDB.mjs";
8
- import { tempoPublicTokensDB as u } from "./TempoPublicTokensDB.mjs";
9
- //#region libs/shared/common/src/data-structures/TokenDBs/PublicTokensDB.ts
10
- var d = class {
11
- useAlternativeDB = {};
12
- async getPublicTokens(t, i) {
13
- let d = a(i, t);
14
- return this.useAlternativeDB[d] ? s.getPublicTokens(t, i) : t === e.arcTestnet ? c.getPublicTokens(i) : r(t) ? l.getPublicTokens(i, t) : n(t) ? u.getPublicTokens(i, t) : o.getPublicTokens(t, i);
15
- }
16
- async getFetchedTokens(t, i) {
17
- let d = a(i, t);
18
- return this.useAlternativeDB[d] ? s.getFetchedTokens(t, i) : t === e.arcTestnet ? c.getFetchedTokens(i) : r(t) ? l.getFetchedTokens(i, t) : n(t) ? u.getFetchedTokens(i, t) : o.getFetchedTokens(t, i);
19
- }
20
- async fetchAndUpdatePublicTokens(d, f) {
21
- let p = a(d, f);
22
- try {
23
- f === e.arcTestnet ? await c.fetchAndUpdatePublicTokens(d) : r(f) ? await l.fetchAndUpdatePublicTokens(d, f) : n(f) ? await u.fetchAndUpdatePublicTokens(d, f) : await o.fetchAndUpdatePublicTokens(d, f), this.useAlternativeDB[p] = !1;
24
- } catch (e) {
25
- if (i.error("error", e), t(f)) return;
26
- await s.fetchAndUpdatePublicTokens(d, f), this.useAlternativeDB[p] = !0;
27
- }
28
- }
29
- };
30
- new d();
31
- //#endregion
32
- export { d as PublicTokensDB };
@@ -1 +0,0 @@
1
- require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../functions/utils/caseInsensitive.utils.cjs`),t=require(`../../types/cache.types.cjs`),n=require(`../../API/API.cjs`),r=require(`../../functions/utils/string.utils.cjs`),i=require(`./token-visibility-db.cjs`),a=require(`../../functions/utils/erc20tokenFunctions.cjs`);let o=require(`idb-keyval`);var s=class{fetchedTokens={};async getPublicTokens(e,n){let i=r.getStateKey(e,n);return a.overlayTokensWithRegistryData((await(0,o.get)(t.StorageKeys.TEMPO_PUBLIC_TOKENS))?.[i]||[],n)}async getFetchedTokens(e,t){let n=r.getStateKey(e,t);return a.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],t)}async fetchAndUpdatePublicTokens(a,s){let c=r.getStateKey(a,s),l=await this.getHeldTokenAddresses(s);if(!l.length)return;let u=(await n.API.tokensInfoCall(s,l)).filter(e=>!!e),d=await i.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(s,u),f=u.filter(t=>!e.lowerCaseIncludes(d,t.erc20TokenAddress));await(0,o.update)(t.StorageKeys.TEMPO_PUBLIC_TOKENS,(e={})=>{let t={...e,[c]:f};return this.fetchedTokens=t,t})}async getHeldTokenAddresses(e){let t=await a.getErc20TokensForChainAPI(e);return Array.from(new Set(t.map(({erc20TokenAddress:e})=>e)))}},c=new s;exports.TempoPublicTokensDB=s,exports.tempoPublicTokensDB=c;
@@ -1,37 +0,0 @@
1
- import { lowerCaseIncludes as e } from "../../functions/utils/caseInsensitive.utils.mjs";
2
- import { StorageKeys as t } from "../../types/cache.types.mjs";
3
- import { API as n } from "../../API/API.mjs";
4
- import { getStateKey as r } from "../../functions/utils/string.utils.mjs";
5
- import { tokenVisibilityStorage as i } from "./token-visibility-db.mjs";
6
- import { getErc20TokensForChainAPI as a, overlayTokensWithRegistryData as o } from "../../functions/utils/erc20tokenFunctions.mjs";
7
- import { get as s, update as c } from "idb-keyval";
8
- //#region libs/shared/common/src/data-structures/TokenDBs/TempoPublicTokensDB.ts
9
- var l = class {
10
- fetchedTokens = {};
11
- async getPublicTokens(e, n) {
12
- let i = r(e, n);
13
- return o((await s(t.TEMPO_PUBLIC_TOKENS))?.[i] || [], n);
14
- }
15
- async getFetchedTokens(e, t) {
16
- let n = r(e, t);
17
- return o(this.fetchedTokens[n] || [], t);
18
- }
19
- async fetchAndUpdatePublicTokens(a, o) {
20
- let s = r(a, o), l = await this.getHeldTokenAddresses(o);
21
- if (!l.length) return;
22
- let u = (await n.tokensInfoCall(o, l)).filter((e) => !!e), d = await i.hideSpamsAndFetchHiddenTokensAddresses(o, u), f = u.filter((t) => !e(d, t.erc20TokenAddress));
23
- await c(t.TEMPO_PUBLIC_TOKENS, (e = {}) => {
24
- let t = {
25
- ...e,
26
- [s]: f
27
- };
28
- return this.fetchedTokens = t, t;
29
- });
30
- }
31
- async getHeldTokenAddresses(e) {
32
- let t = await a(e);
33
- return Array.from(new Set(t.map(({ erc20TokenAddress: e }) => e)));
34
- }
35
- }, u = new l();
36
- //#endregion
37
- export { l as TempoPublicTokensDB, u as tempoPublicTokensDB };
@@ -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(`../http/HttpClient.cjs`);require(`../http/index.cjs`);const r=require(`../../functions/utils/tron.utils.cjs`),i=require(`../../types/cache.types.cjs`),a=require(`../../API/API.cjs`),o=require(`../../functions/utils/string.utils.cjs`),s=require(`./token-visibility-db.cjs`),c=require(`../../functions/utils/erc20tokenFunctions.cjs`);let l=require(`idb-keyval`);var u=200,d=class{fetchedTokens={};async getPublicTokens(e,t){let n=o.getStateKey(e,t);return c.overlayTokensWithRegistryData((await(0,l.get)(i.StorageKeys.TRON_PUBLIC_TOKENS))?.[n]||[],t)}async getFetchedTokens(e,t){let n=o.getStateKey(e,t);return c.overlayTokensWithRegistryData(this.fetchedTokens[n]||[],t)}async fetchAndUpdatePublicTokens(e,n){let r=o.getStateKey(e,n),c=await this.getHeldTokenAddresses(e,n);if(!c.length)return;let u=(await a.API.tokensInfoCall(n,c)).filter(e=>!!e),d=await s.tokenVisibilityStorage.hideSpamsAndFetchHiddenTokensAddresses(n,u),f=u.filter(e=>!t.lowerCaseIncludes(d,e.erc20TokenAddress));await(0,l.update)(i.StorageKeys.TRON_PUBLIC_TOKENS,(e={})=>{let t={...e,[r]:f};return this.fetchedTokens=t,t})}async getHeldTokenAddresses(t,i){let a=r.toTronBase58IfHex(t),o=`${r.getTronWalletRpcUrl(i)}/v1/accounts/${a}`,s=(await n.httpClient.get(o))?.data?.[0];if(!s)return this.getTokenAddressesFromTransferHistory(a,i);let c=[];return s.balance&&s.balance>0&&c.push(e.zeroAddress),(s.trc20??[]).forEach(e=>{Object.entries(e).forEach(([e,t])=>{BigInt(t)>0n&&c.push(r.addressToHexFormat(e))})}),Array.from(new Set(c))}async getTokenAddressesFromTransferHistory(e,t){let i=`${r.getTronWalletRpcUrl(t)}/v1/accounts/${e}/transactions/trc20?only_to=true&limit=${u}`,a=((await n.httpClient.get(i))?.data??[]).map(e=>e.token_info?.address).filter(e=>!!e).map(r.addressToHexFormat);return Array.from(new Set(a))}},f=new d;exports.TronPublicTokensDB=d,exports.tronPublicTokensDB=f;
@@ -1,51 +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 { httpClient as n } from "../http/HttpClient.mjs";
4
- import "../http/index.mjs";
5
- import { addressToHexFormat as r, getTronWalletRpcUrl as i, toTronBase58IfHex as a } from "../../functions/utils/tron.utils.mjs";
6
- import { StorageKeys as o } from "../../types/cache.types.mjs";
7
- 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 { overlayTokensWithRegistryData as u } from "../../functions/utils/erc20tokenFunctions.mjs";
11
- import { get as d, update as f } from "idb-keyval";
12
- //#region libs/shared/common/src/data-structures/TokenDBs/TronPublicTokensDB.ts
13
- var p = 200, m = class {
14
- fetchedTokens = {};
15
- async getPublicTokens(e, t) {
16
- let n = c(e, t);
17
- return u((await d(o.TRON_PUBLIC_TOKENS))?.[n] || [], t);
18
- }
19
- async getFetchedTokens(e, t) {
20
- let n = c(e, t);
21
- return u(this.fetchedTokens[n] || [], t);
22
- }
23
- async fetchAndUpdatePublicTokens(e, n) {
24
- let r = c(e, n), i = await this.getHeldTokenAddresses(e, n);
25
- if (!i.length) return;
26
- let a = (await s.tokensInfoCall(n, i)).filter((e) => !!e), u = await l.hideSpamsAndFetchHiddenTokensAddresses(n, a), d = a.filter((e) => !t(u, e.erc20TokenAddress));
27
- await f(o.TRON_PUBLIC_TOKENS, (e = {}) => {
28
- let t = {
29
- ...e,
30
- [r]: d
31
- };
32
- return this.fetchedTokens = t, t;
33
- });
34
- }
35
- async getHeldTokenAddresses(t, o) {
36
- let s = a(t), c = `${i(o)}/v1/accounts/${s}`, l = (await n.get(c))?.data?.[0];
37
- if (!l) return this.getTokenAddressesFromTransferHistory(s, o);
38
- let u = [];
39
- return l.balance && l.balance > 0 && u.push(e), (l.trc20 ?? []).forEach((e) => {
40
- Object.entries(e).forEach(([e, t]) => {
41
- BigInt(t) > 0n && u.push(r(e));
42
- });
43
- }), Array.from(new Set(u));
44
- }
45
- async getTokenAddressesFromTransferHistory(e, t) {
46
- let a = `${i(t)}/v1/accounts/${e}/transactions/trc20?only_to=true&limit=${p}`, o = ((await n.get(a))?.data ?? []).map((e) => e.token_info?.address).filter((e) => !!e).map(r);
47
- return Array.from(new Set(o));
48
- }
49
- }, h = new m();
50
- //#endregion
51
- export { m as TronPublicTokensDB, h as tronPublicTokensDB };
@@ -1 +0,0 @@
1
- require(`./token-visibility-db.cjs`),require(`./PrivateTokensDB.cjs`),require(`./ArcPublicTokensDB.cjs`),require(`./TronPublicTokensDB.cjs`),require(`./TempoPublicTokensDB.cjs`),require(`./PublicTokensDB.cjs`);
@@ -1,6 +0,0 @@
1
- import "./token-visibility-db.mjs";
2
- import "./PrivateTokensDB.mjs";
3
- import "./ArcPublicTokensDB.mjs";
4
- import "./TronPublicTokensDB.mjs";
5
- import "./TempoPublicTokensDB.mjs";
6
- import "./PublicTokensDB.mjs";
@@ -1 +0,0 @@
1
- require(`multiformats`);
@@ -1 +0,0 @@
1
- import "multiformats";
@@ -1 +0,0 @@
1
- var e=()=>window.location.reload();exports.reloadPage=e;
@@ -1,4 +0,0 @@
1
- //#region libs/shared/common/src/functions/utils/reloadPage.ts
2
- var e = () => window.location.reload();
3
- //#endregion
4
- export { e as reloadPage };