@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
@@ -1,20 +1,21 @@
1
- import { API as t } from "../../API/API.mjs";
1
+ import { API as a } from "../../API/API.mjs";
2
2
  const d = (r) => ({
3
3
  async getAccessToken() {
4
- return t.getZkMeAccessToken();
4
+ const e = r.getCurrentChainId();
5
+ return a.getZkMeAccessToken(e);
5
6
  },
6
7
  async getUserAccounts() {
7
8
  return [await r.getEthereumAddress()];
8
9
  },
9
10
  async delegateTransaction(e) {
10
- const s = r.getProviderAdapter(Number(e.chainId)), a = {
11
+ const s = await r.getProviderAdapter(), t = {
11
12
  ...e,
12
13
  chainId: Number(e.chainId),
13
14
  type: e.type ? e.type : void 0,
14
15
  maxPriorityFeePerGas: e.maxPriorityFeePerGas ? e.maxPriorityFeePerGas : void 0,
15
16
  maxFeePerGas: e.maxFeePerGas ? e.maxFeePerGas : void 0
16
17
  };
17
- return (await s.sendTransaction(a)).hash;
18
+ return (await s.sendTransaction(t)).hash;
18
19
  }
19
20
  });
20
21
  export {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("../../error-handling/error-codes.constants.cjs"),K=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),V=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),X=require("../../functions/web3/events/getShieldedBalance.cjs"),z=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),G=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),P=require("../../types/external-action.types.cjs"),f=require("../../types/hinkal.types.cjs"),w=require("../../functions/utils/amounts.utils.cjs"),Z=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),$=require("../../constants/conversion.constants.cjs"),j=require("../../constants/protocol.constants.cjs"),Y=require("../../functions/pre-transaction/merge-with-fee-structure.cjs"),J=require("../../functions/pre-transaction/getFeeStructure.cjs"),C=require("../../types/ethereum-network.types.cjs"),v=require("../../error-handling/logger.cjs"),Q=require("../../functions/utils/involves-permit2-op.cjs"),tt=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),et=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),rt=require("../../functions/utils/inLogicMetadata.cjs"),ot=require("../../functions/utils/time.utils.cjs"),nt=require("../../functions/pre-transaction/constructAdminData.cjs"),at=async(t,o,r,n,a,g,E,S,U,_,l=!1)=>{const R=rt.encodeParsedInLogicMetadata(E),s={externalActionId:P.ExternalActionId.Wallet,externalAddress:a,externalActionMetadata:R},k=t.getContractWithFetcher(C.ContractType.HinkalContract),u=o.findIndex(e=>e===j.zeroAddress),L=u!==-1&&r[u]<0n?-r[u]:0n,A=U??await J.getFeeStructure(t.getCurrentChainId(),S,o,P.ExternalActionId.Wallet,[{from:k.address,to:a,value:L,calldata:g}]);Y.mergeWithFeeStructure(t.getCurrentChainId(),o,r,A),n=[...n],n.length<r.length&&n.push(0n);const c=[...await X.addPaddingToUtxos(t,o,r)],M=`swapperMHA${r.length.toString()}x${c[0].length}x1`,p=r.map(e=>!(e<0n)),m=[],i={inHinkalAddress:t.userKeys.getInHinkalAddress(a),executeApprovalChanges:n,hinkalLogicAction:f.HinkalLogicAction.EXECUTE,doPreTxApproval:!1,useApprovalUtxoData:[]},O=ot.getCurrentTimeInSeconds().toString();for(let e=0;e<o.length;e+=1){const y=p[e]?0n:-(w.absBigInt(r[e])-w.absBigInt(n[e])),{outputUtxos:b}=K.outputUtxoProcessing(t.userKeys,c[e],y,O,void 0,!1);m.push(b);const{useApprovalUtxoData:D}=Z.outputApprovalDataProcessing(t,c[e],y,a);i.useApprovalUtxoData.push(D??f.defaultUseApprovalUTXOData($.APPROVED_UTXO_CONVERSION_COUNT,0n)),D&&(i.doPreTxApproval=!0)}const T=await t.getRandomRelay(!l);if(!T)throw Error(B.transactionErrorCodes.RELAYER_NOT_AVAILABLE);v.Logger.log("hinkaInAction",{hinkalLogicArgs:i,deltaChanges:r,approvalChanges:n});const{patchAccessTokenMerkleTree:F,kycRequired:H,hasAccessToken:W}=await et.shouldPatchAccessTokenMerkleTree(t,o,r),h=await tt.getSignatureDataForTransact(t.getCurrentChainId(),await t.getEthereumAddress(),t.userKeys,H,W),{zkCallData:x,circomData:d,dimData:q}=await V.constructZkProof("v1x1",t.merkleTreeHinkal,t.merkleTreeAccessToken,c,m,t.userKeys,M,s.externalActionId,s.externalAddress,s.externalActionMetadata,t.generateProofRemotely,T,t.getCurrentChainId(),p,void 0,void 0,F,i,void 0,A,t.getContractWithFetcher(C.ContractType.HinkalHelperContract),h),I=Q.uniswapWorkaround([g]);if(v.Logger.log("hinkalInAction circomData",{circomData:d,withUniswapWorkAround:I}),l)return await z.estimateGasRelayer(t,x,q,d);const N=nt.constructAdminData(_,t.getCurrentChainId(),o,r,await t.getEthereumAddress());return await G.transactCallRelayer(t.getCurrentChainId(),x,q,d,I,void 0,void 0,N)};exports.hinkalInsideTransact=at;
@@ -0,0 +1,4 @@
1
+ import { IHinkal } from './IHinkal';
2
+ import { FeeStructure, type ParsedInLogicMetadata } from '../../types/hinkal.types';
3
+ import { AdminTransactionType } from '../../types/admin.types';
4
+ export declare const hinkalInsideTransact: (hinkal: IHinkal, erc20Addresses: string[], deltaChanges: bigint[], approvalChanges: bigint[], externalAddress: string, externalActionMetadata: string, parsedInLogicMetadata: ParsedInLogicMetadata, feeToken?: string, feeStructureOverride?: FeeStructure, action?: AdminTransactionType, onlyGasEstimate?: boolean) => Promise<bigint | import('../../index.ts').RelayerTransaction>;
@@ -0,0 +1,119 @@
1
+ import { transactionErrorCodes as X } from "../../error-handling/error-codes.constants.mjs";
2
+ import { outputUtxoProcessing as z } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
3
+ import { constructZkProof as B } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
4
+ import { addPaddingToUtxos as $ } from "../../functions/web3/events/getShieldedBalance.mjs";
5
+ import { estimateGasRelayer as b } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
6
+ import { transactCallRelayer as q } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
7
+ import { ExternalActionId as E } from "../../types/external-action.types.mjs";
8
+ import { HinkalLogicAction as Y, defaultUseApprovalUTXOData as Z } from "../../types/hinkal.types.mjs";
9
+ import { absBigInt as U } from "../../functions/utils/amounts.utils.mjs";
10
+ import { outputApprovalDataProcessing as h } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
11
+ import { APPROVED_UTXO_CONVERSION_COUNT as j } from "../../constants/conversion.constants.mjs";
12
+ import { zeroAddress as G } from "../../constants/protocol.constants.mjs";
13
+ import { mergeWithFeeStructure as J } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
14
+ import { getFeeStructure as Q } from "../../functions/pre-transaction/getFeeStructure.mjs";
15
+ import { ContractType as y } from "../../types/ethereum-network.types.mjs";
16
+ import { Logger as C } from "../../error-handling/logger.mjs";
17
+ import { uniswapWorkaround as tt } from "../../functions/utils/involves-permit2-op.mjs";
18
+ import { getSignatureDataForTransact as ot } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
19
+ import { shouldPatchAccessTokenMerkleTree as rt } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
20
+ import { encodeParsedInLogicMetadata as et } from "../../functions/utils/inLogicMetadata.mjs";
21
+ import { getCurrentTimeInSeconds as at } from "../../functions/utils/time.utils.mjs";
22
+ import { constructAdminData as nt } from "../../functions/pre-transaction/constructAdminData.mjs";
23
+ const St = async (t, e, r, a, n, p, P, v, R, S, f = !1) => {
24
+ const H = et(P), m = {
25
+ externalActionId: E.Wallet,
26
+ externalAddress: n,
27
+ externalActionMetadata: H
28
+ }, L = t.getContractWithFetcher(y.HinkalContract), s = e.findIndex((o) => o === G), O = s !== -1 && r[s] < 0n ? -r[s] : 0n, d = R ?? await Q(t.getCurrentChainId(), v, e, E.Wallet, [
29
+ { from: L.address, to: n, value: O, calldata: p }
30
+ ]);
31
+ J(t.getCurrentChainId(), e, r, d), a = [...a], a.length < r.length && a.push(0n);
32
+ const i = [...await $(t, e, r)], W = `swapperMHA${r.length.toString()}x${i[0].length}x1`, A = r.map((o) => !(o < 0n)), g = [], c = {
33
+ inHinkalAddress: t.userKeys.getInHinkalAddress(n),
34
+ executeApprovalChanges: a,
35
+ hinkalLogicAction: Y.EXECUTE,
36
+ doPreTxApproval: !1,
37
+ useApprovalUtxoData: []
38
+ }, M = at().toString();
39
+ for (let o = 0; o < e.length; o += 1) {
40
+ const D = A[o] ? 0n : -(U(r[o]) - U(a[o])), { outputUtxos: V } = z(
41
+ t.userKeys,
42
+ i[o],
43
+ D,
44
+ M,
45
+ void 0,
46
+ !1
47
+ );
48
+ g.push(V);
49
+ const { useApprovalUtxoData: w } = h(
50
+ t,
51
+ i[o],
52
+ D,
53
+ n
54
+ );
55
+ c.useApprovalUtxoData.push(
56
+ w ?? Z(j, 0n)
57
+ ), w && (c.doPreTxApproval = !0);
58
+ }
59
+ const x = await t.getRandomRelay(!f);
60
+ if (!x)
61
+ throw Error(X.RELAYER_NOT_AVAILABLE);
62
+ C.log("hinkaInAction", { hinkalLogicArgs: c, deltaChanges: r, approvalChanges: a });
63
+ const { patchAccessTokenMerkleTree: F, kycRequired: N, hasAccessToken: _ } = await rt(
64
+ t,
65
+ e,
66
+ r
67
+ ), k = await ot(
68
+ t.getCurrentChainId(),
69
+ await t.getEthereumAddress(),
70
+ t.userKeys,
71
+ N,
72
+ _
73
+ ), { zkCallData: l, circomData: u, dimData: I } = await B(
74
+ "v1x1",
75
+ t.merkleTreeHinkal,
76
+ t.merkleTreeAccessToken,
77
+ i,
78
+ g,
79
+ t.userKeys,
80
+ W,
81
+ m.externalActionId,
82
+ m.externalAddress,
83
+ m.externalActionMetadata,
84
+ t.generateProofRemotely,
85
+ x,
86
+ t.getCurrentChainId(),
87
+ A,
88
+ void 0,
89
+ void 0,
90
+ F,
91
+ c,
92
+ void 0,
93
+ d,
94
+ t.getContractWithFetcher(y.HinkalHelperContract),
95
+ k
96
+ ), T = tt([p]);
97
+ if (C.log("hinkalInAction circomData", { circomData: u, withUniswapWorkAround: T }), f)
98
+ return await b(t, l, I, u);
99
+ const K = nt(
100
+ S,
101
+ t.getCurrentChainId(),
102
+ e,
103
+ r,
104
+ await t.getEthereumAddress()
105
+ );
106
+ return await q(
107
+ t.getCurrentChainId(),
108
+ l,
109
+ I,
110
+ u,
111
+ T,
112
+ void 0,
113
+ void 0,
114
+ K
115
+ );
116
+ };
117
+ export {
118
+ St as hinkalInsideTransact
119
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("../../constants/chains.constants.cjs"),S=require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");const j=require("../../types/ethereum-network.types.cjs"),G=require("../../types/external-action.types.cjs"),Y=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const J=require("../../types/admin.types.cjs");require("../../types/activities.types.cjs");require("../../constants/vite.constants.cjs");const Q=require("../../functions/snarkjs/constructEmporiumProof.cjs"),X=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),Z=require("../../functions/web3/events/getShieldedBalance.cjs"),$=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),h=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),I=require("../../functions/utils/involves-permit2-op.cjs"),ee=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),re=require("../../functions/utils/convertEmporiumOpToCallInfo.cjs"),te=require("../../functions/pre-transaction/getFeeStructure.cjs"),oe=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),se=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),ie=require("../../functions/pre-transaction/merge-with-fee-structure-emporium.cjs"),ue=require("../../functions/utils/caseInsensitive.utils.cjs"),ae=require("../../functions/utils/time.utils.cjs"),ce=require("./handleAutoDepositBack.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/token-data/index.cjs");const ne=require("../../functions/pre-transaction/constructAdminData.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("@solana/spl-token");const k=require("../AccountActions/AccountActions.cjs");require("buffer");const le=require("../../functions/pre-transaction/recipientUtxoProcessing.cjs"),Ae=require("../../functions/utils/addresses.cjs"),me=async(t,e,x,o,d,n,i,p,R,_,U,F=!1,B,y,l,T=!1)=>{if(l&&!Ae.isValidPrivateAddress(l.recipientInfo))throw Error(S.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);const s=x.map(r=>r.erc20TokenAddress),u=k.AccountActions.getAddressFromSubAccount(e,p);if(!u)throw Error("Public account address is not available");const{contractData:O}=V.networkRegistry[e],{emporiumAddress:A}=O;if(!A)throw Error("No Emporium Address Provided");const m=_??await te.getFeeStructure(e,R,s,G.ExternalActionId.Emporium,n.map(r=>re.convertEmporiumOpToCallInfo(r,u??"",e))),W=i.find(r=>ue.caseInsensitiveEqual(r.token.erc20TokenAddress,m.feeToken))?.amount??0n;for(u&&await ie.mergeWithFeeStructureEmporium(t,e,u,n,s,o,m,W);d.length<s.length;)d.push(!1);const a=[...await Z.addPaddingToUtxos(t,e,s,o)],q=[],c=Y.defaultHinkalLogicArgs(o.length,t.userKeys),f=ae.getCurrentTimeInSeconds().toString();for(let r=0;r<s.length;r+=1){const{outputUtxos:z}=X.outputUtxoProcessing(t.userKeys,a[r],o[r],f,void 0,!1);q.push(z);const{useApprovalUtxoData:D}=ee.outputApprovalDataProcessing(t,e,a[r],o[r]);D&&(c.doPreTxApproval=!0,c.useApprovalUtxoData[r]=D,c.interactionAddress=A,c.inHinkalAddress=t.userKeys.getInHinkalAddress(A))}l&&le.recipientUtxoProcessing(l,q,o,f);const E=U??await t.getRandomRelay(e,!T);if(!E)throw Error(S.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:H,kycRequired:K,hasAccessToken:b}=await oe.shouldPatchAccessTokenMerkleTree(t,e,s,o),C=await se.getSignatureDataForTransact(e,await t.getEthereumAddressByChain(e),t.userKeys,K,b),{zkCallData:w,circomData:g,dimData:P,authorizationData:v}=await Q.constructEmporiumProof("v1x1",t.merkleTreeHinkalByChain[e],t.merkleTreeAccessTokenByChain[e],s,s.map(()=>0),a,q,t.userKeys,o.length,a.length>0?a[0].length:0,A,n,t.generateProofRemotely,E,e,d,void 0,k.AccountActions.getPrivateKeyFromSubAccount(e,p),c,H,void 0,m,t.getContractWithFetcher(e,j.ContractType.HinkalHelperContract),C),L=I.uniswapWorkaround(n);if(T)return await $.estimateGasRelayer(e,w,P,g,v);const M=ne.constructAdminData(y,e,i.map(r=>r.token.erc20TokenAddress),i.map(r=>r.amount),await t.getEthereumAddressByChain(e),y===J.AdminTransactionType.PublicSwap?i.map(({token:r})=>r):void 0),N=await h.transactCallRelayer(e,w,P,g,!1,L,v,M);return F&&ce.handleAutoDepositBack(t,e,u,p,m.feeToken,B,i,g),N};exports.hinkalPrivateWallet=me;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("../../constants/chains.constants.cjs"),I=require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");const V=require("../../types/ethereum-network.types.cjs"),b=require("../../types/external-action.types.cjs"),j=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const S=require("../../types/admin.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/save-depths.cjs");const G=require("../../functions/utils/caseInsensitive.utils.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../functions/utils/mutexes.utils.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");const Y=require("../crypto-keys/keys.cjs"),J=require("../../functions/utils/time.utils.cjs"),Q=require("../../functions/snarkjs/constructEmporiumProof.cjs"),X=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),Z=require("../../functions/web3/events/getShieldedBalance.cjs"),$=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),ee=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),re=require("../../functions/utils/involves-permit2-op.cjs"),te=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),oe=require("../../functions/utils/convertEmporiumOpToCallInfo.cjs"),se=require("../../functions/pre-transaction/getFeeStructure.cjs"),ie=require("../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs"),ae=require("../../functions/pre-transaction/getSignatureDataForTransact.cjs"),ne=require("../../functions/pre-transaction/merge-with-fee-structure-emporium.cjs"),ue=require("./handleAutoDepositBack.cjs");require("../../constants/token-data/index.cjs");const ce=require("../../functions/pre-transaction/constructAdminData.cjs");require("@solana/spl-token");const de=require("../../functions/pre-transaction/recipientUtxoProcessing.cjs"),pe=require("../../functions/utils/addresses.cjs"),qe=async(e,t,o,l,n,s,m,R,U,_,F=!1,C,g,u,v=!1)=>{if(u&&!pe.isValidPrivateAddress(u.recipientInfo))throw Error(I.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);const c=e.getCurrentChainId(),d=Y.UserKeys.getSignerAddressFromPrivateKey(c,m.privateKey),{contractData:K}=z.networkRegistry[c],{emporiumAddress:p}=K;if(!p)throw Error("No Emporium Address Provided");const q=U??await se.getFeeStructure(c,R,t,b.ExternalActionId.Emporium,n.map(r=>oe.convertEmporiumOpToCallInfo(r,d??"",c))),k=s.find(r=>G.caseInsensitiveEqual(r.token.erc20TokenAddress,q.feeToken))?.amount??0n;for(d&&await ne.mergeWithFeeStructureEmporium(e,d,n,t,o,q,k);l.length<t.length;)l.push(!1);const i=[...await Z.addPaddingToUtxos(e,t,o)],A=[],a=j.defaultHinkalLogicArgs(o.length,e.userKeys),f=J.getCurrentTimeInSeconds().toString();for(let r=0;r<t.length;r+=1){const{outputUtxos:B}=X.outputUtxoProcessing(e.userKeys,i[r],o[r],f,void 0,!1);A.push(B);const{useApprovalUtxoData:x}=te.outputApprovalDataProcessing(e,i[r],o[r]);x&&(a.doPreTxApproval=!0,a.useApprovalUtxoData[r]=x,a.interactionAddress=p,a.inHinkalAddress=e.userKeys.getInHinkalAddress(p))}u&&de.recipientUtxoProcessing(u,A,o,f);const E=_??await e.getRandomRelay(!v);if(!E)throw Error(I.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{patchAccessTokenMerkleTree:O,kycRequired:W,hasAccessToken:h}=await ie.shouldPatchAccessTokenMerkleTree(e,t,o),H=await ae.getSignatureDataForTransact(e.getCurrentChainId(),await e.getEthereumAddress(),e.userKeys,W,h),{zkCallData:w,circomData:y,dimData:P,authorizationData:D}=await Q.constructEmporiumProof("v1x1",e.merkleTreeHinkal,e.merkleTreeAccessToken,t,t.map(()=>0),i,A,e.userKeys,o.length,i.length>0?i[0].length:0,p,n,e.generateProofRemotely,E,e.getCurrentChainId(),l,void 0,m.privateKey,a,O,void 0,q,e.getContractWithFetcher(V.ContractType.HinkalHelperContract),H),L=re.uniswapWorkaround(n);if(v)return await $.estimateGasRelayer(e,w,P,y,D);const T=g===S.AdminTransactionType.FundApproveAndTransact,M=ce.constructAdminData(g,e.getCurrentChainId(),s.map(r=>r.token.erc20TokenAddress),s.map(r=>r.amount),await e.getEthereumAddress(),g===S.AdminTransactionType.PublicSwap?s.map(({token:r})=>r):void 0,T?o:void 0,T?t:void 0,T?s:void 0),N=await ee.transactCallRelayer(e.getCurrentChainId(),w,P,y,!1,L,D,M);return F&&ue.handleAutoDepositBack(e,d,m,q.feeToken,C,s,y),N};exports.hinkalPrivateWallet=qe;
@@ -1,6 +1,6 @@
1
1
  import { IHinkal } from './IHinkal';
2
2
  import { FeeStructure } from '../../types/hinkal.types';
3
- import { ERC20Token, PrivateRecipientInfo, TokenChanges } from '../../types/token.types';
3
+ import { PrivateRecipientInfo, TokenChanges } from '../../types/token.types';
4
4
  import { SubAccount } from '../../types/proxy.types';
5
5
  import { AdminTransactionType } from '../../types/admin.types';
6
- export declare const hinkalPrivateWallet: (hinkal: IHinkal, chainId: number, erc20Tokens: ERC20Token[], deltaChanges: bigint[], onChainCreation: boolean[], ops: string[], emporiumTokenChanges: TokenChanges<bigint>[], subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, relayOverride?: string, autoDepositBack?: boolean, maxGasInDollar?: string, action?: AdminTransactionType, privateRecipientInfo?: PrivateRecipientInfo, onlyGasEstimate?: boolean) => Promise<bigint | import('../../index.ts').RelayerTransaction>;
6
+ export declare const hinkalPrivateWallet: (hinkal: IHinkal, erc20Addresses: string[], deltaChanges: bigint[], onChainCreation: boolean[], ops: string[], emporiumTokenChanges: TokenChanges<bigint>[], subAccount: SubAccount, feeToken?: string, feeStructureOverride?: FeeStructure, relayOverride?: string, autoDepositBack?: boolean, maxGasInDollar?: string, action?: AdminTransactionType, privateRecipientInfo?: PrivateRecipientInfo, onlyGasEstimate?: boolean) => Promise<bigint | import('../../index.ts').RelayerTransaction>;
@@ -1,4 +1,4 @@
1
- import { networkRegistry as C } from "../../constants/chains.constants.mjs";
1
+ import { networkRegistry as k } from "../../constants/chains.constants.mjs";
2
2
  import { transactionErrorCodes as R } from "../../error-handling/error-codes.constants.mjs";
3
3
  import "ethers";
4
4
  import "../../types/circom-data.types.mjs";
@@ -6,152 +6,156 @@ import { ContractType as Y } from "../../types/ethereum-network.types.mjs";
6
6
  import { ExternalActionId as j } from "../../types/external-action.types.mjs";
7
7
  import { defaultHinkalLogicArgs as G } from "../../types/hinkal.types.mjs";
8
8
  import "../../types/transactions.types.mjs";
9
- import { AdminTransactionType as J } from "../../types/admin.types.mjs";
9
+ import { AdminTransactionType as U } from "../../types/admin.types.mjs";
10
10
  import "../../types/activities.types.mjs";
11
- import "../../constants/vite.constants.mjs";
12
- import { constructEmporiumProof as Q } from "../../functions/snarkjs/constructEmporiumProof.mjs";
13
- import { outputUtxoProcessing as X } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
14
- import { addPaddingToUtxos as Z } from "../../functions/web3/events/getShieldedBalance.mjs";
15
- import { estimateGasRelayer as $ } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
16
- import { transactCallRelayer as I } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
17
- import { uniswapWorkaround as h } from "../../functions/utils/involves-permit2-op.mjs";
18
- import { outputApprovalDataProcessing as rr } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
19
- import { convertEmporiumOpToCallInfo as tr } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
20
- import { getFeeStructure as or } from "../../functions/pre-transaction/getFeeStructure.mjs";
21
- import { shouldPatchAccessTokenMerkleTree as er } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
22
- import { getSignatureDataForTransact as sr } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
23
- import { mergeWithFeeStructureEmporium as mr } from "../../functions/pre-transaction/merge-with-fee-structure-emporium.mjs";
24
- import { caseInsensitiveEqual as ir } from "../../functions/utils/caseInsensitive.utils.mjs";
25
- import { getCurrentTimeInSeconds as ar } from "../../functions/utils/time.utils.mjs";
26
- import { handleAutoDepositBack as pr } from "./handleAutoDepositBack.mjs";
27
11
  import "../../constants/server.constants.mjs";
28
12
  import "../../API/getServerURL.mjs";
29
13
  import "../http/HttpClient.mjs";
30
14
  import "axios";
31
- import "../../constants/token-data/index.mjs";
32
- import { constructAdminData as cr } from "../../functions/pre-transaction/constructAdminData.mjs";
15
+ import "circomlibjs-hinkal-fork";
16
+ import "libsodium-wrappers";
17
+ import "process";
18
+ import "buffer";
19
+ import "../../constants/vite.constants.mjs";
20
+ import "../../constants/save-depths.mjs";
21
+ import { caseInsensitiveEqual as J } from "../../functions/utils/caseInsensitive.utils.mjs";
22
+ import "../../constants/reorg-depths.constants.mjs";
23
+ import "../../functions/utils/mutexes.utils.mjs";
33
24
  import "@coral-xyz/anchor";
34
25
  import "@solana/web3.js";
35
- import "circomlibjs-hinkal-fork";
26
+ import { UserKeys as Q } from "../crypto-keys/keys.mjs";
27
+ import { getCurrentTimeInSeconds as X } from "../../functions/utils/time.utils.mjs";
28
+ import { constructEmporiumProof as Z } from "../../functions/snarkjs/constructEmporiumProof.mjs";
29
+ import { outputUtxoProcessing as $ } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
30
+ import { addPaddingToUtxos as b } from "../../functions/web3/events/getShieldedBalance.mjs";
31
+ import { estimateGasRelayer as h } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
32
+ import { transactCallRelayer as tt } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
33
+ import { uniswapWorkaround as rt } from "../../functions/utils/involves-permit2-op.mjs";
34
+ import { outputApprovalDataProcessing as ot } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
35
+ import { convertEmporiumOpToCallInfo as et } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
36
+ import { getFeeStructure as it } from "../../functions/pre-transaction/getFeeStructure.mjs";
37
+ import { shouldPatchAccessTokenMerkleTree as mt } from "../../functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs";
38
+ import { getSignatureDataForTransact as at } from "../../functions/pre-transaction/getSignatureDataForTransact.mjs";
39
+ import { mergeWithFeeStructureEmporium as pt } from "../../functions/pre-transaction/merge-with-fee-structure-emporium.mjs";
40
+ import { handleAutoDepositBack as st } from "./handleAutoDepositBack.mjs";
41
+ import "../../constants/token-data/index.mjs";
42
+ import { constructAdminData as nt } from "../../functions/pre-transaction/constructAdminData.mjs";
36
43
  import "@solana/spl-token";
37
- import { AccountActions as S } from "../AccountActions/AccountActions.mjs";
38
- import "buffer";
39
- import { recipientUtxoProcessing as ur } from "../../functions/pre-transaction/recipientUtxoProcessing.mjs";
40
- import { isValidPrivateAddress as fr } from "../../functions/utils/addresses.mjs";
41
- const Ir = async (o, r, k, e, A, c, m, l, U, F, B, H = !1, K, w, u, T = !1) => {
42
- if (u && !fr(u.recipientInfo))
44
+ import { recipientUtxoProcessing as ct } from "../../functions/pre-transaction/recipientUtxoProcessing.mjs";
45
+ import { isValidPrivateAddress as ut } from "../../functions/utils/addresses.mjs";
46
+ const er = async (t, o, e, d, p, i, A, K, S, F, H = !1, C, g, s, y = !1) => {
47
+ if (s && !ut(s.recipientInfo))
43
48
  throw Error(R.RECIPIENT_FORMAT_INCORRECT);
44
- const s = k.map((t) => t.erc20TokenAddress), i = S.getAddressFromSubAccount(r, l);
45
- if (!i)
46
- throw Error("Public account address is not available");
47
- const { contractData: L } = C[r], { emporiumAddress: f } = L;
48
- if (!f)
49
+ const n = t.getCurrentChainId(), c = Q.getSignerAddressFromPrivateKey(n, A.privateKey), { contractData: L } = k[n], { emporiumAddress: u } = L;
50
+ if (!u)
49
51
  throw Error("No Emporium Address Provided");
50
- const n = F ?? await or(
51
- r,
52
- U,
53
- s,
52
+ const f = S ?? await it(
53
+ n,
54
+ K,
55
+ o,
54
56
  j.Emporium,
55
- c.map((t) => tr(t, i ?? "", r))
56
- ), W = m.find(
57
- (t) => ir(t.token.erc20TokenAddress, n.feeToken)
57
+ p.map((r) => et(r, c ?? "", n))
58
+ ), W = i.find(
59
+ (r) => J(r.token.erc20TokenAddress, f.feeToken)
58
60
  )?.amount ?? 0n;
59
- for (i && await mr(
60
- o,
61
- r,
62
- i,
61
+ for (c && await pt(
62
+ t,
63
63
  c,
64
- s,
64
+ p,
65
+ o,
65
66
  e,
66
- n,
67
+ f,
67
68
  W
68
- ); A.length < s.length; )
69
- A.push(!1);
70
- const a = [...await Z(o, r, s, e)], d = [], p = G(e.length, o.userKeys), y = ar().toString();
71
- for (let t = 0; t < s.length; t += 1) {
72
- const { outputUtxos: V } = X(
73
- o.userKeys,
74
- a[t],
75
- e[t],
76
- y,
69
+ ); d.length < o.length; )
70
+ d.push(!1);
71
+ const m = [...await b(t, o, e)], T = [], a = G(e.length, t.userKeys), E = X().toString();
72
+ for (let r = 0; r < o.length; r += 1) {
73
+ const { outputUtxos: V } = $(
74
+ t.userKeys,
75
+ m[r],
76
+ e[r],
77
+ E,
77
78
  void 0,
78
79
  !1
79
80
  );
80
- d.push(V);
81
- const { useApprovalUtxoData: D } = rr(o, r, a[t], e[t]);
82
- D && (p.doPreTxApproval = !0, p.useApprovalUtxoData[t] = D, p.interactionAddress = f, p.inHinkalAddress = o.userKeys.getInHinkalAddress(f));
81
+ T.push(V);
82
+ const { useApprovalUtxoData: I } = ot(t, m[r], e[r]);
83
+ I && (a.doPreTxApproval = !0, a.useApprovalUtxoData[r] = I, a.interactionAddress = u, a.inHinkalAddress = t.userKeys.getInHinkalAddress(u));
83
84
  }
84
- u && ur(u, d, e, y);
85
- const E = B ?? await o.getRandomRelay(r, !T);
86
- if (!E)
85
+ s && ct(s, T, e, E);
86
+ const v = F ?? await t.getRandomRelay(!y);
87
+ if (!v)
87
88
  throw Error(R.RELAYER_NOT_AVAILABLE);
88
- const { patchAccessTokenMerkleTree: N, kycRequired: O, hasAccessToken: _ } = await er(
89
+ const { patchAccessTokenMerkleTree: N, kycRequired: O, hasAccessToken: _ } = await mt(
90
+ t,
89
91
  o,
90
- r,
91
- s,
92
92
  e
93
- ), b = await sr(
94
- r,
95
- await o.getEthereumAddressByChain(r),
96
- o.userKeys,
93
+ ), M = await at(
94
+ t.getCurrentChainId(),
95
+ await t.getEthereumAddress(),
96
+ t.userKeys,
97
97
  O,
98
98
  _
99
- ), { zkCallData: P, circomData: g, dimData: v, authorizationData: x } = await Q(
99
+ ), { zkCallData: P, circomData: l, dimData: x, authorizationData: D } = await Z(
100
100
  "v1x1",
101
- o.merkleTreeHinkalByChain[r],
102
- o.merkleTreeAccessTokenByChain[r],
103
- s,
104
- s.map(() => 0),
105
- a,
106
- d,
107
- o.userKeys,
101
+ t.merkleTreeHinkal,
102
+ t.merkleTreeAccessToken,
103
+ o,
104
+ o.map(() => 0),
105
+ m,
106
+ T,
107
+ t.userKeys,
108
108
  e.length,
109
- a.length > 0 ? a[0].length : 0,
110
- f,
111
- c,
112
- o.generateProofRemotely,
113
- E,
114
- r,
115
- A,
116
- void 0,
117
- S.getPrivateKeyFromSubAccount(r, l),
109
+ m.length > 0 ? m[0].length : 0,
110
+ u,
118
111
  p,
112
+ t.generateProofRemotely,
113
+ v,
114
+ t.getCurrentChainId(),
115
+ d,
116
+ void 0,
117
+ A.privateKey,
118
+ a,
119
119
  N,
120
120
  void 0,
121
- n,
122
- o.getContractWithFetcher(r, Y.HinkalHelperContract),
123
- b
124
- ), M = h(c);
125
- if (T)
126
- return await $(r, P, v, g, x);
127
- const q = cr(
128
- w,
129
- r,
130
- m.map((t) => t.token.erc20TokenAddress),
131
- m.map((t) => t.amount),
132
- await o.getEthereumAddressByChain(r),
133
- w === J.PublicSwap ? m.map(({ token: t }) => t) : void 0
134
- ), z = await I(
135
- r,
136
- P,
137
- v,
121
+ f,
122
+ t.getContractWithFetcher(Y.HinkalHelperContract),
123
+ M
124
+ ), q = rt(p);
125
+ if (y)
126
+ return await h(t, P, x, l, D);
127
+ const w = g === U.FundApproveAndTransact, z = nt(
138
128
  g,
139
- !1,
140
- M,
129
+ t.getCurrentChainId(),
130
+ i.map((r) => r.token.erc20TokenAddress),
131
+ i.map((r) => r.amount),
132
+ await t.getEthereumAddress(),
133
+ g === U.PublicSwap ? i.map(({ token: r }) => r) : void 0,
134
+ w ? e : void 0,
135
+ // fundAmounts
136
+ w ? o : void 0,
137
+ // erc20AddressesToFund
138
+ w ? i : void 0
139
+ ), B = await tt(
140
+ t.getCurrentChainId(),
141
+ P,
141
142
  x,
142
- q
143
+ l,
144
+ !1,
145
+ q,
146
+ D,
147
+ z
143
148
  );
144
- return H && pr(
145
- o,
146
- r,
149
+ return H && st(
150
+ t,
151
+ c,
152
+ A,
153
+ f.feeToken,
154
+ C,
147
155
  i,
148
- l,
149
- n.feeToken,
150
- K,
151
- m,
152
- g
153
- ), z;
156
+ l
157
+ ), B;
154
158
  };
155
159
  export {
156
- Ir as hinkalPrivateWallet
160
+ er as hinkalPrivateWallet
157
161
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../functions/snarkjs/common.snarkjs.cjs"),A=require("../../functions/web3/etherFunctions.cjs"),d=require("../../types/ethereum-network.types.cjs"),k=require("../utxo/Utxo.cjs"),g=require("../../constants/protocol.constants.cjs"),y=require("../../functions/utils/caseInsensitive.utils.cjs"),u=require("../../functions/utils/token-check.utils.cjs"),q=(n,t)=>{const o=[];let r=0;for(let e=0;e<n.length;e+=1){let i=!1;for(let a=0;a<r;a+=1)if(u.isSameERC20Token(o[a].token,n[e])){o[a].balance+=t[e],i=!0;break}i||(o[r]={token:n[e],balance:t[e]},r+=1)}return o},v=async(n,t,o)=>{const r=q(t,o),e=u.validateAndGetChainId(t),a=n.getContractWithSigner(e,d.ContractType.HinkalContract).address;for(let s=0;s<r.length;s+=1)y.caseInsensitiveEqual(r[s].token.erc20TokenAddress,g.zeroAddress)||await(await n.getContractWithSigner(e,d.ContractType.ERC20Contract,r[s].token.erc20TokenAddress).approve(a,r[s].balance)).wait()},S=async(n,t,o,r)=>{const e=u.validateAndGetChainId(t),i=n.getContractWithSigner(e,d.ContractType.HinkalContract),a=n.userKeys.getShieldedPrivateKey(),s=k.Utxo.findCorrectRandomization(A.randomBigInt(31),a),c=r??Array(t.length).fill(f.calcStealthAddressStructure(s,a));if(c.length!==t.length)throw new Error("Stealth address structures length must be equal to erc20 tokens length");await v(n,t,o);const h=t.findIndex(l=>l.erc20TokenAddress===g.zeroAddress),p=o[h]??0n,C=await i.prooflessDeposit(t.map(({erc20TokenAddress:l})=>l),o,t.map(()=>0n),c,{value:p});return await C.wait(),C};exports.hinkalProoflessDeposit=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../functions/snarkjs/common.snarkjs.cjs"),C=require("../../functions/web3/etherFunctions.cjs"),l=require("../../types/ethereum-network.types.cjs"),k=require("../utxo/Utxo.cjs"),h=require("../../constants/protocol.constants.cjs"),g=require("../../functions/utils/caseInsensitive.utils.cjs"),A=(n,e)=>{const r=[];let o=0;for(let s=0;s<n.length;s+=1){let a=!1;for(let t=0;t<o;t+=1)if(g.caseInsensitiveEqual(r[t].token.erc20TokenAddress,n[s].erc20TokenAddress)){r[t].balance+=e[s],a=!0;break}a||(r[o]={token:n[s],balance:e[s]},o+=1)}return r},y=async(n,e,r)=>{const o=A(e,r),a=n.getContractWithSigner(l.ContractType.HinkalContract).address;for(let t=0;t<o.length;t+=1)g.caseInsensitiveEqual(o[t].token.erc20TokenAddress,h.zeroAddress)||await(await n.getContractWithSigner(l.ContractType.ERC20Contract,o[t].token.erc20TokenAddress).approve(a,o[t].balance)).wait()},q=async(n,e,r,o)=>{const s=n.getContractWithSigner(l.ContractType.HinkalContract),a=n.userKeys.getShieldedPrivateKey(),t=k.Utxo.findCorrectRandomization(C.randomBigInt(31),a),i=o??Array(e.length).fill(f.calcStealthAddressStructure(t,a));if(i.length!==e.length)throw new Error("Stealth address structures length must be equal to erc20 tokens length");await y(n,e,r);const d=e.findIndex(c=>c.erc20TokenAddress===h.zeroAddress),p=r[d]??0n,u=await s.prooflessDeposit(e.map(({erc20TokenAddress:c})=>c),r,e.map(()=>0n),i,{value:p});return await u.wait(),u};exports.hinkalProoflessDeposit=q;
@@ -1,48 +1,46 @@
1
- import { calcStealthAddressStructure as g } from "../../functions/snarkjs/common.snarkjs.mjs";
2
- import { randomBigInt as C } from "../../functions/web3/etherFunctions.mjs";
3
- import { ContractType as d } from "../../types/ethereum-network.types.mjs";
1
+ import { calcStealthAddressStructure as m } from "../../functions/snarkjs/common.snarkjs.mjs";
2
+ import { randomBigInt as g } from "../../functions/web3/etherFunctions.mjs";
3
+ import { ContractType as l } from "../../types/ethereum-network.types.mjs";
4
4
  import { Utxo as A } from "../utxo/Utxo.mjs";
5
- import { zeroAddress as m } from "../../constants/protocol.constants.mjs";
6
- import { caseInsensitiveEqual as w } from "../../functions/utils/caseInsensitive.utils.mjs";
7
- import { validateAndGetChainId as p, isSameERC20Token as S } from "../../functions/utils/token-check.utils.mjs";
8
- const k = (n, t) => {
9
- const o = [];
10
- let r = 0;
11
- for (let e = 0; e < n.length; e += 1) {
5
+ import { zeroAddress as h } from "../../constants/protocol.constants.mjs";
6
+ import { caseInsensitiveEqual as p } from "../../functions/utils/caseInsensitive.utils.mjs";
7
+ const C = (r, e) => {
8
+ const n = [];
9
+ let o = 0;
10
+ for (let a = 0; a < r.length; a += 1) {
12
11
  let s = !1;
13
- for (let a = 0; a < r; a += 1)
14
- if (S(o[a].token, n[e])) {
15
- o[a].balance += t[e], s = !0;
12
+ for (let t = 0; t < o; t += 1)
13
+ if (p(n[t].token.erc20TokenAddress, r[a].erc20TokenAddress)) {
14
+ n[t].balance += e[a], s = !0;
16
15
  break;
17
16
  }
18
- s || (o[r] = {
19
- token: n[e],
20
- balance: t[e]
21
- }, r += 1);
17
+ s || (n[o] = {
18
+ token: r[a],
19
+ balance: e[a]
20
+ }, o += 1);
22
21
  }
23
- return o;
24
- }, v = async (n, t, o) => {
25
- const r = k(t, o), e = p(t), a = n.getContractWithSigner(e, d.HinkalContract).address;
26
- for (let i = 0; i < r.length; i += 1)
27
- w(r[i].token.erc20TokenAddress, m) || await (await n.getContractWithSigner(
28
- e,
29
- d.ERC20Contract,
30
- r[i].token.erc20TokenAddress
31
- ).approve(a, r[i].balance)).wait();
32
- }, W = async (n, t, o, r) => {
33
- const e = p(t), s = n.getContractWithSigner(e, d.HinkalContract), a = n.userKeys.getShieldedPrivateKey(), i = A.findCorrectRandomization(C(31), a), c = r ?? Array(t.length).fill(g(i, a));
34
- if (c.length !== t.length)
22
+ return n;
23
+ }, k = async (r, e, n) => {
24
+ const o = C(e, n), s = r.getContractWithSigner(l.HinkalContract).address;
25
+ for (let t = 0; t < o.length; t += 1)
26
+ p(o[t].token.erc20TokenAddress, h) || await (await r.getContractWithSigner(
27
+ l.ERC20Contract,
28
+ o[t].token.erc20TokenAddress
29
+ ).approve(s, o[t].balance)).wait();
30
+ }, q = async (r, e, n, o) => {
31
+ const a = r.getContractWithSigner(l.HinkalContract), s = r.userKeys.getShieldedPrivateKey(), t = A.findCorrectRandomization(g(31), s), i = o ?? Array(e.length).fill(m(t, s));
32
+ if (i.length !== e.length)
35
33
  throw new Error("Stealth address structures length must be equal to erc20 tokens length");
36
- await v(n, t, o);
37
- const h = t.findIndex((l) => l.erc20TokenAddress === m), u = o[h] ?? 0n, f = await s.prooflessDeposit(
38
- t.map(({ erc20TokenAddress: l }) => l),
39
- o,
40
- t.map(() => 0n),
41
- c,
34
+ await k(r, e, n);
35
+ const d = e.findIndex((c) => c.erc20TokenAddress === h), u = n[d] ?? 0n, f = await a.prooflessDeposit(
36
+ e.map(({ erc20TokenAddress: c }) => c),
37
+ n,
38
+ e.map(() => 0n),
39
+ i,
42
40
  { value: u }
43
41
  );
44
42
  return await f.wait(), f;
45
43
  };
46
44
  export {
47
- W as hinkalProoflessDeposit
45
+ q as hinkalProoflessDeposit
48
46
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../constants/addresses.constants.cjs"),y=require("../../functions/pre-transaction/getFeeStructure.cjs"),P=require("../../functions/private-wallet/emporium.swap.helpers.cjs"),g=require("../../functions/utils/convertEmporiumOpToCallInfo.cjs"),v=require("../../types/external-action.types.cjs"),C=require("../../error-handling/error-codes.constants.cjs"),I=require("../../constants/protocol.constants.cjs"),O=require("../../functions/utils/token-check.utils.cjs"),L=require("../AccountActions/AccountActions.cjs"),T=async(t,o,s,u,A,m,p,n,E,S=!1,_,w,d=!1)=>{if(!n)throw new Error("Fee token is required in hinkalProxySwap");const r=O.validateAndGetChainId(o),a=L.AccountActions.getAddressFromSubAccount(r,p);if(!a)throw Error("Public account address is not available");const c=o.map(e=>e.erc20TokenAddress),i=await t.getRandomRelay(r,!d);if(!i)throw Error(C.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const l=await P.createSwapToEmporiumOps(t,r,u,f.SWAP_ROUTER_ADDRESSES[u][r],A,c[0],s[0],s[1],c[1],m,a,i,!0),q=E??await y.getFeeStructure(r,n,c,v.ExternalActionId.Emporium,l.map(e=>g.convertEmporiumOpToCallInfo(e,a,r)),I.HINKAL_SWAP_VARIABLE_RATE),h=o.map((e,R)=>({token:e,amount:s[R]}));return t.actionPrivateWallet(r,[],[],[],l,h,p,n,q,i,S,_,w,void 0,d)};exports.hinkalProxySwap=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../constants/addresses.constants.cjs"),R=require("../../functions/pre-transaction/getFeeStructure.cjs"),I=require("../../functions/private-wallet/emporium.swap.helpers.cjs"),P=require("../../functions/utils/convertEmporiumOpToCallInfo.cjs"),f=require("../../types/external-action.types.cjs"),v=require("../../error-handling/error-codes.constants.cjs"),O=require("../../constants/protocol.constants.cjs"),h=require("../crypto-keys/keys.cjs"),T=async(r,i,t,c,E,S,u,o,l,A=!1,_,w,p=!1)=>{if(!o)throw new Error("Fee token is required in hinkalProxySwap");const s=r.getCurrentChainId(),d=h.UserKeys.getSignerAddressFromPrivateKey(s,u.privateKey),n=i.map(e=>e.erc20TokenAddress),a=await r.getRandomRelay(!p);if(!a)throw Error(v.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const m=await I.createSwapToEmporiumOps(r,c,C.SWAP_ROUTER_ADDRESSES[c][s],E,n[0],t[0],t[1],n[1],S,d,a,!0),y=l??await R.getFeeStructure(s,o,n,f.ExternalActionId.Emporium,m.map(e=>P.convertEmporiumOpToCallInfo(e,d,r.getCurrentChainId())),O.HINKAL_SWAP_VARIABLE_RATE),g=i.map((e,q)=>({token:e,amount:t[q]}));return r.actionPrivateWallet([],[],[],m,g,u,o,y,a,A,_,w,void 0,p)};exports.hinkalProxySwap=T;