@hinkal/common 0.2.21 → 0.2.22

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 (516) hide show
  1. package/API/API.cjs +1 -1
  2. package/API/API.d.ts +14 -14
  3. package/API/API.mjs +88 -87
  4. package/API/admin-calls.cjs +1 -1
  5. package/API/admin-calls.d.ts +1 -1
  6. package/API/admin-calls.mjs +4 -4
  7. package/API/ai-calls.cjs +1 -0
  8. package/API/ai-calls.d.ts +17 -0
  9. package/API/ai-calls.mjs +21 -0
  10. package/API/callLifiAPI.cjs +1 -1
  11. package/API/callLifiAPI.d.ts +1 -1
  12. package/API/callLifiAPI.mjs +5 -5
  13. package/API/callMonitor.cjs +1 -1
  14. package/API/callMonitor.d.ts +1 -1
  15. package/API/callMonitor.mjs +7 -7
  16. package/API/callOdosAPI.cjs +1 -1
  17. package/API/callOdosAPI.mjs +11 -11
  18. package/API/callOkxAPI.cjs +1 -1
  19. package/API/callOkxAPI.d.ts +1 -1
  20. package/API/callOkxAPI.mjs +5 -5
  21. package/API/callOneInchAPI.cjs +1 -1
  22. package/API/callOneInchAPI.mjs +11 -10
  23. package/API/callRelayer.cjs +1 -1
  24. package/API/callRelayer.d.ts +5 -6
  25. package/API/callRelayer.mjs +11 -11
  26. package/API/checkRisk.cjs +1 -1
  27. package/API/checkRisk.d.ts +1 -1
  28. package/API/checkRisk.mjs +4 -4
  29. package/API/deposit-and-withdraw-status-calls.cjs +1 -0
  30. package/API/deposit-and-withdraw-status-calls.d.ts +20 -0
  31. package/API/deposit-and-withdraw-status-calls.mjs +18 -0
  32. package/API/duneAPI.cjs +1 -0
  33. package/API/duneAPI.d.ts +11 -0
  34. package/API/duneAPI.mjs +25 -0
  35. package/API/enclaveCalls.cjs +1 -1
  36. package/API/enclaveCalls.mjs +4 -5
  37. package/API/fetchCommitmentsCache.cjs +1 -1
  38. package/API/fetchCommitmentsCache.mjs +9 -9
  39. package/API/get-token-data.cjs +1 -1
  40. package/API/get-token-data.d.ts +1 -1
  41. package/API/get-token-data.mjs +5 -5
  42. package/API/getBridgeProtocols.cjs +1 -0
  43. package/API/getBridgeProtocols.d.ts +7 -0
  44. package/API/getBridgeProtocols.mjs +8 -0
  45. package/API/getGasEstimates.cjs +1 -1
  46. package/API/getGasEstimates.mjs +9 -9
  47. package/API/getLifiStatus.cjs +1 -0
  48. package/API/getLifiStatus.d.ts +24 -0
  49. package/API/getLifiStatus.mjs +15 -0
  50. package/API/getRelayerURL.cjs +1 -0
  51. package/API/getRelayerURL.d.ts +1 -0
  52. package/API/getRelayerURL.mjs +10 -0
  53. package/API/getServerURL.cjs +1 -1
  54. package/API/getServerURL.d.ts +3 -3
  55. package/API/getServerURL.mjs +67 -51
  56. package/API/getTokenPrice.cjs +1 -1
  57. package/API/getTokenPrice.d.ts +0 -5
  58. package/API/getTokenPrice.mjs +7 -14
  59. package/API/index.d.ts +3 -1
  60. package/API/is-tx-stateless.cjs +1 -1
  61. package/API/is-tx-stateless.d.ts +1 -1
  62. package/API/is-tx-stateless.mjs +12 -10
  63. package/API/kycCalls.cjs +1 -1
  64. package/API/kycCalls.d.ts +8 -4
  65. package/API/kycCalls.mjs +26 -23
  66. package/API/passwordCalls.cjs +1 -0
  67. package/API/passwordCalls.d.ts +9 -0
  68. package/API/passwordCalls.mjs +13 -0
  69. package/API/proxyAccountsCalls.cjs +1 -1
  70. package/API/proxyAccountsCalls.d.ts +2 -7
  71. package/API/proxyAccountsCalls.mjs +21 -27
  72. package/API/relayCalls.cjs +1 -1
  73. package/API/relayCalls.mjs +4 -4
  74. package/API/restoreSnapshots.cjs +1 -0
  75. package/API/restoreSnapshots.d.ts +1 -0
  76. package/API/restoreSnapshots.mjs +10 -0
  77. package/API/scheduled-transactions-calls.cjs +1 -1
  78. package/API/scheduled-transactions-calls.d.ts +9 -1
  79. package/API/scheduled-transactions-calls.mjs +9 -5
  80. package/API/simulate-batch-tx.cjs +1 -1
  81. package/API/simulate-batch-tx.d.ts +2 -2
  82. package/API/simulate-batch-tx.mjs +6 -7
  83. package/API/solana-calls.cjs +1 -1
  84. package/API/solana-calls.d.ts +3 -6
  85. package/API/solana-calls.mjs +15 -15
  86. package/API/temporaryWalletCalls.cjs +1 -1
  87. package/API/temporaryWalletCalls.mjs +19 -13
  88. package/API/token-calls.cjs +1 -1
  89. package/API/token-calls.mjs +5 -6
  90. package/README.md +54 -42
  91. package/constants/chains.constants.cjs +1 -1
  92. package/constants/chains.constants.d.ts +6 -0
  93. package/constants/chains.constants.mjs +52 -58
  94. package/constants/coingecko.constants.cjs +1 -1
  95. package/constants/coingecko.constants.d.ts +0 -1
  96. package/constants/coingecko.constants.mjs +10 -11
  97. package/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
  98. package/constants/deploy-data/deploy-data-solana.json.mjs +2 -28
  99. package/constants/function-signatures.constants.cjs +1 -1
  100. package/constants/function-signatures.constants.d.ts +1 -0
  101. package/constants/function-signatures.constants.mjs +4 -3
  102. package/constants/kyc.constants.cjs +1 -1
  103. package/constants/kyc.constants.mjs +40 -39
  104. package/constants/mediaUrls.constants.cjs +1 -1
  105. package/constants/mediaUrls.constants.d.ts +0 -1
  106. package/constants/mediaUrls.constants.mjs +1 -2
  107. package/constants/permit2.constants.cjs +1 -1
  108. package/constants/permit2.constants.d.ts +1 -0
  109. package/constants/permit2.constants.mjs +11 -10
  110. package/constants/server.constants.cjs +1 -1
  111. package/constants/server.constants.d.ts +123 -19
  112. package/constants/server.constants.mjs +142 -38
  113. package/constants/vite.constants.cjs +1 -1
  114. package/constants/vite.constants.mjs +13 -36
  115. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
  116. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +71 -68
  117. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  118. package/data-structures/Hinkal/Hinkal.d.ts +56 -45
  119. package/data-structures/Hinkal/Hinkal.mjs +348 -314
  120. package/data-structures/Hinkal/IHinkal.d.ts +54 -40
  121. package/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
  122. package/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
  123. package/data-structures/Hinkal/handleAutoDepositBack.mjs +49 -48
  124. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
  125. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +7 -0
  126. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +42 -0
  127. package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
  128. package/data-structures/Hinkal/hinkalActionReceive.mjs +24 -29
  129. package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
  130. package/data-structures/Hinkal/hinkalApprove.d.ts +3 -0
  131. package/data-structures/Hinkal/hinkalApprove.mjs +114 -0
  132. package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
  133. package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +20 -20
  134. package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  135. package/data-structures/Hinkal/hinkalDeposit.mjs +84 -88
  136. package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
  137. package/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
  138. package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +96 -77
  139. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
  140. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +4 -1
  141. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +80 -75
  142. package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
  143. package/data-structures/Hinkal/hinkalDepostAndBridge.d.ts +1 -1
  144. package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +150 -138
  145. package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
  146. package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +5 -4
  147. package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
  148. package/data-structures/Hinkal/hinkalInsideTransact.d.ts +4 -0
  149. package/data-structures/Hinkal/hinkalInsideTransact.mjs +119 -0
  150. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  151. package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -2
  152. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +118 -114
  153. package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
  154. package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +34 -36
  155. package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -1
  156. package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -40
  157. package/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
  158. package/data-structures/Hinkal/hinkalProxyToPrivate.mjs +32 -37
  159. package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -1
  160. package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +2 -1
  161. package/data-structures/Hinkal/hinkalSignSubAccount.mjs +15 -17
  162. package/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
  163. package/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +3 -4
  164. package/data-structures/Hinkal/hinkalSolanaDeposit.mjs +95 -84
  165. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
  166. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +1 -2
  167. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +182 -155
  168. package/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
  169. package/data-structures/Hinkal/hinkalSolanaProxySend.d.ts +3 -2
  170. package/data-structures/Hinkal/hinkalSolanaProxySend.mjs +40 -43
  171. package/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
  172. package/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +67 -71
  173. package/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
  174. package/data-structures/Hinkal/hinkalSolanaProxySwap.d.ts +1 -1
  175. package/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +59 -63
  176. package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
  177. package/data-structures/Hinkal/hinkalSolanaSwap.mjs +45 -48
  178. package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
  179. package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +48 -49
  180. package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
  181. package/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -2
  182. package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +68 -71
  183. package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  184. package/data-structures/Hinkal/hinkalSwap.mjs +78 -71
  185. package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
  186. package/data-structures/Hinkal/hinkalTransfer.mjs +70 -71
  187. package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  188. package/data-structures/Hinkal/hinkalWithdraw.mjs +79 -81
  189. package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
  190. package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +103 -105
  191. package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  192. package/data-structures/Hinkal/resetMerkleTrees.d.ts +1 -1
  193. package/data-structures/Hinkal/resetMerkleTrees.mjs +53 -107
  194. package/data-structures/IndexedDB/activity-db.cjs +1 -1
  195. package/data-structures/IndexedDB/activity-db.d.ts +0 -1
  196. package/data-structures/IndexedDB/activity-db.mjs +75 -91
  197. package/data-structures/IndexedDB/balances-db.cjs +1 -1
  198. package/data-structures/IndexedDB/balances-db.mjs +37 -40
  199. package/data-structures/IndexedDB/contact-db.cjs +1 -1
  200. package/data-structures/IndexedDB/contact-db.mjs +13 -16
  201. package/data-structures/IndexedDB/signatures-db.cjs +1 -1
  202. package/data-structures/IndexedDB/signatures-db.mjs +40 -25
  203. package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
  204. package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +84 -82
  205. package/data-structures/TokenDBs/token-visibility-db.cjs +1 -1
  206. package/data-structures/TokenDBs/token-visibility-db.mjs +36 -22
  207. package/data-structures/crypto-keys/keys.cjs +1 -1
  208. package/data-structures/crypto-keys/keys.d.ts +11 -0
  209. package/data-structures/crypto-keys/keys.mjs +107 -47
  210. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.cjs +1 -1
  211. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.d.ts +2 -3
  212. package/data-structures/event-service/evm/AbstractAccessTokenSnapshotService.mjs +9 -9
  213. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.cjs +1 -1
  214. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.d.ts +2 -3
  215. package/data-structures/event-service/evm/AbstractApprovalsSnapshotService.mjs +5 -5
  216. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.cjs +1 -1
  217. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.d.ts +2 -3
  218. package/data-structures/event-service/evm/AbstractCommitmentsSnapshotService.mjs +6 -6
  219. package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
  220. package/data-structures/event-service/evm/AbstractEventService.d.ts +2 -4
  221. package/data-structures/event-service/evm/AbstractEventService.mjs +19 -19
  222. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
  223. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +3 -3
  224. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +5 -6
  225. package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
  226. package/data-structures/event-service/evm/AbstractSnapshotService.d.ts +2 -1
  227. package/data-structures/event-service/evm/AbstractSnapshotService.mjs +4 -3
  228. package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
  229. package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +5 -10
  230. package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +35 -39
  231. package/data-structures/event-service/index.d.ts +0 -4
  232. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.cjs +1 -1
  233. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.d.ts +2 -3
  234. package/data-structures/event-service/solana/AbstractSolanaAccessTokenSnapshotService.mjs +6 -6
  235. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
  236. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.d.ts +3 -4
  237. package/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +8 -8
  238. package/data-structures/event-service/solana/AbstractSolanaEventService.cjs +1 -1
  239. package/data-structures/event-service/solana/AbstractSolanaEventService.d.ts +10 -4
  240. package/data-structures/event-service/solana/AbstractSolanaEventService.mjs +7 -10
  241. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
  242. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.d.ts +2 -3
  243. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +1 -1
  244. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.cjs +1 -1
  245. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.d.ts +2 -1
  246. package/data-structures/event-service/solana/AbstractSolanaSnapshotService.mjs +2 -1
  247. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
  248. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.d.ts +16 -11
  249. package/data-structures/event-service/solana/SolanaBlockchainEventEmitter.mjs +66 -64
  250. package/data-structures/index.d.ts +0 -3
  251. package/data-structures/provider-adapter/IProviderAdapter.d.ts +13 -8
  252. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
  253. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +4 -6
  254. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
  255. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +4 -6
  256. package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.cjs +1 -1
  257. package/data-structures/snapshot/evm-snapshots/ClientCommitmentsSnapshotService.mjs +4 -6
  258. package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.cjs +1 -1
  259. package/data-structures/snapshot/evm-snapshots/ClientNullifierSnapshotService.mjs +4 -6
  260. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.cjs +1 -1
  261. package/data-structures/snapshot/solana-snapshots/ClientSolanaAccessTokenSnapshotService.mjs +4 -6
  262. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.cjs +1 -1
  263. package/data-structures/snapshot/solana-snapshots/ClientSolanaCommitmentsSnapshotService.mjs +4 -5
  264. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.cjs +1 -1
  265. package/data-structures/snapshot/solana-snapshots/ClientSolanaNullifierSnapshotService.mjs +4 -6
  266. package/error-handling/error-codes.constants.cjs +1 -1
  267. package/error-handling/error-codes.constants.d.ts +0 -1
  268. package/error-handling/error-codes.constants.mjs +3 -4
  269. package/error-handling/get-error.message.cjs +1 -1
  270. package/error-handling/get-error.message.mjs +27 -21
  271. package/error-handling/handleErrorRestore.cjs +1 -0
  272. package/error-handling/handleErrorRestore.d.ts +2 -0
  273. package/error-handling/handleErrorRestore.mjs +11 -0
  274. package/error-handling/index.d.ts +1 -0
  275. package/functions/kyc/authentoHelper.cjs +1 -0
  276. package/functions/kyc/authentoHelper.d.ts +12 -0
  277. package/functions/kyc/authentoHelper.mjs +30 -0
  278. package/functions/kyc/zkMeHelper.cjs +1 -1
  279. package/functions/kyc/zkMeHelper.mjs +17 -18
  280. package/functions/pre-transaction/constructAdminData.cjs +1 -1
  281. package/functions/pre-transaction/constructAdminData.d.ts +2 -2
  282. package/functions/pre-transaction/constructAdminData.mjs +18 -12
  283. package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
  284. package/functions/pre-transaction/getExternalSwapAddress.d.ts +2 -1
  285. package/functions/pre-transaction/getExternalSwapAddress.mjs +8 -8
  286. package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
  287. package/functions/pre-transaction/getVolatileTransferAmount.mjs +36 -21
  288. package/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
  289. package/functions/pre-transaction/merge-with-fee-structure-emporium.d.ts +1 -1
  290. package/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +17 -17
  291. package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -1
  292. package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +9 -1
  293. package/functions/pre-transaction/outputApprovalDataProcessing.mjs +34 -19
  294. package/functions/pre-transaction/sendV0Transaction.cjs +1 -1
  295. package/functions/pre-transaction/sendV0Transaction.mjs +50 -53
  296. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -1
  297. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +1 -1
  298. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +4 -4
  299. package/functions/private-wallet/emporium.helpers.cjs +1 -1
  300. package/functions/private-wallet/emporium.helpers.d.ts +6 -3
  301. package/functions/private-wallet/emporium.helpers.mjs +127 -89
  302. package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
  303. package/functions/private-wallet/emporium.swap.helpers.d.ts +4 -1
  304. package/functions/private-wallet/emporium.swap.helpers.mjs +102 -100
  305. package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
  306. package/functions/snarkjs/constructEmporiumProof.mjs +49 -49
  307. package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
  308. package/functions/snarkjs/constructSolanaZkProof.mjs +20 -18
  309. package/functions/snarkjs/fetchMerkleTreeSiblings.cjs +1 -1
  310. package/functions/snarkjs/fetchMerkleTreeSiblings.mjs +10 -11
  311. package/functions/utils/addresses.cjs +1 -1
  312. package/functions/utils/addresses.d.ts +0 -1
  313. package/functions/utils/addresses.mjs +12 -13
  314. package/functions/utils/cacheFunctions.cjs +1 -1
  315. package/functions/utils/cacheFunctions.mjs +2 -2
  316. package/functions/utils/create-provider.cjs +1 -1
  317. package/functions/utils/create-provider.d.ts +1 -1
  318. package/functions/utils/create-provider.mjs +9 -13
  319. package/functions/utils/get-hinkal-approvals.cjs +1 -0
  320. package/functions/utils/get-hinkal-approvals.d.ts +3 -0
  321. package/functions/utils/get-hinkal-approvals.mjs +38 -0
  322. package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
  323. package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
  324. package/functions/utils/getUtxosFromReceipt.utils.mjs +11 -11
  325. package/functions/utils/index.d.ts +1 -0
  326. package/functions/utils/involves-permit2-op.cjs +1 -1
  327. package/functions/utils/involves-permit2-op.d.ts +1 -0
  328. package/functions/utils/involves-permit2-op.mjs +6 -4
  329. package/functions/utils/mutexes.utils.cjs +1 -1
  330. package/functions/utils/mutexes.utils.d.ts +1 -1
  331. package/functions/utils/mutexes.utils.mjs +3 -3
  332. package/functions/utils/nftTokenFunctions.cjs +1 -1
  333. package/functions/utils/nftTokenFunctions.mjs +23 -8
  334. package/functions/utils/prepareHinkal.cjs +1 -1
  335. package/functions/utils/prepareHinkal.d.ts +13 -6
  336. package/functions/utils/prepareHinkal.mjs +72 -45
  337. package/functions/utils/publicBalance.utils.cjs +1 -1
  338. package/functions/utils/publicBalance.utils.mjs +54 -49
  339. package/functions/utils/replaceAddressInCalldata.cjs +1 -0
  340. package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
  341. package/functions/utils/replaceAddressInCalldata.mjs +7 -0
  342. package/functions/utils/string.utils.cjs +1 -1
  343. package/functions/utils/string.utils.d.ts +0 -1
  344. package/functions/utils/string.utils.mjs +14 -18
  345. package/functions/utils/token-check.utils.cjs +1 -1
  346. package/functions/utils/token-check.utils.d.ts +0 -3
  347. package/functions/utils/token-check.utils.mjs +7 -18
  348. package/functions/utils/upToDateState.cjs +1 -1
  349. package/functions/utils/upToDateState.d.ts +1 -1
  350. package/functions/utils/upToDateState.mjs +4 -4
  351. package/functions/utils/walletBalances.utils.cjs +1 -1
  352. package/functions/utils/walletBalances.utils.d.ts +17 -2
  353. package/functions/utils/walletBalances.utils.mjs +36 -5
  354. package/functions/web3/events/getApprovedBalance.cjs +1 -1
  355. package/functions/web3/events/getApprovedBalance.d.ts +4 -3
  356. package/functions/web3/events/getApprovedBalance.mjs +44 -39
  357. package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  358. package/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -3
  359. package/functions/web3/events/getInputUtxoAndBalance.mjs +150 -129
  360. package/functions/web3/events/getShieldedBalance.cjs +2 -2
  361. package/functions/web3/events/getShieldedBalance.d.ts +1 -1
  362. package/functions/web3/events/getShieldedBalance.mjs +75 -73
  363. package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
  364. package/functions/web3/events/getTransactionLogEvents.mjs +38 -38
  365. package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
  366. package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +10 -13
  367. package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
  368. package/functions/web3/functionCalls/accessTokenCalls.d.ts +6 -1
  369. package/functions/web3/functionCalls/accessTokenCalls.mjs +21 -12
  370. package/functions/web3/functionCalls/approveToken.cjs +1 -1
  371. package/functions/web3/functionCalls/approveToken.d.ts +1 -1
  372. package/functions/web3/functionCalls/approveToken.mjs +46 -50
  373. package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -1
  374. package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +1 -1
  375. package/functions/web3/functionCalls/approveTokensToHinkal.mjs +6 -6
  376. package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
  377. package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -1
  378. package/functions/web3/functionCalls/estimateGasRelayer.mjs +10 -10
  379. package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
  380. package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
  381. package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +32 -0
  382. package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
  383. package/functions/web3/functionCalls/transactCallDirect.d.ts +1 -1
  384. package/functions/web3/functionCalls/transactCallDirect.mjs +40 -36
  385. package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  386. package/functions/web3/functionCalls/transactCallRelayer.d.ts +3 -3
  387. package/functions/web3/functionCalls/transactCallRelayer.mjs +54 -54
  388. package/functions/web3/getContractMetadata.cjs +1 -1
  389. package/functions/web3/getContractMetadata.mjs +22 -17
  390. package/functions/web3/getPublicAddressBalance.cjs +1 -1
  391. package/functions/web3/getPublicAddressBalance.d.ts +1 -1
  392. package/functions/web3/getPublicAddressBalance.mjs +6 -6
  393. package/functions/web3/getTokenHolder.cjs +1 -1
  394. package/functions/web3/getTokenHolder.mjs +27 -27
  395. package/functions/web3/index.d.ts +0 -1
  396. package/functions/web3/lifiAPI.cjs +1 -1
  397. package/functions/web3/lifiAPI.d.ts +1 -1
  398. package/functions/web3/lifiAPI.mjs +12 -12
  399. package/functions/web3/odosAPI.cjs +1 -1
  400. package/functions/web3/odosAPI.mjs +19 -6
  401. package/functions/web3/okxAPI.cjs +1 -1
  402. package/functions/web3/okxAPI.mjs +13 -13
  403. package/functions/web3/oneInchAPI.cjs +1 -1
  404. package/functions/web3/oneInchAPI.mjs +20 -7
  405. package/functions/web3/runContractFunction.cjs +1 -1
  406. package/functions/web3/runContractFunction.mjs +56 -38
  407. package/functions/web3/uniswapAPI.cjs +1 -1
  408. package/functions/web3/uniswapAPI.mjs +34 -22
  409. package/index.cjs +1 -1
  410. package/index.mjs +922 -920
  411. package/package.json +2 -3
  412. package/providers/EthersProviderAdapter.cjs +1 -1
  413. package/providers/EthersProviderAdapter.d.ts +17 -10
  414. package/providers/EthersProviderAdapter.mjs +76 -45
  415. package/providers/SolanaProviderAdapter.cjs +1 -1
  416. package/providers/SolanaProviderAdapter.d.ts +11 -7
  417. package/providers/SolanaProviderAdapter.mjs +31 -16
  418. package/providers/WagmiProviderAdapter.cjs +1 -1
  419. package/providers/WagmiProviderAdapter.d.ts +17 -11
  420. package/providers/WagmiProviderAdapter.mjs +117 -86
  421. package/providers/prepareEthersHinkal.cjs +1 -1
  422. package/providers/prepareEthersHinkal.mjs +9 -14
  423. package/providers/prepareWagmiHinkal.cjs +1 -1
  424. package/providers/prepareWagmiHinkal.mjs +9 -15
  425. package/types/TransactionSimulator.types.d.ts +9 -2
  426. package/types/activities.types.d.ts +0 -2
  427. package/types/admin.types.cjs +1 -1
  428. package/types/admin.types.d.ts +6 -0
  429. package/types/admin.types.mjs +2 -2
  430. package/types/balances.types.d.ts +1 -0
  431. package/types/bridging.types.d.ts +29 -0
  432. package/types/cache.types.cjs +1 -1
  433. package/types/cache.types.d.ts +3 -6
  434. package/types/cache.types.mjs +1 -1
  435. package/types/coingecko.types.d.ts +0 -5
  436. package/types/duneAPI.types.d.ts +9 -0
  437. package/types/ethereum-network.types.d.ts +0 -1
  438. package/types/hinkal.types.cjs +1 -1
  439. package/types/hinkal.types.d.ts +1 -1
  440. package/types/hinkal.types.mjs +18 -18
  441. package/types/index.d.ts +2 -2
  442. package/types/proxy.types.d.ts +3 -6
  443. package/types/sandbox.types.cjs +1 -1
  444. package/types/sandbox.types.d.ts +39 -10
  445. package/types/sandbox.types.mjs +2 -2
  446. package/types/scheduled-transactions.types.cjs +1 -1
  447. package/types/scheduled-transactions.types.d.ts +6 -0
  448. package/types/scheduled-transactions.types.mjs +3 -2
  449. package/types/session.types.d.ts +0 -2
  450. package/types/solana.types.d.ts +0 -9
  451. package/types/token-prices.types.cjs +1 -1
  452. package/types/token-prices.types.d.ts +0 -7
  453. package/types/token-prices.types.mjs +2 -4
  454. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  455. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  456. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  457. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  458. package/webworker/viteWorkerURL.constant.cjs +3 -3
  459. package/webworker/viteWorkerURL.constant.mjs +3 -3
  460. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  461. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
  462. package/API/get-token-price-chart-data.cjs +0 -1
  463. package/API/get-token-price-chart-data.d.ts +0 -16
  464. package/API/get-token-price-chart-data.mjs +0 -13
  465. package/API/onrampCalls.cjs +0 -1
  466. package/API/onrampCalls.d.ts +0 -20
  467. package/API/onrampCalls.mjs +0 -15
  468. package/API/unspent-utxos-calls.cjs +0 -1
  469. package/API/unspent-utxos-calls.d.ts +0 -26
  470. package/API/unspent-utxos-calls.mjs +0 -26
  471. package/data-structures/AccountActions/AccountActions.cjs +0 -1
  472. package/data-structures/AccountActions/AccountActions.d.ts +0 -18
  473. package/data-structures/AccountActions/AccountActions.mjs +0 -78
  474. package/data-structures/AccountActions/index.d.ts +0 -1
  475. package/data-structures/BlockchainEvent/BlockchainEvent.cjs +0 -1
  476. package/data-structures/BlockchainEvent/BlockchainEvent.d.ts +0 -14
  477. package/data-structures/BlockchainEvent/BlockchainEvent.mjs +0 -41
  478. package/data-structures/PublicBalance/PublicBalanceWatcher.cjs +0 -1
  479. package/data-structures/PublicBalance/PublicBalanceWatcher.d.ts +0 -20
  480. package/data-structures/PublicBalance/PublicBalanceWatcher.mjs +0 -124
  481. package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.cjs +0 -1
  482. package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.d.ts +0 -15
  483. package/data-structures/PublicBalance/SolanaPublicBalancerWatcher.mjs +0 -64
  484. package/data-structures/PublicBalance/index.d.ts +0 -2
  485. package/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +0 -1
  486. package/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +0 -11
  487. package/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +0 -21
  488. package/data-structures/event-service/evm/PollingBlockchainEventEmitter.cjs +0 -1
  489. package/data-structures/event-service/evm/PollingBlockchainEventEmitter.d.ts +0 -6
  490. package/data-structures/event-service/evm/PollingBlockchainEventEmitter.mjs +0 -16
  491. package/data-structures/event-service/helpers/ClientEventHelper.cjs +0 -1
  492. package/data-structures/event-service/helpers/ClientEventHelper.d.ts +0 -11
  493. package/data-structures/event-service/helpers/ClientEventHelper.mjs +0 -26
  494. package/data-structures/event-service/helpers/PollingEventHelper.cjs +0 -1
  495. package/data-structures/event-service/helpers/PollingEventHelper.d.ts +0 -5
  496. package/data-structures/event-service/helpers/PollingEventHelper.mjs +0 -14
  497. package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.cjs +0 -1
  498. package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.d.ts +0 -11
  499. package/data-structures/event-service/solana/ClientSolanaBlockchainEventEmitter.mjs +0 -22
  500. package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.cjs +0 -1
  501. package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.d.ts +0 -6
  502. package/data-structures/event-service/solana/PollingSolanaBlockchainEventEmitter.mjs +0 -16
  503. package/functions/utils/enum.utils.cjs +0 -1
  504. package/functions/utils/enum.utils.mjs +0 -14
  505. package/functions/utils/socket.utils.cjs +0 -1
  506. package/functions/utils/socket.utils.d.ts +0 -1
  507. package/functions/utils/socket.utils.mjs +0 -12
  508. package/functions/web3/crypto.cjs +0 -1
  509. package/functions/web3/crypto.d.ts +0 -1
  510. package/functions/web3/crypto.mjs +0 -7
  511. package/types/events.types.cjs +0 -1
  512. package/types/events.types.d.ts +0 -9
  513. package/types/events.types.mjs +0 -5
  514. package/types/onramp.types.cjs +0 -1
  515. package/types/onramp.types.d.ts +0 -58
  516. package/types/onramp.types.mjs +0 -4
@@ -4,87 +4,86 @@ import { solanaNativeAddress as g, HINKAL_PRIVATE_SEND_VARIABLE_RATE as H } from
4
4
  import "../../types/transactions.types.mjs";
5
5
  import "../../types/activities.types.mjs";
6
6
  import { addPaddingToUtxos as M } from "../../functions/web3/events/getShieldedBalance.mjs";
7
- import { outputUtxoProcessing as G } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
8
- import { getCurrentTimeInSeconds as Y } from "../../functions/utils/time.utils.mjs";
7
+ import { outputUtxoProcessing as Y } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
8
+ import { getCurrentTimeInSeconds as Z } from "../../functions/utils/time.utils.mjs";
9
9
  import { transactionErrorCodes as m } from "../../error-handling/error-codes.constants.mjs";
10
- import { getFeeStructure as Z } from "../../functions/pre-transaction/getFeeStructure.mjs";
11
- import { calcEncryptedOutputs as j } from "../../functions/snarkjs/common.snarkjs.mjs";
12
- import { constructSolanaZkProof as q } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
13
- import { Utxo as R } from "../utxo/Utxo.mjs";
10
+ import { getFeeStructure as j } from "../../functions/pre-transaction/getFeeStructure.mjs";
11
+ import { calcEncryptedOutputs as q } from "../../functions/snarkjs/common.snarkjs.mjs";
12
+ import { constructSolanaZkProof as G } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
13
+ import { Utxo as I } from "../utxo/Utxo.mjs";
14
14
  import { randomBigInt as J } from "../../functions/web3/etherFunctions.mjs";
15
15
  import { solanaTransactCallRelayer as Q } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
16
16
  import { isValidPrivateAddress as W } from "../../functions/utils/addresses.mjs";
17
17
  import { networkRegistry as X } from "../../constants/chains.constants.mjs";
18
18
  import { ethers as $ } from "ethers";
19
- import { validateAndGetChainId as rr } from "../../functions/utils/token-check.utils.mjs";
20
- const wr = async (t, c, e, d, w, S, p = !1) => {
21
- if (p)
19
+ const Ir = async (r, R, o, c, w, S, d = !1) => {
20
+ if (d)
22
21
  throw new Error("onlyGasEstimate is not supported for Solana transfer");
23
- if (!W(d))
22
+ if (!W(c))
24
23
  throw Error(m.RECIPIENT_FORMAT_INCORRECT);
25
- const r = rr(c), { originalDeployer: f, hinkalIdl: u } = X[r].contractData;
26
- if (!f || !u)
24
+ const n = r.getCurrentChainId(), { originalDeployer: p, hinkalIdl: u } = X[n].contractData;
25
+ if (!p || !u)
27
26
  throw new Error("missing data");
28
- const { userKeys: N, merkleTreeAccessTokenByChain: x, merkleTreeHinkalByChain: O } = t, o = c.map((a) => a.erc20TokenAddress);
29
- if (o.length > 1)
27
+ const { userKeys: N, merkleTreeAccessToken: x, merkleTreeHinkal: O } = r, t = R.map((a) => a.erc20TokenAddress);
28
+ if (t.length > 1)
30
29
  throw new Error("Solana Transfer: Only one mint address is supported");
31
- const P = S ?? await Z(r, w, o, b.Transact), i = -e[0] * (10000n - H) / 10000n;
32
- if (e[0] -= P.flatFee, i <= 0n)
30
+ const P = S ?? await j(n, w, t, b.Transact), i = -o[0] * (10000n - H) / 10000n;
31
+ if (o[0] -= P.flatFee, i <= 0n)
33
32
  throw Error(m.RECIPIENT_AMOUNT_INVALID);
34
- const l = -e[0] - i, n = (await M(t, r, o, e, 6))[0], A = Y().toString(), { outputUtxos: _ } = G(
35
- t.userKeys,
36
- n,
37
- e[0],
38
- A,
33
+ const f = -o[0] - i, e = (await M(r, t, o, 6))[0], l = Z().toString(), { outputUtxos: _ } = Y(
34
+ r.userKeys,
35
+ e,
36
+ o[0],
37
+ l,
39
38
  void 0,
40
39
  !1
41
- ), y = _[0], [h, C, U] = d.split(","), E = new R({
40
+ ), A = _[0], [U, C, h] = c.split(","), y = new I({
42
41
  amount: i,
43
- erc20TokenAddress: n[0].erc20TokenAddress,
44
- mintAddress: n[0].mintAddress,
45
- timeStamp: A,
46
- randomization: BigInt(h),
42
+ erc20TokenAddress: e[0].erc20TokenAddress,
43
+ mintAddress: e[0].mintAddress,
44
+ timeStamp: l,
45
+ randomization: BigInt(U),
47
46
  stealthAddress: C,
48
- encryptionKey: U
49
- }), s = await t.getRandomRelay(r, !p);
47
+ encryptionKey: h
48
+ }), s = await r.getRandomRelay(!d);
50
49
  if (!s)
51
50
  throw Error(m.RELAYER_NOT_AVAILABLE);
52
- const B = R.findCorrectRandomization(J(31), t.userKeys.getShieldedPrivateKey()), I = {
53
- tokenNumber: o.length,
54
- nullifierAmount: n.length,
51
+ const v = I.findCorrectRandomization(J(31), r.userKeys.getShieldedPrivateKey()), E = {
52
+ tokenNumber: t.length,
53
+ nullifierAmount: e.length,
55
54
  outputAmount: 2
56
- }, v = t.getSolanaProgram(u), T = j([[y, E]])[0].map((a) => Array.from($.utils.arrayify(a))), { proofAArr: K, proofBArr: L, proofCArr: k, publicInputsArr: F } = await q(
57
- t.generateProofRemotely,
58
- f,
59
- O[r],
60
- x[r],
55
+ }, B = r.getSolanaProgram(u), T = q([[A, y]])[0].map((a) => Array.from($.utils.arrayify(a))), { proofAArr: K, proofBArr: L, proofCArr: k, publicInputsArr: F } = await G(
56
+ r.generateProofRemotely,
57
+ p,
58
+ O,
59
+ x,
61
60
  N,
62
- v,
63
- [o[0]],
64
- [n],
65
- [[y, E]],
66
61
  B,
67
- l,
62
+ [t[0]],
63
+ [e],
64
+ [[A, y]],
65
+ v,
66
+ f,
68
67
  0n,
69
68
  g,
70
69
  s,
71
- I,
70
+ E,
72
71
  T,
73
- r
74
- ), V = o[0] === g, z = {
72
+ n
73
+ ), V = t[0] === g, z = {
75
74
  recipient: s,
76
- mint: V ? void 0 : o[0]
75
+ mint: V ? void 0 : t[0]
77
76
  }, D = {
78
77
  proofAArr: K,
79
78
  proofBArr: L,
80
79
  proofCArr: k,
81
80
  publicInputsArr: F,
82
81
  encryptedOutputs: T,
83
- relayerFee: l.toString(),
84
- dimensions: I
82
+ relayerFee: f.toString(),
83
+ dimensions: E
85
84
  };
86
- return Q({ chainId: r, relayAddress: s, functionName: "transfer", args: D, accounts: z });
85
+ return Q(n, { relayAddress: s, functionName: "transfer", args: D, accounts: z });
87
86
  };
88
87
  export {
89
- wr as hinkalSolanaTransfer
88
+ Ir as hinkalSolanaTransfer
90
89
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const K=require("../../types/external-action.types.cjs"),b=require("../../constants/protocol.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const N=require("../../functions/web3/events/getShieldedBalance.cjs"),M=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),D=require("../../functions/utils/time.utils.cjs"),L=require("../../error-handling/error-codes.constants.cjs"),W=require("../../functions/pre-transaction/getFeeStructure.cjs"),j=require("../../functions/snarkjs/common.snarkjs.cjs"),z=require("../../functions/snarkjs/constructSolanaZkProof.cjs"),Z=require("../utxo/Utxo.cjs"),G=require("../../functions/web3/etherFunctions.cjs"),H=require("../../functions/web3/functionCalls/transactCallRelayer.cjs");require("../../constants/token-data/index.cjs");const V=require("../../constants/chains.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");const Y=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),J=require("ethers"),Q=require("../../functions/utils/token-check.utils.cjs"),X=async(r,c,o,u,m,g,l=!1)=>{if(l)throw new Error("onlyGasEstimate is not supported for Solana withdraw");const e=Q.validateAndGetChainId(c),t=c.map(U=>U.erc20TokenAddress),h=await r.getEthereumAddressByChain(e),{originalDeployer:d,hinkalIdl:q}=V.networkRegistry[e].contractData;if(!d||!q)throw new Error("missing data");const{userKeys:y,merkleTreeAccessTokenByChain:f,merkleTreeHinkalByChain:w}=r,s=g??await W.getFeeStructure(e,m,t,K.ExternalActionId.Transact);o[0]-=s.flatFee;const{patchAccessTokenMerkleTree:S,kycRequired:T,hasAccessToken:k}=await Y.shouldPatchAccessTokenMerkleTree(r,e,t,o);if(t.length>1)throw new Error("Solana Withdraw: Only one mint address is supported");const n=[...await N.addPaddingToUtxos(r,e,t,o,6)][0],R=D.getCurrentTimeInSeconds().toString(),{outputUtxos:a}=M.outputUtxoProcessing(r.userKeys,n,o[0],R,void 0,!1),i=await r.getRandomRelay(e,!l);if(!i)throw Error(L.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const E=Z.Utxo.findCorrectRandomization(G.randomBigInt(31),r.userKeys.getShieldedPrivateKey()),p={tokenNumber:t.length,nullifierAmount:n.length,outputAmount:a.length},P=r.getSolanaProgram(q),x=j.calcEncryptedOutputs([a])[0][0],A=Array.from(J.ethers.utils.arrayify(x)),{proofAArr:v,proofBArr:C,proofCArr:_,publicInputsArr:B}=await z.constructSolanaZkProof(r.generateProofRemotely,d,w[e],f[e],y,P,[t[0]],[n],[a],E,s.flatFee,s.variableRate,u,i,p,[A],e,S),I=t[0]===b.solanaNativeAddress,F={recipient:u,mint:I?void 0:t[0]},O={proofAArr:v,proofBArr:C,proofCArr:_,publicInputsArr:B,encryptedOutputs:[A],relayerFee:s.flatFee.toString(),dimensions:p};return H.solanaTransactCallRelayer({chainId:e,relayAddress:i,functionName:"transact",args:O,accounts:F,solanaAccessTokenData:!k&&T?{ethereumAddress:h,accessKey:y.getAccessKey()}:void 0})};exports.hinkalSolanaWithdraw=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const C=require("../../types/external-action.types.cjs"),K=require("../../constants/protocol.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const b=require("../../functions/web3/events/getShieldedBalance.cjs"),B=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),N=require("../../functions/utils/time.utils.cjs"),M=require("../../error-handling/error-codes.constants.cjs"),D=require("../../functions/pre-transaction/getFeeStructure.cjs"),L=require("../../functions/snarkjs/common.snarkjs.cjs"),W=require("../../functions/snarkjs/constructSolanaZkProof.cjs"),j=require("../utxo/Utxo.cjs"),z=require("../../functions/web3/etherFunctions.cjs"),Z=require("../../functions/web3/functionCalls/transactCallRelayer.cjs");require("../../constants/token-data/index.cjs");const H=require("../../constants/chains.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");const V=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),Y=require("ethers"),G=async(e,r,t,i,g,f,u=!1)=>{if(u)throw new Error("onlyGasEstimate is not supported for Solana withdraw");const o=e.getCurrentChainId(),h=await e.getEthereumAddress(),{originalDeployer:l,hinkalIdl:d}=H.networkRegistry[o].contractData;if(!l||!d)throw new Error("missing data");const{userKeys:q,merkleTreeAccessToken:w,merkleTreeHinkal:S}=e,n=f??await D.getFeeStructure(o,g,r,C.ExternalActionId.Transact);t[0]-=n.flatFee;const{patchAccessTokenMerkleTree:m,kycRequired:A,hasAccessToken:T}=await V.shouldPatchAccessTokenMerkleTree(e,r,t);if(r.length>1)throw new Error("Solana Withdraw: Only one mint address is supported");const a=[...await b.addPaddingToUtxos(e,r,t,6)][0],k=N.getCurrentTimeInSeconds().toString(),{outputUtxos:s}=B.outputUtxoProcessing(e.userKeys,a,t[0],k,void 0,!1),c=await e.getRandomRelay(!u);if(!c)throw Error(M.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const R=j.Utxo.findCorrectRandomization(z.randomBigInt(31),e.userKeys.getShieldedPrivateKey()),p={tokenNumber:r.length,nullifierAmount:a.length,outputAmount:s.length},E=e.getSolanaProgram(d),P=L.calcEncryptedOutputs([s])[0][0],y=Array.from(Y.ethers.utils.arrayify(P)),{proofAArr:x,proofBArr:v,proofCArr:I,publicInputsArr:_}=await W.constructSolanaZkProof(e.generateProofRemotely,l,S,w,q,E,[r[0]],[a],[s],R,n.flatFee,n.variableRate,i,c,p,[y],o,m),F=r[0]===K.solanaNativeAddress,O={recipient:i,mint:F?void 0:r[0]},U={proofAArr:x,proofBArr:v,proofCArr:I,publicInputsArr:_,encryptedOutputs:[y],relayerFee:n.flatFee.toString(),dimensions:p};return Z.solanaTransactCallRelayer(o,{relayAddress:c,functionName:"transact",args:U,accounts:O,solanaAccessTokenData:!T&&A?{ethereumAddress:h,accessKey:q.getAccessKey()}:void 0})};exports.hinkalSolanaWithdraw=G;
@@ -1,4 +1,3 @@
1
1
  import { FeeStructure } from '../../types';
2
2
  import { IHinkal } from './IHinkal';
3
- import { ERC20Token } from '../../types/token.types';
4
- export declare const hinkalSolanaWithdraw: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountChanges: bigint[], recipientAddress: string, feeToken?: string, feeStructureOverride?: FeeStructure, onlyGasEstimate?: boolean) => Promise<import('../../types/relayer.types').RelayerTransaction>;
3
+ export declare const hinkalSolanaWithdraw: (hinkal: IHinkal, mintAddresses: string[], amountChanges: bigint[], recipientAddress: string, feeToken?: string, feeStructureOverride?: FeeStructure, onlyGasEstimate?: boolean) => Promise<import('../../types/relayer.types').RelayerTransaction>;
@@ -1,20 +1,20 @@
1
1
  import "../../types/circom-data.types.mjs";
2
- import { ExternalActionId as b } from "../../types/external-action.types.mjs";
3
- import { solanaNativeAddress as D } from "../../constants/protocol.constants.mjs";
2
+ import { ExternalActionId as B } from "../../types/external-action.types.mjs";
3
+ import { solanaNativeAddress as C } from "../../constants/protocol.constants.mjs";
4
4
  import "../../types/transactions.types.mjs";
5
5
  import "../../types/activities.types.mjs";
6
- import { addPaddingToUtxos as L } from "../../functions/web3/events/getShieldedBalance.mjs";
7
- import { outputUtxoProcessing as z } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
8
- import { getCurrentTimeInSeconds as M } from "../../functions/utils/time.utils.mjs";
9
- import { transactionErrorCodes as W } from "../../error-handling/error-codes.constants.mjs";
10
- import { getFeeStructure as _ } from "../../functions/pre-transaction/getFeeStructure.mjs";
11
- import { calcEncryptedOutputs as q } from "../../functions/snarkjs/common.snarkjs.mjs";
12
- import { constructSolanaZkProof as G } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
13
- import { Utxo as H } from "../utxo/Utxo.mjs";
14
- import { randomBigInt as V } from "../../functions/web3/etherFunctions.mjs";
15
- import { solanaTransactCallRelayer as Y } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
6
+ import { addPaddingToUtxos as b } from "../../functions/web3/events/getShieldedBalance.mjs";
7
+ import { outputUtxoProcessing as D } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
8
+ import { getCurrentTimeInSeconds as L } from "../../functions/utils/time.utils.mjs";
9
+ import { transactionErrorCodes as z } from "../../error-handling/error-codes.constants.mjs";
10
+ import { getFeeStructure as M } from "../../functions/pre-transaction/getFeeStructure.mjs";
11
+ import { calcEncryptedOutputs as W } from "../../functions/snarkjs/common.snarkjs.mjs";
12
+ import { constructSolanaZkProof as _ } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
13
+ import { Utxo as q } from "../utxo/Utxo.mjs";
14
+ import { randomBigInt as H } from "../../functions/web3/etherFunctions.mjs";
15
+ import { solanaTransactCallRelayer as V } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
16
16
  import "../../constants/token-data/index.mjs";
17
- import { networkRegistry as Z } from "../../constants/chains.constants.mjs";
17
+ import { networkRegistry as Y } from "../../constants/chains.constants.mjs";
18
18
  import "../../constants/contracts.constants.mjs";
19
19
  import "../../constants/kyc.constants.mjs";
20
20
  import "../../constants/server.constants.mjs";
@@ -27,82 +27,79 @@ import "../../constants/presale.constants.mjs";
27
27
  import "../../constants/activity.constants.mjs";
28
28
  import "../../constants/tasks.constants.mjs";
29
29
  import "../../constants/events.constants.mjs";
30
- import { shouldPatchAccessTokenMerkleTree as j } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
31
- import { ethers as J } from "ethers";
32
- import { validateAndGetChainId as Q } from "../../functions/utils/token-check.utils.mjs";
33
- const Ct = async (r, m, e, c, A, g, p = !1) => {
34
- if (p)
30
+ import { shouldPatchAccessTokenMerkleTree as Z } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
31
+ import { ethers as j } from "ethers";
32
+ const kt = async (t, r, o, s, y, g, m = !1) => {
33
+ if (m)
35
34
  throw new Error("onlyGasEstimate is not supported for Solana withdraw");
36
- const t = Q(m), o = m.map((U) => U.erc20TokenAddress), w = await r.getEthereumAddressByChain(t), { originalDeployer: d, hinkalIdl: l } = Z[t].contractData;
37
- if (!d || !l)
35
+ const e = t.getCurrentChainId(), w = await t.getEthereumAddress(), { originalDeployer: p, hinkalIdl: u } = Y[e].contractData;
36
+ if (!p || !u)
38
37
  throw new Error("missing data");
39
- const { userKeys: f, merkleTreeAccessTokenByChain: h, merkleTreeHinkalByChain: T } = r, i = g ?? await _(t, A, o, b.Transact);
40
- e[0] -= i.flatFee;
41
- const { patchAccessTokenMerkleTree: S, kycRequired: E, hasAccessToken: R } = await j(
42
- r,
38
+ const { userKeys: f, merkleTreeAccessToken: A, merkleTreeHinkal: T } = t, a = g ?? await M(e, y, r, B.Transact);
39
+ o[0] -= a.flatFee;
40
+ const { patchAccessTokenMerkleTree: S, kycRequired: h, hasAccessToken: E } = await Z(
43
41
  t,
44
- o,
45
- e
42
+ r,
43
+ o
46
44
  );
47
- if (o.length > 1)
45
+ if (r.length > 1)
48
46
  throw new Error("Solana Withdraw: Only one mint address is supported");
49
- const a = [...await L(r, t, o, e, 6)][0], k = M().toString(), { outputUtxos: s } = z(
50
- r.userKeys,
51
- a,
52
- e[0],
53
- k,
47
+ const i = [...await b(t, r, o, 6)][0], R = L().toString(), { outputUtxos: n } = D(
48
+ t.userKeys,
49
+ i,
50
+ o[0],
51
+ R,
54
52
  void 0,
55
53
  !1
56
- ), n = await r.getRandomRelay(t, !p);
57
- if (!n)
58
- throw Error(W.RELAYER_NOT_AVAILABLE);
59
- const v = H.findCorrectRandomization(V(31), r.userKeys.getShieldedPrivateKey()), u = {
60
- tokenNumber: o.length,
61
- nullifierAmount: a.length,
62
- outputAmount: s.length
63
- }, x = r.getSolanaProgram(l), I = q([s])[0][0], y = Array.from(J.utils.arrayify(I)), { proofAArr: B, proofBArr: P, proofCArr: C, publicInputsArr: K } = await G(
64
- r.generateProofRemotely,
65
- d,
66
- T[t],
67
- h[t],
54
+ ), c = await t.getRandomRelay(!m);
55
+ if (!c)
56
+ throw Error(z.RELAYER_NOT_AVAILABLE);
57
+ const x = q.findCorrectRandomization(H(31), t.userKeys.getShieldedPrivateKey()), l = {
58
+ tokenNumber: r.length,
59
+ nullifierAmount: i.length,
60
+ outputAmount: n.length
61
+ }, I = t.getSolanaProgram(u), k = W([n])[0][0], d = Array.from(j.utils.arrayify(k)), { proofAArr: v, proofBArr: P, proofCArr: K, publicInputsArr: O } = await _(
62
+ t.generateProofRemotely,
63
+ p,
64
+ T,
65
+ A,
68
66
  f,
67
+ I,
68
+ [r[0]],
69
+ [i],
70
+ [n],
69
71
  x,
70
- [o[0]],
71
- [a],
72
- [s],
73
- v,
74
- i.flatFee,
75
- i.variableRate,
72
+ a.flatFee,
73
+ a.variableRate,
74
+ s,
76
75
  c,
77
- n,
78
- u,
79
- [y],
80
- t,
76
+ l,
77
+ [d],
78
+ e,
81
79
  S
82
- ), O = o[0] === D, F = {
83
- recipient: c,
84
- mint: O ? void 0 : o[0]
85
- }, N = {
86
- proofAArr: B,
80
+ ), F = r[0] === C, N = {
81
+ recipient: s,
82
+ mint: F ? void 0 : r[0]
83
+ }, U = {
84
+ proofAArr: v,
87
85
  proofBArr: P,
88
- proofCArr: C,
89
- publicInputsArr: K,
90
- encryptedOutputs: [y],
91
- relayerFee: i.flatFee.toString(),
92
- dimensions: u
86
+ proofCArr: K,
87
+ publicInputsArr: O,
88
+ encryptedOutputs: [d],
89
+ relayerFee: a.flatFee.toString(),
90
+ dimensions: l
93
91
  };
94
- return Y({
95
- chainId: t,
96
- relayAddress: n,
92
+ return V(e, {
93
+ relayAddress: c,
97
94
  functionName: "transact",
98
- args: N,
99
- accounts: F,
100
- solanaAccessTokenData: !R && E ? {
95
+ args: U,
96
+ accounts: N,
97
+ solanaAccessTokenData: !E && h ? {
101
98
  ethereumAddress: w,
102
99
  accessKey: f.getAccessKey()
103
100
  } : void 0
104
101
  });
105
102
  };
106
103
  export {
107
- Ct as hinkalSolanaWithdraw
104
+ kt as hinkalSolanaWithdraw
108
105
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../error-handling/error-codes.constants.cjs"),L=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),M=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),B=require("../../functions/web3/events/getShieldedBalance.cjs"),H=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),K=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),N=require("../../functions/pre-transaction/getFeeStructure.cjs"),W=require("../../functions/pre-transaction/merge-with-fee-structure.cjs"),G=require("../../types/external-action.types.cjs"),b=require("../../types/hinkal.types.cjs"),O=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),V=require("../../types/ethereum-network.types.cjs"),Z=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),$=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),j=require("../../functions/pre-transaction/getExternalSwapAddress.cjs"),z=require("../../functions/utils/time.utils.cjs"),Y=require("../../constants/protocol.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");require("ethers");require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");const J=require("../../functions/pre-transaction/constructAdminData.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("@solana/spl-token");require("ethers-v6h");require("tweetnacl");require("bs58");require("buffer");require("../crypto-keys/keys.cjs");const Q=require("../../functions/utils/token-check.utils.cjs"),X=async(r,n,a,u,h,S,m,w,l=!1,C=!1)=>{const e=Q.validateAndGetChainId(n),s=n.map(t=>t.erc20TokenAddress),d=await r.getEthereumAddressByChain(e),q=m??await N.getFeeStructure(e,S,s,G.ExternalActionId.Transact,void 0,Y.HINKAL_SWAP_VARIABLE_RATE);W.mergeWithFeeStructure(e,s,a,q);const f=j.getExternalSwapAddress(e,u),i={externalActionId:u,externalAddress:f,externalActionMetadata:h},o=[...await B.addPaddingToUtxos(r,e,s,a)],v=`swapperM${a.length.toString()}x${o[0].length}x1`,D=[!1,!0,!1].slice(0,a.length),g=[],c=b.defaultHinkalLogicArgs(a.length,r.userKeys),R=z.getCurrentTimeInSeconds().toString();for(let t=0;t<s.length;t+=1){const{outputUtxos:F}=L.outputUtxoProcessing(r.userKeys,o[t],a[t],R,void 0,!1);g.push(F);const{useApprovalUtxoData:T}=O.outputApprovalDataProcessing(r,e,o[t],a[t]);T&&(c.useApprovalUtxoData[t]=T,c.doPreTxApproval=!0)}const p=await r.getRandomRelay(e,!l);if(!p)throw Error(I.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:P,kycRequired:E,hasAccessToken:_}=await Z.shouldPatchAccessTokenMerkleTree(r,e,s,a),k=await $.getSignatureDataForTransact(e,d,r.userKeys,E,_),{zkCallData:A,circomData:y,dimData:x}=await M.constructZkProof("v1x1",r.merkleTreeHinkalByChain[e],r.merkleTreeAccessTokenByChain[e],o,g,r.userKeys,v,i.externalActionId,i.externalAddress,i.externalActionMetadata,r.generateProofRemotely,p,e,D,void 0,void 0,P,c,void 0,q,r.getContractWithFetcher(e,V.ContractType.HinkalHelperContract),k);if(l)return await H.estimateGasRelayer(e,A,x,y);const U=J.constructAdminData(w,e,s,a,d,n);return await K.transactCallRelayer(e,A,x,y,C,void 0,void 0,U)};exports.hinkalSwap=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("../../error-handling/error-codes.constants.cjs"),L=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),M=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),H=require("../../functions/web3/events/getShieldedBalance.cjs"),K=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),N=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),W=require("../../functions/pre-transaction/getFeeStructure.cjs"),B=require("../../functions/pre-transaction/merge-with-fee-structure.cjs"),b=require("../../types/external-action.types.cjs"),k=require("../../types/hinkal.types.cjs"),G=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),O=require("../../types/ethereum-network.types.cjs"),V=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),Z=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),$=require("../../functions/pre-transaction/getExternalSwapAddress.cjs"),j=require("../../functions/utils/time.utils.cjs"),z=require("../../constants/protocol.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../http/HttpClient.cjs");require("axios");require("ethers");require("../../constants/token-data/index.cjs");require("../../API/getServerURL.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../functions/utils/mutexes.utils.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../crypto-keys/keys.cjs");const Y=require("../../functions/pre-transaction/constructAdminData.cjs");require("@solana/spl-token");const J=async(e,c,t,i,x,T,S,m,u=!1,w=!1)=>{const s=c.map(r=>r.erc20TokenAddress),d=await e.getEthereumAddress(),g=S??await W.getFeeStructure(e.getCurrentChainId(),T,s,b.ExternalActionId.Transact,void 0,z.HINKAL_SWAP_VARIABLE_RATE);B.mergeWithFeeStructure(e.getCurrentChainId(),s,t,g);const f=$.getExternalSwapAddress(e,i),o={externalActionId:i,externalAddress:f,externalActionMetadata:x},a=[...await H.addPaddingToUtxos(e,s,t)],v=`swapperM${t.length.toString()}x${a[0].length}x1`,D=[!1,!0,!1].slice(0,t.length),q=[],n=k.defaultHinkalLogicArgs(t.length,e.userKeys),R=j.getCurrentTimeInSeconds().toString();for(let r=0;r<s.length;r+=1){const{outputUtxos:U}=L.outputUtxoProcessing(e.userKeys,a[r],t[r],R,void 0,!1);q.push(U);const{useApprovalUtxoData:y}=G.outputApprovalDataProcessing(e,a[r],t[r]);y&&(n.useApprovalUtxoData[r]=y,n.doPreTxApproval=!0)}const l=await e.getRandomRelay(!u);if(!l)throw Error(F.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:P,kycRequired:h,hasAccessToken:E}=await V.shouldPatchAccessTokenMerkleTree(e,s,t),I=await Z.getSignatureDataForTransact(e.getCurrentChainId(),d,e.userKeys,h,E),{zkCallData:p,circomData:A,dimData:C}=await M.constructZkProof("v1x1",e.merkleTreeHinkal,e.merkleTreeAccessToken,a,q,e.userKeys,v,o.externalActionId,o.externalAddress,o.externalActionMetadata,e.generateProofRemotely,l,e.getCurrentChainId(),D,void 0,void 0,P,n,void 0,g,e.getContractWithFetcher(O.ContractType.HinkalHelperContract),I);if(u)return await K.estimateGasRelayer(e,p,C,A);const _=Y.constructAdminData(m,e.getCurrentChainId(),s,t,d,c);return await N.transactCallRelayer(e.getCurrentChainId(),p,C,A,w,void 0,void 0,_)};exports.hinkalSwap=J;
@@ -2,121 +2,128 @@ import { transactionErrorCodes as K } from "../../error-handling/error-codes.con
2
2
  import { outputUtxoProcessing as M } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
3
3
  import { constructZkProof as _ } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
4
4
  import { addPaddingToUtxos as F } from "../../functions/web3/events/getShieldedBalance.mjs";
5
- import { estimateGasRelayer as k } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
6
- import { transactCallRelayer as N } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
7
- import { getFeeStructure as W } from "../../functions/pre-transaction/getFeeStructure.mjs";
5
+ import { estimateGasRelayer as N } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
6
+ import { transactCallRelayer as W } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
7
+ import { getFeeStructure as B } from "../../functions/pre-transaction/getFeeStructure.mjs";
8
8
  import { mergeWithFeeStructure as V } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
9
9
  import { ExternalActionId as $ } from "../../types/external-action.types.mjs";
10
10
  import { defaultHinkalLogicArgs as q } from "../../types/hinkal.types.mjs";
11
11
  import { outputApprovalDataProcessing as z } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
12
- import { ContractType as G } from "../../types/ethereum-network.types.mjs";
13
- import { shouldPatchAccessTokenMerkleTree as O } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
14
- import { getSignatureDataForTransact as Y } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
15
- import { getExternalSwapAddress as Z } from "../../functions/pre-transaction/getExternalSwapAddress.mjs";
16
- import { getCurrentTimeInSeconds as b } from "../../functions/utils/time.utils.mjs";
17
- import { HINKAL_SWAP_VARIABLE_RATE as j } from "../../constants/protocol.constants.mjs";
12
+ import { ContractType as O } from "../../types/ethereum-network.types.mjs";
13
+ import { shouldPatchAccessTokenMerkleTree as Y } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
14
+ import { getSignatureDataForTransact as Z } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
15
+ import { getExternalSwapAddress as b } from "../../functions/pre-transaction/getExternalSwapAddress.mjs";
16
+ import { getCurrentTimeInSeconds as j } from "../../functions/utils/time.utils.mjs";
17
+ import { HINKAL_SWAP_VARIABLE_RATE as G } from "../../constants/protocol.constants.mjs";
18
18
  import "../../types/circom-data.types.mjs";
19
19
  import "../../types/transactions.types.mjs";
20
20
  import "../../types/activities.types.mjs";
21
21
  import "../../constants/server.constants.mjs";
22
- import "../../API/getServerURL.mjs";
22
+ import "../../constants/chains.constants.mjs";
23
+ import "../../constants/vite.constants.mjs";
23
24
  import "../http/HttpClient.mjs";
24
25
  import "axios";
25
- import "../../constants/vite.constants.mjs";
26
26
  import "ethers";
27
27
  import "../../constants/token-data/index.mjs";
28
- import "../../constants/chains.constants.mjs";
29
- import { constructAdminData as J } from "../../functions/pre-transaction/constructAdminData.mjs";
30
- import "@coral-xyz/anchor";
31
- import "@solana/web3.js";
28
+ import "../../API/getServerURL.mjs";
32
29
  import "circomlibjs-hinkal-fork";
33
- import "@solana/spl-token";
34
- import "ethers-v6h";
35
- import "tweetnacl";
36
- import "bs58";
30
+ import "libsodium-wrappers";
31
+ import "process";
37
32
  import "buffer";
33
+ import "../../constants/save-depths.mjs";
34
+ import "../../constants/reorg-depths.constants.mjs";
35
+ import "../../functions/utils/mutexes.utils.mjs";
36
+ import "@coral-xyz/anchor";
37
+ import "@solana/web3.js";
38
38
  import "../crypto-keys/keys.mjs";
39
- import { validateAndGetChainId as Q } from "../../functions/utils/token-check.utils.mjs";
40
- const Nt = async (r, s, e, c, T, v, w, C, n = !1, h = !1) => {
41
- const t = Q(s), a = s.map((o) => o.erc20TokenAddress), d = await r.getEthereumAddressByChain(t), f = w ?? await W(
42
- t,
43
- v,
44
- a,
39
+ import { constructAdminData as J } from "../../functions/pre-transaction/constructAdminData.mjs";
40
+ import "@solana/spl-token";
41
+ const Wt = async (t, m, e, p, l, T, y, w, c = !1, v = !1) => {
42
+ const o = m.map((r) => r.erc20TokenAddress), n = await t.getEthereumAddress(), d = y ?? await B(
43
+ t.getCurrentChainId(),
44
+ T,
45
+ o,
45
46
  $.Transact,
46
47
  void 0,
47
- j
48
+ G
48
49
  );
49
- V(t, a, e, f);
50
- const R = Z(t, c), m = {
51
- externalActionId: c,
50
+ V(t.getCurrentChainId(), o, e, d);
51
+ const R = b(t, p), s = {
52
+ externalActionId: p,
52
53
  externalAddress: R,
53
- externalActionMetadata: T
54
- }, i = [...await F(r, t, a, e)], D = `swapperM${e.length.toString()}x${i[0].length}x1`, E = [!1, !0, !1].slice(0, e.length), u = [], p = q(e.length, r.userKeys), S = b().toString();
55
- for (let o = 0; o < a.length; o += 1) {
54
+ externalActionMetadata: l
55
+ }, a = [...await F(t, o, e)], D = `swapperM${e.length.toString()}x${a[0].length}x1`, E = [!1, !0, !1].slice(0, e.length), u = [], i = q(e.length, t.userKeys), I = j().toString();
56
+ for (let r = 0; r < o.length; r += 1) {
56
57
  const { outputUtxos: H } = M(
57
- r.userKeys,
58
- i[o],
59
- e[o],
60
- S,
58
+ t.userKeys,
59
+ a[r],
60
+ e[r],
61
+ I,
61
62
  void 0,
62
63
  !1
63
64
  );
64
65
  u.push(H);
65
- const { useApprovalUtxoData: y } = z(r, t, i[o], e[o]);
66
- y && (p.useApprovalUtxoData[o] = y, p.doPreTxApproval = !0);
66
+ const { useApprovalUtxoData: x } = z(t, a[r], e[r]);
67
+ x && (i.useApprovalUtxoData[r] = x, i.doPreTxApproval = !0);
67
68
  }
68
- const g = await r.getRandomRelay(t, !n);
69
+ const g = await t.getRandomRelay(!c);
69
70
  if (!g)
70
71
  throw Error(K.RELAYER_NOT_AVAILABLE);
71
- const { patchAccessTokenMerkleTree: P, kycRequired: I, hasAccessToken: L } = await O(
72
- r,
72
+ const { patchAccessTokenMerkleTree: S, kycRequired: P, hasAccessToken: L } = await Y(
73
73
  t,
74
- a,
74
+ o,
75
75
  e
76
- ), U = await Y(
77
- t,
78
- d,
79
- r.userKeys,
80
- I,
76
+ ), U = await Z(
77
+ t.getCurrentChainId(),
78
+ n,
79
+ t.userKeys,
80
+ P,
81
81
  L
82
- ), { zkCallData: l, circomData: A, dimData: x } = await _(
82
+ ), { zkCallData: f, circomData: A, dimData: C } = await _(
83
83
  "v1x1",
84
- r.merkleTreeHinkalByChain[t],
85
- r.merkleTreeAccessTokenByChain[t],
86
- i,
84
+ t.merkleTreeHinkal,
85
+ t.merkleTreeAccessToken,
86
+ a,
87
87
  u,
88
- r.userKeys,
88
+ t.userKeys,
89
89
  D,
90
- m.externalActionId,
91
- m.externalAddress,
92
- m.externalActionMetadata,
93
- r.generateProofRemotely,
90
+ s.externalActionId,
91
+ s.externalAddress,
92
+ s.externalActionMetadata,
93
+ t.generateProofRemotely,
94
94
  g,
95
- t,
95
+ t.getCurrentChainId(),
96
96
  E,
97
97
  void 0,
98
98
  void 0,
99
- P,
100
- p,
99
+ S,
100
+ i,
101
101
  void 0,
102
- f,
103
- r.getContractWithFetcher(t, G.HinkalHelperContract),
102
+ d,
103
+ t.getContractWithFetcher(O.HinkalHelperContract),
104
104
  U
105
105
  );
106
- if (n)
107
- return await k(t, l, x, A);
108
- const B = J(C, t, a, e, d, s);
109
- return await N(
110
- t,
111
- l,
112
- x,
106
+ if (c)
107
+ return await N(t, f, C, A);
108
+ const h = J(
109
+ w,
110
+ t.getCurrentChainId(),
111
+ o,
112
+ e,
113
+ n,
114
+ m
115
+ );
116
+ return await W(
117
+ t.getCurrentChainId(),
118
+ f,
119
+ C,
113
120
  A,
114
- h,
121
+ v,
115
122
  void 0,
116
123
  void 0,
117
- B
124
+ h
118
125
  );
119
126
  };
120
127
  export {
121
- Nt as hinkalSwap
128
+ Wt as hinkalSwap
122
129
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../error-handling/error-codes.constants.cjs"),k=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),N=require("../../functions/web3/events/getShieldedBalance.cjs"),F=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),M=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),U=require("../../functions/pre-transaction/getFeeStructure.cjs"),B=require("../../functions/pre-transaction/merge-with-fee-structure.cjs");require("../../types/circom-data.types.cjs");const L=require("../../types/ethereum-network.types.cjs"),V=require("../../types/external-action.types.cjs"),H=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const K=require("../../functions/pre-transaction/outputUtxoProcessing.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");require("ethers");require("../../constants/token-data/index.cjs");const O=require("../../constants/protocol.constants.cjs");require("../../constants/chains.constants.cjs");const G=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),W=require("../../functions/pre-transaction/getVolatileTransferAmount.cjs"),b=require("../../functions/pre-transaction/constructAdminData.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("@solana/spl-token");require("ethers-v6h");require("tweetnacl");require("bs58");require("buffer");require("../crypto-keys/keys.cjs");const Z=require("../../functions/utils/time.utils.cjs"),$=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),j=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),z=require("../../functions/utils/addresses.cjs"),Y=require("../../functions/utils/token-check.utils.cjs"),J=async(t,s,E,l,h,x,C,f=!1)=>{const e=Y.validateAndGetChainId(s);if(!z.isValidPrivateAddress(l))throw Error(d.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);const a=s.map(r=>r.erc20TokenAddress),o=await W.modifyVolatileTokenAmountChanges(e,s,E),A=-o[0]*(10000n-O.HINKAL_PRIVATE_SEND_VARIABLE_RATE)/10000n;if(A<=0n)throw Error(d.transactionErrorCodes.RECIPIENT_AMOUNT_INVALID);const q=x??await U.getFeeStructure(e,h,a,V.ExternalActionId.Transact);if(B.mergeWithFeeStructure(e,a,o,q),!s[0])throw Error("Transfer Action: No Token Found");const i=await t.getRandomRelay(e,!0),c={externalActionId:0n,externalAddress:i??await t.getEthereumAddressByChain(e),externalActionMetadata:"0x00"},n=[...await N.addPaddingToUtxos(t,e,a,o)],w=`swapperM${o.length}x${n[0].length}x2`,g=[],u=H.defaultHinkalLogicArgs(o.length,t.userKeys),R=Z.getCurrentTimeInSeconds().toString();for(let r=0;r<a.length;r+=1){const{outputUtxos:S}=K.outputUtxoProcessing(t.userKeys,n[r],o[r],R,void 0,!1,l,r===0?A:0n);g.push(S);const{useApprovalUtxoData:y}=G.outputApprovalDataProcessing(t,e,n[r],o[r]);y&&(u.useApprovalUtxoData[r]=y,u.doPreTxApproval=!0)}if(!i)throw Error(d.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:v,kycRequired:I,hasAccessToken:_}=await $.shouldPatchAccessTokenMerkleTree(t,e,a,o),D=await j.getSignatureDataForTransact(e,await t.getEthereumAddressByChain(e),t.userKeys,I,_),{zkCallData:m,circomData:p,dimData:T}=await k.constructZkProof("v1x1",t.merkleTreeHinkalByChain[e],t.merkleTreeAccessTokenByChain[e],n,g,t.userKeys,w,c.externalActionId,c.externalAddress,c.externalActionMetadata,t.generateProofRemotely,i,e,void 0,void 0,void 0,v,u,void 0,q,t.getContractWithFetcher(e,L.ContractType.HinkalHelperContract),D);if(f)return await F.estimateGasRelayer(e,m,T,p);const P=b.constructAdminData(C,e,a,o,await t.getEthereumAddressByChain(e));return await M.transactCallRelayer(e,m,T,p,void 0,void 0,void 0,P)};exports.hinkalTransfer=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../error-handling/error-codes.constants.cjs"),N=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),F=require("../../functions/web3/events/getShieldedBalance.cjs"),M=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),U=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),L=require("../../functions/pre-transaction/getFeeStructure.cjs"),V=require("../../functions/pre-transaction/merge-with-fee-structure.cjs");require("../../types/circom-data.types.cjs");const k=require("../../types/ethereum-network.types.cjs"),H=require("../../types/external-action.types.cjs"),K=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const O=require("../../functions/pre-transaction/outputUtxoProcessing.cjs");require("../../constants/server.constants.cjs");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../http/HttpClient.cjs");require("axios");require("ethers");require("../../constants/token-data/index.cjs");const B=require("../../constants/protocol.constants.cjs"),G=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),W=require("../../functions/pre-transaction/getVolatileTransferAmount.cjs"),b=require("../../functions/pre-transaction/constructAdminData.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("@solana/spl-token");require("../crypto-keys/keys.cjs");require("buffer");const Z=require("../../functions/utils/time.utils.cjs"),$=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),j=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),z=require("../../functions/utils/addresses.cjs"),Y=async(e,n,E,A,x,y,f,I=!1)=>{if(!z.isValidPrivateAddress(A))throw Error(d.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);const o=n.map(t=>t.erc20TokenAddress),r=await W.modifyVolatileTokenAmountChanges(e.getCurrentChainId(),n,E),l=-r[0]*(10000n-B.HINKAL_PRIVATE_SEND_VARIABLE_RATE)/10000n;if(l<=0n)throw Error(d.transactionErrorCodes.RECIPIENT_AMOUNT_INVALID);const g=y??await L.getFeeStructure(e.getCurrentChainId(),x,o,H.ExternalActionId.Transact);V.mergeWithFeeStructure(e.getCurrentChainId(),o,r,g);const a=e.getCurrentChainId();if(!n[0])throw Error("Transfer Action: No Token Found");const c=await e.getRandomRelay(),i={externalActionId:0n,externalAddress:c??await e.getEthereumAddress(),externalActionMetadata:"0x00"},s=[...await F.addPaddingToUtxos(e,o,r)],w=`swapperM${r.length}x${s[0].length}x2`,q=[],u=K.defaultHinkalLogicArgs(r.length,e.userKeys),R=Z.getCurrentTimeInSeconds().toString();for(let t=0;t<o.length;t+=1){const{outputUtxos:S}=O.outputUtxoProcessing(e.userKeys,s[t],r[t],R,void 0,!1,A,t===0?l:0n);q.push(S);const{useApprovalUtxoData:C}=G.outputApprovalDataProcessing(e,s[t],r[t]);C&&(u.useApprovalUtxoData[t]=C,u.doPreTxApproval=!0)}if(!c)throw Error(d.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:h,kycRequired:v,hasAccessToken:D}=await $.shouldPatchAccessTokenMerkleTree(e,o,r),P=await j.getSignatureDataForTransact(a,await e.getEthereumAddress(),e.userKeys,v,D),{zkCallData:m,circomData:T,dimData:p}=await N.constructZkProof("v1x1",e.merkleTreeHinkal,e.merkleTreeAccessToken,s,q,e.userKeys,w,i.externalActionId,i.externalAddress,i.externalActionMetadata,e.generateProofRemotely,c,a,void 0,void 0,void 0,h,u,void 0,g,e.getContractWithFetcher(k.ContractType.HinkalHelperContract),P);if(I)return await M.estimateGasRelayer(e,m,p,T);const _=b.constructAdminData(f,a,o,r,await e.getEthereumAddress());return await U.transactCallRelayer(a,m,p,T,void 0,void 0,void 0,_)};exports.hinkalTransfer=Y;