@sabaaa1/common 0.1.6 → 0.1.14

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 (672) hide show
  1. package/API/API.cjs +1 -1
  2. package/API/API.d.ts +16 -12
  3. package/API/API.mjs +73 -69
  4. package/API/accessCodeCalls.cjs +1 -0
  5. package/API/accessCodeCalls.d.ts +23 -0
  6. package/API/accessCodeCalls.mjs +23 -0
  7. package/API/admin-calls.cjs +1 -1
  8. package/API/admin-calls.mjs +5 -7
  9. package/API/ai-calls.cjs +1 -1
  10. package/API/ai-calls.mjs +11 -10
  11. package/API/brotherhoodCalls.cjs +1 -1
  12. package/API/brotherhoodCalls.mjs +43 -69
  13. package/API/callLifiAPI.cjs +1 -1
  14. package/API/callLifiAPI.mjs +8 -7
  15. package/API/callOdosAPI.cjs +1 -1
  16. package/API/callOdosAPI.mjs +16 -16
  17. package/API/callOkxAPI.cjs +1 -0
  18. package/API/callOkxAPI.d.ts +10 -0
  19. package/API/callOkxAPI.mjs +13 -0
  20. package/API/callOneInchAPI.cjs +1 -1
  21. package/API/callOneInchAPI.mjs +8 -7
  22. package/API/callRelayer.cjs +1 -1
  23. package/API/callRelayer.d.ts +11 -0
  24. package/API/callRelayer.mjs +15 -7
  25. package/API/checkRisk.cjs +1 -1
  26. package/API/checkRisk.mjs +5 -4
  27. package/API/duneAPI.cjs +1 -1
  28. package/API/duneAPI.mjs +2 -3
  29. package/API/enclaveCalls.cjs +1 -1
  30. package/API/enclaveCalls.mjs +9 -11
  31. package/API/fetchCommitmentsCache.cjs +1 -1
  32. package/API/fetchCommitmentsCache.d.ts +2 -2
  33. package/API/fetchCommitmentsCache.mjs +13 -10
  34. package/API/generate-trading-points.cjs +1 -1
  35. package/API/generate-trading-points.mjs +34 -39
  36. package/API/get-token-data.cjs +1 -1
  37. package/API/get-token-data.mjs +5 -4
  38. package/API/getBridgeProtocols.cjs +1 -1
  39. package/API/getBridgeProtocols.mjs +4 -3
  40. package/API/getGasEstimates.cjs +1 -1
  41. package/API/getGasEstimates.d.ts +2 -1
  42. package/API/getGasEstimates.mjs +14 -16
  43. package/API/getLifiStatus.cjs +1 -1
  44. package/API/getLifiStatus.mjs +11 -10
  45. package/API/getRelayerURL.cjs +1 -1
  46. package/API/getRelayerURL.mjs +4 -4
  47. package/API/getServerURL.cjs +1 -1
  48. package/API/getServerURL.mjs +42 -36
  49. package/API/getTokenPrice.cjs +1 -1
  50. package/API/getTokenPrice.d.ts +0 -11
  51. package/API/getTokenPrice.mjs +8 -23
  52. package/API/getWebsiteURL.cjs +1 -1
  53. package/API/getWebsiteURL.d.ts +1 -1
  54. package/API/getWebsiteURL.mjs +6 -7
  55. package/API/index.d.ts +2 -1
  56. package/API/is-tx-stateless.cjs +1 -1
  57. package/API/is-tx-stateless.mjs +17 -22
  58. package/API/kycCalls.cjs +1 -1
  59. package/API/kycCalls.d.ts +2 -2
  60. package/API/kycCalls.mjs +31 -30
  61. package/API/leaderboardCalls.cjs +1 -1
  62. package/API/leaderboardCalls.mjs +11 -16
  63. package/API/proxyAccountsCalls.cjs +1 -1
  64. package/API/proxyAccountsCalls.mjs +19 -18
  65. package/API/referralsCalls.cjs +1 -1
  66. package/API/referralsCalls.mjs +16 -24
  67. package/API/relayCalls.cjs +1 -1
  68. package/API/relayCalls.mjs +6 -8
  69. package/API/resolve-sns.cjs +1 -0
  70. package/API/resolve-sns.d.ts +1 -0
  71. package/API/resolve-sns.mjs +12 -0
  72. package/API/restoreSnapshots.cjs +1 -1
  73. package/API/restoreSnapshots.mjs +5 -5
  74. package/API/rewardsUserCalls.cjs +1 -1
  75. package/API/rewardsUserCalls.mjs +37 -54
  76. package/API/seedless-calls.cjs +1 -0
  77. package/API/seedless-calls.d.ts +53 -0
  78. package/API/seedless-calls.mjs +12 -0
  79. package/API/send-telegram-callback.cjs +1 -1
  80. package/API/send-telegram-callback.mjs +9 -11
  81. package/API/simulate-batch-tx.cjs +1 -1
  82. package/API/simulate-batch-tx.mjs +11 -13
  83. package/API/solana-calls.cjs +1 -0
  84. package/API/solana-calls.d.ts +34 -0
  85. package/API/solana-calls.mjs +19 -0
  86. package/API/tenderly.api.cjs +1 -1
  87. package/API/tenderly.api.mjs +48 -59
  88. package/API/token-calls.cjs +1 -1
  89. package/API/token-calls.mjs +11 -13
  90. package/API/weeklyAnalyticCalls.cjs +1 -1
  91. package/API/weeklyAnalyticCalls.mjs +9 -14
  92. package/README.md +164 -0
  93. package/_virtual/_commonjsHelpers.cjs +1 -0
  94. package/_virtual/_commonjsHelpers.mjs +30 -0
  95. package/_virtual/bn.cjs +1 -0
  96. package/_virtual/bn.mjs +4 -0
  97. package/_virtual/bn2.cjs +1 -0
  98. package/_virtual/bn2.mjs +4 -0
  99. package/_virtual/common.cjs +1 -0
  100. package/_virtual/common.mjs +4 -0
  101. package/_virtual/common2.cjs +1 -0
  102. package/_virtual/common2.mjs +4 -0
  103. package/_virtual/hash.cjs +1 -0
  104. package/_virtual/hash.mjs +4 -0
  105. package/_virtual/index.cjs +1 -0
  106. package/_virtual/index.mjs +6 -0
  107. package/_virtual/index10.cjs +1 -0
  108. package/_virtual/index10.mjs +6 -0
  109. package/_virtual/index11.cjs +1 -0
  110. package/_virtual/index11.mjs +6 -0
  111. package/_virtual/index12.cjs +1 -0
  112. package/_virtual/index12.mjs +6 -0
  113. package/_virtual/index13.cjs +1 -0
  114. package/_virtual/index13.mjs +6 -0
  115. package/_virtual/index14.cjs +1 -0
  116. package/_virtual/index14.mjs +6 -0
  117. package/_virtual/index15.cjs +1 -0
  118. package/_virtual/index15.mjs +6 -0
  119. package/_virtual/index16.cjs +1 -0
  120. package/_virtual/index16.mjs +6 -0
  121. package/_virtual/index17.cjs +1 -0
  122. package/_virtual/index17.mjs +6 -0
  123. package/_virtual/index18.cjs +1 -0
  124. package/_virtual/index18.mjs +6 -0
  125. package/_virtual/index19.cjs +1 -0
  126. package/_virtual/index19.mjs +6 -0
  127. package/_virtual/index2.cjs +1 -0
  128. package/_virtual/index2.mjs +6 -0
  129. package/_virtual/index20.cjs +1 -0
  130. package/_virtual/index20.mjs +6 -0
  131. package/_virtual/index21.cjs +1 -0
  132. package/_virtual/index21.mjs +6 -0
  133. package/_virtual/index22.cjs +1 -0
  134. package/_virtual/index22.mjs +4 -0
  135. package/_virtual/index3.cjs +1 -0
  136. package/_virtual/index3.mjs +6 -0
  137. package/_virtual/index4.cjs +1 -0
  138. package/_virtual/index4.mjs +6 -0
  139. package/_virtual/index5.cjs +1 -0
  140. package/_virtual/index5.mjs +6 -0
  141. package/_virtual/index6.cjs +1 -0
  142. package/_virtual/index6.mjs +6 -0
  143. package/_virtual/index7.cjs +1 -0
  144. package/_virtual/index7.mjs +6 -0
  145. package/_virtual/index8.cjs +1 -0
  146. package/_virtual/index8.mjs +6 -0
  147. package/_virtual/index9.cjs +1 -0
  148. package/_virtual/index9.mjs +6 -0
  149. package/_virtual/inherits_browser.cjs +1 -0
  150. package/_virtual/inherits_browser.mjs +4 -0
  151. package/_virtual/ripemd.cjs +1 -0
  152. package/_virtual/ripemd.mjs +4 -0
  153. package/_virtual/scrypt.cjs +1 -0
  154. package/_virtual/scrypt.mjs +4 -0
  155. package/_virtual/sha.cjs +1 -0
  156. package/_virtual/sha.mjs +4 -0
  157. package/_virtual/sha3.cjs +1 -0
  158. package/_virtual/sha3.mjs +4 -0
  159. package/_virtual/utils.cjs +1 -0
  160. package/_virtual/utils.mjs +4 -0
  161. package/_virtual/utils2.cjs +1 -0
  162. package/_virtual/utils2.mjs +4 -0
  163. package/constants/backend.constants.cjs +1 -1
  164. package/constants/backend.constants.d.ts +2 -1
  165. package/constants/backend.constants.mjs +5 -7
  166. package/constants/chains.constants.cjs +1 -1
  167. package/constants/chains.constants.d.ts +5 -0
  168. package/constants/chains.constants.mjs +63 -35
  169. package/constants/coingecko.constants.cjs +1 -1
  170. package/constants/coingecko.constants.d.ts +1 -1
  171. package/constants/coingecko.constants.mjs +18 -11
  172. package/constants/contracts.constants.cjs +1 -1
  173. package/constants/contracts.constants.mjs +19 -15
  174. package/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
  175. package/constants/deploy-data/deploy-data-arbMainnet.json.mjs +1218 -8
  176. package/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
  177. package/constants/deploy-data/deploy-data-arcTestnet.json.mjs +1214 -4
  178. package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
  179. package/constants/deploy-data/deploy-data-base.json.mjs +1218 -8
  180. package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
  181. package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +1213 -3
  182. package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
  183. package/constants/deploy-data/deploy-data-optimism.json.mjs +1218 -8
  184. package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
  185. package/constants/deploy-data/deploy-data-polygon.json.mjs +1218 -8
  186. package/constants/deploy-data/deploy-data-solana.json.cjs +1 -0
  187. package/constants/deploy-data/deploy-data-solana.json.mjs +6111 -0
  188. package/constants/deploy-data/index.d.ts +2 -1
  189. package/constants/index.d.ts +1 -1
  190. package/constants/mediaUrls.constants.cjs +1 -1
  191. package/constants/mediaUrls.constants.d.ts +9 -0
  192. package/constants/mediaUrls.constants.mjs +13 -4
  193. package/constants/okx.constants.cjs +1 -0
  194. package/constants/okx.constants.d.ts +2 -0
  195. package/constants/okx.constants.mjs +5 -0
  196. package/constants/protocol.constants.cjs +1 -1
  197. package/constants/protocol.constants.d.ts +12 -1
  198. package/constants/protocol.constants.mjs +37 -29
  199. package/constants/save-depths.cjs +1 -1
  200. package/constants/save-depths.mjs +4 -1
  201. package/constants/server.constants.cjs +1 -1
  202. package/constants/server.constants.d.ts +23 -10
  203. package/constants/server.constants.mjs +102 -89
  204. package/constants/token-data/ERC20Registry.cjs +1 -1
  205. package/constants/token-data/ERC20Registry.mjs +49 -35
  206. package/constants/token-data/index.cjs +1 -1
  207. package/constants/token-data/index.d.ts +17 -1
  208. package/constants/token-data/index.mjs +29 -25
  209. package/constants/token-data/solanaLocalnetRegistry.json.cjs +1 -0
  210. package/constants/token-data/solanaLocalnetRegistry.json.mjs +24 -0
  211. package/constants/token-data/solanaMainnetRegistry.json.cjs +1 -0
  212. package/constants/token-data/solanaMainnetRegistry.json.mjs +560 -0
  213. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
  214. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +41 -41
  215. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  216. package/data-structures/Hinkal/Hinkal.d.ts +19 -10
  217. package/data-structures/Hinkal/Hinkal.mjs +290 -125
  218. package/data-structures/Hinkal/IHinkal.d.ts +18 -11
  219. package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
  220. package/data-structures/Hinkal/handleAutoDepositBack.mjs +36 -32
  221. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -1
  222. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +24 -23
  223. package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
  224. package/data-structures/Hinkal/hinkalActionReceive.mjs +13 -12
  225. package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.cjs +1 -0
  226. package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.d.ts +3 -0
  227. package/data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.mjs +28 -0
  228. package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
  229. package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +11 -8
  230. package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -0
  231. package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +4 -0
  232. package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +167 -0
  233. package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -1
  234. package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +1 -1
  235. package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +4 -4
  236. package/data-structures/Hinkal/hinkalMultiSend.cjs +1 -1
  237. package/data-structures/Hinkal/hinkalMultiSend.mjs +6 -6
  238. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  239. package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
  240. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +109 -93
  241. package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
  242. package/data-structures/Hinkal/hinkalProxySwap.mjs +23 -22
  243. package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -0
  244. package/data-structures/Hinkal/hinkalProxyToPrivate.d.ts +6 -0
  245. package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +45 -0
  246. package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
  247. package/data-structures/Hinkal/hinkalSignSubAccount.mjs +11 -9
  248. package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -0
  249. package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +4 -0
  250. package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +133 -0
  251. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -0
  252. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +3 -0
  253. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +216 -0
  254. package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -0
  255. package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +6 -0
  256. package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +55 -0
  257. package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -0
  258. package/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +6 -0
  259. package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +99 -0
  260. package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -0
  261. package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +5 -0
  262. package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +96 -0
  263. package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -0
  264. package/data-structures/Hinkal/hinkalSolanaSwap.d.ts +4 -0
  265. package/data-structures/Hinkal/hinkalSolanaSwap.mjs +120 -0
  266. package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -0
  267. package/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +3 -0
  268. package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +90 -0
  269. package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -0
  270. package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +3 -0
  271. package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +106 -0
  272. package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  273. package/data-structures/Hinkal/hinkalSwap.mjs +33 -27
  274. package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
  275. package/data-structures/Hinkal/hinkalTransfer.mjs +20 -14
  276. package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  277. package/data-structures/Hinkal/hinkalWithdraw.mjs +15 -9
  278. package/data-structures/Hinkal/index.d.ts +4 -0
  279. package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  280. package/data-structures/Hinkal/resetMerkleTrees.mjs +56 -23
  281. package/data-structures/IndexedDB/activity-db.cjs +1 -1
  282. package/data-structures/IndexedDB/activity-db.d.ts +0 -1
  283. package/data-structures/IndexedDB/activity-db.mjs +86 -86
  284. package/data-structures/IndexedDB/balances-db.cjs +1 -1
  285. package/data-structures/IndexedDB/balances-db.mjs +15 -12
  286. package/data-structures/IndexedDB/contact-db.cjs +1 -1
  287. package/data-structures/IndexedDB/contact-db.mjs +29 -26
  288. package/data-structures/IndexedDB/signatures-db.cjs +1 -1
  289. package/data-structures/IndexedDB/signatures-db.mjs +14 -10
  290. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
  291. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.d.ts +2 -2
  292. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +32 -31
  293. package/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
  294. package/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +6 -1
  295. package/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +154 -79
  296. package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
  297. package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +24 -21
  298. package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
  299. package/data-structures/TokenDBs/PrivateTokensDB.mjs +39 -34
  300. package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
  301. package/data-structures/crypto-keys/decodeUTXO.d.ts +15 -3
  302. package/data-structures/crypto-keys/decodeUTXO.mjs +84 -26
  303. package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
  304. package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +36 -30
  305. package/data-structures/crypto-keys/keys.cjs +1 -1
  306. package/data-structures/crypto-keys/keys.d.ts +19 -5
  307. package/data-structures/crypto-keys/keys.mjs +117 -60
  308. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -0
  309. package/data-structures/event-service/{AbstractAccessTokenSnapshotService.d.ts → evm/AbstractAccessTokenSnapshotService.d.ts} +2 -2
  310. package/data-structures/event-service/{AbstractAccessTokenSnapshotService.mjs → evm/AbstractAccessTokenSnapshotService.mjs} +6 -6
  311. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -0
  312. package/data-structures/event-service/{AbstractApprovalsSnapshotService.d.ts → evm/AbstractApprovalsSnapshotService.d.ts} +2 -2
  313. package/data-structures/event-service/{AbstractApprovalsSnapshotService.mjs → evm/AbstractApprovalsSnapshotService.mjs} +2 -2
  314. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -0
  315. package/data-structures/event-service/{AbstractCommitmentsSnapshotService.d.ts → evm/AbstractCommitmentsSnapshotService.d.ts} +3 -3
  316. package/data-structures/event-service/{AbstractCommitmentsSnapshotService.mjs → evm/AbstractCommitmentsSnapshotService.mjs} +24 -21
  317. package/data-structures/event-service/evm/AbstractEventService.cjs +1 -0
  318. package/data-structures/event-service/{AbstractEventService.d.ts → evm/AbstractEventService.d.ts} +1 -1
  319. package/data-structures/event-service/evm/AbstractEventService.mjs +37 -0
  320. package/data-structures/event-service/{AbstractNullifierSnapshotService.d.ts → evm/AbstractNullifierSnapshotService.d.ts} +1 -1
  321. package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -0
  322. package/data-structures/event-service/{AbstractSnapshotService.mjs → evm/AbstractSnapshotService.mjs} +1 -1
  323. package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -0
  324. package/data-structures/event-service/{BlockchainEventEmitter.d.ts → evm/BlockchainEventEmitter.d.ts} +2 -1
  325. package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +89 -0
  326. package/data-structures/event-service/index.d.ts +13 -7
  327. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -0
  328. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +34 -0
  329. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +87 -0
  330. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -0
  331. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +29 -0
  332. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +96 -0
  333. package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -0
  334. package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +22 -0
  335. package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +33 -0
  336. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -0
  337. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +21 -0
  338. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +49 -0
  339. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -0
  340. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +22 -0
  341. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +33 -0
  342. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -0
  343. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +39 -0
  344. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +153 -0
  345. package/data-structures/http/BasicHttpClient.cjs +1 -0
  346. package/data-structures/http/BasicHttpClient.d.ts +11 -0
  347. package/data-structures/http/BasicHttpClient.mjs +25 -0
  348. package/data-structures/http/HttpClient.cjs +1 -0
  349. package/data-structures/http/HttpClient.d.ts +10 -0
  350. package/data-structures/http/HttpClient.mjs +15 -0
  351. package/data-structures/http/index.d.ts +2 -0
  352. package/data-structures/index.d.ts +1 -0
  353. package/data-structures/provider-adapter/IProviderAdapter.d.ts +1 -3
  354. package/data-structures/snapshot/SnapshotFetcherService.d.ts +1 -1
  355. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -0
  356. package/data-structures/snapshot/{ClientAccessTokenSnapshotService.d.ts → evm-snapshots/ClientAccessTokenSnapshotService.d.ts} +2 -2
  357. package/data-structures/snapshot/{ClientAccessTokenSnapshotService.mjs → evm-snapshots/ClientAccessTokenSnapshotService.mjs} +13 -9
  358. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -0
  359. package/data-structures/snapshot/{ClientApprovalsSnapshotService.d.ts → evm-snapshots/ClientApprovalsSnapshotService.d.ts} +2 -3
  360. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +43 -0
  361. package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -0
  362. package/data-structures/snapshot/{ClientCommitmentsSnapshotService.d.ts → evm-snapshots/ClientCommitmentsSnapshotService.d.ts} +2 -2
  363. package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +35 -0
  364. package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -0
  365. package/data-structures/snapshot/{ClientNullifierSnapshotService.d.ts → evm-snapshots/ClientNullifierSnapshotService.d.ts} +2 -2
  366. package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +34 -0
  367. package/data-structures/snapshot/index.d.ts +7 -0
  368. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -0
  369. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.d.ts +8 -0
  370. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +42 -0
  371. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -0
  372. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.d.ts +8 -0
  373. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +34 -0
  374. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -0
  375. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.d.ts +8 -0
  376. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +34 -0
  377. package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
  378. package/data-structures/token-price-fetcher/TokenChecker.mjs +5 -4
  379. package/data-structures/utxo/Utxo.cjs +1 -1
  380. package/data-structures/utxo/Utxo.d.ts +6 -1
  381. package/data-structures/utxo/Utxo.mjs +37 -24
  382. package/error-handling/error-codes.constants.cjs +1 -1
  383. package/error-handling/error-codes.constants.d.ts +2 -0
  384. package/error-handling/error-codes.constants.mjs +4 -2
  385. package/functions/connectors.types.d.ts +14 -0
  386. package/functions/index.d.ts +1 -0
  387. package/functions/pre-transaction/addressTableLookup.cjs +1 -0
  388. package/functions/pre-transaction/addressTableLookup.d.ts +4 -0
  389. package/functions/pre-transaction/addressTableLookup.mjs +44 -0
  390. package/functions/pre-transaction/constructAdminData.cjs +1 -1
  391. package/functions/pre-transaction/constructAdminData.d.ts +2 -1
  392. package/functions/pre-transaction/constructAdminData.mjs +30 -12
  393. package/functions/pre-transaction/convert-okx-instructions.cjs +1 -0
  394. package/functions/pre-transaction/convert-okx-instructions.d.ts +12 -0
  395. package/functions/pre-transaction/convert-okx-instructions.mjs +30 -0
  396. package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -0
  397. package/functions/pre-transaction/getSolanaCalldataHash.d.ts +4 -0
  398. package/functions/pre-transaction/getSolanaCalldataHash.mjs +36 -0
  399. package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
  400. package/functions/pre-transaction/getVolatileTransferAmount.mjs +11 -7
  401. package/functions/pre-transaction/index.d.ts +10 -0
  402. package/functions/pre-transaction/initTokenLimitIfNeeded.cjs +1 -0
  403. package/functions/pre-transaction/initTokenLimitIfNeeded.d.ts +3 -0
  404. package/functions/pre-transaction/initTokenLimitIfNeeded.mjs +20 -0
  405. package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
  406. package/functions/pre-transaction/outputUtxoProcessing.mjs +14 -13
  407. package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
  408. package/functions/pre-transaction/process-gas-estimates.d.ts +2 -2
  409. package/functions/pre-transaction/process-gas-estimates.mjs +13 -12
  410. package/functions/pre-transaction/recipientUtxoProcessing.cjs +1 -0
  411. package/functions/pre-transaction/recipientUtxoProcessing.d.ts +3 -0
  412. package/functions/pre-transaction/recipientUtxoProcessing.mjs +36 -0
  413. package/functions/pre-transaction/sendInitNullifiersTransaction.cjs +1 -0
  414. package/functions/pre-transaction/sendInitNullifiersTransaction.d.ts +11 -0
  415. package/functions/pre-transaction/sendInitNullifiersTransaction.mjs +41 -0
  416. package/functions/pre-transaction/sendV0Transaction.cjs +1 -0
  417. package/functions/pre-transaction/sendV0Transaction.d.ts +22 -0
  418. package/functions/pre-transaction/sendV0Transaction.mjs +121 -0
  419. package/functions/pre-transaction/solana-public-signals.cjs +1 -0
  420. package/functions/pre-transaction/solana-public-signals.d.ts +19 -0
  421. package/functions/pre-transaction/solana-public-signals.mjs +60 -0
  422. package/functions/pre-transaction/solana.cjs +1 -0
  423. package/functions/pre-transaction/solana.d.ts +17 -0
  424. package/functions/pre-transaction/solana.mjs +96 -0
  425. package/functions/pre-transaction/solanaTransfer.utils.cjs +1 -0
  426. package/functions/pre-transaction/solanaTransfer.utils.d.ts +6 -0
  427. package/functions/pre-transaction/solanaTransfer.utils.mjs +38 -0
  428. package/functions/pre-transaction/store-instructions.cjs +1 -0
  429. package/functions/pre-transaction/store-instructions.d.ts +4 -0
  430. package/functions/pre-transaction/store-instructions.mjs +9 -0
  431. package/functions/pre-transaction/store-proof.cjs +1 -0
  432. package/functions/pre-transaction/store-proof.d.ts +7 -0
  433. package/functions/pre-transaction/store-proof.mjs +55 -0
  434. package/functions/private-wallet/emporium.helpers.cjs +1 -1
  435. package/functions/private-wallet/emporium.helpers.mjs +33 -29
  436. package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
  437. package/functions/private-wallet/emporium.swap.helpers.d.ts +1 -1
  438. package/functions/private-wallet/emporium.swap.helpers.mjs +79 -69
  439. package/functions/snarkjs/constant.cjs +1 -1
  440. package/functions/snarkjs/constant.d.ts +40 -0
  441. package/functions/snarkjs/constant.mjs +66 -23
  442. package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
  443. package/functions/snarkjs/constructEmporiumProof.mjs +32 -32
  444. package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
  445. package/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
  446. package/functions/snarkjs/constructGeneralZkProof.mjs +63 -61
  447. package/functions/snarkjs/constructSolanaZkProof.cjs +1 -0
  448. package/functions/snarkjs/constructSolanaZkProof.d.ts +13 -0
  449. package/functions/snarkjs/constructSolanaZkProof.mjs +109 -0
  450. package/functions/snarkjs/generateCircomData.cjs +1 -1
  451. package/functions/snarkjs/generateCircomData.d.ts +1 -1
  452. package/functions/snarkjs/generateCircomData.mjs +9 -9
  453. package/functions/snarkjs/generateZkProofEnclave.cjs +1 -1
  454. package/functions/snarkjs/generateZkProofEnclave.mjs +10 -9
  455. package/functions/snarkjs/getZKFiles.cjs +1 -1
  456. package/functions/snarkjs/getZKFiles.mjs +13 -13
  457. package/functions/snarkjs/index.d.ts +1 -0
  458. package/functions/utils/addresses.cjs +1 -1
  459. package/functions/utils/addresses.d.ts +1 -1
  460. package/functions/utils/addresses.mjs +21 -17
  461. package/functions/utils/amounts.utils.cjs +1 -1
  462. package/functions/utils/amounts.utils.d.ts +1 -0
  463. package/functions/utils/amounts.utils.mjs +53 -40
  464. package/functions/utils/bytes32.utils.cjs +1 -0
  465. package/functions/utils/bytes32.utils.d.ts +2 -0
  466. package/functions/utils/bytes32.utils.mjs +10 -0
  467. package/functions/utils/cacheDevice.utils.cjs +1 -1
  468. package/functions/utils/cacheDevice.utils.mjs +2 -3
  469. package/functions/utils/cacheFunctions.cjs +1 -1
  470. package/functions/utils/cacheFunctions.mjs +53 -52
  471. package/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
  472. package/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -0
  473. package/functions/utils/create-provider.cjs +1 -1
  474. package/functions/utils/create-provider.d.ts +4 -1
  475. package/functions/utils/create-provider.mjs +8 -6
  476. package/functions/utils/encodeTokenWithId.cjs +1 -1
  477. package/functions/utils/encodeTokenWithId.d.ts +1 -1
  478. package/functions/utils/encodeTokenWithId.mjs +6 -2
  479. package/functions/utils/encryptInputForEnclave.cjs +1 -1
  480. package/functions/utils/encryptInputForEnclave.mjs +29 -28
  481. package/functions/utils/erc20tokenFunctions.cjs +1 -1
  482. package/functions/utils/erc20tokenFunctions.mjs +29 -29
  483. package/functions/utils/ethers-formatter.utils.cjs +1 -1
  484. package/functions/utils/ethers-formatter.utils.d.ts +2 -0
  485. package/functions/utils/ethers-formatter.utils.mjs +45 -15
  486. package/functions/utils/evmNetworkFunctions.cjs +1 -1
  487. package/functions/utils/evmNetworkFunctions.mjs +3 -4
  488. package/functions/utils/fees.utils.cjs +1 -1
  489. package/functions/utils/fees.utils.d.ts +1 -0
  490. package/functions/utils/fees.utils.mjs +19 -9
  491. package/functions/utils/get-hinkal-approvals.cjs +1 -1
  492. package/functions/utils/get-hinkal-approvals.mjs +1 -1
  493. package/functions/utils/getBlockExplorerUrl.cjs +1 -1
  494. package/functions/utils/getBlockExplorerUrl.mjs +2 -2
  495. package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
  496. package/functions/utils/getRecipientInfoFromUserKeys.d.ts +0 -1
  497. package/functions/utils/getRecipientInfoFromUserKeys.mjs +10 -13
  498. package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -0
  499. package/functions/utils/getUtxosFromReceipt.utils.d.ts +4 -0
  500. package/functions/utils/getUtxosFromReceipt.utils.mjs +29 -0
  501. package/functions/utils/getUtxosFromReceiptSolana.cjs +1 -0
  502. package/functions/utils/getUtxosFromReceiptSolana.d.ts +5 -0
  503. package/functions/utils/getUtxosFromReceiptSolana.mjs +19 -0
  504. package/functions/utils/index.d.ts +5 -1
  505. package/functions/utils/networks.utils.cjs +1 -1
  506. package/functions/utils/networks.utils.mjs +2 -3
  507. package/functions/utils/nftTokenFunctions.cjs +1 -1
  508. package/functions/utils/nftTokenFunctions.mjs +8 -4
  509. package/functions/utils/prepareHinkal.cjs +1 -0
  510. package/functions/utils/prepareHinkal.d.ts +7 -1
  511. package/functions/utils/prepareHinkal.mjs +88 -0
  512. package/functions/utils/publicBalance.utils.cjs +1 -1
  513. package/functions/utils/publicBalance.utils.d.ts +1 -0
  514. package/functions/utils/publicBalance.utils.mjs +75 -45
  515. package/functions/utils/solanaMint.utils.cjs +1 -0
  516. package/functions/utils/solanaMint.utils.d.ts +10 -0
  517. package/functions/utils/solanaMint.utils.mjs +14 -0
  518. package/functions/utils/time.utils.cjs +1 -1
  519. package/functions/utils/time.utils.d.ts +1 -1
  520. package/functions/utils/time.utils.mjs +11 -11
  521. package/functions/utils/userAgent.cjs +1 -1
  522. package/functions/utils/userAgent.mjs +6 -7
  523. package/functions/utils/walletBalances.utils.cjs +1 -1
  524. package/functions/utils/walletBalances.utils.d.ts +2 -1
  525. package/functions/utils/walletBalances.utils.mjs +18 -17
  526. package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  527. package/functions/web3/events/getInputUtxoAndBalance.mjs +98 -91
  528. package/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
  529. package/functions/web3/events/getInputUtxosEnclave.mjs +38 -16
  530. package/functions/web3/events/getShieldedBalance.cjs +2 -2
  531. package/functions/web3/events/getShieldedBalance.mjs +70 -62
  532. package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
  533. package/functions/web3/events/getTransactionLogEvents.d.ts +3 -2
  534. package/functions/web3/events/getTransactionLogEvents.mjs +12 -9
  535. package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -0
  536. package/functions/web3/fetchSolanaMerkleTreeRootHash.d.ts +4 -0
  537. package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +45 -0
  538. package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
  539. package/functions/web3/functionCalls/accessTokenCalls.d.ts +2 -0
  540. package/functions/web3/functionCalls/accessTokenCalls.mjs +25 -7
  541. package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  542. package/functions/web3/functionCalls/transactCallRelayer.d.ts +20 -0
  543. package/functions/web3/functionCalls/transactCallRelayer.mjs +61 -19
  544. package/functions/web3/getContractMetadata.cjs +1 -1
  545. package/functions/web3/getContractMetadata.mjs +20 -50
  546. package/functions/web3/getTokenHolder.cjs +1 -1
  547. package/functions/web3/getTokenHolder.mjs +29 -24
  548. package/functions/web3/index.d.ts +2 -0
  549. package/functions/web3/odosAPI.cjs +1 -1
  550. package/functions/web3/odosAPI.mjs +11 -8
  551. package/functions/web3/okxAPI.cjs +1 -0
  552. package/functions/web3/okxAPI.d.ts +8 -0
  553. package/functions/web3/okxAPI.mjs +43 -0
  554. package/functions/web3/oneInchAPI.cjs +1 -1
  555. package/functions/web3/oneInchAPI.mjs +7 -4
  556. package/functions/web3/runContractFunction.cjs +1 -1
  557. package/functions/web3/runContractFunction.mjs +22 -18
  558. package/functions/web3/signAndSendSerializedTransaction.cjs +1 -0
  559. package/functions/web3/signAndSendSerializedTransaction.d.ts +2 -0
  560. package/functions/web3/signAndSendSerializedTransaction.mjs +11 -0
  561. package/functions/web3/uniswapAPI.cjs +1 -1
  562. package/functions/web3/uniswapAPI.mjs +7 -4
  563. package/index.cjs +1 -1
  564. package/index.mjs +922 -810
  565. package/package.json +12 -16
  566. package/providers/CustomEthersProvider.cjs +1 -0
  567. package/providers/{TorExternalProvider.d.ts → CustomEthersProvider.d.ts} +2 -2
  568. package/providers/CustomEthersProvider.mjs +29 -0
  569. package/providers/CustomSolanaConnection.cjs +1 -0
  570. package/providers/CustomSolanaConnection.d.ts +4 -0
  571. package/providers/CustomSolanaConnection.mjs +33 -0
  572. package/providers/EthersProviderAdapter.cjs +1 -1
  573. package/providers/EthersProviderAdapter.d.ts +1 -2
  574. package/providers/EthersProviderAdapter.mjs +8 -48
  575. package/providers/SolanaProviderAdapter.cjs +1 -0
  576. package/providers/SolanaProviderAdapter.d.ts +44 -0
  577. package/providers/SolanaProviderAdapter.mjs +125 -0
  578. package/providers/WagmiProviderAdapter.cjs +1 -1
  579. package/providers/WagmiProviderAdapter.d.ts +1 -2
  580. package/providers/WagmiProviderAdapter.mjs +26 -24
  581. package/providers/prepareEthersHinkal.cjs +1 -1
  582. package/providers/prepareEthersHinkal.mjs +10 -7
  583. package/providers/prepareWagmiHinkal.cjs +1 -1
  584. package/providers/prepareWagmiHinkal.mjs +9 -6
  585. package/types/IMultiThreadedUtxoUtils.d.ts +2 -2
  586. package/types/TransactionSimulator.types.d.ts +1 -0
  587. package/types/activities.types.cjs +1 -1
  588. package/types/activities.types.d.ts +1 -0
  589. package/types/activities.types.mjs +6 -4
  590. package/types/admin.types.cjs +1 -1
  591. package/types/admin.types.d.ts +16 -0
  592. package/types/admin.types.mjs +1 -1
  593. package/types/all-points.types.d.ts +0 -1
  594. package/types/cache.types.cjs +1 -1
  595. package/types/cache.types.d.ts +8 -1
  596. package/types/cache.types.mjs +1 -1
  597. package/types/circom-data.types.d.ts +6 -0
  598. package/types/commitments.types.d.ts +12 -0
  599. package/types/ethereum-network.types.cjs +1 -1
  600. package/types/ethereum-network.types.d.ts +9 -3
  601. package/types/ethereum-network.types.mjs +1 -1
  602. package/types/external-action.types.cjs +1 -1
  603. package/types/external-action.types.d.ts +3 -1
  604. package/types/external-action.types.mjs +2 -2
  605. package/types/hinkal.types.cjs +1 -1
  606. package/types/hinkal.types.d.ts +3 -2
  607. package/types/hinkal.types.mjs +8 -8
  608. package/types/http.types.d.ts +8 -0
  609. package/types/index.d.ts +3 -2
  610. package/types/new-rewards.type.d.ts +2 -9
  611. package/types/offscreen.types.cjs +1 -1
  612. package/types/offscreen.types.d.ts +2 -1
  613. package/types/offscreen.types.mjs +2 -2
  614. package/types/okx.types.d.ts +57 -0
  615. package/types/rewards.types.d.ts +0 -11
  616. package/types/sandbox.types.cjs +1 -1
  617. package/types/sandbox.types.d.ts +19 -2
  618. package/types/sandbox.types.mjs +2 -2
  619. package/types/solana.types.d.ts +75 -0
  620. package/types/token.types.d.ts +6 -0
  621. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  622. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  623. package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
  624. package/webworker/snarkjsWorker/snarkjsWorkerLogic.d.ts +0 -1
  625. package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +28 -30
  626. package/webworker/utxoWorker/utxoWorker.types.d.ts +2 -0
  627. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  628. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  629. package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
  630. package/webworker/utxoWorker/utxoWorkerLogic.mjs +33 -31
  631. package/webworker/viteWorkerURL.constant.cjs +21 -1
  632. package/webworker/viteWorkerURL.constant.mjs +21 -12
  633. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  634. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
  635. package/API/mysteryBoxesCalls.cjs +0 -1
  636. package/API/mysteryBoxesCalls.d.ts +0 -60
  637. package/API/mysteryBoxesCalls.mjs +0 -66
  638. package/assets/snarkjsWorkerLauncher-CWaDqRaL.js +0 -14803
  639. package/assets/utxoWorkerLauncher-BUhBaUSg.js +0 -115868
  640. package/assets/zkProofWorkerLauncher-DlWQP3l9.js +0 -115360
  641. package/constants/mystery-boxes.constants.cjs +0 -1
  642. package/constants/mystery-boxes.constants.d.ts +0 -63
  643. package/constants/mystery-boxes.constants.mjs +0 -355
  644. package/data-structures/event-service/AbstractAccessTokenSnapshotService.cjs +0 -1
  645. package/data-structures/event-service/AbstractApprovalsSnapshotService.cjs +0 -1
  646. package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +0 -1
  647. package/data-structures/event-service/AbstractEventService.cjs +0 -1
  648. package/data-structures/event-service/AbstractEventService.mjs +0 -33
  649. package/data-structures/event-service/AbstractSnapshotService.cjs +0 -1
  650. package/data-structures/event-service/BlockchainEventEmitter.cjs +0 -1
  651. package/data-structures/event-service/BlockchainEventEmitter.mjs +0 -80
  652. package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +0 -1
  653. package/data-structures/snapshot/ClientApprovalsSnapshotService.cjs +0 -1
  654. package/data-structures/snapshot/ClientApprovalsSnapshotService.mjs +0 -23
  655. package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +0 -1
  656. package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +0 -31
  657. package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +0 -1
  658. package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +0 -30
  659. package/functions/utils/mystery-box-auction.utils.cjs +0 -1
  660. package/functions/utils/mystery-box-auction.utils.d.ts +0 -8
  661. package/functions/utils/mystery-box-auction.utils.mjs +0 -51
  662. package/providers/TorExternalProvider.cjs +0 -1
  663. package/providers/TorExternalProvider.mjs +0 -29
  664. package/types/merch-order.types.cjs +0 -1
  665. package/types/merch-order.types.d.ts +0 -16
  666. package/types/merch-order.types.mjs +0 -4
  667. package/types/mystery-boxes.types.cjs +0 -1
  668. package/types/mystery-boxes.types.d.ts +0 -43
  669. package/types/mystery-boxes.types.mjs +0 -6
  670. /package/data-structures/event-service/{AbstractNullifierSnapshotService.cjs → evm/AbstractNullifierSnapshotService.cjs} +0 -0
  671. /package/data-structures/event-service/{AbstractNullifierSnapshotService.mjs → evm/AbstractNullifierSnapshotService.mjs} +0 -0
  672. /package/data-structures/event-service/{AbstractSnapshotService.d.ts → evm/AbstractSnapshotService.d.ts} +0 -0
@@ -1,17 +1,21 @@
1
- import { utils as g, ethers as h } from "ethers";
2
- import m from "libsodium-wrappers";
3
- import { CIRCOM_P as d } from "../../constants/protocol.constants.mjs";
4
- import { babyJubInstance as p } from "../../crypto/babyJub.mjs";
5
- import { poseidonHash as a } from "../../crypto/poseidon.mjs";
6
- import { getCircomSign as l } from "./keyUtils.mjs";
7
- import { AttachableMemoryCacheDevice as u } from "../cacheDevices/AttachableMemoryCacheDevice.mjs";
8
- import { ethers as c } from "ethers-v6h";
9
- import { networkRegistry as K } from "../../constants/chains.constants.mjs";
10
- const P = new u(), v = new u(), C = {
1
+ import { utils as o, ethers as d } from "ethers";
2
+ import w from "libsodium-wrappers";
3
+ import { CIRCOM_P as m } from "../../constants/protocol.constants.mjs";
4
+ import { babyJubInstance as b } from "../../crypto/babyJub.mjs";
5
+ import { poseidonHash as c } from "../../crypto/poseidon.mjs";
6
+ import { getCircomSign as y } from "./keyUtils.mjs";
7
+ import { AttachableMemoryCacheDevice as v } from "../cacheDevices/AttachableMemoryCacheDevice.mjs";
8
+ import { ethers as u, hexlify as F } from "ethers-v6h";
9
+ import { isSolanaLike as h, networkRegistry as p } from "../../constants/chains.constants.mjs";
10
+ import { Keypair as g, VersionedTransaction as K } from "@solana/web3.js";
11
+ import k from "tweetnacl";
12
+ import P from "bs58";
13
+ import { createCustomSolanaConnection as A } from "../../functions/utils/create-provider.mjs";
14
+ const E = new v(), R = new v(), L = {
11
15
  privateKey: "",
12
16
  publicKey: ""
13
17
  };
14
- class D {
18
+ class l {
15
19
  signature;
16
20
  constructor(e) {
17
21
  this.signature = e;
@@ -27,80 +31,133 @@ class D {
27
31
  throw Error("No signature provided");
28
32
  }
29
33
  verifyMessage(e) {
30
- return this.requireSignature(), g.verifyMessage(e, this.signature);
34
+ return this.requireSignature(), o.verifyMessage(e, this.signature);
31
35
  }
32
36
  /**
33
37
  * get shielded private key from message signature used to login to the application,
34
38
  * this private key is used to generate encryption keypairs as well as public key
35
39
  * @retuns 0x-prefixed shielded private key
36
40
  */
37
- getShieldedPrivateKey = () => (this.requireSignature(), h.utils.keccak256(this.signature));
41
+ getShieldedPrivateKey = () => (this.requireSignature(), d.utils.keccak256(this.signature));
38
42
  /**
39
43
  * generate shielded public key from private key
40
44
  * @param privateKey the key used to generate the shielded public key, this should be the signature
41
45
  * that the user provided
42
46
  * @retuns shielded public key in hexstring with 0x prefixed
43
47
  */
44
- getShieldedPublicKey = () => (this.requireSignature(), a(this.getShieldedPrivateKey()));
48
+ getShieldedPublicKey = () => (this.requireSignature(), c(this.getShieldedPrivateKey()));
49
+ /**
50
+ * deterministically derive an EVM address from the shielded private key
51
+ */
52
+ getDerivedEthereumAddress = () => (this.requireSignature(), new u.Wallet(this.getShieldedPrivateKey()).address);
53
+ /**
54
+ * deterministically derive a Solana public key from the shielded private key
55
+ */
56
+ getDerivedSolanaPublicKey = () => (this.requireSignature(), g.fromSeed(o.arrayify(this.getShieldedPrivateKey())).publicKey.toBase58());
45
57
  /**
46
58
  * generate access token, this accessKey is what should be sent to the server for signing
47
59
  * @returns accessKey in hexstring with 0x prefixed
48
60
  */
49
- getAccessKey = () => (this.requireSignature(), a(this.getShieldedPrivateKey(), this.getShieldedPublicKey()));
50
- static getSignerAddressFromPrivateKey(e) {
51
- return new c.Wallet(e).address;
52
- }
53
- static deriveSignerFromNonce(e, t) {
54
- const r = a(t, e.getShieldedPrivateKey(), e.getShieldedPublicKey()), i = g.keccak256(g.toUtf8Bytes(r));
55
- return new c.Wallet(i);
56
- }
57
- static async signMessageFromPrivateKey(e, t) {
58
- const r = new c.Wallet(e), i = g.isHexString(t) ? g.arrayify(t) : t;
59
- return r.signMessage(i);
60
- }
61
- static signTypedDataFromPrivateKey(e, t, r, i) {
62
- return new c.Wallet(e).signTypedData(t, r, i);
63
- }
64
- static async authorizeDelegationFromPrivateKey(e, t, r, i) {
65
- const n = new c.Wallet(e), s = new c.JsonRpcProvider(K[t].fetchRpcUrl);
66
- return n.connect(s).authorize({
67
- address: r,
68
- ...i !== void 0 && { nonce: i }
69
- });
61
+ getAccessKey = () => (this.requireSignature(), c(this.getShieldedPrivateKey(), this.getShieldedPublicKey()));
62
+ getSignerPrivateKeyFromNonce = (e) => {
63
+ this.requireSignature();
64
+ const r = c(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
65
+ return o.keccak256(o.toUtf8Bytes(r));
66
+ };
67
+ getSignerSolanaPrivateKeyFromNonce = (e) => {
68
+ const r = this.getSignerPrivateKeyFromNonce(e), t = o.arrayify(r), i = g.fromSeed(t);
69
+ return P.encode(i.secretKey);
70
+ };
71
+ getEvmPrivateKeyFromSolanaPrivateKey = (e) => {
72
+ const t = P.decode(e).slice(0, 32);
73
+ return F(t);
74
+ };
75
+ static getSignerFromPrivateKey = (e, r) => {
76
+ if (h(e)) {
77
+ const i = o.arrayify(r);
78
+ return g.fromSeed(i);
79
+ }
80
+ return new u.Wallet(r);
81
+ };
82
+ static getSignerAddressFromPrivateKey(e, r) {
83
+ const t = l.getSignerFromPrivateKey(e, r);
84
+ return t instanceof g ? t.publicKey.toString() : t.address;
70
85
  }
71
- getWalletSalt = (e) => (this.requireSignature(), a(this.getShieldedPublicKey(), this.getShieldedPrivateKey(), e));
86
+ static signMessageFromPrivateKey = async (e, r, t) => {
87
+ const i = l.getSignerFromPrivateKey(e, r);
88
+ if (i instanceof g) {
89
+ const a = o.isHexString(t) ? o.arrayify(t) : new TextEncoder().encode(t), s = k.sign.detached(a, i.secretKey);
90
+ return `0x${Buffer.from(s).toString("hex")}`;
91
+ }
92
+ const n = o.isHexString(t) ? o.arrayify(t) : t;
93
+ return i.signMessage(n);
94
+ };
95
+ static signSolanaTransactionFromPrivateKey = (e, r, t) => {
96
+ if (!h(e))
97
+ throw new Error("Solana transaction signing is only available for Solana chains");
98
+ const i = l.getSignerFromPrivateKey(e, r);
99
+ if (!(i instanceof g))
100
+ throw new Error("Unable to derive Solana keypair for signing");
101
+ t.sign([i]);
102
+ };
103
+ static sendAndSignTransactionFromPrivateKey = async (e, r, t) => {
104
+ const i = l.getSignerFromPrivateKey(e, r), { fetchRpcUrl: n } = p[e];
105
+ if (!n)
106
+ throw new Error("No RPC URL found for chainId");
107
+ if (i instanceof g) {
108
+ if (!(t instanceof K))
109
+ throw new Error("Invalid transaction type for Solana");
110
+ return t.sign([i]), await A(n).sendRawTransaction(t.serialize());
111
+ }
112
+ if (t instanceof K)
113
+ throw new Error("Invalid transaction type for EVM");
114
+ const a = new u.JsonRpcProvider(n);
115
+ return (await i.connect(a).sendTransaction(t)).hash;
116
+ };
117
+ static signTypedDataFromPrivateKey = async (e, r, t, i, n) => {
118
+ if (h(e))
119
+ throw new Error("Solana does not support typed data");
120
+ return await l.getSignerFromPrivateKey(e, r).signTypedData(t, i, n);
121
+ };
122
+ static authorizeDelegation = async (e, r, t, i) => {
123
+ if (h(e))
124
+ throw new Error("Solana does not support delegation");
125
+ const n = new u.JsonRpcProvider(p[e].fetchRpcUrl);
126
+ return await l.getSignerFromPrivateKey(e, r).connect(n).authorize({ address: t, ...i !== void 0 && { nonce: i } });
127
+ };
128
+ getWalletSalt = (e) => (this.requireSignature(), c(this.getShieldedPublicKey(), this.getShieldedPrivateKey(), e));
72
129
  /**
73
130
  * generate inHinkalAddress - a user unique address linking him with a specific app
74
131
  * @returns inHinkalAddress in bigint
75
132
  */
76
133
  getInHinkalAddress = (e) => {
77
134
  this.requireSignature();
78
- const t = a(this.getShieldedPrivateKey(), e);
79
- return BigInt(t);
135
+ const r = c(this.getShieldedPrivateKey(), e);
136
+ return BigInt(r);
80
137
  };
81
138
  /**
82
139
  * generate backend token, which is used for access control on backend
83
140
  * @returns accessKey in hexstring with 0x prefixed
84
141
  */
85
- getBackendToken = () => (this.requireSignature(), a(this.getAccessKey(), this.getShieldedPublicKey()));
86
- static getRandomizedStealthPair = P.attach(
87
- (e, t) => {
88
- const r = p(), i = BigInt(t) % d, n = e * i % d, s = r.mulPointEscalar(r.Base8, e), o = r.mulPointEscalar(r.Base8, n), y = [BigInt(r.F.toString(s[0])), BigInt(r.F.toString(s[1]))], S = [BigInt(r.F.toString(o[0])), BigInt(r.F.toString(o[1]))];
89
- return { H0: y, H1: S };
142
+ getBackendToken = () => (this.requireSignature(), c(this.getAccessKey(), this.getShieldedPublicKey()));
143
+ static getRandomizedStealthPair = E.attach(
144
+ (e, r) => {
145
+ const t = b(), i = BigInt(r) % m, n = e * i % m, a = t.mulPointEscalar(t.Base8, e), s = t.mulPointEscalar(t.Base8, n), S = [BigInt(t.F.toString(a[0])), BigInt(t.F.toString(a[1]))], f = [BigInt(t.F.toString(s[0])), BigInt(t.F.toString(s[1]))];
146
+ return { H0: S, H1: f };
90
147
  }
91
148
  );
92
- static getStealthAddressCompressedPoints = (e, t) => {
93
- const { H0: r, H1: i } = this.getRandomizedStealthPair(e, t), [n, s] = [r, i].map((o) => BigInt(o[1]) + 2n ** 255n * l(o[0]));
94
- return { h0: n, h1: s };
149
+ static getStealthAddressCompressedPoints = (e, r) => {
150
+ const { H0: t, H1: i } = this.getRandomizedStealthPair(e, r), [n, a] = [t, i].map((s) => BigInt(s[1]) + 2n ** 255n * y(s[0]));
151
+ return { h0: n, h1: a };
95
152
  };
96
- static getStealthAddress = v.attach((e, t) => {
97
- const { H0: r, H1: i } = this.getRandomizedStealthPair(e, t), s = [2n * l(r[0]) + l(i[0]), r[1], i[1]];
98
- return a(...s);
153
+ static getStealthAddress = R.attach((e, r) => {
154
+ const { H0: t, H1: i } = this.getRandomizedStealthPair(e, r), a = [2n * y(t[0]) + y(i[0]), t[1], i[1]];
155
+ return c(...a);
99
156
  });
100
- static getStealthAddressWithEKey = (e, t) => ({ stealthAddress: this.getStealthAddress(e, t), encryptionKey: this.getEncryptionKeyPair(t).publicKey });
101
- static checkSignature = (e, t, r, i) => {
102
- const { h0: n, h1: s } = this.getStealthAddressCompressedPoints(e, i);
103
- return t === n && r === s;
157
+ static getStealthAddressWithEKey = (e, r) => ({ stealthAddress: this.getStealthAddress(e, r), encryptionKey: this.getEncryptionKeyPair(r).publicKey });
158
+ static checkSignature = (e, r, t, i) => {
159
+ const { h0: n, h1: a } = this.getStealthAddressCompressedPoints(e, i);
160
+ return r === n && t === a;
104
161
  };
105
162
  /**
106
163
  * generate private and public keypair
@@ -108,16 +165,16 @@ class D {
108
165
  * and must correspond to 32 bytes
109
166
  */
110
167
  static getEncryptionKeyPair = (e) => {
111
- const t = m.crypto_box_seed_keypair(h.utils.arrayify(e));
168
+ const r = w.crypto_box_seed_keypair(d.utils.arrayify(e));
112
169
  return {
113
- privateKey: h.utils.hexlify(t.privateKey),
114
- publicKey: h.utils.hexlify(t.publicKey)
170
+ privateKey: d.utils.hexlify(r.privateKey),
171
+ publicKey: d.utils.hexlify(r.publicKey)
115
172
  };
116
173
  };
117
174
  }
118
175
  export {
119
- C as EncryptionKeyPairDefaultValue,
120
- D as UserKeys,
121
- v as stealthAddressCacheDevice,
122
- P as stealthPairCacheDevice
176
+ L as EncryptionKeyPairDefaultValue,
177
+ l as UserKeys,
178
+ R as stealthAddressCacheDevice,
179
+ E as stealthPairCacheDevice
123
180
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../constants/protocol.constants.cjs"),a=require("../../../crypto/poseidon.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const t=require("../../../functions/utils/amounts.utils.cjs"),o=require("../../merkle-tree/MerkleTree.cjs");require("ethers");require("../../../error-handling/error-codes.constants.cjs");const l=require("./AbstractSnapshotService.cjs"),i=require("../../../functions/utils/merkleTree.utils.cjs");class u extends l.AbstractSnapshotService{constructor(e){super(e,"NewAccessKeyAdded")}_merkleTree;_senderAddresses;_senderAddressIndexMap;get merkleTree(){return this._merkleTree}get senderAddresses(){return this._senderAddresses}get senderAddressIndexMap(){return this._senderAddressIndexMap}serializeSnapshot(e){return{merkleTree:e.payload.merkleTree.toJSON(),senderAddresses:Array.from(e.payload.senderAddresses),latestBlockNumber:e.latestBlockNumber,senderAddressIndexMap:Array.from(e.payload.senderAddressIndexMap).map(([s,r])=>({address:s,index:r}))}}deserializeSnapshot(e){let s,r;return e.latestBlockNumber&&e.merkleTree?s=i.contructMerkleTreeFromSerialized(e.merkleTree):s=o.MerkleTree.create(a.poseidonFunction,0n),e.latestBlockNumber&&e.senderAddressIndexMap?r=new Map(e.senderAddressIndexMap.map(({address:d,index:n})=>[d,n])):r=new Map,{latestBlockNumber:e.latestBlockNumber??0,payload:{merkleTree:s,senderAddresses:e.senderAddresses??[],senderAddressIndexMap:r}}}acceptEvent(e,s){try{return this._merkleTree.insert(e.accessKey,e.index),this._senderAddressIndexMap.set(e.senderAddress,Math.max(Number(e.index),this._senderAddressIndexMap.get(e.senderAddress)??0)),this._senderAddresses.includes(e.senderAddress)||this._senderAddresses.push(e.senderAddress),e.accessKey===0n&&e.senderAddress===c.zeroAddress&&this._merkleTree.remove(e.index),!0}catch(r){return console.error(r),!1}}mapEvent(e){const{accessKey:s,index:r,senderAddress:d}=e;return{accessKey:t.toBigInt(s),index:t.toBigInt(r),senderAddress:d}}getSnapshotPayload(){return{merkleTree:this._merkleTree,senderAddresses:this._senderAddresses,senderAddressIndexMap:this._senderAddressIndexMap}}populateSnapshot({payload:{merkleTree:e,senderAddresses:s,senderAddressIndexMap:r}}){this._merkleTree=e,this._senderAddresses=s,this._senderAddressIndexMap=r}}exports.AbstractAccessTokenSnapshotService=u;
@@ -1,5 +1,5 @@
1
- import { MerkleTree, MerkleTreeJson } from '../merkle-tree';
2
- import { AccessTokenEvent } from '../../types';
1
+ import { MerkleTree, MerkleTreeJson } from '../../merkle-tree';
2
+ import { AccessTokenEvent } from '../../../types';
3
3
  import { AbstractSnapshotService, Snapshot } from './AbstractSnapshotService';
4
4
  import { BlockchainEventEmitter } from './BlockchainEventEmitter';
5
5
  export type SenderAddressIndexMapJson = {
@@ -1,15 +1,15 @@
1
- import { zeroAddress as m } from "../../constants/protocol.constants.mjs";
2
- import { poseidonFunction as o } from "../../crypto/poseidon.mjs";
1
+ import { zeroAddress as m } from "../../../constants/protocol.constants.mjs";
2
+ import { poseidonFunction as o } from "../../../crypto/poseidon.mjs";
3
3
  import "circomlibjs-hinkal-fork";
4
4
  import "libsodium-wrappers";
5
5
  import "process";
6
6
  import "buffer";
7
- import { toBigInt as t } from "../../functions/utils/amounts.utils.mjs";
8
- import { MerkleTree as a } from "../merkle-tree/MerkleTree.mjs";
7
+ import { toBigInt as t } from "../../../functions/utils/amounts.utils.mjs";
8
+ import { MerkleTree as a } from "../../merkle-tree/MerkleTree.mjs";
9
9
  import "ethers";
10
- import "../../error-handling/error-codes.constants.mjs";
10
+ import "../../../error-handling/error-codes.constants.mjs";
11
11
  import { AbstractSnapshotService as l } from "./AbstractSnapshotService.mjs";
12
- import { contructMerkleTreeFromSerialized as A } from "../../functions/utils/merkleTree.utils.mjs";
12
+ import { contructMerkleTreeFromSerialized as A } from "../../../functions/utils/merkleTree.utils.mjs";
13
13
  class b extends l {
14
14
  constructor(e) {
15
15
  super(e, "NewAccessKeyAdded");
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./AbstractSnapshotService.cjs"),v=require("../../../functions/utils/amounts.utils.cjs"),u=require("../../../functions/utils/caseInsensitive.utils.cjs");class A extends c.AbstractSnapshotService{constructor(e){super(e,"NewApprovedUtxo")}_approvals=new Map;events=new Set;get approvals(){return this._approvals}getEventKey(e,t,s){return typeof e!="bigint"||typeof s!="string"||typeof t!="string"?null:`${s}-${t}-${e}`}serializeSnapshot(e){const t=Object.fromEntries(e.payload.approvals),s=Object.entries(t).map(([p,i])=>{const l=i.map(n=>({amount:n.amount.toString(),tokenAddress:n.tokenAddress,inHinkalAddress:n.inHinkalAddress.toString()}));return[p,l]}),r=Object.fromEntries(s);return{latestBlockNumber:e.latestBlockNumber,approvals:r,events:[...this.events]}}deserializeSnapshot(e){const t=e.approvals,s=Object.entries(t).map(([p,i])=>{const l=i.map(n=>({amount:BigInt(n.amount),tokenAddress:n.tokenAddress,inHinkalAddress:BigInt(n.inHinkalAddress)}));return[p,l]}),r=new Map(s);return{latestBlockNumber:e.latestBlockNumber??0,payload:{approvals:r,events:new Set(e.events)}}}getSnapshotPayload(){return{approvals:this._approvals,events:this.events}}populateSnapshot({payload:{approvals:e,events:t}}){this._approvals=e,this.events=t}mapEvent(e){const{approveTo:t,tokenAddress:s,amount:r,inHinkalAddress:p}=e;return{approveTo:t,tokenAddress:s,amount:v.toBigInt(r),inHinkalAddress:v.toBigInt(p)}}acceptEvent(e,t,s){const r=this.getEventKey(e.inHinkalAddress,e.tokenAddress,s);if(r&&!this.events.has(r)){const{amount:p,tokenAddress:i,inHinkalAddress:l}=e,n={amount:p,tokenAddress:i,inHinkalAddress:l};let a=this.approvals.get(e.approveTo)||[],d=!1;for(let o=0;o<a.length;o+=1)u.caseInsensitiveEqual(i,a[o].tokenAddress)&&l===a[o].inHinkalAddress&&(a[o].amount+=p,d=!0);if(a=a.filter(o=>o.amount!==0n),d&&a.length===0)this.approvals.delete(e.approveTo);else{const o=d?a:[...a,n];this.approvals.set(e.approveTo,o)}return s&&this.events.add(r),!0}return!1}}exports.AbstractApprovalsSnapshotService=A;
@@ -1,7 +1,7 @@
1
1
  import { AbstractSnapshotService, Snapshot } from './AbstractSnapshotService';
2
- import { NewApprovedUtxoEvent } from '../../types/commitments.types';
2
+ import { NewApprovedUtxoEvent } from '../../../types/commitments.types';
3
3
  import { BlockchainEventEmitter } from './BlockchainEventEmitter';
4
- import { ApprovedUtxo } from '../../types/hinkal.types';
4
+ import { ApprovedUtxo } from '../../../types/hinkal.types';
5
5
  export type ApprovalsSnapshotPayload = {
6
6
  readonly approvals: Map<string, ApprovedUtxo[]>;
7
7
  readonly events: Set<string>;
@@ -1,6 +1,6 @@
1
1
  import { AbstractSnapshotService as c } from "./AbstractSnapshotService.mjs";
2
- import { toBigInt as v } from "../../functions/utils/amounts.utils.mjs";
3
- import { caseInsensitiveEqual as u } from "../../functions/utils/caseInsensitive.utils.mjs";
2
+ import { toBigInt as v } from "../../../functions/utils/amounts.utils.mjs";
3
+ import { caseInsensitiveEqual as u } from "../../../functions/utils/caseInsensitive.utils.mjs";
4
4
  class g extends c {
5
5
  constructor(e) {
6
6
  super(e, "NewApprovedUtxo");
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../crypto/poseidon.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const l=require("../../merkle-tree/MerkleTree.cjs");require("ethers");require("../../../error-handling/error-codes.constants.cjs");const u=require("../../../functions/utils/amounts.utils.cjs"),o=require("./AbstractSnapshotService.cjs"),p=require("../../../functions/utils/merkleTree.utils.cjs");class a extends o.AbstractSnapshotService{constructor(e){super(e,"NewCommitment")}_merkleTree;_encryptedOutputs;get merkleTree(){return this._merkleTree}get encryptedOutputs(){return this._encryptedOutputs}serializeSnapshot(e){return{merkleTree:e.payload.merkleTree.toJSON(),latestBlockNumber:e.latestBlockNumber,encryptedOutputs:e.payload.encryptedOutputs.map(t=>({value:t.value,isPositive:String(t.isPositive),isBlocked:t.isBlocked??!1}))}}deserializeSnapshot(e){let t;e.latestBlockNumber&&e.merkleTree?t=p.contructMerkleTreeFromSerialized(e.merkleTree):t=l.MerkleTree.create(c.poseidonFunction,0n);const s=e.encryptedOutputs?.map(r=>({value:r.value,isPositive:JSON.parse(r.isPositive),isBlocked:r.isBlocked??!1}));return{latestBlockNumber:e.latestBlockNumber??0,payload:{merkleTree:t,encryptedOutputs:s||[]}}}getSnapshotPayload(){return{merkleTree:this._merkleTree,encryptedOutputs:this._encryptedOutputs}}populateSnapshot({payload:{merkleTree:e,encryptedOutputs:t}}){this._merkleTree=e,this._encryptedOutputs=t}mapEvent(e){const{commitment:t,index:s,encryptedOutput:r}=e;return{commitment:u.toBigInt(t),index:u.toBigInt(s),encryptedOutput:r}}acceptEvent(e,t,s,r){if(!this.encryptedOutputs.map(i=>i.value).includes(e.encryptedOutput)){if(!this._merkleTree.insert(e.commitment,e.index>=0?e.index:-1n*e.index))return!1;const n={value:e.encryptedOutput,isPositive:e.index>=0n,isBlocked:r??!1};return this._encryptedOutputs.push(n),!0}return!1}}exports.AbstractCommitmentsSnapshotService=a;
@@ -1,5 +1,5 @@
1
- import { MerkleTree, MerkleTreeJson } from '../merkle-tree';
2
- import { CommitmentEvent, EncryptedOutputWithSign } from '../../types';
1
+ import { MerkleTree, MerkleTreeJson } from '../../merkle-tree';
2
+ import { CommitmentEvent, EncryptedOutputWithSign } from '../../../types';
3
3
  import { AbstractSnapshotService, Snapshot } from './AbstractSnapshotService';
4
4
  import { BlockchainEventEmitter } from './BlockchainEventEmitter';
5
5
  export type CommitmentsSnapshotPayload = {
@@ -25,5 +25,5 @@ export declare abstract class AbstractCommitmentsSnapshotService extends Abstrac
25
25
  };
26
26
  protected populateSnapshot({ payload: { merkleTree, encryptedOutputs }, }: Snapshot<CommitmentsSnapshotPayload>): void;
27
27
  protected mapEvent(event: CommitmentEvent): CommitmentEvent<bigint>;
28
- protected acceptEvent(event: CommitmentEvent<bigint>, _blockNumber: number): boolean;
28
+ protected acceptEvent(event: CommitmentEvent<bigint>, _blockNumber: number, _txHash?: string, isBlocked?: boolean): boolean;
29
29
  }
@@ -1,15 +1,15 @@
1
- import { poseidonFunction as p } from "../../crypto/poseidon.mjs";
1
+ import { poseidonFunction as m } from "../../../crypto/poseidon.mjs";
2
2
  import "circomlibjs-hinkal-fork";
3
3
  import "libsodium-wrappers";
4
4
  import "process";
5
5
  import "buffer";
6
- import { MerkleTree as s } from "../merkle-tree/MerkleTree.mjs";
6
+ import { MerkleTree as c } from "../../merkle-tree/MerkleTree.mjs";
7
7
  import "ethers";
8
- import "../../error-handling/error-codes.constants.mjs";
9
- import { toBigInt as i } from "../../functions/utils/amounts.utils.mjs";
10
- import { AbstractSnapshotService as m } from "./AbstractSnapshotService.mjs";
11
- import { contructMerkleTreeFromSerialized as n } from "../../functions/utils/merkleTree.utils.mjs";
12
- class S extends m {
8
+ import "../../../error-handling/error-codes.constants.mjs";
9
+ import { toBigInt as p } from "../../../functions/utils/amounts.utils.mjs";
10
+ import { AbstractSnapshotService as o } from "./AbstractSnapshotService.mjs";
11
+ import { contructMerkleTreeFromSerialized as n } from "../../../functions/utils/merkleTree.utils.mjs";
12
+ class b extends o {
13
13
  constructor(e) {
14
14
  super(e, "NewCommitment");
15
15
  }
@@ -27,22 +27,24 @@ class S extends m {
27
27
  latestBlockNumber: e.latestBlockNumber,
28
28
  encryptedOutputs: e.payload.encryptedOutputs.map((t) => ({
29
29
  value: t.value,
30
- isPositive: String(t.isPositive)
30
+ isPositive: String(t.isPositive),
31
+ isBlocked: t.isBlocked ?? !1
31
32
  }))
32
33
  };
33
34
  }
34
35
  deserializeSnapshot(e) {
35
36
  let t;
36
- e.latestBlockNumber && e.merkleTree ? t = n(e.merkleTree) : t = s.create(p, 0n);
37
- const r = e.encryptedOutputs?.map((u) => ({
38
- value: u.value,
39
- isPositive: JSON.parse(u.isPositive)
37
+ e.latestBlockNumber && e.merkleTree ? t = n(e.merkleTree) : t = c.create(m, 0n);
38
+ const s = e.encryptedOutputs?.map((r) => ({
39
+ value: r.value,
40
+ isPositive: JSON.parse(r.isPositive),
41
+ isBlocked: r.isBlocked ?? !1
40
42
  }));
41
43
  return {
42
44
  latestBlockNumber: e.latestBlockNumber ?? 0,
43
45
  payload: {
44
46
  merkleTree: t,
45
- encryptedOutputs: r || []
47
+ encryptedOutputs: s || []
46
48
  }
47
49
  };
48
50
  }
@@ -58,20 +60,21 @@ class S extends m {
58
60
  this._merkleTree = e, this._encryptedOutputs = t;
59
61
  }
60
62
  mapEvent(e) {
61
- const { commitment: t, index: r, encryptedOutput: u } = e;
63
+ const { commitment: t, index: s, encryptedOutput: r } = e;
62
64
  return {
63
- commitment: i(t),
64
- index: i(r),
65
- encryptedOutput: u
65
+ commitment: p(t),
66
+ index: p(s),
67
+ encryptedOutput: r
66
68
  };
67
69
  }
68
- acceptEvent(e, t) {
69
- if (!this.encryptedOutputs.map((r) => r.value).includes(e.encryptedOutput)) {
70
+ acceptEvent(e, t, s, r) {
71
+ if (!this.encryptedOutputs.map((i) => i.value).includes(e.encryptedOutput)) {
70
72
  if (!this._merkleTree.insert(e.commitment, e.index >= 0 ? e.index : -1n * e.index))
71
73
  return !1;
72
74
  const u = {
73
75
  value: e.encryptedOutput,
74
- isPositive: e.index >= 0n
76
+ isPositive: e.index >= 0n,
77
+ isBlocked: r ?? !1
75
78
  };
76
79
  return this._encryptedOutputs.push(u), !0;
77
80
  }
@@ -79,5 +82,5 @@ class S extends m {
79
82
  }
80
83
  }
81
84
  export {
82
- S as AbstractCommitmentsSnapshotService
85
+ b as AbstractCommitmentsSnapshotService
83
86
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../../../functions/utils/resolve-sync.utils.cjs");class h{blockchainEventEmitter;eventName;constructor(e,t){this.blockchainEventEmitter=e,this.eventName=t,e.addEventProcessorFunction(this.processEventsPage.bind(this))}get latestBlockNumber(){return this.blockchainEventEmitter.latestBlockNumber}intervalClear(){this.blockchainEventEmitter.intervalClear()}async processEventsPage(e){const t=new Set;e.forEach(({event:s,transactionHash:n})=>{s==="BlockedUtxosCreated"&&t.add(n)});const c=[];await v.resolveSync(e.map(s=>async()=>{if(s.event!==this.eventName)return;const{args:n,blockNumber:i,transactionHash:r}=s;if(!n)throw new Error("Wrong event structure");const a=this.mapEvent(n),l=t.has(r);await this.acceptEvent(a,i,r,l)&&c.push(a)}));const o=c.length;return await this.afterEventsAccepted(o),c.length}}exports.AbstractEventService=h;
@@ -6,7 +6,7 @@ export declare abstract class AbstractEventService<EventType, SerializedEventTyp
6
6
  get latestBlockNumber(): number;
7
7
  intervalClear(): void;
8
8
  private processEventsPage;
9
- protected abstract acceptEvent(event: EventType, blockNumber: number, txHash?: string): boolean | Promise<boolean>;
9
+ protected abstract acceptEvent(event: EventType, blockNumber: number, txHash?: string, isBlocked?: boolean): boolean | Promise<boolean>;
10
10
  protected abstract mapEvent(event: SerializedEventType): EventType;
11
11
  protected abstract afterEventsAccepted(eventsCount: number): Promise<void>;
12
12
  }
@@ -0,0 +1,37 @@
1
+ import { resolveSync as v } from "../../../functions/utils/resolve-sync.utils.mjs";
2
+ class u {
3
+ blockchainEventEmitter;
4
+ eventName;
5
+ constructor(t, e) {
6
+ this.blockchainEventEmitter = t, this.eventName = e, t.addEventProcessorFunction(this.processEventsPage.bind(this));
7
+ }
8
+ get latestBlockNumber() {
9
+ return this.blockchainEventEmitter.latestBlockNumber;
10
+ }
11
+ intervalClear() {
12
+ this.blockchainEventEmitter.intervalClear();
13
+ }
14
+ async processEventsPage(t) {
15
+ const e = /* @__PURE__ */ new Set();
16
+ t.forEach(({ event: s, transactionHash: n }) => {
17
+ s === "BlockedUtxosCreated" && e.add(n);
18
+ });
19
+ const c = [];
20
+ await v(
21
+ t.map((s) => async () => {
22
+ if (s.event !== this.eventName)
23
+ return;
24
+ const { args: n, blockNumber: i, transactionHash: a } = s;
25
+ if (!n)
26
+ throw new Error("Wrong event structure");
27
+ const r = this.mapEvent(n), h = e.has(a);
28
+ await this.acceptEvent(r, i, a, h) && c.push(r);
29
+ })
30
+ );
31
+ const o = c.length;
32
+ return await this.afterEventsAccepted(o), c.length;
33
+ }
34
+ }
35
+ export {
36
+ u as AbstractEventService
37
+ };
@@ -1,5 +1,5 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { NullifierEvent } from '../../types/commitments.types';
2
+ import { NullifierEvent } from '../../../types/commitments.types';
3
3
  import { AbstractSnapshotService, Snapshot } from './AbstractSnapshotService';
4
4
  import { BlockchainEventEmitter } from './BlockchainEventEmitter';
5
5
  export type NullifierSnapshotPayload = {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../constants/save-depths.cjs"),a=require("./AbstractEventService.cjs");class i extends a.AbstractEventService{savedLatestBlockNumber=0;chainId=0;constructor(t,e){super(t,e)}async init(){await this.loadSnapshot(),this.chainId=(await this.blockchainEventEmitter.contract.provider.getNetwork()).chainId}async retrieveEventsFromLatestBlock(){await this.blockchainEventEmitter.retrieveEvents(this.latestBlockNumber)}async loadSnapshot(){const t=await this.fetchSnapshot(),e=this.deserializeSnapshot(t);this.populateSnapshot(e),this.blockchainEventEmitter.syncFromAtMost(e.latestBlockNumber),this.savedLatestBlockNumber=e.latestBlockNumber}saveSnapshot(){return this.savedLatestBlockNumber=this.latestBlockNumber,this.persistSnapshot(this.serializeSnapshot({latestBlockNumber:this.latestBlockNumber,payload:this.getSnapshotPayload()}))}async afterEventsAccepted(t){(t>0||this.savedLatestBlockNumber+s.saveDepths[this.chainId]<this.latestBlockNumber)&&await this.saveSnapshot()}}exports.AbstractSnapshotService=i;
@@ -1,4 +1,4 @@
1
- import { saveDepths as e } from "../../constants/save-depths.mjs";
1
+ import { saveDepths as e } from "../../../constants/save-depths.mjs";
2
2
  import { AbstractEventService as a } from "./AbstractEventService.mjs";
3
3
  class c extends a {
4
4
  savedLatestBlockNumber = 0;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../../constants/reorg-depths.constants.cjs"),c=require("../../../functions/utils/resolve-sync.utils.cjs"),m=require("../../../functions/utils/mutexes.utils.cjs");class y{contract;depositOnChainUtxosContract;_latestBlockNumber;_initialBlockNumber;onEventsProcessed;eventProcessors=new Set;maxPageSize;isReady=!1;isServer;intervalId;inProgress;constructor(e,r,l,s,i){this.contract=e,this.depositOnChainUtxosContract=i,this._initialBlockNumber=r,this.maxPageSize=s,this.isServer=l,this.inProgress=!1}get latestBlockNumber(){return this._latestBlockNumber??this._initialBlockNumber}syncFromAtMost(e){(this._latestBlockNumber===void 0||e<this._latestBlockNumber)&&(this._latestBlockNumber=e)}intervalClear(){this.isReady=!1,this.eventProcessors=new Set,clearInterval(this.intervalId)}async init(){if(this.isReady)throw new Error("Already initialized");this.isReady=!0,await this.retrieveEvents(this.latestBlockNumber+1),this.intervalId=setInterval(async()=>{await this.retrieveEvents(this.latestBlockNumber)},3500)}requireReady(){if(!this.isReady)throw new Error("Not ready")}addEventProcessorFunction(e){if(this.isReady)throw new Error("Can't add event processor after event emitter initialized");this.eventProcessors.add(e)}async getLastBlockNumberForEventRequest(){const e=await this.contract.provider.getBlockNumber();if(!this.isServer)return e;const{chainId:r}=await this.contract.provider.getNetwork();return Math.max(this.latestBlockNumber,e-d.blockReorgDepth[r]+1)}async retrieveEvents(e,r=!1){return this.requireReady(),await m.balanceFetchingMutex.runExclusive(async()=>{try{if(this.inProgress&&!r)return!1;this.inProgress=!0;let s=0;const i=await this.getLastBlockNumberForEventRequest();if(i<e)return this.inProgress=!1,!1;const h=c.getSequence(e,i,this.maxPageSize),n=[];if(await c.resolveSync(h.map(({from:t,to:a})=>async()=>{const o=await this.contract.queryFilter("*",t,a);n.push(...o)})),this.depositOnChainUtxosContract){const{depositOnChainUtxosContract:t}=this;await c.resolveSync(h.map(({from:a,to:o})=>async()=>{const v=await t.queryFilter("*",a,o);n.push(...v)}))}const u=await Promise.all([...this.eventProcessors].map(t=>t(n)));return this._latestBlockNumber=i,s+=u.reduce((t,a)=>t+a,0),this.onEventsProcessed?.(s),this.inProgress=!1,!0}catch(s){return console.log("retrieveEvents error:",{err:s}),this.inProgress=!1,!1}})}}exports.BlockchainEventEmitter=y;
@@ -2,6 +2,7 @@ import { ethers } from 'ethers';
2
2
  export type EventProcessorFunction = (events: ethers.Event[]) => Promise<number> | number;
3
3
  export declare class BlockchainEventEmitter {
4
4
  readonly contract: ethers.Contract;
5
+ readonly depositOnChainUtxosContract?: ethers.Contract;
5
6
  private _latestBlockNumber;
6
7
  private _initialBlockNumber;
7
8
  onEventsProcessed?: (acceptedEventCount: number) => void;
@@ -11,7 +12,7 @@ export declare class BlockchainEventEmitter {
11
12
  private isServer;
12
13
  private intervalId?;
13
14
  private inProgress;
14
- constructor(contract: ethers.Contract, initialBlockNumber: number, isServer: boolean, maxPageSize?: number);
15
+ constructor(contract: ethers.Contract, initialBlockNumber: number, isServer: boolean, maxPageSize?: number, depositOnChainUtxosContract?: ethers.Contract);
15
16
  get latestBlockNumber(): number;
16
17
  syncFromAtMost(blockNumber: number): void;
17
18
  intervalClear(): void;
@@ -0,0 +1,89 @@
1
+ import { blockReorgDepth as d } from "../../../constants/reorg-depths.constants.mjs";
2
+ import { getSequence as m, resolveSync as h } from "../../../functions/utils/resolve-sync.utils.mjs";
3
+ import { balanceFetchingMutex as y } from "../../../functions/utils/mutexes.utils.mjs";
4
+ class g {
5
+ contract;
6
+ depositOnChainUtxosContract;
7
+ _latestBlockNumber;
8
+ _initialBlockNumber;
9
+ onEventsProcessed;
10
+ eventProcessors = /* @__PURE__ */ new Set();
11
+ maxPageSize;
12
+ isReady = !1;
13
+ isServer;
14
+ intervalId;
15
+ inProgress;
16
+ // to remove race conditions
17
+ constructor(t, r, c, s, i) {
18
+ this.contract = t, this.depositOnChainUtxosContract = i, this._initialBlockNumber = r, this.maxPageSize = s, this.isServer = c, this.inProgress = !1;
19
+ }
20
+ get latestBlockNumber() {
21
+ return this._latestBlockNumber ?? this._initialBlockNumber;
22
+ }
23
+ syncFromAtMost(t) {
24
+ (this._latestBlockNumber === void 0 || t < this._latestBlockNumber) && (this._latestBlockNumber = t);
25
+ }
26
+ intervalClear() {
27
+ this.isReady = !1, this.eventProcessors = /* @__PURE__ */ new Set(), clearInterval(this.intervalId);
28
+ }
29
+ async init() {
30
+ if (this.isReady)
31
+ throw new Error("Already initialized");
32
+ this.isReady = !0, await this.retrieveEvents(this.latestBlockNumber + 1), this.intervalId = setInterval(async () => {
33
+ await this.retrieveEvents(this.latestBlockNumber);
34
+ }, 3500);
35
+ }
36
+ requireReady() {
37
+ if (!this.isReady)
38
+ throw new Error("Not ready");
39
+ }
40
+ addEventProcessorFunction(t) {
41
+ if (this.isReady)
42
+ throw new Error("Can't add event processor after event emitter initialized");
43
+ this.eventProcessors.add(t);
44
+ }
45
+ async getLastBlockNumberForEventRequest() {
46
+ const t = await this.contract.provider.getBlockNumber();
47
+ if (!this.isServer)
48
+ return t;
49
+ const { chainId: r } = await this.contract.provider.getNetwork();
50
+ return Math.max(this.latestBlockNumber, t - d[r] + 1);
51
+ }
52
+ async retrieveEvents(t, r = !1) {
53
+ return this.requireReady(), await y.runExclusive(async () => {
54
+ try {
55
+ if (this.inProgress && !r)
56
+ return !1;
57
+ this.inProgress = !0;
58
+ let s = 0;
59
+ const i = await this.getLastBlockNumberForEventRequest();
60
+ if (i < t)
61
+ return this.inProgress = !1, !1;
62
+ const l = m(t, i, this.maxPageSize), n = [];
63
+ if (await h(
64
+ l.map(({ from: e, to: a }) => async () => {
65
+ const o = await this.contract.queryFilter("*", e, a);
66
+ n.push(...o);
67
+ })
68
+ ), this.depositOnChainUtxosContract) {
69
+ const { depositOnChainUtxosContract: e } = this;
70
+ await h(
71
+ l.map(({ from: a, to: o }) => async () => {
72
+ const v = await e.queryFilter("*", a, o);
73
+ n.push(...v);
74
+ })
75
+ );
76
+ }
77
+ const u = await Promise.all(
78
+ [...this.eventProcessors].map((e) => e(n))
79
+ );
80
+ return this._latestBlockNumber = i, s += u.reduce((e, a) => e + a, 0), this.onEventsProcessed?.(s), this.inProgress = !1, !0;
81
+ } catch (s) {
82
+ return console.log("retrieveEvents error:", { err: s }), this.inProgress = !1, !1;
83
+ }
84
+ });
85
+ }
86
+ }
87
+ export {
88
+ g as BlockchainEventEmitter
89
+ };
@@ -1,7 +1,13 @@
1
- export * from './AbstractAccessTokenSnapshotService';
2
- export * from './AbstractCommitmentsSnapshotService';
3
- export * from './AbstractApprovalsSnapshotService';
4
- export * from './AbstractNullifierSnapshotService';
5
- export * from './AbstractSnapshotService';
6
- export * from './AbstractEventService';
7
- export * from './BlockchainEventEmitter';
1
+ export * from './evm/AbstractAccessTokenSnapshotService';
2
+ export * from './evm/AbstractCommitmentsSnapshotService';
3
+ export * from './evm/AbstractApprovalsSnapshotService';
4
+ export * from './evm/AbstractNullifierSnapshotService';
5
+ export * from './evm/AbstractSnapshotService';
6
+ export * from './evm/AbstractEventService';
7
+ export * from './evm/BlockchainEventEmitter';
8
+ export * from './solana/SolanaBlockchainEventEmitter';
9
+ export * from './solana/AbstractSolanaEventService';
10
+ export * from './solana/AbstractSolanaSnapshotService';
11
+ export * from './solana/AbstractSolanaNullifierSnapshotService';
12
+ export * from './solana/AbstractSolanaCommitmentsSnapshotService';
13
+ export * from './solana/AbstractSolanaAccessTokenSnapshotService';