@hinkal/common 0.2.12 → 0.2.14

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 (574) hide show
  1. package/API/API.cjs +1 -1
  2. package/API/API.d.ts +9 -3
  3. package/API/API.mjs +44 -34
  4. package/API/ai-calls.cjs +1 -0
  5. package/API/ai-calls.d.ts +9 -0
  6. package/API/ai-calls.mjs +13 -0
  7. package/API/callCurveAPI.cjs +1 -1
  8. package/API/callCurveAPI.mjs +28 -22
  9. package/API/callRelayer.d.ts +3 -2
  10. package/API/dataServerCalls.cjs +1 -1
  11. package/API/dataServerCalls.d.ts +4 -0
  12. package/API/dataServerCalls.mjs +11 -7
  13. package/API/duneAPI.cjs +1 -1
  14. package/API/duneAPI.mjs +6 -4
  15. package/API/fetchCommitmentsCache.cjs +1 -1
  16. package/API/fetchCommitmentsCache.d.ts +9 -1
  17. package/API/fetchCommitmentsCache.mjs +6 -5
  18. package/API/getGasEstimates.cjs +1 -1
  19. package/API/getGasEstimates.d.ts +2 -1
  20. package/API/getGasEstimates.mjs +10 -9
  21. package/API/getServerURL.d.ts +1 -1
  22. package/API/index.d.ts +2 -0
  23. package/API/is-tx-stateless.cjs +1 -0
  24. package/API/is-tx-stateless.d.ts +3 -0
  25. package/API/is-tx-stateless.mjs +9 -0
  26. package/API/kycCalls.cjs +1 -1
  27. package/API/kycCalls.d.ts +0 -4
  28. package/API/kycCalls.mjs +11 -15
  29. package/API/rewardsPointsCalls.d.ts +0 -3
  30. package/API/tenderly.api.cjs +1 -0
  31. package/API/tenderly.api.d.ts +12 -0
  32. package/API/tenderly.api.mjs +47 -0
  33. package/API/token-calls.cjs +1 -0
  34. package/API/token-calls.d.ts +2 -0
  35. package/API/token-calls.mjs +9 -0
  36. package/README.md +0 -61
  37. package/constants/addresses.constants.cjs +1 -0
  38. package/constants/addresses.constants.d.ts +16 -0
  39. package/constants/addresses.constants.mjs +50 -0
  40. package/constants/assets.constants.cjs +1 -1
  41. package/constants/assets.constants.mjs +13 -13
  42. package/constants/axelar.constants.cjs +1 -1
  43. package/constants/axelar.constants.mjs +5 -5
  44. package/constants/balance.constants.cjs +1 -0
  45. package/constants/balance.constants.d.ts +1 -0
  46. package/constants/balance.constants.mjs +4 -0
  47. package/constants/chains.constants.cjs +1 -1
  48. package/constants/chains.constants.d.ts +0 -2
  49. package/constants/chains.constants.mjs +26 -38
  50. package/constants/contracts.constants.cjs +1 -1
  51. package/constants/contracts.constants.mjs +108 -108
  52. package/constants/conversion.constants.cjs +1 -0
  53. package/constants/conversion.constants.d.ts +1 -0
  54. package/constants/conversion.constants.mjs +4 -0
  55. package/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
  56. package/constants/deploy-data/deploy-data-localhost.json.mjs +1652 -829
  57. package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
  58. package/constants/deploy-data/deploy-data-optimism.json.mjs +9707 -3957
  59. package/constants/fees.constants.cjs +1 -1
  60. package/constants/fees.constants.d.ts +5 -3
  61. package/constants/fees.constants.mjs +22 -19
  62. package/constants/index.d.ts +6 -0
  63. package/constants/mediaUrls.constants.cjs +1 -0
  64. package/constants/mediaUrls.constants.d.ts +23 -0
  65. package/constants/mediaUrls.constants.mjs +26 -0
  66. package/constants/permit2.constants.cjs +1 -0
  67. package/constants/permit2.constants.d.ts +2 -0
  68. package/constants/permit2.constants.mjs +5 -0
  69. package/constants/protocol.constants.cjs +1 -1
  70. package/constants/protocol.constants.d.ts +6 -0
  71. package/constants/protocol.constants.mjs +27 -15
  72. package/constants/rewards.constants.cjs +1 -1
  73. package/constants/rewards.constants.d.ts +0 -1
  74. package/constants/rewards.constants.mjs +14 -13
  75. package/constants/server.constants.cjs +1 -1
  76. package/constants/server.constants.d.ts +8 -3
  77. package/constants/server.constants.mjs +16 -11
  78. package/constants/token-data/ERC20Registry.cjs +1 -1
  79. package/constants/token-data/ERC20Registry.mjs +10 -9
  80. package/constants/token-data/arbMainnetRegistry.json.cjs +1 -1
  81. package/constants/token-data/arbMainnetRegistry.json.mjs +88 -88
  82. package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
  83. package/constants/token-data/arbMainnetRegistryFixed.json.mjs +78 -78
  84. package/constants/token-data/avalancheRegistry.json.cjs +1 -1
  85. package/constants/token-data/avalancheRegistry.json.mjs +49 -49
  86. package/constants/token-data/avalancheRegistryFixed.json.cjs +1 -1
  87. package/constants/token-data/avalancheRegistryFixed.json.mjs +49 -49
  88. package/constants/token-data/baseRegistry.json.cjs +1 -1
  89. package/constants/token-data/baseRegistry.json.mjs +32 -32
  90. package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
  91. package/constants/token-data/baseRegistryFixed.json.mjs +29 -29
  92. package/constants/token-data/bnbMainnetRegistry.json.cjs +1 -1
  93. package/constants/token-data/bnbMainnetRegistry.json.mjs +65 -65
  94. package/constants/token-data/bnbMainnetRegistryFixed.json.cjs +1 -1
  95. package/constants/token-data/bnbMainnetRegistryFixed.json.mjs +65 -65
  96. package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
  97. package/constants/token-data/ethMainnetRegistry.json.mjs +227 -227
  98. package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
  99. package/constants/token-data/ethMainnetRegistryFixed.json.mjs +191 -191
  100. package/constants/token-data/index.d.ts +91 -0
  101. package/constants/token-data/localhostRegistry.json.cjs +1 -1
  102. package/constants/token-data/localhostRegistry.json.mjs +294 -277
  103. package/constants/token-data/optimismRegistry.json.cjs +1 -1
  104. package/constants/token-data/optimismRegistry.json.mjs +702 -182
  105. package/constants/token-data/optimismRegistryFixed.json.cjs +1 -1
  106. package/constants/token-data/optimismRegistryFixed.json.mjs +678 -175
  107. package/constants/token-data/polygonRegistry.json.cjs +1 -1
  108. package/constants/token-data/polygonRegistry.json.mjs +109 -109
  109. package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
  110. package/constants/token-data/polygonRegistryFixed.json.mjs +101 -101
  111. package/constants/token.limits.constants.cjs +1 -0
  112. package/constants/token.limits.constants.d.ts +5 -0
  113. package/constants/token.limits.constants.mjs +30 -0
  114. package/constants/vite.constants.cjs +1 -1
  115. package/constants/vite.constants.d.ts +5 -0
  116. package/constants/vite.constants.mjs +26 -22
  117. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  118. package/data-structures/Hinkal/Hinkal.d.ts +46 -21
  119. package/data-structures/Hinkal/Hinkal.mjs +260 -92
  120. package/data-structures/Hinkal/IHinkal.d.ts +35 -11
  121. package/data-structures/Hinkal/hinkalActionBeefy.cjs +1 -1
  122. package/data-structures/Hinkal/hinkalActionBeefy.mjs +5 -4
  123. package/data-structures/Hinkal/hinkalActionConvex.cjs +1 -1
  124. package/data-structures/Hinkal/hinkalActionConvex.mjs +4 -3
  125. package/data-structures/Hinkal/hinkalActionCurve.cjs +1 -1
  126. package/data-structures/Hinkal/hinkalActionCurve.mjs +5 -4
  127. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
  128. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +3 -0
  129. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +61 -0
  130. package/data-structures/Hinkal/hinkalActionLidoEth.cjs +1 -1
  131. package/data-structures/Hinkal/hinkalActionLidoEth.mjs +9 -8
  132. package/data-structures/Hinkal/hinkalActionPendle.cjs +1 -1
  133. package/data-structures/Hinkal/hinkalActionPendle.mjs +17 -16
  134. package/data-structures/Hinkal/hinkalActionPendleLP.cjs +1 -1
  135. package/data-structures/Hinkal/hinkalActionPendleLP.mjs +14 -12
  136. package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -0
  137. package/data-structures/Hinkal/hinkalActionReceive.d.ts +4 -0
  138. package/data-structures/Hinkal/hinkalActionReceive.mjs +39 -0
  139. package/data-structures/Hinkal/hinkalActionStake.cjs +1 -1
  140. package/data-structures/Hinkal/hinkalActionStake.mjs +12 -9
  141. package/data-structures/Hinkal/hinkalActionVolatile.cjs +1 -1
  142. package/data-structures/Hinkal/hinkalActionVolatile.mjs +25 -21
  143. package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
  144. package/data-structures/Hinkal/hinkalApprove.d.ts +2 -0
  145. package/data-structures/Hinkal/hinkalApprove.mjs +120 -0
  146. package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -0
  147. package/data-structures/Hinkal/hinkalCheckTokenRegistry.d.ts +3 -0
  148. package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +12 -0
  149. package/data-structures/Hinkal/hinkalDeploySubAccount.cjs +1 -0
  150. package/data-structures/Hinkal/hinkalDeploySubAccount.d.ts +3 -0
  151. package/data-structures/Hinkal/hinkalDeploySubAccount.mjs +15 -0
  152. package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  153. package/data-structures/Hinkal/hinkalDeposit.d.ts +3 -2
  154. package/data-structures/Hinkal/hinkalDeposit.mjs +96 -71
  155. package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -1
  156. package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +1 -1
  157. package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +5 -11
  158. package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
  159. package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +6 -18
  160. package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
  161. package/data-structures/Hinkal/hinkalInsideTransact.d.ts +2 -0
  162. package/data-structures/Hinkal/hinkalInsideTransact.mjs +111 -0
  163. package/data-structures/Hinkal/hinkalMultiSend.cjs +1 -0
  164. package/data-structures/Hinkal/hinkalMultiSend.d.ts +3 -0
  165. package/data-structures/Hinkal/hinkalMultiSend.mjs +13 -0
  166. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  167. package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -1
  168. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +83 -38
  169. package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -0
  170. package/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +4 -0
  171. package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +46 -0
  172. package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -0
  173. package/data-structures/Hinkal/hinkalProxySwap.d.ts +5 -0
  174. package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -0
  175. package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -0
  176. package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +3 -0
  177. package/data-structures/Hinkal/hinkalSignSubAccount.mjs +20 -0
  178. package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  179. package/data-structures/Hinkal/hinkalSwap.d.ts +2 -1
  180. package/data-structures/Hinkal/hinkalSwap.mjs +68 -60
  181. package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  182. package/data-structures/Hinkal/hinkalWithdraw.d.ts +3 -1
  183. package/data-structures/Hinkal/hinkalWithdraw.mjs +76 -50
  184. package/data-structures/Hinkal/index.d.ts +1 -0
  185. package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  186. package/data-structures/Hinkal/resetMerkleTrees.mjs +18 -11
  187. package/data-structures/IndexedDB/activity-db.cjs +1 -0
  188. package/data-structures/IndexedDB/activity-db.d.ts +16 -0
  189. package/data-structures/IndexedDB/activity-db.mjs +124 -0
  190. package/data-structures/IndexedDB/balances-db.cjs +1 -0
  191. package/data-structures/IndexedDB/balances-db.d.ts +13 -0
  192. package/data-structures/IndexedDB/balances-db.mjs +75 -0
  193. package/data-structures/IndexedDB/contact-db.cjs +1 -0
  194. package/data-structures/IndexedDB/contact-db.d.ts +11 -0
  195. package/data-structures/IndexedDB/contact-db.mjs +44 -0
  196. package/data-structures/IndexedDB/index.d.ts +5 -0
  197. package/data-structures/IndexedDB/prices-db.cjs +1 -0
  198. package/data-structures/IndexedDB/prices-db.d.ts +9 -0
  199. package/data-structures/IndexedDB/prices-db.mjs +62 -0
  200. package/data-structures/IndexedDB/private-balances-db.cjs +1 -0
  201. package/data-structures/IndexedDB/private-balances-db.d.ts +9 -0
  202. package/data-structures/IndexedDB/private-balances-db.mjs +28 -0
  203. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
  204. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +47 -44
  205. package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -0
  206. package/data-structures/TokenDBs/PrivateTokensDB.d.ts +11 -0
  207. package/data-structures/TokenDBs/PrivateTokensDB.mjs +53 -0
  208. package/data-structures/TokenDBs/PublicTokensDB.cjs +1 -0
  209. package/data-structures/TokenDBs/PublicTokensDB.d.ts +13 -0
  210. package/data-structures/TokenDBs/PublicTokensDB.mjs +81 -0
  211. package/data-structures/TokenDBs/index.d.ts +2 -0
  212. package/data-structures/cacheDevices/AttachableMemoryCacheDevice.cjs +1 -0
  213. package/data-structures/cacheDevices/AttachableMemoryCacheDevice.d.ts +8 -0
  214. package/data-structures/cacheDevices/AttachableMemoryCacheDevice.mjs +28 -0
  215. package/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
  216. package/data-structures/cacheDevices/BaseCacheDevice.d.ts +9 -6
  217. package/data-structures/cacheDevices/BaseCacheDevice.mjs +13 -4
  218. package/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
  219. package/data-structures/cacheDevices/FileCacheDevice.d.ts +1 -0
  220. package/data-structures/cacheDevices/FileCacheDevice.mjs +7 -3
  221. package/data-structures/cacheDevices/LocalStorageCacheDevice.cjs +1 -1
  222. package/data-structures/cacheDevices/LocalStorageCacheDevice.d.ts +2 -1
  223. package/data-structures/cacheDevices/LocalStorageCacheDevice.mjs +10 -5
  224. package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
  225. package/data-structures/crypto-keys/decodeUTXO.mjs +13 -12
  226. package/data-structures/crypto-keys/keys.cjs +1 -1
  227. package/data-structures/crypto-keys/keys.d.ts +13 -3
  228. package/data-structures/crypto-keys/keys.mjs +45 -34
  229. package/data-structures/custom-token-registry/CustomTokenRegistry.cjs +1 -1
  230. package/data-structures/custom-token-registry/CustomTokenRegistry.d.ts +2 -3
  231. package/data-structures/custom-token-registry/CustomTokenRegistry.mjs +17 -21
  232. package/data-structures/event-service/AbstractAccessTokenSnapshotService.cjs +1 -1
  233. package/data-structures/event-service/AbstractAccessTokenSnapshotService.mjs +15 -29
  234. package/data-structures/event-service/AbstractApprovalsSnapshotService.cjs +1 -0
  235. package/data-structures/event-service/AbstractApprovalsSnapshotService.d.ts +30 -0
  236. package/data-structures/event-service/AbstractApprovalsSnapshotService.mjs +104 -0
  237. package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +1 -1
  238. package/data-structures/event-service/AbstractCommitmentsSnapshotService.mjs +24 -37
  239. package/data-structures/event-service/AbstractEventService.cjs +1 -1
  240. package/data-structures/event-service/AbstractEventService.d.ts +1 -1
  241. package/data-structures/event-service/AbstractEventService.mjs +34 -46
  242. package/data-structures/event-service/index.d.ts +1 -0
  243. package/data-structures/index.d.ts +2 -0
  244. package/data-structures/merkle-tree/MerkleTree.cjs +1 -1
  245. package/data-structures/merkle-tree/MerkleTree.d.ts +4 -1
  246. package/data-structures/merkle-tree/MerkleTree.mjs +66 -65
  247. package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs +1 -1
  248. package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.ts +1 -1
  249. package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs +10 -6
  250. package/data-structures/provider-adapter/IProviderAdapter.d.ts +2 -0
  251. package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
  252. package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +6 -10
  253. package/data-structures/snapshot/ClientApprovalsSnapshotService.cjs +1 -0
  254. package/data-structures/snapshot/ClientApprovalsSnapshotService.d.ts +8 -0
  255. package/data-structures/snapshot/ClientApprovalsSnapshotService.mjs +23 -0
  256. package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +1 -1
  257. package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +6 -10
  258. package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
  259. package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +6 -10
  260. package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
  261. package/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -0
  262. package/data-structures/token-price-fetcher/TokenChecker.mjs +4 -2
  263. package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
  264. package/data-structures/transactions-manager/TransactionsManager.d.ts +6 -5
  265. package/data-structures/transactions-manager/TransactionsManager.mjs +95 -100
  266. package/data-structures/transactions-manager/history/getBeefyData.cjs +1 -1
  267. package/data-structures/transactions-manager/history/getBeefyData.mjs +3 -2
  268. package/data-structures/transactions-manager/history/getConvexData.cjs +1 -1
  269. package/data-structures/transactions-manager/history/getConvexData.mjs +3 -2
  270. package/data-structures/transactions-manager/history/getCurveData.cjs +1 -1
  271. package/data-structures/transactions-manager/history/getCurveData.mjs +3 -2
  272. package/data-structures/transactions-manager/history/getLidoData.cjs +1 -1
  273. package/data-structures/transactions-manager/history/getLidoData.mjs +3 -2
  274. package/data-structures/transactions-manager/history/getPendleData.cjs +1 -1
  275. package/data-structures/transactions-manager/history/getPendleData.mjs +13 -12
  276. package/data-structures/transactions-manager/history/getTxDetails.cjs +1 -1
  277. package/data-structures/transactions-manager/history/getTxDetails.mjs +22 -20
  278. package/data-structures/transactions-manager/history/getVolatileData.cjs +1 -1
  279. package/data-structures/transactions-manager/history/getVolatileData.mjs +11 -10
  280. package/data-structures/transactions-manager/history/history.types.cjs +1 -1
  281. package/data-structures/transactions-manager/history/history.types.mjs +4 -2
  282. package/data-structures/utxo/Utxo.cjs +1 -1
  283. package/data-structures/utxo/Utxo.d.ts +3 -3
  284. package/data-structures/utxo/Utxo.mjs +8 -7
  285. package/error-handling/error-codes.constants.cjs +2 -2
  286. package/error-handling/error-codes.constants.d.ts +20 -3
  287. package/error-handling/error-codes.constants.mjs +139 -126
  288. package/error-handling/get-error.message.cjs +1 -1
  289. package/error-handling/get-error.message.mjs +29 -25
  290. package/error-handling/index.d.ts +1 -0
  291. package/error-handling/logger.cjs +1 -0
  292. package/error-handling/logger.d.ts +5 -0
  293. package/error-handling/logger.mjs +16 -0
  294. package/error-handling/types.cjs +1 -1
  295. package/error-handling/types.d.ts +3 -1
  296. package/error-handling/types.mjs +2 -2
  297. package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -0
  298. package/functions/pre-transaction/getExternalSwapAddress.d.ts +3 -0
  299. package/functions/pre-transaction/getExternalSwapAddress.mjs +26 -0
  300. package/functions/pre-transaction/getFeeStructure.cjs +1 -0
  301. package/functions/pre-transaction/getFeeStructure.d.ts +4 -0
  302. package/functions/pre-transaction/getFeeStructure.mjs +30 -0
  303. package/functions/pre-transaction/getFlatFees.cjs +1 -1
  304. package/functions/pre-transaction/getFlatFees.d.ts +3 -7
  305. package/functions/pre-transaction/getFlatFees.mjs +52 -46
  306. package/functions/pre-transaction/getSignatureDataForTransact.cjs +1 -0
  307. package/functions/pre-transaction/getSignatureDataForTransact.d.ts +3 -0
  308. package/functions/pre-transaction/getSignatureDataForTransact.mjs +6 -0
  309. package/functions/pre-transaction/index.d.ts +1 -0
  310. package/functions/pre-transaction/interaction-to-action.cjs +1 -1
  311. package/functions/pre-transaction/interaction-to-action.mjs +3 -2
  312. package/functions/pre-transaction/merge-with-fee-structure.cjs +1 -0
  313. package/functions/pre-transaction/merge-with-fee-structure.d.ts +2 -0
  314. package/functions/pre-transaction/merge-with-fee-structure.mjs +25 -0
  315. package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -0
  316. package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +16 -0
  317. package/functions/pre-transaction/outputApprovalDataProcessing.mjs +42 -0
  318. package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
  319. package/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
  320. package/functions/pre-transaction/outputUtxoProcessing.mjs +19 -30
  321. package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
  322. package/functions/pre-transaction/process-gas-estimates.d.ts +2 -2
  323. package/functions/pre-transaction/process-gas-estimates.mjs +17 -28
  324. package/functions/pre-transaction/processAmountChanges.cjs +1 -1
  325. package/functions/pre-transaction/processAmountChanges.mjs +34 -23
  326. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -0
  327. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +6 -0
  328. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +7 -0
  329. package/functions/private-wallet/emporium.helpers.cjs +1 -1
  330. package/functions/private-wallet/emporium.helpers.d.ts +17 -4
  331. package/functions/private-wallet/emporium.helpers.mjs +119 -12
  332. package/functions/private-wallet/emporium.swap.helpers.cjs +1 -0
  333. package/functions/private-wallet/emporium.swap.helpers.d.ts +5 -0
  334. package/functions/private-wallet/emporium.swap.helpers.mjs +92 -0
  335. package/functions/private-wallet/index.d.ts +2 -0
  336. package/functions/private-wallet/opProducer.cjs +1 -1
  337. package/functions/private-wallet/opProducer.mjs +1 -1
  338. package/functions/private-wallet/smartContractWalletCalculator.cjs +1 -0
  339. package/functions/private-wallet/smartContractWalletCalculator.d.ts +5 -0
  340. package/functions/private-wallet/smartContractWalletCalculator.mjs +25 -0
  341. package/functions/protocols/convex.protocols.cjs +1 -1
  342. package/functions/protocols/convex.protocols.mjs +10 -8
  343. package/functions/protocols/pendle.helpers.cjs +1 -1
  344. package/functions/protocols/pendle.helpers.mjs +16 -12
  345. package/functions/snarkjs/common.snarkjs.cjs +1 -1
  346. package/functions/snarkjs/common.snarkjs.d.ts +8 -5
  347. package/functions/snarkjs/common.snarkjs.mjs +177 -87
  348. package/functions/snarkjs/constant.cjs +1 -1
  349. package/functions/snarkjs/constant.d.ts +223 -2
  350. package/functions/snarkjs/constant.mjs +313 -93
  351. package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
  352. package/functions/snarkjs/constructEmporiumProof.d.ts +6 -3
  353. package/functions/snarkjs/constructEmporiumProof.mjs +148 -84
  354. package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
  355. package/functions/snarkjs/constructGeneralZkProof.d.ts +5 -3
  356. package/functions/snarkjs/constructGeneralZkProof.mjs +141 -86
  357. package/functions/snarkjs/generateCircomData.cjs +1 -1
  358. package/functions/snarkjs/generateCircomData.d.ts +3 -2
  359. package/functions/snarkjs/generateCircomData.mjs +33 -35
  360. package/functions/snarkjs/generateZkProof.cjs +1 -1
  361. package/functions/snarkjs/generateZkProof.d.ts +2 -2
  362. package/functions/snarkjs/generateZkProof.mjs +4 -4
  363. package/functions/snarkjs/generateZkProofEnclave.cjs +1 -1
  364. package/functions/snarkjs/generateZkProofEnclave.d.ts +2 -1
  365. package/functions/snarkjs/generateZkProofEnclave.mjs +22 -29
  366. package/functions/snarkjs/generateZkProofSelf.cjs +1 -1
  367. package/functions/snarkjs/generateZkProofSelf.d.ts +2 -2
  368. package/functions/snarkjs/generateZkProofSelf.mjs +10 -10
  369. package/functions/snarkjs/getOriginalSender.cjs +1 -0
  370. package/functions/snarkjs/getOriginalSender.d.ts +1 -0
  371. package/functions/snarkjs/getOriginalSender.mjs +5 -0
  372. package/functions/snarkjs/getZKFiles.cjs +1 -1
  373. package/functions/snarkjs/getZKFiles.d.ts +3 -2
  374. package/functions/snarkjs/getZKFiles.mjs +14 -5
  375. package/functions/utils/addresses.cjs +1 -0
  376. package/functions/utils/addresses.d.ts +4 -0
  377. package/functions/utils/addresses.mjs +20 -0
  378. package/functions/utils/amounts.utils.cjs +1 -1
  379. package/functions/utils/amounts.utils.d.ts +4 -1
  380. package/functions/utils/amounts.utils.mjs +29 -27
  381. package/functions/utils/arraysMatch.cjs +1 -0
  382. package/functions/utils/arraysMatch.d.ts +1 -0
  383. package/functions/utils/arraysMatch.mjs +4 -0
  384. package/functions/utils/axelar.utils.cjs +1 -1
  385. package/functions/utils/axelar.utils.d.ts +1 -0
  386. package/functions/utils/axelar.utils.mjs +31 -9
  387. package/functions/utils/cacheDevice.utils.cjs +1 -1
  388. package/functions/utils/cacheDevice.utils.mjs +5 -3
  389. package/functions/utils/cacheFunctions.cjs +1 -1
  390. package/functions/utils/cacheFunctions.d.ts +10 -7
  391. package/functions/utils/cacheFunctions.mjs +62 -39
  392. package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -0
  393. package/functions/utils/convertEmporiumOpToCallInfo.d.ts +2 -0
  394. package/functions/utils/convertEmporiumOpToCallInfo.mjs +10 -0
  395. package/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
  396. package/functions/utils/convertIntegrationProviderToExternalActionId.d.ts +2 -1
  397. package/functions/utils/convertIntegrationProviderToExternalActionId.mjs +7 -10
  398. package/functions/utils/encodeTokenWithId.cjs +1 -0
  399. package/functions/utils/encodeTokenWithId.d.ts +2 -0
  400. package/functions/utils/encodeTokenWithId.mjs +4 -0
  401. package/functions/utils/encryptInputForEnclave.cjs +1 -0
  402. package/functions/utils/encryptInputForEnclave.d.ts +8 -0
  403. package/functions/utils/encryptInputForEnclave.mjs +43 -0
  404. package/functions/utils/erc20tokenFunctions.cjs +1 -1
  405. package/functions/utils/erc20tokenFunctions.d.ts +8 -2
  406. package/functions/utils/erc20tokenFunctions.mjs +22 -14
  407. package/functions/utils/evmNetworkFunctions.cjs +1 -1
  408. package/functions/utils/evmNetworkFunctions.mjs +6 -4
  409. package/functions/utils/external-action.utils.d.ts +2 -2
  410. package/functions/utils/fees.utils.cjs +1 -0
  411. package/functions/utils/fees.utils.d.ts +2 -0
  412. package/functions/utils/fees.utils.mjs +14 -0
  413. package/functions/utils/getBlockExplorerUrl.cjs +1 -0
  414. package/functions/utils/getBlockExplorerUrl.d.ts +1 -0
  415. package/functions/utils/getBlockExplorerUrl.mjs +6 -0
  416. package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -0
  417. package/functions/utils/getRecipientInfoFromUserKeys.d.ts +3 -0
  418. package/functions/utils/getRecipientInfoFromUserKeys.mjs +18 -0
  419. package/functions/utils/index.d.ts +12 -0
  420. package/functions/utils/involves-permit2-op.cjs +1 -0
  421. package/functions/utils/involves-permit2-op.d.ts +1 -0
  422. package/functions/utils/involves-permit2-op.mjs +5 -0
  423. package/functions/utils/merkleTree.utils.cjs +1 -0
  424. package/functions/utils/merkleTree.utils.d.ts +2 -0
  425. package/functions/utils/merkleTree.utils.mjs +19 -0
  426. package/functions/utils/prepareHinkal.d.ts +6 -0
  427. package/functions/utils/processUseApprovalUtxoData.cjs +1 -0
  428. package/functions/utils/processUseApprovalUtxoData.d.ts +3 -0
  429. package/functions/utils/processUseApprovalUtxoData.mjs +19 -0
  430. package/functions/utils/publicBalance.utils.cjs +1 -0
  431. package/functions/utils/publicBalance.utils.d.ts +5 -0
  432. package/functions/utils/publicBalance.utils.mjs +25 -0
  433. package/functions/utils/replaceAddressInCalldata.cjs +1 -0
  434. package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
  435. package/functions/utils/replaceAddressInCalldata.mjs +7 -0
  436. package/functions/utils/rpc-int-encode.cjs +1 -0
  437. package/functions/utils/rpc-int-encode.d.ts +2 -0
  438. package/functions/utils/rpc-int-encode.mjs +8 -0
  439. package/functions/utils/serialize.utils.cjs +1 -1
  440. package/functions/utils/serialize.utils.d.ts +1 -0
  441. package/functions/utils/serialize.utils.mjs +3 -2
  442. package/functions/utils/string.utils.cjs +1 -1
  443. package/functions/utils/string.utils.d.ts +3 -0
  444. package/functions/utils/string.utils.mjs +31 -7
  445. package/functions/utils/time.utils.cjs +1 -1
  446. package/functions/utils/time.utils.d.ts +1 -0
  447. package/functions/utils/time.utils.mjs +4 -3
  448. package/functions/utils/token-check.utils.cjs +1 -0
  449. package/functions/utils/token-check.utils.d.ts +1 -0
  450. package/functions/utils/token-check.utils.mjs +10 -0
  451. package/functions/utils/upToDateState.cjs +1 -0
  452. package/functions/utils/upToDateState.d.ts +2 -0
  453. package/functions/utils/upToDateState.mjs +11 -0
  454. package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -0
  455. package/functions/web3/events/balanceChangedCustomHandler.d.ts +2 -0
  456. package/functions/web3/events/balanceChangedCustomHandler.mjs +14 -0
  457. package/functions/web3/events/balanceChangedHandler.cjs +1 -1
  458. package/functions/web3/events/balanceChangedHandler.mjs +5 -4
  459. package/functions/web3/events/getApprovedBalance.cjs +1 -0
  460. package/functions/web3/events/getApprovedBalance.d.ts +7 -0
  461. package/functions/web3/events/getApprovedBalance.mjs +80 -0
  462. package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  463. package/functions/web3/events/getInputUtxoAndBalance.d.ts +16 -3
  464. package/functions/web3/events/getInputUtxoAndBalance.mjs +128 -46
  465. package/functions/web3/events/getShieldedBalance.cjs +2 -2
  466. package/functions/web3/events/getShieldedBalance.d.ts +1 -1
  467. package/functions/web3/events/getShieldedBalance.mjs +79 -82
  468. package/functions/web3/events/index.d.ts +2 -0
  469. package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
  470. package/functions/web3/functionCalls/accessTokenCalls.d.ts +2 -2
  471. package/functions/web3/functionCalls/accessTokenCalls.mjs +19 -17
  472. package/functions/web3/functionCalls/approveToken.cjs +1 -1
  473. package/functions/web3/functionCalls/approveToken.mjs +8 -7
  474. package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -0
  475. package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +4 -0
  476. package/functions/web3/functionCalls/approveTokensToHinkal.mjs +11 -0
  477. package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
  478. package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -2
  479. package/functions/web3/functionCalls/estimateGasRelayer.mjs +14 -8
  480. package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
  481. package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
  482. package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +32 -0
  483. package/functions/web3/functionCalls/relayFunctions.d.ts +1 -15
  484. package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
  485. package/functions/web3/functionCalls/transactCallDirect.d.ts +2 -2
  486. package/functions/web3/functionCalls/transactCallDirect.mjs +29 -42
  487. package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  488. package/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
  489. package/functions/web3/functionCalls/transactCallRelayer.mjs +26 -5
  490. package/functions/web3/odosAPI.cjs +1 -1
  491. package/functions/web3/odosAPI.mjs +6 -3
  492. package/functions/web3/oneInchAPI.cjs +1 -1
  493. package/functions/web3/oneInchAPI.mjs +6 -3
  494. package/functions/web3/runContractFunction.cjs +1 -1
  495. package/functions/web3/runContractFunction.mjs +3 -2
  496. package/functions/web3/uniswapAPI.cjs +1 -1
  497. package/functions/web3/uniswapAPI.mjs +6 -3
  498. package/index.cjs +1 -1
  499. package/index.mjs +756 -612
  500. package/package.json +6 -2
  501. package/providers/EthersProviderAdapter.cjs +1 -1
  502. package/providers/EthersProviderAdapter.d.ts +7 -3
  503. package/providers/EthersProviderAdapter.mjs +31 -11
  504. package/providers/WagmiProviderAdapter.cjs +1 -1
  505. package/providers/WagmiProviderAdapter.d.ts +3 -1
  506. package/providers/WagmiProviderAdapter.mjs +12 -4
  507. package/providers/prepareEthersHinkal.cjs +1 -1
  508. package/providers/prepareEthersHinkal.mjs +17 -11
  509. package/providers/prepareWagmiHinkal.cjs +1 -1
  510. package/providers/prepareWagmiHinkal.mjs +17 -11
  511. package/types/API.types.d.ts +21 -0
  512. package/types/ICacheDevice.d.ts +4 -3
  513. package/types/TransactionSimulator.types.d.ts +9 -0
  514. package/types/activities.types.cjs +1 -0
  515. package/types/activities.types.d.ts +45 -0
  516. package/types/activities.types.mjs +13 -0
  517. package/types/balances.types.cjs +1 -0
  518. package/types/balances.types.d.ts +17 -0
  519. package/types/balances.types.mjs +4 -0
  520. package/types/cache.types.cjs +1 -0
  521. package/types/cache.types.d.ts +27 -0
  522. package/types/cache.types.mjs +4 -0
  523. package/types/circom-data.types.d.ts +29 -9
  524. package/types/commitments.types.d.ts +6 -0
  525. package/types/contacts.types.d.ts +5 -0
  526. package/types/crypto.types.d.ts +1 -0
  527. package/types/earlyAccessCode.types.d.ts +4 -0
  528. package/types/ethereum-network.types.cjs +1 -1
  529. package/types/ethereum-network.types.d.ts +66 -62
  530. package/types/ethereum-network.types.mjs +1 -1
  531. package/types/external-action.types.cjs +1 -1
  532. package/types/external-action.types.d.ts +2 -1
  533. package/types/external-action.types.mjs +1 -1
  534. package/types/fee.types.d.ts +9 -0
  535. package/types/hinkal.types.cjs +1 -1
  536. package/types/hinkal.types.d.ts +43 -5
  537. package/types/hinkal.types.mjs +37 -13
  538. package/types/index.d.ts +9 -0
  539. package/types/rewards.types.cjs +1 -1
  540. package/types/rewards.types.d.ts +3 -4
  541. package/types/rewards.types.mjs +12 -12
  542. package/types/sandbox.types.cjs +1 -0
  543. package/types/sandbox.types.d.ts +157 -0
  544. package/types/sandbox.types.mjs +4 -0
  545. package/types/tenderly.api.types.d.ts +180 -0
  546. package/types/token-with-id.types.d.ts +4 -0
  547. package/types/token.types.d.ts +23 -0
  548. package/types/transactions.types.cjs +1 -1
  549. package/types/transactions.types.d.ts +31 -0
  550. package/types/transactions.types.mjs +8 -5
  551. package/types/wc.types.d.ts +89 -0
  552. package/types/with-id.types.d.ts +3 -0
  553. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  554. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  555. package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
  556. package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +26 -31
  557. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  558. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  559. package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
  560. package/webworker/utxoWorker/utxoWorkerLogic.mjs +58 -50
  561. package/webworker/viteWorkerURL.constant.cjs +3 -3
  562. package/webworker/viteWorkerURL.constant.mjs +3 -3
  563. package/webworker/workerFactory.cjs +1 -1
  564. package/webworker/workerFactory.mjs +2 -2
  565. package/webworker/workerProxy.cjs +1 -1
  566. package/webworker/workerProxy.d.ts +11 -11
  567. package/webworker/workerProxy.mjs +24 -26
  568. package/webworker/zkProofWorker/zkProofWorker.types.d.ts +2 -0
  569. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  570. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
  571. package/webworker/zkProofWorker/zkProofWorkerLogic.cjs +1 -1
  572. package/webworker/zkProofWorker/zkProofWorkerLogic.mjs +47 -61
  573. package/functions/utils/memoize.utils.cjs +0 -1
  574. package/functions/utils/memoize.utils.mjs +0 -14
@@ -1,107 +1,112 @@
1
- import { isBeefyDeposit as f } from "../../types/beefy.types.mjs";
1
+ import { isBeefyDeposit as O } from "../../types/beefy.types.mjs";
2
2
  import "../../types/circom-data.types.mjs";
3
3
  import { INTERACTION as a } from "../../types/hinkal.types.mjs";
4
4
  import "../../types/transactions.types.mjs";
5
5
  import "../../types/curve.types.mjs";
6
+ import "../../types/activities.types.mjs";
6
7
  import { getERC20Token as T } from "../utils/erc20tokenFunctions.mjs";
7
- import { processGasEstimates as R } from "./process-gas-estimates.mjs";
8
- import { getInteractionFromAction as A } from "./interaction-to-action.mjs";
9
- const F = async (t, _, D, N, n, W) => {
8
+ import { processGasEstimates as A } from "./process-gas-estimates.mjs";
9
+ import { getInteractionFromAction as i } from "./interaction-to-action.mjs";
10
+ const Y = async (_, t, S, P, D, W, R = []) => {
10
11
  let k;
11
- const P = A(D, n);
12
- if (P === a.NONE)
12
+ const N = i(S, D);
13
+ if (N === a.NONE)
13
14
  throw Error("No interaction was choosen");
14
- let L, o, b;
15
- switch (P) {
15
+ let n, r, b, o;
16
+ switch (N) {
16
17
  case a.WITHDRAW:
17
- k = T(_[0], t);
18
+ k = T(t[0], _);
18
19
  break;
19
20
  case a.SWAP:
20
- k = T(_[1], t);
21
+ k = T(t[1], _);
21
22
  break;
22
23
  case a.CURVE_DEPOSIT:
23
- k = T(_[_.length - 1], t);
24
+ k = T(t[t.length - 1], _);
24
25
  break;
25
26
  case a.CURVE_WITHDRAW: {
26
- if (b = _.findIndex(
27
- (r) => r.toLowerCase() === W?.toLowerCase()
28
- ), b === -1)
27
+ if (o = t.findIndex(
28
+ (L) => L.toLowerCase() === W?.toLowerCase()
29
+ ), o === -1)
29
30
  throw Error("Curve Withdraw Token Index not found");
30
- k = T(_[b], t);
31
+ k = T(t[o], _);
31
32
  break;
32
33
  }
33
34
  case a.STAKING:
34
35
  case a.UNSTAKING:
35
- k = T(_[1], t);
36
+ k = T(t[1], _);
36
37
  break;
37
38
  case a.CLAIMING:
38
- k = T(_[1], t);
39
+ k = T(t[1], _);
39
40
  break;
40
41
  case a.BEEFY:
41
- L = f(n) ? 1 : 0, k = T(_[L], t);
42
+ n = O(D) ? 1 : 0, k = T(t[n], _);
42
43
  break;
43
44
  case a.BEEFY_STAKE:
44
45
  case a.BEEFY_UNSTAKE:
45
- k = T(_[1], t);
46
+ k = T(t[1], _);
46
47
  break;
47
48
  case a.BEEFY_GET_REWARDS:
48
- k = T(_[1], t);
49
+ k = T(t[1], _);
49
50
  break;
50
51
  case a.LIDO_STAKE:
51
- k = T(_[0], t);
52
+ k = T(t[0], _);
52
53
  break;
53
54
  case a.LIDO_REQUEST:
54
- k = T(_[1], t);
55
+ k = T(t[1], _);
55
56
  break;
56
57
  case a.LIDO_CLAIM:
57
- k = T(_[1], t);
58
+ k = T(t[1], _);
58
59
  break;
59
60
  case a.PENDLE_TRANSACT:
60
- k = T(_[0], t);
61
+ k = T(t[0], _);
61
62
  break;
62
63
  case a.PENDLE_YT_IN_SWAP:
63
- k = T(_[1], t);
64
+ k = T(t[1], _);
64
65
  break;
65
66
  case a.PENDLE_YT_OUT_SWAP:
66
- k = T(_[0], t);
67
+ k = T(t[0], _);
67
68
  break;
68
69
  case a.PENDLE_PT_SWAP:
69
- k = T(_[1], t);
70
+ k = T(t[1], _);
70
71
  break;
71
72
  case a.PENDLE_MINT:
72
- k = T(_[1], t);
73
+ k = T(t[1], _);
73
74
  break;
74
75
  case a.PENDLE_REDEEM:
75
- k = T(_[2], t);
76
+ k = T(t[2], _);
76
77
  break;
77
78
  case a.PENDLE_CLAIM:
78
- k = T(_[1], t);
79
+ k = T(t[1], _);
79
80
  break;
80
81
  case a.VOLATILE_WITHDRAW:
81
- k = T(_[0], t);
82
+ k = T(t[0], _);
82
83
  break;
83
84
  case a.VOLATILE_SWAP:
84
- k = T(_[1], t);
85
+ k = T(t[1], _);
85
86
  break;
86
87
  case a.PENDLE_LP:
87
- o = N.findIndex((r) => r > 0), k = T(_[o], t);
88
+ r = P.findIndex((L) => L > 0), k = T(t[r], _);
88
89
  break;
89
90
  case a.PENDLE_LP_CLAIM:
90
- k = T(_[1], t);
91
+ k = T(t[1], _);
91
92
  break;
92
93
  case a.EMPORIUM:
94
+ b = P.findIndex((L) => L > 0n), k = T(t[b], _);
95
+ break;
93
96
  }
94
- let E, S;
95
- const I = N.length;
96
- k && ({ priceOfTransactionInToken: E, priceOfTransactionInUSD: S } = await R(
97
- t,
97
+ let E, f;
98
+ const I = P.length;
99
+ k && ({ priceOfTransactionInToken: E, priceOfTransactionInUSD: f } = await A(
100
+ _,
98
101
  k,
102
+ S,
99
103
  D,
100
- n,
101
- I
104
+ I,
105
+ void 0,
106
+ R
102
107
  ));
103
108
  const e = new Array(I).fill(0n);
104
- switch (P) {
109
+ switch (N) {
105
110
  case a.WITHDRAW:
106
111
  e[0] = E || 0n;
107
112
  break;
@@ -112,7 +117,7 @@ const F = async (t, _, D, N, n, W) => {
112
117
  e[e.length - 1] = E || 0n;
113
118
  break;
114
119
  case a.CURVE_WITHDRAW:
115
- b !== void 0 && (e[b] = E || 0n);
120
+ o !== void 0 && (e[o] = E || 0n);
116
121
  break;
117
122
  case a.STAKING:
118
123
  case a.UNSTAKING:
@@ -122,7 +127,7 @@ const F = async (t, _, D, N, n, W) => {
122
127
  e[1] = E || 0n;
123
128
  break;
124
129
  case a.BEEFY:
125
- L && (e[L] = E || 0n);
130
+ n && (e[n] = E || 0n);
126
131
  break;
127
132
  case a.BEEFY_STAKE:
128
133
  e[1] = E || 0n, e[0] = E || 0n;
@@ -167,16 +172,17 @@ const F = async (t, _, D, N, n, W) => {
167
172
  e[1] = E || 0n;
168
173
  break;
169
174
  case a.PENDLE_LP:
170
- o !== void 0 && (e[o] = E || 0n);
175
+ r !== void 0 && (e[r] = E || 0n);
171
176
  break;
172
177
  case a.PENDLE_LP_CLAIM:
173
178
  e[1] = E || 0n;
174
179
  break;
175
180
  case a.EMPORIUM:
181
+ b !== void 0 && b !== -1 && (e[b] = E || 0n);
176
182
  break;
177
183
  }
178
- return { flatFees: e, priceOfTransactionInToken: E, feeUnit: k, priceOfTransactionInUSD: S };
184
+ return { flatFees: e, priceOfTransactionInToken: E, feeUnit: k, priceOfTransactionInUSD: f };
179
185
  };
180
186
  export {
181
- F as getFlatFees
187
+ Y as getFlatFees
182
188
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../constants/protocol.constants.cjs"),c=require("../../API/API.cjs"),o=async(t,e,a,r,n)=>!r||n?s.defaultSignatureData:(await c.API.getAccessTokenSignature(t,e,a.getAccessKey())).signatureData;exports.getSignatureDataForTransact=o;
@@ -0,0 +1,3 @@
1
+ import { UserKeys } from '../../data-structures/crypto-keys';
2
+ import { SignatureData } from '../../types/crypto.types';
3
+ export declare const getSignatureDataForTransact: (currentChainId: number, ethereumAddress: string, userKeys: UserKeys, kycRequired: boolean, hasAccessToken: boolean) => Promise<SignatureData>;
@@ -0,0 +1,6 @@
1
+ import { defaultSignatureData as i } from "../../constants/protocol.constants.mjs";
2
+ import { API as o } from "../../API/API.mjs";
3
+ const g = async (t, a, e, r, n) => !r || n ? i : (await o.getAccessTokenSignature(t, a, e.getAccessKey())).signatureData;
4
+ export {
5
+ g as getSignatureDataForTransact
6
+ };
@@ -3,3 +3,4 @@ export * from './outputUtxoProcessing';
3
3
  export * from './process-gas-estimates';
4
4
  export * from './processAmountChanges';
5
5
  export * from './getFlatFees';
6
+ export * from './outputApprovalDataProcessing';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const r=require("../../types/external-action.types.cjs"),e=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");const A=(E,t)=>{if(E===r.ExternalActionId.Transact)return e.INTERACTION.WITHDRAW;if([r.ExternalActionId.Uniswap,r.ExternalActionId.Odos,r.ExternalActionId.OneInch].includes(E))return e.INTERACTION.SWAP;if((E===r.ExternalActionId.Curve||E===r.ExternalActionId.CurveDynamic)&&t===e.CurveAction.Deposit)return e.INTERACTION.CURVE_DEPOSIT;if((E===r.ExternalActionId.Curve||E===r.ExternalActionId.CurveDynamic)&&[e.CurveAction.WithdrawInt,e.CurveAction.WithdrawUint].includes(t))return e.INTERACTION.CURVE_WITHDRAW;if((E===r.ExternalActionId.Curve||E===r.ExternalActionId.CurveDynamic)&&t===e.CurveAction.WithdrawImbalance)return e.INTERACTION.CURVE_WITHDRAW_INBALANCED;if((E===r.ExternalActionId.CurveCRV||E===r.ExternalActionId.CurveCRVRewards)&&t===e.CurveAction.Stake||E===r.ExternalActionId.Convex&&t===e.ConvexAction.StakeLP)return e.INTERACTION.STAKING;if((E===r.ExternalActionId.CurveCRV||E===r.ExternalActionId.CurveCRVRewards)&&t===e.CurveAction.Unstake||E===r.ExternalActionId.Convex&&t===e.ConvexAction.UnStakeLP)return e.INTERACTION.UNSTAKING;if((E===r.ExternalActionId.CurveCRV||E===r.ExternalActionId.CurveCRVRewards)&&t===e.CurveAction.GetCRV||E===r.ExternalActionId.Convex&&t===e.ConvexAction.ClaimRewardsLP)return e.INTERACTION.CLAIMING;if(E===r.ExternalActionId.Beefy)return e.INTERACTION.BEEFY;if(E===r.ExternalActionId.BeefyStake&&t===e.BeefyAction.Stake)return e.INTERACTION.BEEFY_STAKE;if(E===r.ExternalActionId.BeefyStake&&t===e.BeefyAction.Unstake)return e.INTERACTION.BEEFY_UNSTAKE;if(E===r.ExternalActionId.BeefyStake&&t===e.BeefyAction.GetRewards)return e.INTERACTION.BEEFY_GET_REWARDS;if((E===r.ExternalActionId.LidoETH||E===r.ExternalActionId.LidoMATIC)&&t===e.LidoAction.Stake)return e.INTERACTION.LIDO_STAKE;if((E===r.ExternalActionId.LidoETHNFT||E===r.ExternalActionId.LidoMATICNFT)&&t===e.LidoAction.Request)return e.INTERACTION.LIDO_REQUEST;if((E===r.ExternalActionId.LidoETHNFT||E===r.ExternalActionId.LidoMATICNFT)&&t===e.LidoAction.Claim)return e.INTERACTION.LIDO_CLAIM;if(E===r.ExternalActionId.Pendle)return t===e.PendleAction.SwapFromYt?e.INTERACTION.PENDLE_YT_IN_SWAP:t===e.PendleAction.SwapToYt?e.INTERACTION.PENDLE_YT_OUT_SWAP:t===e.PendleAction.SwapPt?e.INTERACTION.PENDLE_PT_SWAP:t===e.PendleAction.Checkpoint?e.INTERACTION.PENDLE_CLAIM:e.INTERACTION.PENDLE_TRANSACT;if(E===r.ExternalActionId.Volatile){if(t===e.VolatileAction.Withdraw)return e.INTERACTION.VOLATILE_WITHDRAW;if(t===e.VolatileAction.Swap)return e.INTERACTION.VOLATILE_SWAP}else if(E===r.ExternalActionId.PendleLP){if(t===e.PendleLPAction.AddOrRemoveLiquidity)return e.INTERACTION.PENDLE_LP;if(t===e.PendleLPAction.Checkpoint)return e.INTERACTION.PENDLE_LP_CLAIM}else if(E===r.ExternalActionId.Emporium)return e.INTERACTION.EMPORIUM;return e.INTERACTION.NONE};exports.getInteractionFromAction=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");const r=require("../../types/external-action.types.cjs"),e=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");const A=(E,t)=>{if(E===r.ExternalActionId.Transact)return e.INTERACTION.WITHDRAW;if([r.ExternalActionId.Uniswap,r.ExternalActionId.Odos,r.ExternalActionId.OneInch].includes(E))return e.INTERACTION.SWAP;if((E===r.ExternalActionId.Curve||E===r.ExternalActionId.CurveDynamic)&&t===e.CurveAction.Deposit)return e.INTERACTION.CURVE_DEPOSIT;if((E===r.ExternalActionId.Curve||E===r.ExternalActionId.CurveDynamic)&&[e.CurveAction.WithdrawInt,e.CurveAction.WithdrawUint].includes(t))return e.INTERACTION.CURVE_WITHDRAW;if((E===r.ExternalActionId.Curve||E===r.ExternalActionId.CurveDynamic)&&t===e.CurveAction.WithdrawImbalance)return e.INTERACTION.CURVE_WITHDRAW_INBALANCED;if((E===r.ExternalActionId.CurveCRV||E===r.ExternalActionId.CurveCRVRewards)&&t===e.CurveAction.Stake||E===r.ExternalActionId.Convex&&t===e.ConvexAction.StakeLP)return e.INTERACTION.STAKING;if((E===r.ExternalActionId.CurveCRV||E===r.ExternalActionId.CurveCRVRewards)&&t===e.CurveAction.Unstake||E===r.ExternalActionId.Convex&&t===e.ConvexAction.UnStakeLP)return e.INTERACTION.UNSTAKING;if((E===r.ExternalActionId.CurveCRV||E===r.ExternalActionId.CurveCRVRewards)&&t===e.CurveAction.GetCRV||E===r.ExternalActionId.Convex&&t===e.ConvexAction.ClaimRewardsLP)return e.INTERACTION.CLAIMING;if(E===r.ExternalActionId.Beefy)return e.INTERACTION.BEEFY;if(E===r.ExternalActionId.BeefyStake&&t===e.BeefyAction.Stake)return e.INTERACTION.BEEFY_STAKE;if(E===r.ExternalActionId.BeefyStake&&t===e.BeefyAction.Unstake)return e.INTERACTION.BEEFY_UNSTAKE;if(E===r.ExternalActionId.BeefyStake&&t===e.BeefyAction.GetRewards)return e.INTERACTION.BEEFY_GET_REWARDS;if((E===r.ExternalActionId.LidoETH||E===r.ExternalActionId.LidoMATIC)&&t===e.LidoAction.Stake)return e.INTERACTION.LIDO_STAKE;if((E===r.ExternalActionId.LidoETHNFT||E===r.ExternalActionId.LidoMATICNFT)&&t===e.LidoAction.Request)return e.INTERACTION.LIDO_REQUEST;if((E===r.ExternalActionId.LidoETHNFT||E===r.ExternalActionId.LidoMATICNFT)&&t===e.LidoAction.Claim)return e.INTERACTION.LIDO_CLAIM;if(E===r.ExternalActionId.Pendle)return t===e.PendleAction.SwapFromYt?e.INTERACTION.PENDLE_YT_IN_SWAP:t===e.PendleAction.SwapToYt?e.INTERACTION.PENDLE_YT_OUT_SWAP:t===e.PendleAction.SwapPt?e.INTERACTION.PENDLE_PT_SWAP:t===e.PendleAction.Checkpoint?e.INTERACTION.PENDLE_CLAIM:e.INTERACTION.PENDLE_TRANSACT;if(E===r.ExternalActionId.Volatile){if(t===e.VolatileAction.Withdraw)return e.INTERACTION.VOLATILE_WITHDRAW;if(t===e.VolatileAction.Swap)return e.INTERACTION.VOLATILE_SWAP}else if(E===r.ExternalActionId.PendleLP){if(t===e.PendleLPAction.AddOrRemoveLiquidity)return e.INTERACTION.PENDLE_LP;if(t===e.PendleLPAction.Checkpoint)return e.INTERACTION.PENDLE_LP_CLAIM}else if(E===r.ExternalActionId.Emporium)return e.INTERACTION.EMPORIUM;return e.INTERACTION.NONE};exports.getInteractionFromAction=A;
@@ -3,7 +3,8 @@ import { ExternalActionId as e } from "../../types/external-action.types.mjs";
3
3
  import { INTERACTION as u, CurveAction as C, ConvexAction as L, BeefyAction as T, LidoAction as s, PendleAction as f, VolatileAction as P, PendleLPAction as R } from "../../types/hinkal.types.mjs";
4
4
  import "../../types/transactions.types.mjs";
5
5
  import "../../types/curve.types.mjs";
6
- const m = (r, E) => {
6
+ import "../../types/activities.types.mjs";
7
+ const v = (r, E) => {
7
8
  if (r === e.Transact)
8
9
  return u.WITHDRAW;
9
10
  if ([e.Uniswap, e.Odos, e.OneInch].includes(
@@ -53,5 +54,5 @@ const m = (r, E) => {
53
54
  return u.NONE;
54
55
  };
55
56
  export {
56
- m as getInteractionFromAction
57
+ v as getInteractionFromAction
57
58
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../error-handling/logger.cjs"),g=require("../../error-handling/customErrors/FeeOverTransactionValueError.cjs"),a=require("../utils/caseInsensitive.utils.cjs"),s=require("../utils/erc20tokenFunctions.cjs"),c=(i,t,o,e)=>{if(e.variableRate!==0n)throw new Error("Not Implemented");n.Logger.log("amount changes before merge",{amountChanges:o});const r=t.findIndex(l=>a.caseInsensitiveEqual(l,e.feeToken));if(r===-1){t.push(e.feeToken),o.push(-1n*e.flatFee),n.Logger.log("amount changes after merge",{amountChanges:o});return}if(o[r]>0&&o[r]<e.flatFee)throw new g.FeeOverTransactionValueError({totalFeeWEI:e.flatFee,feeUnit:s.getERC20Token(e.feeToken,i)});o[r]-=e.flatFee,n.Logger.log("amount changes after merge",{amountChanges:o})};exports.mergeWithFeeStructure=c;
@@ -0,0 +1,2 @@
1
+ import { FeeStructure } from '../../types/hinkal.types';
2
+ export declare const mergeWithFeeStructure: (chainId: number, erc20Addresses: string[], amountChanges: bigint[], feeStructure: FeeStructure) => void;
@@ -0,0 +1,25 @@
1
+ import { Logger as n } from "../../error-handling/logger.mjs";
2
+ import { FeeOverTransactionValueError as m } from "../../error-handling/customErrors/FeeOverTransactionValueError.mjs";
3
+ import { caseInsensitiveEqual as t } from "../utils/caseInsensitive.utils.mjs";
4
+ import { getERC20Token as a } from "../utils/erc20tokenFunctions.mjs";
5
+ const k = (f, i, o, e) => {
6
+ if (e.variableRate !== 0n)
7
+ throw new Error("Not Implemented");
8
+ n.log("amount changes before merge", { amountChanges: o });
9
+ const r = i.findIndex(
10
+ (l) => t(l, e.feeToken)
11
+ );
12
+ if (r === -1) {
13
+ i.push(e.feeToken), o.push(-1n * e.flatFee), n.log("amount changes after merge", { amountChanges: o });
14
+ return;
15
+ }
16
+ if (o[r] > 0 && o[r] < e.flatFee)
17
+ throw new m({
18
+ totalFeeWEI: e.flatFee,
19
+ feeUnit: a(e.feeToken, f)
20
+ });
21
+ o[r] -= e.flatFee, n.log("amount changes after merge", { amountChanges: o });
22
+ };
23
+ export {
24
+ k as mergeWithFeeStructure
25
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../error-handling/error-codes.constants.cjs"),A=require("../../constants/conversion.constants.cjs"),T=require("../../types/hinkal.types.cjs"),k=require("../utils/processUseApprovalUtxoData.cjs"),f=require("../utils/amounts.utils.cjs"),g=require("../utils/caseInsensitive.utils.cjs"),m=(p,d,t,E,i)=>{if(i&&i>0)throw new Error(I.transactionErrorCodes.INSUFFICIENT_FUNDS);const l=f.countTotalAmountInUtxos(d),{erc20TokenAddress:u}=d[0],v=p.getApprovedUtxosForToken(u).filter(n=>!g.caseInsensitiveEqual(n.interactionAddress,E)),r=T.defaultUseApprovalUTXOData(A.APPROVED_UTXO_CONVERSION_COUNT,0n);if(t<0n&&l+t<0n){let n=-(l+t);for(let e=0;e<Math.min(v.length,A.APPROVED_UTXO_CONVERSION_COUNT)&&n!==0n;e+=1){const s=v[e],U=s.amount>=n?-n:-s.amount;n+=U,r.approvalChanges[e]=U,r.externalApprovalAddresses[e]=s.interactionAddress,r.conversionInHinkalAddress[e]=s.inHinkalAddress}if(n!==0n)throw new Error(I.transactionErrorCodes.INSUFFICIENT_FUNDS)}return{useApprovalUtxoData:k.isUseApprovalDataEmpty(r)?void 0:r}},x=(p,d,t,E,i,l)=>{if(l&&l>0)throw new Error(I.transactionErrorCodes.INSUFFICIENT_FUNDS);const u=f.countTotalAmountInUtxos(d),{erc20TokenAddress:v}=d[0],r=T.defaultUseApprovalUTXOData(A.APPROVED_UTXO_CONVERSION_COUNT,0n),n=p.userKeys.getInHinkalAddress(t),e=p.getApprovedUtxosForToken(v).sort((o,c)=>o.inHinkalAddress===n?-1:c.inHinkalAddress===n?1:o.amount===c.amount?0:o.amount<c.amount?-1:1),s=e[0]?.inHinkalAddress===n,U=s?e[0].amount:0n,D=E-U;r.approvalChanges[0]=D,r.externalApprovalAddresses[0]=t,r.conversionInHinkalAddress[0]=p.userKeys.getInHinkalAddress(t);const _=s?1:0,O=_===0?1:0;if(i<0n&&u+i<0){let o=-(u+i);const c=Math.min(e.length,A.APPROVED_UTXO_CONVERSION_COUNT);for(let a=_;a<c&&!(o===0n||a+O>=A.APPROVED_UTXO_CONVERSION_COUNT);a+=1){const N=e[a],C=N.amount>=o?-o:-N.amount;o+=C,r.approvalChanges[a+O]=C,r.externalApprovalAddresses[a+O]=N.interactionAddress,r.conversionInHinkalAddress[a+O]=N.inHinkalAddress}if(o!==0n)throw new Error(I.transactionErrorCodes.INSUFFICIENT_FUNDS)}return{useApprovalUtxoData:r}};exports.outputApprovalDataProcessing=m;exports.outputApprovalDataProcessingForHinkalApprove=x;
@@ -0,0 +1,16 @@
1
+ import { Utxo } from '../../data-structures/utxo/Utxo';
2
+ import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
3
+ export declare const outputApprovalDataProcessing: (hinkal: IHinkal, inputUtxos: Utxo[], amountChange: bigint, interactionToIgnore?: string, tokenId?: number) => {
4
+ useApprovalUtxoData: {
5
+ approvalChanges: bigint[];
6
+ externalApprovalAddresses: string[];
7
+ conversionInHinkalAddress: bigint[];
8
+ } | undefined;
9
+ };
10
+ export declare const outputApprovalDataProcessingForHinkalApprove: (hinkal: IHinkal, inputUtxos: Utxo[], approvedTo: string, approvalAmount: bigint, deltaAmount: bigint, tokenId?: number) => {
11
+ useApprovalUtxoData: {
12
+ approvalChanges: bigint[];
13
+ externalApprovalAddresses: string[];
14
+ conversionInHinkalAddress: bigint[];
15
+ };
16
+ };
@@ -0,0 +1,42 @@
1
+ import { transactionErrorCodes as I } from "../../error-handling/error-codes.constants.mjs";
2
+ import { APPROVED_UTXO_CONVERSION_COUNT as c } from "../../constants/conversion.constants.mjs";
3
+ import { defaultUseApprovalUTXOData as N } from "../../types/hinkal.types.mjs";
4
+ import { isUseApprovalDataEmpty as E } from "../utils/processUseApprovalUtxoData.mjs";
5
+ import { countTotalAmountInUtxos as g } from "../utils/amounts.utils.mjs";
6
+ import { caseInsensitiveEqual as H } from "../utils/caseInsensitive.utils.mjs";
7
+ const _ = (d, p, t, k, i) => {
8
+ if (i && i > 0)
9
+ throw new Error(I.INSUFFICIENT_FUNDS);
10
+ const A = g(p), { erc20TokenAddress: u } = p[0], v = d.getApprovedUtxosForToken(u).filter((n) => !H(n.interactionAddress, k)), r = N(c, 0n);
11
+ if (t < 0n && A + t < 0n) {
12
+ let n = -(A + t);
13
+ for (let o = 0; o < Math.min(v.length, c) && n !== 0n; o += 1) {
14
+ const s = v[o], m = s.amount >= n ? -n : -s.amount;
15
+ n += m, r.approvalChanges[o] = m, r.externalApprovalAddresses[o] = s.interactionAddress, r.conversionInHinkalAddress[o] = s.inHinkalAddress;
16
+ }
17
+ if (n !== 0n)
18
+ throw new Error(I.INSUFFICIENT_FUNDS);
19
+ }
20
+ return { useApprovalUtxoData: E(r) ? void 0 : r };
21
+ }, y = (d, p, t, k, i, A) => {
22
+ if (A && A > 0)
23
+ throw new Error(I.INSUFFICIENT_FUNDS);
24
+ const u = g(p), { erc20TokenAddress: v } = p[0], r = N(c, 0n), n = d.userKeys.getInHinkalAddress(t), o = d.getApprovedUtxosForToken(v).sort((e, l) => e.inHinkalAddress === n ? -1 : l.inHinkalAddress === n ? 1 : e.amount === l.amount ? 0 : e.amount < l.amount ? -1 : 1), s = o[0]?.inHinkalAddress === n, m = s ? o[0].amount : 0n, D = k - m;
25
+ r.approvalChanges[0] = D, r.externalApprovalAddresses[0] = t, r.conversionInHinkalAddress[0] = d.userKeys.getInHinkalAddress(t);
26
+ const x = s ? 1 : 0, f = x === 0 ? 1 : 0;
27
+ if (i < 0n && u + i < 0) {
28
+ let e = -(u + i);
29
+ const l = Math.min(o.length, c);
30
+ for (let a = x; a < l && !(e === 0n || a + f >= c); a += 1) {
31
+ const U = o[a], F = U.amount >= e ? -e : -U.amount;
32
+ e += F, r.approvalChanges[a + f] = F, r.externalApprovalAddresses[a + f] = U.interactionAddress, r.conversionInHinkalAddress[a + f] = U.inHinkalAddress;
33
+ }
34
+ if (e !== 0n)
35
+ throw new Error(I.INSUFFICIENT_FUNDS);
36
+ }
37
+ return { useApprovalUtxoData: r };
38
+ };
39
+ export {
40
+ _ as outputApprovalDataProcessing,
41
+ y as outputApprovalDataProcessingForHinkalApprove
42
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../data-structures/utxo/Utxo.cjs"),q=require("../../error-handling/error-codes.constants.cjs");require("ethers");require("axios");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");const c=(o,t,e,u,i)=>{let r=0n;if(t.forEach(s=>{r+=s.amount}),e<0n&&r+e<0n)throw Error(q.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);return{outputUtxos:[new n.Utxo({amount:r+e,erc20TokenAddress:t[0].erc20TokenAddress,shieldedPrivateKey:o.getShieldedPrivateKey(),timeStamp:u,tokenId:i})]}};exports.outputUtxoProcessing=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../data-structures/utxo/Utxo.cjs"),r=require("../utils/amounts.utils.cjs"),a=require("../../error-handling/error-codes.constants.cjs"),l=(s,o,t,n,u,i=!0)=>{const e=r.countTotalAmountInUtxos(o),{erc20TokenAddress:c}=o[0];if(i&&t<0n&&e+t<0n)throw Error(a.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);return{outputUtxos:[new d.Utxo({amount:r.bigintMax(e+t,0n),erc20TokenAddress:c,shieldedPrivateKey:s.getShieldedPrivateKey(),timeStamp:n,tokenId:u})]}};exports.outputUtxoProcessing=l;
@@ -1,5 +1,5 @@
1
1
  import { UserKeys } from '../../data-structures/crypto-keys/keys';
2
2
  import { Utxo } from '../../data-structures/utxo/Utxo';
3
- export declare const outputUtxoProcessing: (userKeys: UserKeys, inputUtxos: Utxo[], amountChange: bigint, timeStamp?: string, tokenId?: number) => {
3
+ export declare const outputUtxoProcessing: (userKeys: UserKeys, inputUtxos: Utxo[], amountChange: bigint, timeStamp?: string, tokenId?: number, revertIfNegative?: boolean) => {
4
4
  outputUtxos: Utxo[];
5
5
  };
@@ -1,33 +1,22 @@
1
- import { Utxo as s } from "../../data-structures/utxo/Utxo.mjs";
2
- import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
3
- import "ethers";
4
- import "axios";
5
- import "../../constants/chains.constants.mjs";
6
- import "../../constants/vite.constants.mjs";
7
- import "../../types/circom-data.types.mjs";
8
- import "../../types/transactions.types.mjs";
9
- import "../../types/curve.types.mjs";
10
- import "circomlibjs-hinkal-fork";
11
- import "libsodium-wrappers";
12
- import "process";
13
- import "buffer";
14
- import "../../constants/reorg-depths.constants.mjs";
15
- const P = (i, r, o, e, m) => {
16
- let t = 0n;
17
- if (r.forEach((p) => {
18
- t += p.amount;
19
- }), o < 0n && t + o < 0n)
20
- throw Error(n.INSUFFICIENT_FUNDS_TO_TRANSACT);
21
- return { outputUtxos: [
22
- new s({
23
- amount: t + o,
24
- erc20TokenAddress: r[0].erc20TokenAddress,
25
- shieldedPrivateKey: i.getShieldedPrivateKey(),
26
- timeStamp: e,
27
- tokenId: m
28
- })
29
- ] };
1
+ import { Utxo as c } from "../../data-structures/utxo/Utxo.mjs";
2
+ import { countTotalAmountInUtxos as d, bigintMax as m } from "../utils/amounts.utils.mjs";
3
+ import { transactionErrorCodes as p } from "../../error-handling/error-codes.constants.mjs";
4
+ const a = (e, o, t, n, s, i = !0) => {
5
+ const r = d(o), { erc20TokenAddress: u } = o[0];
6
+ if (i && t < 0n && r + t < 0n)
7
+ throw Error(p.INSUFFICIENT_FUNDS_TO_TRANSACT);
8
+ return {
9
+ outputUtxos: [
10
+ new c({
11
+ amount: m(r + t, 0n),
12
+ erc20TokenAddress: u,
13
+ shieldedPrivateKey: e.getShieldedPrivateKey(),
14
+ timeStamp: n,
15
+ tokenId: s
16
+ })
17
+ ]
18
+ };
30
19
  };
31
20
  export {
32
- P as outputUtxoProcessing
21
+ a as outputUtxoProcessing
33
22
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const q=require("../../API/getGasEstimates.cjs");require("ethers");require("../../types/curve.types.cjs");const l=require("../../error-handling/logError.cjs");require("../../constants/token-data/index.cjs");const m=require("../utils/amounts.utils.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const g=require("../web3/etherFunctions.cjs"),T=async(i,e,s,n,o,a)=>{let t,r;try{({priceOfTransactionInUSD:t,priceOfTransactionInToken:r}=await q.getGasEstimates(i,e.erc20TokenAddress,s,n,o,a))}catch(u){l.logError("processGasEstimates error:",u)}const c=r?g.getAmountInWei(e,m.getValueFirstNDigit(r,e.decimals)):void 0;return{priceOfTransactionInUSD:t,priceOfTransactionInToken:c}};exports.processGasEstimates=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../API/getGasEstimates.cjs"),E=require("../../error-handling/logError.cjs"),d=require("../utils/amounts.utils.cjs"),f=require("../web3/etherFunctions.cjs"),G=async(a,e,i,n,o,c,u=[])=>{let s,t;try{({priceOfTransactionInUSD:s,priceOfTransactionInToken:t}=await T.getGasEstimates(a,e.erc20TokenAddress,i,n,o,u.map(({from:r,to:m,calldata:g,value:p})=>({from:r,to:m,calldata:g,value:`${p}`})),c))}catch(r){E.logError("processGasEstimates error:",r)}const l=t?f.getAmountInWei(e,d.getValueFirstNDigit(t,e.decimals)):void 0;return{priceOfTransactionInUSD:s,priceOfTransactionInToken:l}};exports.processGasEstimates=G;
@@ -1,5 +1,5 @@
1
- import { ERC20Token, ExternalActionId, ValidExternalAction } from '../../types';
2
- export declare const processGasEstimates: (chainId: number, token: ERC20Token, externalActionId: ExternalActionId, action: ValidExternalAction | undefined, erc20TokenAddressLength: number, gasAmount?: number) => Promise<{
1
+ import { CallInfo, ERC20Token, ExternalActionId, ValidExternalAction } from '../../types';
2
+ export declare const processGasEstimates: (chainId: number, token: ERC20Token, externalActionId: ExternalActionId, action: ValidExternalAction | undefined, erc20TokenAddressLength: number, gasAmount?: number, calls?: CallInfo<bigint>[]) => Promise<{
3
3
  priceOfTransactionInUSD: number | undefined;
4
4
  priceOfTransactionInToken: bigint | undefined;
5
5
  }>;
@@ -1,36 +1,25 @@
1
- import "../../constants/chains.constants.mjs";
2
- import "../../constants/vite.constants.mjs";
3
- import "axios";
4
- import "../../constants/coingecko.constants.mjs";
5
- import { getGasEstimates as c } from "../../API/getGasEstimates.mjs";
6
- import "ethers";
7
- import "../../types/curve.types.mjs";
8
- import { logError as f } from "../../error-handling/logError.mjs";
9
- import "../../constants/token-data/index.mjs";
10
- import { getValueFirstNDigit as T } from "../utils/amounts.utils.mjs";
11
- import "../../constants/contracts.constants.mjs";
12
- import "../../constants/kyc.constants.mjs";
13
- import "../../constants/axelar.constants.mjs";
14
- import "../../constants/rewards.constants.mjs";
15
- import "../../constants/reorg-depths.constants.mjs";
16
- import { getAmountInWei as g } from "../web3/etherFunctions.mjs";
17
- const N = async (i, r, e, m, s, p) => {
1
+ import { getGasEstimates as g } from "../../API/getGasEstimates.mjs";
2
+ import { logError as E } from "../../error-handling/logError.mjs";
3
+ import { getValueFirstNDigit as I } from "../utils/amounts.utils.mjs";
4
+ import { getAmountInWei as d } from "../web3/etherFunctions.mjs";
5
+ const v = async (s, r, a, i, n, c, m = []) => {
18
6
  let o, t;
19
7
  try {
20
- ({ priceOfTransactionInUSD: o, priceOfTransactionInToken: t } = await c(
21
- i,
22
- r.erc20TokenAddress,
23
- e,
24
- m,
8
+ ({ priceOfTransactionInUSD: o, priceOfTransactionInToken: t } = await g(
25
9
  s,
26
- p
10
+ r.erc20TokenAddress,
11
+ a,
12
+ i,
13
+ n,
14
+ m.map(({ from: e, to: f, calldata: T, value: l }) => ({ from: e, to: f, calldata: T, value: `${l}` })),
15
+ c
27
16
  ));
28
- } catch (n) {
29
- f("processGasEstimates error:", n);
17
+ } catch (e) {
18
+ E("processGasEstimates error:", e);
30
19
  }
31
- const a = t ? g(r, T(t, r.decimals)) : void 0;
32
- return { priceOfTransactionInUSD: o, priceOfTransactionInToken: a };
20
+ const p = t ? d(r, I(t, r.decimals)) : void 0;
21
+ return { priceOfTransactionInUSD: o, priceOfTransactionInToken: p };
33
22
  };
34
23
  export {
35
- N as processGasEstimates
24
+ v as processGasEstimates
36
25
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants/fees.constants.cjs"),d=require("../../error-handling/customErrors/FeeOverTransactionValueError.cjs"),y=require("../utils/amounts.utils.cjs");require("ethers");require("axios");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");const O=require("../../types/beefy.types.cjs");require("../../types/circom-data.types.cjs");const e=require("../../types/hinkal.types.cjs"),c=require("../../types/slippage.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");const _=require("./interaction-to-action.cjs"),N=(t,A,r)=>{const l=y.absBigInt(t)-A;if(A<0n)throw new d.FeeOverTransactionValueError({totalFeeWEI:l,feeUnit:r});return A},F=({erc20Addresses:t=[],amountChanges:A,flatFees:r,feeUnit:I,externalActionId:l,action:p,gasTokenAddress:b})=>{const i=_.getInteractionFromAction(l,p);if(i===e.INTERACTION.NONE)throw Error("No interaction was choosen");switch(i){case e.INTERACTION.WITHDRAW:{N(A[0],T.getAmountAfterRelayAndFlatFees(A[0],r[0],!0),I);break}case e.INTERACTION.SWAP:{A[1]=N(A[1],T.getAmountAfterRelayAndFlatFeesAndSlippage(A[1],r[1],c.SlippageType.Swap),I);break}case e.INTERACTION.CURVE_DEPOSIT:{const E=A.length-1;A[E]=N(A[E],T.getAmountAfterRelayAndFlatFeesAndSlippage(A[E],r[E],c.SlippageType.CurveDeposit),I);break}case e.INTERACTION.CURVE_WITHDRAW:r.forEach((E,R)=>{E>0n?A[R]=N(A[R],T.getAmountAfterRelayAndFlatFeesAndSlippage(A[R],E,c.SlippageType.CurveWithdraw),I):E===0n&&A[R]>0n&&R!==r.length-1&&(A[R]=T.getAmountAfterSlippage(A[R],c.SlippageType.CurveWithdraw))});break;case e.INTERACTION.CURVE_WITHDRAW_INBALANCED:break;case e.INTERACTION.STAKING:A[0]=N(A[0],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.UNSTAKING:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[0],r[0]),I);break;case e.INTERACTION.CLAIMING:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.BEEFY:{const E=O.isBeefyDeposit(p)?1:0;A[E]=N(A[E],T.getAmountAfterRelayAndFlatFeesAndSlippage(A[E],r[E],c.SlippageType.Beefy),I);break}case e.INTERACTION.BEEFY_STAKE:A[0]=N(A[0],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.BEEFY_UNSTAKE:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[0],r[0]),I);break;case e.INTERACTION.BEEFY_GET_REWARDS:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.LIDO_STAKE:A[0]=N(A[0],T.getAmountAfterRelayAndFlatFees(A[0],r[0]),I);break;case e.INTERACTION.LIDO_REQUEST:N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.LIDO_CLAIM:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.PENDLE_TRANSACT:A[0]<0n&&N(A[0],T.getAmountAfterRelayAndFlatFees(A[0],r[0],!0),I);break;case e.INTERACTION.PENDLE_YT_IN_SWAP:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.PENDLE_YT_OUT_SWAP:break;case e.INTERACTION.PENDLE_PT_SWAP:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.PENDLE_MINT:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.PENDLE_REDEEM:A[2]=N(A[2],T.getAmountAfterRelayAndFlatFees(A[2],r[2]),I);break;case e.INTERACTION.PENDLE_CLAIM:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break;case e.INTERACTION.PENDLE_LP:{const E=A.findIndex(R=>R>0n);A[E]=N(A[E],T.getAmountAfterRelayAndFlatFeesAndSlippage(A[E],r[E],c.SlippageType.Pendle));break}case e.INTERACTION.PENDLE_LP_CLAIM:A[1]=N(A[1],T.getAmountAfterRelayAndFlatFees(A[1],r[1]),I);break}return A};exports.processAmountChanges=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../constants/fees.constants.cjs"),y=require("../../error-handling/customErrors/FeeOverTransactionValueError.cjs"),O=require("../utils/amounts.utils.cjs");require("ethers");require("../../error-handling/error-codes.constants.cjs");require("axios");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");const d=require("../../types/beefy.types.cjs");require("../../types/circom-data.types.cjs");const e=require("../../types/hinkal.types.cjs"),c=require("../../types/slippage.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");const _=require("./interaction-to-action.cjs"),E=(p,r,A)=>{const l=O.absBigInt(p)-r;if(r<0n)throw new y.FeeOverTransactionValueError({totalFeeWEI:l,feeUnit:A});return r},b=({erc20Addresses:p=[],amountChanges:r,flatFees:A,feeUnit:T,externalActionId:l,action:t,gasTokenAddress:k})=>{const i=_.getInteractionFromAction(l,t);if(i===e.INTERACTION.NONE)throw Error("No interaction was choosen");switch(i){case e.INTERACTION.WITHDRAW:{E(r[0],I.getAmountAfterRelayAndFlatFees(r[0],A[0],!0),T);break}case e.INTERACTION.SWAP:{r[1]=E(r[1],I.getAmountAfterRelayAndFlatFeesAndSlippage(r[1],A[1],c.SlippageType.Swap),T);break}case e.INTERACTION.CURVE_DEPOSIT:{const N=r.length-1;r[N]=E(r[N],I.getAmountAfterRelayAndFlatFeesAndSlippage(r[N],A[N],c.SlippageType.CurveDeposit),T);break}case e.INTERACTION.CURVE_WITHDRAW:A.forEach((N,R)=>{N>0n?r[R]=E(r[R],I.getAmountAfterRelayAndFlatFeesAndSlippage(r[R],N,c.SlippageType.CurveWithdraw),T):N===0n&&r[R]>0n&&R!==A.length-1&&(r[R]=I.getAmountAfterSlippage(r[R],c.SlippageType.CurveWithdraw))});break;case e.INTERACTION.CURVE_WITHDRAW_INBALANCED:break;case e.INTERACTION.STAKING:r[0]=E(r[0],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.UNSTAKING:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[0],A[0]),T);break;case e.INTERACTION.CLAIMING:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.BEEFY:{const N=d.isBeefyDeposit(t)?1:0;r[N]=E(r[N],I.getAmountAfterRelayAndFlatFeesAndSlippage(r[N],A[N],c.SlippageType.Beefy),T);break}case e.INTERACTION.BEEFY_STAKE:r[0]=E(r[0],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.BEEFY_UNSTAKE:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[0],A[0]),T);break;case e.INTERACTION.BEEFY_GET_REWARDS:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.LIDO_STAKE:r[0]=E(r[0],I.getAmountAfterRelayAndFlatFees(r[0],A[0]),T);break;case e.INTERACTION.LIDO_REQUEST:E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.LIDO_CLAIM:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.PENDLE_TRANSACT:r[0]<0n&&E(r[0],I.getAmountAfterRelayAndFlatFees(r[0],A[0],!0),T);break;case e.INTERACTION.PENDLE_YT_IN_SWAP:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.PENDLE_YT_OUT_SWAP:break;case e.INTERACTION.PENDLE_PT_SWAP:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.PENDLE_MINT:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.PENDLE_REDEEM:r[2]=E(r[2],I.getAmountAfterRelayAndFlatFees(r[2],A[2]),T);break;case e.INTERACTION.PENDLE_CLAIM:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.PENDLE_LP:{const N=r.findIndex(R=>R>0n);r[N]=E(r[N],I.getAmountAfterRelayAndFlatFeesAndSlippage(r[N],A[N],c.SlippageType.Pendle));break}case e.INTERACTION.PENDLE_LP_CLAIM:r[1]=E(r[1],I.getAmountAfterRelayAndFlatFees(r[1],A[1]),T);break;case e.INTERACTION.EMPORIUM:A.forEach((N,R)=>{N>0&&(r[R]=E(r[R],r[R]-N,T))});break}return r};exports.processAmountChanges=b;