@oakagentkit/core 0.3.5 → 0.3.6

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 (517) hide show
  1. package/build/dist/api/addresses.d.ts +14 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/chain.js +1 -1
  4. package/build/dist/api/history.d.ts +2 -0
  5. package/build/dist/api/history.js +1 -1
  6. package/build/dist/api/identity-link.js +1 -1
  7. package/build/dist/api/metadata.js +1 -1
  8. package/build/dist/api/modules/beefy/boosts.js +1 -1
  9. package/build/dist/api/modules/beefy/clm.js +1 -1
  10. package/build/dist/api/modules/beefy/guard.js +1 -1
  11. package/build/dist/api/modules/beefy/index.js +1 -1
  12. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  13. package/build/dist/api/modules/beefy/management.js +1 -1
  14. package/build/dist/api/modules/beefy/vaults.js +1 -1
  15. package/build/dist/api/modules/borro/actions.js +1 -1
  16. package/build/dist/api/modules/borro/index.js +1 -1
  17. package/build/dist/api/modules/borro/liquidity.js +1 -1
  18. package/build/dist/api/modules/borro/positions.js +1 -1
  19. package/build/dist/api/modules/borro/reader.js +1 -1
  20. package/build/dist/api/modules/chop/display.js +1 -1
  21. package/build/dist/api/modules/chop/guard.js +1 -1
  22. package/build/dist/api/modules/chop/index.js +1 -1
  23. package/build/dist/api/modules/clanker/extensions.js +1 -1
  24. package/build/dist/api/modules/clanker/index.js +1 -1
  25. package/build/dist/api/modules/clanker/manage.js +1 -1
  26. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  27. package/build/dist/api/modules/clanker/protocol.js +1 -1
  28. package/build/dist/api/modules/clanker/state.js +1 -1
  29. package/build/dist/api/modules/earn/index.js +1 -1
  30. package/build/dist/api/modules/erc8004/common.js +1 -1
  31. package/build/dist/api/modules/erc8004/domain.js +1 -1
  32. package/build/dist/api/modules/erc8004/index.js +1 -1
  33. package/build/dist/api/modules/erc8004/management.js +1 -1
  34. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  35. package/build/dist/api/modules/erc8004/services.js +1 -1
  36. package/build/dist/api/modules/erc8004/thesis.js +1 -1
  37. package/build/dist/api/modules/erc8004/validation.js +1 -1
  38. package/build/dist/api/modules/fobo/index.js +1 -1
  39. package/build/dist/api/modules/fobo/intent.js +1 -1
  40. package/build/dist/api/modules/fobo/steps.js +1 -1
  41. package/build/dist/api/modules/fobo/verify.js +1 -1
  42. package/build/dist/api/modules/grove/index.js +1 -1
  43. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  44. package/build/dist/api/modules/heyresearch/index.js +1 -1
  45. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  46. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  47. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  48. package/build/dist/api/modules/hoodag/index.js +1 -1
  49. package/build/dist/api/modules/hoodag/management.js +1 -1
  50. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  51. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  52. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  53. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  54. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  55. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  56. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  57. package/build/dist/api/modules/hoodlock/index.js +1 -1
  58. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  59. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  60. package/build/dist/api/modules/hoodlock/public.js +1 -1
  61. package/build/dist/api/modules/hookr/actions.d.ts +39 -2
  62. package/build/dist/api/modules/hookr/actions.js +1 -1
  63. package/build/dist/api/modules/hookr/addons.js +1 -1
  64. package/build/dist/api/modules/hookr/agent-gate.d.ts +14 -2
  65. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  66. package/build/dist/api/modules/hookr/agent-link.d.ts +17 -0
  67. package/build/dist/api/modules/hookr/agent-link.js +1 -0
  68. package/build/dist/api/modules/hookr/api-client.d.ts +9 -0
  69. package/build/dist/api/modules/hookr/api-client.js +1 -0
  70. package/build/dist/api/modules/hookr/blocks/advisory.d.ts +41 -0
  71. package/build/dist/api/modules/hookr/blocks/advisory.js +1 -0
  72. package/build/dist/api/modules/hookr/blocks/buy-sell-block.d.ts +7 -0
  73. package/build/dist/api/modules/hookr/blocks/buy-sell-block.js +1 -0
  74. package/build/dist/api/modules/hookr/blocks/core-settings.d.ts +6 -0
  75. package/build/dist/api/modules/hookr/blocks/core-settings.js +1 -0
  76. package/build/dist/api/modules/hookr/blocks/exit-clock.d.ts +14 -0
  77. package/build/dist/api/modules/hookr/blocks/exit-clock.js +1 -0
  78. package/build/dist/api/modules/hookr/blocks/holder-pot.d.ts +30 -0
  79. package/build/dist/api/modules/hookr/blocks/holder-pot.js +1 -0
  80. package/build/dist/api/modules/hookr/blocks/managed-fee.d.ts +96 -0
  81. package/build/dist/api/modules/hookr/blocks/managed-fee.js +1 -0
  82. package/build/dist/api/modules/hookr/blocks/market-guard.d.ts +116 -0
  83. package/build/dist/api/modules/hookr/blocks/market-guard.js +1 -0
  84. package/build/dist/api/modules/hookr/blocks/market-hours-fee.d.ts +87 -0
  85. package/build/dist/api/modules/hookr/blocks/market-hours-fee.js +1 -0
  86. package/build/dist/api/modules/hookr/blocks/pay-later.d.ts +199 -0
  87. package/build/dist/api/modules/hookr/blocks/pay-later.js +1 -0
  88. package/build/dist/api/modules/hookr/blocks/sandwich-guard.d.ts +3 -0
  89. package/build/dist/api/modules/hookr/blocks/sandwich-guard.js +1 -0
  90. package/build/dist/api/modules/hookr/blocks/storm-fee.d.ts +3 -0
  91. package/build/dist/api/modules/hookr/blocks/storm-fee.js +1 -0
  92. package/build/dist/api/modules/hookr/blocks/swap-cut.d.ts +3 -0
  93. package/build/dist/api/modules/hookr/blocks/swap-cut.js +1 -0
  94. package/build/dist/api/modules/hookr/blocks/swap-reward-mint.d.ts +125 -0
  95. package/build/dist/api/modules/hookr/blocks/swap-reward-mint.js +1 -0
  96. package/build/dist/api/modules/hookr/blocks/wallet-cap.d.ts +3 -0
  97. package/build/dist/api/modules/hookr/blocks/wallet-cap.js +1 -0
  98. package/build/dist/api/modules/hookr/blocks/zap-source.d.ts +161 -0
  99. package/build/dist/api/modules/hookr/blocks/zap-source.js +1 -0
  100. package/build/dist/api/modules/hookr/blocks/zap-target.d.ts +51 -0
  101. package/build/dist/api/modules/hookr/blocks/zap-target.js +1 -0
  102. package/build/dist/api/modules/hookr/claims.d.ts +53 -0
  103. package/build/dist/api/modules/hookr/claims.js +1 -0
  104. package/build/dist/api/modules/hookr/contracts.d.ts +3 -1
  105. package/build/dist/api/modules/hookr/contracts.js +1 -1
  106. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  107. package/build/dist/api/modules/hookr/discovery.d.ts +2 -2
  108. package/build/dist/api/modules/hookr/discovery.js +1 -1
  109. package/build/dist/api/modules/hookr/fill-bounty.d.ts +2 -0
  110. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  111. package/build/dist/api/modules/hookr/gas.d.ts +48 -0
  112. package/build/dist/api/modules/hookr/gas.js +1 -0
  113. package/build/dist/api/modules/hookr/gates.d.ts +51 -0
  114. package/build/dist/api/modules/hookr/gates.js +1 -0
  115. package/build/dist/api/modules/hookr/hook-blocks.d.ts +304 -0
  116. package/build/dist/api/modules/hookr/hook-blocks.js +1 -0
  117. package/build/dist/api/modules/hookr/index.d.ts +4 -2
  118. package/build/dist/api/modules/hookr/index.js +1 -1
  119. package/build/dist/api/modules/hookr/jobs.d.ts +7 -0
  120. package/build/dist/api/modules/hookr/jobs.js +1 -0
  121. package/build/dist/api/modules/hookr/launch-options.d.ts +52 -3
  122. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  123. package/build/dist/api/modules/hookr/launch-profile.d.ts +8 -0
  124. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  125. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  126. package/build/dist/api/modules/hookr/launch.d.ts +24 -0
  127. package/build/dist/api/modules/hookr/launch.js +1 -1
  128. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  129. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  130. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  131. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  132. package/build/dist/api/modules/hookr/lp-state.d.ts +90 -2
  133. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  134. package/build/dist/api/modules/hookr/pay-later-actions.d.ts +52 -0
  135. package/build/dist/api/modules/hookr/pay-later-actions.js +1 -0
  136. package/build/dist/api/modules/hookr/pins.d.ts +5 -0
  137. package/build/dist/api/modules/hookr/pins.js +1 -1
  138. package/build/dist/api/modules/hookr/pm-liquidity.d.ts +215 -0
  139. package/build/dist/api/modules/hookr/pm-liquidity.js +1 -0
  140. package/build/dist/api/modules/hookr/public-reads.d.ts +1 -1
  141. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  142. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  143. package/build/dist/api/modules/hookr/relay.js +1 -1
  144. package/build/dist/api/modules/hookr/revenue.d.ts +4 -1
  145. package/build/dist/api/modules/hookr/revenue.js +1 -1
  146. package/build/dist/api/modules/hookr/scan.d.ts +25 -0
  147. package/build/dist/api/modules/hookr/scan.js +1 -0
  148. package/build/dist/api/modules/hookr/swap.d.ts +161 -0
  149. package/build/dist/api/modules/hookr/swap.js +1 -0
  150. package/build/dist/api/modules/kyberswap/index.js +1 -1
  151. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  152. package/build/dist/api/modules/layerbank/abi.js +1 -1
  153. package/build/dist/api/modules/layerbank/actions.js +1 -1
  154. package/build/dist/api/modules/layerbank/checks.js +1 -1
  155. package/build/dist/api/modules/layerbank/index.js +1 -1
  156. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  157. package/build/dist/api/modules/layerbank/reader.js +1 -1
  158. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  159. package/build/dist/api/modules/lighter/index.js +1 -1
  160. package/build/dist/api/modules/longbow/administration.js +1 -1
  161. package/build/dist/api/modules/longbow/analytics.js +1 -1
  162. package/build/dist/api/modules/longbow/fixed.js +1 -1
  163. package/build/dist/api/modules/longbow/index.js +1 -1
  164. package/build/dist/api/modules/longbow/nft.js +1 -1
  165. package/build/dist/api/modules/longbow/rebates.js +1 -1
  166. package/build/dist/api/modules/longbow/staking.js +1 -1
  167. package/build/dist/api/modules/meridian/index.js +1 -1
  168. package/build/dist/api/modules/meridian/markets.js +1 -1
  169. package/build/dist/api/modules/meridian/rfq.js +1 -1
  170. package/build/dist/api/modules/merkl/discovery.js +1 -1
  171. package/build/dist/api/modules/merkl/index.js +1 -1
  172. package/build/dist/api/modules/merkl/manage.js +1 -1
  173. package/build/dist/api/modules/merkl/protocol.js +1 -1
  174. package/build/dist/api/modules/morpho/allocator.js +1 -1
  175. package/build/dist/api/modules/morpho/bundles.js +1 -1
  176. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  177. package/build/dist/api/modules/morpho/index.js +1 -1
  178. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  179. package/build/dist/api/modules/morpho/midnight.js +1 -1
  180. package/build/dist/api/modules/morpho/protocol.js +1 -1
  181. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  182. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  183. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  184. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  185. package/build/dist/api/modules/netnet/card-read.js +1 -1
  186. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  187. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  188. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  189. package/build/dist/api/modules/netnet/financial.js +1 -1
  190. package/build/dist/api/modules/netnet/index.js +1 -1
  191. package/build/dist/api/modules/netnet/staking.js +1 -1
  192. package/build/dist/api/modules/orbio/index.js +1 -1
  193. package/build/dist/api/modules/orbio/positions.js +1 -1
  194. package/build/dist/api/modules/pendle/costs.js +1 -1
  195. package/build/dist/api/modules/pendle/index.js +1 -1
  196. package/build/dist/api/modules/pendle/markets.js +1 -1
  197. package/build/dist/api/modules/pendle/positions.js +1 -1
  198. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  199. package/build/dist/api/modules/pendle/reader.js +1 -1
  200. package/build/dist/api/modules/pendle/redeem.js +1 -1
  201. package/build/dist/api/modules/pendle/trade.js +1 -1
  202. package/build/dist/api/modules/pendle/validate.js +1 -1
  203. package/build/dist/api/modules/pendle/verify.js +1 -1
  204. package/build/dist/api/modules/pons/claim.js +1 -1
  205. package/build/dist/api/modules/pons/index.js +1 -1
  206. package/build/dist/api/modules/pons/launch-status.js +1 -1
  207. package/build/dist/api/modules/pons/prices.js +1 -1
  208. package/build/dist/api/modules/pons/reads.js +1 -1
  209. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  210. package/build/dist/api/modules/pons/trade.js +1 -1
  211. package/build/dist/api/modules/poolstrade/index.js +1 -1
  212. package/build/dist/api/modules/priors/coverage.js +1 -1
  213. package/build/dist/api/modules/priors/discovery.js +1 -1
  214. package/build/dist/api/modules/priors/features.js +1 -1
  215. package/build/dist/api/modules/priors/holdings.js +1 -1
  216. package/build/dist/api/modules/priors/index.js +1 -1
  217. package/build/dist/api/modules/priors/integration.js +1 -1
  218. package/build/dist/api/modules/priors/market.js +1 -1
  219. package/build/dist/api/modules/priors/pt.js +1 -1
  220. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  221. package/build/dist/api/modules/priors/starter-line.js +1 -1
  222. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  223. package/build/dist/api/modules/raeto/index.js +1 -1
  224. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  225. package/build/dist/api/modules/relay/discovery.js +1 -1
  226. package/build/dist/api/modules/relay/inbound.js +1 -1
  227. package/build/dist/api/modules/relay/index.js +1 -1
  228. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  229. package/build/dist/api/modules/relay/reads.js +1 -1
  230. package/build/dist/api/modules/spark/actions.js +1 -1
  231. package/build/dist/api/modules/spark/details.js +1 -1
  232. package/build/dist/api/modules/spark/index.js +1 -1
  233. package/build/dist/api/modules/spark/management.js +1 -1
  234. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  235. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  236. package/build/dist/api/modules/steakhouse/index.js +1 -1
  237. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  238. package/build/dist/api/modules/steakhouse/management.js +1 -1
  239. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  240. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  241. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  242. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  243. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  244. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  245. package/build/dist/api/modules/tickerspring/index.js +1 -1
  246. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  247. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  248. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  249. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  250. package/build/dist/api/modules/tickerspring/research.js +1 -1
  251. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  252. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  253. package/build/dist/api/modules/uniswap/auction.js +1 -1
  254. package/build/dist/api/modules/uniswap/batch.js +1 -1
  255. package/build/dist/api/modules/uniswap/common.js +1 -1
  256. package/build/dist/api/modules/uniswap/fees.js +1 -1
  257. package/build/dist/api/modules/uniswap/index.js +1 -1
  258. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  259. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  260. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  261. package/build/dist/api/modules/uniswap/pools.js +1 -1
  262. package/build/dist/api/modules/uniswap/position.js +1 -1
  263. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  264. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  265. package/build/dist/api/modules/uniswap/stock-prices.d.ts +25 -0
  266. package/build/dist/api/modules/uniswap/stock-prices.js +1 -1
  267. package/build/dist/api/modules/uniswap/stocks.js +1 -1
  268. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  269. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  270. package/build/dist/api/modules/uniswap/trade.js +1 -1
  271. package/build/dist/api/modules/uniswap/v2.js +1 -1
  272. package/build/dist/api/modules/uniswap/v3.js +1 -1
  273. package/build/dist/api/modules/uniswap/v4.js +1 -1
  274. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  275. package/build/dist/api/modules/upoch/index.js +1 -1
  276. package/build/dist/api/modules/upoch/reads.js +1 -1
  277. package/build/dist/api/modules/velora/claims.js +1 -1
  278. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  279. package/build/dist/api/modules/velora/index.js +1 -1
  280. package/build/dist/api/modules/wormhole/index.js +1 -1
  281. package/build/dist/api/modules/wormhole/scan-text.d.ts +1 -1
  282. package/build/dist/api/positions.js +1 -1
  283. package/build/dist/api/pricenote.js +1 -1
  284. package/build/dist/api/prices.js +1 -1
  285. package/build/dist/api/rpc.js +1 -1
  286. package/build/dist/api/send.js +1 -1
  287. package/build/dist/api/signing-registry.js +1 -1
  288. package/build/dist/api/signing.js +1 -1
  289. package/build/dist/api/simulate.js +1 -1
  290. package/build/dist/api/swap.d.ts +2 -0
  291. package/build/dist/api/swap.js +1 -1
  292. package/build/dist/api/tokens.d.ts +9 -1
  293. package/build/dist/api/tokens.js +1 -1
  294. package/build/dist/api/tool-policy.js +1 -1
  295. package/build/dist/api/universal-router.js +1 -1
  296. package/build/dist/api/usd-estimate.js +1 -1
  297. package/build/dist/chunks/{DMDOSHV7.js → 266VIESP.js} +1 -1
  298. package/build/dist/chunks/{R66NSNNQ.js → 2BKZLF5A.js} +1 -1
  299. package/build/dist/chunks/{HFVXNKA5.js → 2BM2WX2G.js} +1 -1
  300. package/build/dist/chunks/{OY5W7ZSL.js → 2H2OZE6X.js} +1 -1
  301. package/build/dist/chunks/{E76Z2TT4.js → 2QQ5CGQI.js} +1 -1
  302. package/build/dist/chunks/{4PLLS6CT.js → 2VYA6WIN.js} +1 -1
  303. package/build/dist/chunks/{LCH6F5HT.js → 342OZP53.js} +1 -1
  304. package/build/dist/chunks/{C57DITTF.js → 3HF6WE4L.js} +1 -1
  305. package/build/dist/chunks/3M7RMROZ.js +1 -0
  306. package/build/dist/chunks/3RGED2KO.js +1 -0
  307. package/build/dist/chunks/{4HQEJHCD.js → 3XIJCHT7.js} +1 -1
  308. package/build/dist/chunks/3XY44BP5.js +1 -0
  309. package/build/dist/chunks/3YNXQ3EZ.js +1 -0
  310. package/build/dist/chunks/45QP74CE.js +1 -0
  311. package/build/dist/chunks/{SX5YNFHG.js → 4GAU3JLN.js} +1 -1
  312. package/build/dist/chunks/{Y2QADJOB.js → 4P6DRKY3.js} +1 -1
  313. package/build/dist/chunks/{W3DGFMQE.js → 4RTXP2YP.js} +1 -1
  314. package/build/dist/chunks/{QMIH6HXH.js → 4SXRXNHG.js} +1 -1
  315. package/build/dist/chunks/{ZTKT3ZQK.js → 53VBLEYS.js} +1 -1
  316. package/build/dist/chunks/{FRT6AC6M.js → 5677LZOV.js} +1 -1
  317. package/build/dist/chunks/{ADIPEGNN.js → 5AO2QPWE.js} +1 -1
  318. package/build/dist/chunks/{GQITAJVF.js → 5BPFF7NX.js} +1 -1
  319. package/build/dist/chunks/{JDHPMS7X.js → 5DWQUEBA.js} +1 -1
  320. package/build/dist/chunks/{WAKZWSHB.js → 5KKAN7XQ.js} +1 -1
  321. package/build/dist/chunks/{VVAM3EAK.js → 5N6YJFFA.js} +1 -1
  322. package/build/dist/chunks/{QIB6OMQV.js → 5O67QQIY.js} +1 -1
  323. package/build/dist/chunks/5PNFV7HH.js +1 -0
  324. package/build/dist/chunks/5RAZFRO4.js +1 -0
  325. package/build/dist/chunks/{FAH7FKUT.js → 5UWVXEPD.js} +1 -1
  326. package/build/dist/chunks/5VKVAUFQ.js +1 -0
  327. package/build/dist/chunks/5Y457HYC.js +1 -0
  328. package/build/dist/chunks/64LAWFBE.js +1 -0
  329. package/build/dist/chunks/{3BQ5XHDJ.js → 6EWSLHXL.js} +1 -1
  330. package/build/dist/chunks/{6F527FLN.js → 6HNQAYBM.js} +1 -1
  331. package/build/dist/chunks/{FUP53K6G.js → 6LDC5D2S.js} +1 -1
  332. package/build/dist/chunks/{TZ7S5KRB.js → 6QXTL65K.js} +1 -1
  333. package/build/dist/chunks/6RVAV6BB.js +1 -0
  334. package/build/dist/chunks/{WSILNJS2.js → 6STUQOFL.js} +1 -1
  335. package/build/dist/chunks/{RUHNLNVX.js → 6Y2546JA.js} +1 -1
  336. package/build/dist/chunks/{4Z3IGMU6.js → 7AYP4ATZ.js} +1 -1
  337. package/build/dist/chunks/{YGW4ODAP.js → 7EPU3XGY.js} +1 -1
  338. package/build/dist/chunks/7GL547YZ.js +1 -0
  339. package/build/dist/chunks/7JTXYMNP.js +1 -0
  340. package/build/dist/chunks/{A3BJSQ23.js → 7VU5VCTL.js} +1 -1
  341. package/build/dist/chunks/{Z7FGEWO2.js → 7WXAS54T.js} +1 -1
  342. package/build/dist/chunks/{WQ2XTDHO.js → 7X5JVF3F.js} +1 -1
  343. package/build/dist/chunks/{DRLBTB4E.js → A72ADVYF.js} +1 -1
  344. package/build/dist/chunks/{ANIF3JMV.js → AG66NM3J.js} +1 -1
  345. package/build/dist/chunks/AODUTN65.js +1 -0
  346. package/build/dist/chunks/{DBOGRUPS.js → AONO47JX.js} +1 -1
  347. package/build/dist/chunks/{JTPHZCO3.js → AQJLEG6B.js} +1 -1
  348. package/build/dist/chunks/AZBTNUXF.js +1 -0
  349. package/build/dist/chunks/{TOIKOIY6.js → B5BU645H.js} +1 -1
  350. package/build/dist/chunks/{ZX43P4BK.js → B75SS7H6.js} +1 -1
  351. package/build/dist/chunks/{GBIBRYOV.js → B7HVPHSS.js} +1 -1
  352. package/build/dist/chunks/{LT5P6PZW.js → B7WZJHIJ.js} +1 -1
  353. package/build/dist/chunks/{3A2IKFTV.js → BIFANUTV.js} +1 -1
  354. package/build/dist/chunks/BM4KHOFB.js +1 -0
  355. package/build/dist/chunks/{N65J3L2H.js → BSV65PCA.js} +1 -1
  356. package/build/dist/chunks/{ZVY7GGSP.js → BW755PNH.js} +1 -1
  357. package/build/dist/chunks/{VXCGMALF.js → BWE5PXRE.js} +1 -1
  358. package/build/dist/chunks/{7U62MMUQ.js → BY2OWKZB.js} +1 -1
  359. package/build/dist/chunks/{CNDIAF3P.js → C2H3BWN5.js} +1 -1
  360. package/build/dist/chunks/{F7MGYRPU.js → CCPG6PRL.js} +1 -1
  361. package/build/dist/chunks/{OI3N4EW4.js → CG7ABZXH.js} +1 -1
  362. package/build/dist/chunks/CJMVRV34.js +1 -0
  363. package/build/dist/chunks/CQPIR6ER.js +1 -0
  364. package/build/dist/chunks/{A4K5GXVO.js → CR7DPGI6.js} +1 -1
  365. package/build/dist/chunks/{UUF4Z6K6.js → CVVNAFUE.js} +1 -1
  366. package/build/dist/chunks/{MI5HZDMH.js → D6JOXK7Q.js} +1 -1
  367. package/build/dist/chunks/{2PS4GCOZ.js → DJRS3TR5.js} +1 -1
  368. package/build/dist/chunks/{IZFED3R2.js → DLNDJZR4.js} +1 -1
  369. package/build/dist/chunks/{MQXSCNUL.js → DPSFR3ZS.js} +1 -1
  370. package/build/dist/chunks/{LKUZAJPZ.js → DV2HVFTM.js} +1 -1
  371. package/build/dist/chunks/{NMJVQX5M.js → DWRRIFXS.js} +1 -1
  372. package/build/dist/chunks/{3ZH5SOC2.js → EFOC337C.js} +1 -1
  373. package/build/dist/chunks/EHQRAA3R.js +1 -0
  374. package/build/dist/chunks/{A4FLWHLP.js → EJIP7RBG.js} +1 -1
  375. package/build/dist/chunks/EWZFZUVF.js +1 -0
  376. package/build/dist/chunks/{OB7BFDOV.js → EYE3ZAJB.js} +1 -1
  377. package/build/dist/chunks/{MQ5F2VOK.js → EZUQMTLE.js} +1 -1
  378. package/build/dist/chunks/{O2QBSINK.js → F36IA5RI.js} +1 -1
  379. package/build/dist/chunks/{XTXXWRN2.js → F74ARK4H.js} +1 -1
  380. package/build/dist/chunks/{HPS4KOU4.js → FGGDAAHW.js} +1 -1
  381. package/build/dist/chunks/FMEO7RX7.js +1 -0
  382. package/build/dist/chunks/{FHB7QYJO.js → FN6XY6ET.js} +1 -1
  383. package/build/dist/chunks/G4IX4CYN.js +1 -0
  384. package/build/dist/chunks/G53U6Y4L.js +1 -0
  385. package/build/dist/chunks/{HDBZZOHJ.js → GBIL2I2K.js} +1 -1
  386. package/build/dist/chunks/{MJGEGNDU.js → GCFHKJIO.js} +1 -1
  387. package/build/dist/chunks/{O5QTITN6.js → GRHBE4MQ.js} +1 -1
  388. package/build/dist/chunks/GTJ6LBGB.js +1 -0
  389. package/build/dist/chunks/GV6Z3MET.js +1 -0
  390. package/build/dist/chunks/{GK3D7OKG.js → GVCNTGLC.js} +1 -1
  391. package/build/dist/chunks/GX2RCAHG.js +1 -0
  392. package/build/dist/chunks/{7TRO6MBQ.js → H5KU4DUU.js} +1 -1
  393. package/build/dist/chunks/H7ZJ7LAB.js +1 -0
  394. package/build/dist/chunks/{DCGNVMKG.js → HC3QFA5I.js} +1 -1
  395. package/build/dist/chunks/{6CKCZJ3F.js → HEQBTHFS.js} +1 -1
  396. package/build/dist/chunks/{C76D54YG.js → HGSFRN57.js} +1 -1
  397. package/build/dist/chunks/HJI7KO6F.js +1 -0
  398. package/build/dist/chunks/{KO7ANIKY.js → HNBYPHTA.js} +1 -1
  399. package/build/dist/chunks/{MSRCJ2BS.js → HPBTSJW7.js} +1 -1
  400. package/build/dist/chunks/HPO673QQ.js +1 -0
  401. package/build/dist/chunks/{4IOHSX3Z.js → HRGLFGFL.js} +1 -1
  402. package/build/dist/chunks/{DGDMRATN.js → ICHT3H3W.js} +1 -1
  403. package/build/dist/chunks/IJVBCEA2.js +1 -0
  404. package/build/dist/chunks/{N742W5KX.js → IKVRFAUP.js} +1 -1
  405. package/build/dist/chunks/IM7ZF7XZ.js +1 -0
  406. package/build/dist/chunks/{I4473OC6.js → IMD33NQS.js} +1 -1
  407. package/build/dist/chunks/IR7KDBFU.js +1 -0
  408. package/build/dist/chunks/{X24YTJST.js → IY7FWTAL.js} +1 -1
  409. package/build/dist/chunks/IYOWMW5B.js +1 -0
  410. package/build/dist/chunks/J2J73XYU.js +1 -0
  411. package/build/dist/chunks/JCS24YBB.js +1 -0
  412. package/build/dist/chunks/JQVTHPUO.js +1 -0
  413. package/build/dist/chunks/{USGMGKAG.js → JTWJT2O3.js} +1 -1
  414. package/build/dist/chunks/{W7BFM6CK.js → K4CYAWNL.js} +1 -1
  415. package/build/dist/chunks/{7VH6JQ2H.js → K5C6QBOO.js} +1 -1
  416. package/build/dist/chunks/K5OXLIPK.js +1 -0
  417. package/build/dist/chunks/{ZKBOPZH5.js → K6GECT3F.js} +1 -1
  418. package/build/dist/chunks/{6LVHN33V.js → KB2JWQZ4.js} +1 -1
  419. package/build/dist/chunks/{YW4W3LPQ.js → KHLM6NIZ.js} +1 -1
  420. package/build/dist/chunks/{OIQTZOBN.js → KKGHXNM4.js} +1 -1
  421. package/build/dist/chunks/{SUNTJ6IU.js → KYANIEPX.js} +1 -1
  422. package/build/dist/chunks/{JJSCDDQO.js → L3IAEXQR.js} +1 -1
  423. package/build/dist/chunks/{ZZ6FZGHF.js → L4UFGM7M.js} +1 -1
  424. package/build/dist/chunks/{YWVPK3DV.js → L76P6WIH.js} +1 -1
  425. package/build/dist/chunks/{QMNUB2GM.js → LBT6WR4U.js} +1 -1
  426. package/build/dist/chunks/LD3A2KLN.js +1 -0
  427. package/build/dist/chunks/{WRUTW6CG.js → LFSNAQ7V.js} +1 -1
  428. package/build/dist/chunks/{ZQPC54J5.js → LKRAUTYI.js} +1 -1
  429. package/build/dist/chunks/{23HNDJ76.js → M2SWILNG.js} +1 -1
  430. package/build/dist/chunks/{IT2JLILU.js → MFKDNAHB.js} +1 -1
  431. package/build/dist/chunks/MFQTBUSD.js +1 -0
  432. package/build/dist/chunks/{V4UJMUIB.js → MLN5KTG7.js} +1 -1
  433. package/build/dist/chunks/{S4JUFCT4.js → MSQNOK3I.js} +1 -1
  434. package/build/dist/chunks/{O4P5IQCP.js → MXI7LX2F.js} +1 -1
  435. package/build/dist/chunks/N6YNJGEF.js +1 -0
  436. package/build/dist/chunks/{DXAPKN7H.js → NLC36QHL.js} +1 -1
  437. package/build/dist/chunks/NUTTPUYJ.js +1 -0
  438. package/build/dist/chunks/{O4S6XAYV.js → O7L55XM3.js} +1 -1
  439. package/build/dist/chunks/{NAO7VWZF.js → OCIEVYPR.js} +1 -1
  440. package/build/dist/chunks/{4NBXBKOX.js → OD7CY6BY.js} +1 -1
  441. package/build/dist/chunks/{RUTSEGGD.js → OHZHQSCA.js} +1 -1
  442. package/build/dist/chunks/{E47UYYK4.js → OIGTTRN5.js} +1 -1
  443. package/build/dist/chunks/{2I7XHRTI.js → P6JE2NRA.js} +1 -1
  444. package/build/dist/chunks/PD5NXIRT.js +1 -0
  445. package/build/dist/chunks/{TXGZ6NWN.js → PG7HZIZL.js} +1 -1
  446. package/build/dist/chunks/{VREGY7E6.js → PMFR47H3.js} +1 -1
  447. package/build/dist/chunks/{PV7FEVBD.js → PXVF2SHU.js} +1 -1
  448. package/build/dist/chunks/{2FOI2625.js → Q43WPRYU.js} +1 -1
  449. package/build/dist/chunks/QAAKUIWE.js +1 -0
  450. package/build/dist/chunks/{ZXFJKW6H.js → QAVP3CWL.js} +1 -1
  451. package/build/dist/chunks/{YXXK6EPI.js → QBHY2QRC.js} +1 -1
  452. package/build/dist/chunks/{ELHRXA5U.js → QFK335LC.js} +1 -1
  453. package/build/dist/chunks/{3PHJUFU2.js → QFUSCK5C.js} +1 -1
  454. package/build/dist/chunks/{IPU656WB.js → QKH7ED6B.js} +1 -1
  455. package/build/dist/chunks/{XW3VGWXK.js → QMWHQRYC.js} +1 -1
  456. package/build/dist/chunks/{ZXRIJG6H.js → QP2B7AYX.js} +1 -1
  457. package/build/dist/chunks/{TJU644I7.js → QZ6V6J6W.js} +1 -1
  458. package/build/dist/chunks/{MDLJFCT4.js → R5Z4HPCA.js} +1 -1
  459. package/build/dist/chunks/RKJFSDGV.js +1 -0
  460. package/build/dist/chunks/RKS3M7L5.js +1 -0
  461. package/build/dist/chunks/{GDOHHXNH.js → RLX6YTNT.js} +1 -1
  462. package/build/dist/chunks/{IZP3EKKS.js → RYEQIZ2H.js} +1 -1
  463. package/build/dist/chunks/{USEF3QKG.js → S432S6NA.js} +1 -1
  464. package/build/dist/chunks/{2OVJ2BTJ.js → SEXKWYUM.js} +1 -1
  465. package/build/dist/chunks/{KKTOBXIT.js → SRYX65GZ.js} +1 -1
  466. package/build/dist/chunks/{GKUPC4DO.js → TMENUIBC.js} +1 -1
  467. package/build/dist/chunks/{BSX4LFYI.js → TNHU5UBQ.js} +1 -1
  468. package/build/dist/chunks/{PDPTJMTJ.js → TT2ST3Q3.js} +1 -1
  469. package/build/dist/chunks/TTBB6EFN.js +1 -0
  470. package/build/dist/chunks/{FRVCSDKU.js → TWVDWNTG.js} +1 -1
  471. package/build/dist/chunks/TZG7HTVM.js +1 -0
  472. package/build/dist/chunks/{OVM4QIET.js → U4MSIH4G.js} +1 -1
  473. package/build/dist/chunks/{G5AMH4IP.js → UGFRBJDQ.js} +1 -1
  474. package/build/dist/chunks/{OB3YMTDI.js → UIVOYAO2.js} +1 -1
  475. package/build/dist/chunks/{XRDLMTBJ.js → UMY6SP7C.js} +1 -1
  476. package/build/dist/chunks/UNBRUWSV.js +1 -0
  477. package/build/dist/chunks/{LGLWEGPY.js → UPX3OWKA.js} +1 -1
  478. package/build/dist/chunks/{TGXEKBLV.js → URTQNYWU.js} +1 -1
  479. package/build/dist/chunks/{4RCYYN6O.js → V7HTGO23.js} +1 -1
  480. package/build/dist/chunks/{HZSYMGJ2.js → VS7ZA4OF.js} +1 -1
  481. package/build/dist/chunks/{BJ2U2VXJ.js → VTWAVH74.js} +1 -1
  482. package/build/dist/chunks/{LZM3DO5Q.js → W5GWK72I.js} +1 -1
  483. package/build/dist/chunks/{65OITTDL.js → W73SLWBT.js} +1 -1
  484. package/build/dist/chunks/{3YH5B5NQ.js → WUONMIA2.js} +1 -1
  485. package/build/dist/chunks/{XL3W7DAQ.js → X3BB6WME.js} +1 -1
  486. package/build/dist/chunks/{XADHV2DT.js → X53QVHBC.js} +1 -1
  487. package/build/dist/chunks/{GBPB7JIB.js → XSQJOOEY.js} +1 -1
  488. package/build/dist/chunks/XUDQYSPU.js +1 -0
  489. package/build/dist/chunks/{S37D7HOK.js → XWZ5SL5Q.js} +1 -1
  490. package/build/dist/chunks/{NIWAVMDR.js → XXLQDQEX.js} +1 -1
  491. package/build/dist/chunks/{QBNASL3T.js → Y5T36EEU.js} +1 -1
  492. package/build/dist/chunks/{R73R4KN3.js → YBLJ2MCR.js} +1 -1
  493. package/build/dist/chunks/ZSGW2ZSO.js +1 -0
  494. package/build/dist/chunks/{HRAHGYNK.js → ZTNBX4VH.js} +1 -1
  495. package/package.json +1 -1
  496. package/build/dist/chunks/5H7NVE6O.js +0 -1
  497. package/build/dist/chunks/7OOCAZBE.js +0 -1
  498. package/build/dist/chunks/DFM4T6ZE.js +0 -1
  499. package/build/dist/chunks/FCVH4FYH.js +0 -1
  500. package/build/dist/chunks/GDUKZYE2.js +0 -1
  501. package/build/dist/chunks/GYPMUYB5.js +0 -1
  502. package/build/dist/chunks/J7OZLXSG.js +0 -1
  503. package/build/dist/chunks/JFC2QCMW.js +0 -1
  504. package/build/dist/chunks/M6JNGU4E.js +0 -1
  505. package/build/dist/chunks/M7OVMIIE.js +0 -1
  506. package/build/dist/chunks/MQK6OP7S.js +0 -1
  507. package/build/dist/chunks/N624NR7Y.js +0 -1
  508. package/build/dist/chunks/OSMOBKRQ.js +0 -1
  509. package/build/dist/chunks/Q3Q3YHEX.js +0 -1
  510. package/build/dist/chunks/QQD4PV64.js +0 -1
  511. package/build/dist/chunks/RN3WUJIO.js +0 -1
  512. package/build/dist/chunks/RP5VCG54.js +0 -1
  513. package/build/dist/chunks/TI727O2H.js +0 -1
  514. package/build/dist/chunks/UHIJMDD2.js +0 -1
  515. package/build/dist/chunks/W32UECOL.js +0 -1
  516. package/build/dist/chunks/WWNAGOCD.js +0 -1
  517. package/build/dist/chunks/XWC6IC5E.js +0 -1
@@ -1 +1 @@
1
- import{b as Ce,o as le}from"./GYPMUYB5.js";import{a as ue}from"./Z7FGEWO2.js";import{b as Ne}from"./SPJCSEKP.js";import{a as Ae}from"./IOYRL6AY.js";import{a as ve}from"./66F5ZH34.js";import{e as X,g as p,i as xe,n as Ie}from"./NWNYJ26T.js";import{b as A,j as Te}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as de}from"./JXOEJPJ4.js";import{decodeErrorResult as Me,decodeEventLog as ce,encodeAbiParameters as U,encodeFunctionData as C,erc20Abi as J,parseAbi as $e,parseAbiParameters as q,toHex as Be,zeroAddress as F}from"viem";var g=Te[A].poolsTrade,Y=g.liquidityLauncher.address,B=g.uerc20BeneficiaryVault.address,fe=g.universalRouter.address,ie=10n**27n,j=(1n<<128n)-1n,Se=`0x${"00".repeat(32)}`,D=63127652n,pe=100000n,ae=10000000n,Ue=2000n,me={address:ue,symbol:"ETH",decimals:18,chainId:A},h=$e(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),K=$e(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),V=[g.instantLaunchStrategyFeesOn.address,g.instantLaunchStrategyFeesOff.address];function re(l){if(l.status!=="success")throw new r("The launch receipt did not succeed.");let c=[];for(let k of l.logs){let H=V.findIndex(L=>p(L,k.address));if(H===-1||k.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let G=ce({abi:K,eventName:"TokenLaunched",data:k.data,topics:[...k.topics]}),{token:x,poolId:ee,poolKey:M,feeSplitter:te}=G.args,_=H===0?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address;if(!p(te,_)||!p(M.currency0,F)||!p(M.currency1,x)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,F))throw new r("The launch does not match the current native ETH strategy.");let ne=l.logs.filter(L=>p(L.address,g.v4PositionManager.address)).flatMap(L=>{if(L.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let O=ce({abi:K,eventName:"Transfer",data:L.data,topics:[...L.topics]}).args;return p(O.from,F)&&p(O.to,V[H])?[O.tokenId]:[]});if(ne.length!==1)throw new r("The launch receipt must identify one matching position mint.");c.push({token:x,poolId:ee,positionId:ne[0].toString(),creatorFees:H===0})}return c}function S(l){return xe(l,"Provide a valid wallet or token address.")}function P(l,c,k=!1){return Ie(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!k})}function Z(l,c,k=!1){if(k&&l===void 0)return"";if(typeof l!="string"||!k&&!l.trim()||l.length>4096)throw new r(`Provide a valid ${c}.`);return l}function he(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new r("Provide a valid launch transaction hash.");return l}function ge(l,c,k="minAmountOut"){let H=c.slippageBps??Ce;if(typeof H!="number")throw new r("Slippage must be an integer in basis points.");let G=le(l.toString(),H),x=c[k]===void 0?BigInt(G):P(c[k],k,l===0n);if(x>l||l>0n&&x===0n||x>j)throw new r("The minimum output must be positive and no larger than the simulated output.");return x}var qe=l=>{let c=l.clientFor(A),k=(e,o,n,s)=>l.unsignedTx({to:e,data:o,value:n.toString(),chainId:A,description:s}),H=e=>{throw new r(l.plainError(e))};async function G(){if(await c.getChainId()!==A)throw new r("pools.trade requires Robinhood Chain 4663.")}async function x(e,o,n){let s=await l.preview(e,o),t=s.changes.map(({token:a,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,a.decimals)} ${de(a.symbol)} (${a.address}, chain ${a.chainId})`});return{txs:e,summary:[n,s.summary,...t].join(" ")}}async function ee(){return(await c.getBlock()).timestamp+600n}function M(e,o,n,s,t,a){let d=[F,e,2500,25,F],i=[U(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,o,n,s,0n,"0x"]]),U(q("address,uint256"),[o?F:e,n]),U(q("address,address,uint256"),[o?e:F,t,0n])],m=[U(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:m,encoded:U(q("bytes,bytes[],uint256"),["0x10",m,a])}}async function te(e,o){let n=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:o,gas:Be(Ae),to:i.to,data:i.data,value:Be(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(n)||n.length!==1||!X(n[0])||!Array.isArray(n[0].calls)||n[0].calls.length!==e.length)throw new r("The output simulation returned a malformed response.");let s=n[0].calls;if(!s.slice(0,-1).every(i=>X(i)&&i.status==="0x1"&&!i.error))throw new r("A prerequisite failed during the output simulation.");let t=s.at(-1);if(!X(t)||t.status!=="0x0")throw new r("The output simulation did not return the expected minimum-output control.");let a=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:X(t.error)?t.error.data:void 0;if(typeof a!="string"||!/^0x[0-9a-fA-F]+$/.test(a))throw new r("The output simulation did not report an expected amount.");let d=Me({abi:h,data:a});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==j||d.args[1]<=0n||d.args[1]>=j)throw new r("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ne=2e3;async function L(e,o,n,s=()=>!0){let t=await c.getBlockNumber(),a=t<D?0n:(t-D)/ae+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Ue)throw new r("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(a*BigInt(V.length+(e&&!n?1:0)));let m=new Map,b=new Set;for(let u=D;u<=t&&s();u+=ae){let f=u+ae-1n>t?t:u+ae-1n,y=(await Promise.all(V.map(T=>c.getLogs({address:T,event:K[0],...o?{args:{token:o}}:{},fromBlock:u,toBlock:f,strict:!0})))).flat(),$=[...new Set(y.map(T=>T.transactionHash))].filter(T=>!T||!m.has(T));for(let T=0;T<$.length&&s();T+=8)await Promise.all($.slice(T,T+8).map(async E=>{if(!E)throw new r("A launch log is missing its transaction hash.");let R=_.get(E);R||(i(),R=await c.getTransactionReceipt({hash:E}),_.size>=ne&&_.delete(_.keys().next().value),_.set(E,R)),m.set(E,R),s()&&await n?.(R)}));if(!s())break;if(e&&!n){let T=await c.getLogs({address:B,event:K[1],args:{to:e},fromBlock:u,toBlock:f,strict:!0});for(let E of T){let R=ce({abi:K,eventName:"Transfer",data:E.data,topics:E.topics}).args;b.add(R.tokenId.toString())}}}return{receipts:[...m.values()],feeIds:b}}async function O(e){let n=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:he(e.launchTx)})]:(await L(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(re).filter(s=>e.positionId!==void 0?s.positionId===P(e.positionId,"positionId").toString():p(s.token,S(e.token)));if(n.length!==1)throw new r("No unique current-strategy launch was found. Older strategy generations are unsupported.");return n[0]}async function Ee(e,o){if(typeof e.creatorFees!="boolean")throw new r("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),F)&&!p(S(e.pair),ue))throw new r("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new r("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&P(e.supply,"supply")!==ie)throw new r("Instant Launch requires a supply of one billion tokens.");let n=S(e.feeBeneficiary);if(p(n,F)||p(n,Y))throw new r("The fee beneficiary must be a wallet other than the launcher or zero address.");let s=Z(e.name,"name"),t=Z(e.symbol,"symbol"),a=e.initialBuy===void 0?0n:P(e.initialBuy,"initialBuy",!0);if(a>j)throw new r("The initial buy exceeds uint128.");if(a===0n&&e.minAmountOut!==void 0)throw new r("A minimum output requires an initial buy.");let d=await c.readContract({address:Y,abi:h,functionName:"getGraffiti",args:[o]}),i=S(await c.readContract({address:g.uerc20Factory.address,abi:h,functionName:"getUERC20Address",args:[s,t,18,Y,d]})),m=await c.getCode({address:i});if(m&&m!=="0x")throw new r("This wallet already launched that name and symbol.");let b=U(q("(string,string,string,bytes)"),[[Z(e.description,"description",!0),Z(e.website,"website",!0),Z(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?V[0]:V[1],f=[C({abi:h,functionName:"createToken",args:[g.uerc20Factory.address,s,t,18,ie,Y,b]}),C({abi:h,functionName:"distributeToken",args:[i,{strategy:u,amount:ie,configData:U(q("address"),[n])},Se]})],y=await ee(),v=T=>{let E=[...f];if(a>0n){let R=U(q("(address,address,bytes)"),[[fe,o,M(i,!0,a,T,o,y).encoded]]);E.push(C({abi:h,functionName:"distributeWithNative",args:[g.universalRouterStrategyApp.address,R,Se,a]}))}return k(Y,C({abi:h,functionName:"multicall",args:[E]}),a,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${n}.`)},$=a>0n?ge(await te([v(j)],o),e):0n;return x([v($)],o,`Launch ${s} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${n}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${$} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Fe(e,o,n){let s=P(e.amountIn,"amountIn");if(s>j)throw new r("The trade amount exceeds uint128.");let t=S(e.token);await O(e);let a=await ee(),d=[];n||(await c.readContract({address:t,abi:J,functionName:"allowance",args:[o,g.permit2.address]})<s&&d.push(l.approval(t,g.permit2.address,s.toString(),A)),d.push(k(g.permit2.address,C({abi:h,functionName:"approve",args:[t,fe,s,Number(a)]}),0n,`Permit the exact ${s} token base units until ${a}.`)));let i=u=>[...d,k(fe,C({abi:h,functionName:"execute",args:["0x10",M(t,n,s,u,o,a).inputs,a]}),n?s:0n,`${n?"Buy":"Sell"} ${t} with minimum output ${u}.`)],m=await te(i(j),o),b=ge(m,e);return x(i(b),o,`${n?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${s}, minimum output ${b} ${n?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function we(e,o,n){let s=await O(e),t=BigInt(s.positionId),a=s.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,d=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,a))throw new r("The position is not locked in its current-strategy splitter.");if(!n)return x([k(a,C({abi:h,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],o,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(i,o))throw new r("Only the current fee NFT holder is entitled to claim.");let m=await c.readContract({address:B,abi:h,functionName:"amounts",args:[t]}),b=ge(m[0],e,"minEth");if(m[1]!==0n)throw new r("The current buy-only creator fee configuration returned unexpected token fees.");return x([k(B,C({abi:h,functionName:"claim",args:[t,b,0n]}),0n,`Claim collected ETH fees for position ${t} to ${o}.`)],o,`Claim collected fees: ${m[0]} ETH base units (18 decimals), minimum ${b}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function Le(e,o){let n=await O(e),s=S(e.to);if(p(s,F))throw new r("The token recipient cannot be the zero address.");let t=P(e.amount,"amount"),a=await oe(n.token,await c.getBlockNumber());return x([k(a.address,C({abi:J,functionName:"transfer",args:[s,t]}),0n,`Transfer exactly ${t} ${de(a.symbol)} base units to ${s}.`)],o,`Transfer ${t} token base units (token ${a.address}, decimals ${a.decimals}, chain ${a.chainId}) to ${s}. No approval; no transaction sent.`)}async function Oe(e,o){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new r("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let n=e.positionIds.map(d=>P(d,"positionId").toString());if(new Set(n).size!==n.length)throw new r("Each position ID must appear once.");let s=e.launchTxs.map(he),t=new Map;for(let[d,i]of n.entries()){let b=(await O({positionId:i,launchTx:s[d]})).creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,u=BigInt(i),f=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[u]});if(!p(f,b))throw new r("The position is not locked in its current-strategy splitter.");t.set(b,[...t.get(b)??[],u])}let a=[...t].map(([d,i])=>k(d,C({abi:h,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return x(a,o,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let Q="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function oe(e,o){let[n,s]=await Promise.all([c.readContract({address:e,abi:J,functionName:"symbol",blockNumber:o}),c.readContract({address:e,abi:J,functionName:"decimals",blockNumber:o})]);if(typeof n!="string"||!n||n.length>256||s!==18)throw new r("The current launch token returned invalid metadata.");return{address:e,symbol:n,decimals:s,chainId:A}}async function be(e,o,n,s){let t=s??await oe(e.token,n),a=await c.readContract({address:t.address,abi:J,functionName:"balanceOf",args:[o],blockNumber:n});return{token:t,amount:a.toString(),humanAmount:l.formatAmount(a.toString(),t.decimals)}}async function Pe(e,o){let n=await O(e),s=await c.getBlockNumber();return{wallet:o,...await be(n,o,s),blockNumber:s.toString(),coverage:Q}}async function He(e,o){let n=he(e.launchTx),s=await c.getTransactionReceipt({hash:n}),t=re(s);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===P(e.positionId,"positionId").toString())),!t.length)throw new r("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let a=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let m=i.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,b=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a});if(!p(b,m))throw new r("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a}),approved:await c.readContract({address:B,abi:h,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:a}),collected:await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:a})}:void 0,f=await oe(i.token,a);return{...i,token:f,custodian:b,holding:await be(i,o,a,f),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:me,amount:u.collected[0].toString()},{token:f,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:n,wallet:o,creator:s.from,blockNumber:a.toString(),launches:d,coverage:Q}}async function Re(e){let o=await c.getBlockNumber(),n=e.limit??20;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>50)throw new r("limit must be an integer from 1 to 50.");let s=e.fromBlock===void 0?o>=D+pe?o-pe+1n:D:P(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?o:P(e.toBlock,"toBlock",!0),a=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new r("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),f=BigInt(u[0]),y=BigInt(u[1]);if(e.fromBlock!==void 0&&s!==f||e.toBlock!==void 0&&t!==y)throw new r("The cursor does not match this block range.");s=f,t=y,a=Number(u[2])}if(o<D&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:D.toString(),toBlock:o.toString(),coverage:Q,predeployment:!0};if(s<D||t<s||t>o||t-s>=pe)throw new r("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:V,event:K[0],fromBlock:s,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new r("The launch feed returned an incomplete log.");if(d.sort((u,f)=>u.blockNumber===f.blockNumber?f.logIndex-u.logIndex:u.blockNumber>f.blockNumber?-1:1),a>d.length)throw new r("The browse cursor is outside the launch feed.");let i=new Map,m=[];for(let u of d.slice(a,a+n)){let f=u.transactionHash,y=i.get(f);y||(y=await c.getTransactionReceipt({hash:f}),i.set(f,y));let v=ce({abi:K,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,$=re(y).filter(T=>p(T.token,v.token)&&p(T.poolId,v.poolId));if($.length!==1)throw new r("The launch feed log does not match one verified receipt launch.");m.push({...$[0],launchTx:f,blockNumber:u.blockNumber.toString(),token:await oe($[0].token,t),creator:y.from})}let b=a+n;return{launches:m,cursor:b<d.length?`${s}:${t}:${b}`:null,fromBlock:s.toString(),toBlock:t.toString(),coverage:Q,previousToBlock:s>D?(s-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ye(e,o,n){let s=await O(e);if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let t=BigInt(s.positionId),a=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(a,g.feeSplitterFeesOn.address))throw new r("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,o))throw new r("Only the current fee NFT holder can change this entitlement.");let i=S(n?e.to:e.spender);if(p(i,B)||n&&p(i,F))throw new r("The fee NFT recipient cannot be the vault or zero address.");let m=n?C({abi:h,functionName:"safeTransferFrom",args:[o,i,t]}):C({abi:h,functionName:"approve",args:[i,t]});return x([k(B,m,0n,n?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],o,n?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function De(){return{chainId:A,instant:{supported:!0,supply:ie.toString(),decimals:18,currency:me,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:Q}}let w=e=>({type:"string",description:e}),I=e=>ve(e),se="Launched token contract address (0x + 40 hex digits).",z="Transaction hash (0x + 64 hex digits) of the token launch; lets the tool find the launch without scanning. Optional where the token or position is given.",W='Liquidity position NFT id for the launch, as a decimal string. Example: "1".',ke={chainId:{type:"integer",const:A,description:"Chain id; only 4663 (Robinhood Chain mainnet) is accepted. Optional."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage tolerance in basis points (50 = 0.5%) used to derive minimum outputs when none is given. Optional."}};function N(e,o,n,s){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...ke,...o},required:n},execute:async(t,a)=>{try{let d=new Set([...Object.keys(ke),...Object.keys(o)]);if(Object.keys(t).some(i=>!d.has(i)))throw new r("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==A)throw new r("pools.trade requires chain 4663.");if(S(a),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new r("Slippage must be an integer in basis points.");le("10000",t.slippageBps)}return await G(),await s(t,a)}catch(d){H(d)}}}}return{tools:[N("launch",{name:w("Token name, shown in wallets and explorers."),symbol:w("Token ticker symbol."),creatorFees:{type:"boolean",description:"Permanent choice; must be explicit. true enables creator fees paid to feeBeneficiary from buys; false disables them forever."},feeBeneficiary:w("Address that receives creator fees; must not be the zero address or the launcher."),pair:w("Optional pair currency; only native ETH is supported (the zero address or the native ETH sentinel)."),decimals:{type:"integer",const:18,description:"Token decimals; must be 18 for an Instant Launch."},supply:I("Total token supply in base units (18 decimals); must be 1000000000000000000000000000 = one billion tokens."),initialBuy:I('ETH to spend on an initial buy in the same transaction, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.'),minAmountOut:I('Least new tokens to receive from the initial buy, in token base units (18 decimals). Requires initialBuy. Example: "1000000000000000000" = 1 token.'),description:w("Optional token description stored in token metadata."),website:w("Optional website URL stored in token metadata."),imageUri:w("Optional image URI stored in token metadata.")},["name","symbol","creatorFees","feeBeneficiary"],Ee),...["buy","sell"].map(e=>N(e,{token:w(se),amountIn:I(e==="buy"?'ETH to spend, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.':'Tokens to sell, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),minAmountOut:I(e==="buy"?'Least tokens to receive, in token base units (18 decimals). Example: "1000000000000000000" = 1 token. Defaults from slippageBps.':'Least ETH to receive, in wei base units (18 decimals). Example: "1000000000000000" = 0.001 ETH. Defaults from slippageBps.'),launchTx:w(z)},["token","amountIn"],(o,n)=>Fe(o,n,e==="buy"))),N("collect",{positionId:I(W),launchTx:w(z)},["positionId"],(e,o)=>we(e,o,!1)),N("claim",{positionId:I(W),launchTx:w(z),minEth:I('Least ETH you must receive from the claim, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.')},["positionId"],(e,o)=>we(e,o,!0)),N("browse",{fromBlock:I("First block number of the scan range, as a decimal string. Defaults to the most recent 100000 blocks."),toBlock:I("Last block number of the scan range, as a decimal string. Defaults to the latest block."),limit:{type:"integer",minimum:1,maximum:50,description:"Launches per page, 1 to 50 (default 20)."},cursor:w("Opaque pagination cursor exactly as returned by the previous browse call.")},[],Re),N("balance",{token:w(se),launchTx:w(z)},["token"],Pe),N("status",{launchTx:w("Transaction hash (0x + 64 hex digits) of the token launch to inspect."),token:w(se),positionId:I(W)},["launchTx"],He),N("launch_options",{},[],De),N("fee_transfer",{positionId:I(W),launchTx:w(z),to:w("Address that will become the new holder of the fee NFT and its future creator fees. Use the intended address.")},["positionId","to"],(e,o)=>ye(e,o,!0)),N("fee_approve",{positionId:I(W),launchTx:w(z),spender:w("Address approved to move the fee NFT. Use the intended address.")},["positionId","spender"],(e,o)=>ye(e,o,!1)),N("transfer",{token:w(se),amount:I('Tokens to send, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),to:w("Recipient address of the tokens; must not be the zero address. Use the intended address."),launchTx:w(z)},["token","amount","to"],Le),N("collect_many",{positionIds:{type:"array",items:I(W),minItems:1,maxItems:20,description:"Position NFT ids to collect fees for, decimal strings; same order as launchTxs."},launchTxs:{type:"array",items:w("Launch transaction hash (0x + 64 hex digits) matching the position id at the same index."),minItems:1,maxItems:20,description:"Launch transaction hashes, one per position id, in the same order."}},["positionIds","launchTxs"],Oe)],positions:async(e,o)=>{S(e);let n=[],s=0,t=!0,a=o?.deepScan?2e4:6e3,d=o?.signal,i,m,b=f=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:A,assets:[],incomplete:!0,description:`${f} Checked ${s} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),u=async()=>{await G(),t&&await L(e,void 0,async f=>{s++;for(let y of re(f)){if(!t)return;let v=y.creatorFees&&p(await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(y.positionId)]}),e);if(!t)return;if(!v&&!p(f.from,e))continue;let $=v?[{token:me,amount:(await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(y.positionId)]}))[0].toString()}]:[];t&&n.push({module:"poolstrade",id:y.positionId,chainId:A,assets:$,description:`Current Instant Launch ${y.token} (18 decimals, supply 1000000000), pool ${y.poolId}; creator fees ${y.creatorFees?"on":"off"} (permanent). ${v?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>t)};try{if(d?.aborted)return[b("Pools.trade discovery was cancelled; the historical scan is incomplete.")];let f=new Promise(v=>{i=()=>{t=!1,v("aborted")},d?.addEventListener("abort",i,{once:!0}),m=setTimeout(()=>{t=!1,v("budget")},a)}),y=await Promise.race([u().then(()=>"complete"),f]);return y==="complete"?n:[...n,b(y==="aborted"?"Pools.trade discovery was cancelled; the historical scan is incomplete.":`Pools.trade global launch discovery reached its ${a} ms read budget; the historical scan is incomplete.`)]}catch(f){return[...n,b(`Pools.trade discovery could not finish: ${l.plainError(f)}`)]}finally{t=!1,m!==void 0&&clearTimeout(m),i&&d?.removeEventListener("abort",i)}}}};function Ye(l){return Ne("poolstrade",[qe(l)])}export{re as a,qe as b,Ye as c};
1
+ import{b as Ce,o as le}from"./TTBB6EFN.js";import{a as ue}from"./7WXAS54T.js";import{b as Ne}from"./SPJCSEKP.js";import{a as Ae}from"./IOYRL6AY.js";import{a as ve}from"./66F5ZH34.js";import{e as X,g as p,i as xe,n as Ie}from"./NWNYJ26T.js";import{b as A,j as Te}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{a as de}from"./JXOEJPJ4.js";import{decodeErrorResult as Me,decodeEventLog as ce,encodeAbiParameters as U,encodeFunctionData as C,erc20Abi as J,parseAbi as $e,parseAbiParameters as q,toHex as Be,zeroAddress as F}from"viem";var g=Te[A].poolsTrade,Y=g.liquidityLauncher.address,B=g.uerc20BeneficiaryVault.address,fe=g.universalRouter.address,ie=10n**27n,j=(1n<<128n)-1n,Se=`0x${"00".repeat(32)}`,D=63127652n,pe=100000n,ae=10000000n,Ue=2000n,me={address:ue,symbol:"ETH",decimals:18,chainId:A},h=$e(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),K=$e(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),V=[g.instantLaunchStrategyFeesOn.address,g.instantLaunchStrategyFeesOff.address];function re(l){if(l.status!=="success")throw new r("The launch receipt did not succeed.");let c=[];for(let k of l.logs){let H=V.findIndex(L=>p(L,k.address));if(H===-1||k.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let G=ce({abi:K,eventName:"TokenLaunched",data:k.data,topics:[...k.topics]}),{token:x,poolId:ee,poolKey:M,feeSplitter:te}=G.args,_=H===0?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address;if(!p(te,_)||!p(M.currency0,F)||!p(M.currency1,x)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,F))throw new r("The launch does not match the current native ETH strategy.");let ne=l.logs.filter(L=>p(L.address,g.v4PositionManager.address)).flatMap(L=>{if(L.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let O=ce({abi:K,eventName:"Transfer",data:L.data,topics:[...L.topics]}).args;return p(O.from,F)&&p(O.to,V[H])?[O.tokenId]:[]});if(ne.length!==1)throw new r("The launch receipt must identify one matching position mint.");c.push({token:x,poolId:ee,positionId:ne[0].toString(),creatorFees:H===0})}return c}function S(l){return xe(l,"Provide a valid wallet or token address.")}function P(l,c,k=!1){return Ie(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!k})}function Z(l,c,k=!1){if(k&&l===void 0)return"";if(typeof l!="string"||!k&&!l.trim()||l.length>4096)throw new r(`Provide a valid ${c}.`);return l}function he(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new r("Provide a valid launch transaction hash.");return l}function ge(l,c,k="minAmountOut"){let H=c.slippageBps??Ce;if(typeof H!="number")throw new r("Slippage must be an integer in basis points.");let G=le(l.toString(),H),x=c[k]===void 0?BigInt(G):P(c[k],k,l===0n);if(x>l||l>0n&&x===0n||x>j)throw new r("The minimum output must be positive and no larger than the simulated output.");return x}var qe=l=>{let c=l.clientFor(A),k=(e,o,n,s)=>l.unsignedTx({to:e,data:o,value:n.toString(),chainId:A,description:s}),H=e=>{throw new r(l.plainError(e))};async function G(){if(await c.getChainId()!==A)throw new r("pools.trade requires Robinhood Chain 4663.")}async function x(e,o,n){let s=await l.preview(e,o),t=s.changes.map(({token:a,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,a.decimals)} ${de(a.symbol)} (${a.address}, chain ${a.chainId})`});return{txs:e,summary:[n,s.summary,...t].join(" ")}}async function ee(){return(await c.getBlock()).timestamp+600n}function M(e,o,n,s,t,a){let d=[F,e,2500,25,F],i=[U(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,o,n,s,0n,"0x"]]),U(q("address,uint256"),[o?F:e,n]),U(q("address,address,uint256"),[o?e:F,t,0n])],m=[U(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:m,encoded:U(q("bytes,bytes[],uint256"),["0x10",m,a])}}async function te(e,o){let n=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:o,gas:Be(Ae),to:i.to,data:i.data,value:Be(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(n)||n.length!==1||!X(n[0])||!Array.isArray(n[0].calls)||n[0].calls.length!==e.length)throw new r("The output simulation returned a malformed response.");let s=n[0].calls;if(!s.slice(0,-1).every(i=>X(i)&&i.status==="0x1"&&!i.error))throw new r("A prerequisite failed during the output simulation.");let t=s.at(-1);if(!X(t)||t.status!=="0x0")throw new r("The output simulation did not return the expected minimum-output control.");let a=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:X(t.error)?t.error.data:void 0;if(typeof a!="string"||!/^0x[0-9a-fA-F]+$/.test(a))throw new r("The output simulation did not report an expected amount.");let d=Me({abi:h,data:a});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==j||d.args[1]<=0n||d.args[1]>=j)throw new r("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ne=2e3;async function L(e,o,n,s=()=>!0){let t=await c.getBlockNumber(),a=t<D?0n:(t-D)/ae+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Ue)throw new r("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(a*BigInt(V.length+(e&&!n?1:0)));let m=new Map,b=new Set;for(let u=D;u<=t&&s();u+=ae){let f=u+ae-1n>t?t:u+ae-1n,y=(await Promise.all(V.map(T=>c.getLogs({address:T,event:K[0],...o?{args:{token:o}}:{},fromBlock:u,toBlock:f,strict:!0})))).flat(),$=[...new Set(y.map(T=>T.transactionHash))].filter(T=>!T||!m.has(T));for(let T=0;T<$.length&&s();T+=8)await Promise.all($.slice(T,T+8).map(async E=>{if(!E)throw new r("A launch log is missing its transaction hash.");let R=_.get(E);R||(i(),R=await c.getTransactionReceipt({hash:E}),_.size>=ne&&_.delete(_.keys().next().value),_.set(E,R)),m.set(E,R),s()&&await n?.(R)}));if(!s())break;if(e&&!n){let T=await c.getLogs({address:B,event:K[1],args:{to:e},fromBlock:u,toBlock:f,strict:!0});for(let E of T){let R=ce({abi:K,eventName:"Transfer",data:E.data,topics:E.topics}).args;b.add(R.tokenId.toString())}}}return{receipts:[...m.values()],feeIds:b}}async function O(e){let n=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:he(e.launchTx)})]:(await L(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(re).filter(s=>e.positionId!==void 0?s.positionId===P(e.positionId,"positionId").toString():p(s.token,S(e.token)));if(n.length!==1)throw new r("No unique current-strategy launch was found. Older strategy generations are unsupported.");return n[0]}async function Ee(e,o){if(typeof e.creatorFees!="boolean")throw new r("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),F)&&!p(S(e.pair),ue))throw new r("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new r("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&P(e.supply,"supply")!==ie)throw new r("Instant Launch requires a supply of one billion tokens.");let n=S(e.feeBeneficiary);if(p(n,F)||p(n,Y))throw new r("The fee beneficiary must be a wallet other than the launcher or zero address.");let s=Z(e.name,"name"),t=Z(e.symbol,"symbol"),a=e.initialBuy===void 0?0n:P(e.initialBuy,"initialBuy",!0);if(a>j)throw new r("The initial buy exceeds uint128.");if(a===0n&&e.minAmountOut!==void 0)throw new r("A minimum output requires an initial buy.");let d=await c.readContract({address:Y,abi:h,functionName:"getGraffiti",args:[o]}),i=S(await c.readContract({address:g.uerc20Factory.address,abi:h,functionName:"getUERC20Address",args:[s,t,18,Y,d]})),m=await c.getCode({address:i});if(m&&m!=="0x")throw new r("This wallet already launched that name and symbol.");let b=U(q("(string,string,string,bytes)"),[[Z(e.description,"description",!0),Z(e.website,"website",!0),Z(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?V[0]:V[1],f=[C({abi:h,functionName:"createToken",args:[g.uerc20Factory.address,s,t,18,ie,Y,b]}),C({abi:h,functionName:"distributeToken",args:[i,{strategy:u,amount:ie,configData:U(q("address"),[n])},Se]})],y=await ee(),v=T=>{let E=[...f];if(a>0n){let R=U(q("(address,address,bytes)"),[[fe,o,M(i,!0,a,T,o,y).encoded]]);E.push(C({abi:h,functionName:"distributeWithNative",args:[g.universalRouterStrategyApp.address,R,Se,a]}))}return k(Y,C({abi:h,functionName:"multicall",args:[E]}),a,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${n}.`)},$=a>0n?ge(await te([v(j)],o),e):0n;return x([v($)],o,`Launch ${s} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${n}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${$} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Fe(e,o,n){let s=P(e.amountIn,"amountIn");if(s>j)throw new r("The trade amount exceeds uint128.");let t=S(e.token);await O(e);let a=await ee(),d=[];n||(await c.readContract({address:t,abi:J,functionName:"allowance",args:[o,g.permit2.address]})<s&&d.push(l.approval(t,g.permit2.address,s.toString(),A)),d.push(k(g.permit2.address,C({abi:h,functionName:"approve",args:[t,fe,s,Number(a)]}),0n,`Permit the exact ${s} token base units until ${a}.`)));let i=u=>[...d,k(fe,C({abi:h,functionName:"execute",args:["0x10",M(t,n,s,u,o,a).inputs,a]}),n?s:0n,`${n?"Buy":"Sell"} ${t} with minimum output ${u}.`)],m=await te(i(j),o),b=ge(m,e);return x(i(b),o,`${n?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${s}, minimum output ${b} ${n?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function we(e,o,n){let s=await O(e),t=BigInt(s.positionId),a=s.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,d=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,a))throw new r("The position is not locked in its current-strategy splitter.");if(!n)return x([k(a,C({abi:h,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],o,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(i,o))throw new r("Only the current fee NFT holder is entitled to claim.");let m=await c.readContract({address:B,abi:h,functionName:"amounts",args:[t]}),b=ge(m[0],e,"minEth");if(m[1]!==0n)throw new r("The current buy-only creator fee configuration returned unexpected token fees.");return x([k(B,C({abi:h,functionName:"claim",args:[t,b,0n]}),0n,`Claim collected ETH fees for position ${t} to ${o}.`)],o,`Claim collected fees: ${m[0]} ETH base units (18 decimals), minimum ${b}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function Le(e,o){let n=await O(e),s=S(e.to);if(p(s,F))throw new r("The token recipient cannot be the zero address.");let t=P(e.amount,"amount"),a=await oe(n.token,await c.getBlockNumber());return x([k(a.address,C({abi:J,functionName:"transfer",args:[s,t]}),0n,`Transfer exactly ${t} ${de(a.symbol)} base units to ${s}.`)],o,`Transfer ${t} token base units (token ${a.address}, decimals ${a.decimals}, chain ${a.chainId}) to ${s}. No approval; no transaction sent.`)}async function Oe(e,o){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new r("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let n=e.positionIds.map(d=>P(d,"positionId").toString());if(new Set(n).size!==n.length)throw new r("Each position ID must appear once.");let s=e.launchTxs.map(he),t=new Map;for(let[d,i]of n.entries()){let b=(await O({positionId:i,launchTx:s[d]})).creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,u=BigInt(i),f=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[u]});if(!p(f,b))throw new r("The position is not locked in its current-strategy splitter.");t.set(b,[...t.get(b)??[],u])}let a=[...t].map(([d,i])=>k(d,C({abi:h,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return x(a,o,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let Q="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function oe(e,o){let[n,s]=await Promise.all([c.readContract({address:e,abi:J,functionName:"symbol",blockNumber:o}),c.readContract({address:e,abi:J,functionName:"decimals",blockNumber:o})]);if(typeof n!="string"||!n||n.length>256||s!==18)throw new r("The current launch token returned invalid metadata.");return{address:e,symbol:n,decimals:s,chainId:A}}async function be(e,o,n,s){let t=s??await oe(e.token,n),a=await c.readContract({address:t.address,abi:J,functionName:"balanceOf",args:[o],blockNumber:n});return{token:t,amount:a.toString(),humanAmount:l.formatAmount(a.toString(),t.decimals)}}async function Pe(e,o){let n=await O(e),s=await c.getBlockNumber();return{wallet:o,...await be(n,o,s),blockNumber:s.toString(),coverage:Q}}async function He(e,o){let n=he(e.launchTx),s=await c.getTransactionReceipt({hash:n}),t=re(s);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===P(e.positionId,"positionId").toString())),!t.length)throw new r("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let a=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let m=i.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,b=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a});if(!p(b,m))throw new r("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a}),approved:await c.readContract({address:B,abi:h,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:a}),collected:await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:a})}:void 0,f=await oe(i.token,a);return{...i,token:f,custodian:b,holding:await be(i,o,a,f),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:me,amount:u.collected[0].toString()},{token:f,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:n,wallet:o,creator:s.from,blockNumber:a.toString(),launches:d,coverage:Q}}async function Re(e){let o=await c.getBlockNumber(),n=e.limit??20;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>50)throw new r("limit must be an integer from 1 to 50.");let s=e.fromBlock===void 0?o>=D+pe?o-pe+1n:D:P(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?o:P(e.toBlock,"toBlock",!0),a=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new r("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),f=BigInt(u[0]),y=BigInt(u[1]);if(e.fromBlock!==void 0&&s!==f||e.toBlock!==void 0&&t!==y)throw new r("The cursor does not match this block range.");s=f,t=y,a=Number(u[2])}if(o<D&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:D.toString(),toBlock:o.toString(),coverage:Q,predeployment:!0};if(s<D||t<s||t>o||t-s>=pe)throw new r("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:V,event:K[0],fromBlock:s,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new r("The launch feed returned an incomplete log.");if(d.sort((u,f)=>u.blockNumber===f.blockNumber?f.logIndex-u.logIndex:u.blockNumber>f.blockNumber?-1:1),a>d.length)throw new r("The browse cursor is outside the launch feed.");let i=new Map,m=[];for(let u of d.slice(a,a+n)){let f=u.transactionHash,y=i.get(f);y||(y=await c.getTransactionReceipt({hash:f}),i.set(f,y));let v=ce({abi:K,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,$=re(y).filter(T=>p(T.token,v.token)&&p(T.poolId,v.poolId));if($.length!==1)throw new r("The launch feed log does not match one verified receipt launch.");m.push({...$[0],launchTx:f,blockNumber:u.blockNumber.toString(),token:await oe($[0].token,t),creator:y.from})}let b=a+n;return{launches:m,cursor:b<d.length?`${s}:${t}:${b}`:null,fromBlock:s.toString(),toBlock:t.toString(),coverage:Q,previousToBlock:s>D?(s-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ye(e,o,n){let s=await O(e);if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let t=BigInt(s.positionId),a=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(a,g.feeSplitterFeesOn.address))throw new r("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,o))throw new r("Only the current fee NFT holder can change this entitlement.");let i=S(n?e.to:e.spender);if(p(i,B)||n&&p(i,F))throw new r("The fee NFT recipient cannot be the vault or zero address.");let m=n?C({abi:h,functionName:"safeTransferFrom",args:[o,i,t]}):C({abi:h,functionName:"approve",args:[i,t]});return x([k(B,m,0n,n?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],o,n?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function De(){return{chainId:A,instant:{supported:!0,supply:ie.toString(),decimals:18,currency:me,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:Q}}let w=e=>({type:"string",description:e}),I=e=>ve(e),se="Launched token contract address (0x + 40 hex digits).",z="Transaction hash (0x + 64 hex digits) of the token launch; lets the tool find the launch without scanning. Optional where the token or position is given.",W='Liquidity position NFT id for the launch, as a decimal string. Example: "1".',ke={chainId:{type:"integer",const:A,description:"Chain id; only 4663 (Robinhood Chain mainnet) is accepted. Optional."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage tolerance in basis points (50 = 0.5%) used to derive minimum outputs when none is given. Optional."}};function N(e,o,n,s){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...ke,...o},required:n},execute:async(t,a)=>{try{let d=new Set([...Object.keys(ke),...Object.keys(o)]);if(Object.keys(t).some(i=>!d.has(i)))throw new r("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==A)throw new r("pools.trade requires chain 4663.");if(S(a),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new r("Slippage must be an integer in basis points.");le("10000",t.slippageBps)}return await G(),await s(t,a)}catch(d){H(d)}}}}return{tools:[N("launch",{name:w("Token name, shown in wallets and explorers."),symbol:w("Token ticker symbol."),creatorFees:{type:"boolean",description:"Permanent choice; must be explicit. true enables creator fees paid to feeBeneficiary from buys; false disables them forever."},feeBeneficiary:w("Address that receives creator fees; must not be the zero address or the launcher."),pair:w("Optional pair currency; only native ETH is supported (the zero address or the native ETH sentinel)."),decimals:{type:"integer",const:18,description:"Token decimals; must be 18 for an Instant Launch."},supply:I("Total token supply in base units (18 decimals); must be 1000000000000000000000000000 = one billion tokens."),initialBuy:I('ETH to spend on an initial buy in the same transaction, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.'),minAmountOut:I('Least new tokens to receive from the initial buy, in token base units (18 decimals). Requires initialBuy. Example: "1000000000000000000" = 1 token.'),description:w("Optional token description stored in token metadata."),website:w("Optional website URL stored in token metadata."),imageUri:w("Optional image URI stored in token metadata.")},["name","symbol","creatorFees","feeBeneficiary"],Ee),...["buy","sell"].map(e=>N(e,{token:w(se),amountIn:I(e==="buy"?'ETH to spend, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.':'Tokens to sell, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),minAmountOut:I(e==="buy"?'Least tokens to receive, in token base units (18 decimals). Example: "1000000000000000000" = 1 token. Defaults from slippageBps.':'Least ETH to receive, in wei base units (18 decimals). Example: "1000000000000000" = 0.001 ETH. Defaults from slippageBps.'),launchTx:w(z)},["token","amountIn"],(o,n)=>Fe(o,n,e==="buy"))),N("collect",{positionId:I(W),launchTx:w(z)},["positionId"],(e,o)=>we(e,o,!1)),N("claim",{positionId:I(W),launchTx:w(z),minEth:I('Least ETH you must receive from the claim, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.')},["positionId"],(e,o)=>we(e,o,!0)),N("browse",{fromBlock:I("First block number of the scan range, as a decimal string. Defaults to the most recent 100000 blocks."),toBlock:I("Last block number of the scan range, as a decimal string. Defaults to the latest block."),limit:{type:"integer",minimum:1,maximum:50,description:"Launches per page, 1 to 50 (default 20)."},cursor:w("Opaque pagination cursor exactly as returned by the previous browse call.")},[],Re),N("balance",{token:w(se),launchTx:w(z)},["token"],Pe),N("status",{launchTx:w("Transaction hash (0x + 64 hex digits) of the token launch to inspect."),token:w(se),positionId:I(W)},["launchTx"],He),N("launch_options",{},[],De),N("fee_transfer",{positionId:I(W),launchTx:w(z),to:w("Address that will become the new holder of the fee NFT and its future creator fees. Use the intended address.")},["positionId","to"],(e,o)=>ye(e,o,!0)),N("fee_approve",{positionId:I(W),launchTx:w(z),spender:w("Address approved to move the fee NFT. Use the intended address.")},["positionId","spender"],(e,o)=>ye(e,o,!1)),N("transfer",{token:w(se),amount:I('Tokens to send, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),to:w("Recipient address of the tokens; must not be the zero address. Use the intended address."),launchTx:w(z)},["token","amount","to"],Le),N("collect_many",{positionIds:{type:"array",items:I(W),minItems:1,maxItems:20,description:"Position NFT ids to collect fees for, decimal strings; same order as launchTxs."},launchTxs:{type:"array",items:w("Launch transaction hash (0x + 64 hex digits) matching the position id at the same index."),minItems:1,maxItems:20,description:"Launch transaction hashes, one per position id, in the same order."}},["positionIds","launchTxs"],Oe)],positions:async(e,o)=>{S(e);let n=[],s=0,t=!0,a=o?.deepScan?2e4:6e3,d=o?.signal,i,m,b=f=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:A,assets:[],incomplete:!0,description:`${f} Checked ${s} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),u=async()=>{await G(),t&&await L(e,void 0,async f=>{s++;for(let y of re(f)){if(!t)return;let v=y.creatorFees&&p(await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(y.positionId)]}),e);if(!t)return;if(!v&&!p(f.from,e))continue;let $=v?[{token:me,amount:(await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(y.positionId)]}))[0].toString()}]:[];t&&n.push({module:"poolstrade",id:y.positionId,chainId:A,assets:$,description:`Current Instant Launch ${y.token} (18 decimals, supply 1000000000), pool ${y.poolId}; creator fees ${y.creatorFees?"on":"off"} (permanent). ${v?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>t)};try{if(d?.aborted)return[b("Pools.trade discovery was cancelled; the historical scan is incomplete.")];let f=new Promise(v=>{i=()=>{t=!1,v("aborted")},d?.addEventListener("abort",i,{once:!0}),m=setTimeout(()=>{t=!1,v("budget")},a)}),y=await Promise.race([u().then(()=>"complete"),f]);return y==="complete"?n:[...n,b(y==="aborted"?"Pools.trade discovery was cancelled; the historical scan is incomplete.":`Pools.trade global launch discovery reached its ${a} ms read budget; the historical scan is incomplete.`)]}catch(f){return[...n,b(`Pools.trade discovery could not finish: ${l.plainError(f)}`)]}finally{t=!1,m!==void 0&&clearTimeout(m),i&&d?.removeEventListener("abort",i)}}}};function Ye(l){return Ne("poolstrade",[qe(l)])}export{re as a,qe as b,Ye as c};
@@ -1 +1 @@
1
- import{a as H}from"./M6JNGU4E.js";import{b as Z,c as z,d as J,e as K}from"./MJGEGNDU.js";import{a as W}from"./6F527FLN.js";import{a as V}from"./IPU656WB.js";import{a as L}from"./A3PN3PK3.js";import{c as j}from"./X24YTJST.js";import{b as T,o as q}from"./GYPMUYB5.js";import{b as _}from"./SPJCSEKP.js";import{a as A,d as I,e as B}from"./43LI5NKJ.js";import{a as $}from"./66F5ZH34.js";import{g as x,m as E,n as R}from"./NWNYJ26T.js";import{b as h,e as F,j as N,k as S}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{getAddress as O,parseAbi as te}from"viem";var n=O(N[4663].vaults.groveAlm.address),ne="0x29626c2d8ca49a51e4deceec5499e52983c42bd5",m=te(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function maxWithdraw(address) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)"]),C=$("Positive integer in token base units."),U={type:"string",description:`Public Grove vault only: ${n}. Defaults to this vault.`},Q={type:"integer",minimum:0,maximum:9999,default:T,description:`Allowed slippage in basis points (50 = 0.5%), 0 to 9999. Sets the minimum output unless you pass it explicitly. Defaults to ${T}.`};function D(t){return R(t,"Amount must be positive and within the uint256 range.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function v(t){return E(t,"Grove returned an invalid integer read.")}function M(t,d,l){if(A(d),Object.keys(t).some(u=>!["vault",...l].includes(u)))throw new o("Unsupported Grove argument.");if(t.vault!==void 0){if(typeof t.vault!="string")throw new o("Provide the public Grove vault address.");if(t.vault.toLowerCase()===ne)throw new o("The Grove ALM proxy is allocator infrastructure, not the public ERC-4626 vault.");if(A(t.vault),!x(t.vault,n))throw new o("Only the public Grove ERC-4626 vault is supported.")}}function X(t,d,l){let u=l===void 0?T:l;if(typeof u!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");let e=BigInt(q(t.toString(),u)),a=d===void 0?e:D(d);if(a<=0n||a>t)throw new o("The minimum output must be positive and no greater than the quoted output.");return a}function Y(t,d){let l=0n;for(let u of t.changes)if(!(u.token.chainId!==d.chainId||!x(u.token.address,d.address))){if(u.token.decimals!==d.decimals||typeof u.amount!="string"||!/^-?\d+$/.test(u.amount))throw new o("Grove preview returned invalid token metadata or amounts.");l+=BigInt(u.amount)}return l}var ae=t=>{async function d(e){try{return await e()}catch(a){throw new o(t.plainError(a))}}async function l(){let e=t.clientFor(h);if(await e.getChainId()!==h)throw new o("Grove requires an RPC endpoint on chain 4663.");let a=await e.readContract({address:n,abi:m,functionName:"asset"});if(typeof a!="string"||!x(a,S))throw new o("The public Grove vault must use canonical USDG on chain 4663.");let[i,r,s]=await Promise.all([e.readContract({address:O(S),abi:m,functionName:"decimals"}),e.readContract({address:n,abi:m,functionName:"decimals"}),L(e,n)]);if(i!==F||r!==18)throw new o("Grove token decimals differ from the evidenced USDG/share interface.");let p={address:O(S),chainId:h,decimals:i,symbol:"USDG"};return{client:e,asset:p,shareToken:{address:n,chainId:h,decimals:r,symbol:s}}}async function u(e,a,i,r,s,p){let f=await t.preview(e,a);if(Y(f,i)!==-r)throw new o("Grove simulation did not show the exact requested token outflow.");if(Y(f,s)<p)throw new o("Grove simulated output is below the minimum.");let g=f.changes.map(({token:w,amount:b})=>{let y=b.startsWith("-");return`${y?"-":"+"}${t.formatAmount(y?b.slice(1):b,w.decimals)} ${w.symbol} (${w.address}, chain ${w.chainId})`}).join("; ");return{txs:e,summary:`${f.summary} ${g}. Minimum ${p} base units of ${s.address} is a preview check, not enforced on-chain by standard ERC-4626. Re-preview before signing; execution output can change.`}}return{tools:[z(t,"grove_details",n),V(t,"grove_analytics",n),H(t,"grove_manage",n),...W(t,"grove",n),{name:"grove_list",inputSchema:{type:"object",properties:{vault:U},additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,[]);let{client:i,asset:r,shareToken:s}=await l(),[p,f,c,g,w,b]=await Promise.all([i.readContract({address:n,abi:m,functionName:"totalAssets"}),i.readContract({address:n,abi:m,functionName:"totalSupply"}),i.readContract({address:n,abi:m,functionName:"maxDeposit",args:[a]}),i.readContract({address:n,abi:m,functionName:"maxWithdraw",args:[a]}),i.readContract({address:n,abi:m,functionName:"performanceFee"}),i.readContract({address:n,abi:m,functionName:"managementFee"})]);return[{vault:n,chainId:h,name:"Grove x Steakhouse USDG",asset:r,shareToken:s,totalAssets:{token:r,amount:v(p).toString()},totalSupply:{token:s,amount:v(f).toString()},maxDeposit:v(c)===0n?null:c.toString(),maxWithdraw:v(g)===0n?null:g.toString(),maxViewCaveat:"Zero Morpho V2 maximum views mean unknown capacity. Simulate the requested action; full exits use the fresh share balance.",fees:{performanceFeeRaw:v(w).toString(),managementFeeRaw:v(b).toString(),scale:"1000000000000000000",managementFeeTimeUnit:"second",performanceFeeBasis:"accrued interest"}}]})},{name:"grove_deposit",inputSchema:{type:"object",description:"Deposit USDG in base units (1 USDG = 1000000) for 18-decimal vault shares. Exit with grove_withdraw; check positions after confirmation.",properties:{vault:U,amount:C,minSharesOut:C,slippageBps:Q},required:["amount"],additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,["amount","minSharesOut","slippageBps"]);let i=D(e.amount),{client:r,asset:s,shareToken:p}=await l(),f=v(await r.readContract({address:n,abi:m,functionName:"previewDeposit",args:[i]})),c=X(f,e.minSharesOut,e.slippageBps),g=I(n,s.address,i.toString(),a,h),w=[t.approval(s.address,n,i.toString(),h),t.unsignedTx(g.txs[1])];return u(w,a,s,i,p,c)})},{name:"grove_withdraw",inputSchema:{type:"object",description:"Redeem shares in 18-decimal base units, or shares all for a full exit to USDG. Check positions after confirmation.",properties:{vault:U,shares:{oneOf:[C,{const:"all",description:"Redeem the fresh full share balance."}],description:'Vault shares to redeem, in base units (shares have 18 decimals; "1000000000000000000" = 1 share), or "all" for the full balance.'},minAmountOut:C,slippageBps:Q,force:{type:"boolean",description:'True plans a full Morpho V2 force exit with penalty disclosure. Needs shares "all", minAmountOut and maxPenaltyAssets.'},maxPenaltyAssets:$('Force exit only: most USDG, in base units (6 decimals), you accept losing to the exit penalty. Example: "1000000" = 1 USDG.')},required:["shares"],additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,["shares","minAmountOut","slippageBps","force","maxPenaltyAssets"]);let i=e.shares==="all"?void 0:D(e.shares),{client:r,asset:s,shareToken:p}=await l(),f=v(await r.readContract({address:n,abi:m,functionName:"balanceOf",args:[a]})),c=i??f;if(c===0n||c>f)throw new o("The Grove share balance is insufficient for this withdrawal.");if(e.force!==void 0&&typeof e.force!="boolean")throw new o("force must be a boolean.");if(e.force===!0){if(e.shares!=="all"||e.slippageBps!==void 0)throw new o("Force exit requires shares all and an explicit minAmountOut; omit slippageBps.");let G=j(e.maxPenaltyAssets),ee=D(e.minAmountOut),k=await Z(t,r,n,a,c,G),P=await t.preview([k.tx],a);return K(P.changes,n,c,ee),{txs:[k.tx],preview:P,summary:`${J(k.plan)} ${P.summary}`}}if(e.maxPenaltyAssets!==void 0)throw new o("maxPenaltyAssets requires force true.");let g=v(await r.readContract({address:n,abi:m,functionName:"previewRedeem",args:[c]})),w=X(g,e.minAmountOut,e.slippageBps),y=B(n,c.toString(),a,h).txs.map(G=>t.unsignedTx({...G,description:`Redeem ${c} Grove share base units to the wallet.`}));return u(y,a,p,c,s,w)})}],positions:e=>d(async()=>{A(e);let{client:a,asset:i,shareToken:r}=await l(),s=v(await a.readContract({address:n,abi:m,functionName:"balanceOf",args:[e]}));if(s===0n)return[];let p=v(await a.readContract({address:n,abi:m,functionName:"previewRedeem",args:[s]}));return[{module:"grove",id:`${h}:${n.toLowerCase()}`,chainId:h,assets:[{token:i,amount:p.toString()}],description:`${t.formatAmount(s.toString(),r.decimals)} Grove shares (${s} base units, ${r.decimals} decimals, ${n}); estimated USDG redemption, subject to simulation.`}]})}},we=t=>_("grove",[ae(t)]);export{ae as a,we as b};
1
+ import{a as W}from"./6HNQAYBM.js";import{a as H}from"./H7ZJ7LAB.js";import{b as Z,c as z,d as J,e as K}from"./GCFHKJIO.js";import{a as V}from"./QKH7ED6B.js";import{a as L}from"./A3PN3PK3.js";import{c as j}from"./IY7FWTAL.js";import{b as T,o as q}from"./TTBB6EFN.js";import{b as _}from"./SPJCSEKP.js";import{a as A,d as I,e as B}from"./43LI5NKJ.js";import{a as $}from"./66F5ZH34.js";import{g as x,m as E,n as R}from"./NWNYJ26T.js";import{b as h,e as F,j as N,k as S}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{getAddress as O,parseAbi as te}from"viem";var n=O(N[4663].vaults.groveAlm.address),ne="0x29626c2d8ca49a51e4deceec5499e52983c42bd5",m=te(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function maxWithdraw(address) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)"]),C=$("Positive integer in token base units."),U={type:"string",description:`Public Grove vault only: ${n}. Defaults to this vault.`},Q={type:"integer",minimum:0,maximum:9999,default:T,description:`Allowed slippage in basis points (50 = 0.5%), 0 to 9999. Sets the minimum output unless you pass it explicitly. Defaults to ${T}.`};function D(t){return R(t,"Amount must be positive and within the uint256 range.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function v(t){return E(t,"Grove returned an invalid integer read.")}function M(t,d,l){if(A(d),Object.keys(t).some(u=>!["vault",...l].includes(u)))throw new o("Unsupported Grove argument.");if(t.vault!==void 0){if(typeof t.vault!="string")throw new o("Provide the public Grove vault address.");if(t.vault.toLowerCase()===ne)throw new o("The Grove ALM proxy is allocator infrastructure, not the public ERC-4626 vault.");if(A(t.vault),!x(t.vault,n))throw new o("Only the public Grove ERC-4626 vault is supported.")}}function X(t,d,l){let u=l===void 0?T:l;if(typeof u!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");let e=BigInt(q(t.toString(),u)),a=d===void 0?e:D(d);if(a<=0n||a>t)throw new o("The minimum output must be positive and no greater than the quoted output.");return a}function Y(t,d){let l=0n;for(let u of t.changes)if(!(u.token.chainId!==d.chainId||!x(u.token.address,d.address))){if(u.token.decimals!==d.decimals||typeof u.amount!="string"||!/^-?\d+$/.test(u.amount))throw new o("Grove preview returned invalid token metadata or amounts.");l+=BigInt(u.amount)}return l}var ae=t=>{async function d(e){try{return await e()}catch(a){throw new o(t.plainError(a))}}async function l(){let e=t.clientFor(h);if(await e.getChainId()!==h)throw new o("Grove requires an RPC endpoint on chain 4663.");let a=await e.readContract({address:n,abi:m,functionName:"asset"});if(typeof a!="string"||!x(a,S))throw new o("The public Grove vault must use canonical USDG on chain 4663.");let[i,r,s]=await Promise.all([e.readContract({address:O(S),abi:m,functionName:"decimals"}),e.readContract({address:n,abi:m,functionName:"decimals"}),L(e,n)]);if(i!==F||r!==18)throw new o("Grove token decimals differ from the evidenced USDG/share interface.");let p={address:O(S),chainId:h,decimals:i,symbol:"USDG"};return{client:e,asset:p,shareToken:{address:n,chainId:h,decimals:r,symbol:s}}}async function u(e,a,i,r,s,p){let f=await t.preview(e,a);if(Y(f,i)!==-r)throw new o("Grove simulation did not show the exact requested token outflow.");if(Y(f,s)<p)throw new o("Grove simulated output is below the minimum.");let g=f.changes.map(({token:w,amount:b})=>{let y=b.startsWith("-");return`${y?"-":"+"}${t.formatAmount(y?b.slice(1):b,w.decimals)} ${w.symbol} (${w.address}, chain ${w.chainId})`}).join("; ");return{txs:e,summary:`${f.summary} ${g}. Minimum ${p} base units of ${s.address} is a preview check, not enforced on-chain by standard ERC-4626. Re-preview before signing; execution output can change.`}}return{tools:[z(t,"grove_details",n),V(t,"grove_analytics",n),H(t,"grove_manage",n),...W(t,"grove",n),{name:"grove_list",inputSchema:{type:"object",properties:{vault:U},additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,[]);let{client:i,asset:r,shareToken:s}=await l(),[p,f,c,g,w,b]=await Promise.all([i.readContract({address:n,abi:m,functionName:"totalAssets"}),i.readContract({address:n,abi:m,functionName:"totalSupply"}),i.readContract({address:n,abi:m,functionName:"maxDeposit",args:[a]}),i.readContract({address:n,abi:m,functionName:"maxWithdraw",args:[a]}),i.readContract({address:n,abi:m,functionName:"performanceFee"}),i.readContract({address:n,abi:m,functionName:"managementFee"})]);return[{vault:n,chainId:h,name:"Grove x Steakhouse USDG",asset:r,shareToken:s,totalAssets:{token:r,amount:v(p).toString()},totalSupply:{token:s,amount:v(f).toString()},maxDeposit:v(c)===0n?null:c.toString(),maxWithdraw:v(g)===0n?null:g.toString(),maxViewCaveat:"Zero Morpho V2 maximum views mean unknown capacity. Simulate the requested action; full exits use the fresh share balance.",fees:{performanceFeeRaw:v(w).toString(),managementFeeRaw:v(b).toString(),scale:"1000000000000000000",managementFeeTimeUnit:"second",performanceFeeBasis:"accrued interest"}}]})},{name:"grove_deposit",inputSchema:{type:"object",description:"Deposit USDG in base units (1 USDG = 1000000) for 18-decimal vault shares. Exit with grove_withdraw; check positions after confirmation.",properties:{vault:U,amount:C,minSharesOut:C,slippageBps:Q},required:["amount"],additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,["amount","minSharesOut","slippageBps"]);let i=D(e.amount),{client:r,asset:s,shareToken:p}=await l(),f=v(await r.readContract({address:n,abi:m,functionName:"previewDeposit",args:[i]})),c=X(f,e.minSharesOut,e.slippageBps),g=I(n,s.address,i.toString(),a,h),w=[t.approval(s.address,n,i.toString(),h),t.unsignedTx(g.txs[1])];return u(w,a,s,i,p,c)})},{name:"grove_withdraw",inputSchema:{type:"object",description:"Redeem shares in 18-decimal base units, or shares all for a full exit to USDG. Check positions after confirmation.",properties:{vault:U,shares:{oneOf:[C,{const:"all",description:"Redeem the fresh full share balance."}],description:'Vault shares to redeem, in base units (shares have 18 decimals; "1000000000000000000" = 1 share), or "all" for the full balance.'},minAmountOut:C,slippageBps:Q,force:{type:"boolean",description:'True plans a full Morpho V2 force exit with penalty disclosure. Needs shares "all", minAmountOut and maxPenaltyAssets.'},maxPenaltyAssets:$('Force exit only: most USDG, in base units (6 decimals), you accept losing to the exit penalty. Example: "1000000" = 1 USDG.')},required:["shares"],additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,["shares","minAmountOut","slippageBps","force","maxPenaltyAssets"]);let i=e.shares==="all"?void 0:D(e.shares),{client:r,asset:s,shareToken:p}=await l(),f=v(await r.readContract({address:n,abi:m,functionName:"balanceOf",args:[a]})),c=i??f;if(c===0n||c>f)throw new o("The Grove share balance is insufficient for this withdrawal.");if(e.force!==void 0&&typeof e.force!="boolean")throw new o("force must be a boolean.");if(e.force===!0){if(e.shares!=="all"||e.slippageBps!==void 0)throw new o("Force exit requires shares all and an explicit minAmountOut; omit slippageBps.");let G=j(e.maxPenaltyAssets),ee=D(e.minAmountOut),k=await Z(t,r,n,a,c,G),P=await t.preview([k.tx],a);return K(P.changes,n,c,ee),{txs:[k.tx],preview:P,summary:`${J(k.plan)} ${P.summary}`}}if(e.maxPenaltyAssets!==void 0)throw new o("maxPenaltyAssets requires force true.");let g=v(await r.readContract({address:n,abi:m,functionName:"previewRedeem",args:[c]})),w=X(g,e.minAmountOut,e.slippageBps),y=B(n,c.toString(),a,h).txs.map(G=>t.unsignedTx({...G,description:`Redeem ${c} Grove share base units to the wallet.`}));return u(y,a,p,c,s,w)})}],positions:e=>d(async()=>{A(e);let{client:a,asset:i,shareToken:r}=await l(),s=v(await a.readContract({address:n,abi:m,functionName:"balanceOf",args:[e]}));if(s===0n)return[];let p=v(await a.readContract({address:n,abi:m,functionName:"previewRedeem",args:[s]}));return[{module:"grove",id:`${h}:${n.toLowerCase()}`,chainId:h,assets:[{token:i,amount:p.toString()}],description:`${t.formatAmount(s.toString(),r.decimals)} Grove shares (${s} base units, ${r.decimals} decimals, ${n}); estimated USDG redemption, subject to simulation.`}]})}},we=t=>_("grove",[ae(t)]);export{ae as a,we as b};
@@ -1 +1 @@
1
- import{a as y,b as R,c as S,f as d,g as b,h as O,i as $,j as T,k,l as V}from"./TXGZ6NWN.js";import{c as j}from"./SCG5HWMN.js";import{c as h,e as C,g as A}from"./NWNYJ26T.js";import{b as P}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{concat as U,encodeAbiParameters as H,encodeFunctionData as E,keccak256 as M,parseAbi as F,parseAbiParameters as q}from"viem";var _=F(["function allocation(address) view returns (address token,uint256 amountTotal,uint256 amountClaimed,uint256 lockupEndTime,uint256 vestingEndTime,address admin)","function amountAvailableToClaim(address) view returns (uint256)","function claim(address)","function editAllocationAdmin(address,address)"]),D=F(["function airdrops(address) view returns (address admin,bytes32 merkleRoot,uint256 totalSupply,uint256 totalClaimed,uint256 lockupEndTime,uint256 vestingEndTime,uint256 adminClaimTime,bool adminClaimed)","function amountAvailableToClaim(address,address,uint256) view returns (uint256)","function claim(address,address,uint256,bytes32[])","function updateAdmin(address,address)","function updateMerkleRoot(address,bytes32)","function adminClaim(address,address)"]),L={bps:{type:"integer",minimum:1,maximum:9e3,description:"Share of the token supply sent to this extension, in basis points (1000 = 10%). Vault and airdrop together may not exceed 9000."},admin:{...h,description:"Address that administers this allocation. Defaults to the launching wallet."},lockupDuration:{...R,description:"Lockup before anything can be claimed, in seconds, as a decimal string (604800 = 7 days; airdrop minimum 86400 = 1 day)."},vestingDuration:{...R,description:"Linear vesting period after the lockup ends, in seconds, as a decimal string (0 = fully unlocked at lockup end)."}},W={vault:{type:"object",properties:L,required:["bps","lockupDuration","vestingDuration"],additionalProperties:!1},airdrop:{type:"object",properties:{...L,merkleRoot:{...S,description:"Merkle root of the airdrop allocations, as 0x followed by 64 hex digits (from clanker_airdrop_tree)."}},required:["bps","lockupDuration","vestingDuration","merkleRoot"],additionalProperties:!1}};function X(m,f){let g=[];for(let p of["vault","airdrop"]){let l=m[p];if(l===void 0)continue;if(!C(l))throw new r(`Provide ${p} configuration as an object.`);$(l,["bps","admin","lockupDuration","vestingDuration",...p==="airdrop"?["merkleRoot"]:[]]);let w=d(l.admin??f),v=b(l.lockupDuration),e=b(l.vestingDuration);if(v<BigInt(p==="vault"?604800:86400))throw new r(`${p} lockup is below the contract minimum.`);if(v+e+1209600n>=1n<<256n)throw new r("Extension duration exceeds uint256.");g.push({extension:y[p].address,msgValue:0n,extensionBps:O(l.bps,1,9e3),extensionData:p==="vault"?H(q("(address,uint256,uint256)"),[[w,v,e]]):H(q("(address,bytes32,uint256,uint256)"),[[w,T(l.merkleRoot),v,e]])})}if(g.reduce((p,l)=>p+l.extensionBps,0)>9e3)throw new r("Extensions must leave at least 10% of supply for liquidity.");return g}function N(m,f){return M(M(H(q("address,uint256"),[m,f])))}function I(m,f){return M(U(BigInt(m)<BigInt(f)?[m,f]:[f,m]))}var Z=m=>{let f=()=>m.clientFor(P),g=async(e,t)=>{if(!(await V(m,e)).extensions.some(a=>A(a,y[t].address)))throw new r(`This token has no verified Clanker ${t} extension.`)},p=async e=>{await g(e,"vault");let t=await f().readContract({address:y.vault.address,abi:_,functionName:"allocation",args:[e]});if(!Array.isArray(t)||t.length!==6||!A(d(t[0]),e))throw new r("Clanker returned an invalid vault allocation.");return{token:e,amountTotal:k(t[1]),amountClaimed:k(t[2]),lockupEndTime:k(t[3]),vestingEndTime:k(t[4]),admin:d(t[5]),claimable:k(await f().readContract({address:y.vault.address,abi:_,functionName:"amountAvailableToClaim",args:[e]}))}},l=async e=>{await g(e,"airdrop");let t=await f().readContract({address:y.airdrop.address,abi:D,functionName:"airdrops",args:[e]});if(!Array.isArray(t)||t.length!==8||typeof t[7]!="boolean")throw new r("Clanker returned invalid airdrop state.");return{token:e,admin:d(t[0]),merkleRoot:T(t[1]),totalSupply:k(t[2]),totalClaimed:k(t[3]),lockupEndTime:k(t[4]),vestingEndTime:k(t[5]),adminClaimTime:k(t[6]),adminClaimed:t[7]}},w=(e,t,o,a)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(s,n)=>{try{return $(s,Object.keys(t)),await a(s,d(n))}catch(i){throw new r(m.plainError(i))}}}),v=async(e,t,o,a)=>{let s=[m.unsignedTx({to:e,data:t,chainId:P,value:"0",description:o})],n=await m.preview(s,a);return{txs:s,preview:n,summary:`${o} ${n.summary}`}};return{tools:[w("airdrop_proofs",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await l(o),s=new URL("https://www.clanker.world/api/airdrops/claim");s.searchParams.set("tokenAddress",o),s.searchParams.set("claimerAddress",t);let i=(await j(m.http,s.toString(),{method:"GET"},u=>C(u)&&Array.isArray(u.proofs))).proofs;if(i.length>200)throw new r("Clanker returned too many airdrop proofs.");let c=i.map(u=>{if(!C(u)||!C(u.entry)||!Array.isArray(u.proof)||u.proof.length>64||!A(d(u.entry.account),t))throw new r("Clanker returned invalid airdrop proofs.");let x=b(u.entry.amount),B=u.proof.map(T);if(!x||!A(B.reduce(I,N(t,x)),a.merkleRoot))throw new r("The indexed airdrop proof does not match the active onchain root.");return{allocatedAmount:x.toString(),proof:B}});return{token:o,chainId:P,recipient:t,proofs:c,summary:"Verified against the onchain airdrop root. An empty indexer response does not prove ineligibility; use saved allocation proofs if the tree was not published."}}),w("vault_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],e=>p(d(e.token))),w("vault_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await p(o);if(a.claimable==="0")throw new r("No vested Clanker tokens are available to claim.");return v(y.vault.address,E({abi:_,functionName:"claim",args:[o]}),`Claim ${a.claimable} base units of ${o} (18 decimals) to vault admin ${a.admin}.`,t)}),w("vault_update_admin",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},admin:{...h,description:"Address of the new vault administrator, who then receives all future claims."}},["token","admin"],async(e,t)=>{let o=d(e.token),a=await p(o);if(!A(a.admin,t))throw new r("Only the vault administrator can transfer its allocation.");return v(y.vault.address,E({abi:_,functionName:"editAllocationAdmin",args:[o,d(e.admin)]}),`Transfer all future Clanker vault claims for ${o} to ${d(e.admin)}.`,t)}),w("airdrop_tree",{allocations:{type:"array",minItems:1,maxItems:200,description:"Airdrop recipients and amounts, 1 to 200 rows with unique recipients. Returns the Merkle root and each proof.",items:{type:"object",properties:{recipient:{...h,description:"Address of the wallet eligible to claim this allocation."},amount:{...R,description:'Amount of the launched token allocated to this recipient, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'}},required:["recipient","amount"],additionalProperties:!1}}},["allocations"],async e=>{if(!Array.isArray(e.allocations)||!e.allocations.length||e.allocations.length>200)throw new r("Provide 1 to 200 airdrop allocations.");let t=new Set,o=e.allocations.map(n=>{if(!C(n))throw new r("Provide allocation objects.");$(n,["recipient","amount"]);let i=d(n.recipient),c=b(n.amount);if(!c||t.has(i))throw new r("Airdrop allocations require positive amounts and unique recipients.");return t.add(i),{recipient:i,amount:c.toString(),hash:N(i,c)}}).sort((n,i)=>n.hash.localeCompare(i.hash)),a=[o.map(n=>n.hash)];for(;a.at(-1).length>1;){let n=a.at(-1),i=[];for(let c=0;c<n.length;c+=2)i.push(c+1<n.length?I(n[c],n[c+1]):n[c]);a.push(i)}let s=o.reduce((n,i)=>n+BigInt(i.amount),0n);if(s>=1n<<256n)throw new r("Airdrop total exceeds uint256.");return{merkleRoot:a.at(-1)[0],total:s.toString(),allocations:o.map((n,i)=>{let c=[],u=i;for(let x of a.slice(0,-1))x[u^1]&&c.push(x[u^1]),u=Math.floor(u/2);return{recipient:n.recipient,amount:n.amount,proof:c}}),summary:"Double-hashed ABI(address,uint256) leaves; sorted hash pairs. Save these public proofs. Allocations are token base units, 18 decimals; match their total to the launch extension supply."}}),w("airdrop_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Optional: your allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. Adds the claimable amount to the result.'}},["token"],async(e,t)=>{let o=d(e.token);return{...await l(o),...e.allocatedAmount===void 0?{}:{claimable:k(await f().readContract({address:y.airdrop.address,abi:D,functionName:"amountAvailableToClaim",args:[o,t,b(e.allocatedAmount)]}))}}}),w("airdrop_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Your full allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'},proof:{type:"array",maxItems:64,description:"Merkle proof for your wallet and allocation, as 0x-prefixed 32-byte hex strings (from clanker_airdrop_proofs).",items:S}},["token","allocatedAmount","proof"],async(e,t)=>{let o=d(e.token),a=await l(o),s=b(e.allocatedAmount);if(!s||!Array.isArray(e.proof)||e.proof.length>64)throw new r("Provide a positive allocation and Merkle proof.");let n=e.proof.map(T),i=n.reduce(I,N(t,s));if(!A(i,a.merkleRoot))throw new r("The airdrop proof does not match the active root for this wallet and allocation.");return v(y.airdrop.address,E({abi:D,functionName:"claim",args:[o,t,s,n]}),`Claim vested allocation of ${s} base units of ${o} (18 decimals) to ${t}. Preview determines currently unlocked receipts.`,t)}),w("airdrop_manage",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},operation:{enum:["admin","root","reclaim"],description:"admin: hand administration to a new address (give admin); root: replace the Merkle root (give merkleRoot); reclaim: send unclaimed tokens to recipient and close claims."},admin:{...h,description:"New airdrop administrator address, for operation admin."},merkleRoot:{...S,description:"New Merkle root as 0x followed by 64 hex digits, for operation root."},recipient:{...h,description:"Address that receives the reclaimed tokens, for operation reclaim."}},["token","operation"],async(e,t)=>{let o=d(e.token),a=await l(o);if(!A(a.admin,t))throw new r("Only the airdrop administrator may manage it.");let s=e.operation==="admin"?"admin":e.operation==="root"?"merkleRoot":"recipient";for(let i of["admin","merkleRoot","recipient"])if(e[i]!==void 0&&i!==s)throw new r(`Input ${i} does not match this airdrop operation.`);let n;if(e.operation==="admin")n=E({abi:D,functionName:"updateAdmin",args:[o,d(e.admin)]});else if(e.operation==="root")n=E({abi:D,functionName:"updateMerkleRoot",args:[o,T(e.merkleRoot)]});else if(e.operation==="reclaim")n=E({abi:D,functionName:"adminClaim",args:[o,d(e.recipient)]});else throw new r("Choose admin, root or reclaim.");return v(y.airdrop.address,n,`Clanker airdrop ${String(e.operation)} for ${o}; ${String(e.admin??e.merkleRoot??e.recipient)}. Reclaim permanently closes recipient claims; contract timing and zero-claim guards apply.`,t)})]}};export{W as a,X as b,Z as c};
1
+ import{a as y,b as R,c as S,f as d,g as b,h as O,i as $,j as T,k,l as V}from"./PG7HZIZL.js";import{c as j}from"./SCG5HWMN.js";import{c as h,e as C,g as A}from"./NWNYJ26T.js";import{b as P}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{concat as U,encodeAbiParameters as H,encodeFunctionData as E,keccak256 as M,parseAbi as F,parseAbiParameters as q}from"viem";var _=F(["function allocation(address) view returns (address token,uint256 amountTotal,uint256 amountClaimed,uint256 lockupEndTime,uint256 vestingEndTime,address admin)","function amountAvailableToClaim(address) view returns (uint256)","function claim(address)","function editAllocationAdmin(address,address)"]),D=F(["function airdrops(address) view returns (address admin,bytes32 merkleRoot,uint256 totalSupply,uint256 totalClaimed,uint256 lockupEndTime,uint256 vestingEndTime,uint256 adminClaimTime,bool adminClaimed)","function amountAvailableToClaim(address,address,uint256) view returns (uint256)","function claim(address,address,uint256,bytes32[])","function updateAdmin(address,address)","function updateMerkleRoot(address,bytes32)","function adminClaim(address,address)"]),L={bps:{type:"integer",minimum:1,maximum:9e3,description:"Share of the token supply sent to this extension, in basis points (1000 = 10%). Vault and airdrop together may not exceed 9000."},admin:{...h,description:"Address that administers this allocation. Defaults to the launching wallet."},lockupDuration:{...R,description:"Lockup before anything can be claimed, in seconds, as a decimal string (604800 = 7 days; airdrop minimum 86400 = 1 day)."},vestingDuration:{...R,description:"Linear vesting period after the lockup ends, in seconds, as a decimal string (0 = fully unlocked at lockup end)."}},W={vault:{type:"object",properties:L,required:["bps","lockupDuration","vestingDuration"],additionalProperties:!1},airdrop:{type:"object",properties:{...L,merkleRoot:{...S,description:"Merkle root of the airdrop allocations, as 0x followed by 64 hex digits (from clanker_airdrop_tree)."}},required:["bps","lockupDuration","vestingDuration","merkleRoot"],additionalProperties:!1}};function X(m,f){let g=[];for(let p of["vault","airdrop"]){let l=m[p];if(l===void 0)continue;if(!C(l))throw new r(`Provide ${p} configuration as an object.`);$(l,["bps","admin","lockupDuration","vestingDuration",...p==="airdrop"?["merkleRoot"]:[]]);let w=d(l.admin??f),v=b(l.lockupDuration),e=b(l.vestingDuration);if(v<BigInt(p==="vault"?604800:86400))throw new r(`${p} lockup is below the contract minimum.`);if(v+e+1209600n>=1n<<256n)throw new r("Extension duration exceeds uint256.");g.push({extension:y[p].address,msgValue:0n,extensionBps:O(l.bps,1,9e3),extensionData:p==="vault"?H(q("(address,uint256,uint256)"),[[w,v,e]]):H(q("(address,bytes32,uint256,uint256)"),[[w,T(l.merkleRoot),v,e]])})}if(g.reduce((p,l)=>p+l.extensionBps,0)>9e3)throw new r("Extensions must leave at least 10% of supply for liquidity.");return g}function N(m,f){return M(M(H(q("address,uint256"),[m,f])))}function I(m,f){return M(U(BigInt(m)<BigInt(f)?[m,f]:[f,m]))}var Z=m=>{let f=()=>m.clientFor(P),g=async(e,t)=>{if(!(await V(m,e)).extensions.some(a=>A(a,y[t].address)))throw new r(`This token has no verified Clanker ${t} extension.`)},p=async e=>{await g(e,"vault");let t=await f().readContract({address:y.vault.address,abi:_,functionName:"allocation",args:[e]});if(!Array.isArray(t)||t.length!==6||!A(d(t[0]),e))throw new r("Clanker returned an invalid vault allocation.");return{token:e,amountTotal:k(t[1]),amountClaimed:k(t[2]),lockupEndTime:k(t[3]),vestingEndTime:k(t[4]),admin:d(t[5]),claimable:k(await f().readContract({address:y.vault.address,abi:_,functionName:"amountAvailableToClaim",args:[e]}))}},l=async e=>{await g(e,"airdrop");let t=await f().readContract({address:y.airdrop.address,abi:D,functionName:"airdrops",args:[e]});if(!Array.isArray(t)||t.length!==8||typeof t[7]!="boolean")throw new r("Clanker returned invalid airdrop state.");return{token:e,admin:d(t[0]),merkleRoot:T(t[1]),totalSupply:k(t[2]),totalClaimed:k(t[3]),lockupEndTime:k(t[4]),vestingEndTime:k(t[5]),adminClaimTime:k(t[6]),adminClaimed:t[7]}},w=(e,t,o,a)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(s,n)=>{try{return $(s,Object.keys(t)),await a(s,d(n))}catch(i){throw new r(m.plainError(i))}}}),v=async(e,t,o,a)=>{let s=[m.unsignedTx({to:e,data:t,chainId:P,value:"0",description:o})],n=await m.preview(s,a);return{txs:s,preview:n,summary:`${o} ${n.summary}`}};return{tools:[w("airdrop_proofs",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await l(o),s=new URL("https://www.clanker.world/api/airdrops/claim");s.searchParams.set("tokenAddress",o),s.searchParams.set("claimerAddress",t);let i=(await j(m.http,s.toString(),{method:"GET"},u=>C(u)&&Array.isArray(u.proofs))).proofs;if(i.length>200)throw new r("Clanker returned too many airdrop proofs.");let c=i.map(u=>{if(!C(u)||!C(u.entry)||!Array.isArray(u.proof)||u.proof.length>64||!A(d(u.entry.account),t))throw new r("Clanker returned invalid airdrop proofs.");let x=b(u.entry.amount),B=u.proof.map(T);if(!x||!A(B.reduce(I,N(t,x)),a.merkleRoot))throw new r("The indexed airdrop proof does not match the active onchain root.");return{allocatedAmount:x.toString(),proof:B}});return{token:o,chainId:P,recipient:t,proofs:c,summary:"Verified against the onchain airdrop root. An empty indexer response does not prove ineligibility; use saved allocation proofs if the tree was not published."}}),w("vault_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],e=>p(d(e.token))),w("vault_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await p(o);if(a.claimable==="0")throw new r("No vested Clanker tokens are available to claim.");return v(y.vault.address,E({abi:_,functionName:"claim",args:[o]}),`Claim ${a.claimable} base units of ${o} (18 decimals) to vault admin ${a.admin}.`,t)}),w("vault_update_admin",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},admin:{...h,description:"Address of the new vault administrator, who then receives all future claims."}},["token","admin"],async(e,t)=>{let o=d(e.token),a=await p(o);if(!A(a.admin,t))throw new r("Only the vault administrator can transfer its allocation.");return v(y.vault.address,E({abi:_,functionName:"editAllocationAdmin",args:[o,d(e.admin)]}),`Transfer all future Clanker vault claims for ${o} to ${d(e.admin)}.`,t)}),w("airdrop_tree",{allocations:{type:"array",minItems:1,maxItems:200,description:"Airdrop recipients and amounts, 1 to 200 rows with unique recipients. Returns the Merkle root and each proof.",items:{type:"object",properties:{recipient:{...h,description:"Address of the wallet eligible to claim this allocation."},amount:{...R,description:'Amount of the launched token allocated to this recipient, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'}},required:["recipient","amount"],additionalProperties:!1}}},["allocations"],async e=>{if(!Array.isArray(e.allocations)||!e.allocations.length||e.allocations.length>200)throw new r("Provide 1 to 200 airdrop allocations.");let t=new Set,o=e.allocations.map(n=>{if(!C(n))throw new r("Provide allocation objects.");$(n,["recipient","amount"]);let i=d(n.recipient),c=b(n.amount);if(!c||t.has(i))throw new r("Airdrop allocations require positive amounts and unique recipients.");return t.add(i),{recipient:i,amount:c.toString(),hash:N(i,c)}}).sort((n,i)=>n.hash.localeCompare(i.hash)),a=[o.map(n=>n.hash)];for(;a.at(-1).length>1;){let n=a.at(-1),i=[];for(let c=0;c<n.length;c+=2)i.push(c+1<n.length?I(n[c],n[c+1]):n[c]);a.push(i)}let s=o.reduce((n,i)=>n+BigInt(i.amount),0n);if(s>=1n<<256n)throw new r("Airdrop total exceeds uint256.");return{merkleRoot:a.at(-1)[0],total:s.toString(),allocations:o.map((n,i)=>{let c=[],u=i;for(let x of a.slice(0,-1))x[u^1]&&c.push(x[u^1]),u=Math.floor(u/2);return{recipient:n.recipient,amount:n.amount,proof:c}}),summary:"Double-hashed ABI(address,uint256) leaves; sorted hash pairs. Save these public proofs. Allocations are token base units, 18 decimals; match their total to the launch extension supply."}}),w("airdrop_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Optional: your allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. Adds the claimable amount to the result.'}},["token"],async(e,t)=>{let o=d(e.token);return{...await l(o),...e.allocatedAmount===void 0?{}:{claimable:k(await f().readContract({address:y.airdrop.address,abi:D,functionName:"amountAvailableToClaim",args:[o,t,b(e.allocatedAmount)]}))}}}),w("airdrop_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Your full allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'},proof:{type:"array",maxItems:64,description:"Merkle proof for your wallet and allocation, as 0x-prefixed 32-byte hex strings (from clanker_airdrop_proofs).",items:S}},["token","allocatedAmount","proof"],async(e,t)=>{let o=d(e.token),a=await l(o),s=b(e.allocatedAmount);if(!s||!Array.isArray(e.proof)||e.proof.length>64)throw new r("Provide a positive allocation and Merkle proof.");let n=e.proof.map(T),i=n.reduce(I,N(t,s));if(!A(i,a.merkleRoot))throw new r("The airdrop proof does not match the active root for this wallet and allocation.");return v(y.airdrop.address,E({abi:D,functionName:"claim",args:[o,t,s,n]}),`Claim vested allocation of ${s} base units of ${o} (18 decimals) to ${t}. Preview determines currently unlocked receipts.`,t)}),w("airdrop_manage",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},operation:{enum:["admin","root","reclaim"],description:"admin: hand administration to a new address (give admin); root: replace the Merkle root (give merkleRoot); reclaim: send unclaimed tokens to recipient and close claims."},admin:{...h,description:"New airdrop administrator address, for operation admin."},merkleRoot:{...S,description:"New Merkle root as 0x followed by 64 hex digits, for operation root."},recipient:{...h,description:"Address that receives the reclaimed tokens, for operation reclaim."}},["token","operation"],async(e,t)=>{let o=d(e.token),a=await l(o);if(!A(a.admin,t))throw new r("Only the airdrop administrator may manage it.");let s=e.operation==="admin"?"admin":e.operation==="root"?"merkleRoot":"recipient";for(let i of["admin","merkleRoot","recipient"])if(e[i]!==void 0&&i!==s)throw new r(`Input ${i} does not match this airdrop operation.`);let n;if(e.operation==="admin")n=E({abi:D,functionName:"updateAdmin",args:[o,d(e.admin)]});else if(e.operation==="root")n=E({abi:D,functionName:"updateMerkleRoot",args:[o,T(e.merkleRoot)]});else if(e.operation==="reclaim")n=E({abi:D,functionName:"adminClaim",args:[o,d(e.recipient)]});else throw new r("Choose admin, root or reclaim.");return v(y.airdrop.address,n,`Clanker airdrop ${String(e.operation)} for ${o}; ${String(e.admin??e.merkleRoot??e.recipient)}. Reclaim permanently closes recipient claims; contract timing and zero-claim guards apply.`,t)})]}};export{W as a,X as b,Z as c};
@@ -0,0 +1 @@
1
+ import{a as k}from"./G2LAO23N.js";import{g as f,h as v}from"./3RGED2KO.js";import{c as p}from"./NWNYJ26T.js";import{b as u}from"./EWZFZUVF.js";import{a as t}from"./XSD5NL7J.js";import{getAddress as y}from"viem";var g={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},b=[["hookr_release",{},[],"Read verified release contracts, block and recapture lane."],["hookr_blocks",{},[],"Read all Hook Blocks and their current availability."],["hookr_kings",{poolId:g},[],"Read King of the Pool rounds, leaders, pots and endings."],["hookr_claims",{poolId:g},[],"Read the signing wallet's prizes, royalties, recapture and PoolManager claims."],["hookr_revenue_tokens",{limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of revenue tokens to return, 1 to 50."},cursor:{type:"string",pattern:"^(v1|v1:[1-9][0-9]{0,19}|v2:[1-9][0-9]{0,19})$",description:"Paging cursor: the nextCursor string from the previous page (v1, v1:N or v2:N); omit for the first page."}},[],"Read revenue tokens, tokenizer provenance, streams and income, page by page."],["hookr_revenue_token",{token:{...p,description:k.address("revenue token")}},["token"],"Read a revenue token, stream endings, income, drops and the signing wallet's claims."],["hookr_hook",{address:{...p,description:k.address("Hookr hook contract")}},["address"],"Read shared or owned hook provenance, ownership, allowed blocks, opening and pools."]],T=[...b.map(c=>c[0]),"hookr_contracts","hookr_read","hookr_revenue_read","hookr_addon_read","hookr_api_read"];function I(c){return[...b.map(([o,n,i,s])=>({name:o,inputSchema:{type:"object",description:s,properties:n,required:i,additionalProperties:!1},execute:async(l,w)=>{if(Object.keys(l).some(r=>!Object.hasOwn(n,r))||i.some(r=>l[r]===void 0))throw new t(`Provide the documented arguments for ${o}.`);let m={};for(let[r,a]of Object.entries(l)){let d=n[r];if(d.type==="integer"){if(typeof a!="number"||!Number.isInteger(a)||a<Number(d.minimum)||a>Number(d.maximum))throw new t("Hookr revenue page limit must be an integer from 1 to 50.")}else if(typeof a!="string"||!new RegExp(String(d.pattern)).test(a))throw new t(`Provide a valid Hookr ${r}.`);m[r]=r==="token"||r==="address"?y(String(a)):a}return(o==="hookr_claims"||o==="hookr_revenue_token")&&(m.account=w),{...await f(c,o,m),chainId:u,source:"https://hookr.fun/api/mcp"}}})),_(c)]}var h={catalog:"/api/hooks/catalog",stats:"/api/protocol-stats",poolApr:"/api/pool-apr",revenueTokens:"/api/revenue-tokens",revenueIncome:"/api/revenue-tokens/income"};function _(c){return{name:"hookr_api_read",inputSchema:{type:"object",description:"Read Hookr public catalog, protocol stats, pool APR, revenue directory/income, or one token's doors/mark. Marks are project metadata, not investment or security endorsements.",properties:{resource:{type:"string",enum:[...Object.keys(h),"revenueDoors","revenueMark"],description:"Public feed to read: catalog, stats, poolApr, revenueTokens, revenueIncome; revenueDoors and revenueMark also need token (that token's doors, or its mark image URL)."},token:{...p,description:k.address("revenue token, only for revenueDoors and revenueMark")}},required:["resource"],additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(s=>!["resource","token"].includes(s))||typeof e.resource!="string")throw new t("Choose a documented Hookr public resource.");let o=["revenueDoors","revenueMark"].includes(e.resource);if(!o&&e.token!==void 0||o&&typeof e.token!="string")throw new t("Only the revenueDoors and revenueMark resources take a token address.");let n;if(o){let s;try{s=y(String(e.token))}catch{throw new t("Provide a valid revenue token address.")}n=`/api/revenue-tokens/${s}/${e.resource==="revenueDoors"?"doors":"mark"}`}else{if(!Object.hasOwn(h,e.resource))throw new t("Choose a documented Hookr public resource.");n=h[e.resource]}let i=`https://hookr.fun${n}`;try{let s=await v(c,n,e.resource==="revenueMark");return e.resource==="revenueMark"?{chainId:u,source:i,imageUrl:i,pngUrl:`${i}.png`,note:"Official SVG mark URL; SVG code is not executed or returned. The PNG URL has not been fetched."}:{chainId:u,source:i,data:s}}catch{throw new t("Hookr public resource is unavailable. Retry later; no empty or zero result is implied.")}}}}export{T as a,I as b,_ as c};
@@ -1 +1 @@
1
- import{b as Z}from"./CNDIAF3P.js";import{a as I,b as J,d as V}from"./RUTSEGGD.js";import{a as E}from"./QYKXWBZC.js";import{a as Q}from"./CEQNXF6A.js";import{L as y}from"./MQXSCNUL.js";import{c as $}from"./N624NR7Y.js";import{a as H}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{d as M,g as O,i as K}from"./NWNYJ26T.js";import{b}from"./TI727O2H.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as Y,erc20Abi as X,getAddress as W,parseAbi as ee,zeroAddress as te}from"viem";var v={address:W("0xCeF73866b088766DeD46Ba71d9Bd7591B5e931d2"),symbol:"tNET",decimals:9,chainId:b},_={pair_oracle:["checkpoint"],futures:["open","close","marginCall","accrueCarry","sweepCarrySkim"],underwriting:["subscribe","redeem"],prize:["enter","enterWithNet","exit","exitToUsdg","lockTranche","earlyUnlock","pokeRebase"]},fe=x=>({tools:[{name:"netnet_desk_action",inputSchema:{type:"object",additionalProperties:!1,required:["program","operation"],properties:{program:{type:"string",enum:Object.keys(_),description:"Desk program: pair_oracle (price checkpoint), futures, underwriting or prize (WinNET)."},operation:{type:"string",enum:[...new Set(Object.values(_).flat())],description:"Action to run; it must be one the chosen program supports (see the program list in this tool)."},amount:N('Amount in base units of the token the operation spends or moves: tNET 9 decimals for futures and underwriting, USDG 6 or NET 9 for prize. Example: "1000000000" = 1 NET.'),minAmountOut:N('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9, underwriting shares). Example: "1000000" = 1 USDG.'),maxPayment:N('Most tNET you will pay for futures open (margin plus fee), in tNET base units (9 decimals). Example: "1000000000" = 1 tNET.'),sizeUsdWad:N('Futures position notional in USD as an 18-decimal wad in base units (1e18 = 1 USD). Example: "100000000000000000000" = 100 USD.'),isLong:{type:"boolean",description:"Futures open only: true for a long position, false for a short."},account:{type:"string",description:"Futures marginCall only: address of the trader to margin-call; they must be liquidatable."},referrer:{type:"string",description:"Prize enter only: optional referrer address recorded at the first deposit; cannot be your own wallet."},trancheIndex:N('Zero-based index of your WinNET tranche to lock or unlock early, as a decimal string. Example: "0".'),lockDraws:{enum:["7","30"],description:"Prize lockTranche only: commit the tranche for 7 or 30 draws."},maxPenaltyAssets:N('Prize earlyUnlock only: highest forfeited principal you accept, in NET base units (9 decimals). Example: "1000000000" = 1 NET.')}},execute:async(t,m)=>{try{if(H(m),typeof t.program!="string"||!Object.hasOwn(_,t.program)||typeof t.operation!="string"||!_[t.program].includes(t.operation))throw new e("Choose a supported finite NetNet desk operation.");let p=t.program,r=t.operation,P=E[p],z=Q[p],T=x.clientFor(b);if(await T.getChainId()!==b)throw new e("NetNet desk actions require chain 4663.");let D=await T.getBlock(),q=new Set(["program","operation"]),u=(n,s=[])=>T.readContract({address:P.address,abi:z,functionName:n,args:s,blockNumber:D.number}),h=(...n)=>n.forEach(s=>q.add(s)),A=()=>(h("amount"),y(t.amount)),S=()=>(h("minAmountOut"),y(t.minAmountOut)),d=n=>K(n,"Provide an explicit checksummed account.",M),l=[],a,c=0n,w="",g;if(p==="pair_oracle"){if(d(await u("pairContract"))!==Z)throw new e("The oracle does not use the pinned canonical pair.");w="Permissionless oracle checkpoint; it sends no reward to this wallet and may not yet produce a valid TWAP."}else if(p==="futures"||p==="underwriting"){if(d(await u("token"))!==v.address||await T.readContract({address:v.address,abi:X,functionName:"decimals",blockNumber:D.number})!==9)throw new e("This desk does not use the pinned valueless 9-decimal tNET test collateral.");let n=E.futures.address,s=E.underwriting.address;if(p==="futures"?d(await u("vault"))!==s:d(await u("clearinghouse"))!==n)throw new e("Futures and underwriting counterparties do not match the published pins.");if(w="Experimental tNET test program; tNET has no monetary value. Futures margin and underwriting capital can be lost. Utilization/ADL can prevent redemption. Prices and fees are read from the contract oracle; these calls encode no price floor.",r==="open"){if(h("isLong","sizeUsdWad","maxPayment"),typeof t.isLong!="boolean")throw new e("Provide isLong as a boolean.");let o=A(),f=y(t.sizeUsdWad);if(o>=1n<<128n||f>=1n<<128n)throw new e("Position margin and notional must fit uint128.");let k=d(await u("oracle"));if(k!==W("0xc8a11E8793F8714a159061369173dc86A0A5E23F"))throw new e("The futures oracle is not the published deployment.");let C=await T.readContract({address:k,abi:ee(["function marginPriceWad() view returns (uint256)"]),functionName:"marginPriceWad",blockNumber:D.number});if(C<=0n)throw new e("Futures margin price is unavailable.");let i=f*5n/10000n*1000000000n/C;if(c=o+i,a=v,c>y(t.maxPayment))throw new e("Margin plus taker fee exceeds maxPayment.");l=[t.isLong,f,o],w+=` Entry fee ${i} tNET base units; exact approval caps price drift and may require a fresh preview.`}else if(r==="marginCall"){h("account");let o=d(t.account);if(await u("liquidatable",[o])!==!0)throw new e("The selected futures trader is not liquidatable.");l=[o]}else if(r==="subscribe"){c=A(),a=v,l=[c];let[o,f]=await Promise.all([u("totalShares"),u("equityTokens")]);if(typeof o!="bigint"||typeof f!="bigint"||o>0n&&f===0n)throw new e("Underwriting share price is invalid.");let k=o===0n?c:c*o/f;if(k===0n||k<S())throw new e("Underwriting subscription rounds to zero or misses the local share minimum.");w+=` Current quote ${k} underwriting share units; the share minimum is a local check, not encoded calldata.`}else if(r==="redeem"){let o=A();if(o>await u("sharesOf",[m]))throw new e("The wallet has insufficient underwriting shares.");l=[o],g={token:v,amount:S()}}}else{let[n,s,o,f,k,C]=await Promise.all(["net","usdg","staking","sNet","controller","book"].map(i=>u(i)));if(d(n)!==I.address||d(s)!==$.address||d(o)!==V||d(f)!==J.address||d(k)!==E.draw.address||d(C)!==E.bonus.address)throw new e("WinNET token, staking, book or controller does not match its published pins.");if(w="WinNET principal is a fixed NET claim, exposed to NET price changes. Entry commits through three staking epochs; locks commit for 7 or 30 draws. Early unlock forfeits 1% of principal and cancels streak credits. Pair buys and sells each incur the NET trading tax; no prize or return is guaranteed.",r==="enter"||r==="enterWithNet"){h("referrer");let i=t.referrer===void 0?te:d(t.referrer);if(i===W(m))throw new e("WinNET does not permit self-referral.");c=A(),a=r==="enter"?$:I,l=r==="enter"?[c,S(),i]:[c,i],w+=` Referrer ${i} is recorded at the first deposit and cannot later be changed.`}else if(r==="exit"||r==="exitToUsdg"){let i=A();if(i>await u("principalOf",[m]))throw new e("WinNET exit exceeds this wallet\u2019s fixed principal.");l=r==="exit"?[i,m]:[i,S(),m],g={token:r==="exit"?I:$,amount:r==="exit"?i:y(t.minAmountOut)}}else if(r==="lockTranche"||r==="earlyUnlock"){h("trancheIndex");let i=y(t.trancheIndex,!0),U=await u("trancheAt",[m,i]);if(!Array.isArray(U)||typeof U[0]!="bigint"||U[0]===0n)throw new e("Choose a nonempty WinNET tranche.");if(r==="lockTranche"){if(h("lockDraws"),t.lockDraws!=="7"&&t.lockDraws!=="30")throw new e("Choose a 7- or 30-draw lock.");l=[i,BigInt(t.lockDraws)]}else{h("maxPenaltyAssets");let j=(U[0]+99n)/100n;if(j>y(t.maxPenaltyAssets,!0))throw new e("Early unlock exceeds maxPenaltyAssets in NET base units.");l=[i],w+=` Current irreversible forfeiture ${j} NET base units.`}}}if(Object.keys(t).some(n=>!q.has(n)))throw new e("Unexpected fields for this desk operation.");if(a&&await T.readContract({address:a.address,abi:X,functionName:"balanceOf",args:[m],blockNumber:D.number})<c)throw new e(`Top up ${a.symbol}; this action needs ${c} base units.`);let F=`NetNet ${p}.${r}, contract ${P.address}, chain ${b}, ordered values ${JSON.stringify(l,(n,s)=>typeof s=="bigint"?String(s):s)}. ${a?`Approve exactly ${c} ${a.symbol} base units (token ${a.address}, decimals ${a.decimals}). `:""}${w}`,L=[...a?[x.approval(a.address,P.address,c.toString(),b)]:[],x.unsignedTx({to:P.address,data:Y({abi:z,functionName:r,args:l}),value:"0",chainId:b,description:F})],R=await x.preview(L,m),B=0n,G=0n;for(let n of R.changes){if(n.token.chainId!==b||!/^-?\d+$/.test(n.amount))throw new e("Invalid desk preview metadata.");let s=BigInt(n.amount);if(s<0n){if(!a||!O(n.token.address,a.address)||n.token.decimals!==a.decimals)throw new e("Desk preview spends an unexpected wallet asset.");B-=s}if(g&&O(n.token.address,g.token.address)){if(n.token.decimals!==g.token.decimals)throw new e("Desk receipt decimals mismatch.");G+=s}}if(B>c||g&&G<g.amount)throw new e("Desk preview exceeds its input budget or misses the requested receipt minimum.");return{txs:L,preview:R,summary:F}}catch(p){throw new e(x.plainError(p))}}}]});export{v as a,fe as b};
1
+ import{a as Q}from"./CEQNXF6A.js";import{b as Z}from"./C2H3BWN5.js";import{a as I,b as J,d as V}from"./OHZHQSCA.js";import{a as E}from"./QYKXWBZC.js";import{L as y}from"./DPSFR3ZS.js";import{c as $}from"./5PNFV7HH.js";import{a as H}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{d as M,g as O,i as K}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as Y,erc20Abi as X,getAddress as W,parseAbi as ee,zeroAddress as te}from"viem";var v={address:W("0xCeF73866b088766DeD46Ba71d9Bd7591B5e931d2"),symbol:"tNET",decimals:9,chainId:b},_={pair_oracle:["checkpoint"],futures:["open","close","marginCall","accrueCarry","sweepCarrySkim"],underwriting:["subscribe","redeem"],prize:["enter","enterWithNet","exit","exitToUsdg","lockTranche","earlyUnlock","pokeRebase"]},fe=x=>({tools:[{name:"netnet_desk_action",inputSchema:{type:"object",additionalProperties:!1,required:["program","operation"],properties:{program:{type:"string",enum:Object.keys(_),description:"Desk program: pair_oracle (price checkpoint), futures, underwriting or prize (WinNET)."},operation:{type:"string",enum:[...new Set(Object.values(_).flat())],description:"Action to run; it must be one the chosen program supports (see the program list in this tool)."},amount:N('Amount in base units of the token the operation spends or moves: tNET 9 decimals for futures and underwriting, USDG 6 or NET 9 for prize. Example: "1000000000" = 1 NET.'),minAmountOut:N('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9, underwriting shares). Example: "1000000" = 1 USDG.'),maxPayment:N('Most tNET you will pay for futures open (margin plus fee), in tNET base units (9 decimals). Example: "1000000000" = 1 tNET.'),sizeUsdWad:N('Futures position notional in USD as an 18-decimal wad in base units (1e18 = 1 USD). Example: "100000000000000000000" = 100 USD.'),isLong:{type:"boolean",description:"Futures open only: true for a long position, false for a short."},account:{type:"string",description:"Futures marginCall only: address of the trader to margin-call; they must be liquidatable."},referrer:{type:"string",description:"Prize enter only: optional referrer address recorded at the first deposit; cannot be your own wallet."},trancheIndex:N('Zero-based index of your WinNET tranche to lock or unlock early, as a decimal string. Example: "0".'),lockDraws:{enum:["7","30"],description:"Prize lockTranche only: commit the tranche for 7 or 30 draws."},maxPenaltyAssets:N('Prize earlyUnlock only: highest forfeited principal you accept, in NET base units (9 decimals). Example: "1000000000" = 1 NET.')}},execute:async(t,m)=>{try{if(H(m),typeof t.program!="string"||!Object.hasOwn(_,t.program)||typeof t.operation!="string"||!_[t.program].includes(t.operation))throw new e("Choose a supported finite NetNet desk operation.");let p=t.program,r=t.operation,P=E[p],z=Q[p],T=x.clientFor(b);if(await T.getChainId()!==b)throw new e("NetNet desk actions require chain 4663.");let D=await T.getBlock(),q=new Set(["program","operation"]),u=(n,s=[])=>T.readContract({address:P.address,abi:z,functionName:n,args:s,blockNumber:D.number}),h=(...n)=>n.forEach(s=>q.add(s)),A=()=>(h("amount"),y(t.amount)),S=()=>(h("minAmountOut"),y(t.minAmountOut)),d=n=>K(n,"Provide an explicit checksummed account.",M),l=[],a,c=0n,w="",g;if(p==="pair_oracle"){if(d(await u("pairContract"))!==Z)throw new e("The oracle does not use the pinned canonical pair.");w="Permissionless oracle checkpoint; it sends no reward to this wallet and may not yet produce a valid TWAP."}else if(p==="futures"||p==="underwriting"){if(d(await u("token"))!==v.address||await T.readContract({address:v.address,abi:X,functionName:"decimals",blockNumber:D.number})!==9)throw new e("This desk does not use the pinned valueless 9-decimal tNET test collateral.");let n=E.futures.address,s=E.underwriting.address;if(p==="futures"?d(await u("vault"))!==s:d(await u("clearinghouse"))!==n)throw new e("Futures and underwriting counterparties do not match the published pins.");if(w="Experimental tNET test program; tNET has no monetary value. Futures margin and underwriting capital can be lost. Utilization/ADL can prevent redemption. Prices and fees are read from the contract oracle; these calls encode no price floor.",r==="open"){if(h("isLong","sizeUsdWad","maxPayment"),typeof t.isLong!="boolean")throw new e("Provide isLong as a boolean.");let o=A(),f=y(t.sizeUsdWad);if(o>=1n<<128n||f>=1n<<128n)throw new e("Position margin and notional must fit uint128.");let k=d(await u("oracle"));if(k!==W("0xc8a11E8793F8714a159061369173dc86A0A5E23F"))throw new e("The futures oracle is not the published deployment.");let C=await T.readContract({address:k,abi:ee(["function marginPriceWad() view returns (uint256)"]),functionName:"marginPriceWad",blockNumber:D.number});if(C<=0n)throw new e("Futures margin price is unavailable.");let i=f*5n/10000n*1000000000n/C;if(c=o+i,a=v,c>y(t.maxPayment))throw new e("Margin plus taker fee exceeds maxPayment.");l=[t.isLong,f,o],w+=` Entry fee ${i} tNET base units; exact approval caps price drift and may require a fresh preview.`}else if(r==="marginCall"){h("account");let o=d(t.account);if(await u("liquidatable",[o])!==!0)throw new e("The selected futures trader is not liquidatable.");l=[o]}else if(r==="subscribe"){c=A(),a=v,l=[c];let[o,f]=await Promise.all([u("totalShares"),u("equityTokens")]);if(typeof o!="bigint"||typeof f!="bigint"||o>0n&&f===0n)throw new e("Underwriting share price is invalid.");let k=o===0n?c:c*o/f;if(k===0n||k<S())throw new e("Underwriting subscription rounds to zero or misses the local share minimum.");w+=` Current quote ${k} underwriting share units; the share minimum is a local check, not encoded calldata.`}else if(r==="redeem"){let o=A();if(o>await u("sharesOf",[m]))throw new e("The wallet has insufficient underwriting shares.");l=[o],g={token:v,amount:S()}}}else{let[n,s,o,f,k,C]=await Promise.all(["net","usdg","staking","sNet","controller","book"].map(i=>u(i)));if(d(n)!==I.address||d(s)!==$.address||d(o)!==V||d(f)!==J.address||d(k)!==E.draw.address||d(C)!==E.bonus.address)throw new e("WinNET token, staking, book or controller does not match its published pins.");if(w="WinNET principal is a fixed NET claim, exposed to NET price changes. Entry commits through three staking epochs; locks commit for 7 or 30 draws. Early unlock forfeits 1% of principal and cancels streak credits. Pair buys and sells each incur the NET trading tax; no prize or return is guaranteed.",r==="enter"||r==="enterWithNet"){h("referrer");let i=t.referrer===void 0?te:d(t.referrer);if(i===W(m))throw new e("WinNET does not permit self-referral.");c=A(),a=r==="enter"?$:I,l=r==="enter"?[c,S(),i]:[c,i],w+=` Referrer ${i} is recorded at the first deposit and cannot later be changed.`}else if(r==="exit"||r==="exitToUsdg"){let i=A();if(i>await u("principalOf",[m]))throw new e("WinNET exit exceeds this wallet\u2019s fixed principal.");l=r==="exit"?[i,m]:[i,S(),m],g={token:r==="exit"?I:$,amount:r==="exit"?i:y(t.minAmountOut)}}else if(r==="lockTranche"||r==="earlyUnlock"){h("trancheIndex");let i=y(t.trancheIndex,!0),U=await u("trancheAt",[m,i]);if(!Array.isArray(U)||typeof U[0]!="bigint"||U[0]===0n)throw new e("Choose a nonempty WinNET tranche.");if(r==="lockTranche"){if(h("lockDraws"),t.lockDraws!=="7"&&t.lockDraws!=="30")throw new e("Choose a 7- or 30-draw lock.");l=[i,BigInt(t.lockDraws)]}else{h("maxPenaltyAssets");let j=(U[0]+99n)/100n;if(j>y(t.maxPenaltyAssets,!0))throw new e("Early unlock exceeds maxPenaltyAssets in NET base units.");l=[i],w+=` Current irreversible forfeiture ${j} NET base units.`}}}if(Object.keys(t).some(n=>!q.has(n)))throw new e("Unexpected fields for this desk operation.");if(a&&await T.readContract({address:a.address,abi:X,functionName:"balanceOf",args:[m],blockNumber:D.number})<c)throw new e(`Top up ${a.symbol}; this action needs ${c} base units.`);let F=`NetNet ${p}.${r}, contract ${P.address}, chain ${b}, ordered values ${JSON.stringify(l,(n,s)=>typeof s=="bigint"?String(s):s)}. ${a?`Approve exactly ${c} ${a.symbol} base units (token ${a.address}, decimals ${a.decimals}). `:""}${w}`,L=[...a?[x.approval(a.address,P.address,c.toString(),b)]:[],x.unsignedTx({to:P.address,data:Y({abi:z,functionName:r,args:l}),value:"0",chainId:b,description:F})],R=await x.preview(L,m),B=0n,G=0n;for(let n of R.changes){if(n.token.chainId!==b||!/^-?\d+$/.test(n.amount))throw new e("Invalid desk preview metadata.");let s=BigInt(n.amount);if(s<0n){if(!a||!O(n.token.address,a.address)||n.token.decimals!==a.decimals)throw new e("Desk preview spends an unexpected wallet asset.");B-=s}if(g&&O(n.token.address,g.token.address)){if(n.token.decimals!==g.token.decimals)throw new e("Desk receipt decimals mismatch.");G+=s}}if(B>c||g&&G<g.amount)throw new e("Desk preview exceeds its input budget or misses the requested receipt minimum.");return{txs:L,preview:R,summary:F}}catch(p){throw new e(x.plainError(p))}}}]});export{v as a,fe as b};
@@ -1 +1 @@
1
- import{b as B}from"./S4JUFCT4.js";import{a as u,b,c,e as k,f as m,g as l,h as w}from"./WAKZWSHB.js";import{e as y,m as o}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as x}from"viem";var a="LayerBank returned a malformed reserve read. Please try again.";function N(r){let s=o(r,a);if(s>=1n<<128n)throw new n(a);return s}async function I(r,s){try{let e=s??await r.getBlockNumber({cacheTime:0}),p=await B(r,e),[f,h,R,v]=await Promise.all([r.readContract({address:u,abi:l,functionName:"getConfiguration",args:[c.address],blockNumber:e}),r.readContract({address:c.address,abi:L,functionName:"balanceOf",args:[b],blockNumber:e}),r.readContract({address:b,abi:w,functionName:"scaledTotalSupply",blockNumber:e}),r.readContract({address:u,abi:l,functionName:"getReserveNormalizedIncome",args:[c.address],blockNumber:e})]);if(!y(f))throw new n(a);let t=o(f.data,a);if((t>>48n&255n)!==6n)throw new n(a);let C=N(p.currentLiquidityRate),P=N(p.accruedToTreasury),T=o(R,a),g=o(v,a);if(g===0n)throw new n(a);let d=((T+P)*g+m/2n)/m,i=(t>>116n&(1n<<36n)-1n)*10n**6n;return{blockNumber:e,active:(t&1n<<56n)!==0n,frozen:(t&1n<<57n)!==0n,paused:(t&1n<<60n)!==0n,supplyCapBase:i,suppliedBase:d,capRoomBase:i===0n?k:d>=i?0n:i-d,cashUsdgBase:o(h,a),rateBasePct:Number(x(C,25))}}catch(e){throw e instanceof n?e:new n("LayerBank reserve could not be read. Please try again.")}}export{I as a};
1
+ import{b as B}from"./MSQNOK3I.js";import{a as u,b,c,e as k,f as m,g as l,h as w}from"./5KKAN7XQ.js";import{e as y,m as o}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as x}from"viem";var a="LayerBank returned a malformed reserve read. Please try again.";function N(r){let s=o(r,a);if(s>=1n<<128n)throw new n(a);return s}async function I(r,s){try{let e=s??await r.getBlockNumber({cacheTime:0}),p=await B(r,e),[f,h,R,v]=await Promise.all([r.readContract({address:u,abi:l,functionName:"getConfiguration",args:[c.address],blockNumber:e}),r.readContract({address:c.address,abi:L,functionName:"balanceOf",args:[b],blockNumber:e}),r.readContract({address:b,abi:w,functionName:"scaledTotalSupply",blockNumber:e}),r.readContract({address:u,abi:l,functionName:"getReserveNormalizedIncome",args:[c.address],blockNumber:e})]);if(!y(f))throw new n(a);let t=o(f.data,a);if((t>>48n&255n)!==6n)throw new n(a);let C=N(p.currentLiquidityRate),P=N(p.accruedToTreasury),T=o(R,a),g=o(v,a);if(g===0n)throw new n(a);let d=((T+P)*g+m/2n)/m,i=(t>>116n&(1n<<36n)-1n)*10n**6n;return{blockNumber:e,active:(t&1n<<56n)!==0n,frozen:(t&1n<<57n)!==0n,paused:(t&1n<<60n)!==0n,supplyCapBase:i,suppliedBase:d,capRoomBase:i===0n?k:d>=i?0n:i-d,cashUsdgBase:o(h,a),rateBasePct:Number(x(C,25))}}catch(e){throw e instanceof n?e:new n("LayerBank reserve could not be read. Please try again.")}}export{I as a};
@@ -0,0 +1 @@
1
+ import{e as u,f as l}from"./UMY6SP7C.js";import{a as s}from"./XSD5NL7J.js";var c={id:"buy-sell-block",fields:["buyPause","sellLock"]};function d(o,e){u(e,["id","buyPause","sellLock"],["id","buyPause","sellLock"]);let n=l(e.buyPause,16),t=l(e.sellLock,8);if(e.id!==c.id||n>300n||t>5n||!(n||t)||!o.guardEndBlock)throw new s("Buy/Sell Block needs a guard and at least one window: buyPause 0\u2013300, sellLock 0\u20135.");let r=511n<<85n|7n<<94n;if(o.potEveryNBuys&1<<23||o.potMinBuyQuote&r)throw new s("Buy/Sell Block windows are already set.");return{...o,potEveryNBuys:o.potEveryNBuys|1<<30|1<<23,potMinBuyQuote:o.potMinBuyQuote|n<<85n|t<<94n}}function a(o){let e=o.potMinBuyQuote>>85n&511n,n=o.potMinBuyQuote>>94n&7n;return`Buy/Sell Block: buys paused for ${e*12n} seconds and sells locked for ${n*12n} seconds from launch, subject to the parent-block guard; the launch's own buy and initial liquidity are exempt. No fee is charged. Same-block round-trip blocking is not included.`}export{c as a,d as b,a as c};
@@ -1 +1 @@
1
- import{m as Y}from"./7OOCAZBE.js";import{b as V,c as W,d as G}from"./N624NR7Y.js";import{d as de,e as L}from"./GYPMUYB5.js";import{a as B}from"./Z7FGEWO2.js";import{a as N}from"./43LI5NKJ.js";import{b as H,c as se,d as ae,e as j}from"./IX3GZMTM.js";import{b as x,j as D}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{a as S}from"./JXOEJPJ4.js";import{decodeEventLog as $e,encodeAbiParameters as pe,encodeFunctionData as ye,erc20Abi as Z,getAddress as l,isAddress as E,keccak256 as Ee,parseAbi as _e,parseAbiParameters as we,toEventSelector as ge}from"viem";var A=l(D[4663].hookr.HookrLimitOrders.address),ve=l(D[4663].hookr.HookrRoot.address),Ne=l(D[4663].hookr.HookrRouter.address),It=l(D[4663].hookr.HookrRegistry.address),Be=l(D[4663].hookr.HookrForwarder.address),Fe=l(D[4663].hookr.PoolManager.address),At=l(D[4663].hookr.HOOKR_Token.address),Me=l("0x000000000000000000000000000000000000dEaD"),ze=8388608,qe=200,ce=60n,Xe=604800n,ue=31536000n,ht=10,St=100,xt="500000000000000",Ct="10000000000000000",me=4096n,Q=32n,Ke=1e4,Ue=(1n<<127n)-1n,le=(1n<<128n)-1n,je=(1n<<160n)-1n,Ve=(1n<<40n)-1n,We=16777215,Ge=8388607,fe=1n<<192n,ee=0,M=1,Ye=2,Qe=3,Ze=ge("OrderCreated(uint256,address,bytes32,bool,uint128,uint128,uint128,uint40,address)"),Dt=ge("OrderCancelled(uint256,address,address,uint256,uint256)"),P=_e(["function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function createOrder(((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint160 sqrtPriceLimitX96, address recipient, uint40 expiry, uint128 bounty) params) payable returns (uint256 orderId)","function cancel(uint256 orderId, address to)","function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)","function router() view returns (address)","function registry() view returns (address)","function poolManager() view returns (address)","function forwarder() view returns (address)","event OrderCreated(uint256 indexed orderId, address indexed owner, bytes32 indexed poolId, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint40 expiry, address recipient)","event OrderCancelled(uint256 indexed orderId, address indexed owner, address indexed to, uint256 amountIn, uint256 bounty)"]);function F(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ke(e){let t=e.toLowerCase();return t===L.toLowerCase()||t===B.toLowerCase()||t===de.toLowerCase()}function $(e,t){if(typeof e!="string"||!e.trim())throw new o(`Provide a valid contract address for ${t}. Identify tokens by chain and address, never by symbol.`);let n=e.trim();if(!E(n,{strict:!1}))throw new o(`Invalid token address "${n}" for ${t}. Identify tokens by chain and address, never by symbol.`);return ke(n)?L:l(n)}function be(e){let t=e===void 0?x:Number(e);if(!Number.isSafeInteger(t)||t!==x)throw new o(`Hookr limit orders are only supported on Robinhood Chain (${x}).`);return x}function Je(e){switch(e){case ee:return"None";case M:return"Open";case Ye:return"Filled";case Qe:return"Cancelled";default:return"Unknown"}}function et(e,t,n=ae){if(typeof e!="string"||!/^-?\d+$/.test(e.trim()))throw new o("Signed amount must be an integer string in base units.");let r=e.trim();if(r.startsWith("-")){let i=r.slice(1),u=n(i,t);return u==="0"?"0":`-${u}`}return n(r,t)}function Pt(e,t,n="floor"){return se(e,t,n)}function Oe(e){return Ee(pe(we("address, address, uint24, int24, address"),[l(e.currency0),l(e.currency1),e.fee,e.tickSpacing,l(e.hooks)]))}function Ie(e,t){let n=e.toLowerCase();if(new Set([L.toLowerCase(),Me.toLowerCase(),A.toLowerCase(),Ne.toLowerCase(),Be.toLowerCase(),Fe.toLowerCase(),t.toLowerCase()]).has(n))throw new o(`Recipient ${e} is a reserved address and cannot receive Hookr limit order funds.`)}async function J(e,t,n,r){if(ke(e))return{address:B,symbol:V.symbol,decimals:V.decimals,chainId:t};let i=l(e),u=i.toLowerCase();if(F(r)){let s=typeof r.decimals=="number"&&Number.isInteger(r.decimals)&&r.decimals>=0&&r.decimals<=255?r.decimals:void 0,a=typeof r.symbol=="string"&&r.symbol.trim()?r.symbol.trim():void 0;if(s!==void 0&&a!==void 0)return{address:i,symbol:a,decimals:s,chainId:t}}if(u===W.address.toLowerCase())return{...W,chainId:t};if(u===G.address.toLowerCase())return{...G,chainId:t};try{let[s,a]=await Promise.all([n.readContract({address:i,abi:Z,functionName:"symbol"}),n.readContract({address:i,abi:Z,functionName:"decimals"})]);if(typeof s!="string"||!s.trim()||typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new o(`Invalid token metadata for ${i}.`);return{address:i,symbol:s.trim(),decimals:a,chainId:t}}catch{throw new o(`Could not read valid token metadata for ${i}. Refusing to guess token decimals.`)}}function tt(e){let t=F(e.key)?e.key:F(e.poolKey)?e.poolKey:void 0,n=t?.fee??e.fee??ze,r=(typeof n=="string"&&/^\d+$/.test(n),Number(n));if(!Number.isInteger(r)||r<0||r>We)throw new o("Pool fee must be a valid uint24 integer (default 8388608 for Hookr dynamic fee pools).");let i=t?.tickSpacing??e.tickSpacing??qe,u=(typeof i=="string"&&/^-?\d+$/.test(i),Number(i));if(!Number.isInteger(u)||u<=0||u>Ge)throw new o("Pool tickSpacing must be a positive int24 integer.");let s=t?.hooks??e.hooks??ve;if(typeof s!="string"||!E(s,{strict:!1}))throw new o("Provide a valid Hookr root contract address for hooks.");let a=l(s);if(t?.currency0!==void 0&&t?.currency1!==void 0||e.currency0!==void 0&&e.currency1!==void 0){let m=$(t?.currency0??e.currency0,"currency0"),I=$(t?.currency1??e.currency1,"currency1");if(m.toLowerCase()===I.toLowerCase())throw new o("Pool currency0 and currency1 must be distinct token addresses.");if(BigInt(m)>=BigInt(I))throw new o("Pool currency0 must sort strictly before currency1 by address.");let b;if(typeof e.zeroForOne=="boolean")b=e.zeroForOne;else if(e.tokenIn!==void 0||e.from!==void 0){let C=$(e.tokenIn??e.from,"tokenIn");if(C.toLowerCase()===m.toLowerCase())b=!0;else if(C.toLowerCase()===I.toLowerCase())b=!1;else throw new o("tokenIn does not match currency0 or currency1 of the pool key.")}else throw new o("Provide zeroForOne (boolean) or tokenIn when specifying a pool key.");return{key:{currency0:m,currency1:I,fee:r,tickSpacing:u,hooks:a},zeroForOne:b}}let w=e.tokenIn??e.from,f=e.tokenOut??e.to;if(w===void 0||f===void 0)throw new o("Provide either key ({ currency0, currency1, fee, tickSpacing, hooks }) with zeroForOne or tokenIn and tokenOut addresses.");let g=$(w,"tokenIn"),k=$(f,"tokenOut");if(g.toLowerCase()===k.toLowerCase())throw new o("Input and output tokens must have distinct addresses.");let p=BigInt(g)<BigInt(k),y=p?g:k,d=p?k:g;if(typeof e.zeroForOne=="boolean"&&e.zeroForOne!==p)throw new o("zeroForOne conflicts with the canonical sorting of tokenIn and tokenOut.");return{key:{currency0:y,currency1:d,fee:r,tickSpacing:u,hooks:a},zeroForOne:p}}function nt(e,t,n){let r=Y(t),i=r*r;if(n){let s=j(e.toString(),i.toString(),fe.toString(),"ceil");return BigInt(s)}let u=j(e.toString(),fe.toString(),i.toString(),"ceil");return BigInt(u)}function R(e,t){if(typeof e=="bigint"){if(e<0n)throw new o(`${t} must be a non-negative integer.`);return e}if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new o(`${t} must be a non-negative safe integer.`);return BigInt(e)}if(typeof e=="string")return H(e.trim());throw new o(`Provide ${t} as a decimal base-unit string.`)}async function ot(e,t){if(t!==void 0)return R(t,"now");if(typeof e.getBlock=="function"){let n=await e.getBlock().catch(()=>{throw new o("Could not read the chain timestamp for Hookr order expiry.")});return BigInt(n.timestamp)}throw new o("Could not read the chain timestamp for Hookr order expiry.")}function Ae(e,t){return!e.changes||e.changes.length===0?"no net ERC-20 transfer deltas":e.changes.map(n=>`${et(n.amount,n.token.decimals,t.formatAmount)} ${S(n.token.symbol)}`).join(", ")}function rt(e,t,n,r){if(!e||!Array.isArray(e.logs))throw new o("Provide a transaction receipt with a logs array.");for(let i of e.logs){if(!i||typeof i.address!="string"||!E(i.address,{strict:!1})||!Array.isArray(i.topics)||typeof i.data!="string"||i.topics.some(u=>typeof u!="string"||!/^0x[0-9a-fA-F]{64}$/.test(u)))throw new o(`Malformed Hookr ${t} receipt log.`);if(i.address.toLowerCase()===A.toLowerCase()&&i.topics[0]?.toLowerCase()===n.toLowerCase()){if(i.topics.length!==4||!/^0x0{24}/i.test(i.topics[2])||t==="OrderCancelled"&&!/^0x0{24}/i.test(i.topics[3])||!/^0x[0-9a-fA-F]*$/.test(i.data)||i.data.length!==2+r*64)throw new o(`Malformed Hookr ${t} receipt log.`);return{topics:i.topics,data:i.data}}}throw new o(`Could not find Hookr ${t} event in transaction receipt logs.`)}function he(e){if(e.receipt!==void 0){if(!F(e.receipt)||!Array.isArray(e.receipt.logs))throw new o("Provide a transaction receipt with a logs array.");return st({logs:e.receipt.logs})}if(e.logs!==void 0){if(!Array.isArray(e.logs))throw new o("Provide receipt logs as an array.");return it(e.logs)}}function Se(e){let t=rt(e,"OrderCreated",Ze,6);try{let n=$e({abi:P,eventName:"OrderCreated",...t,strict:!0});if(pe(we("bool, uint128, uint128, uint128, uint40, address"),[n.args.zeroForOne,n.args.amountIn,n.args.minAmountOut,n.args.bounty,n.args.expiry,n.args.recipient]).toLowerCase()!==t.data.toLowerCase())throw new o("Noncanonical Hookr OrderCreated event data.");return{orderId:n.args.orderId.toString(),owner:l(n.args.owner),poolId:n.args.poolId,zeroForOne:n.args.zeroForOne,amountIn:n.args.amountIn.toString(),minAmountOut:n.args.minAmountOut.toString(),bounty:n.args.bounty.toString(),expiry:n.args.expiry.toString(),recipient:l(n.args.recipient)}}catch{throw new o("Malformed Hookr OrderCreated receipt log.")}}function it(e){return Se({logs:e}).orderId}function st(e){return Se(e).orderId}function xe(e){if(Array.isArray(e)){let[n,r,i,u,s,a,c,w,f,g,k]=e;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:r,createdAt:i,expiry:u,zeroForOne:s,status:a,recipient:c,amountIn:BigInt(w),minAmountOut:BigInt(f),bounty:BigInt(g),sqrtPriceLimitX96:BigInt(k)}}let t=e;return{key:{currency0:t.key.currency0,currency1:t.key.currency1,fee:Number(t.key.fee),tickSpacing:Number(t.key.tickSpacing),hooks:t.key.hooks},owner:t.owner,createdAt:t.createdAt,expiry:t.expiry,zeroForOne:!!t.zeroForOne,status:Number(t.status),recipient:t.recipient,amountIn:BigInt(t.amountIn),minAmountOut:BigInt(t.minAmountOut),bounty:BigInt(t.bounty),sqrtPriceLimitX96:BigInt(t.sqrtPriceLimitX96)}}async function Ce(e,t,n){let r=R(t,"orderId");if(r<=0n)throw new o("Order ID must be a positive integer.");let i=e.clientFor(x),u=n?.order??await i.readContract({address:A,abi:P,functionName:"getOrder",args:[r]}).catch(()=>{throw new o(`Could not read Hookr order #${r}. Order coverage is incomplete.`)}),s=xe(u),a=Number(s.status);if(s.owner.toLowerCase()===L.toLowerCase()||a===ee)throw new o(`Hookr order #${r} does not exist.`);let c={currency0:l(s.key.currency0),currency1:l(s.key.currency1),fee:Number(s.key.fee),tickSpacing:Number(s.key.tickSpacing),hooks:l(s.key.hooks)},w=s.zeroForOne?c.currency0:c.currency1,f=s.zeroForOne?c.currency1:c.currency0,g=m=>{let I=m.toLowerCase(),b=n?.tokens.get(I);if(b)return b;let C=J(m,x,i);return n?.tokens.set(I,C),C},[k,p]=await Promise.all([g(w),g(f)]),y=!1,d=0n;if(a===M)try{let m=await i.readContract({address:A,abi:P,functionName:"quoteFill",args:[r]});if(typeof m[0]!="boolean"||typeof m[1]!="bigint"||m[1]<0n)throw new o(`Invalid quote for Hookr order #${r}.`);y=m[0],d=m[1]}catch{throw new o(`Could not quote Hookr order #${r}. Fillability and output amount are unknown.`)}return{orderId:r.toString(),poolId:Oe(c),key:c,owner:l(s.owner),recipient:l(s.recipient),createdAt:BigInt(s.createdAt).toString(),expiry:BigInt(s.expiry).toString(),zeroForOne:s.zeroForOne,status:a,statusLabel:Je(a),amountIn:s.amountIn.toString(),minAmountOut:s.minAmountOut.toString(),bounty:s.bounty.toString(),sqrtPriceLimitX96:s.sqrtPriceLimitX96.toString(),tokenIn:k,tokenOut:p,fillable:y,quotedAmountOut:d.toString()}}function at(e){return{name:"hookr_create",inputSchema:{type:"object",properties:{key:{type:"object",description:"Uniswap v4 PoolKey of the pool to place the order in; omitted fee, tickSpacing and hooks use Hookr defaults. tokenIn or zeroForOne picks the direction.",properties:{currency0:{type:"string",description:"Lower-sorted pool token address (0x followed by 40 hex digits)."},currency1:{type:"string",description:"Higher-sorted pool token address (0x followed by 40 hex digits)."},fee:{type:"number",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%); default 8388608, the v4 dynamic-fee flag of Hookr pools."},tickSpacing:{type:"number",description:"Pool tick spacing, a positive integer; defaults to the Hookr pool spacing."},hooks:{type:"string",description:"Address of the pool hook contract; defaults to the Hookr root hook."}}},tokenIn:{type:"string",description:"Input token address on chain 4663."},tokenOut:{type:"string",description:"Output token address on chain 4663."},zeroForOne:{type:"boolean",description:"True when selling currency0 for currency1."},amountIn:{type:"string",description:"Input amount in base units (uint128)."},minAmountOut:{type:"string",description:"Minimum net output amount in base units (uint128)."},tick:{type:"number",description:"Optional limit tick in [-887272, 887272]."},expiry:{type:"string",description:"Order expiry unix timestamp in seconds (uint40)."},deadline:{type:"string",description:"Alias for expiry unix timestamp in seconds."},bounty:{type:"string",description:"Keeper bounty in native ETH wei (uint128)."},recipient:{type:"string",description:"Order output recipient address (must be the signing wallet)."},sqrtPriceLimitX96:{type:"string",description:"Optional sqrtPriceLimitX96 (defaults to 0)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["amountIn"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=e.clientFor(i),s=he(t),{key:a,zeroForOne:c}=tt(t),w=c?a.currency0:a.currency1,f=c?a.currency1:a.currency0,[g,k]=await Promise.all([J(w,i,u,t.tokenInMeta),J(f,i,u,t.tokenOutMeta)]),p=t.recipient??r;if(typeof p!="string"||!E(p,{strict:!1}))throw new o("Provide a valid recipient address for the Hookr limit order.");let y=l(p);if(Ie(y,a.hooks),y!==r)throw new o("Hookr recipient must be the signing wallet.");if(typeof t.amountIn!="string")throw new o("Provide amountIn as an integer string in base units.");let d=H(t.amountIn);if(d<=0n||d>Ue)throw new o("amountIn must be between 1 and int128.max base units.");if(t.tick!==void 0){let T=Number(t.tick);Y(T)}let m;if(t.minAmountOut!==void 0){if(typeof t.minAmountOut!="string")throw new o("Provide minAmountOut as an integer string in base units.");m=H(t.minAmountOut)}else if(t.tick!==void 0)m=nt(d,Number(t.tick),c);else throw new o("Provide minAmountOut in base units (or tick to derive minAmountOut).");if(m<=0n||m>le)throw new o("minAmountOut must be between 1 and uint128.max base units.");let I=t.sqrtPriceLimitX96!==void 0?R(t.sqrtPriceLimitX96,"sqrtPriceLimitX96"):0n;if(I>je)throw new o("sqrtPriceLimitX96 exceeds uint160 bounds.");let b=await ot(u,t.now),C=t.expiry??t.deadline,O;if(C!==void 0)O=R(C,"expiry");else if(t.lifetime!==void 0||t.ttlSeconds!==void 0){let T=R(t.lifetime??t.ttlSeconds,"lifetime");O=b+T}else O=b+Xe;if(O<b+ce)throw new o(`Order expiry (${O}) is expired or below the minimum lifetime of ${ce} seconds from block timestamp ${b}.`);if(O>b+ue||O>Ve)throw new o(`Order expiry (${O}) exceeds the maximum lifetime of ${ue} seconds (365 days).`);let z=await u.readContract({address:A,abi:P,functionName:"bountyBounds",args:[a,c,d,m]}).catch(()=>{throw new o("Could not read Hookr bounty bounds.")}),_=BigInt(z[0]),q=BigInt(z[1]),X=BigInt(z[2]);if(t.bounty!==void 0&&typeof t.bounty!="string")throw new o("Provide bounty as an integer string in base units.");let h=t.bounty!==void 0?H(t.bounty):q,K=_>0n?_:q;if(h<_||K>0n&&h<K)throw new o(`Order keeper bounty (${h} wei) is underbounty: must be at least ${K} wei (default keeper bounty floor).`);if(h>X||h>le)throw new o(`Order keeper bounty (${h} wei) exceeds the maximum allowed bounty of ${X} wei.`);let te=w.toLowerCase()===L.toLowerCase(),v=[];if(!te){let T;try{let U=await u.readContract({address:w,abi:Z,functionName:"allowance",args:[r,A]});if(typeof U!="bigint"||U<0n)throw new o("Invalid token allowance.");T=U}catch{throw new o(`Could not read token allowance for ${w}. No approval was prepared.`)}T<d&&v.push(e.approval(w,A,d.toString(),i))}let Pe=te?d+h:h,Le=ye({abi:P,functionName:"createOrder",args:[{key:a,zeroForOne:c,amountIn:d,minAmountOut:m,sqrtPriceLimitX96:I,recipient:y,expiry:Number(O),bounty:h}]}),ne=e.formatAmount(d.toString(),g.decimals),oe=e.formatAmount(m.toString(),k.decimals),re=e.formatAmount(h.toString(),18),Te=e.unsignedTx({to:A,data:Le,value:Pe.toString(),chainId:i,description:`Create Hookr limit order on ${A}: sell ${ne} ${S(g.symbol)} (${g.address}) for at least ${oe} ${S(k.symbol)} (${k.address}) with ${re} ETH keeper bounty (fee=${a.fee}, tickSpacing=${a.tickSpacing}, expiry=${O}).`});v.push(Te);let ie=await e.preview(v,r),Re=Ae(ie,e),He=Oe(a);return{txs:v,summary:`Hookr limit order prepared: sell ${ne} ${S(g.symbol)} for at least ${oe} ${S(k.symbol)} (bounty ${re} ETH, expiry ${O}; preview deltas: ${Re}).`,preview:ie,poolId:He,key:a,zeroForOne:c,amountIn:d.toString(),minAmountOut:m.toString(),bounty:h.toString(),bountyBounds:{minBounty:_.toString(),defaultBounty:q.toString(),maxBounty:X.toString()},expiry:O.toString(),recipient:y,sqrtPriceLimitX96:I.toString(),tokenIn:g,tokenOut:k,...s!==void 0?{orderId:s}:{}}}}}function dt(e){return{name:"hookr_cancel",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"Hookr order ID to cancel (uint256 decimal string)."},to:{type:"string",description:"Recipient address for the refunded principal and bounty (must be the signing wallet)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["orderId"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=he(t),s=t.orderId??t.id??u;if(s===void 0)throw new o("Provide orderId to cancel a Hookr limit order.");let a=R(s,"orderId");if(a<=0n)throw new o("orderId must be a positive integer.");let c=await Ce(e,a);if(c.owner.toLowerCase()!==r.toLowerCase())throw new o(`Unauthorized cancellation: only the order owner (${c.owner}) can cancel Hookr order #${a} (caller is ${r}).`);if(c.status!==M)throw new o(`Hookr order #${a} is not open (current status: ${c.statusLabel}).`);let w=t.to??r;if(typeof w!="string"||!E(w,{strict:!1}))throw new o("Provide a valid refund recipient address for cancel.");let f=l(w);if(Ie(f,c.key.hooks),f!==r)throw new o("Hookr refund recipient must be the signing wallet.");let g=ye({abi:P,functionName:"cancel",args:[a,f]}),k=e.formatAmount(c.amountIn,c.tokenIn.decimals),p=e.formatAmount(c.bounty,18),y=e.unsignedTx({to:A,data:g,value:"0",chainId:i,description:`Cancel Hookr limit order #${a} on ${A} and refund ${k} ${S(c.tokenIn.symbol)} plus ${p} ETH bounty to ${f}.`}),d=await e.preview([y],r),m=Ae(d,e);return{txs:[y],summary:`Cancel Hookr limit order #${a}: refund ${k} ${S(c.tokenIn.symbol)} and ${p} ETH bounty to ${f} (preview deltas: ${m}).`,preview:d,orderId:a.toString(),to:f,refundedAmountIn:c.amountIn,refundedBounty:c.bounty,tokenIn:c.tokenIn,tokenOut:c.tokenOut}}}}function ct(e){let t=performance.now()+Ke;return new Proxy(e,{get(n,r,i){return r!=="readContract"?Reflect.get(n,r,i):async(...u)=>{let s=t-performance.now(),a=()=>new o("Hookr scan deadline exceeded. Order coverage is incomplete; retry later.");if(s<=0)throw a();let c;try{return await Promise.race([n.readContract(...u),new Promise((w,f)=>{c=setTimeout(()=>f(a()),s)})])}finally{c!==void 0&&clearTimeout(c)}}}})}function ut(e){return async t=>{N(t);let n=l(t),r=ct(e.clientFor(x)),i={...e,clientFor:()=>r},u=await r.readContract({address:A,abi:P,functionName:"lastOrderId"}).catch(()=>{throw new o("Could not read the last Hookr order ID. Order coverage is incomplete.")});if(typeof u!="bigint"||u<0n)throw new o("Could not read a valid last Hookr order ID. Order coverage is incomplete.");let s=u,a=s>me?s-me+1n:1n;if(s<=0n)return[];let c=[],w=new Map;for(let f=a;f<=s;f+=Q){let g=Array.from({length:Number(s-f+1n<Q?s-f+1n:Q)},(p,y)=>f+BigInt(y)),k=await Promise.all(g.map(async p=>{let y=await r.readContract({address:A,abi:P,functionName:"getOrder",args:[p]}).catch(()=>{throw new o(`Could not read Hookr order #${p}. Order coverage is incomplete.`)}),d=xe(y);if(d.owner.toLowerCase()===L||Number(d.status)===ee)throw new o(`Hookr order #${p} does not exist. Order coverage is incomplete.`);return{id:p,order:d}}));for(let{id:p,order:y}of k){if(y.owner.toLowerCase()!==n.toLowerCase()||Number(y.status)!==M)continue;let d=await Ce(i,p,{order:y,tokens:w}),m=[{token:d.tokenIn,amount:d.amountIn}];BigInt(d.bounty)>0n&&m.push({token:{address:B,symbol:"ETH",decimals:18,chainId:x},amount:d.bounty});let I=e.formatAmount(d.amountIn,d.tokenIn.decimals),b=e.formatAmount(d.minAmountOut,d.tokenOut.decimals),C=e.formatAmount(d.bounty,18),O=e.formatAmount(d.quotedAmountOut,d.tokenOut.decimals);c.push({module:"hookr",id:d.orderId,chainId:x,assets:m,description:`Hookr open limit order #${d.orderId}: sell ${I} ${S(d.tokenIn.symbol)} (${d.tokenIn.address}) for at least ${b} ${S(d.tokenOut.symbol)} (${d.tokenOut.address}), bounty ${C} ETH, expiry ${d.expiry}, fillable=${d.fillable} (quoted output ${O} ${S(d.tokenOut.symbol)}).`})}}return a>1n&&c.push({module:"hookr",id:"coverage",chainId:x,assets:[],description:`Hookr order coverage is incomplete: scanned IDs ${a}-${s}. Older orders require an explicit order ID.`}),c}}var De=e=>{let t=[at(e),dt(e)],n=ut(e);return{tools:t,positions:n}},Lt=De,Tt=De;export{A as a,ve as b,Ne as c,It as d,Be as e,Fe as f,At as g,Me as h,ze as i,qe as j,ce as k,Xe as l,ue as m,ht as n,St as o,xt as p,Ct as q,me as r,Ke as s,ee as t,M as u,Ye as v,Qe as w,Ze as x,Dt as y,P as z,et as A,Pt as B,Oe as C,rt as D,Se as E,it as F,st as G,xe as H,Ce as I,at as J,dt as K,ct as L,ut as M,De as N,Lt as O,Tt as P};
1
+ import{m as Y}from"./IR7KDBFU.js";import{b as V,c as W,d as G}from"./5PNFV7HH.js";import{d as de,e as L}from"./TTBB6EFN.js";import{a as B}from"./7WXAS54T.js";import{a as N}from"./43LI5NKJ.js";import{b as H,c as se,d as ae,e as j}from"./IX3GZMTM.js";import{b as x,j as D}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{a as S}from"./JXOEJPJ4.js";import{decodeEventLog as $e,encodeAbiParameters as pe,encodeFunctionData as ye,erc20Abi as Z,getAddress as l,isAddress as E,keccak256 as Ee,parseAbi as _e,parseAbiParameters as we,toEventSelector as ge}from"viem";var A=l(D[4663].hookr.HookrLimitOrders.address),ve=l(D[4663].hookr.HookrRoot.address),Ne=l(D[4663].hookr.HookrRouter.address),It=l(D[4663].hookr.HookrRegistry.address),Be=l(D[4663].hookr.HookrForwarder.address),Fe=l(D[4663].hookr.PoolManager.address),At=l(D[4663].hookr.HOOKR_Token.address),Me=l("0x000000000000000000000000000000000000dEaD"),ze=8388608,qe=200,ce=60n,Xe=604800n,ue=31536000n,ht=10,St=100,xt="500000000000000",Ct="10000000000000000",me=4096n,Q=32n,Ke=1e4,Ue=(1n<<127n)-1n,le=(1n<<128n)-1n,je=(1n<<160n)-1n,Ve=(1n<<40n)-1n,We=16777215,Ge=8388607,fe=1n<<192n,ee=0,M=1,Ye=2,Qe=3,Ze=ge("OrderCreated(uint256,address,bytes32,bool,uint128,uint128,uint128,uint40,address)"),Dt=ge("OrderCancelled(uint256,address,address,uint256,uint256)"),P=_e(["function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function createOrder(((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint160 sqrtPriceLimitX96, address recipient, uint40 expiry, uint128 bounty) params) payable returns (uint256 orderId)","function cancel(uint256 orderId, address to)","function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)","function router() view returns (address)","function registry() view returns (address)","function poolManager() view returns (address)","function forwarder() view returns (address)","event OrderCreated(uint256 indexed orderId, address indexed owner, bytes32 indexed poolId, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint40 expiry, address recipient)","event OrderCancelled(uint256 indexed orderId, address indexed owner, address indexed to, uint256 amountIn, uint256 bounty)"]);function F(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ke(e){let t=e.toLowerCase();return t===L.toLowerCase()||t===B.toLowerCase()||t===de.toLowerCase()}function $(e,t){if(typeof e!="string"||!e.trim())throw new o(`Provide a valid contract address for ${t}. Identify tokens by chain and address, never by symbol.`);let n=e.trim();if(!E(n,{strict:!1}))throw new o(`Invalid token address "${n}" for ${t}. Identify tokens by chain and address, never by symbol.`);return ke(n)?L:l(n)}function be(e){let t=e===void 0?x:Number(e);if(!Number.isSafeInteger(t)||t!==x)throw new o(`Hookr limit orders are only supported on Robinhood Chain (${x}).`);return x}function Je(e){switch(e){case ee:return"None";case M:return"Open";case Ye:return"Filled";case Qe:return"Cancelled";default:return"Unknown"}}function et(e,t,n=ae){if(typeof e!="string"||!/^-?\d+$/.test(e.trim()))throw new o("Signed amount must be an integer string in base units.");let r=e.trim();if(r.startsWith("-")){let i=r.slice(1),u=n(i,t);return u==="0"?"0":`-${u}`}return n(r,t)}function Pt(e,t,n="floor"){return se(e,t,n)}function Oe(e){return Ee(pe(we("address, address, uint24, int24, address"),[l(e.currency0),l(e.currency1),e.fee,e.tickSpacing,l(e.hooks)]))}function Ie(e,t){let n=e.toLowerCase();if(new Set([L.toLowerCase(),Me.toLowerCase(),A.toLowerCase(),Ne.toLowerCase(),Be.toLowerCase(),Fe.toLowerCase(),t.toLowerCase()]).has(n))throw new o(`Recipient ${e} is a reserved address and cannot receive Hookr limit order funds.`)}async function J(e,t,n,r){if(ke(e))return{address:B,symbol:V.symbol,decimals:V.decimals,chainId:t};let i=l(e),u=i.toLowerCase();if(F(r)){let s=typeof r.decimals=="number"&&Number.isInteger(r.decimals)&&r.decimals>=0&&r.decimals<=255?r.decimals:void 0,a=typeof r.symbol=="string"&&r.symbol.trim()?r.symbol.trim():void 0;if(s!==void 0&&a!==void 0)return{address:i,symbol:a,decimals:s,chainId:t}}if(u===W.address.toLowerCase())return{...W,chainId:t};if(u===G.address.toLowerCase())return{...G,chainId:t};try{let[s,a]=await Promise.all([n.readContract({address:i,abi:Z,functionName:"symbol"}),n.readContract({address:i,abi:Z,functionName:"decimals"})]);if(typeof s!="string"||!s.trim()||typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new o(`Invalid token metadata for ${i}.`);return{address:i,symbol:s.trim(),decimals:a,chainId:t}}catch{throw new o(`Could not read valid token metadata for ${i}. Refusing to guess token decimals.`)}}function tt(e){let t=F(e.key)?e.key:F(e.poolKey)?e.poolKey:void 0,n=t?.fee??e.fee??ze,r=(typeof n=="string"&&/^\d+$/.test(n),Number(n));if(!Number.isInteger(r)||r<0||r>We)throw new o("Pool fee must be a valid uint24 integer (default 8388608 for Hookr dynamic fee pools).");let i=t?.tickSpacing??e.tickSpacing??qe,u=(typeof i=="string"&&/^-?\d+$/.test(i),Number(i));if(!Number.isInteger(u)||u<=0||u>Ge)throw new o("Pool tickSpacing must be a positive int24 integer.");let s=t?.hooks??e.hooks??ve;if(typeof s!="string"||!E(s,{strict:!1}))throw new o("Provide a valid Hookr root contract address for hooks.");let a=l(s);if(t?.currency0!==void 0&&t?.currency1!==void 0||e.currency0!==void 0&&e.currency1!==void 0){let m=$(t?.currency0??e.currency0,"currency0"),I=$(t?.currency1??e.currency1,"currency1");if(m.toLowerCase()===I.toLowerCase())throw new o("Pool currency0 and currency1 must be distinct token addresses.");if(BigInt(m)>=BigInt(I))throw new o("Pool currency0 must sort strictly before currency1 by address.");let b;if(typeof e.zeroForOne=="boolean")b=e.zeroForOne;else if(e.tokenIn!==void 0||e.from!==void 0){let C=$(e.tokenIn??e.from,"tokenIn");if(C.toLowerCase()===m.toLowerCase())b=!0;else if(C.toLowerCase()===I.toLowerCase())b=!1;else throw new o("tokenIn does not match currency0 or currency1 of the pool key.")}else throw new o("Provide zeroForOne (boolean) or tokenIn when specifying a pool key.");return{key:{currency0:m,currency1:I,fee:r,tickSpacing:u,hooks:a},zeroForOne:b}}let w=e.tokenIn??e.from,f=e.tokenOut??e.to;if(w===void 0||f===void 0)throw new o("Provide either key ({ currency0, currency1, fee, tickSpacing, hooks }) with zeroForOne or tokenIn and tokenOut addresses.");let g=$(w,"tokenIn"),k=$(f,"tokenOut");if(g.toLowerCase()===k.toLowerCase())throw new o("Input and output tokens must have distinct addresses.");let p=BigInt(g)<BigInt(k),y=p?g:k,d=p?k:g;if(typeof e.zeroForOne=="boolean"&&e.zeroForOne!==p)throw new o("zeroForOne conflicts with the canonical sorting of tokenIn and tokenOut.");return{key:{currency0:y,currency1:d,fee:r,tickSpacing:u,hooks:a},zeroForOne:p}}function nt(e,t,n){let r=Y(t),i=r*r;if(n){let s=j(e.toString(),i.toString(),fe.toString(),"ceil");return BigInt(s)}let u=j(e.toString(),fe.toString(),i.toString(),"ceil");return BigInt(u)}function R(e,t){if(typeof e=="bigint"){if(e<0n)throw new o(`${t} must be a non-negative integer.`);return e}if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new o(`${t} must be a non-negative safe integer.`);return BigInt(e)}if(typeof e=="string")return H(e.trim());throw new o(`Provide ${t} as a decimal base-unit string.`)}async function ot(e,t){if(t!==void 0)return R(t,"now");if(typeof e.getBlock=="function"){let n=await e.getBlock().catch(()=>{throw new o("Could not read the chain timestamp for Hookr order expiry.")});return BigInt(n.timestamp)}throw new o("Could not read the chain timestamp for Hookr order expiry.")}function Ae(e,t){return!e.changes||e.changes.length===0?"no net ERC-20 transfer deltas":e.changes.map(n=>`${et(n.amount,n.token.decimals,t.formatAmount)} ${S(n.token.symbol)}`).join(", ")}function rt(e,t,n,r){if(!e||!Array.isArray(e.logs))throw new o("Provide a transaction receipt with a logs array.");for(let i of e.logs){if(!i||typeof i.address!="string"||!E(i.address,{strict:!1})||!Array.isArray(i.topics)||typeof i.data!="string"||i.topics.some(u=>typeof u!="string"||!/^0x[0-9a-fA-F]{64}$/.test(u)))throw new o(`Malformed Hookr ${t} receipt log.`);if(i.address.toLowerCase()===A.toLowerCase()&&i.topics[0]?.toLowerCase()===n.toLowerCase()){if(i.topics.length!==4||!/^0x0{24}/i.test(i.topics[2])||t==="OrderCancelled"&&!/^0x0{24}/i.test(i.topics[3])||!/^0x[0-9a-fA-F]*$/.test(i.data)||i.data.length!==2+r*64)throw new o(`Malformed Hookr ${t} receipt log.`);return{topics:i.topics,data:i.data}}}throw new o(`Could not find Hookr ${t} event in transaction receipt logs.`)}function he(e){if(e.receipt!==void 0){if(!F(e.receipt)||!Array.isArray(e.receipt.logs))throw new o("Provide a transaction receipt with a logs array.");return st({logs:e.receipt.logs})}if(e.logs!==void 0){if(!Array.isArray(e.logs))throw new o("Provide receipt logs as an array.");return it(e.logs)}}function Se(e){let t=rt(e,"OrderCreated",Ze,6);try{let n=$e({abi:P,eventName:"OrderCreated",...t,strict:!0});if(pe(we("bool, uint128, uint128, uint128, uint40, address"),[n.args.zeroForOne,n.args.amountIn,n.args.minAmountOut,n.args.bounty,n.args.expiry,n.args.recipient]).toLowerCase()!==t.data.toLowerCase())throw new o("Noncanonical Hookr OrderCreated event data.");return{orderId:n.args.orderId.toString(),owner:l(n.args.owner),poolId:n.args.poolId,zeroForOne:n.args.zeroForOne,amountIn:n.args.amountIn.toString(),minAmountOut:n.args.minAmountOut.toString(),bounty:n.args.bounty.toString(),expiry:n.args.expiry.toString(),recipient:l(n.args.recipient)}}catch{throw new o("Malformed Hookr OrderCreated receipt log.")}}function it(e){return Se({logs:e}).orderId}function st(e){return Se(e).orderId}function xe(e){if(Array.isArray(e)){let[n,r,i,u,s,a,c,w,f,g,k]=e;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:r,createdAt:i,expiry:u,zeroForOne:s,status:a,recipient:c,amountIn:BigInt(w),minAmountOut:BigInt(f),bounty:BigInt(g),sqrtPriceLimitX96:BigInt(k)}}let t=e;return{key:{currency0:t.key.currency0,currency1:t.key.currency1,fee:Number(t.key.fee),tickSpacing:Number(t.key.tickSpacing),hooks:t.key.hooks},owner:t.owner,createdAt:t.createdAt,expiry:t.expiry,zeroForOne:!!t.zeroForOne,status:Number(t.status),recipient:t.recipient,amountIn:BigInt(t.amountIn),minAmountOut:BigInt(t.minAmountOut),bounty:BigInt(t.bounty),sqrtPriceLimitX96:BigInt(t.sqrtPriceLimitX96)}}async function Ce(e,t,n){let r=R(t,"orderId");if(r<=0n)throw new o("Order ID must be a positive integer.");let i=e.clientFor(x),u=n?.order??await i.readContract({address:A,abi:P,functionName:"getOrder",args:[r]}).catch(()=>{throw new o(`Could not read Hookr order #${r}. Order coverage is incomplete.`)}),s=xe(u),a=Number(s.status);if(s.owner.toLowerCase()===L.toLowerCase()||a===ee)throw new o(`Hookr order #${r} does not exist.`);let c={currency0:l(s.key.currency0),currency1:l(s.key.currency1),fee:Number(s.key.fee),tickSpacing:Number(s.key.tickSpacing),hooks:l(s.key.hooks)},w=s.zeroForOne?c.currency0:c.currency1,f=s.zeroForOne?c.currency1:c.currency0,g=m=>{let I=m.toLowerCase(),b=n?.tokens.get(I);if(b)return b;let C=J(m,x,i);return n?.tokens.set(I,C),C},[k,p]=await Promise.all([g(w),g(f)]),y=!1,d=0n;if(a===M)try{let m=await i.readContract({address:A,abi:P,functionName:"quoteFill",args:[r]});if(typeof m[0]!="boolean"||typeof m[1]!="bigint"||m[1]<0n)throw new o(`Invalid quote for Hookr order #${r}.`);y=m[0],d=m[1]}catch{throw new o(`Could not quote Hookr order #${r}. Fillability and output amount are unknown.`)}return{orderId:r.toString(),poolId:Oe(c),key:c,owner:l(s.owner),recipient:l(s.recipient),createdAt:BigInt(s.createdAt).toString(),expiry:BigInt(s.expiry).toString(),zeroForOne:s.zeroForOne,status:a,statusLabel:Je(a),amountIn:s.amountIn.toString(),minAmountOut:s.minAmountOut.toString(),bounty:s.bounty.toString(),sqrtPriceLimitX96:s.sqrtPriceLimitX96.toString(),tokenIn:k,tokenOut:p,fillable:y,quotedAmountOut:d.toString()}}function at(e){return{name:"hookr_create",inputSchema:{type:"object",properties:{key:{type:"object",description:"Uniswap v4 PoolKey of the pool to place the order in; omitted fee, tickSpacing and hooks use Hookr defaults. tokenIn or zeroForOne picks the direction.",properties:{currency0:{type:"string",description:"Lower-sorted pool token address (0x followed by 40 hex digits)."},currency1:{type:"string",description:"Higher-sorted pool token address (0x followed by 40 hex digits)."},fee:{type:"number",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%); default 8388608, the v4 dynamic-fee flag of Hookr pools."},tickSpacing:{type:"number",description:"Pool tick spacing, a positive integer; defaults to the Hookr pool spacing."},hooks:{type:"string",description:"Address of the pool hook contract; defaults to the Hookr root hook."}}},tokenIn:{type:"string",description:"Input token address on chain 4663."},tokenOut:{type:"string",description:"Output token address on chain 4663."},zeroForOne:{type:"boolean",description:"True when selling currency0 for currency1."},amountIn:{type:"string",description:"Input amount in base units (uint128)."},minAmountOut:{type:"string",description:"Minimum net output amount in base units (uint128)."},tick:{type:"number",description:"Optional limit tick in [-887272, 887272]."},expiry:{type:"string",description:"Order expiry unix timestamp in seconds (uint40)."},deadline:{type:"string",description:"Alias for expiry unix timestamp in seconds."},bounty:{type:"string",description:"Keeper bounty in native ETH wei (uint128)."},recipient:{type:"string",description:"Order output recipient address (must be the signing wallet)."},sqrtPriceLimitX96:{type:"string",description:"Optional sqrtPriceLimitX96 (defaults to 0)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["amountIn"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=e.clientFor(i),s=he(t),{key:a,zeroForOne:c}=tt(t),w=c?a.currency0:a.currency1,f=c?a.currency1:a.currency0,[g,k]=await Promise.all([J(w,i,u,t.tokenInMeta),J(f,i,u,t.tokenOutMeta)]),p=t.recipient??r;if(typeof p!="string"||!E(p,{strict:!1}))throw new o("Provide a valid recipient address for the Hookr limit order.");let y=l(p);if(Ie(y,a.hooks),y!==r)throw new o("Hookr recipient must be the signing wallet.");if(typeof t.amountIn!="string")throw new o("Provide amountIn as an integer string in base units.");let d=H(t.amountIn);if(d<=0n||d>Ue)throw new o("amountIn must be between 1 and int128.max base units.");if(t.tick!==void 0){let T=Number(t.tick);Y(T)}let m;if(t.minAmountOut!==void 0){if(typeof t.minAmountOut!="string")throw new o("Provide minAmountOut as an integer string in base units.");m=H(t.minAmountOut)}else if(t.tick!==void 0)m=nt(d,Number(t.tick),c);else throw new o("Provide minAmountOut in base units (or tick to derive minAmountOut).");if(m<=0n||m>le)throw new o("minAmountOut must be between 1 and uint128.max base units.");let I=t.sqrtPriceLimitX96!==void 0?R(t.sqrtPriceLimitX96,"sqrtPriceLimitX96"):0n;if(I>je)throw new o("sqrtPriceLimitX96 exceeds uint160 bounds.");let b=await ot(u,t.now),C=t.expiry??t.deadline,O;if(C!==void 0)O=R(C,"expiry");else if(t.lifetime!==void 0||t.ttlSeconds!==void 0){let T=R(t.lifetime??t.ttlSeconds,"lifetime");O=b+T}else O=b+Xe;if(O<b+ce)throw new o(`Order expiry (${O}) is expired or below the minimum lifetime of ${ce} seconds from block timestamp ${b}.`);if(O>b+ue||O>Ve)throw new o(`Order expiry (${O}) exceeds the maximum lifetime of ${ue} seconds (365 days).`);let z=await u.readContract({address:A,abi:P,functionName:"bountyBounds",args:[a,c,d,m]}).catch(()=>{throw new o("Could not read Hookr bounty bounds.")}),_=BigInt(z[0]),q=BigInt(z[1]),X=BigInt(z[2]);if(t.bounty!==void 0&&typeof t.bounty!="string")throw new o("Provide bounty as an integer string in base units.");let h=t.bounty!==void 0?H(t.bounty):q,K=_>0n?_:q;if(h<_||K>0n&&h<K)throw new o(`Order keeper bounty (${h} wei) is underbounty: must be at least ${K} wei (default keeper bounty floor).`);if(h>X||h>le)throw new o(`Order keeper bounty (${h} wei) exceeds the maximum allowed bounty of ${X} wei.`);let te=w.toLowerCase()===L.toLowerCase(),v=[];if(!te){let T;try{let U=await u.readContract({address:w,abi:Z,functionName:"allowance",args:[r,A]});if(typeof U!="bigint"||U<0n)throw new o("Invalid token allowance.");T=U}catch{throw new o(`Could not read token allowance for ${w}. No approval was prepared.`)}T<d&&v.push(e.approval(w,A,d.toString(),i))}let Pe=te?d+h:h,Le=ye({abi:P,functionName:"createOrder",args:[{key:a,zeroForOne:c,amountIn:d,minAmountOut:m,sqrtPriceLimitX96:I,recipient:y,expiry:Number(O),bounty:h}]}),ne=e.formatAmount(d.toString(),g.decimals),oe=e.formatAmount(m.toString(),k.decimals),re=e.formatAmount(h.toString(),18),Te=e.unsignedTx({to:A,data:Le,value:Pe.toString(),chainId:i,description:`Create Hookr limit order on ${A}: sell ${ne} ${S(g.symbol)} (${g.address}) for at least ${oe} ${S(k.symbol)} (${k.address}) with ${re} ETH keeper bounty (fee=${a.fee}, tickSpacing=${a.tickSpacing}, expiry=${O}).`});v.push(Te);let ie=await e.preview(v,r),Re=Ae(ie,e),He=Oe(a);return{txs:v,summary:`Hookr limit order prepared: sell ${ne} ${S(g.symbol)} for at least ${oe} ${S(k.symbol)} (bounty ${re} ETH, expiry ${O}; preview deltas: ${Re}).`,preview:ie,poolId:He,key:a,zeroForOne:c,amountIn:d.toString(),minAmountOut:m.toString(),bounty:h.toString(),bountyBounds:{minBounty:_.toString(),defaultBounty:q.toString(),maxBounty:X.toString()},expiry:O.toString(),recipient:y,sqrtPriceLimitX96:I.toString(),tokenIn:g,tokenOut:k,...s!==void 0?{orderId:s}:{}}}}}function dt(e){return{name:"hookr_cancel",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"Hookr order ID to cancel (uint256 decimal string)."},to:{type:"string",description:"Recipient address for the refunded principal and bounty (must be the signing wallet)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["orderId"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=he(t),s=t.orderId??t.id??u;if(s===void 0)throw new o("Provide orderId to cancel a Hookr limit order.");let a=R(s,"orderId");if(a<=0n)throw new o("orderId must be a positive integer.");let c=await Ce(e,a);if(c.owner.toLowerCase()!==r.toLowerCase())throw new o(`Unauthorized cancellation: only the order owner (${c.owner}) can cancel Hookr order #${a} (caller is ${r}).`);if(c.status!==M)throw new o(`Hookr order #${a} is not open (current status: ${c.statusLabel}).`);let w=t.to??r;if(typeof w!="string"||!E(w,{strict:!1}))throw new o("Provide a valid refund recipient address for cancel.");let f=l(w);if(Ie(f,c.key.hooks),f!==r)throw new o("Hookr refund recipient must be the signing wallet.");let g=ye({abi:P,functionName:"cancel",args:[a,f]}),k=e.formatAmount(c.amountIn,c.tokenIn.decimals),p=e.formatAmount(c.bounty,18),y=e.unsignedTx({to:A,data:g,value:"0",chainId:i,description:`Cancel Hookr limit order #${a} on ${A} and refund ${k} ${S(c.tokenIn.symbol)} plus ${p} ETH bounty to ${f}.`}),d=await e.preview([y],r),m=Ae(d,e);return{txs:[y],summary:`Cancel Hookr limit order #${a}: refund ${k} ${S(c.tokenIn.symbol)} and ${p} ETH bounty to ${f} (preview deltas: ${m}).`,preview:d,orderId:a.toString(),to:f,refundedAmountIn:c.amountIn,refundedBounty:c.bounty,tokenIn:c.tokenIn,tokenOut:c.tokenOut}}}}function ct(e){let t=performance.now()+Ke;return new Proxy(e,{get(n,r,i){return r!=="readContract"?Reflect.get(n,r,i):async(...u)=>{let s=t-performance.now(),a=()=>new o("Hookr scan deadline exceeded. Order coverage is incomplete; retry later.");if(s<=0)throw a();let c;try{return await Promise.race([n.readContract(...u),new Promise((w,f)=>{c=setTimeout(()=>f(a()),s)})])}finally{c!==void 0&&clearTimeout(c)}}}})}function ut(e){return async t=>{N(t);let n=l(t),r=ct(e.clientFor(x)),i={...e,clientFor:()=>r},u=await r.readContract({address:A,abi:P,functionName:"lastOrderId"}).catch(()=>{throw new o("Could not read the last Hookr order ID. Order coverage is incomplete.")});if(typeof u!="bigint"||u<0n)throw new o("Could not read a valid last Hookr order ID. Order coverage is incomplete.");let s=u,a=s>me?s-me+1n:1n;if(s<=0n)return[];let c=[],w=new Map;for(let f=a;f<=s;f+=Q){let g=Array.from({length:Number(s-f+1n<Q?s-f+1n:Q)},(p,y)=>f+BigInt(y)),k=await Promise.all(g.map(async p=>{let y=await r.readContract({address:A,abi:P,functionName:"getOrder",args:[p]}).catch(()=>{throw new o(`Could not read Hookr order #${p}. Order coverage is incomplete.`)}),d=xe(y);if(d.owner.toLowerCase()===L||Number(d.status)===ee)throw new o(`Hookr order #${p} does not exist. Order coverage is incomplete.`);return{id:p,order:d}}));for(let{id:p,order:y}of k){if(y.owner.toLowerCase()!==n.toLowerCase()||Number(y.status)!==M)continue;let d=await Ce(i,p,{order:y,tokens:w}),m=[{token:d.tokenIn,amount:d.amountIn}];BigInt(d.bounty)>0n&&m.push({token:{address:B,symbol:"ETH",decimals:18,chainId:x},amount:d.bounty});let I=e.formatAmount(d.amountIn,d.tokenIn.decimals),b=e.formatAmount(d.minAmountOut,d.tokenOut.decimals),C=e.formatAmount(d.bounty,18),O=e.formatAmount(d.quotedAmountOut,d.tokenOut.decimals);c.push({module:"hookr",id:d.orderId,chainId:x,assets:m,description:`Hookr open limit order #${d.orderId}: sell ${I} ${S(d.tokenIn.symbol)} (${d.tokenIn.address}) for at least ${b} ${S(d.tokenOut.symbol)} (${d.tokenOut.address}), bounty ${C} ETH, expiry ${d.expiry}, fillable=${d.fillable} (quoted output ${O} ${S(d.tokenOut.symbol)}).`})}}return a>1n&&c.push({module:"hookr",id:"coverage",chainId:x,assets:[],description:`Hookr order coverage is incomplete: scanned IDs ${a}-${s}. Older orders require an explicit order ID.`}),c}}var De=e=>{let t=[at(e),dt(e)],n=ut(e);return{tools:t,positions:n}},Lt=De,Tt=De;export{A as a,ve as b,Ne as c,It as d,Be as e,Fe as f,At as g,Me as h,ze as i,qe as j,ce as k,Xe as l,ue as m,ht as n,St as o,xt as p,Ct as q,me as r,Ke as s,ee as t,M as u,Ye as v,Qe as w,Ze as x,Dt as y,P as z,et as A,Pt as B,Oe as C,rt as D,Se as E,it as F,st as G,xe as H,Ce as I,at as J,dt as K,ct as L,ut as M,De as N,Lt as O,Tt as P};
@@ -1 +1 @@
1
- import{a as c,b as m,f as T,g as d,h as i,i as l}from"./TXGZ6NWN.js";import{c as P,e as p}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{encodeAbiParameters as y,parseAbiParameters as h,zeroAddress as B}from"viem";var A={type:"object",properties:{pairedToken:{...P,description:"Address of the token paired against the launched token in the pool. Defaults to WETH."},startingTick:{type:"integer",minimum:-887272,maximum:887272,description:"Initial pool price as a tick (when the launched token is token0). Default -230400."},tickSpacing:{type:"integer",minimum:1,maximum:32767,description:"Pool tick spacing; position ticks must be multiples of it. Default 200."},positions:{type:"array",minItems:1,maxItems:7,description:"Liquidity positions, 1 to 7, whose bps allocations total 10000. Default: one position from -230400 to -120000.",items:{type:"object",properties:{tickLower:{type:"integer",description:"Lower tick of the position; at or above the starting tick and a multiple of tick spacing."},tickUpper:{type:"integer",description:"Upper tick of the position; above tickLower and a multiple of tick spacing."},bps:{type:"integer",minimum:1,maximum:1e4,description:"Share of the pool liquidity supply in this position, in basis points (5000 = 50%)."}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",description:"Optional dynamic LP fee settings; cannot be combined with feeBps.",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3,description:"Minimum LP fee in basis points (100 = 1%)."},maxFeeBps:{type:"integer",minimum:25,maximum:1e3,description:"Maximum LP fee in basis points (100 = 1%); at least baseFeeBps."},referenceTickFilterPeriod:{...m,description:"Seconds during which the reference tick is held before it may update, as a decimal string."},resetPeriod:{...m,description:"Seconds of inactivity after which the dynamic fee resets to base, as a decimal string."},resetTickFilter:{type:"integer",minimum:-887272,maximum:887272,description:"Tick distance from the reference tick that triggers a fee reset."},feeControlNumerator:{...m,description:"Numerator scaling how fast the fee rises with price movement, as a decimal string."},decayFilterBps:{type:"integer",minimum:0,maximum:3e4,description:"Decay rate of the reference-tick filter in basis points (50 = 0.5%)."}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function D(f){let o=f.pool??{};if(!p(o))throw new r("Provide pool configuration as an object.");l(o,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=T(o.pairedToken??c.paired_weth.address),g=i(o.startingTick??-230400,-887272,887272),u=i(o.tickSpacing??200,1,32767),n=o.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new r("Provide one to seven liquidity positions.");let a=n.map(e=>{if(!p(e))throw new r("Provide liquidity position objects.");l(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<g||t%u||s%u)throw new r("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(a.reduce((e,t)=>e+t.bps,0)!==1e4)throw new r("Liquidity position allocations must total 10000 bps.");let k=i(f.feeBps??100,0,1e3)*100,b=c.fee_static_hook_v2.address,w=y(h("uint24,uint24"),[k,k]),F=`Static LP fee ${k/100} bps`;if(o.dynamicFee!==void 0){let e=o.dynamicFee;if(!p(e)||f.feeBps!==void 0)throw new r("Provide dynamic fee configuration without a static feeBps override.");l(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);b=c.fee_dynamic_hook_v2.address,w=y(h("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),F=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:F,poolConfig:{hook:b,pairedToken:x,tickIfToken0IsClanker:g,tickSpacing:u,poolData:y(h("(address,bytes,bytes)"),[[B,"0x",w]])},tickLower:a.map(e=>e.lower),tickUpper:a.map(e=>e.upper),positionBps:a.map(e=>e.bps)}}export{A as a,D as b};
1
+ import{a as c,b as m,f as T,g as d,h as i,i as l}from"./PG7HZIZL.js";import{c as P,e as p}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{encodeAbiParameters as y,parseAbiParameters as h,zeroAddress as B}from"viem";var A={type:"object",properties:{pairedToken:{...P,description:"Address of the token paired against the launched token in the pool. Defaults to WETH."},startingTick:{type:"integer",minimum:-887272,maximum:887272,description:"Initial pool price as a tick (when the launched token is token0). Default -230400."},tickSpacing:{type:"integer",minimum:1,maximum:32767,description:"Pool tick spacing; position ticks must be multiples of it. Default 200."},positions:{type:"array",minItems:1,maxItems:7,description:"Liquidity positions, 1 to 7, whose bps allocations total 10000. Default: one position from -230400 to -120000.",items:{type:"object",properties:{tickLower:{type:"integer",description:"Lower tick of the position; at or above the starting tick and a multiple of tick spacing."},tickUpper:{type:"integer",description:"Upper tick of the position; above tickLower and a multiple of tick spacing."},bps:{type:"integer",minimum:1,maximum:1e4,description:"Share of the pool liquidity supply in this position, in basis points (5000 = 50%)."}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",description:"Optional dynamic LP fee settings; cannot be combined with feeBps.",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3,description:"Minimum LP fee in basis points (100 = 1%)."},maxFeeBps:{type:"integer",minimum:25,maximum:1e3,description:"Maximum LP fee in basis points (100 = 1%); at least baseFeeBps."},referenceTickFilterPeriod:{...m,description:"Seconds during which the reference tick is held before it may update, as a decimal string."},resetPeriod:{...m,description:"Seconds of inactivity after which the dynamic fee resets to base, as a decimal string."},resetTickFilter:{type:"integer",minimum:-887272,maximum:887272,description:"Tick distance from the reference tick that triggers a fee reset."},feeControlNumerator:{...m,description:"Numerator scaling how fast the fee rises with price movement, as a decimal string."},decayFilterBps:{type:"integer",minimum:0,maximum:3e4,description:"Decay rate of the reference-tick filter in basis points (50 = 0.5%)."}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function D(f){let o=f.pool??{};if(!p(o))throw new r("Provide pool configuration as an object.");l(o,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=T(o.pairedToken??c.paired_weth.address),g=i(o.startingTick??-230400,-887272,887272),u=i(o.tickSpacing??200,1,32767),n=o.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new r("Provide one to seven liquidity positions.");let a=n.map(e=>{if(!p(e))throw new r("Provide liquidity position objects.");l(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<g||t%u||s%u)throw new r("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(a.reduce((e,t)=>e+t.bps,0)!==1e4)throw new r("Liquidity position allocations must total 10000 bps.");let k=i(f.feeBps??100,0,1e3)*100,b=c.fee_static_hook_v2.address,w=y(h("uint24,uint24"),[k,k]),F=`Static LP fee ${k/100} bps`;if(o.dynamicFee!==void 0){let e=o.dynamicFee;if(!p(e)||f.feeBps!==void 0)throw new r("Provide dynamic fee configuration without a static feeBps override.");l(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);b=c.fee_dynamic_hook_v2.address,w=y(h("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),F=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:F,poolConfig:{hook:b,pairedToken:x,tickIfToken0IsClanker:g,tickSpacing:u,poolData:y(h("(address,bytes,bytes)"),[[B,"0x",w]])},tickLower:a.map(e=>e.lower),tickUpper:a.map(e=>e.upper),positionBps:a.map(e=>e.bps)}}export{A as a,D as b};
@@ -0,0 +1 @@
1
+ import{j as r,k as m,m as d,o as p,p as u,q as x,r as f}from"./UMY6SP7C.js";import{a as t}from"./XSD5NL7J.js";import{decodeFunctionData as P,keccak256 as T,parseAbi as y}from"viem";async function A(o,s,e,n,a){if(s<0n||!Number.isInteger(n)||!n||(n&~e.phaseMask)!==0)throw new t("Hookr advisory phases are outside the reviewed profile.");let[h,H,b,g]=await Promise.all([o.getCode({address:e.address,blockNumber:s}),u(o,f,p("registry"),"admission",[x,e.address],s),u(o,e.address,y(["function configSchemaHash() view returns (bytes32)"]),"configSchemaHash",[],s),u(o,f,p("registry"),"isRevokedAdmission",[x,e.address],s)]),i=d(H),k=d(i.caps),l=r(i.gasLimit,32),w=r(i.phaseMask,8),c={maxLpFeePips:r(k.maxLpFeePips,24),maxQuoteTakePips:r(k.maxQuoteTakePips,24),maxSubjectTakeBps:r(k.maxSubjectTakeBps,16)};if(!h||h==="0x"||T(h)!==e.codeHash||i.implementation!==e.address||r(i.kind,8)!==1n||i.codeHash!==e.codeHash||i.schemaHash!==e.schemaHash||b!==e.schemaHash||m(g)||m(i.feeOnly)!==e.feeOnly||(BigInt(n)&~w)!==0n||l<BigInt(e.gasMin??1)||l>BigInt(e.gasMax??2e6)||c.maxLpFeePips>600000n||c.maxQuoteTakePips>=1000000n||c.maxSubjectTakeBps!==0n||a.maxSubjectTakeBps!==0n||a.maxLpFeePips>c.maxLpFeePips||a.maxQuoteTakePips>c.maxQuoteTakePips)throw new t("Hookr advisory runtime, admission, schema, gas, phases or fee caps differ from the reviewed profile.");return{address:e.address,schemaHash:e.schemaHash,codeHash:e.codeHash,gasLimit:Number(l),phases:n,failOpen:!1,admissionFailOpen:m(i.failOpen),caps:c}}function L(o){let s;try{s=P({abi:p("launcherV1"),data:o})}catch{throw new t("Hookr launch refused: Oak could not decode its own launch transaction, so the advisory fail-open choice is unchecked.")}if(s.functionName!=="launchAdvised")throw new t("Hookr launch refused: the transaction is not a launchAdvised call.");let e=s.args?.[2];if(!Array.isArray(e)||!e.length)throw new t("Hookr launch refused: the launchAdvised call has no pool member to check.");for(let n of e)if(d(d(n).config).advisoryFailOpen!==!1)throw new t("Hookr launch refused: it would bind the advisory fail open, so swaps would keep trading when the advisory fails instead of stopping. Oak only launches fail-closed pools.")}function S(o,s,e,n=0n){let a={maxLpFeePips:o.maxLpFeePips+s.maxLpFeePips,maxQuoteTakePips:o.maxQuoteTakePips+s.maxQuoteTakePips,maxSubjectTakeBps:o.maxSubjectTakeBps};if(s.maxSubjectTakeBps!==0n||a.maxLpFeePips>600000n||a.maxLpFeePips>e.maxLpFeePips||a.maxQuoteTakePips>=1000000n||a.maxQuoteTakePips>e.maxQuoteTakePips||a.maxSubjectTakeBps>1000n||a.maxSubjectTakeBps>e.maxSubjectTakeBps)throw new t("Hookr selected blocks plus the full advisory reservation exceed the live core fee caps. Lower their rates.");if(n>a.maxQuoteTakePips&&(a.maxQuoteTakePips=n),a.maxQuoteTakePips>=1000000n)throw new t("Hookr combined pool quote cap must remain below one million pips.");return a}export{A as a,L as b,S as c};
@@ -1 +1 @@
1
- import{b as I}from"./KO7ANIKY.js";import{c as $}from"./CNDIAF3P.js";import{g as w}from"./RUTSEGGD.js";import{a as k}from"./G5AMH4IP.js";import{a as E}from"./TZ7S5KRB.js";import{c as C}from"./DMDOSHV7.js";import{a as b}from"./ZXFJKW6H.js";import{b as U}from"./SPJCSEKP.js";import{a as h}from"./43LI5NKJ.js";import{a as G}from"./66F5ZH34.js";import{g as P,n as y}from"./NWNYJ26T.js";import{b as s,e as T,j as S}from"./TI727O2H.js";import{a as m}from"./XSD5NL7J.js";import{encodeFunctionData as v,parseAbi as j}from"viem";var a=S[s].vaults.netnet.address,d={address:S[s].tokens.USDG.address,chainId:s,decimals:T,symbol:"USDG"},N={address:a,chainId:s,decimals:18,symbol:"nnUSDG"},o=j(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function convertToAssets(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),_=G("Positive USDG amount in integer base units (6 decimals)."),O="Preview amounts are estimates; these ERC-4626 calls have no on-chain minimum output argument. No transaction was sent.";function M(e){return y(e,"Amount must be positive and fit in uint256.",{notString:"Provide an integer amount string in base units.",positive:!0})}function g(e,f){if(Object.keys(e).some(l=>!f.includes(l)))throw new m("Unsupported NetNet argument.")}var q=e=>{async function f(t){try{return await t()}catch(n){throw new m(e.plainError(n))}}async function l(){let t=e.clientFor(s);if(await t.getChainId()!==s)throw new m("NetNet requires chain 4663.");let[n,r]=await Promise.all([t.readContract({address:a,abi:o,functionName:"asset"}),t.readContract({address:a,abi:o,functionName:"decimals"})]);if(!P(n,d.address))throw new m("NetNet does not report the pinned USDG asset.");if(r!==N.decimals)throw new m("NetNet share decimals do not match the pinned metadata.");return t}async function D(t,n,r){let i=await e.preview(t,n),p=i.changes.map(({token:c,amount:u})=>{let A=u.startsWith("-");return`${A?"-":"+"}${e.formatAmount(A?u.slice(1):u,c.decimals)} ${c.symbol}`}).join(", ");return{txs:t,preview:i,summary:`${r} ${i.summary} ${p?`Estimated changes: ${p}. `:""}${O}`}}async function R(t){return f(async()=>{h(t);let n=await l(),r=await n.readContract({address:a,abi:o,functionName:"balanceOf",args:[t]});if(r===0n)return[];let i=await n.readContract({address:a,abi:o,functionName:"convertToAssets",args:[r]});return[{module:"netnet",id:`${s}:${a}`,chainId:s,assets:[{token:{...d},amount:i.toString()}],description:`${e.formatAmount(r.toString(),N.decimals)} nnUSDG shares in NetNet Credit (${a}); underlying USDG is an estimate, not a liquidity guarantee.`}]})}return{positions:R,tools:[{name:"netnet_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:t=>f(async()=>{g(t,[]);let r=await(await l()).readContract({address:a,abi:o,functionName:"totalAssets"});return[{address:a,name:"NetNet Credit",chainId:s,asset:{...d},shares:{...N},totalAssets:{token:{...d},amount:r.toString()}}]})},{name:"netnet_deposit",inputSchema:{type:"object",description:"Deposit USDG in base units (1 USDG = 1000000) for nnUSDG vault shares. Exit with netnet_withdraw; check positions after confirmation.",properties:{amount:_},required:["amount"],additionalProperties:!1},execute:(t,n)=>f(async()=>{g(t,["amount"]),h(n);let r=M(t.amount);await l();let i=[e.approval(d.address,a,r.toString(),s),e.unsignedTx({to:a,data:v({abi:o,functionName:"deposit",args:[r,n]}),value:"0",chainId:s,description:`Deposit ${e.formatAmount(r.toString(),d.decimals)} USDG into NetNet Credit.`})];return D(i,n,"Approve the exact USDG amount, then deposit into NetNet Credit.")})},{name:"netnet_withdraw",inputSchema:{type:"object",description:"Withdraw USDG in 6-decimal base units, or amount max to redeem every nnUSDG share for USDG. Check positions after confirmation.",properties:{amount:{description:'USDG to withdraw in base units (USDG has 6 decimals; "1000000" = 1 USDG), or "max" to redeem every nnUSDG share.',anyOf:[_,{const:"max",description:"Redeem the fresh full nnUSDG share balance."}]}},required:["amount"],additionalProperties:!1},execute:(t,n)=>f(async()=>{g(t,["amount"]),h(n);let r=t.amount==="max"?void 0:M(t.amount),i=await l(),p,c;if(r===void 0){let u=await i.readContract({address:a,abi:o,functionName:"balanceOf",args:[n]});if(u===0n)throw new m("This wallet has no NetNet shares to redeem.");p=v({abi:o,functionName:"redeem",args:[u,n,n]}),c=`Redeem all ${e.formatAmount(u.toString(),N.decimals)} nnUSDG shares for USDG.`}else p=v({abi:o,functionName:"withdraw",args:[r,n,n]}),c=`Withdraw ${e.formatAmount(r.toString(),d.decimals)} USDG from NetNet Credit (unmeasured on the recorded fork; full exit uses amount "max" redeem).`;return D([e.unsignedTx({to:a,data:p,value:"0",chainId:s,description:c})],n,c)})}]}};function ie(e){return U("netnet",[q(e),w(e),$(e),C(e),k(e),E(e),I(e),{tools:b(e,"netnet",[{vault:a,asset:d}])}])}export{q as a,ie as b};
1
+ import{a as k}from"./UGFRBJDQ.js";import{a as E}from"./6QXTL65K.js";import{b as I}from"./HNBYPHTA.js";import{c as $}from"./C2H3BWN5.js";import{g as w}from"./OHZHQSCA.js";import{c as C}from"./266VIESP.js";import{a as b}from"./QAVP3CWL.js";import{b as U}from"./SPJCSEKP.js";import{a as h}from"./43LI5NKJ.js";import{a as G}from"./66F5ZH34.js";import{g as P,n as y}from"./NWNYJ26T.js";import{b as s,e as T,j as S}from"./EWZFZUVF.js";import{a as m}from"./XSD5NL7J.js";import{encodeFunctionData as v,parseAbi as j}from"viem";var a=S[s].vaults.netnet.address,d={address:S[s].tokens.USDG.address,chainId:s,decimals:T,symbol:"USDG"},N={address:a,chainId:s,decimals:18,symbol:"nnUSDG"},o=j(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function convertToAssets(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),_=G("Positive USDG amount in integer base units (6 decimals)."),O="Preview amounts are estimates; these ERC-4626 calls have no on-chain minimum output argument. No transaction was sent.";function M(e){return y(e,"Amount must be positive and fit in uint256.",{notString:"Provide an integer amount string in base units.",positive:!0})}function g(e,f){if(Object.keys(e).some(l=>!f.includes(l)))throw new m("Unsupported NetNet argument.")}var q=e=>{async function f(t){try{return await t()}catch(n){throw new m(e.plainError(n))}}async function l(){let t=e.clientFor(s);if(await t.getChainId()!==s)throw new m("NetNet requires chain 4663.");let[n,r]=await Promise.all([t.readContract({address:a,abi:o,functionName:"asset"}),t.readContract({address:a,abi:o,functionName:"decimals"})]);if(!P(n,d.address))throw new m("NetNet does not report the pinned USDG asset.");if(r!==N.decimals)throw new m("NetNet share decimals do not match the pinned metadata.");return t}async function D(t,n,r){let i=await e.preview(t,n),p=i.changes.map(({token:c,amount:u})=>{let A=u.startsWith("-");return`${A?"-":"+"}${e.formatAmount(A?u.slice(1):u,c.decimals)} ${c.symbol}`}).join(", ");return{txs:t,preview:i,summary:`${r} ${i.summary} ${p?`Estimated changes: ${p}. `:""}${O}`}}async function R(t){return f(async()=>{h(t);let n=await l(),r=await n.readContract({address:a,abi:o,functionName:"balanceOf",args:[t]});if(r===0n)return[];let i=await n.readContract({address:a,abi:o,functionName:"convertToAssets",args:[r]});return[{module:"netnet",id:`${s}:${a}`,chainId:s,assets:[{token:{...d},amount:i.toString()}],description:`${e.formatAmount(r.toString(),N.decimals)} nnUSDG shares in NetNet Credit (${a}); underlying USDG is an estimate, not a liquidity guarantee.`}]})}return{positions:R,tools:[{name:"netnet_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:t=>f(async()=>{g(t,[]);let r=await(await l()).readContract({address:a,abi:o,functionName:"totalAssets"});return[{address:a,name:"NetNet Credit",chainId:s,asset:{...d},shares:{...N},totalAssets:{token:{...d},amount:r.toString()}}]})},{name:"netnet_deposit",inputSchema:{type:"object",description:"Deposit USDG in base units (1 USDG = 1000000) for nnUSDG vault shares. Exit with netnet_withdraw; check positions after confirmation.",properties:{amount:_},required:["amount"],additionalProperties:!1},execute:(t,n)=>f(async()=>{g(t,["amount"]),h(n);let r=M(t.amount);await l();let i=[e.approval(d.address,a,r.toString(),s),e.unsignedTx({to:a,data:v({abi:o,functionName:"deposit",args:[r,n]}),value:"0",chainId:s,description:`Deposit ${e.formatAmount(r.toString(),d.decimals)} USDG into NetNet Credit.`})];return D(i,n,"Approve the exact USDG amount, then deposit into NetNet Credit.")})},{name:"netnet_withdraw",inputSchema:{type:"object",description:"Withdraw USDG in 6-decimal base units, or amount max to redeem every nnUSDG share for USDG. Check positions after confirmation.",properties:{amount:{description:'USDG to withdraw in base units (USDG has 6 decimals; "1000000" = 1 USDG), or "max" to redeem every nnUSDG share.',anyOf:[_,{const:"max",description:"Redeem the fresh full nnUSDG share balance."}]}},required:["amount"],additionalProperties:!1},execute:(t,n)=>f(async()=>{g(t,["amount"]),h(n);let r=t.amount==="max"?void 0:M(t.amount),i=await l(),p,c;if(r===void 0){let u=await i.readContract({address:a,abi:o,functionName:"balanceOf",args:[n]});if(u===0n)throw new m("This wallet has no NetNet shares to redeem.");p=v({abi:o,functionName:"redeem",args:[u,n,n]}),c=`Redeem all ${e.formatAmount(u.toString(),N.decimals)} nnUSDG shares for USDG.`}else p=v({abi:o,functionName:"withdraw",args:[r,n,n]}),c=`Withdraw ${e.formatAmount(r.toString(),d.decimals)} USDG from NetNet Credit (unmeasured on the recorded fork; full exit uses amount "max" redeem).`;return D([e.unsignedTx({to:a,data:p,value:"0",chainId:s,description:c})],n,c)})}]}};function ie(e){return U("netnet",[q(e),w(e),$(e),C(e),k(e),E(e),I(e),{tools:b(e,"netnet",[{vault:a,asset:d}])}])}export{q as a,ie as b};