@hinkal/common 0.2.19 → 0.2.21

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 (281) hide show
  1. package/API/API.cjs +1 -1
  2. package/API/API.d.ts +6 -1
  3. package/API/API.mjs +48 -41
  4. package/API/enclaveCalls.cjs +1 -1
  5. package/API/enclaveCalls.mjs +5 -4
  6. package/API/index.d.ts +1 -0
  7. package/API/proxyAccountsCalls.cjs +1 -1
  8. package/API/proxyAccountsCalls.d.ts +7 -2
  9. package/API/proxyAccountsCalls.mjs +26 -20
  10. package/API/temporaryWalletCalls.cjs +1 -0
  11. package/API/temporaryWalletCalls.d.ts +13 -0
  12. package/API/temporaryWalletCalls.mjs +20 -0
  13. package/API/unspent-utxos-calls.cjs +1 -1
  14. package/API/unspent-utxos-calls.d.ts +1 -1
  15. package/API/unspent-utxos-calls.mjs +16 -14
  16. package/README.md +36 -13
  17. package/constants/chains.constants.cjs +1 -1
  18. package/constants/chains.constants.d.ts +1 -1
  19. package/constants/chains.constants.mjs +69 -51
  20. package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
  21. package/constants/deploy-data/deploy-data-solana.json.mjs +28 -2
  22. package/constants/kyc.constants.cjs +1 -1
  23. package/constants/kyc.constants.mjs +39 -40
  24. package/constants/mediaUrls.constants.cjs +1 -1
  25. package/constants/mediaUrls.constants.d.ts +1 -0
  26. package/constants/mediaUrls.constants.mjs +2 -1
  27. package/constants/server.constants.cjs +1 -1
  28. package/constants/server.constants.d.ts +6 -1
  29. package/constants/server.constants.mjs +37 -32
  30. package/constants/token-data/polygonRegistry.json.cjs +1 -1
  31. package/constants/token-data/polygonRegistry.json.mjs +4 -4
  32. package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
  33. package/constants/token-data/polygonRegistryFixed.json.mjs +4 -4
  34. package/data-structures/AccountActions/AccountActions.cjs +1 -0
  35. package/data-structures/AccountActions/AccountActions.d.ts +18 -0
  36. package/data-structures/AccountActions/AccountActions.mjs +78 -0
  37. package/data-structures/AccountActions/index.d.ts +1 -0
  38. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
  39. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +68 -71
  40. package/data-structures/BlockchainEvent/BlockchainEvent.cjs +1 -0
  41. package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +14 -0
  42. package/data-structures/BlockchainEvent/BlockchainEvent.mjs +41 -0
  43. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  44. package/data-structures/Hinkal/Hinkal.d.ts +14 -8
  45. package/data-structures/Hinkal/Hinkal.mjs +215 -179
  46. package/data-structures/Hinkal/IHinkal.d.ts +9 -6
  47. package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
  48. package/data-structures/Hinkal/handleAutoDepositBack.mjs +47 -48
  49. package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
  50. package/data-structures/Hinkal/hinkalActionReceive.mjs +25 -22
  51. package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
  52. package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +12 -12
  53. package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  54. package/data-structures/Hinkal/hinkalDeposit.mjs +63 -63
  55. package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
  56. package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +60 -147
  57. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -0
  58. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -0
  59. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +103 -0
  60. package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -0
  61. package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +4 -0
  62. package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +214 -0
  63. package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
  64. package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +4 -4
  65. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  66. package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
  67. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +103 -99
  68. package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
  69. package/data-structures/Hinkal/hinkalProxySwap.mjs +44 -41
  70. package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
  71. package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +31 -28
  72. package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
  73. package/data-structures/Hinkal/hinkalSignSubAccount.mjs +16 -13
  74. package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
  75. package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +34 -34
  76. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
  77. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +67 -65
  78. package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
  79. package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +35 -32
  80. package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
  81. package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +59 -56
  82. package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
  83. package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +35 -32
  84. package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
  85. package/data-structures/Hinkal/hinkalSolanaSwap.mjs +10 -10
  86. package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
  87. package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +25 -25
  88. package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  89. package/data-structures/Hinkal/hinkalSwap.mjs +34 -30
  90. package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
  91. package/data-structures/Hinkal/hinkalTransfer.mjs +43 -39
  92. package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  93. package/data-structures/Hinkal/hinkalWithdraw.mjs +47 -43
  94. package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
  95. package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +50 -46
  96. package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  97. package/data-structures/Hinkal/resetMerkleTrees.mjs +36 -34
  98. package/data-structures/IndexedDB/activity-db.cjs +1 -1
  99. package/data-structures/IndexedDB/activity-db.d.ts +1 -0
  100. package/data-structures/IndexedDB/activity-db.mjs +86 -70
  101. package/data-structures/IndexedDB/balances-db.cjs +1 -1
  102. package/data-structures/IndexedDB/balances-db.mjs +33 -30
  103. package/data-structures/IndexedDB/contact-db.cjs +1 -1
  104. package/data-structures/IndexedDB/contact-db.mjs +9 -6
  105. package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +1 -0
  106. package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +20 -0
  107. package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +124 -0
  108. package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +1 -0
  109. package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +15 -0
  110. package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +64 -0
  111. package/data-structures/PublicBalance/index.d.ts +2 -0
  112. package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
  113. package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +77 -78
  114. package/data-structures/crypto-keys/keys.cjs +1 -1
  115. package/data-structures/crypto-keys/keys.d.ts +0 -11
  116. package/data-structures/crypto-keys/keys.mjs +47 -107
  117. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
  118. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +3 -2
  119. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
  120. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
  121. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +3 -2
  122. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
  123. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
  124. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +3 -2
  125. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
  126. package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
  127. package/data-structures/event-service/evm/AbstractEventService.d.ts +3 -2
  128. package/data-structures/event-service/evm/AbstractEventService.mjs +16 -19
  129. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
  130. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
  131. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +6 -5
  132. package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +1 -1
  133. package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
  134. package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +7 -4
  135. package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +35 -34
  136. package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +1 -0
  137. package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +11 -0
  138. package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +21 -0
  139. package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +1 -0
  140. package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +6 -0
  141. package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +16 -0
  142. package/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -0
  143. package/data-structures/event-service/helpers/ClientEventHelper.d.ts +11 -0
  144. package/data-structures/event-service/helpers/ClientEventHelper.mjs +26 -0
  145. package/data-structures/event-service/helpers/PollingEventHelper.cjs +1 -0
  146. package/data-structures/event-service/helpers/PollingEventHelper.d.ts +5 -0
  147. package/data-structures/event-service/helpers/PollingEventHelper.mjs +14 -0
  148. package/data-structures/event-service/index.d.ts +4 -0
  149. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
  150. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +3 -2
  151. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
  152. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
  153. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +4 -3
  154. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
  155. package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
  156. package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +3 -10
  157. package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +5 -5
  158. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
  159. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +3 -2
  160. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +1 -1
  161. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +1 -1
  162. package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +1 -0
  163. package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +11 -0
  164. package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +22 -0
  165. package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +1 -0
  166. package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +6 -0
  167. package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +16 -0
  168. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
  169. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +8 -14
  170. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +68 -67
  171. package/data-structures/index.d.ts +3 -0
  172. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
  173. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +5 -2
  174. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
  175. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +5 -2
  176. package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
  177. package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +5 -2
  178. package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
  179. package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +5 -2
  180. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
  181. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +5 -2
  182. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
  183. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +5 -2
  184. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
  185. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +5 -2
  186. package/data-structures/utxo/Utxo.cjs +1 -1
  187. package/data-structures/utxo/Utxo.d.ts +1 -0
  188. package/data-structures/utxo/Utxo.mjs +18 -4
  189. package/error-handling/error-codes.constants.cjs +1 -1
  190. package/error-handling/error-codes.constants.mjs +2 -2
  191. package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
  192. package/functions/pre-transaction/getSolanaCalldataHash.mjs +22 -22
  193. package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
  194. package/functions/pre-transaction/sendV0Transaction.mjs +53 -50
  195. package/functions/pre-transaction/solana.cjs +1 -1
  196. package/functions/pre-transaction/solana.mjs +93 -93
  197. package/functions/private-wallet/emporium.helpers.cjs +1 -1
  198. package/functions/private-wallet/emporium.helpers.d.ts +3 -2
  199. package/functions/private-wallet/emporium.helpers.mjs +118 -93
  200. package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
  201. package/functions/snarkjs/constructEmporiumProof.d.ts +1 -2
  202. package/functions/snarkjs/constructEmporiumProof.mjs +89 -89
  203. package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
  204. package/functions/snarkjs/constructSolanaZkProof.mjs +6 -2
  205. package/functions/utils/bytes32.utils.cjs +1 -1
  206. package/functions/utils/bytes32.utils.mjs +8 -7
  207. package/functions/utils/create-provider.cjs +1 -1
  208. package/functions/utils/create-provider.d.ts +1 -1
  209. package/functions/utils/create-provider.mjs +13 -9
  210. package/functions/utils/index.d.ts +0 -1
  211. package/functions/utils/prepareHinkal.cjs +1 -1
  212. package/functions/utils/prepareHinkal.d.ts +6 -7
  213. package/functions/utils/prepareHinkal.mjs +45 -53
  214. package/functions/utils/publicBalance.utils.cjs +1 -1
  215. package/functions/utils/publicBalance.utils.mjs +49 -54
  216. package/functions/utils/socket.utils.cjs +1 -0
  217. package/functions/utils/socket.utils.d.ts +1 -0
  218. package/functions/utils/socket.utils.mjs +12 -0
  219. package/functions/utils/string.utils.cjs +1 -1
  220. package/functions/utils/string.utils.d.ts +1 -0
  221. package/functions/utils/string.utils.mjs +18 -14
  222. package/functions/utils/walletBalances.utils.cjs +1 -1
  223. package/functions/utils/walletBalances.utils.d.ts +1 -1
  224. package/functions/utils/walletBalances.utils.mjs +4 -4
  225. package/functions/web3/crypto.cjs +1 -0
  226. package/functions/web3/crypto.d.ts +1 -0
  227. package/functions/web3/crypto.mjs +7 -0
  228. package/functions/web3/events/getApprovedBalance.cjs +1 -1
  229. package/functions/web3/events/getApprovedBalance.mjs +14 -14
  230. package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  231. package/functions/web3/events/getInputUtxoAndBalance.mjs +61 -59
  232. package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
  233. package/functions/web3/events/getTransactionLogEvents.mjs +32 -32
  234. package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
  235. package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +6 -3
  236. package/functions/web3/functionCalls/approveToken.cjs +1 -1
  237. package/functions/web3/functionCalls/approveToken.mjs +17 -17
  238. package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
  239. package/functions/web3/functionCalls/transactCallDirect.mjs +16 -16
  240. package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  241. package/functions/web3/functionCalls/transactCallRelayer.mjs +13 -11
  242. package/functions/web3/getContractMetadata.cjs +1 -1
  243. package/functions/web3/getContractMetadata.mjs +17 -22
  244. package/functions/web3/getTokenHolder.cjs +1 -1
  245. package/functions/web3/getTokenHolder.mjs +20 -20
  246. package/functions/web3/index.d.ts +1 -0
  247. package/index.cjs +1 -1
  248. package/index.mjs +913 -890
  249. package/package.json +3 -2
  250. package/providers/EthersProviderAdapter.cjs +1 -1
  251. package/providers/EthersProviderAdapter.mjs +2 -5
  252. package/providers/prepareEthersHinkal.cjs +1 -1
  253. package/providers/prepareEthersHinkal.mjs +11 -4
  254. package/providers/prepareWagmiHinkal.cjs +1 -1
  255. package/providers/prepareWagmiHinkal.mjs +11 -4
  256. package/types/activities.types.d.ts +2 -0
  257. package/types/bridging-tx.types.d.ts +17 -0
  258. package/types/cache.types.cjs +1 -1
  259. package/types/cache.types.d.ts +5 -1
  260. package/types/cache.types.mjs +1 -1
  261. package/types/ethereum-network.types.d.ts +1 -0
  262. package/types/events.types.cjs +1 -0
  263. package/types/events.types.d.ts +9 -0
  264. package/types/events.types.mjs +5 -0
  265. package/types/index.d.ts +2 -0
  266. package/types/proxy.types.d.ts +11 -4
  267. package/types/sandbox.types.d.ts +2 -0
  268. package/types/solana.types.d.ts +8 -0
  269. package/types/token.types.d.ts +5 -0
  270. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  271. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  272. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  273. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  274. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  275. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
  276. package/functions/kyc/authentoHelper.cjs +0 -1
  277. package/functions/kyc/authentoHelper.d.ts +0 -12
  278. package/functions/kyc/authentoHelper.mjs +0 -30
  279. package/functions/utils/get-hinkal-approvals.cjs +0 -1
  280. package/functions/utils/get-hinkal-approvals.d.ts +0 -3
  281. package/functions/utils/get-hinkal-approvals.mjs +0 -38
@@ -1,32 +1,32 @@
1
- import { EventType as E } from "../../types/hinkal.types.mjs";
1
+ import { ethers as B } from "ethers";
2
+ import { EventType as D } from "../../types/hinkal.types.mjs";
2
3
  import { ContractType as w } from "../../types/ethereum-network.types.mjs";
3
- import { hinkalCheckSolanaTokenRegistry as H } from "./hinkalCheckSolanaTokenRegistry.mjs";
4
- import { checkHinkalAccessToken as D } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
5
- import { getShieldedBalance as F } from "../../functions/web3/events/getShieldedBalance.mjs";
6
- import { UserKeys as S } from "../crypto-keys/keys.mjs";
7
- import { hinkalDeposit as b, hinkalDepositForOther as W } from "./hinkalDeposit.mjs";
8
- import { hinkalDepositAndWithdraw as U } from "./hinkalDepositAndWithdraw.mjs";
9
- import { hinkalSolanaDeposit as x, hinkalSolanaDepositForOther as K, hinkalSolanaMultiPaymentDeposit as L } from "./hinkalSolanaDeposit.mjs";
10
- import { hinkalSwap as N } from "./hinkalSwap.mjs";
11
- import { hinkalWithdraw as I } from "./hinkalWithdraw.mjs";
12
- import { hinkalWithdrawStuckUtxos as O } from "./hinkalWithdrawStuckUtxos.mjs";
13
- import { resetMerkleTrees as _ } from "./resetMerkleTrees.mjs";
14
- import { MerkleTree as C } from "../merkle-tree/MerkleTree.mjs";
15
- import "ethers";
16
- import { transactionErrorCodes as z } from "../../error-handling/error-codes.constants.mjs";
17
- import { poseidonFunction as T } from "../../crypto/poseidon.mjs";
18
- import { WALLET_SUPPORTED_CHAINS as u, networkRegistry as k, isSolanaLike as h } from "../../constants/chains.constants.mjs";
4
+ import { hinkalCheckSolanaTokenRegistry as F } from "./hinkalCheckSolanaTokenRegistry.mjs";
5
+ import { checkHinkalAccessToken as b } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
6
+ import { getShieldedBalance as U } from "../../functions/web3/events/getShieldedBalance.mjs";
7
+ import { UserKeys as P } from "../crypto-keys/keys.mjs";
8
+ import { hinkalDeposit as W, hinkalDepositForOther as K } from "./hinkalDeposit.mjs";
9
+ import { hinkalDepositAndWithdraw as x } from "./hinkalDepositAndWithdraw.mjs";
10
+ import { hinkalSolanaDeposit as L, hinkalSolanaDepositForOther as N, hinkalSolanaMultiPaymentDeposit as O } from "./hinkalSolanaDeposit.mjs";
11
+ import { hinkalSwap as z } from "./hinkalSwap.mjs";
12
+ import { hinkalWithdraw as _ } from "./hinkalWithdraw.mjs";
13
+ import { hinkalWithdrawStuckUtxos as I } from "./hinkalWithdrawStuckUtxos.mjs";
14
+ import { resetMerkleTrees as j } from "./resetMerkleTrees.mjs";
15
+ import { MerkleTree as T } from "../merkle-tree/MerkleTree.mjs";
16
+ import { transactionErrorCodes as $ } from "../../error-handling/error-codes.constants.mjs";
17
+ import { poseidonFunction as M } from "../../crypto/poseidon.mjs";
18
+ import { WALLET_SUPPORTED_CHAINS as k, chainIds as u, isSolanaLike as l, networkRegistry as A } from "../../constants/chains.constants.mjs";
19
19
  import "../../API/getServerURL.mjs";
20
20
  import "axios";
21
21
  import "../../constants/coingecko.constants.mjs";
22
22
  import "../../constants/server.constants.mjs";
23
23
  import "../http/HttpClient.mjs";
24
- import { API as A } from "../../API/API.mjs";
24
+ import { API as S } from "../../API/API.mjs";
25
25
  import "../../API/tenderly.api.mjs";
26
26
  import "../../constants/token-data/index.mjs";
27
27
  import "../../constants/contracts.constants.mjs";
28
- import { supportedPassportLinks as j } from "../../constants/kyc.constants.mjs";
29
- import { isExtension as $ } from "../../constants/vite.constants.mjs";
28
+ import { supportedPassportLinks as q } from "../../constants/kyc.constants.mjs";
29
+ import { isExtension as J } from "../../constants/vite.constants.mjs";
30
30
  import "../../constants/reorg-depths.constants.mjs";
31
31
  import "../../constants/addresses.constants.mjs";
32
32
  import "../../constants/token.limits.constants.mjs";
@@ -34,21 +34,21 @@ import "../../constants/presale.constants.mjs";
34
34
  import "../../constants/activity.constants.mjs";
35
35
  import "../../constants/tasks.constants.mjs";
36
36
  import "../../constants/events.constants.mjs";
37
- import { reloadPage as q } from "../../functions/utils/reloadPage.mjs";
38
- import { MultiThreadedUtxoUtils as J } from "../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
39
- import { hinkalPrivateWallet as Q } from "./hinkalPrivateWallet.mjs";
40
- import { createCacheDevice as V } from "../../functions/utils/cacheDevice.utils.mjs";
41
- import { getContractWithFetcherByChainId as X } from "../../functions/web3/getContractMetadata.mjs";
42
- import { getRecipientInfo as Y } from "./hinkalGetRecipientInfo.mjs";
43
- import { getApprovedBalance as Z, getApprovedUtxos as G, getApprovedUtxosForToken as ee } from "../../functions/web3/events/getApprovedBalance.mjs";
44
- import { hinkalSignSubAccount as te } from "./hinkalSignSubAccount.mjs";
45
- import { hinkalCheckTokenRegistry as re } from "./hinkalCheckTokenRegistry.mjs";
46
- import { hinkalActionReceive as ie } from "./hinkalActionReceive.mjs";
47
- import { privateTokensDB as ae } from "../TokenDBs/PrivateTokensDB.mjs";
37
+ import { reloadPage as Q } from "../../functions/utils/reloadPage.mjs";
38
+ import { MultiThreadedUtxoUtils as V } from "../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
39
+ import { hinkalPrivateWallet as X } from "./hinkalPrivateWallet.mjs";
40
+ import { createCacheDevice as Y } from "../../functions/utils/cacheDevice.utils.mjs";
41
+ import { getContractWithFetcherByChainId as Z } from "../../functions/web3/getContractMetadata.mjs";
42
+ import { getRecipientInfo as G } from "./hinkalGetRecipientInfo.mjs";
43
+ import { getApprovedBalance as ee, getApprovedUtxos as te, getApprovedUtxosForToken as re } from "../../functions/web3/events/getApprovedBalance.mjs";
44
+ import { hinkalSignSubAccount as ie } from "./hinkalSignSubAccount.mjs";
45
+ import { hinkalCheckTokenRegistry as ae } from "./hinkalCheckTokenRegistry.mjs";
46
+ import { hinkalActionReceive as oe } from "./hinkalActionReceive.mjs";
47
+ import { privateTokensDB as ne } from "../TokenDBs/PrivateTokensDB.mjs";
48
48
  import "idb-keyval";
49
- import { getErc20TokensForChain as oe } from "../../functions/utils/erc20tokenFunctions.mjs";
49
+ import { getErc20TokensForChain as se } from "../../functions/utils/erc20tokenFunctions.mjs";
50
50
  import "multiformats";
51
- import { PublicKey as v } from "@solana/web3.js";
51
+ import { PublicKey as y } from "@solana/web3.js";
52
52
  import "@solana/spl-token";
53
53
  import { validateAndGetChainId as m } from "../../functions/utils/token-check.utils.mjs";
54
54
  import "async-mutex";
@@ -56,32 +56,39 @@ import "../../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
56
56
  import "../../types/circom-data.types.mjs";
57
57
  import "../../types/transactions.types.mjs";
58
58
  import "../../types/activities.types.mjs";
59
- import { getMerkleAccountPublicKey as ne, getAccessTokenMerkleAccountPublicKey as se } from "../../functions/pre-transaction/solana.mjs";
59
+ import { getMerkleAccountPublicKey as he, getAccessTokenMerkleAccountPublicKey as le } from "../../functions/pre-transaction/solana.mjs";
60
+ import "ethers-v6h";
61
+ import "tweetnacl";
62
+ import "bs58";
60
63
  import "@coral-xyz/anchor";
64
+ import "buffer";
61
65
  import "../../functions/utils/userAgent.mjs";
62
66
  import "libsodium-wrappers";
63
67
  import "circomlibjs-hinkal-fork";
64
68
  import "process";
65
- import "buffer";
66
69
  import "../../providers/EthersProviderAdapter.mjs";
67
- import "node-forge";
70
+ import { SolanaProviderAdapter as pe } from "../../providers/SolanaProviderAdapter.mjs";
71
+ import "../../functions/web3/events/getInputUtxoAndBalance.mjs";
68
72
  import "../../functions/web3/getTokenHolder.mjs";
69
- import { createTransaferEmporiumOpsBatch as pe } from "../../functions/private-wallet/emporium.helpers.mjs";
70
- import { hinkalProoflessDeposit as he } from "./hinkalProoflessDeposit.mjs";
71
- import { hinkalProxySwap as ce } from "./hinkalProxySwap.mjs";
72
- import { hinkalMultiSendPrivateRecipients as le } from "./hinkalMultiSend.mjs";
73
- import { hinkalTransfer as de } from "./hinkalTransfer.mjs";
74
- import { hinkalProxyToPrivate as me } from "./hinkalProxyToPrivate.mjs";
75
- import { hinkalSolanaDepositAndWithdraw as ge } from "./hinkalSolanaDepositAndWithdraw.mjs";
73
+ import "node-forge";
74
+ import { createTransaferEmporiumOpsBatch as ce } from "../../functions/private-wallet/emporium.helpers.mjs";
75
+ import { hinkalProoflessDeposit as de } from "./hinkalProoflessDeposit.mjs";
76
+ import { hinkalProxySwap as me } from "./hinkalProxySwap.mjs";
77
+ import { hinkalMultiSendPrivateRecipients as ge } from "./hinkalMultiSend.mjs";
78
+ import { hinkalTransfer as fe } from "./hinkalTransfer.mjs";
79
+ import { hinkalProxyToPrivate as ue } from "./hinkalProxyToPrivate.mjs";
80
+ import { hinkalSolanaDepositAndWithdraw as ve } from "./hinkalSolanaDepositAndWithdraw.mjs";
76
81
  import { hinkalSolanaWithdraw as ye } from "./hinkalSolanaWithdraw.mjs";
77
- import { hinkalSolanaTransfer as fe } from "./hinkalSolanaTransfer.mjs";
78
- import { hinkalSolanaSwap as ve } from "./hinkalSolanaSwap.mjs";
79
- import { hinkalSolanaProxySend as ue } from "./hinkalSolanaProxySend.mjs";
80
- import { hinkalSolanaProxySwap as ke } from "./hinkalSolanaProxySwap.mjs";
81
- import { hinkalSolanaProxyShield as B } from "./hinkalSolanaProxyShield.mjs";
82
- import { fetchSolanaMerkleTreeRootHash as R } from "../../functions/web3/fetchSolanaMerkleTreeRootHash.mjs";
83
- class Vt {
84
- providerAdapter;
82
+ import { hinkalSolanaTransfer as Pe } from "./hinkalSolanaTransfer.mjs";
83
+ import { hinkalSolanaSwap as ke } from "./hinkalSolanaSwap.mjs";
84
+ import { hinkalSolanaProxySend as Ae } from "./hinkalSolanaProxySend.mjs";
85
+ import { hinkalSolanaProxySwap as we } from "./hinkalSolanaProxySwap.mjs";
86
+ import { hinkalSolanaProxyShield as R } from "./hinkalSolanaProxyShield.mjs";
87
+ import { fetchSolanaMerkleTreeRootHash as E } from "../../functions/web3/fetchSolanaMerkleTreeRootHash.mjs";
88
+ import { hinkalDepositAndBridge as Se } from "./hinkalDepostAndBridge.mjs";
89
+ class or {
90
+ ethereumProviderAdapter;
91
+ solanaProviderAdapter;
85
92
  userKeys;
86
93
  signingMessage = "Login to Hinkal Protocol";
87
94
  privateTransferSigningMessage = "Login to Hinkal's Private Transfer App";
@@ -99,40 +106,50 @@ class Vt {
99
106
  generateProofRemotely;
100
107
  disableMerkleTreeUpdates;
101
108
  constructor(e) {
102
- this.userKeys = new S(void 0), u.forEach((t) => {
103
- this.merkleTreeHinkalByChain[t] = C.create(T, 0n), this.merkleTreeAccessTokenByChain[t] = C.create(T, 0n), this.nullifiersByChain[t] = /* @__PURE__ */ new Set(), this.encryptedOutputsByChain[t] = [], this.approvalsByChain[t] = /* @__PURE__ */ new Map();
104
- }), this.generateProofRemotely = e?.generateProofRemotely ?? !1, this.utxoUtils = new J(), this.cacheDevice = V(e), this.disableMerkleTreeUpdates = e?.disableMerkleTreeUpdates ?? !1;
109
+ this.userKeys = new P(void 0), k.forEach((t) => {
110
+ this.merkleTreeHinkalByChain[t] = T.create(M, 0n), this.merkleTreeAccessTokenByChain[t] = T.create(M, 0n), this.nullifiersByChain[t] = /* @__PURE__ */ new Set(), this.encryptedOutputsByChain[t] = [], this.approvalsByChain[t] = /* @__PURE__ */ new Map();
111
+ }), this.generateProofRemotely = e?.generateProofRemotely ?? !1, this.utxoUtils = new V(), this.cacheDevice = Y(e), this.disableMerkleTreeUpdates = e?.disableMerkleTreeUpdates ?? !1;
105
112
  }
106
113
  async initProviderAdapter(e, t) {
107
- await this.updateProviderAdapter(t), this.providerAdapter?.initConnector(e);
108
- const r = await this.connectAndPatchProvider(e);
109
- await t.init(r), await this.setListeners();
114
+ const r = t instanceof pe;
115
+ await this.updateProviderAdapter(r ? u.solanaMainnet : u.ethMainnet, t), r ? this.solanaProviderAdapter?.initConnector(e) : this.ethereumProviderAdapter?.initConnector(e);
116
+ const i = await this.connectAndPatchProvider(r, e);
117
+ await t.init(i), await this.setListeners();
110
118
  }
111
119
  async initUserKeys(e = !1) {
112
120
  const t = e ? this.privateTransferSigningMessage : this.signingMessage;
113
- this.userKeys = new S(await this.getProviderAdapter().signMessage(t));
121
+ this.userKeys = new P(await this.getProviderAdapter().signMessage(t));
114
122
  }
115
123
  async initUserKeysWithPassword(e) {
116
- this.userKeys = new S(e);
124
+ this.userKeys = new P(e);
125
+ }
126
+ async initUserKeysFromSeedPhrases(e) {
127
+ const t = e.join(" "), r = B.utils.toUtf8Bytes(t), i = B.utils.keccak256(r);
128
+ this.userKeys = new P(i);
117
129
  }
118
130
  async resetMerkle(e) {
119
131
  if (this.disableMerkleTreeUpdates)
120
132
  return;
121
- (e?.every((r) => this.isSelectedNetworkSupported(r)) ?? !0) && await _(this, e);
133
+ (e?.every((r) => this.isSelectedNetworkSupported(r)) ?? !0) && await j(this, e);
122
134
  }
123
- getProviderAdapter() {
124
- if (!this.providerAdapter)
135
+ // If chainId is not provided, use the ethereum provider, if it is initialized. In other case, use the solana provider.
136
+ getProviderAdapter(e) {
137
+ const t = e ?? (this.ethereumProviderAdapter ? u.ethMainnet : u.solanaMainnet), r = l(t) ? this.solanaProviderAdapter : this.ethereumProviderAdapter;
138
+ if (!r)
125
139
  throw new Error("ProviderAdapter is not initialized");
126
- return this.providerAdapter;
140
+ return r;
141
+ }
142
+ getSupportedChains() {
143
+ return this.ethereumProviderAdapter && this.solanaProviderAdapter ? k : this.ethereumProviderAdapter ? k.filter((e) => !l(e)) : this.solanaProviderAdapter ? k.filter((e) => l(e)) : [];
127
144
  }
128
145
  async waitForTransaction(e, t, r = 1) {
129
- return !!await this.providerAdapter?.waitForTransaction(e, t, r);
146
+ return !!await this.getProviderAdapter(e).waitForTransaction(e, t, r);
130
147
  }
131
148
  getContract(e, t, r = void 0) {
132
- return this.getProviderAdapter().getContract(e, t, r);
149
+ return this.getProviderAdapter(e).getContract(e, t, r);
133
150
  }
134
151
  getContractWithFetcherByChainId(e, t, r = void 0) {
135
- return X(e, t, r);
152
+ return Z(e, t, r);
136
153
  }
137
154
  async signMessage(e) {
138
155
  return await this.getProviderAdapter().signMessage(e);
@@ -141,42 +158,51 @@ class Vt {
141
158
  return await this.getProviderAdapter().signTypedData(e, t, r);
142
159
  }
143
160
  async signWithSubAccount(e, t, r, i) {
144
- return te(e, t, r, i);
161
+ return ie(e, t, r, i);
145
162
  }
146
163
  getContractWithSigner(e, t, r = "") {
147
- return this.getProviderAdapter().getContractWithSigner(e, t, r);
164
+ return this.getProviderAdapter(e).getContractWithSigner(e, t, r);
148
165
  }
149
166
  getContractWithFetcher(e, t, r = "") {
150
- return this.getProviderAdapter().getContractWithFetcher(e, t, r);
167
+ return this.getProviderAdapter(e).getContractWithFetcher(e, t, r);
151
168
  }
152
169
  isSelectedNetworkSupported(e) {
153
- return !!k[e];
170
+ return !!A[e];
154
171
  }
155
172
  async switchNetwork(e) {
156
173
  try {
157
174
  await this.getProviderAdapter().switchNetwork(e);
158
175
  } catch {
159
- throw new Error(z.FAILED_TO_SWITCH_NETWORKS);
176
+ throw new Error($.FAILED_TO_SWITCH_NETWORKS);
160
177
  }
161
178
  }
162
- isPermitterAvailable() {
163
- return this.getProviderAdapter().isPermitterAvailable();
179
+ isPermitterAvailable(e) {
180
+ return this.getProviderAdapter(e).isPermitterAvailable();
164
181
  }
165
- async connectAndPatchProvider(e) {
166
- return await this.getProviderAdapter().connectAndPatchProvider(e);
182
+ async connectAndPatchProvider(e, t) {
183
+ return await this.getProviderAdapter(
184
+ e ? u.solanaMainnet : u.ethMainnet
185
+ ).connectAndPatchProvider(t);
167
186
  }
168
187
  async disconnectFromConnector() {
169
- await this.getProviderAdapter().disconnectFromConnector();
188
+ await this.ethereumProviderAdapter?.disconnectFromConnector(), await this.solanaProviderAdapter?.disconnectFromConnector();
170
189
  }
171
- async updateProviderAdapter(e) {
190
+ async updateProviderAdapter(e, t) {
172
191
  try {
173
- this.providerAdapter && this.providerAdapter.release(), this.providerAdapter = e;
174
- } catch (t) {
175
- throw console.error(t), Error("updateProviderAdapter failed, please try again.");
192
+ l(e) ? (this.solanaProviderAdapter && this.solanaProviderAdapter.release(), this.solanaProviderAdapter = t) : (this.ethereumProviderAdapter && this.ethereumProviderAdapter.release(), this.ethereumProviderAdapter = t);
193
+ } catch (r) {
194
+ throw console.error(r), Error("updateProviderAdapter failed, please try again.");
176
195
  }
177
196
  }
178
197
  async setListeners() {
179
- this.providerAdapter?.setChainEventListener({
198
+ this.ethereumProviderAdapter?.setChainEventListener({
199
+ onAccountChanged: () => {
200
+ this.onAccountChanged();
201
+ },
202
+ onChainChanged: (e) => {
203
+ this.onChainChanged(e);
204
+ }
205
+ }), this.solanaProviderAdapter?.setChainEventListener({
180
206
  onAccountChanged: () => {
181
207
  this.onAccountChanged();
182
208
  },
@@ -186,18 +212,18 @@ class Vt {
186
212
  });
187
213
  }
188
214
  async onAccountChanged() {
189
- await this.getProviderAdapter().onAccountChanged();
190
- const e = E.AccountChanged;
215
+ await this.ethereumProviderAdapter?.onAccountChanged(), await this.solanaProviderAdapter?.onAccountChanged();
216
+ const e = D.AccountChanged;
191
217
  typeof document < "u" ? document?.dispatchEvent(new Event(e)) : process?.emit("message", e, void 0);
192
218
  }
193
219
  async onChainChanged(e) {
194
- e ? await this.getProviderAdapter().onChainChanged(e) : (await this.disconnectFromConnector(), q());
220
+ e ? await this.getProviderAdapter(e).onChainChanged(e) : (await this.disconnectFromConnector(), Q());
195
221
  }
196
- async monitorConnectedAddress() {
197
- await A.monitor(await this.getEthereumAddress());
222
+ async monitorConnectedAddress(e) {
223
+ await S.monitor(await this.getEthereumAddressByChain(e));
198
224
  }
199
225
  async getBalances(e, t, r, i, a = !1, o, n = !1) {
200
- return F(
226
+ return U(
201
227
  this,
202
228
  e,
203
229
  t,
@@ -210,10 +236,10 @@ class Vt {
210
236
  );
211
237
  }
212
238
  async getApprovedBalances(e, t = !1, r = !1) {
213
- return Z(this, e, t, r);
239
+ return ee(this, e, t, r);
214
240
  }
215
241
  async getTotalBalance(e, t, r, i = !1, a, o = !1) {
216
- const n = r ?? await this.getEthereumAddress(), s = t ?? this.userKeys, p = await this.getBalances(
242
+ const n = r ?? await this.getEthereumAddressByChain(e), s = t ?? this.userKeys, h = await this.getBalances(
217
243
  e,
218
244
  s.getShieldedPrivateKey(),
219
245
  s.getShieldedPublicKey(),
@@ -221,49 +247,49 @@ class Vt {
221
247
  i,
222
248
  a,
223
249
  o
224
- ), c = !h(e) && !o ? await this.getApprovedBalances(e, i, a) : /* @__PURE__ */ new Map(), g = $ ? await ae.getPrivateTokens(e, n) : oe(e), d = [];
225
- return g.forEach((l) => {
226
- const y = l.erc20TokenAddress.toLowerCase(), f = p.get(y), P = c.get(y), M = {
227
- token: l,
228
- balance: (f?.balance ?? 0n) + (P?.balance ?? 0n),
229
- timestamp: f?.timestamp || P?.timestamp || "0",
230
- nfts: f?.nfts || []
250
+ ), p = !l(e) && !o ? await this.getApprovedBalances(e, i, a) : /* @__PURE__ */ new Map(), g = J ? await ne.getPrivateTokens(e, n) : se(e), d = [];
251
+ return g.forEach((c) => {
252
+ const f = c.erc20TokenAddress.toLowerCase(), v = h.get(f), C = p.get(f), H = {
253
+ token: c,
254
+ balance: (v?.balance ?? 0n) + (C?.balance ?? 0n),
255
+ timestamp: v?.timestamp || C?.timestamp || "0",
256
+ nfts: v?.nfts || []
231
257
  };
232
- d.push(M);
258
+ d.push(H);
233
259
  }), d;
234
260
  }
235
261
  async getStuckShieldedBalances(e, t) {
236
262
  return (await this.getTotalBalance(e, void 0, t, !1, !1, !0)).filter((i) => i.balance > 0n);
237
263
  }
238
264
  getSupportedPassportLinks() {
239
- return j;
265
+ return q;
240
266
  }
241
267
  checkAccessToken(e) {
242
- return D(this, e);
268
+ return b(this, e);
243
269
  }
244
270
  async getHinkalTreeRootHash(e) {
245
- if (h(e)) {
246
- const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } = k[e].contractData;
271
+ if (l(e)) {
272
+ const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } = A[e].contractData;
247
273
  if (!r || !i || !a)
248
274
  throw new Error(`Missing Solana configuration for chain ${e}`);
249
- const o = new v(a), n = new v(i), s = ne(n, o), p = this.getSolanaProgram(r);
250
- return R(p, s);
275
+ const o = new y(a), n = new y(i), s = he(n, o), h = this.getSolanaProgram(r);
276
+ return E(h, s);
251
277
  }
252
278
  return this.getContractWithFetcherByChainId(e, w.HinkalContract).getRootHash();
253
279
  }
254
280
  async getAccessTokenTreeRootHash(e) {
255
- if (h(e)) {
256
- const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } = k[e].contractData;
281
+ if (l(e)) {
282
+ const { hinkalIdl: r, hinkalAddress: i, originalDeployer: a } = A[e].contractData;
257
283
  if (!r || !i || !a)
258
284
  throw new Error(`Missing Solana configuration for chain ${e}`);
259
- const o = new v(a), n = new v(i), s = se(n, o), p = this.getSolanaProgram(r);
260
- return R(p, s);
285
+ const o = new y(a), n = new y(i), s = le(n, o), h = this.getSolanaProgram(r);
286
+ return E(h, s);
261
287
  }
262
288
  return this.getContractWithFetcherByChainId(e, w.AccessTokenContract).getRootHash();
263
289
  }
264
290
  async resetMerkleTreesIfNecessary() {
265
291
  const t = (await Promise.all(
266
- u.map(async (r) => {
292
+ this.getSupportedChains().map(async (r) => {
267
293
  const [i, a] = await Promise.all([
268
294
  this.getHinkalTreeRootHash(r),
269
295
  this.getAccessTokenTreeRootHash(r)
@@ -274,7 +300,7 @@ class Vt {
274
300
  t.length > 0 && (console.log("resetting merkle tree in resetMerkleTreesIfNecessary for chains:", t), await this.resetMerkle(t));
275
301
  }
276
302
  async getEventsFromHinkal() {
277
- const e = u.flatMap((t) => [
303
+ const e = this.getSupportedChains().flatMap((t) => [
278
304
  this.accessTokenSnapshotServiceByChain[t]?.retrieveEventsFromLatestBlock(),
279
305
  this.commitmentsSnapshotServiceByChain[t]?.retrieveEventsFromLatestBlock(),
280
306
  this.nullifierSnapshotServiceByChain[t]?.retrieveEventsFromLatestBlock(),
@@ -282,65 +308,72 @@ class Vt {
282
308
  ]);
283
309
  await Promise.all(e);
284
310
  }
285
- getEthereumAddress() {
286
- return this.getProviderAdapter().getAddress();
311
+ async getEthereumAddress() {
312
+ const e = this.ethereumProviderAdapter ?? this.solanaProviderAdapter;
313
+ if (!e)
314
+ throw new Error("No provider adapter initialized");
315
+ return e.getAddress();
316
+ }
317
+ getEthereumAddressByChain(e) {
318
+ return this.getProviderAdapter(e).getAddress();
287
319
  }
288
320
  async getRandomRelay(e, t = !1) {
289
- return (await A.getIdleRelay(e, t)).relay;
321
+ return (await S.getIdleRelay(e, t)).relay;
290
322
  }
291
323
  getGasPrice(e) {
292
- if (!this.providerAdapter)
324
+ const t = this.getProviderAdapter(e);
325
+ if (!t)
293
326
  throw new Error("Illegal State of providerAdapter in Hinkal: no providerAdapter initialized");
294
- return this.providerAdapter.getGasPrice(e);
327
+ return t.getGasPrice(e);
295
328
  }
296
329
  getAPI() {
297
- return A;
330
+ return S;
298
331
  }
299
332
  snapshotsClearInterval() {
300
- u.forEach((e) => {
333
+ this.getSupportedChains().forEach((e) => {
301
334
  this.commitmentsSnapshotServiceByChain[e]?.intervalClear(), this.accessTokenSnapshotServiceByChain[e]?.intervalClear(), this.nullifierSnapshotServiceByChain[e]?.intervalClear(), this.approvalsSnapshotServiceByChain[e]?.intervalClear();
302
335
  });
303
336
  }
304
337
  checkTokenRegistry(e, t, r) {
305
- if (h(e)) {
338
+ if (l(e)) {
306
339
  const {
307
340
  hinkalIdl: a,
308
341
  hinkalAddress: o,
309
342
  originalDeployer: n
310
- } = k[e].contractData;
343
+ } = A[e].contractData;
311
344
  if (!a || !o || !n)
312
345
  throw new Error("missing solana data");
313
- const s = this.getSolanaProgram(a), p = new v(n);
314
- return H(s, p, t, r);
346
+ const s = this.getSolanaProgram(a), h = new y(n);
347
+ return F(s, h, t, r);
315
348
  }
316
349
  const i = this.getContractWithFetcher(e, w.HinkalHelperContract);
317
- return re(i, t, r);
350
+ return ae(i, t, r);
318
351
  }
319
352
  getRecipientInfo() {
320
- return Y(this);
353
+ return G(this);
321
354
  }
322
355
  getApprovedUtxos(e, t = !1) {
323
- return G(this, e, t);
356
+ return te(this, e, t);
324
357
  }
325
358
  getApprovedUtxosForToken(e, t, r = !1) {
326
- return ee(this, e, t, r);
359
+ return re(this, e, t, r);
327
360
  }
328
361
  async deposit(e, t) {
329
- return b(this, e, t);
362
+ return W(this, e, t);
330
363
  }
331
364
  async depositForOther(e, t, r) {
332
- return W(this, e, t, r);
365
+ return K(this, e, t, r);
333
366
  }
334
367
  async depositAndWithdraw(e, t, r, i, a) {
335
368
  const o = m([e]);
336
- return h(o) ? ge(
369
+ return l(o) ? ve(
337
370
  this,
338
371
  e,
339
372
  t,
340
373
  r,
341
374
  i,
342
375
  a
343
- ) : U(
376
+ ) : x(
344
377
  this,
345
378
  e,
346
379
  t,
@@ -349,35 +382,38 @@ class Vt {
349
382
  a
350
383
  );
351
384
  }
385
+ async depositAndBridge(e, t, r, i) {
386
+ return Se(this, e, t, r, i);
387
+ }
352
388
  async prooflessDeposit(e, t, r) {
353
- return he(this, e, t, r);
389
+ return de(this, e, t, r);
354
390
  }
355
391
  getSolanaProgram(e) {
356
- if (!this.providerAdapter)
392
+ if (!this.solanaProviderAdapter)
357
393
  throw new Error("No provider adapter initialized");
358
- if (!("getSolanaProgram" in this.providerAdapter))
394
+ if (!("getSolanaProgram" in this.solanaProviderAdapter))
359
395
  throw new Error("Current provider adapter is not a Solana provider adapter");
360
- return this.providerAdapter.getSolanaProgram(e);
396
+ return this.solanaProviderAdapter.getSolanaProgram(e);
361
397
  }
362
398
  getSolanaPublicKey() {
363
- if (!this.providerAdapter)
399
+ if (!this.solanaProviderAdapter)
364
400
  throw new Error("No provider adapter initialized");
365
- if (!("getSolanaPublicKey" in this.providerAdapter))
401
+ if (!("getSolanaPublicKey" in this.solanaProviderAdapter))
366
402
  throw new Error("Current provider adapter is not a Solana provider adapter");
367
- return this.providerAdapter.getSolanaPublicKey();
403
+ return this.solanaProviderAdapter.getSolanaPublicKey();
368
404
  }
369
405
  async depositSolana(e, t) {
370
- return x(this, e, t);
406
+ return L(this, e, t);
371
407
  }
372
408
  async depositSolanaForOther(e, t, r) {
373
- return K(this, e, t, r);
409
+ return N(this, e, t, r);
374
410
  }
375
411
  async solanaMultiPaymentDeposit(e, t) {
376
- return L(this, e, t);
412
+ return O(this, e, t);
377
413
  }
378
414
  async transfer(e, t, r, i, a, o, n = !1) {
379
415
  const s = m(e);
380
- return h(s) ? fe(
416
+ return l(s) ? Pe(
381
417
  this,
382
418
  e,
383
419
  t,
@@ -385,7 +421,7 @@ class Vt {
385
421
  i,
386
422
  a,
387
423
  n
388
- ) : de(
424
+ ) : fe(
389
425
  this,
390
426
  e,
391
427
  t,
@@ -397,8 +433,8 @@ class Vt {
397
433
  );
398
434
  }
399
435
  async withdraw(e, t, r, i, a, o, n, s = !1) {
400
- const p = m(e);
401
- return h(p) ? ye(
436
+ const h = m(e);
437
+ return l(h) ? ye(
402
438
  this,
403
439
  e,
404
440
  t,
@@ -406,7 +442,7 @@ class Vt {
406
442
  a,
407
443
  o,
408
444
  s
409
- ) : I(
445
+ ) : _(
410
446
  this,
411
447
  e,
412
448
  t,
@@ -419,11 +455,11 @@ class Vt {
419
455
  );
420
456
  }
421
457
  async withdrawStuckUtxos(e, t) {
422
- return O(this, e, t);
458
+ return I(this, e, t);
423
459
  }
424
- async swap(e, t, r, i, a, o, n, s = !1, p = !1) {
425
- const c = m(e);
426
- return h(c) ? this.swapSolana(e, t, i, a, o, s) : N(
460
+ async swap(e, t, r, i, a, o, n, s = !1, h = !1) {
461
+ const p = m(e);
462
+ return l(p) ? this.swapSolana(e, t, i, a, o, s) : z(
427
463
  this,
428
464
  e,
429
465
  t,
@@ -433,18 +469,18 @@ class Vt {
433
469
  o,
434
470
  n,
435
471
  s,
436
- p
472
+ h
437
473
  );
438
474
  }
439
475
  async swapSolana(e, t, r, i, a, o = !1) {
440
- const n = JSON.parse(r), s = BigInt(n.swapperAccountSalt), { instructionLists: p, addressLookupTableAccount: c } = n.data;
441
- return ve(
476
+ const n = JSON.parse(r), s = BigInt(n.swapperAccountSalt), { instructionLists: h, addressLookupTableAccount: p } = n.data;
477
+ return ke(
442
478
  this,
443
479
  e,
444
480
  t,
445
481
  s,
482
+ h,
446
483
  p,
447
- c,
448
484
  i,
449
485
  a,
450
486
  o
@@ -454,7 +490,7 @@ class Vt {
454
490
  if (!a)
455
491
  throw new Error("subAccount is required");
456
492
  const s = m(e);
457
- return h(s) ? B(this, e[0], t[0], a, void 0, n) : ie(
493
+ return l(s) ? R(this, e[0], t[0], a, void 0, n) : oe(
458
494
  this,
459
495
  e,
460
496
  t,
@@ -465,8 +501,8 @@ class Vt {
465
501
  n
466
502
  );
467
503
  }
468
- async actionPrivateWallet(e, t, r, i, a, o, n, s, p, c, g = !1, d, l, y, f = !1) {
469
- return Q(
504
+ async actionPrivateWallet(e, t, r, i, a, o, n, s, h, p, g = !1, d, c, f, v = !1) {
505
+ return X(
470
506
  this,
471
507
  e,
472
508
  t,
@@ -476,18 +512,18 @@ class Vt {
476
512
  o,
477
513
  n,
478
514
  s,
515
+ h,
479
516
  p,
480
- c,
481
517
  g,
482
518
  d,
483
- l,
484
- y,
485
- f
519
+ c,
520
+ f,
521
+ v
486
522
  );
487
523
  }
488
- async proxySwap(e, t, r, i, a, o, n, s, p = !1, c, g, d = !1) {
489
- const l = m(e);
490
- return h(l) ? ke(
524
+ async proxySwap(e, t, r, i, a, o, n, s, h = !1, p, g, d = !1) {
525
+ const c = m(e);
526
+ return l(c) ? we(
491
527
  this,
492
528
  e,
493
529
  t,
@@ -496,7 +532,7 @@ class Vt {
496
532
  n,
497
533
  s,
498
534
  d
499
- ) : ce(
535
+ ) : me(
500
536
  this,
501
537
  e,
502
538
  t,
@@ -506,22 +542,22 @@ class Vt {
506
542
  o,
507
543
  n,
508
544
  s,
545
+ h,
509
546
  p,
510
- c,
511
547
  g,
512
548
  d
513
549
  );
514
550
  }
515
551
  async proxyToPrivate(e, t, r, i, a, o, n, s = !1) {
516
- const p = m(e);
517
- return h(p) ? B(
552
+ const h = m(e);
553
+ return l(h) ? R(
518
554
  this,
519
555
  e[0],
520
556
  t[0],
521
557
  r,
522
558
  i,
523
559
  s
524
- ) : me(
560
+ ) : ue(
525
561
  this,
526
562
  e,
527
563
  t,
@@ -534,25 +570,25 @@ class Vt {
534
570
  );
535
571
  }
536
572
  async proxySend(e, t, r, i, a, o, n, s = !1) {
537
- const p = m(e);
538
- if (h(p))
539
- return ue(e[0], t[0], r, i, s);
540
- const c = pe(
573
+ const h = m(e);
574
+ if (l(h))
575
+ return Ae(e[0], t[0], r, i, s);
576
+ const p = ce(
541
577
  this,
542
- p,
543
- e.map((l) => l.erc20TokenAddress),
578
+ h,
579
+ e.map((c) => c.erc20TokenAddress),
544
580
  t,
545
581
  i
546
- ), g = e.map((l, y) => ({
547
- token: l,
548
- amount: -1n * t[y]
582
+ ), g = e.map((c, f) => ({
583
+ token: c,
584
+ amount: -1n * t[f]
549
585
  }));
550
586
  return await this.actionPrivateWallet(
551
- p,
587
+ h,
552
588
  [],
553
589
  [],
554
590
  [],
555
- c,
591
+ p,
556
592
  g,
557
593
  r,
558
594
  a,
@@ -566,7 +602,7 @@ class Vt {
566
602
  );
567
603
  }
568
604
  async multiSendPrivateRecipients(e, t, r) {
569
- return le(this, e, t, r);
605
+ return ge(this, e, t, r);
570
606
  }
571
607
  areMerkleTreeUpdatesDisabled() {
572
608
  return this.disableMerkleTreeUpdates;
@@ -576,5 +612,5 @@ class Vt {
576
612
  }
577
613
  }
578
614
  export {
579
- Vt as Hinkal
615
+ or as Hinkal
580
616
  };