@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
@@ -1,43 +1,43 @@
1
- import { PublicKey as r } from "@solana/web3.js";
2
- import { getAmountInWei as P } from "./etherFunctions.mjs";
3
- import { isSolanaLike as h, networkRegistry as K } from "../../constants/chains.constants.mjs";
4
- import { getSwapperAccountPublicKey as O } from "../pre-transaction/solana.mjs";
5
- import { callOkxAPI as T } from "../../API/callOkxAPI.mjs";
6
- const D = (o, e, n, s, i = 0.7) => ({
1
+ import { PublicKey as o } from "@solana/web3.js";
2
+ import { randomBigInt as P, getAmountInWei as I } from "./etherFunctions.mjs";
3
+ import { isSolanaLike as K, networkRegistry as O } from "../../constants/chains.constants.mjs";
4
+ import { getSwapperAccountPublicKeyFromSalt as T } from "../pre-transaction/solana.mjs";
5
+ import { callOkxAPI as D } from "../../API/callOkxAPI.mjs";
6
+ const E = (r, t, n, s, i = 0.7) => ({
7
7
  amount: `${n}`,
8
8
  chainIndex: "501",
9
9
  // Solana mainnet
10
- fromTokenAddress: o.toString(),
11
- toTokenAddress: e.toString(),
10
+ fromTokenAddress: r.toString(),
11
+ toTokenAddress: t.toString(),
12
12
  userWalletAddress: s,
13
13
  slippagePercent: `${i}`,
14
14
  directRoute: !0
15
- }), $ = async (o, e, n, s, i = 0.5, a, c) => {
16
- if (!h(o))
15
+ }), q = async (r, t, n, s, i = 0.5, a, c) => {
16
+ if (!K(r))
17
17
  throw new Error("OKX is only supported on Solana");
18
- const d = P(e, s), { hinkalAddress: l, originalDeployer: u } = K[o].contractData;
19
- if (!u)
18
+ const u = P(31), p = I(t, s), { hinkalAddress: d, originalDeployer: l } = O[r].contractData;
19
+ if (!l)
20
20
  throw new Error("No original deployer configured for Solana program");
21
21
  if (c && !a)
22
22
  throw new Error("Proxy wallet address is required");
23
- const w = new r(l), g = new r(u), m = c && a ? new r(a) : O(w, g), p = new r(e.erc20TokenAddress), f = new r(n.erc20TokenAddress), A = D(
24
- p,
23
+ const w = new o(d), g = new o(l), m = c && a ? new o(a) : T(w, g, u), A = new o(t.erc20TokenAddress), f = new o(n.erc20TokenAddress), S = E(
24
+ A,
25
25
  f,
26
- d,
26
+ p,
27
27
  m.toString(),
28
28
  i
29
- ), { okxResponse: t, status: k } = await T(o, { quote: A });
29
+ ), { okxResponse: e, status: k } = await D({ quote: S });
30
30
  if (k !== "success")
31
31
  throw Error("OKX API Fetch Error");
32
- if (t.code !== "0")
33
- throw new Error(`OKX API error: ${t.msg}`);
34
- const S = BigInt(t.data.routerResult.toTokenAmount), y = JSON.stringify(t);
32
+ if (e.code !== "0")
33
+ throw new Error(`OKX API error: ${e.msg}`);
34
+ const h = BigInt(e.data.routerResult.toTokenAmount), y = JSON.stringify({ ...e, swapperAccountSalt: u.toString() });
35
35
  return {
36
- outSwapAmountValue: S,
36
+ outSwapAmountValue: h,
37
37
  okxDataValue: y
38
38
  };
39
39
  };
40
40
  export {
41
- D as createOKXQuote,
42
- $ as getOKXPrice
41
+ E as createOKXQuote,
42
+ q as getOKXPrice
43
43
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../API/callOneInchAPI.cjs");require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");const e=require("../../constants/protocol.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 q=require("../../error-handling/error-codes.constants.cjs"),a=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");const d=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");const l=require("../../error-handling/logger.cjs");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const A=require("./getContractMetadata.cjs"),I=async(s,t,i,n,u=.7)=>{try{const o={fromTokenAddress:t.erc20TokenAddress!==e.zeroAddress?t.erc20TokenAddress:e.oneInchZeroAddress,toTokenAddress:i.erc20TokenAddress!==e.zeroAddress?i.erc20TokenAddress:e.oneInchZeroAddress,fromAddress:e.zeroAddress,destReceiver:A.getContractMetadata(d.ContractType.OneInchExternalActionContract,s).address,amount:a.getAmountInWei(t,n),slippage:u,disableEstimate:!0,allowPartialFill:!1},r=await c.callOneInchAPI(s,o);if(!r||!r.tx)throw Error("OneInch API price fetch error");return{outSwapAmountValue:BigInt(r.toAmount),oneInchDataValue:r.tx.data}}catch(o){throw l.Logger.log({error:o}),Error(q.transactionErrorCodes.NO_ONEINCH_PRICE)}};exports.getOneInchPrice=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../API/callOneInchAPI.cjs");require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");const e=require("../../constants/protocol.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 a=require("../../error-handling/error-codes.constants.cjs"),d=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");const q=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const l=require("../../error-handling/logger.cjs"),A=require("./getContractMetadata.cjs"),I=async(s,t,n,c,i=.7)=>{try{const o={fromTokenAddress:t.erc20TokenAddress!==e.zeroAddress?t.erc20TokenAddress:e.oneInchZeroAddress,toTokenAddress:n.erc20TokenAddress!==e.zeroAddress?n.erc20TokenAddress:e.oneInchZeroAddress,fromAddress:e.zeroAddress,destReceiver:A.getContractMetadata(q.ContractType.OneInchExternalActionContract,s).address,amount:d.getAmountInWei(t,c),slippage:i,disableEstimate:!0,allowPartialFill:!1},r=await u.callOneInchAPI(s,o);if(!r||!r.tx)throw Error("OneInch API price fetch error");return{outSwapAmountValue:BigInt(r.toAmount),oneInchDataValue:r.tx.data}}catch(o){throw l.Logger.log({error:o}),Error(a.transactionErrorCodes.NO_ONEINCH_PRICE)}};exports.getOneInchPrice=I;
@@ -1,7 +1,7 @@
1
1
  import { callOneInchAPI as a } from "../../API/callOneInchAPI.mjs";
2
2
  import "../../constants/token-data/index.mjs";
3
3
  import "../../constants/chains.constants.mjs";
4
- import { zeroAddress as e, oneInchZeroAddress as p } from "../../constants/protocol.constants.mjs";
4
+ import { zeroAddress as e, oneInchZeroAddress as s } from "../../constants/protocol.constants.mjs";
5
5
  import "../../constants/contracts.constants.mjs";
6
6
  import "../../constants/kyc.constants.mjs";
7
7
  import "../../constants/server.constants.mjs";
@@ -20,31 +20,18 @@ import "../../types/circom-data.types.mjs";
20
20
  import { ContractType as A } from "../../types/ethereum-network.types.mjs";
21
21
  import "../../types/transactions.types.mjs";
22
22
  import "../../types/activities.types.mjs";
23
- import "../../API/getServerURL.mjs";
24
- import "../../data-structures/http/HttpClient.mjs";
25
- import "axios";
26
- import "ethers";
27
- import "circomlibjs-hinkal-fork";
28
- import "libsodium-wrappers";
29
- import "process";
30
- import "buffer";
31
- import "../../constants/save-depths.mjs";
32
- import "../utils/mutexes.utils.mjs";
33
- import "@coral-xyz/anchor";
34
23
  import { Logger as l } from "../../error-handling/logger.mjs";
35
- import "@solana/web3.js";
36
- import "../../data-structures/crypto-keys/keys.mjs";
37
24
  import { getContractMetadata as f } from "./getContractMetadata.mjs";
38
- const $ = async (m, o, i, s, n = 0.7) => {
25
+ const H = async (m, o, i, n, p = 0.7) => {
39
26
  try {
40
27
  const t = {
41
- fromTokenAddress: o.erc20TokenAddress !== e ? o.erc20TokenAddress : p,
42
- toTokenAddress: i.erc20TokenAddress !== e ? i.erc20TokenAddress : p,
28
+ fromTokenAddress: o.erc20TokenAddress !== e ? o.erc20TokenAddress : s,
29
+ toTokenAddress: i.erc20TokenAddress !== e ? i.erc20TokenAddress : s,
43
30
  fromAddress: e,
44
31
  // we user zero address here because this paramater is not relevant to us, only destReceiver is
45
32
  destReceiver: f(A.OneInchExternalActionContract, m).address,
46
- amount: d(o, s),
47
- slippage: n,
33
+ amount: d(o, n),
34
+ slippage: p,
48
35
  disableEstimate: !0,
49
36
  // disable gas estimation, we don't need it
50
37
  // disable partial filling:
@@ -65,5 +52,5 @@ const $ = async (m, o, i, s, n = 0.7) => {
65
52
  }
66
53
  };
67
54
  export {
68
- $ as getOneInchPrice
55
+ H as getOneInchPrice
69
56
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../error-handling/error-codes.constants.cjs");require("ethers");const T=require("../../error-handling/get-error.message.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const m=5e4,l=1,d=11,w=15,q=async(t,i)=>{try{const r=await t.getFeeData(),s=i===0?d:w;return r.gasPrice?.mul(s).div(10)??void 0}catch(r){console.log("getGasPrice error: ",{err:r});return}},P=(t,i,r)=>new Promise((s,a)=>{const o=setTimeout(()=>{a(new Error(c.transactionErrorCodes.TRANSACTION_TIMEOUT))},r);t.wait(i).then(e=>{clearTimeout(o),s(e)}).catch(e=>{clearTimeout(o),a(e)})}),g=async({contractFunction:t,args:i,gasPrice:r,gasLimit:s,nonce:a,confirmations:o,waitTime:e})=>{const n=await t(...i,{type:0,gasLimit:s,gasPrice:r,nonce:a});return await P(n,o??l,e??m)},E=async({provider:t,contractFunction:i,args:r,gasLimit:s,nonce:a,confirmations:o})=>{try{const e=await q(t,0);return await g({contractFunction:i,args:r,gasPrice:e,gasLimit:s,nonce:a,confirmations:o})}catch(e){const n=T.getErrorMessage(e);if(n===c.UserFriendlyErrorCodes.MAX_FEE_GAS_ERROR||n===c.transactionErrorCodes.TRANSACTION_TIMEOUT){console.log("Timeout Hit: Increase gas");const u=await q(t,1);return await g({contractFunction:i,args:r,gasPrice:u,gasLimit:s,nonce:a,confirmations:o})}throw e}};exports.runContractFunction=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../error-handling/error-codes.constants.cjs");require("ethers");const m=require("../../error-handling/get-error.message.cjs");require("../../constants/vite.constants.cjs");const l=5e4,d=1,w=11,P=15,g=async(e,s)=>{try{const t=await e.getFeeData(),a=s===0?w:P;return t.gasPrice?.mul(a).div(10)??void 0}catch(t){console.log("getGasPrice error: ",{err:t});return}},E=(e,s,t)=>new Promise((a,o)=>{const n=setTimeout(()=>{o(new Error(i.transactionErrorCodes.TRANSACTION_TIMEOUT))},t);e.wait(s).then(r=>{clearTimeout(n),a(r)}).catch(r=>{clearTimeout(n),o(r)})}),T=async({contractFunction:e,args:s,gasPrice:t,gasLimit:a,nonce:o,confirmations:n,waitTime:r})=>{const c=await e(...s,{type:0,gasLimit:a,gasPrice:t,nonce:o});return await E(c,n??d,r??l)},y=async({provider:e,contractFunction:s,args:t,gasLimit:a,nonce:o,confirmations:n})=>{try{const r=await g(e,0);return await T({contractFunction:s,args:t,gasPrice:r,gasLimit:a,nonce:o,confirmations:n})}catch(r){const c=m.getErrorMessage(r);if(c===i.UserFriendlyErrorCodes.MAX_FEE_GAS_ERROR||c===i.transactionErrorCodes.TRANSACTION_TIMEOUT){console.log("Timeout Hit: Increase gas");const u=await g(e,1);return await T({contractFunction:s,args:t,gasPrice:u,gasLimit:a,nonce:o,confirmations:n})}throw r}};exports.runContractFunction=y;
@@ -1,91 +1,73 @@
1
- import { UserFriendlyErrorCodes as T, transactionErrorCodes as u } from "../../error-handling/error-codes.constants.mjs";
1
+ import { UserFriendlyErrorCodes as g, transactionErrorCodes as T } from "../../error-handling/error-codes.constants.mjs";
2
2
  import "ethers";
3
- import { getErrorMessage as g } from "../../error-handling/get-error.message.mjs";
4
- import "../../constants/server.constants.mjs";
5
- import "../../API/getServerURL.mjs";
6
- import "../../data-structures/http/HttpClient.mjs";
7
- import "axios";
8
- import "../../constants/chains.constants.mjs";
9
- import "../../types/circom-data.types.mjs";
10
- import "../../types/transactions.types.mjs";
11
- import "../../types/activities.types.mjs";
12
- import "circomlibjs-hinkal-fork";
13
- import "libsodium-wrappers";
14
- import "process";
15
- import "buffer";
3
+ import { getErrorMessage as w } from "../../error-handling/get-error.message.mjs";
16
4
  import "../../constants/vite.constants.mjs";
17
- import "../../constants/save-depths.mjs";
18
- import "../../constants/reorg-depths.constants.mjs";
19
- import "../utils/mutexes.utils.mjs";
20
- import "@coral-xyz/anchor";
21
- import "@solana/web3.js";
22
- import "../../data-structures/crypto-keys/keys.mjs";
23
- const w = 5e4, l = 1, P = 11, d = 15, m = async (o, i) => {
5
+ const l = 5e4, P = 1, d = 11, E = 15, m = async (e, a) => {
24
6
  try {
25
- const t = await o.getFeeData(), e = i === 0 ? P : d;
26
- return t.gasPrice?.mul(e).div(10) ?? void 0;
7
+ const t = await e.getFeeData(), o = a === 0 ? d : E;
8
+ return t.gasPrice?.mul(o).div(10) ?? void 0;
27
9
  } catch (t) {
28
10
  console.log("getGasPrice error: ", { err: t });
29
11
  return;
30
12
  }
31
- }, E = (o, i, t) => new Promise((e, a) => {
32
- const s = setTimeout(() => {
33
- a(new Error(u.TRANSACTION_TIMEOUT));
13
+ }, y = (e, a, t) => new Promise((o, s) => {
14
+ const n = setTimeout(() => {
15
+ s(new Error(T.TRANSACTION_TIMEOUT));
34
16
  }, t);
35
- o.wait(i).then((r) => {
36
- clearTimeout(s), e(r);
17
+ e.wait(a).then((r) => {
18
+ clearTimeout(n), o(r);
37
19
  }).catch((r) => {
38
- clearTimeout(s), a(r);
20
+ clearTimeout(n), s(r);
39
21
  });
40
- }), p = async ({
41
- contractFunction: o,
42
- args: i,
22
+ }), u = async ({
23
+ contractFunction: e,
24
+ args: a,
43
25
  gasPrice: t,
44
- gasLimit: e,
45
- nonce: a,
46
- confirmations: s,
26
+ gasLimit: o,
27
+ nonce: s,
28
+ confirmations: n,
47
29
  waitTime: r
48
30
  }) => {
49
- const n = await o(...i, {
31
+ const c = await e(...a, {
50
32
  type: 0,
51
- gasLimit: e,
33
+ gasLimit: o,
52
34
  gasPrice: t,
53
- nonce: a
35
+ nonce: s
54
36
  });
55
- return await E(
56
- n,
57
- s ?? l,
58
- r ?? w
37
+ return await y(
38
+ c,
39
+ n ?? P,
40
+ r ?? l
59
41
  );
60
- }, q = async ({
61
- provider: o,
62
- contractFunction: i,
42
+ }, I = async ({
43
+ provider: e,
44
+ contractFunction: a,
63
45
  args: t,
64
- gasLimit: e,
65
- nonce: a,
66
- confirmations: s
46
+ gasLimit: o,
47
+ nonce: s,
48
+ confirmations: n
67
49
  }) => {
68
50
  try {
69
51
  const r = await m(
70
- o,
52
+ e,
71
53
  0
72
54
  /* Initial */
73
55
  );
74
- return await p({ contractFunction: i, args: t, gasPrice: r, gasLimit: e, nonce: a, confirmations: s });
56
+ return await u({ contractFunction: a, args: t, gasPrice: r, gasLimit: o, nonce: s, confirmations: n });
75
57
  } catch (r) {
76
- const n = g(r);
77
- if (n === T.MAX_FEE_GAS_ERROR || n === u.TRANSACTION_TIMEOUT) {
58
+ const c = w(r);
59
+ if (c === g.MAX_FEE_GAS_ERROR || c === T.TRANSACTION_TIMEOUT) {
78
60
  console.log("Timeout Hit: Increase gas");
79
- const c = await m(
80
- o,
61
+ const i = await m(
62
+ e,
81
63
  1
82
64
  /* Secondary */
83
65
  );
84
- return await p({ contractFunction: i, args: t, gasPrice: c, gasLimit: e, nonce: a, confirmations: s });
66
+ return await u({ contractFunction: a, args: t, gasPrice: i, gasLimit: o, nonce: s, confirmations: n });
85
67
  }
86
68
  throw r;
87
69
  }
88
70
  };
89
71
  export {
90
- q as runContractFunction
72
+ I as runContractFunction
91
73
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("ethers");require("../../constants/token-data/index.cjs");const u=require("../../constants/chains.constants.cjs"),C=require("../../constants/protocol.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 p=require("../../error-handling/error-codes.constants.cjs"),P=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");const d=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");const h=require("../../error-handling/logError.cjs");require("../../constants/save-depths.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const l=async(s,t,c,r)=>{const o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await t.getPool(c,r,e),fee:e})))).filter(({poolAddress:e})=>e!==C.zeroAddress),n=await Promise.all(o.map(async e=>({poolAddress:e.poolAddress,fee:e.fee,token1Balance:(await s.balanceOf(e.poolAddress)).toBigInt()}))),a=n.map(e=>e.token1Balance).reduce((e,q)=>q>=e?q:e,0n);if(a===0n)throw new Error(p.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return n.find(e=>e.token1Balance===a)},w=async(s,t,c,r,o,n)=>{try{if(!u.networkRegistry[t].quoterV2Address)throw Error("No Quoter Contract Provided");return(await s.getContractWithFetcherByChainId(t,d.ContractType.UniswapV3QuoterContract,u.networkRegistry[t].quoterV2Address).callStatic.quoteExactInputSingle({tokenIn:c.wrappedErc20TokenAddress??c.erc20TokenAddress,tokenOut:r.wrappedErc20TokenAddress??r.erc20TokenAddress,fee:o,amountIn:n,sqrtPriceLimitX96:0})).amountOut.toBigInt()}catch(i){throw h.logError(i),i}},A=async(s,t,c,r)=>{try{const o=s.getContractWithFetcherByChainId(t,d.ContractType.UniswapV3FactoryContract,u.networkRegistry[t].uniswapV3FactoryAddress),n=s.getContractWithFetcherByChainId(t,d.ContractType.ERC20Contract,r.wrappedErc20TokenAddress??r.erc20TokenAddress),{fee:i}=await l(n,o,c.wrappedErc20TokenAddress??c.erc20TokenAddress,r.wrappedErc20TokenAddress??r.erc20TokenAddress);return i}catch(o){throw console.log("Error in getUniswapFee",o),o}},E=async(s,t,c,r,o)=>{try{const n=await A(s,t,r,o),i=g.utils.defaultAbiCoder.encode(["uint24"],[n]),a=P.getAmountInWei(r,c);return{tokenPrice:await w(s,t,r,o,n,a),poolFee:i}}catch{throw Error(p.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=A;exports.getUniswapPrice=E;exports.getUniswapPriceHelper=w;exports.searchPoolAndFee=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("ethers");require("../../constants/token-data/index.cjs");const d=require("../../constants/chains.constants.cjs"),C=require("../../constants/protocol.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 l=require("../../error-handling/error-codes.constants.cjs"),P=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");const u=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const h=require("../../error-handling/logError.cjs"),w=async(s,t,c,r)=>{const o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await t.getPool(c,r,e),fee:e})))).filter(({poolAddress:e})=>e!==C.zeroAddress),n=await Promise.all(o.map(async e=>({poolAddress:e.poolAddress,fee:e.fee,token1Balance:(await s.balanceOf(e.poolAddress)).toBigInt()}))),i=n.map(e=>e.token1Balance).reduce((e,p)=>p>=e?p:e,0n);if(i===0n)throw new Error(l.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return n.find(e=>e.token1Balance===i)},q=async(s,t,c,r,o,n)=>{try{if(!d.networkRegistry[t].quoterV2Address)throw Error("No Quoter Contract Provided");return(await s.getContractWithFetcherByChainId(t,u.ContractType.UniswapV3QuoterContract,d.networkRegistry[t].quoterV2Address).callStatic.quoteExactInputSingle({tokenIn:c.wrappedErc20TokenAddress??c.erc20TokenAddress,tokenOut:r.wrappedErc20TokenAddress??r.erc20TokenAddress,fee:o,amountIn:n,sqrtPriceLimitX96:0})).amountOut.toBigInt()}catch(a){throw h.logError(a),a}},A=async(s,t,c,r)=>{try{const o=s.getContractWithFetcherByChainId(t,u.ContractType.UniswapV3FactoryContract,d.networkRegistry[t].uniswapV3FactoryAddress),n=s.getContractWithFetcherByChainId(t,u.ContractType.ERC20Contract,r.wrappedErc20TokenAddress??r.erc20TokenAddress),{fee:a}=await w(n,o,c.wrappedErc20TokenAddress??c.erc20TokenAddress,r.wrappedErc20TokenAddress??r.erc20TokenAddress);return a}catch(o){throw console.log("Error in getUniswapFee",o),o}},E=async(s,t,c,r,o)=>{try{const n=await A(s,t,r,o),a=g.utils.defaultAbiCoder.encode(["uint24"],[n]),i=P.getAmountInWei(r,c);return{tokenPrice:await q(s,t,r,o,n,i),poolFee:a}}catch{throw Error(l.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=A;exports.getUniswapPrice=E;exports.getUniswapPriceHelper=q;exports.searchPoolAndFee=w;
@@ -17,26 +17,14 @@ import "../../constants/events.constants.mjs";
17
17
  import { transactionErrorCodes as l } from "../../error-handling/error-codes.constants.mjs";
18
18
  import { getAmountInWei as f } from "./etherFunctions.mjs";
19
19
  import "../../types/circom-data.types.mjs";
20
- import { ContractType as m } from "../../types/ethereum-network.types.mjs";
20
+ import { ContractType as d } from "../../types/ethereum-network.types.mjs";
21
21
  import "../../types/transactions.types.mjs";
22
22
  import "../../types/activities.types.mjs";
23
- import "../../API/getServerURL.mjs";
24
- import "../../data-structures/http/HttpClient.mjs";
25
- import "axios";
26
- import "circomlibjs-hinkal-fork";
27
- import "libsodium-wrappers";
28
- import "process";
29
- import "buffer";
30
23
  import { logError as y } from "../../error-handling/logError.mjs";
31
- import "../../constants/save-depths.mjs";
32
- import "../utils/mutexes.utils.mjs";
33
- import "@coral-xyz/anchor";
34
- import "@solana/web3.js";
35
- import "../../data-structures/crypto-keys/keys.mjs";
36
- const C = async (s, o, i, t) => {
24
+ const C = async (s, o, a, t) => {
37
25
  const e = (await Promise.all(
38
26
  [100, 500, 3e3, 1e4].map(async (r) => ({
39
- poolAddress: await o.getPool(i, t, r),
27
+ poolAddress: await o.getPool(a, t, r),
40
28
  fee: r
41
29
  }))
42
30
  )).filter(({ poolAddress: r }) => r !== u), n = await Promise.all(
@@ -45,66 +33,66 @@ const C = async (s, o, i, t) => {
45
33
  fee: r.fee,
46
34
  token1Balance: (await s.balanceOf(r.poolAddress)).toBigInt()
47
35
  }))
48
- ), c = n.map((r) => r.token1Balance).reduce((r, d) => d >= r ? d : r, 0n);
49
- if (c === 0n)
36
+ ), i = n.map((r) => r.token1Balance).reduce((r, m) => m >= r ? m : r, 0n);
37
+ if (i === 0n)
50
38
  throw new Error(l.UNISWAP_NOT_ENOUGH_LIQUIDITY);
51
- return n.find((r) => r.token1Balance === c);
52
- }, g = async (s, o, i, t, e, n) => {
39
+ return n.find((r) => r.token1Balance === i);
40
+ }, g = async (s, o, a, t, e, n) => {
53
41
  try {
54
42
  if (!p[o].quoterV2Address)
55
43
  throw Error("No Quoter Contract Provided");
56
44
  return (await s.getContractWithFetcherByChainId(
57
45
  o,
58
- m.UniswapV3QuoterContract,
46
+ d.UniswapV3QuoterContract,
59
47
  p[o].quoterV2Address
60
48
  ).callStatic.quoteExactInputSingle({
61
- tokenIn: i.wrappedErc20TokenAddress ?? i.erc20TokenAddress,
49
+ tokenIn: a.wrappedErc20TokenAddress ?? a.erc20TokenAddress,
62
50
  tokenOut: t.wrappedErc20TokenAddress ?? t.erc20TokenAddress,
63
51
  fee: e,
64
52
  amountIn: n,
65
53
  sqrtPriceLimitX96: 0
66
54
  })).amountOut.toBigInt();
67
- } catch (a) {
68
- throw y(a), a;
55
+ } catch (c) {
56
+ throw y(c), c;
69
57
  }
70
- }, E = async (s, o, i, t) => {
58
+ }, E = async (s, o, a, t) => {
71
59
  try {
72
60
  const e = s.getContractWithFetcherByChainId(
73
61
  o,
74
- m.UniswapV3FactoryContract,
62
+ d.UniswapV3FactoryContract,
75
63
  p[o].uniswapV3FactoryAddress
76
64
  ), n = s.getContractWithFetcherByChainId(
77
65
  o,
78
- m.ERC20Contract,
66
+ d.ERC20Contract,
79
67
  t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
80
- ), { fee: a } = await C(
68
+ ), { fee: c } = await C(
81
69
  n,
82
70
  e,
83
- i.wrappedErc20TokenAddress ?? i.erc20TokenAddress,
71
+ a.wrappedErc20TokenAddress ?? a.erc20TokenAddress,
84
72
  t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
85
73
  );
86
- return a;
74
+ return c;
87
75
  } catch (e) {
88
76
  throw console.log("Error in getUniswapFee", e), e;
89
77
  }
90
- }, or = async (s, o, i, t, e) => {
78
+ }, G = async (s, o, a, t, e) => {
91
79
  try {
92
- const n = await E(s, o, t, e), a = A.defaultAbiCoder.encode(["uint24"], [n]), c = f(t, i);
80
+ const n = await E(s, o, t, e), c = A.defaultAbiCoder.encode(["uint24"], [n]), i = f(t, a);
93
81
  return { tokenPrice: await g(
94
82
  s,
95
83
  o,
96
84
  t,
97
85
  e,
98
86
  n,
99
- c
100
- ), poolFee: a };
87
+ i
88
+ ), poolFee: c };
101
89
  } catch {
102
90
  throw Error(l.NO_UNISWAP_PRICE);
103
91
  }
104
92
  };
105
93
  export {
106
94
  E as getUniswapFee,
107
- or as getUniswapPrice,
95
+ G as getUniswapPrice,
108
96
  g as getUniswapPriceHelper,
109
97
  C as searchPoolAndFee
110
98
  };