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