@hinkal/common 0.2.13 → 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 (656) hide show
  1. package/API/API.cjs +1 -1
  2. package/API/API.d.ts +10 -3
  3. package/API/API.mjs +42 -31
  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 +7 -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/rewardsPointsCalls.cjs +1 -1
  27. package/API/rewardsPointsCalls.d.ts +3 -3
  28. package/API/rewardsPointsCalls.mjs +1 -3
  29. package/API/tenderly.api.cjs +1 -0
  30. package/API/tenderly.api.d.ts +12 -0
  31. package/API/tenderly.api.mjs +47 -0
  32. package/API/token-calls.cjs +1 -0
  33. package/API/token-calls.d.ts +2 -0
  34. package/API/token-calls.mjs +9 -0
  35. package/API/userVerifyTransactions.cjs +1 -1
  36. package/API/userVerifyTransactions.d.ts +6 -7
  37. package/API/userVerifyTransactions.mjs +13 -14
  38. package/constants/addresses.constants.cjs +1 -0
  39. package/constants/addresses.constants.d.ts +16 -0
  40. package/constants/addresses.constants.mjs +50 -0
  41. package/constants/assets.constants.cjs +1 -1
  42. package/constants/assets.constants.mjs +13 -13
  43. package/constants/axelar.constants.cjs +1 -1
  44. package/constants/axelar.constants.mjs +5 -5
  45. package/constants/balance.constants.cjs +1 -0
  46. package/constants/balance.constants.d.ts +1 -0
  47. package/constants/balance.constants.mjs +4 -0
  48. package/constants/chains.constants.cjs +1 -1
  49. package/constants/chains.constants.d.ts +0 -2
  50. package/constants/chains.constants.mjs +28 -40
  51. package/constants/contracts.constants.cjs +1 -1
  52. package/constants/contracts.constants.mjs +144 -140
  53. package/constants/conversion.constants.cjs +1 -0
  54. package/constants/conversion.constants.d.ts +1 -0
  55. package/constants/conversion.constants.mjs +4 -0
  56. package/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
  57. package/constants/deploy-data/deploy-data-arbMainnet.json.mjs +846 -11
  58. package/constants/deploy-data/deploy-data-avalanche.json.cjs +1 -1
  59. package/constants/deploy-data/deploy-data-avalanche.json.mjs +848 -13
  60. package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
  61. package/constants/deploy-data/deploy-data-base.json.mjs +852 -17
  62. package/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
  63. package/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +855 -20
  64. package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
  65. package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +850 -15
  66. package/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
  67. package/constants/deploy-data/deploy-data-localhost.json.mjs +3208 -1550
  68. package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
  69. package/constants/deploy-data/deploy-data-optimism.json.mjs +10010 -3429
  70. package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
  71. package/constants/deploy-data/deploy-data-polygon.json.mjs +844 -9
  72. package/constants/fees.constants.cjs +1 -1
  73. package/constants/fees.constants.d.ts +5 -3
  74. package/constants/fees.constants.mjs +22 -19
  75. package/constants/index.d.ts +6 -0
  76. package/constants/kyc.constants.cjs +1 -1
  77. package/constants/kyc.constants.mjs +30 -18
  78. package/constants/mediaUrls.constants.cjs +1 -0
  79. package/constants/mediaUrls.constants.d.ts +23 -0
  80. package/constants/mediaUrls.constants.mjs +26 -0
  81. package/constants/permit2.constants.cjs +1 -0
  82. package/constants/permit2.constants.d.ts +2 -0
  83. package/constants/permit2.constants.mjs +5 -0
  84. package/constants/protocol.constants.cjs +1 -1
  85. package/constants/protocol.constants.d.ts +6 -0
  86. package/constants/protocol.constants.mjs +27 -15
  87. package/constants/rewards.constants.cjs +1 -1
  88. package/constants/rewards.constants.mjs +14 -12
  89. package/constants/server.constants.cjs +1 -1
  90. package/constants/server.constants.d.ts +14 -6
  91. package/constants/server.constants.mjs +24 -16
  92. package/constants/token-data/ERC20Registry.cjs +1 -1
  93. package/constants/token-data/ERC20Registry.mjs +49 -48
  94. package/constants/token-data/arbMainnetRegistry.json.cjs +1 -1
  95. package/constants/token-data/arbMainnetRegistry.json.mjs +89 -86
  96. package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
  97. package/constants/token-data/arbMainnetRegistryFixed.json.mjs +79 -76
  98. package/constants/token-data/avalancheRegistry.json.cjs +1 -1
  99. package/constants/token-data/avalancheRegistry.json.mjs +51 -48
  100. package/constants/token-data/avalancheRegistryFixed.json.cjs +1 -1
  101. package/constants/token-data/avalancheRegistryFixed.json.mjs +51 -48
  102. package/constants/token-data/baseRegistry.json.cjs +1 -1
  103. package/constants/token-data/baseRegistry.json.mjs +34 -31
  104. package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
  105. package/constants/token-data/baseRegistryFixed.json.mjs +31 -28
  106. package/constants/token-data/bnbMainnetRegistry.json.cjs +1 -1
  107. package/constants/token-data/bnbMainnetRegistry.json.mjs +67 -64
  108. package/constants/token-data/bnbMainnetRegistryFixed.json.cjs +1 -1
  109. package/constants/token-data/bnbMainnetRegistryFixed.json.mjs +67 -64
  110. package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
  111. package/constants/token-data/ethMainnetRegistry.json.mjs +229 -226
  112. package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
  113. package/constants/token-data/ethMainnetRegistryFixed.json.mjs +193 -190
  114. package/constants/token-data/index.cjs +1 -0
  115. package/constants/token-data/index.d.ts +1063 -15
  116. package/constants/token-data/index.mjs +34 -0
  117. package/constants/token-data/localhostRegistry.json.cjs +1 -1
  118. package/constants/token-data/localhostRegistry.json.mjs +296 -276
  119. package/constants/token-data/optimismRegistry.json.cjs +1 -1
  120. package/constants/token-data/optimismRegistry.json.mjs +703 -180
  121. package/constants/token-data/optimismRegistryFixed.json.cjs +1 -1
  122. package/constants/token-data/optimismRegistryFixed.json.mjs +679 -173
  123. package/constants/token-data/polygonRegistry.json.cjs +1 -1
  124. package/constants/token-data/polygonRegistry.json.mjs +110 -107
  125. package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
  126. package/constants/token-data/polygonRegistryFixed.json.mjs +102 -99
  127. package/constants/token.limits.constants.cjs +1 -0
  128. package/constants/token.limits.constants.d.ts +5 -0
  129. package/constants/token.limits.constants.mjs +30 -0
  130. package/constants/vite.constants.cjs +1 -1
  131. package/constants/vite.constants.d.ts +5 -0
  132. package/constants/vite.constants.mjs +26 -22
  133. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  134. package/data-structures/Hinkal/Hinkal.d.ts +48 -20
  135. package/data-structures/Hinkal/Hinkal.mjs +263 -85
  136. package/data-structures/Hinkal/IHinkal.d.ts +37 -10
  137. package/data-structures/Hinkal/hinkalActionBeefy.cjs +1 -1
  138. package/data-structures/Hinkal/hinkalActionBeefy.mjs +25 -23
  139. package/data-structures/Hinkal/hinkalActionConvex.cjs +1 -1
  140. package/data-structures/Hinkal/hinkalActionConvex.mjs +11 -9
  141. package/data-structures/Hinkal/hinkalActionCurve.cjs +1 -1
  142. package/data-structures/Hinkal/hinkalActionCurve.mjs +18 -16
  143. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
  144. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +3 -0
  145. package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +61 -0
  146. package/data-structures/Hinkal/hinkalActionLidoEth.cjs +1 -1
  147. package/data-structures/Hinkal/hinkalActionLidoEth.mjs +24 -22
  148. package/data-structures/Hinkal/hinkalActionPendle.cjs +1 -1
  149. package/data-structures/Hinkal/hinkalActionPendle.d.ts +1 -1
  150. package/data-structures/Hinkal/hinkalActionPendle.mjs +17 -15
  151. package/data-structures/Hinkal/hinkalActionPendleLP.cjs +1 -1
  152. package/data-structures/Hinkal/hinkalActionPendleLP.mjs +29 -26
  153. package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -0
  154. package/data-structures/Hinkal/hinkalActionReceive.d.ts +4 -0
  155. package/data-structures/Hinkal/hinkalActionReceive.mjs +39 -0
  156. package/data-structures/Hinkal/hinkalActionStake.cjs +1 -1
  157. package/data-structures/Hinkal/hinkalActionStake.d.ts +1 -1
  158. package/data-structures/Hinkal/hinkalActionStake.mjs +15 -11
  159. package/data-structures/Hinkal/hinkalActionVolatile.cjs +1 -1
  160. package/data-structures/Hinkal/hinkalActionVolatile.d.ts +1 -1
  161. package/data-structures/Hinkal/hinkalActionVolatile.mjs +31 -26
  162. package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
  163. package/data-structures/Hinkal/hinkalApprove.d.ts +2 -0
  164. package/data-structures/Hinkal/hinkalApprove.mjs +120 -0
  165. package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -0
  166. package/data-structures/Hinkal/hinkalCheckTokenRegistry.d.ts +3 -0
  167. package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +12 -0
  168. package/data-structures/Hinkal/hinkalDeploySubAccount.cjs +1 -0
  169. package/data-structures/Hinkal/hinkalDeploySubAccount.d.ts +3 -0
  170. package/data-structures/Hinkal/hinkalDeploySubAccount.mjs +15 -0
  171. package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  172. package/data-structures/Hinkal/hinkalDeposit.d.ts +3 -2
  173. package/data-structures/Hinkal/hinkalDeposit.mjs +116 -52
  174. package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -0
  175. package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +2 -0
  176. package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +10 -0
  177. package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
  178. package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +6 -17
  179. package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
  180. package/data-structures/Hinkal/hinkalInsideTransact.d.ts +2 -0
  181. package/data-structures/Hinkal/hinkalInsideTransact.mjs +111 -0
  182. package/data-structures/Hinkal/hinkalMultiSend.cjs +1 -0
  183. package/data-structures/Hinkal/hinkalMultiSend.d.ts +3 -0
  184. package/data-structures/Hinkal/hinkalMultiSend.mjs +13 -0
  185. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  186. package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -1
  187. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +83 -37
  188. package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -0
  189. package/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +4 -0
  190. package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +46 -0
  191. package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -0
  192. package/data-structures/Hinkal/hinkalProxySwap.d.ts +5 -0
  193. package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -0
  194. package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -0
  195. package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +3 -0
  196. package/data-structures/Hinkal/hinkalSignSubAccount.mjs +20 -0
  197. package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  198. package/data-structures/Hinkal/hinkalSwap.d.ts +2 -1
  199. package/data-structures/Hinkal/hinkalSwap.mjs +69 -60
  200. package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  201. package/data-structures/Hinkal/hinkalWithdraw.d.ts +3 -1
  202. package/data-structures/Hinkal/hinkalWithdraw.mjs +77 -50
  203. package/data-structures/Hinkal/index.d.ts +1 -0
  204. package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  205. package/data-structures/Hinkal/resetMerkleTrees.mjs +18 -11
  206. package/data-structures/IndexedDB/activity-db.cjs +1 -0
  207. package/data-structures/IndexedDB/activity-db.d.ts +16 -0
  208. package/data-structures/IndexedDB/activity-db.mjs +124 -0
  209. package/data-structures/IndexedDB/balances-db.cjs +1 -0
  210. package/data-structures/IndexedDB/balances-db.d.ts +13 -0
  211. package/data-structures/IndexedDB/balances-db.mjs +75 -0
  212. package/data-structures/IndexedDB/contact-db.cjs +1 -0
  213. package/data-structures/IndexedDB/contact-db.d.ts +11 -0
  214. package/data-structures/IndexedDB/contact-db.mjs +44 -0
  215. package/data-structures/IndexedDB/index.d.ts +5 -0
  216. package/data-structures/IndexedDB/prices-db.cjs +1 -0
  217. package/data-structures/IndexedDB/prices-db.d.ts +9 -0
  218. package/data-structures/IndexedDB/prices-db.mjs +62 -0
  219. package/data-structures/IndexedDB/private-balances-db.cjs +1 -0
  220. package/data-structures/IndexedDB/private-balances-db.d.ts +9 -0
  221. package/data-structures/IndexedDB/private-balances-db.mjs +28 -0
  222. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
  223. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +47 -44
  224. package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -0
  225. package/data-structures/TokenDBs/PrivateTokensDB.d.ts +11 -0
  226. package/data-structures/TokenDBs/PrivateTokensDB.mjs +53 -0
  227. package/data-structures/TokenDBs/PublicTokensDB.cjs +1 -0
  228. package/data-structures/TokenDBs/PublicTokensDB.d.ts +13 -0
  229. package/data-structures/TokenDBs/PublicTokensDB.mjs +81 -0
  230. package/data-structures/TokenDBs/index.d.ts +2 -0
  231. package/data-structures/cacheDevices/AttachableMemoryCacheDevice.cjs +1 -0
  232. package/data-structures/cacheDevices/AttachableMemoryCacheDevice.d.ts +8 -0
  233. package/data-structures/cacheDevices/AttachableMemoryCacheDevice.mjs +28 -0
  234. package/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
  235. package/data-structures/cacheDevices/BaseCacheDevice.d.ts +9 -6
  236. package/data-structures/cacheDevices/BaseCacheDevice.mjs +13 -4
  237. package/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
  238. package/data-structures/cacheDevices/FileCacheDevice.d.ts +1 -0
  239. package/data-structures/cacheDevices/FileCacheDevice.mjs +7 -3
  240. package/data-structures/cacheDevices/LocalStorageCacheDevice.cjs +1 -1
  241. package/data-structures/cacheDevices/LocalStorageCacheDevice.d.ts +2 -1
  242. package/data-structures/cacheDevices/LocalStorageCacheDevice.mjs +10 -5
  243. package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
  244. package/data-structures/crypto-keys/decodeUTXO.mjs +13 -12
  245. package/data-structures/crypto-keys/keys.cjs +1 -1
  246. package/data-structures/crypto-keys/keys.d.ts +13 -3
  247. package/data-structures/crypto-keys/keys.mjs +45 -34
  248. package/data-structures/custom-token-registry/CustomTokenRegistry.cjs +1 -1
  249. package/data-structures/custom-token-registry/CustomTokenRegistry.d.ts +2 -3
  250. package/data-structures/custom-token-registry/CustomTokenRegistry.mjs +17 -21
  251. package/data-structures/event-service/AbstractAccessTokenSnapshotService.cjs +1 -1
  252. package/data-structures/event-service/AbstractAccessTokenSnapshotService.mjs +15 -29
  253. package/data-structures/event-service/AbstractApprovalsSnapshotService.cjs +1 -0
  254. package/data-structures/event-service/AbstractApprovalsSnapshotService.d.ts +30 -0
  255. package/data-structures/event-service/AbstractApprovalsSnapshotService.mjs +104 -0
  256. package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +1 -1
  257. package/data-structures/event-service/AbstractCommitmentsSnapshotService.mjs +24 -37
  258. package/data-structures/event-service/AbstractEventService.cjs +1 -1
  259. package/data-structures/event-service/AbstractEventService.d.ts +1 -1
  260. package/data-structures/event-service/AbstractEventService.mjs +15 -15
  261. package/data-structures/event-service/index.d.ts +1 -0
  262. package/data-structures/index.d.ts +2 -0
  263. package/data-structures/merkle-tree/MerkleTree.cjs +1 -1
  264. package/data-structures/merkle-tree/MerkleTree.d.ts +6 -1
  265. package/data-structures/merkle-tree/MerkleTree.mjs +79 -65
  266. package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs +1 -0
  267. package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.ts +3 -0
  268. package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs +13 -0
  269. package/data-structures/merkle-tree/index.d.ts +1 -0
  270. package/data-structures/provider-adapter/IProviderAdapter.d.ts +2 -0
  271. package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
  272. package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +3 -2
  273. package/data-structures/snapshot/ClientApprovalsSnapshotService.cjs +1 -0
  274. package/data-structures/snapshot/ClientApprovalsSnapshotService.d.ts +8 -0
  275. package/data-structures/snapshot/ClientApprovalsSnapshotService.mjs +23 -0
  276. package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +1 -1
  277. package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +3 -2
  278. package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
  279. package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +6 -5
  280. package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
  281. package/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -0
  282. package/data-structures/token-price-fetcher/TokenChecker.mjs +4 -2
  283. package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
  284. package/data-structures/transactions-manager/TransactionsManager.d.ts +8 -6
  285. package/data-structures/transactions-manager/TransactionsManager.mjs +124 -122
  286. package/data-structures/transactions-manager/history/getBeefyData.cjs +1 -1
  287. package/data-structures/transactions-manager/history/getBeefyData.mjs +3 -2
  288. package/data-structures/transactions-manager/history/getConvexData.cjs +1 -1
  289. package/data-structures/transactions-manager/history/getConvexData.mjs +3 -2
  290. package/data-structures/transactions-manager/history/getCurveData.cjs +1 -1
  291. package/data-structures/transactions-manager/history/getCurveData.mjs +3 -2
  292. package/data-structures/transactions-manager/history/getLidoData.cjs +1 -1
  293. package/data-structures/transactions-manager/history/getLidoData.mjs +3 -2
  294. package/data-structures/transactions-manager/history/getPendleData.cjs +1 -1
  295. package/data-structures/transactions-manager/history/getPendleData.mjs +13 -12
  296. package/data-structures/transactions-manager/history/getTxDetails.cjs +1 -1
  297. package/data-structures/transactions-manager/history/getTxDetails.mjs +22 -20
  298. package/data-structures/transactions-manager/history/getVolatileData.cjs +1 -1
  299. package/data-structures/transactions-manager/history/getVolatileData.mjs +11 -10
  300. package/data-structures/transactions-manager/history/history.types.cjs +1 -1
  301. package/data-structures/transactions-manager/history/history.types.mjs +4 -2
  302. package/data-structures/utxo/Utxo.cjs +1 -1
  303. package/data-structures/utxo/Utxo.d.ts +3 -3
  304. package/data-structures/utxo/Utxo.mjs +8 -7
  305. package/error-handling/error-codes.constants.cjs +2 -2
  306. package/error-handling/error-codes.constants.d.ts +22 -1
  307. package/error-handling/error-codes.constants.mjs +129 -112
  308. package/error-handling/get-error.message.cjs +1 -1
  309. package/error-handling/get-error.message.mjs +29 -25
  310. package/error-handling/index.d.ts +1 -0
  311. package/error-handling/logger.cjs +1 -0
  312. package/error-handling/logger.d.ts +5 -0
  313. package/error-handling/logger.mjs +16 -0
  314. package/error-handling/types.cjs +1 -1
  315. package/error-handling/types.d.ts +3 -1
  316. package/error-handling/types.mjs +2 -2
  317. package/externalABIs/BabPassport.json.cjs +1 -1
  318. package/externalABIs/BabPassport.json.mjs +8 -3
  319. package/externalABIs/BeefyRouterAbi.json.cjs +1 -1
  320. package/externalABIs/BeefyRouterAbi.json.mjs +5 -2
  321. package/externalABIs/BeefyStrategyAbi.json.cjs +1 -1
  322. package/externalABIs/BeefyStrategyAbi.json.mjs +5 -2
  323. package/externalABIs/BeefyVaultAbi.json.cjs +1 -1
  324. package/externalABIs/BeefyVaultAbi.json.mjs +5 -2
  325. package/externalABIs/BeefyZapAbi.json.cjs +1 -1
  326. package/externalABIs/BeefyZapAbi.json.mjs +5 -2
  327. package/externalABIs/BeefyZapOneInchAbi.json.cjs +1 -1
  328. package/externalABIs/BeefyZapOneInchAbi.json.mjs +5 -2
  329. package/externalABIs/ConvexBoosterAbi.json.cjs +1 -1
  330. package/externalABIs/ConvexBoosterAbi.json.mjs +5 -2
  331. package/externalABIs/ConvexBoosterAbiMainnet.json.cjs +1 -1
  332. package/externalABIs/ConvexBoosterAbiMainnet.json.mjs +5 -2
  333. package/externalABIs/ConvexRewardPoolAbi.json.cjs +1 -1
  334. package/externalABIs/ConvexRewardPoolAbi.json.mjs +5 -2
  335. package/externalABIs/CurveReadingWrapperAbi.json.cjs +1 -1
  336. package/externalABIs/CurveReadingWrapperAbi.json.mjs +5 -2
  337. package/externalABIs/CurveWrappedMainPool.json.cjs +1 -1
  338. package/externalABIs/CurveWrappedMainPool.json.mjs +5 -2
  339. package/externalABIs/CurveZap.json.cjs +1 -1
  340. package/externalABIs/CurveZap.json.mjs +5 -2
  341. package/externalABIs/CvxCrvUtilities.json.cjs +1 -1
  342. package/externalABIs/CvxCrvUtilities.json.mjs +5 -2
  343. package/externalABIs/ERC20.json.cjs +1 -1
  344. package/externalABIs/ERC20.json.mjs +20 -3
  345. package/externalABIs/GalxePassport.json.cjs +1 -1
  346. package/externalABIs/GalxePassport.json.mjs +8 -3
  347. package/externalABIs/IQuoterV2.json.cjs +1 -1
  348. package/externalABIs/IQuoterV2.json.mjs +20 -3
  349. package/externalABIs/ISwapRouter.json.cjs +1 -1
  350. package/externalABIs/ISwapRouter.json.mjs +5 -2
  351. package/externalABIs/IUniswapV3Factory.json.cjs +1 -1
  352. package/externalABIs/IUniswapV3Factory.json.mjs +20 -3
  353. package/externalABIs/IUniswapV3Pool.json.cjs +1 -1
  354. package/externalABIs/IUniswapV3Pool.json.mjs +20 -3
  355. package/externalABIs/PendleRouterAbi.json.cjs +1 -1
  356. package/externalABIs/PendleRouterAbi.json.mjs +5 -2
  357. package/externalABIs/UniswapV2PoolAbi.json.cjs +1 -1
  358. package/externalABIs/UniswapV2PoolAbi.json.mjs +16 -3
  359. package/externalABIs/index.cjs +1 -0
  360. package/externalABIs/index.d.ts +307 -11
  361. package/externalABIs/index.mjs +23 -0
  362. package/externalABIs/transactionsProver.json.cjs +1 -1
  363. package/externalABIs/transactionsProver.json.mjs +20 -3
  364. package/functions/kyc/zkMeHelper.cjs +1 -1
  365. package/functions/kyc/zkMeHelper.d.ts +0 -1
  366. package/functions/kyc/zkMeHelper.mjs +8 -11
  367. package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -0
  368. package/functions/pre-transaction/getExternalSwapAddress.d.ts +3 -0
  369. package/functions/pre-transaction/getExternalSwapAddress.mjs +26 -0
  370. package/functions/pre-transaction/getFeeStructure.cjs +1 -0
  371. package/functions/pre-transaction/getFeeStructure.d.ts +4 -0
  372. package/functions/pre-transaction/getFeeStructure.mjs +30 -0
  373. package/functions/pre-transaction/getFlatFees.cjs +1 -1
  374. package/functions/pre-transaction/getFlatFees.d.ts +3 -7
  375. package/functions/pre-transaction/getFlatFees.mjs +52 -46
  376. package/functions/pre-transaction/getSignatureDataForTransact.cjs +1 -0
  377. package/functions/pre-transaction/getSignatureDataForTransact.d.ts +3 -0
  378. package/functions/pre-transaction/getSignatureDataForTransact.mjs +6 -0
  379. package/functions/pre-transaction/index.d.ts +1 -0
  380. package/functions/pre-transaction/interaction-to-action.cjs +1 -1
  381. package/functions/pre-transaction/interaction-to-action.mjs +3 -2
  382. package/functions/pre-transaction/merge-with-fee-structure.cjs +1 -0
  383. package/functions/pre-transaction/merge-with-fee-structure.d.ts +2 -0
  384. package/functions/pre-transaction/merge-with-fee-structure.mjs +25 -0
  385. package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -0
  386. package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +16 -0
  387. package/functions/pre-transaction/outputApprovalDataProcessing.mjs +42 -0
  388. package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
  389. package/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
  390. package/functions/pre-transaction/outputUtxoProcessing.mjs +19 -30
  391. package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
  392. package/functions/pre-transaction/process-gas-estimates.d.ts +2 -2
  393. package/functions/pre-transaction/process-gas-estimates.mjs +17 -27
  394. package/functions/pre-transaction/processAmountChanges.cjs +1 -1
  395. package/functions/pre-transaction/processAmountChanges.mjs +34 -23
  396. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -0
  397. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +6 -0
  398. package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +7 -0
  399. package/functions/private-wallet/emporium.helpers.cjs +1 -1
  400. package/functions/private-wallet/emporium.helpers.d.ts +9 -1
  401. package/functions/private-wallet/emporium.helpers.mjs +117 -22
  402. package/functions/private-wallet/emporium.swap.helpers.cjs +1 -0
  403. package/functions/private-wallet/emporium.swap.helpers.d.ts +5 -0
  404. package/functions/private-wallet/emporium.swap.helpers.mjs +92 -0
  405. package/functions/private-wallet/index.d.ts +1 -0
  406. package/functions/private-wallet/opProducer.cjs +1 -1
  407. package/functions/private-wallet/opProducer.mjs +9 -10
  408. package/functions/private-wallet/smartContractWalletCalculator.cjs +1 -1
  409. package/functions/private-wallet/smartContractWalletCalculator.d.ts +5 -1
  410. package/functions/private-wallet/smartContractWalletCalculator.mjs +22 -17
  411. package/functions/protocols/convex.protocols.cjs +1 -1
  412. package/functions/protocols/convex.protocols.mjs +11 -8
  413. package/functions/protocols/pendle.helpers.cjs +1 -1
  414. package/functions/protocols/pendle.helpers.mjs +20 -15
  415. package/functions/snarkjs/common.snarkjs.cjs +1 -1
  416. package/functions/snarkjs/common.snarkjs.d.ts +8 -5
  417. package/functions/snarkjs/common.snarkjs.mjs +177 -87
  418. package/functions/snarkjs/constant.cjs +1 -1
  419. package/functions/snarkjs/constant.d.ts +223 -1
  420. package/functions/snarkjs/constant.mjs +315 -94
  421. package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
  422. package/functions/snarkjs/constructEmporiumProof.d.ts +6 -3
  423. package/functions/snarkjs/constructEmporiumProof.mjs +148 -84
  424. package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
  425. package/functions/snarkjs/constructGeneralZkProof.d.ts +5 -3
  426. package/functions/snarkjs/constructGeneralZkProof.mjs +142 -86
  427. package/functions/snarkjs/generateCircomData.cjs +1 -1
  428. package/functions/snarkjs/generateCircomData.d.ts +3 -2
  429. package/functions/snarkjs/generateCircomData.mjs +33 -35
  430. package/functions/snarkjs/generateZkProof.cjs +1 -1
  431. package/functions/snarkjs/generateZkProof.d.ts +2 -2
  432. package/functions/snarkjs/generateZkProof.mjs +4 -15
  433. package/functions/snarkjs/generateZkProofEnclave.cjs +1 -0
  434. package/functions/snarkjs/generateZkProofEnclave.d.ts +6 -0
  435. package/functions/snarkjs/generateZkProofEnclave.mjs +26 -0
  436. package/functions/snarkjs/generateZkProofSelf.cjs +1 -0
  437. package/functions/snarkjs/generateZkProofSelf.d.ts +5 -0
  438. package/functions/snarkjs/generateZkProofSelf.mjs +17 -0
  439. package/functions/snarkjs/getOriginalSender.cjs +1 -0
  440. package/functions/snarkjs/getOriginalSender.d.ts +1 -0
  441. package/functions/snarkjs/getOriginalSender.mjs +5 -0
  442. package/functions/snarkjs/getZKFiles.cjs +1 -1
  443. package/functions/snarkjs/getZKFiles.d.ts +3 -2
  444. package/functions/snarkjs/getZKFiles.mjs +14 -5
  445. package/functions/utils/addresses.cjs +1 -0
  446. package/functions/utils/addresses.d.ts +4 -0
  447. package/functions/utils/addresses.mjs +20 -0
  448. package/functions/utils/amounts.utils.cjs +1 -1
  449. package/functions/utils/amounts.utils.d.ts +4 -1
  450. package/functions/utils/amounts.utils.mjs +29 -27
  451. package/functions/utils/arraysMatch.cjs +1 -0
  452. package/functions/utils/arraysMatch.d.ts +1 -0
  453. package/functions/utils/arraysMatch.mjs +4 -0
  454. package/functions/utils/axelar.utils.cjs +1 -1
  455. package/functions/utils/axelar.utils.d.ts +1 -0
  456. package/functions/utils/axelar.utils.mjs +32 -9
  457. package/functions/utils/cacheDevice.utils.cjs +1 -1
  458. package/functions/utils/cacheDevice.utils.mjs +11 -8
  459. package/functions/utils/cacheFunctions.cjs +1 -1
  460. package/functions/utils/cacheFunctions.d.ts +10 -7
  461. package/functions/utils/cacheFunctions.mjs +62 -39
  462. package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -0
  463. package/functions/utils/convertEmporiumOpToCallInfo.d.ts +2 -0
  464. package/functions/utils/convertEmporiumOpToCallInfo.mjs +10 -0
  465. package/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
  466. package/functions/utils/convertIntegrationProviderToExternalActionId.d.ts +2 -1
  467. package/functions/utils/convertIntegrationProviderToExternalActionId.mjs +7 -10
  468. package/functions/utils/encodeTokenWithId.cjs +1 -0
  469. package/functions/utils/encodeTokenWithId.d.ts +2 -0
  470. package/functions/utils/encodeTokenWithId.mjs +4 -0
  471. package/functions/utils/encryptInputForEnclave.cjs +1 -0
  472. package/functions/utils/encryptInputForEnclave.d.ts +8 -0
  473. package/functions/utils/encryptInputForEnclave.mjs +43 -0
  474. package/functions/utils/erc20tokenFunctions.cjs +1 -1
  475. package/functions/utils/erc20tokenFunctions.d.ts +8 -2
  476. package/functions/utils/erc20tokenFunctions.mjs +23 -14
  477. package/functions/utils/evmNetworkFunctions.cjs +1 -1
  478. package/functions/utils/evmNetworkFunctions.mjs +7 -4
  479. package/functions/utils/external-action.utils.d.ts +2 -2
  480. package/functions/utils/fees.utils.cjs +1 -0
  481. package/functions/utils/fees.utils.d.ts +2 -0
  482. package/functions/utils/fees.utils.mjs +14 -0
  483. package/functions/utils/getBlockExplorerUrl.cjs +1 -0
  484. package/functions/utils/getBlockExplorerUrl.d.ts +1 -0
  485. package/functions/utils/getBlockExplorerUrl.mjs +6 -0
  486. package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -0
  487. package/functions/utils/getRecipientInfoFromUserKeys.d.ts +3 -0
  488. package/functions/utils/getRecipientInfoFromUserKeys.mjs +18 -0
  489. package/functions/utils/index.d.ts +12 -0
  490. package/functions/utils/involves-permit2-op.cjs +1 -0
  491. package/functions/utils/involves-permit2-op.d.ts +1 -0
  492. package/functions/utils/involves-permit2-op.mjs +5 -0
  493. package/functions/utils/merkleTree.utils.cjs +1 -0
  494. package/functions/utils/merkleTree.utils.d.ts +2 -0
  495. package/functions/utils/merkleTree.utils.mjs +19 -0
  496. package/functions/utils/prepareHinkal.d.ts +6 -0
  497. package/functions/utils/processUseApprovalUtxoData.cjs +1 -0
  498. package/functions/utils/processUseApprovalUtxoData.d.ts +3 -0
  499. package/functions/utils/processUseApprovalUtxoData.mjs +19 -0
  500. package/functions/utils/publicBalance.utils.cjs +1 -0
  501. package/functions/utils/publicBalance.utils.d.ts +5 -0
  502. package/functions/utils/publicBalance.utils.mjs +25 -0
  503. package/functions/utils/replaceAddressInCalldata.cjs +1 -0
  504. package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
  505. package/functions/utils/replaceAddressInCalldata.mjs +7 -0
  506. package/functions/utils/rpc-int-encode.cjs +1 -0
  507. package/functions/utils/rpc-int-encode.d.ts +2 -0
  508. package/functions/utils/rpc-int-encode.mjs +8 -0
  509. package/functions/utils/serialize.utils.cjs +1 -1
  510. package/functions/utils/serialize.utils.d.ts +1 -0
  511. package/functions/utils/serialize.utils.mjs +3 -2
  512. package/functions/utils/string.utils.cjs +1 -1
  513. package/functions/utils/string.utils.d.ts +2 -0
  514. package/functions/utils/string.utils.mjs +28 -14
  515. package/functions/utils/time.utils.cjs +1 -1
  516. package/functions/utils/time.utils.d.ts +1 -0
  517. package/functions/utils/time.utils.mjs +4 -3
  518. package/functions/utils/token-check.utils.cjs +1 -0
  519. package/functions/utils/token-check.utils.d.ts +1 -0
  520. package/functions/utils/token-check.utils.mjs +10 -0
  521. package/functions/utils/upToDateState.cjs +1 -0
  522. package/functions/utils/upToDateState.d.ts +2 -0
  523. package/functions/utils/upToDateState.mjs +11 -0
  524. package/functions/utils/userAgent.cjs +1 -1
  525. package/functions/utils/userAgent.mjs +8 -8
  526. package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -0
  527. package/functions/web3/events/balanceChangedCustomHandler.d.ts +2 -0
  528. package/functions/web3/events/balanceChangedCustomHandler.mjs +14 -0
  529. package/functions/web3/events/balanceChangedHandler.cjs +1 -1
  530. package/functions/web3/events/balanceChangedHandler.mjs +5 -4
  531. package/functions/web3/events/getApprovedBalance.cjs +1 -0
  532. package/functions/web3/events/getApprovedBalance.d.ts +7 -0
  533. package/functions/web3/events/getApprovedBalance.mjs +80 -0
  534. package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  535. package/functions/web3/events/getInputUtxoAndBalance.d.ts +16 -3
  536. package/functions/web3/events/getInputUtxoAndBalance.mjs +128 -46
  537. package/functions/web3/events/getShieldedBalance.cjs +2 -2
  538. package/functions/web3/events/getShieldedBalance.d.ts +1 -1
  539. package/functions/web3/events/getShieldedBalance.mjs +70 -65
  540. package/functions/web3/events/index.d.ts +2 -0
  541. package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
  542. package/functions/web3/functionCalls/accessTokenCalls.d.ts +2 -2
  543. package/functions/web3/functionCalls/accessTokenCalls.mjs +20 -18
  544. package/functions/web3/functionCalls/approveToken.cjs +1 -1
  545. package/functions/web3/functionCalls/approveToken.mjs +8 -7
  546. package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -0
  547. package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +4 -0
  548. package/functions/web3/functionCalls/approveTokensToHinkal.mjs +11 -0
  549. package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
  550. package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -2
  551. package/functions/web3/functionCalls/estimateGasRelayer.mjs +14 -8
  552. package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
  553. package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
  554. package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +32 -0
  555. package/functions/web3/functionCalls/relayFunctions.d.ts +1 -15
  556. package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
  557. package/functions/web3/functionCalls/transactCallDirect.d.ts +2 -2
  558. package/functions/web3/functionCalls/transactCallDirect.mjs +31 -30
  559. package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  560. package/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
  561. package/functions/web3/functionCalls/transactCallRelayer.mjs +32 -9
  562. package/functions/web3/getContractMetadata.cjs +1 -0
  563. package/functions/web3/getContractMetadata.d.ts +5 -0
  564. package/functions/web3/getContractMetadata.mjs +30 -0
  565. package/functions/web3/odosAPI.cjs +1 -1
  566. package/functions/web3/odosAPI.d.ts +1 -2
  567. package/functions/web3/odosAPI.mjs +23 -19
  568. package/functions/web3/oneInchAPI.cjs +1 -1
  569. package/functions/web3/oneInchAPI.d.ts +1 -2
  570. package/functions/web3/oneInchAPI.mjs +20 -15
  571. package/functions/web3/runContractFunction.cjs +1 -1
  572. package/functions/web3/runContractFunction.mjs +3 -2
  573. package/functions/web3/uniswapAPI.cjs +1 -1
  574. package/functions/web3/uniswapAPI.d.ts +4 -4
  575. package/functions/web3/uniswapAPI.mjs +57 -43
  576. package/index.cjs +1 -1
  577. package/index.mjs +761 -639
  578. package/package.json +19 -8
  579. package/providers/EthersProviderAdapter.cjs +1 -1
  580. package/providers/EthersProviderAdapter.d.ts +8 -3
  581. package/providers/EthersProviderAdapter.mjs +52 -43
  582. package/providers/WagmiProviderAdapter.cjs +1 -1
  583. package/providers/WagmiProviderAdapter.d.ts +4 -1
  584. package/providers/WagmiProviderAdapter.mjs +53 -56
  585. package/providers/prepareEthersHinkal.cjs +1 -1
  586. package/providers/prepareEthersHinkal.mjs +18 -10
  587. package/providers/prepareWagmiHinkal.cjs +1 -1
  588. package/providers/prepareWagmiHinkal.mjs +18 -10
  589. package/types/API.types.d.ts +21 -0
  590. package/types/ICacheDevice.d.ts +4 -3
  591. package/types/TransactionSimulator.types.d.ts +9 -0
  592. package/types/activities.types.cjs +1 -0
  593. package/types/activities.types.d.ts +45 -0
  594. package/types/activities.types.mjs +13 -0
  595. package/types/balances.types.cjs +1 -0
  596. package/types/balances.types.d.ts +17 -0
  597. package/types/balances.types.mjs +4 -0
  598. package/types/cache.types.cjs +1 -0
  599. package/types/cache.types.d.ts +27 -0
  600. package/types/cache.types.mjs +4 -0
  601. package/types/circom-data.types.d.ts +29 -9
  602. package/types/commitments.types.d.ts +6 -0
  603. package/types/contacts.types.d.ts +5 -0
  604. package/types/crypto.types.d.ts +1 -0
  605. package/types/earlyAccessCode.types.d.ts +4 -0
  606. package/types/ethereum-network.types.cjs +1 -1
  607. package/types/ethereum-network.types.d.ts +8 -3
  608. package/types/ethereum-network.types.mjs +1 -1
  609. package/types/external-action.types.cjs +1 -1
  610. package/types/external-action.types.d.ts +2 -1
  611. package/types/external-action.types.mjs +1 -1
  612. package/types/fee.types.d.ts +9 -0
  613. package/types/hinkal.types.cjs +1 -1
  614. package/types/hinkal.types.d.ts +48 -0
  615. package/types/hinkal.types.mjs +38 -13
  616. package/types/index.d.ts +9 -0
  617. package/types/kyc.types.cjs +1 -1
  618. package/types/kyc.types.d.ts +1 -1
  619. package/types/kyc.types.mjs +1 -1
  620. package/types/remote-proof.types.d.ts +15 -0
  621. package/types/rewards.types.d.ts +9 -0
  622. package/types/sandbox.types.cjs +1 -0
  623. package/types/sandbox.types.d.ts +157 -0
  624. package/types/sandbox.types.mjs +4 -0
  625. package/types/tenderly.api.types.d.ts +180 -0
  626. package/types/time.types.cjs +1 -1
  627. package/types/time.types.mjs +1 -1
  628. package/types/token-with-id.types.d.ts +4 -0
  629. package/types/token.types.d.ts +23 -0
  630. package/types/transactions.types.cjs +1 -1
  631. package/types/transactions.types.d.ts +31 -0
  632. package/types/transactions.types.mjs +8 -5
  633. package/types/wc.types.d.ts +89 -0
  634. package/types/with-id.types.d.ts +3 -0
  635. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  636. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  637. package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
  638. package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +26 -26
  639. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  640. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  641. package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
  642. package/webworker/utxoWorker/utxoWorkerLogic.mjs +58 -50
  643. package/webworker/viteWorkerURL.constant.cjs +3 -3
  644. package/webworker/viteWorkerURL.constant.mjs +3 -3
  645. package/webworker/workerFactory.cjs +1 -1
  646. package/webworker/workerFactory.mjs +2 -2
  647. package/webworker/workerProxy.cjs +1 -1
  648. package/webworker/workerProxy.d.ts +11 -11
  649. package/webworker/workerProxy.mjs +24 -26
  650. package/webworker/zkProofWorker/zkProofWorker.types.d.ts +2 -0
  651. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  652. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
  653. package/webworker/zkProofWorker/zkProofWorkerLogic.cjs +1 -1
  654. package/webworker/zkProofWorker/zkProofWorkerLogic.mjs +47 -61
  655. package/functions/utils/memoize.utils.cjs +0 -1
  656. package/functions/utils/memoize.utils.mjs +0 -14
@@ -1,43 +1,45 @@
1
1
  import { getAmountAfterRelayAndFlatFees as I, getAmountAfterRelayAndFlatFeesAndSlippage as N, getAmountAfterSlippage as L } from "../../constants/fees.constants.mjs";
2
2
  import { FeeOverTransactionValueError as S } from "../../error-handling/customErrors/FeeOverTransactionValueError.mjs";
3
- import { absBigInt as W } from "../utils/amounts.utils.mjs";
3
+ import { absBigInt as R } from "../utils/amounts.utils.mjs";
4
4
  import "ethers";
5
+ import "../../error-handling/error-codes.constants.mjs";
5
6
  import "axios";
6
7
  import "../../constants/chains.constants.mjs";
7
8
  import "../../constants/vite.constants.mjs";
8
- import { isBeefyDeposit as R } from "../../types/beefy.types.mjs";
9
+ import { isBeefyDeposit as W } from "../../types/beefy.types.mjs";
9
10
  import "../../types/circom-data.types.mjs";
10
11
  import { INTERACTION as c } from "../../types/hinkal.types.mjs";
11
- import { SlippageType as b } from "../../types/slippage.types.mjs";
12
+ import { SlippageType as _ } from "../../types/slippage.types.mjs";
12
13
  import "../../types/transactions.types.mjs";
13
14
  import "../../types/curve.types.mjs";
15
+ import "../../types/activities.types.mjs";
14
16
  import "circomlibjs-hinkal-fork";
15
17
  import "libsodium-wrappers";
16
18
  import "process";
17
19
  import "buffer";
18
20
  import "../../constants/reorg-depths.constants.mjs";
19
- import { getInteractionFromAction as d } from "./interaction-to-action.mjs";
21
+ import { getInteractionFromAction as w } from "./interaction-to-action.mjs";
20
22
  const p = (D, r, E) => {
21
- const T = W(D) - r;
23
+ const T = R(D) - r;
22
24
  if (r < 0n)
23
25
  throw new S({
24
26
  totalFeeWEI: T,
25
27
  feeUnit: E
26
28
  });
27
29
  return r;
28
- }, l = ({
30
+ }, F = ({
29
31
  erc20Addresses: D = [],
30
32
  amountChanges: r,
31
33
  flatFees: E,
32
34
  feeUnit: A,
33
35
  externalActionId: T,
34
- action: i,
35
- gasTokenAddress: w
36
+ action: P,
37
+ gasTokenAddress: O
36
38
  }) => {
37
- const P = d(T, i);
38
- if (P === c.NONE)
39
+ const i = w(T, P);
40
+ if (i === c.NONE)
39
41
  throw Error("No interaction was choosen");
40
- switch (P) {
42
+ switch (i) {
41
43
  case c.WITHDRAW: {
42
44
  p(
43
45
  r[0],
@@ -49,7 +51,7 @@ const p = (D, r, E) => {
49
51
  case c.SWAP: {
50
52
  r[1] = p(
51
53
  r[1],
52
- N(r[1], E[1], b.Swap),
54
+ N(r[1], E[1], _.Swap),
53
55
  A
54
56
  );
55
57
  break;
@@ -58,18 +60,18 @@ const p = (D, r, E) => {
58
60
  const k = r.length - 1;
59
61
  r[k] = p(
60
62
  r[k],
61
- N(r[k], E[k], b.CurveDeposit),
63
+ N(r[k], E[k], _.CurveDeposit),
62
64
  A
63
65
  );
64
66
  break;
65
67
  }
66
68
  case c.CURVE_WITHDRAW:
67
- E.forEach((k, _) => {
68
- k > 0n ? r[_] = p(
69
- r[_],
70
- N(r[_], k, b.CurveWithdraw),
69
+ E.forEach((k, b) => {
70
+ k > 0n ? r[b] = p(
71
+ r[b],
72
+ N(r[b], k, _.CurveWithdraw),
71
73
  A
72
- ) : k === 0n && r[_] > 0n && _ !== E.length - 1 && (r[_] = L(r[_], b.CurveWithdraw));
74
+ ) : k === 0n && r[b] > 0n && b !== E.length - 1 && (r[b] = L(r[b], _.CurveWithdraw));
73
75
  });
74
76
  break;
75
77
  case c.CURVE_WITHDRAW_INBALANCED:
@@ -96,13 +98,13 @@ const p = (D, r, E) => {
96
98
  );
97
99
  break;
98
100
  case c.BEEFY: {
99
- const k = R(i) ? 1 : 0;
101
+ const k = W(P) ? 1 : 0;
100
102
  r[k] = p(
101
103
  r[k],
102
104
  N(
103
105
  r[k],
104
106
  E[k],
105
- b.Beefy
107
+ _.Beefy
106
108
  ),
107
109
  A
108
110
  );
@@ -195,10 +197,10 @@ const p = (D, r, E) => {
195
197
  );
196
198
  break;
197
199
  case c.PENDLE_LP: {
198
- const k = r.findIndex((_) => _ > 0n);
200
+ const k = r.findIndex((b) => b > 0n);
199
201
  r[k] = p(
200
202
  r[k],
201
- N(r[k], E[k], b.Pendle)
203
+ N(r[k], E[k], _.Pendle)
202
204
  );
203
205
  break;
204
206
  }
@@ -209,9 +211,18 @@ const p = (D, r, E) => {
209
211
  A
210
212
  );
211
213
  break;
214
+ case c.EMPORIUM:
215
+ E.forEach((k, b) => {
216
+ k > 0 && (r[b] = p(
217
+ r[b],
218
+ r[b] - k,
219
+ A
220
+ ));
221
+ });
222
+ break;
212
223
  }
213
224
  return r;
214
225
  };
215
226
  export {
216
- l as processAmountChanges
227
+ F as processAmountChanges
217
228
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=async(e,t,o)=>{const c=await e.checkTokenRegistry(t,o),s=await e.checkAccessToken();return{patchAccessTokenMerkleTree:c&&!s,hasAccessToken:s,kycRequired:c}};exports.shouldPatchAccessTokenMerkleTree=r;
@@ -0,0 +1,6 @@
1
+ import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
2
+ export declare const shouldPatchAccessTokenMerkleTree: (hinkal: IHinkal, erc20Addresses: string[], amountChanges: bigint[]) => Promise<{
3
+ patchAccessTokenMerkleTree: boolean;
4
+ hasAccessToken: boolean;
5
+ kycRequired: boolean;
6
+ }>;
@@ -0,0 +1,7 @@
1
+ const k = async (e, o, t) => {
2
+ const c = await e.checkTokenRegistry(o, t), s = await e.checkAccessToken();
3
+ return { patchAccessTokenMerkleTree: c && !s, hasAccessToken: s, kycRequired: c };
4
+ };
5
+ export {
6
+ k as shouldPatchAccessTokenMerkleTree
7
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),f=({contract:t,func:r,args:a,callDataString:i,invokeWallet:l,value:y})=>{let s=new Uint8Array,o=i?e.utils.arrayify(i):new Uint8Array;if(typeof t=="object"&&"address"in t){if(s=e.utils.arrayify(t.address),i?.length&&i?.length>0)throw Error("If function and args are providedm no calldata is needed");r&&a&&!i&&(o=e.utils.arrayify(t.interface.encodeFunctionData(r,a)))}else s=e.utils.arrayify(t);const n=e.utils.arrayify([l?1:0]),u=e.utils.zeroPad(e.utils.arrayify(e.BigNumber.from(y??0n)),16),d=e.utils.concat([s,n,u,o]);return e.utils.hexlify(d)},m=(t,r)=>e.utils.defaultAbiCoder.encode(["tuple(bytes32 walletSalt, bytes[] ops)"],[{walletSalt:r??e.utils.hexlify(new Uint8Array(32)),ops:t}]);exports.emporiumOp=f;exports.encodeEmporiumMetadata=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("ethers"),q=require("../../constants/protocol.constants.cjs"),y=require("../../types/ethereum-network.types.cjs");require("../../constants/contracts.constants.cjs");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../../data-structures/crypto-keys/keys.cjs");require("idb-keyval");require("../utils/external-action.utils.cjs");require("../../constants/token-data/index.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("../../types/circom-data.types.cjs");require("../../constants/vite.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("axios");require("../../constants/chains.constants.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../utils/userAgent.cjs");const E=require("../utils/string.utils.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const O=require("../utils/replaceAddressInCalldata.cjs"),v=require("./smartContractWalletCalculator.cjs"),l=({contract:r,func:e,args:o,callDataString:t,invokeWallet:a,value:i})=>{let c=new Uint8Array,d=t?n.utils.arrayify(t):new Uint8Array;if(typeof r=="object"&&"address"in r){if(c=n.utils.arrayify(r.address),t?.length&&t?.length>0)throw Error("If function and args are providedm no calldata is needed");e&&o&&!t&&(d=n.utils.arrayify(r.interface.encodeFunctionData(e,o)))}else c=n.utils.arrayify(r);const f=n.utils.arrayify([a?1:0]),m=n.utils.zeroPad(n.utils.arrayify(n.BigNumber.from(i??0n)),16),u=n.utils.concat([c,f,m,d]);return n.utils.hexlify(u)},F=(r,e,o)=>n.utils.defaultAbiCoder.encode(["tuple(bytes32 walletSalt, uint256 replayProtection, bytes[] ops)"],[{walletSalt:e??n.utils.hexlify(new Uint8Array(32)),replayProtection:o??0n,ops:r}]),h=(r,e,o,t,a)=>{if(e===q.zeroAddress)return l({contract:o,callDataString:"",value:t,invokeWallet:a});const i=r.getContractWithFetcher(y.ContractType.ERC20Contract,e);return l({contract:i,func:"transfer",args:[o,t],invokeWallet:a})},C=(r,e,o,t,a)=>{if(e===q.zeroAddress)throw new Error("can't approve native token");const i=r.getContractWithFetcher(y.ContractType.ERC20Contract,e);return l({contract:i,func:"approve",args:[o,t],invokeWallet:a})},A=(r,e,o,t)=>{const a=r.getContractWithFetcher(y.ContractType.HinkalContract);return h(r,e,t??a.address,o,!0)},w=(r,e,o,t)=>e.map((a,i)=>A(r,a,o[i],t)),g=(r,e,o)=>{const t=r.getSelectedNetwork()?.contractData.hinkalAddress;if(!t)throw Error("No Hinkal Address Provided to modifyDataForProxy");return E.replaceAllInstances(o,t.slice(2),e.slice(2))},P=async(r,e,o)=>{if(!e)throw Error("No Nonce Provided to modifyDataForProxy");const t=await v.calculateSmartContractWalletAddressFromNonce(r.getCurrentChainId(),r.userKeys,e);return g(r,t,o)},T=(r,e,o,t,a,i,c,d,f)=>{const m=r.getContractWithFetcher(y.ContractType.HinkalContract),u=[];for(let s=0;s<e.length;s+=1){const p=e[s];u.push(h(r,p,i,o[s],!1))}for(let s=0;s<t.length;s+=1){const p=t[s];p!==q.zeroAddress&&u.push(C(r,p,c,a[s],!0))}return u.push(l({contract:c,callDataString:O.replaceAddressesInCalldata(d,m.address,i),value:f,invokeWallet:!0})),u};exports.createApproveEmporiumOp=C;exports.createTransaferEmporiumOpsBatch=w;exports.createTransferEmporiumOp=A;exports.createTransferToEmporiumOp=h;exports.emporiumOp=l;exports.encodeEmporiumMetadata=F;exports.generateFundApproveAndTransactOps=T;exports.modifyDataForProxy=g;exports.modifyDataForProxyWithNonce=P;
@@ -1,4 +1,5 @@
1
1
  import { Contract, ContractTransaction } from 'ethers';
2
+ import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
2
3
  export declare const emporiumOp: <ContractInstance extends Contract, ContractFunctions extends ContractInstance["functions"], ExactFunction extends { [K in keyof ContractFunctions]: ReturnType<ContractFunctions[K]> extends Promise<ContractTransaction> ? K : never; }[keyof ContractFunctions], FunctionArguments extends Parameters<ContractFunctions[ExactFunction]>>({ contract, func, args, callDataString, invokeWallet, value, }: {
3
4
  contract: ContractInstance | string;
4
5
  func?: ExactFunction | undefined;
@@ -7,4 +8,11 @@ export declare const emporiumOp: <ContractInstance extends Contract, ContractFun
7
8
  invokeWallet?: boolean | undefined;
8
9
  value?: bigint | undefined;
9
10
  }) => string;
10
- export declare const encodeEmporiumMetadata: (ops: string[], walletSalt?: string) => string;
11
+ export declare const encodeEmporiumMetadata: (ops: string[], walletSalt?: string, replayProtection?: bigint) => string;
12
+ export declare const createTransferToEmporiumOp: (hinkal: IHinkal, erc20TokenAddress: string, to: string, amount: bigint, invokeWallet: boolean) => string;
13
+ export declare const createApproveEmporiumOp: (hinkal: IHinkal, erc20TokenAddress: string, to: string, amount: bigint, invokeWallet: boolean) => string;
14
+ export declare const createTransferEmporiumOp: (hinkal: IHinkal, erc20TokenAddress: string, amount: bigint, to?: string) => string;
15
+ export declare const createTransaferEmporiumOpsBatch: (hinkal: IHinkal, erc20TokenAddresses: string[], amounts: bigint[], to?: string) => string[];
16
+ export declare const modifyDataForProxy: (hinkal: IHinkal, userAddress: string, data: string) => string;
17
+ export declare const modifyDataForProxyWithNonce: (hinkal: IHinkal, nonce: bigint | undefined, data: string) => Promise<string>;
18
+ export declare const generateFundApproveAndTransactOps: (hinkal: IHinkal, erc20AddressesToFund: string[], fundAmounts: bigint[], approveTokenAddresses: string[], approveAmounts: bigint[], walletAddress: string, to: string, callDataString: string, value: bigint) => string[];
@@ -1,31 +1,126 @@
1
- import { utils as e, BigNumber as p } from "ethers";
2
- const u = ({
3
- contract: r,
4
- func: a,
5
- args: i,
6
- callDataString: t,
7
- invokeWallet: n,
8
- value: d
1
+ import { utils as n, BigNumber as g } from "ethers";
2
+ import { zeroAddress as h } from "../../constants/protocol.constants.mjs";
3
+ import { ContractType as l } from "../../types/ethereum-network.types.mjs";
4
+ import "../../constants/contracts.constants.mjs";
5
+ import "circomlibjs-hinkal-fork";
6
+ import "../../error-handling/error-codes.constants.mjs";
7
+ import "../../data-structures/crypto-keys/keys.mjs";
8
+ import "idb-keyval";
9
+ import "../utils/external-action.utils.mjs";
10
+ import "../../constants/token-data/index.mjs";
11
+ import "../utils/convertIntegrationProviderToExternalActionId.mjs";
12
+ import "../../types/circom-data.types.mjs";
13
+ import "../../constants/vite.constants.mjs";
14
+ import "../../types/transactions.types.mjs";
15
+ import "../../types/curve.types.mjs";
16
+ import "../../types/activities.types.mjs";
17
+ import "axios";
18
+ import "../../constants/chains.constants.mjs";
19
+ import "libsodium-wrappers";
20
+ import "process";
21
+ import "buffer";
22
+ import "../../constants/reorg-depths.constants.mjs";
23
+ import "../../constants/kyc.constants.mjs";
24
+ import "../../constants/coingecko.constants.mjs";
25
+ import "../../constants/axelar.constants.mjs";
26
+ import "../../constants/rewards.constants.mjs";
27
+ import "../../constants/addresses.constants.mjs";
28
+ import "../../constants/token.limits.constants.mjs";
29
+ import "../utils/userAgent.mjs";
30
+ import { replaceAllInstances as A } from "../utils/string.utils.mjs";
31
+ import "../../data-structures/volatile-helper/VolatileHelper.mjs";
32
+ import { replaceAddressesInCalldata as w } from "../utils/replaceAddressInCalldata.mjs";
33
+ import { calculateSmartContractWalletAddressFromNonce as E } from "./smartContractWalletCalculator.mjs";
34
+ const f = ({
35
+ contract: t,
36
+ func: r,
37
+ args: e,
38
+ callDataString: o,
39
+ invokeWallet: a,
40
+ value: i
9
41
  }) => {
10
- let y = new Uint8Array(), o = t ? e.arrayify(t) : new Uint8Array();
11
- if (typeof r == "object" && "address" in r) {
12
- if (y = e.arrayify(r.address), t?.length && t?.length > 0)
42
+ let p = new Uint8Array(), m = o ? n.arrayify(o) : new Uint8Array();
43
+ if (typeof t == "object" && "address" in t) {
44
+ if (p = n.arrayify(t.address), o?.length && o?.length > 0)
13
45
  throw Error("If function and args are providedm no calldata is needed");
14
- a && i && !t && (o = e.arrayify(r.interface.encodeFunctionData(a, i)));
46
+ r && e && !o && (m = n.arrayify(t.interface.encodeFunctionData(r, e)));
15
47
  } else
16
- y = e.arrayify(r);
17
- const s = e.arrayify([n ? 1 : 0]), f = e.zeroPad(e.arrayify(p.from(d ?? 0n)), 16), l = e.concat([y, s, f, o]);
18
- return e.hexlify(l);
19
- }, w = (r, a) => e.defaultAbiCoder.encode(
20
- ["tuple(bytes32 walletSalt, bytes[] ops)"],
48
+ p = n.arrayify(t);
49
+ const y = n.arrayify([a ? 1 : 0]), u = n.zeroPad(n.arrayify(g.from(i ?? 0n)), 16), s = n.concat([p, y, u, m]);
50
+ return n.hexlify(s);
51
+ }, at = (t, r, e) => n.defaultAbiCoder.encode(
52
+ ["tuple(bytes32 walletSalt, uint256 replayProtection, bytes[] ops)"],
21
53
  [
22
54
  {
23
- walletSalt: a ?? e.hexlify(new Uint8Array(32)),
24
- ops: r
55
+ walletSalt: r ?? n.hexlify(new Uint8Array(32)),
56
+ replayProtection: e ?? 0n,
57
+ ops: t
25
58
  }
26
59
  ]
27
- );
60
+ ), C = (t, r, e, o, a) => {
61
+ if (r === h)
62
+ return f({ contract: e, callDataString: "", value: o, invokeWallet: a });
63
+ const i = t.getContractWithFetcher(l.ERC20Contract, r);
64
+ return f({
65
+ contract: i,
66
+ func: "transfer",
67
+ args: [e, o],
68
+ invokeWallet: a
69
+ });
70
+ }, v = (t, r, e, o, a) => {
71
+ if (r === h)
72
+ throw new Error("can't approve native token");
73
+ const i = t.getContractWithFetcher(l.ERC20Contract, r);
74
+ return f({
75
+ contract: i,
76
+ func: "approve",
77
+ args: [e, o],
78
+ invokeWallet: a
79
+ });
80
+ }, F = (t, r, e, o) => {
81
+ const a = t.getContractWithFetcher(l.HinkalContract);
82
+ return C(t, r, o ?? a.address, e, !0);
83
+ }, nt = (t, r, e, o) => r.map((a, i) => F(t, a, e[i], o)), P = (t, r, e) => {
84
+ const o = t.getSelectedNetwork()?.contractData.hinkalAddress;
85
+ if (!o)
86
+ throw Error("No Hinkal Address Provided to modifyDataForProxy");
87
+ return A(e, o.slice(2), r.slice(2));
88
+ }, it = async (t, r, e) => {
89
+ if (!r)
90
+ throw Error("No Nonce Provided to modifyDataForProxy");
91
+ const o = await E(
92
+ t.getCurrentChainId(),
93
+ t.userKeys,
94
+ r
95
+ );
96
+ return P(t, o, e);
97
+ }, ct = (t, r, e, o, a, i, p, m, y) => {
98
+ const u = t.getContractWithFetcher(l.HinkalContract), s = [];
99
+ for (let c = 0; c < r.length; c += 1) {
100
+ const d = r[c];
101
+ s.push(C(t, d, i, e[c], !1));
102
+ }
103
+ for (let c = 0; c < o.length; c += 1) {
104
+ const d = o[c];
105
+ d !== h && s.push(v(t, d, p, a[c], !0));
106
+ }
107
+ return s.push(
108
+ f({
109
+ contract: p,
110
+ callDataString: w(m, u.address, i),
111
+ value: y,
112
+ invokeWallet: !0
113
+ })
114
+ ), s;
115
+ };
28
116
  export {
29
- u as emporiumOp,
30
- w as encodeEmporiumMetadata
117
+ v as createApproveEmporiumOp,
118
+ nt as createTransaferEmporiumOpsBatch,
119
+ F as createTransferEmporiumOp,
120
+ C as createTransferToEmporiumOp,
121
+ f as emporiumOp,
122
+ at as encodeEmporiumMetadata,
123
+ ct as generateFundApproveAndTransactOps,
124
+ P as modifyDataForProxy,
125
+ it as modifyDataForProxyWithNonce
31
126
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("ethers"),O=require("./emporium.helpers.cjs"),x=require("../../constants/addresses.constants.cjs"),I=require("../../types/external-action.types.cjs"),b=require("../../types/ethereum-network.types.cjs"),y=require("../pre-transaction/getExternalSwapAddress.cjs"),z=require("../utils/string.utils.cjs"),w=require("../../constants/protocol.constants.cjs"),q=(e,c,r,a,t,i,n=!1)=>{const p=g.BigNumber.from(i).toBigInt(),u={tokenIn:c,tokenOut:a,fee:p,recipient:t,amountIn:r,amountOutMinimum:0,sqrtPriceLimitX96:0},o=["function exactInputSingle(tuple(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)) external payable returns (uint256 amountOut)"],m=new g.ethers.Contract(e,o);return O.emporiumOp({contract:m,func:"exactInputSingle",args:[u],invokeWallet:n})},h=(e,c,r,a,t,i,n=!1)=>{const p=y.getExternalSwapAddress(e,c),u=z.replaceAllInstances(a,p.slice(2),t.slice(2));return O.emporiumOp({contract:r,callDataString:u,value:i,invokeWallet:n})},D=(e,c,r,a,t,i,n,p,u,o=!1)=>{const m=i<0n?-1n*i:i,C=p<0n?-1n*p:p,s=[],S=x.NATIVE_TOKEN_WRAPPER_ADDRESSES[e.getCurrentChainId()];let l=!1,f;if(c===I.ExternalActionId.OneInch){t!==w.zeroAddress&&s.push(O.createApproveEmporiumOp(e,t,r,m,o));const E=t===w.zeroAddress?m:void 0;return f=h(e,c,r,a,u,E,o),s.push(f),s}if(t===w.zeroAddress){const E=e.getContractWithFetcher(b.ContractType.ERC20Contract,S);s.push(O.emporiumOp({contract:E,func:"deposit",value:m,invokeWallet:o})),t=S}if(n===w.zeroAddress&&(n=S,l=!0),t!==w.zeroAddress&&s.push(O.createApproveEmporiumOp(e,t,r,m,o)),c===I.ExternalActionId.Uniswap?f=q(r,t,m,n,u,a,o):f=h(e,c,r,a,u,void 0,o),s.push(f),l){const E=["function withdraw(uint256) external"],_=new g.ethers.Contract(n,E);s.push(O.emporiumOp({contract:_,func:"withdraw",args:[C],invokeWallet:o})),n=w.zeroAddress}return s};exports.createSwapToEmporiumOpForUniswap=q;exports.createSwapToEmporiumOpFromData=h;exports.createSwapToEmporiumOps=D;
@@ -0,0 +1,5 @@
1
+ import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
2
+ import { ExternalActionId } from '../../types/external-action.types';
3
+ export declare const createSwapToEmporiumOpForUniswap: (routerAddress: string, inputTokenAddress: string, positiveAmountInput: bigint, outputTokenAddress: string, recipient: string, data: string, invokeWallet?: boolean) => string;
4
+ export declare const createSwapToEmporiumOpFromData: (hinkal: IHinkal, externalActionId: ExternalActionId, routerAddress: string, data: string, walletAddress: string, value?: bigint, invokeWallet?: boolean) => string;
5
+ export declare const createSwapToEmporiumOps: (hinkal: IHinkal, externalActionId: ExternalActionId, routerAddress: string, data: string, inputTokenAddress: string, inputAmount: bigint, outputTokenAddress: string, outputAmount: bigint, walletAddress: string, invokeWallet?: boolean) => string[];
@@ -0,0 +1,92 @@
1
+ import { BigNumber as b, ethers as x } from "ethers";
2
+ import { emporiumOp as E, createApproveEmporiumOp as S } from "./emporium.helpers.mjs";
3
+ import { NATIVE_TOKEN_WRAPPER_ADDRESSES as l } from "../../constants/addresses.constants.mjs";
4
+ import { ExternalActionId as h } from "../../types/external-action.types.mjs";
5
+ import { ContractType as R } from "../../types/ethereum-network.types.mjs";
6
+ import { getExternalSwapAddress as F } from "../pre-transaction/getExternalSwapAddress.mjs";
7
+ import { replaceAllInstances as N } from "../utils/string.utils.mjs";
8
+ import { zeroAddress as u } from "../../constants/protocol.constants.mjs";
9
+ const U = (r, a, n, m, t, e, c = !1) => {
10
+ const p = b.from(e).toBigInt(), s = {
11
+ tokenIn: a,
12
+ tokenOut: m,
13
+ fee: p,
14
+ recipient: t,
15
+ amountIn: n,
16
+ amountOutMinimum: 0,
17
+ sqrtPriceLimitX96: 0
18
+ }, o = [
19
+ "function exactInputSingle(tuple(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)) external payable returns (uint256 amountOut)"
20
+ ], f = new x.Contract(r, o);
21
+ return E({
22
+ contract: f,
23
+ func: "exactInputSingle",
24
+ args: [s],
25
+ invokeWallet: c
26
+ });
27
+ }, C = (r, a, n, m, t, e, c = !1) => {
28
+ const p = F(r, a), s = N(m, p.slice(2), t.slice(2));
29
+ return E({
30
+ contract: n,
31
+ callDataString: s,
32
+ value: e,
33
+ invokeWallet: c
34
+ });
35
+ }, z = (r, a, n, m, t, e, c, p, s, o = !1) => {
36
+ const f = e < 0n ? -1n * e : e, D = p < 0n ? -1n * p : p, i = [], g = l[r.getCurrentChainId()];
37
+ let I = !1, w;
38
+ if (a === h.OneInch)
39
+ return t !== u && i.push(S(r, t, n, f, o)), w = C(
40
+ r,
41
+ a,
42
+ n,
43
+ m,
44
+ s,
45
+ t === u ? f : void 0,
46
+ o
47
+ ), i.push(w), i;
48
+ if (t === u) {
49
+ const O = r.getContractWithFetcher(R.ERC20Contract, g);
50
+ i.push(
51
+ E({
52
+ contract: O,
53
+ func: "deposit",
54
+ value: f,
55
+ invokeWallet: o
56
+ })
57
+ ), t = g;
58
+ }
59
+ if (c === u && (c = g, I = !0), t !== u && i.push(S(r, t, n, f, o)), a === h.Uniswap ? w = U(
60
+ n,
61
+ t,
62
+ f,
63
+ c,
64
+ s,
65
+ m,
66
+ o
67
+ ) : w = C(
68
+ r,
69
+ a,
70
+ n,
71
+ m,
72
+ s,
73
+ void 0,
74
+ o
75
+ ), i.push(w), I) {
76
+ const O = ["function withdraw(uint256) external"], P = new x.Contract(c, O);
77
+ i.push(
78
+ E({
79
+ contract: P,
80
+ func: "withdraw",
81
+ args: [D],
82
+ invokeWallet: o
83
+ })
84
+ ), c = u;
85
+ }
86
+ return i;
87
+ };
88
+ export {
89
+ U as createSwapToEmporiumOpForUniswap,
90
+ C as createSwapToEmporiumOpFromData,
91
+ z as createSwapToEmporiumOps
92
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './emporium.helpers';
2
2
  export * from './opProducer';
3
3
  export * from './smartContractWalletCalculator';
4
+ export * from './emporium.swap.helpers';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../externalABIs/ERC20.json.cjs"),p=require("../../externalABIs/ISwapRouter.json.cjs"),b=require("ethers"),h=require("./emporium.helpers.cjs");var t=(r=>(r[r.Erc20Token=0]="Erc20Token",r[r.Uniswap=1]="Uniswap",r))(t||{});const m=(r,o,c,n,i,a)=>{let e="";switch(r){case 0:e=u.abi;break;case 1:e=p.abi;break}if(!e)throw Error("No ABI match in produceOp");const s=new b.ethers.Contract(o,e);return h.emporiumOp({contract:s,func:c,args:n,invokeWallet:i,value:a})};exports.OpType=t;exports.produceOp=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../externalABIs/index.cjs"),p=require("ethers"),d=require("./emporium.helpers.cjs");var o=(e=>(e[e.Erc20Token=0]="Erc20Token",e[e.Uniswap=1]="Uniswap",e))(o||{});const h=(e,c,n,i,s,a)=>{let r="";switch(e){case 0:r=t.ERC20ABI;break;case 1:r=t.ISwapRouterABI;break}if(!r)throw Error("No ABI match in produceOp");const u=new p.ethers.Contract(c,r);return d.emporiumOp({contract:u,func:n,args:i,invokeWallet:s,value:a})};exports.OpType=o;exports.produceOp=h;
@@ -1,24 +1,23 @@
1
- import { abi as m } from "../../externalABIs/ERC20.json.mjs";
2
- import { abi as s } from "../../externalABIs/ISwapRouter.json.mjs";
1
+ import { ISwapRouterABI as m, ERC20ABI as s } from "../../externalABIs/index.mjs";
3
2
  import { ethers as p } from "ethers";
4
- import { emporiumOp as b } from "./emporium.helpers.mjs";
5
- var f = /* @__PURE__ */ ((r) => (r[r.Erc20Token = 0] = "Erc20Token", r[r.Uniswap = 1] = "Uniswap", r))(f || {});
6
- const E = (r, t, a, i, c, e) => {
3
+ import { emporiumOp as u } from "./emporium.helpers.mjs";
4
+ var w = /* @__PURE__ */ ((r) => (r[r.Erc20Token = 0] = "Erc20Token", r[r.Uniswap = 1] = "Uniswap", r))(w || {});
5
+ const E = (r, t, e, c, a, n) => {
7
6
  let o = "";
8
7
  switch (r) {
9
8
  case 0:
10
- o = m;
9
+ o = s;
11
10
  break;
12
11
  case 1:
13
- o = s;
12
+ o = m;
14
13
  break;
15
14
  }
16
15
  if (!o)
17
16
  throw Error("No ABI match in produceOp");
18
- const n = new p.Contract(t, o);
19
- return b({ contract: n, func: a, args: i, invokeWallet: c, value: e });
17
+ const i = new p.Contract(t, o);
18
+ return u({ contract: i, func: e, args: c, invokeWallet: a, value: n });
20
19
  };
21
20
  export {
22
- f as OpType,
21
+ w as OpType,
23
22
  E as produceOp
24
23
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),l=require("../../constants/chains.constants.cjs"),u=async(s,r,t)=>{const o=await new e.ethers.providers.JsonRpcProvider(l.networkRegistry[`${s}`].fetchRpcUrl).getCode(r),n=[t],i=["address"],a=e.utils.defaultAbiCoder.encode(i,n);return o+a.slice(2)},y=async(s,r)=>{const{hinkalWalletFactoryAddress:t,hinkalWalletBeaconAddress:c}=l.networkRegistry[s].contractData;if(!t||!c||!e.utils.isAddress(t))throw new Error(`Invalid deployer address ${t}`);const o=e.utils.hexlify(e.utils.zeroPad(e.utils.arrayify(r),32)),n=`0xff${t.slice(2)}`,i=await u(s,t,c),a=e.utils.keccak256(i),d=e.utils.keccak256(`${n}${o.slice(2)}${a.slice(2)}`);return e.utils.getAddress(`0x${d.slice(-40)}`)};exports.calculateSmartContractWalletAddress=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers"),n=require("../../constants/chains.constants.cjs"),u=require("../../constants/protocol.constants.cjs"),y=require("../utils/caseInsensitive.utils.cjs"),w=require("../../types/ethereum-network.types.cjs"),g=require("../../error-handling/logger.cjs"),p=["function getWallet(bytes32 salt) external view returns (address)"],i=async(e,r)=>{const s=t.utils.hexlify(t.utils.zeroPad(t.utils.arrayify(r),32)),c=new t.ethers.providers.JsonRpcProvider(n.networkRegistry[`${e}`].fetchRpcUrl),{hinkalWalletFactoryAddress:o}=n.networkRegistry[e].contractData;if(!o)throw new Error(`Invalid deployer address ${o}`);const l=await new t.ethers.Contract(o,p,c).getWallet(s);if(!l)throw new Error("Wallet address in Wallet Factory not found");return l},h=async(e,r,s)=>i(e,r.getWalletSalt(s)),W=async(e,r)=>{const s=e.getCurrentChainId(),{userKeys:c}=e,o=c.getWalletSalt(r),a=await e.getContractWithFetcher(w.ContractType.HinkalWalletFactory).getWallet(o);g.Logger.log("check if wallet is deployed for subaccount",{walletAddress:a});const d=await new t.ethers.providers.JsonRpcProvider(n.networkRegistry[s].fetchRpcUrl).getCode(a);return!!a&&d!=="0x"&&!y.caseInsensitiveEqual(a,u.zeroAddress)};exports.calculateSmartContractWalletAddress=i;exports.calculateSmartContractWalletAddressFromNonce=h;exports.isProxyDeployed=W;
@@ -1 +1,5 @@
1
- export declare const calculateSmartContractWalletAddress: (chainId: number, salt: number) => Promise<string>;
1
+ import { UserKeys } from '../../data-structures/crypto-keys/keys';
2
+ import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
3
+ export declare const calculateSmartContractWalletAddress: (chainId: number, saltString: string) => Promise<string>;
4
+ export declare const calculateSmartContractWalletAddressFromNonce: (chainId: number, userKeys: UserKeys, walletNonce: bigint) => Promise<string>;
5
+ export declare const isProxyDeployed: (hinkal: IHinkal, walletNonce: bigint) => Promise<boolean>;
@@ -1,20 +1,25 @@
1
- import { utils as e, ethers as f } from "ethers";
2
- import { networkRegistry as l } from "../../constants/chains.constants.mjs";
3
- const p = async (s, r, t) => {
4
- const c = await new f.providers.JsonRpcProvider(l[`${s}`].fetchRpcUrl).getCode(r), d = [t], n = ["address"], a = e.defaultAbiCoder.encode(
5
- n,
6
- // Constructor argument types
7
- d
8
- // Constructor argument values
9
- );
10
- return c + a.slice(2);
11
- }, C = async (s, r) => {
12
- const { hinkalWalletFactoryAddress: t, hinkalWalletBeaconAddress: o } = l[s].contractData;
13
- if (!t || !o || !e.isAddress(t))
14
- throw new Error(`Invalid deployer address ${t}`);
15
- const c = e.hexlify(e.zeroPad(e.arrayify(r), 32)), d = `0xff${t.slice(2)}`, n = await p(s, t, o), a = e.keccak256(n), i = e.keccak256(`${d}${c.slice(2)}${a.slice(2)}`);
16
- return e.getAddress(`0x${i.slice(-40)}`);
1
+ import { utils as c, ethers as n } from "ethers";
2
+ import { networkRegistry as d } from "../../constants/chains.constants.mjs";
3
+ import { zeroAddress as p } from "../../constants/protocol.constants.mjs";
4
+ import { caseInsensitiveEqual as y } from "../utils/caseInsensitive.utils.mjs";
5
+ import { ContractType as f } from "../../types/ethereum-network.types.mjs";
6
+ import { Logger as w } from "../../error-handling/logger.mjs";
7
+ const m = ["function getWallet(bytes32 salt) external view returns (address)"], u = async (t, e) => {
8
+ const r = c.hexlify(c.zeroPad(c.arrayify(e), 32)), s = new n.providers.JsonRpcProvider(d[`${t}`].fetchRpcUrl), { hinkalWalletFactoryAddress: o } = d[t].contractData;
9
+ if (!o)
10
+ throw new Error(`Invalid deployer address ${o}`);
11
+ const l = await new n.Contract(o, m, s).getWallet(r);
12
+ if (!l)
13
+ throw new Error("Wallet address in Wallet Factory not found");
14
+ return l;
15
+ }, A = async (t, e, r) => u(t, e.getWalletSalt(r)), x = async (t, e) => {
16
+ const r = t.getCurrentChainId(), { userKeys: s } = t, o = s.getWalletSalt(e), a = await t.getContractWithFetcher(f.HinkalWalletFactory).getWallet(o);
17
+ w.log("check if wallet is deployed for subaccount", { walletAddress: a });
18
+ const i = await new n.providers.JsonRpcProvider(d[r].fetchRpcUrl).getCode(a);
19
+ return !!a && i !== "0x" && !y(a, p);
17
20
  };
18
21
  export {
19
- C as calculateSmartContractWalletAddress
22
+ u as calculateSmartContractWalletAddress,
23
+ A as calculateSmartContractWalletAddressFromNonce,
24
+ x as isProxyDeployed
20
25
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const c=r=>{switch(e.getNonLocalhostChainId(r)){case e.chainIds.polygon:return"0x4257ea7637c355f81616050cbb6a9b709fd72683";case e.chainIds.arbMainnet:return"0xb952a807345991bd529fdded05009f5e80fe8f45";case e.chainIds.ethMainnet:return"0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B";case e.chainIds.optimism:return"0x81ab7e0d570b01411fcc4afd3d50ec8c241cb74b";default:return"0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"}};exports.getCVX=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/token-data/index.cjs");const e=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");const c=r=>{switch(e.getNonLocalhostChainId(r)){case e.chainIds.polygon:return"0x4257ea7637c355f81616050cbb6a9b709fd72683";case e.chainIds.arbMainnet:return"0xb952a807345991bd529fdded05009f5e80fe8f45";case e.chainIds.ethMainnet:return"0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B";case e.chainIds.optimism:return"0x81ab7e0d570b01411fcc4afd3d50ec8c241cb74b";default:return"0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"}};exports.getCVX=c;
@@ -1,4 +1,5 @@
1
- import { getNonLocalhostChainId as o, chainIds as e } from "../../constants/chains.constants.mjs";
1
+ import "../../constants/token-data/index.mjs";
2
+ import { getNonLocalhostChainId as o, chainIds as t } from "../../constants/chains.constants.mjs";
2
3
  import "../../constants/vite.constants.mjs";
3
4
  import "../../constants/contracts.constants.mjs";
4
5
  import "../../constants/kyc.constants.mjs";
@@ -6,20 +7,22 @@ import "../../constants/coingecko.constants.mjs";
6
7
  import "../../constants/axelar.constants.mjs";
7
8
  import "../../constants/rewards.constants.mjs";
8
9
  import "../../constants/reorg-depths.constants.mjs";
9
- const p = (t) => {
10
- switch (o(t)) {
11
- case e.polygon:
10
+ import "../../constants/addresses.constants.mjs";
11
+ import "../../constants/token.limits.constants.mjs";
12
+ const D = (e) => {
13
+ switch (o(e)) {
14
+ case t.polygon:
12
15
  return "0x4257ea7637c355f81616050cbb6a9b709fd72683";
13
- case e.arbMainnet:
16
+ case t.arbMainnet:
14
17
  return "0xb952a807345991bd529fdded05009f5e80fe8f45";
15
- case e.ethMainnet:
18
+ case t.ethMainnet:
16
19
  return "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B";
17
- case e.optimism:
20
+ case t.optimism:
18
21
  return "0x81ab7e0d570b01411fcc4afd3d50ec8c241cb74b";
19
22
  default:
20
23
  return "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B";
21
24
  }
22
25
  };
23
26
  export {
24
- p as getCVX
27
+ D as getCVX
25
28
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const o=require("../../constants/server.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../utils/caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const s=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const n=require("../../types/pendle.types.cjs");require("../../types/curve.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("idb-keyval");require("../utils/external-action.utils.cjs");const c=require("../utils/erc20tokenFunctions.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("process");require("buffer");require("../utils/userAgent.cjs");require("../../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const T=require("../utils/enum.utils.cjs");function P(e){if(!e)return;const r=c.getERC20Token(e.address,e.chainId);if(!r?.isVolatile)return r}function w(e,r){if(!e||!r)return;let t;switch(r){case n.PendleAssetType.YT:t=e?.yt;break;case n.PendleAssetType.PT:t=e?.pt;break;case n.PendleAssetType.PENDLE_LP:t=e?.lp;break;case n.PendleAssetType.SY:t=e?.sy;break;default:t=void 0;break}return t}const q=(e,r,t)=>{if(i.caseInsensitiveEqual(e.yt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForYt;if(i.caseInsensitiveEqual(e.pt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForPt;if(i.caseInsensitiveEqual(e.yt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactYtForToken;if(i.caseInsensitiveEqual(e.pt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactPtForToken},F=e=>{let r;switch(e){case n.PendleSwapType.SwapExactTokenForYt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForYT;break;case n.PendleSwapType.SwapExactTokenForPt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForPt;break;case n.PendleSwapType.SwapExactYtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactYtForToken;break;case n.PendleSwapType.SwapExactPtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactPtForToken;break;default:throw new Error("Cant determine Pendle Swap Type Api Route")}return r},k=(e,r,t,a)=>{if(!T.isInEnum(s.PendleAction,e))throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");if(a)return t.findIndex(d=>d.toLowerCase()===a?.toLowerCase());const l=r.findIndex(d=>d>0n),p=r.length-1;if(r[p]<=0n)throw new Error("getTokenIndexForPendleFlatFee: Last token in amountChange is not > 0");let u=l;return(e===s.PendleAction.Mint||e===s.PendleAction.Redeem||e===s.PendleAction.PoolRemove)&&(u=l),u};exports.determinePendleSwapType=q;exports.determinePendleSwapTypeApiRoute=F;exports.erc20TokenFromPendleAsset=P;exports.getAssetTypeFromPendleMarket=w;exports.getTokenIndexForPendleFlatFee=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/token-data/index.cjs");require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const i=require("../../constants/server.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const o=require("../utils/caseInsensitive.utils.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../types/circom-data.types.cjs");const s=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const n=require("../../types/pendle.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../../data-structures/crypto-keys/keys.cjs");require("idb-keyval");require("../utils/external-action.utils.cjs");const c=require("../utils/erc20tokenFunctions.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("libsodium-wrappers");require("process");require("buffer");require("../utils/userAgent.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const T=require("../utils/enum.utils.cjs");function P(e){if(!e)return;const r=c.getERC20Token(e.address,e.chainId);if(!r?.isVolatile)return r}function q(e,r){if(!e||!r)return;let t;switch(r){case n.PendleAssetType.YT:t=e?.yt;break;case n.PendleAssetType.PT:t=e?.pt;break;case n.PendleAssetType.PENDLE_LP:t=e?.lp;break;case n.PendleAssetType.SY:t=e?.sy;break;default:t=void 0;break}return t}const w=(e,r,t)=>{if(o.caseInsensitiveEqual(e.yt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForYt;if(o.caseInsensitiveEqual(e.pt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForPt;if(o.caseInsensitiveEqual(e.yt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactYtForToken;if(o.caseInsensitiveEqual(e.pt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactPtForToken},F=e=>{let r;switch(e){case n.PendleSwapType.SwapExactTokenForYt:r=i.API_CONFIG.ROUTES.pendleSwapExactTokenForYT;break;case n.PendleSwapType.SwapExactTokenForPt:r=i.API_CONFIG.ROUTES.pendleSwapExactTokenForPt;break;case n.PendleSwapType.SwapExactYtForToken:r=i.API_CONFIG.ROUTES.pendleSwapExactYtForToken;break;case n.PendleSwapType.SwapExactPtForToken:r=i.API_CONFIG.ROUTES.pendleSwapExactPtForToken;break;default:throw new Error("Cant determine Pendle Swap Type Api Route")}return r},k=(e,r,t,a)=>{if(!T.isInEnum(s.PendleAction,e))throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");if(a)return t.findIndex(d=>d.toLowerCase()===a?.toLowerCase());const u=r.findIndex(d=>d>0n),p=r.length-1;if(r[p]<=0n)throw new Error("getTokenIndexForPendleFlatFee: Last token in amountChange is not > 0");let l=u;return(e===s.PendleAction.Mint||e===s.PendleAction.Redeem||e===s.PendleAction.PoolRemove)&&(l=u),l};exports.determinePendleSwapType=w;exports.determinePendleSwapTypeApiRoute=F;exports.erc20TokenFromPendleAsset=P;exports.getAssetTypeFromPendleMarket=q;exports.getTokenIndexForPendleFlatFee=k;