@hinkal/common 0.2.17 → 0.2.19

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