@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{L as P}from"./MQXSCNUL.js";import{a as u}from"./YXXK6EPI.js";import{a as O}from"./43LI5NKJ.js";import{a as A}from"./66F5ZH34.js";import{d as g,i as T}from"./NWNYJ26T.js";import{b as p}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as k}from"./JXOEJPJ4.js";import{encodeFunctionData as E,getAddress as f,parseAbi as v,zeroAddress as R}from"viem";var w=v(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),C=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(d){return T(d,"Provide an explicit checksummed address.",g)}var S=d=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(O(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(d.plainError(a))}}});async function b(){let n=d.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string",description:"Optional ERC-20 token address to check whether the NFT loan contract permits it as a loan currency."}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:u,abi:w,functionName:s})));return{chainId:p,contract:u,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:u,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:C,description:"Owner administration call: pause or unpause the protocol, update the admin fee or maximum loan duration, permit tokens, or manage ownership transfer."},value:A("Integer in base units of the setting, as a decimal string. updateAdminFee: basis points (50 = 0.5%, max 10000). updateMaximumLoanDuration: seconds (86400 = 1 day)."),account:{type:"string",description:"Address of the ERC-20 token for setERC20Permit, or of the proposed new owner for requestTransferOwnership."},enabled:{type:"boolean",description:"For setERC20Permit: true permits the token as a loan currency, false removes the permission."},tokens:{type:"array",maxItems:32,description:"For setERC20Permits: unique token addresses to update; pairs by position with permissions.",items:{type:"string",description:"ERC-20 token address."}},permissions:{type:"array",maxItems:32,description:"For setERC20Permits: true/false per token, same length and order as tokens.",items:{type:"boolean",description:"True permits the token at the same index as a loan currency."}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!C.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:u,abi:w,functionName:"owner"});if(f(o)!==f(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=P(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(l=>typeof l!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===R)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${u}, values ${JSON.stringify(t,(o,l)=>typeof l=="bigint"?String(l):l)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[d.unsignedTx({to:u,data:E({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await d.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await d.http(`https://longbow.credit/api/referral/stats/${f(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==f(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:f(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:k("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};
1
+ import{L as P}from"./DPSFR3ZS.js";import{a as u}from"./QBHY2QRC.js";import{a as O}from"./43LI5NKJ.js";import{a as A}from"./66F5ZH34.js";import{d as g,i as T}from"./NWNYJ26T.js";import{b as p}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{a as k}from"./JXOEJPJ4.js";import{encodeFunctionData as E,getAddress as f,parseAbi as v,zeroAddress as R}from"viem";var w=v(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),C=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(d){return T(d,"Provide an explicit checksummed address.",g)}var S=d=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(O(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(d.plainError(a))}}});async function b(){let n=d.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string",description:"Optional ERC-20 token address to check whether the NFT loan contract permits it as a loan currency."}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:u,abi:w,functionName:s})));return{chainId:p,contract:u,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:u,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:C,description:"Owner administration call: pause or unpause the protocol, update the admin fee or maximum loan duration, permit tokens, or manage ownership transfer."},value:A("Integer in base units of the setting, as a decimal string. updateAdminFee: basis points (50 = 0.5%, max 10000). updateMaximumLoanDuration: seconds (86400 = 1 day)."),account:{type:"string",description:"Address of the ERC-20 token for setERC20Permit, or of the proposed new owner for requestTransferOwnership."},enabled:{type:"boolean",description:"For setERC20Permit: true permits the token as a loan currency, false removes the permission."},tokens:{type:"array",maxItems:32,description:"For setERC20Permits: unique token addresses to update; pairs by position with permissions.",items:{type:"string",description:"ERC-20 token address."}},permissions:{type:"array",maxItems:32,description:"For setERC20Permits: true/false per token, same length and order as tokens.",items:{type:"boolean",description:"True permits the token at the same index as a loan currency."}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!C.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:u,abi:w,functionName:"owner"});if(f(o)!==f(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=P(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(l=>typeof l!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===R)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${u}, values ${JSON.stringify(t,(o,l)=>typeof l=="bigint"?String(l):l)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[d.unsignedTx({to:u,data:E({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await d.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await d.http(`https://longbow.credit/api/referral/stats/${f(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==f(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:f(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:k("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};
@@ -1 +1 @@
1
- import{a as C}from"./43LI5NKJ.js";import{a as _}from"./66F5ZH34.js";import{g as N,m as T,n as k}from"./NWNYJ26T.js";import{b as u,j as $,k as I}from"./TI727O2H.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as w,erc20Abi as R,getAddress as y,parseAbi as z}from"viem";var d=y($[u].vaults.spark.address),l={address:y(I),symbol:"USDG",decimals:6,chainId:u},E={address:d,symbol:"spUSDG",decimals:6,chainId:u},c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function maxMint(address) view returns (uint256)","function maxRedeem(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function mint(uint256 shares,address receiver,uint16 referral) returns (uint256)","function deposit(uint256 assets,address receiver,uint16 referral) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)"]),Q=r=>_(r),J={type:"integer",minimum:0,maximum:65535,description:"Integration referral code, a whole number from 0 to 65535. It is only emitted in an event and has no other effect."},K={shares:'Amount of spUSDG shares in base units (spUSDG has 6 decimals). Example: "1000000" = 1 spUSDG.',maxAssets:'Most USDG you will pay, in base units (USDG has 6 decimals). The call fails if the quote is higher. Example: "1000000" = 1 USDG.',amount:'Amount of USDG in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.'};function M(r){return k(r,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function j(r){return T(r,"Invalid Spark integer read.")}function ee(r){return["mint","redeem","deposit_referral","return_liquidity"].map(n=>{let t=n==="mint",a=n==="redeem",h=n==="deposit_referral",x=t?["shares","maxAssets","referral"]:a?["shares"]:h?["amount","referral"]:["amount"],O=t?["shares","maxAssets"]:a?["shares"]:h?["amount","referral"]:["amount"];return{name:`spark_${n}`,inputSchema:{type:"object",additionalProperties:!1,required:O,properties:Object.fromEntries(x.map(m=>[m,m==="referral"?J:Q(K[m])]))},execute:async(m,o)=>{try{if(C(o),Object.keys(m).some(p=>!x.includes(p)))throw new i("Unexpected Spark action argument.");let e=M(m[t||a?"shares":"amount"]),B=t?M(m.maxAssets):void 0,s=m.referral;if((h||s!==void 0)&&(typeof s!="number"||!Number.isInteger(s)||s<0||s>65535))throw new i("Referral must be a uint16 integer.");let f=r.clientFor(u);if(await f.getChainId()!==u)throw new i("Spark requires chain 4663.");let[U,F,H]=await Promise.all([f.readContract({address:d,abi:c,functionName:"asset"}),f.readContract({address:d,abi:c,functionName:"decimals"}),f.readContract({address:l.address,abi:R,functionName:"decimals"})]);if(typeof U!="string"||y(U)!==l.address||F!==6||H!==6)throw new i("Spark requires the pinned USDG/share metadata.");let v=n==="return_liquidity"?e:j(await f.readContract({address:d,abi:c,functionName:t?"previewMint":a?"previewRedeem":"previewDeposit",args:[e]}));if(v===0n)throw new i("Spark returned a zero action quote.");if(n!=="return_liquidity"){let p=j(await f.readContract({address:d,abi:c,functionName:t?"maxMint":a?"maxRedeem":"maxDeposit",args:[o]}));if(e>p)throw new i("The amount exceeds Spark\u2019s current action capacity.")}if(t&&v>B)throw new i("The mint quote exceeds maxAssets.");let G=t?v:e,P=t?s===void 0?w({abi:c,functionName:"mint",args:[e,o]}):w({abi:c,functionName:"mint",args:[e,o,s]}):a?w({abi:c,functionName:"redeem",args:[e,o,o]}):h?w({abi:c,functionName:"deposit",args:[e,o,s]}):w({abi:R,functionName:"transfer",args:[d,e]}),q=`${n} ${e} ${t||a?"spUSDG share":"USDG asset"} base units; ${n==="return_liquidity"?`USDG goes to ${d}, with no shares minted`:`beneficiary ${o}`}${s===void 0?"":`; event-only referral ${s}`}.`,A=[...t||h?[r.approval(l.address,d,G.toString(),u)]:[],r.unsignedTx({to:n==="return_liquidity"?l.address:d,data:P,value:"0",chainId:u,description:q})],g=await r.preview(A,o),S=p=>g.changes.filter(b=>b.token.chainId===u&&N(b.token.address,p.address)).reduce((b,D)=>{if(D.token.decimals!==p.decimals||!/^-?\d+$/.test(D.amount))throw new i("Invalid Spark preview metadata.");return b+BigInt(D.amount)},0n);if(a?S(E)!==-e||S(l)<=0n:S(l)!==-G||n!=="return_liquidity"&&S(E)<(t?e:1n))throw new i("Spark preview does not match the requested outflow and receipt.");return{txs:A,preview:g,summary:`${q} Quoted ${v} ${a?"USDG asset":t||n==="return_liquidity"?"USDG input":"spUSDG share"} base units. ${g.summary} Standard ERC-4626 encodes no output minimum; the exact mint approval can become insufficient as interest accrues. Re-preview before signing.`}}catch(e){throw new i(r.plainError(e))}}}})}export{ee as a};
1
+ import{a as C}from"./43LI5NKJ.js";import{a as _}from"./66F5ZH34.js";import{g as N,m as T,n as k}from"./NWNYJ26T.js";import{b as u,j as $,k as I}from"./EWZFZUVF.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as w,erc20Abi as R,getAddress as y,parseAbi as z}from"viem";var d=y($[u].vaults.spark.address),l={address:y(I),symbol:"USDG",decimals:6,chainId:u},E={address:d,symbol:"spUSDG",decimals:6,chainId:u},c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function maxMint(address) view returns (uint256)","function maxRedeem(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function mint(uint256 shares,address receiver,uint16 referral) returns (uint256)","function deposit(uint256 assets,address receiver,uint16 referral) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)"]),Q=r=>_(r),J={type:"integer",minimum:0,maximum:65535,description:"Integration referral code, a whole number from 0 to 65535. It is only emitted in an event and has no other effect."},K={shares:'Amount of spUSDG shares in base units (spUSDG has 6 decimals). Example: "1000000" = 1 spUSDG.',maxAssets:'Most USDG you will pay, in base units (USDG has 6 decimals). The call fails if the quote is higher. Example: "1000000" = 1 USDG.',amount:'Amount of USDG in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.'};function M(r){return k(r,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function j(r){return T(r,"Invalid Spark integer read.")}function ee(r){return["mint","redeem","deposit_referral","return_liquidity"].map(n=>{let t=n==="mint",a=n==="redeem",h=n==="deposit_referral",x=t?["shares","maxAssets","referral"]:a?["shares"]:h?["amount","referral"]:["amount"],O=t?["shares","maxAssets"]:a?["shares"]:h?["amount","referral"]:["amount"];return{name:`spark_${n}`,inputSchema:{type:"object",additionalProperties:!1,required:O,properties:Object.fromEntries(x.map(m=>[m,m==="referral"?J:Q(K[m])]))},execute:async(m,o)=>{try{if(C(o),Object.keys(m).some(p=>!x.includes(p)))throw new i("Unexpected Spark action argument.");let e=M(m[t||a?"shares":"amount"]),B=t?M(m.maxAssets):void 0,s=m.referral;if((h||s!==void 0)&&(typeof s!="number"||!Number.isInteger(s)||s<0||s>65535))throw new i("Referral must be a uint16 integer.");let f=r.clientFor(u);if(await f.getChainId()!==u)throw new i("Spark requires chain 4663.");let[U,F,H]=await Promise.all([f.readContract({address:d,abi:c,functionName:"asset"}),f.readContract({address:d,abi:c,functionName:"decimals"}),f.readContract({address:l.address,abi:R,functionName:"decimals"})]);if(typeof U!="string"||y(U)!==l.address||F!==6||H!==6)throw new i("Spark requires the pinned USDG/share metadata.");let v=n==="return_liquidity"?e:j(await f.readContract({address:d,abi:c,functionName:t?"previewMint":a?"previewRedeem":"previewDeposit",args:[e]}));if(v===0n)throw new i("Spark returned a zero action quote.");if(n!=="return_liquidity"){let p=j(await f.readContract({address:d,abi:c,functionName:t?"maxMint":a?"maxRedeem":"maxDeposit",args:[o]}));if(e>p)throw new i("The amount exceeds Spark\u2019s current action capacity.")}if(t&&v>B)throw new i("The mint quote exceeds maxAssets.");let G=t?v:e,P=t?s===void 0?w({abi:c,functionName:"mint",args:[e,o]}):w({abi:c,functionName:"mint",args:[e,o,s]}):a?w({abi:c,functionName:"redeem",args:[e,o,o]}):h?w({abi:c,functionName:"deposit",args:[e,o,s]}):w({abi:R,functionName:"transfer",args:[d,e]}),q=`${n} ${e} ${t||a?"spUSDG share":"USDG asset"} base units; ${n==="return_liquidity"?`USDG goes to ${d}, with no shares minted`:`beneficiary ${o}`}${s===void 0?"":`; event-only referral ${s}`}.`,A=[...t||h?[r.approval(l.address,d,G.toString(),u)]:[],r.unsignedTx({to:n==="return_liquidity"?l.address:d,data:P,value:"0",chainId:u,description:q})],g=await r.preview(A,o),S=p=>g.changes.filter(b=>b.token.chainId===u&&N(b.token.address,p.address)).reduce((b,D)=>{if(D.token.decimals!==p.decimals||!/^-?\d+$/.test(D.amount))throw new i("Invalid Spark preview metadata.");return b+BigInt(D.amount)},0n);if(a?S(E)!==-e||S(l)<=0n:S(l)!==-G||n!=="return_liquidity"&&S(E)<(t?e:1n))throw new i("Spark preview does not match the requested outflow and receipt.");return{txs:A,preview:g,summary:`${q} Quoted ${v} ${a?"USDG asset":t||n==="return_liquidity"?"USDG input":"spUSDG share"} base units. ${g.summary} Standard ERC-4626 encodes no output minimum; the exact mint approval can become insufficient as interest accrues. Re-preview before signing.`}}catch(e){throw new i(r.plainError(e))}}}})}export{ee as a};
@@ -1,4 +1,4 @@
1
- import{h as T,s as E,t as F,v as P,w as S}from"./3A2IKFTV.js";import{a as m}from"./X5V2Z2NM.js";import{d as A}from"./HFVXNKA5.js";import{e as g,g as u}from"./NWNYJ26T.js";import{t as v}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{encodeFunctionData as k,keccak256 as _,stringToHex as C}from"viem";var x="erc8004_stamp_thesis",q="/v1/agents/thesis",M={type:"object",additionalProperties:!1,required:["text","position"],properties:{text:{type:"string",minLength:1,maxLength:16384,description:"Exact thesis text to hash and publish in the tracker record; up to 16 KiB UTF-8. Only the hash is written on chain."},position:{type:"string",minLength:1,maxLength:256,description:"Canonical position ID, up to 256 UTF-8 bytes. Use oak_plan_run steps [trade, stamp] to approve both together."}}};function b(t,n){if(typeof t!="string"||!t.trim()||Buffer.byteLength(t,"utf8")>16384||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(t))throw new o("Provide nonempty thesis text up to 16 KiB of valid UTF-8.");if(typeof n!="string"||!n.trim()||Buffer.byteLength(n,"utf8")>256||/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(n))throw new o("Provide a nonempty canonical position ID up to 256 UTF-8 bytes.");let e=_(C(t)),r=`oak.thesis.${_(C(JSON.stringify([n,t]))).slice(2)}`;return{text:t,position:n,key:r,hash:e}}function O(t,n){let e=b(n.text,n.position);if(!/^(0|[1-9][0-9]*)$/.test(n.agentId)||e.key!==n.key||e.hash!==n.hash||typeof n.writtenAfterEntry!="boolean")throw new o("The thesis differs from the locally prepared stamp.");let r=k({abi:m,functionName:"setMetadata",args:[BigInt(n.agentId),e.key,e.hash]}),a=t[0];if(t.length!==1||!a||a.chainId!==4663||!u(a.to,v.mainnet.identityRegistry)||a.value!=="0"||!u(a.data,r))throw new o("The transaction differs from the exact zero-value thesis stamp.")}function J(t){if(t.filter(e=>e.action?.name===x).length>1)throw new o("A plan may contain only one thesis stamp.");for(let[e,r]of t.entries()){if(r.action?.name!==x)continue;let a=r.action.oakThesis;if(!a||a.writtenAfterEntry!==(e===0))throw new o("The thesis disclosure differs from its locally prepared plan context.");O(r.txs,a)}}async function V(t,n,e,r,a={}){let{network:d,chainId:i,registry:y}=T(t);if(d!=="mainnet")throw new o("Thesis stamps are available on Robinhood Chain mainnet.");let c=A(e,d);if(!g(r)||Object.keys(r).some(D=>!["text","position"].includes(D)))throw new o("Provide only text and position; the local verified identity supplies the agent ID.");let s=b(r.text,r.position),l=BigInt(c.agentId);await F(t,l,n,"stamp this thesis");let f={...s,agentId:c.agentId,writtenAfterEntry:a.writtenAfterEntry!==!1},h=k({abi:m,functionName:"setMetadata",args:[l,s.key,s.hash]}),w=t.unsignedTx({to:y,chainId:i,value:"0",data:h,description:"Stamp the thesis hash as ERC-8004 metadata."}),p=f.writtenAfterEntry?`Thesis written after entry on ${new Date((a.now??Date.now)()).toISOString().slice(0,10)}.`:"Trade and thesis approved together in one plan.";return{...await E(t,[w],n,`Stamp the thesis hash ${s.hash} for agent ${c.agentId}. Only the hash is written on chain; the exact text and position are sent to Oak's public tracker record after the stamp is mined. ${p}
1
+ import{h as T,s as E,t as F,v as P,w as S}from"./BIFANUTV.js";import{a as m}from"./X5V2Z2NM.js";import{d as A}from"./2BM2WX2G.js";import{e as g,g as u}from"./NWNYJ26T.js";import{t as v}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{encodeFunctionData as k,keccak256 as _,stringToHex as C}from"viem";var x="erc8004_stamp_thesis",q="/v1/agents/thesis",M={type:"object",additionalProperties:!1,required:["text","position"],properties:{text:{type:"string",minLength:1,maxLength:16384,description:"Exact thesis text to hash and publish in the tracker record; up to 16 KiB UTF-8. Only the hash is written on chain."},position:{type:"string",minLength:1,maxLength:256,description:"Canonical position ID, up to 256 UTF-8 bytes. Use oak_plan_run steps [trade, stamp] to approve both together."}}};function b(t,n){if(typeof t!="string"||!t.trim()||Buffer.byteLength(t,"utf8")>16384||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(t))throw new o("Provide nonempty thesis text up to 16 KiB of valid UTF-8.");if(typeof n!="string"||!n.trim()||Buffer.byteLength(n,"utf8")>256||/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(n))throw new o("Provide a nonempty canonical position ID up to 256 UTF-8 bytes.");let e=_(C(t)),r=`oak.thesis.${_(C(JSON.stringify([n,t]))).slice(2)}`;return{text:t,position:n,key:r,hash:e}}function O(t,n){let e=b(n.text,n.position);if(!/^(0|[1-9][0-9]*)$/.test(n.agentId)||e.key!==n.key||e.hash!==n.hash||typeof n.writtenAfterEntry!="boolean")throw new o("The thesis differs from the locally prepared stamp.");let r=k({abi:m,functionName:"setMetadata",args:[BigInt(n.agentId),e.key,e.hash]}),a=t[0];if(t.length!==1||!a||a.chainId!==4663||!u(a.to,v.mainnet.identityRegistry)||a.value!=="0"||!u(a.data,r))throw new o("The transaction differs from the exact zero-value thesis stamp.")}function J(t){if(t.filter(e=>e.action?.name===x).length>1)throw new o("A plan may contain only one thesis stamp.");for(let[e,r]of t.entries()){if(r.action?.name!==x)continue;let a=r.action.oakThesis;if(!a||a.writtenAfterEntry!==(e===0))throw new o("The thesis disclosure differs from its locally prepared plan context.");O(r.txs,a)}}async function V(t,n,e,r,a={}){let{network:d,chainId:i,registry:y}=T(t);if(d!=="mainnet")throw new o("Thesis stamps are available on Robinhood Chain mainnet.");let c=A(e,d);if(!g(r)||Object.keys(r).some(D=>!["text","position"].includes(D)))throw new o("Provide only text and position; the local verified identity supplies the agent ID.");let s=b(r.text,r.position),l=BigInt(c.agentId);await F(t,l,n,"stamp this thesis");let f={...s,agentId:c.agentId,writtenAfterEntry:a.writtenAfterEntry!==!1},h=k({abi:m,functionName:"setMetadata",args:[l,s.key,s.hash]}),w=t.unsignedTx({to:y,chainId:i,value:"0",data:h,description:"Stamp the thesis hash as ERC-8004 metadata."}),p=f.writtenAfterEntry?`Thesis written after entry on ${new Date((a.now??Date.now)()).toISOString().slice(0,10)}.`:"Trade and thesis approved together in one plan.";return{...await E(t,[w],n,`Stamp the thesis hash ${s.hash} for agent ${c.agentId}. Only the hash is written on chain; the exact text and position are sent to Oak's public tracker record after the stamp is mined. ${p}
2
2
  Position: ${JSON.stringify(s.position)}
3
3
  Thesis:
4
4
  ${I(s.text)}`,!1),thesis:f}}async function Z(t,n,e,r,a){let d=!1;try{let i=b(e.text,e.position);if(i.key!==e.key||i.hash!==e.hash||typeof e.writtenAfterEntry!="boolean")throw new Error("invalid_bound_thesis");let{registry:y,chainId:c}=T(t);if(c!==4663||!/^(0|[1-9][0-9]*)$/.test(e.agentId))throw new Error("invalid_stamp_identity");let s=BigInt(e.agentId),l=k({abi:m,functionName:"setMetadata",args:[s,i.key,i.hash]}),f=await P(t,r,n,l),h=S(f,y,m,"MetadataSet");if(h.agentId!==s||h.metadataKey!==i.key||typeof h.metadataValue!="string"||!u(h.metadataValue,i.hash))throw new Error("stamp_event_mismatch");let w=await t.clientFor(c).readContract({address:y,abi:m,functionName:"getMetadata",args:[s,i.key],blockNumber:f.blockNumber});if(typeof w!="string"||!u(w,i.hash))throw new Error("stamp_metadata_mismatch");d=!0;let p=await a({agentId:e.agentId,key:i.key,hash:i.hash,text:i.text,txHash:r,position:i.position,writtenAfterEntry:e.writtenAfterEntry});if(!g(p)||p.ok!==!0||!g(p.data)||p.data.verification!=="confirmed")throw new Error("record_not_confirmed");return{txHash:r,stampMined:!0,recorded:!0,summary:"The thesis stamp is mined and its public tracker record is confirmed."}}catch{return{txHash:r,...d?{stampMined:!0}:{},recorded:!1,summary:d?"The thesis stamp is mined, but its tracker record was not confirmed. Retry recording this stamp without sending another transaction.":"The thesis stamp receipt could not be verified. No thesis record was posted; check the transaction before retrying."}}}var z=t=>({tools:t.network==="testnet"?[]:[{name:x,inputSchema:M,execute:async()=>{throw new o("Prepare this action through the local Oak bridge with a verified identity.")}}]});export{x as a,q as b,M as c,b as d,O as e,J as f,V as g,Z as h,z as i};
@@ -0,0 +1 @@
1
+ import{e as u,f as i}from"./UMY6SP7C.js";import{a}from"./XSD5NL7J.js";function p(e,t){if(u(t,["id","cap"],["id","cap"]),t.id!=="wallet-cap")throw new a("Choose Hook Block wallet-cap.");let o=i(t.cap,128);if(!e.guardEndBlock||!o||(e.potEveryNBuys&1<<19)!==0||(e.potMinBuyQuote&(1n<<19n)-1n)!==0n)throw new a("Wallet Cap requires a launch guard and a positive, unoccupied cap.");let n=1n;for(let r=0;r<=31;r++,n*=10n)if(o%n===0n&&o/n<16384n)return{...e,potEveryNBuys:e.potEveryNBuys|1<<30|1<<19,potMinBuyQuote:e.potMinBuyQuote|o/n|BigInt(r)<<14n};throw new a("Wallet Cap must be exactly representable as a mantissa below 16384 times a power of ten up to 31.")}function l(e){let t=e.potMinBuyQuote;return`Wallet Cap: each wallet may buy at most ${(t&16383n)*10n**(t>>14n&31n)} subject base units during the launch guard; sales do not restore the allowance. unauthenticated trades count tx.origin, and authenticated contract payers also count their transaction signer. The launch buy and qualifying lane executor swaps are exempt. No fee is charged.`}export{p as a,l as b};
@@ -1 +1 @@
1
- import{a as U,b as N,c as _}from"./XW3VGWXK.js";import{b as k,c as R}from"./2OVJ2BTJ.js";import{a as q,c as f,d as h,f as I,g as D}from"./GQITAJVF.js";import{g as B}from"./OUROA7XR.js";import{e as S}from"./NMJVQX5M.js";import{a as b,c as O}from"./43LI5NKJ.js";import{b as v}from"./66F5ZH34.js";import{b as A}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as $}from"viem";var K=a=>{function w(e,n){if(Object.keys(e).some(m=>!n.includes(m)))throw new s("Use only the inputs shown for this Pendle tool. YT and LP actions are not supported.")}function j(e){if(typeof e!="string"||!/^[0-9]+$/.test(e)||e.length>78)throw new s("Provide a positive decimal base-unit amount as a string.");return k(BigInt(e),!0)}function C(e,n){let m=e==="stable"?100:200,r=n===void 0?e==="stable"?50:100:n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new s("Slippage must be a whole number of basis points.");if(r>m)throw new s(`Oak won't accept a price move that big. The most it allows is ${m/100}%.`);return r}async function y(e,n,m){w(n,["market","amount","slippageBps"]),f(h(m,a.wallet),"wallet does not match this request"),b(n.market);for(let r=0;r<2;r++){let t=await a.verify(n.market);f(h(t.market,n.market),"verified market does not match the request");let d=await a.client.getBlock();if(t.expired||d.timestamp>=BigInt(t.expiry))throw new s("This Pendle term has ended. Use pendle_redeem to cash out.");let p=C(t.kind,n.slippageBps),o=e==="sell"&&n.amount==="max"?k(await a.client.readContract({address:t.pt,abi:$,functionName:"balanceOf",args:[a.wallet],blockNumber:d.number}),!0):j(n.amount),i=e==="buy"?t.inputToken:t.pt,l=e==="buy"?t.pt:t.inputToken,u=await B(a.http,{inputToken:i,outputToken:l,amount:o,wallet:a.wallet,slippageBps:p}),c=(e==="buy"?I:D)(u.body,{market:t,wallet:a.wallet,amount:o,slippageBps:p});if(Math.abs(c.priceImpact)>.03)throw new s("This is a thin market and your size moves the price too much. Try a smaller amount.");if(Date.now()-u.receivedAt>3e4)continue;await R(a.client,t,e,o,c.amountOut,c.priceImpact);let T=Date.now()-u.receivedAt;if(T<0||T>3e4)continue;let x=e==="sell"?{wallet:a.wallet,market:t.market,pt:t.pt,outputToken:l,amountIn:o.toString(),amountOut:c.amountOut.toString(),minOut:c.minOut.toString(),ptDecimals:t.ptDecimals,outputDecimals:t.inputDecimals,endsAt:t.expiry,feeUsd:c.feeUsd,receivedAt:u.receivedAt,data:c.tx.data}:void 0;return{txs:[O(i,q,o.toString(),A),c.tx],...x?{pendleSellQuote:x}:{},summary:e==="buy"?"Approve the exact input amount, then buy Pendle PT.":"Approve the exact PT amount, then sell early at today\u2019s market price."}}throw new s("Pendle\u2019s quote became too old. Try again for a fresh price.")}async function M(e,n){w(e,["market","minOutBps"]),f(h(n,a.wallet),"wallet does not match this request");let m=U(e.minOutBps),r;if(e.market==="all")try{r=await S(a.client)}catch{throw new s("Oak could not read ended Pendle markets from the chain. Provide one ended market address to cash it out.")}else b(e.market),r=[e.market];let t=[];for(let o of r){let i=await a.verify(o);if(f(h(i.market,o),"verified market does not match the request"),e.market==="all"&&!i.expired)continue;let l=k(await a.client.readContract({address:i.pt,abi:$,functionName:"balanceOf",args:[a.wallet]}));l!==0n&&t.push({verified:i,balance:l})}if(t.length>1)throw new s(`Ended Pendle terms are cashed out one at a time. Run pendle_redeem with one of these market addresses: ${t.map(({verified:o})=>o.market).join(", ")}.`);let d=[],p=[];for(let{verified:o,balance:i}of t){let l=await N(a,o,i,m);d.push(...l.txs);let u=await _(a,o,i,l.expected,m);u&&p.push(u)}return{txs:d,summary:d.length?["Cash out ended Pendle PT balances to each market\u2019s input token.",...p].join(" "):"No PT balance in the selected ended Pendle terms."}}let g={type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Pendle market address returned by pendle_list."},P={type:"integer",minimum:0,maximum:200,description:"USDG: default 50, cap 100 bps. Stock tokens: default 100, cap 200 bps; the verified market determines the cap."};return[{name:"pendle_buy",inputSchema:{type:"object",properties:{market:g,amount:v("Positive decimal base units of the market input token; read its decimals first."),slippageBps:P},required:["market","amount"],additionalProperties:!1},execute:(e,n)=>y("buy",e,n)},{name:"pendle_sell",inputSchema:{type:"object",properties:{market:g,amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"PT decimal base units, or max for the full PT balance."},slippageBps:P},required:["market","amount"],additionalProperties:!1},execute:(e,n)=>y("sell",e,n)},{name:"pendle_redeem",inputSchema:{type:"object",properties:{market:{type:"string",anyOf:[{pattern:"^0x[0-9a-fA-F]{40}$"},{const:"all"}],description:"Ended market address, or all ended markets held by this wallet."},minOutBps:{type:"integer",minimum:0,maximum:50,default:10,description:"Maximum reduction from the on-chain redemption estimate, in basis points."}},required:["market"],additionalProperties:!1},execute:M}]};export{K as a};
1
+ import{a as U,b as N,c as _}from"./QMWHQRYC.js";import{e as S}from"./DWRRIFXS.js";import{b as k,c as R}from"./SEXKWYUM.js";import{a as q,c as f,d as h,f as I,g as D}from"./5BPFF7NX.js";import{g as B}from"./OUROA7XR.js";import{a as b,c as O}from"./43LI5NKJ.js";import{b as v}from"./66F5ZH34.js";import{b as A}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as $}from"viem";var K=a=>{function w(e,n){if(Object.keys(e).some(m=>!n.includes(m)))throw new s("Use only the inputs shown for this Pendle tool. YT and LP actions are not supported.")}function j(e){if(typeof e!="string"||!/^[0-9]+$/.test(e)||e.length>78)throw new s("Provide a positive decimal base-unit amount as a string.");return k(BigInt(e),!0)}function C(e,n){let m=e==="stable"?100:200,r=n===void 0?e==="stable"?50:100:n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new s("Slippage must be a whole number of basis points.");if(r>m)throw new s(`Oak won't accept a price move that big. The most it allows is ${m/100}%.`);return r}async function y(e,n,m){w(n,["market","amount","slippageBps"]),f(h(m,a.wallet),"wallet does not match this request"),b(n.market);for(let r=0;r<2;r++){let t=await a.verify(n.market);f(h(t.market,n.market),"verified market does not match the request");let d=await a.client.getBlock();if(t.expired||d.timestamp>=BigInt(t.expiry))throw new s("This Pendle term has ended. Use pendle_redeem to cash out.");let p=C(t.kind,n.slippageBps),o=e==="sell"&&n.amount==="max"?k(await a.client.readContract({address:t.pt,abi:$,functionName:"balanceOf",args:[a.wallet],blockNumber:d.number}),!0):j(n.amount),i=e==="buy"?t.inputToken:t.pt,l=e==="buy"?t.pt:t.inputToken,u=await B(a.http,{inputToken:i,outputToken:l,amount:o,wallet:a.wallet,slippageBps:p}),c=(e==="buy"?I:D)(u.body,{market:t,wallet:a.wallet,amount:o,slippageBps:p});if(Math.abs(c.priceImpact)>.03)throw new s("This is a thin market and your size moves the price too much. Try a smaller amount.");if(Date.now()-u.receivedAt>3e4)continue;await R(a.client,t,e,o,c.amountOut,c.priceImpact);let T=Date.now()-u.receivedAt;if(T<0||T>3e4)continue;let x=e==="sell"?{wallet:a.wallet,market:t.market,pt:t.pt,outputToken:l,amountIn:o.toString(),amountOut:c.amountOut.toString(),minOut:c.minOut.toString(),ptDecimals:t.ptDecimals,outputDecimals:t.inputDecimals,endsAt:t.expiry,feeUsd:c.feeUsd,receivedAt:u.receivedAt,data:c.tx.data}:void 0;return{txs:[O(i,q,o.toString(),A),c.tx],...x?{pendleSellQuote:x}:{},summary:e==="buy"?"Approve the exact input amount, then buy Pendle PT.":"Approve the exact PT amount, then sell early at today\u2019s market price."}}throw new s("Pendle\u2019s quote became too old. Try again for a fresh price.")}async function M(e,n){w(e,["market","minOutBps"]),f(h(n,a.wallet),"wallet does not match this request");let m=U(e.minOutBps),r;if(e.market==="all")try{r=await S(a.client)}catch{throw new s("Oak could not read ended Pendle markets from the chain. Provide one ended market address to cash it out.")}else b(e.market),r=[e.market];let t=[];for(let o of r){let i=await a.verify(o);if(f(h(i.market,o),"verified market does not match the request"),e.market==="all"&&!i.expired)continue;let l=k(await a.client.readContract({address:i.pt,abi:$,functionName:"balanceOf",args:[a.wallet]}));l!==0n&&t.push({verified:i,balance:l})}if(t.length>1)throw new s(`Ended Pendle terms are cashed out one at a time. Run pendle_redeem with one of these market addresses: ${t.map(({verified:o})=>o.market).join(", ")}.`);let d=[],p=[];for(let{verified:o,balance:i}of t){let l=await N(a,o,i,m);d.push(...l.txs);let u=await _(a,o,i,l.expected,m);u&&p.push(u)}return{txs:d,summary:d.length?["Cash out ended Pendle PT balances to each market\u2019s input token.",...p].join(" "):"No PT balance in the selected ended Pendle terms."}}let g={type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Pendle market address returned by pendle_list."},P={type:"integer",minimum:0,maximum:200,description:"USDG: default 50, cap 100 bps. Stock tokens: default 100, cap 200 bps; the verified market determines the cap."};return[{name:"pendle_buy",inputSchema:{type:"object",properties:{market:g,amount:v("Positive decimal base units of the market input token; read its decimals first."),slippageBps:P},required:["market","amount"],additionalProperties:!1},execute:(e,n)=>y("buy",e,n)},{name:"pendle_sell",inputSchema:{type:"object",properties:{market:g,amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"PT decimal base units, or max for the full PT balance."},slippageBps:P},required:["market","amount"],additionalProperties:!1},execute:(e,n)=>y("sell",e,n)},{name:"pendle_redeem",inputSchema:{type:"object",properties:{market:{type:"string",anyOf:[{pattern:"^0x[0-9a-fA-F]{40}$"},{const:"all"}],description:"Ended market address, or all ended markets held by this wallet."},minOutBps:{type:"integer",minimum:0,maximum:50,default:10,description:"Maximum reduction from the on-chain redemption estimate, in basis points."}},required:["market"],additionalProperties:!1},execute:M}]};export{K as a};
@@ -1 +1 @@
1
- import{d as ee}from"./NAO7VWZF.js";import{e as ie}from"./4RCYYN6O.js";import{a as ne,i as se,l as re}from"./W3DGFMQE.js";import{a as ae,b as D,c as F}from"./4PLLS6CT.js";import{e as te}from"./PDPTJMTJ.js";import{b as Z}from"./SPJCSEKP.js";import{a as $}from"./43LI5NKJ.js";import{c as B}from"./SCG5HWMN.js";import{b as X}from"./66F5ZH34.js";import{c as A,d as z,e as b,g as N,j as J,m as Q,n as K}from"./NWNYJ26T.js";import{b as l,j as O}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=O[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function R(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function U(a){return N(a,V.address)}function P(a){return ne.some(f=>N(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(s){try{return await s()}catch(i){throw new u(a.plainError(i))}}function S(s,i){if(s.chainId!==void 0&&s.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(s))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let s=await B(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return s.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return B(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(s,i){let d=s[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let s=a.clientFor(l);if(await s.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await s.getBlockNumber()),d=(t,r)=>s.readContract({address:t,abi:q,functionName:r,blockNumber:i}),e=async(t,r)=>T(await s.readContract({address:t,abi:M,functionName:"balanceOf",args:[r],blockNumber:i}));async function n(t){let[r,p]=await Promise.all([s.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),s.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof r!="string"||!r.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:r,decimals:ue(p)}}async function o(t){let r=t.earnContractAddress,p=v(await d(r,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(r),d(r,"strategy"),d(r,"balance"),d(r,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let _=v(m),x=await d(_,"paused");if(typeof x!="boolean")throw new u("The strategy returned an invalid pause flag.");let G=T(w);if(G===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:_,paused:x,managed:T(c),pricePerFullShare:G}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function Y(s){let i=v(s.vault),d=D(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function W(s,i,d,e){let n=j(await H(),e),o=await a.preview(s,i),t=o.changes.map(r=>{let p=r.amount.startsWith("-"),h=p?r.amount.slice(1):r.amount;return`${p?"-":"+"}${a.formatAmount(h,r.token.decimals)} ${g(r.token.symbol)} (${r.token.address}, chain ${r.token.chainId})`}).join("; ");return{txs:s,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let r=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await se(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:r.want,shares:r.shares,vaultTotalWant:{token:r.want,amount:r.managed.toString()},pricePerFullShare:{token:r.want,amount:r.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:r.paused,source:"strategy.paused()",address:r.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:U(t.earnContractAddress),qualification:U(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:D(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!r.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"],description:"Price-history window as candle size_range: 1h_1d = hourly over 1 day, 1h_1w = 1 week, 1h_1M = 1 month, 1d_1M = daily over 1 month (default), 1d_1Y = 1 year, 1d_all = all time."}},required:["vault"],additionalProperties:!1},execute:s=>f(async()=>{S(s,["vault","historyBucket"]);let i=s.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(s.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await B(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},_=>_!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,r,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...r,currency:"USD"},history:p,forkQualified:U(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},token:{...A,description:"Address of the vault's want (LP or CLM share) token being deposited; must equal the vault's want token."},amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Maximum slippage in basis points (50 = 0.5%) used to set the minimum shares if minSharesOut is omitted. Default 50."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","token","amount"],additionalProperties:!1},execute:(s,i)=>f(async()=>{if(S(s,["vault","token","amount","minSharesOut","slippageBps"]),$(i),s.slippageBps!==void 0&&(!Number.isInteger(s.slippageBps)||Number(s.slippageBps)<0||Number(s.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");s.minSharesOut!==void 0&&R(s.minSharesOut);let d=R(s.amount),e=v(s.token),n=await Y(s),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let r=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await W(r,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=s.minSharesOut===void 0?h*BigInt(1e4-Number(s.slippageBps??50))/10000n:R(s.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:O[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},shares:{description:'Vault shares (moo tokens) to redeem for want, in base units of the share token (read its decimals). "all" redeems your full share balance.',anyOf:[E,{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","shares"],additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,["vault","shares"]),$(i);let d=s.shares==="all"?void 0:R(s.shares),e=await Y(s),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let r=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return W(r,i,"Withdraw from",e)})}],positions:s=>f(async()=>{$(s);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,s),t===0n)continue;let r=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:r.want,amount:(t*r.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),r.shares.decimals)} ${g(r.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${r.paused}. ${U(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(r){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(r)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),re(a),ee(a),te(a)])}export{he as a,Te as b};
1
+ import{d as ee}from"./OCIEVYPR.js";import{e as ie}from"./V7HTGO23.js";import{a as ne,i as se,l as re}from"./4RTXP2YP.js";import{a as ae,b as D,c as F}from"./2VYA6WIN.js";import{e as te}from"./TT2ST3Q3.js";import{b as Z}from"./SPJCSEKP.js";import{a as $}from"./43LI5NKJ.js";import{c as B}from"./SCG5HWMN.js";import{b as X}from"./66F5ZH34.js";import{c as A,d as z,e as b,g as N,j as J,m as Q,n as K}from"./NWNYJ26T.js";import{b as l,j as O}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=O[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function R(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function U(a){return N(a,V.address)}function P(a){return ne.some(f=>N(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(s){try{return await s()}catch(i){throw new u(a.plainError(i))}}function S(s,i){if(s.chainId!==void 0&&s.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(s))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let s=await B(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return s.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return B(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(s,i){let d=s[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let s=a.clientFor(l);if(await s.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await s.getBlockNumber()),d=(t,r)=>s.readContract({address:t,abi:q,functionName:r,blockNumber:i}),e=async(t,r)=>T(await s.readContract({address:t,abi:M,functionName:"balanceOf",args:[r],blockNumber:i}));async function n(t){let[r,p]=await Promise.all([s.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),s.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof r!="string"||!r.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:r,decimals:ue(p)}}async function o(t){let r=t.earnContractAddress,p=v(await d(r,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(r),d(r,"strategy"),d(r,"balance"),d(r,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let _=v(m),x=await d(_,"paused");if(typeof x!="boolean")throw new u("The strategy returned an invalid pause flag.");let G=T(w);if(G===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:_,paused:x,managed:T(c),pricePerFullShare:G}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function Y(s){let i=v(s.vault),d=D(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function W(s,i,d,e){let n=j(await H(),e),o=await a.preview(s,i),t=o.changes.map(r=>{let p=r.amount.startsWith("-"),h=p?r.amount.slice(1):r.amount;return`${p?"-":"+"}${a.formatAmount(h,r.token.decimals)} ${g(r.token.symbol)} (${r.token.address}, chain ${r.token.chainId})`}).join("; ");return{txs:s,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let r=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await se(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:r.want,shares:r.shares,vaultTotalWant:{token:r.want,amount:r.managed.toString()},pricePerFullShare:{token:r.want,amount:r.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:r.paused,source:"strategy.paused()",address:r.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:U(t.earnContractAddress),qualification:U(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:D(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!r.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"],description:"Price-history window as candle size_range: 1h_1d = hourly over 1 day, 1h_1w = 1 week, 1h_1M = 1 month, 1d_1M = daily over 1 month (default), 1d_1Y = 1 year, 1d_all = all time."}},required:["vault"],additionalProperties:!1},execute:s=>f(async()=>{S(s,["vault","historyBucket"]);let i=s.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(s.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await B(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},_=>_!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,r,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...r,currency:"USD"},history:p,forkQualified:U(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},token:{...A,description:"Address of the vault's want (LP or CLM share) token being deposited; must equal the vault's want token."},amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Maximum slippage in basis points (50 = 0.5%) used to set the minimum shares if minSharesOut is omitted. Default 50."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","token","amount"],additionalProperties:!1},execute:(s,i)=>f(async()=>{if(S(s,["vault","token","amount","minSharesOut","slippageBps"]),$(i),s.slippageBps!==void 0&&(!Number.isInteger(s.slippageBps)||Number(s.slippageBps)<0||Number(s.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");s.minSharesOut!==void 0&&R(s.minSharesOut);let d=R(s.amount),e=v(s.token),n=await Y(s),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let r=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await W(r,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=s.minSharesOut===void 0?h*BigInt(1e4-Number(s.slippageBps??50))/10000n:R(s.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:O[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},shares:{description:'Vault shares (moo tokens) to redeem for want, in base units of the share token (read its decimals). "all" redeems your full share balance.',anyOf:[E,{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","shares"],additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,["vault","shares"]),$(i);let d=s.shares==="all"?void 0:R(s.shares),e=await Y(s),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let r=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return W(r,i,"Withdraw from",e)})}],positions:s=>f(async()=>{$(s);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,s),t===0n)continue;let r=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:r.want,amount:(t*r.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),r.shares.decimals)} ${g(r.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${r.paused}. ${U(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(r){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(r)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),re(a),ee(a),te(a)])}export{he as a,Te as b};
@@ -0,0 +1 @@
1
+ import{a as R,b as K}from"./G2LAO23N.js";import{a as W}from"./7WXAS54T.js";import{a as B}from"./B7WZJHIJ.js";import{c as L,f as U,g as T,i as z}from"./NWNYJ26T.js";import{b as k}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as J,erc20Abi as re,erc721Abi as V,getAddress as ie,parseAbi as se,zeroAddress as q}from"viem";var A=B,G=se(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),g=(t,e)=>t.name==="seed"?"marketSeed":t.name||`arg${e}`,X=t=>"components"in t?t.components:[],ae=t=>{if(typeof t!="string"||!/^(0|[1-9][0-9]*)$/.test(t)||t.length>78||BigInt(t)>=1n<<256n)throw new d("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(t)},p=t=>U(t,"Provide the documented Hookr parameter object."),b=t=>z(t,"Provide a valid Hookr address."),Y=t=>t.stateMutability==="view"||t.stateMutability==="pure";function _(t){return t.abi}var ce=`Base units of the token it counts; read that token's decimals (18 decimals: "1000000000000000000" = 1 token).`,de={type:"string",pattern:"^(0|[1-9][0-9]*)$"};function ue(t,e,a){let r=`${t} ${e} ${a}.`,n=t.replace(/\[[0-9]*\]$/,"");return/^u?int/.test(n)?/divisor|numerator|denominator/i.test(e)?`${r} Plain integer ${/divisor/i.test(e)?"divisor":"ratio component"}; do not scale by token decimals.`:/liquidity/i.test(e)?`${r} Uniswap v4 liquidity units, not a token amount; do not scale by token decimals.`:/gas/i.test(e)?`${r} Integer gas units; do not scale by token decimals.`:/point/i.test(e)&&!/decimals/i.test(e)?`${r} Integer points; do not scale by token decimals.`:/pips$/i.test(e)?`${r} ${R.pips()}`:K(e,de)||e==="walletFeeCap"?`${r} ${ce}`:/bps$/i.test(e)?`${r} ${R.bps()}`:/(deadline|expir|timestamp|time|At)$/.test(e)?`${r} Unix seconds, as a decimal string.`:`${r} Decimal string${n.startsWith("uint")?"":", may be negative"}.`:n==="address"?`${r} 0x followed by 40 hex digits${/^(to|recipient|receiver|owner|spender|wallet|beneficiary)$/i.test(e)?"; use the intended address, never an example address":""}.`:n==="bool"?`${r} true or false.`:n.startsWith("bytes")?`${r} 0x-prefixed hex bytes.`:n==="tuple"?`${r} Object with the listed fields.`:`${r} Plain text.`}function Z(t,e,a,r){let n=ue(t.type,r,e),i=/^(.*)\[([0-9]*)\]$/.exec(t.type);return i?{type:"array",description:n,items:Z({...t,type:i[1]},e,a,r),minItems:i[2]?Number(i[2]):0,maxItems:i[2]?Number(i[2]):128}:t.type==="tuple"?{...E(X(t),a,r),description:n}:t.type==="bool"?{type:"boolean",description:n}:t.type==="address"?{...L,description:n}:/^u?int/.test(t.type)?{type:"string",pattern:t.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:n}:t.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770,description:n}:{type:"string",maxLength:4096,description:n}}function E(t,e,a){let r=a===void 0?`argument of ${e}`:`field of ${a} in ${e}`;return{type:"object",properties:Object.fromEntries(t.map((n,i)=>[g(n,i),Z(n,r,e,g(n,i))])),required:t.map(g),additionalProperties:!1}}function C(t,e){let a=/^(.*)\[([0-9]*)\]$/.exec(t.type);if(a){if(!Array.isArray(e)||e.length>128||a[2]&&e.length!==Number(a[2]))throw new d("Hookr parameter array has an invalid length.");return e.map(n=>C({...t,type:a[1]},n))}if(t.type==="tuple"){let n=p(e),i=X(t);return N(n,i.map(g)),Object.fromEntries(i.map((c,u)=>[c.name||`arg${u}`,C(c,n[g(c,u)])]))}if(t.type==="address")return b(e);if(t.type==="bool"){if(typeof e!="boolean")throw new d("Provide a Hookr boolean.");return e}let r=/^(u?)int([0-9]*)$/.exec(t.type);if(r){if(typeof e!="string"||!/^(0|-?[1-9][0-9]*)$/.test(e)||e.length>79)throw new d("Provide Hookr integers as decimal base-unit strings.");let n=BigInt(e),i=BigInt(r[2]||256),c=!r[1];if(n<(c?-(1n<<i-1n):0n)||n>=1n<<(c?i-1n:i))throw new d("Hookr integer exceeds its ABI range.");return i<=32n?Number(n):n}if(t.type.startsWith("bytes")){let n=Number(t.type.slice(5));if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(e)||e.length>32770||n&&e.length!==2+n*2)throw new d("Provide a valid Hookr hex byte string of the ABI length.");return e}if(t.type!=="string"||typeof e!="string"||new TextEncoder().encode(e).length>4096)throw new d("Provide a valid Hookr string.");return e}function N(t,e){if(Object.keys(t).some(a=>!e.includes(a))||e.some(a=>!Object.hasOwn(t,a)))throw new d("Provide exactly the documented Hookr parameters.")}function ye(t,e){N(e,t.inputs.map(g));let a=t.inputs.map((r,n)=>C(r,e[g(r,n)]));return{values:a,params:Object.fromEntries(t.inputs.map((r,n)=>[g(r,n),a[n]]))}}function ee(t,e){if(N(t,["contract","function","params"]),typeof t.contract!="string"||!Object.hasOwn(A,t.contract))throw new d("Choose a contract from hookr_contracts.");let a=A[t.contract];if(!e&&a.address.toLowerCase()===B.launcherV1.address.toLowerCase())throw new d("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let r=_(a).find(u=>u.name===t.function&&(e?Y(u):a.actions.includes(u.name)));if(!r)throw new d("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let n=p(t.params);N(n,r.inputs.map(g));let i=r.inputs.map((u,f)=>C(u,n[g(u,f)])),c=Object.fromEntries(r.inputs.map((u,f)=>[g(u,f),i[f]]));return{pin:a,fn:r,values:i,params:c,target:b(a.address)}}var te={type:"string",enum:Object.keys(A),description:'Pinned Hookr contract role, as listed by hookr_contracts (for example "launcherV1").'},Q={type:"object",properties:{contract:te,function:{type:"string",description:"Function name on that contract, exactly as hookr_contracts lists it."},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function ne(t){return JSON.parse(JSON.stringify(t,(e,a)=>typeof a=="bigint"?a.toString():a))}async function me(t,e,a){if(t.network==="testnet")throw new d("Hookr actions are configured only on mainnet, chain 4663.");let{pin:r,fn:n,values:i,params:c,target:u}=ee(e,!1),f=e.contract,l=n.name,$=t.clientFor(k),v=[],P=[],w=0n,O=new Map,h=(o,s)=>{let m=b(o),x=typeof s=="bigint"?s:ae(s);if(x<0n||x>=(1n<<256n)-1n)throw new d("Hookr funding must be an exact bounded amount.");x&&(m===q?w+=x:O.set(m,(O.get(m)??0n)+x))},H=(o,s,m=[])=>$.readContract({address:b(A[o].address),abi:A[o].abi,functionName:s,args:m});if(f==="router"&&["swap","swapGated"].includes(l)){let o=p(c.params),s=p(o.key),m=o.amountSpecified;if(m===0n||o.amountBound===0n)throw new d("Hookr swaps require a nonzero amount and bound.");h(o.zeroForOne?s.currency0:s.currency1,m<0n?-m:o.amountBound)}else if(f==="vault"&&l==="deposit"){let o=p(c.params),s=p(o.key);if(h(s.currency0,o.amount0Desired),h(s.currency1,o.amount1Desired),o.amount0Min>o.amount0Desired||o.amount1Min>o.amount1Desired)throw new d("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&l==="transfer")P.push({token:u,id:c.id,amount:c.amount,to:b(c.receiver)});else if(f==="launcher"&&l.startsWith("launch")){let o=l==="launchFamily"?p(c.p):c,s=p(o.token),m=o.members;if(m.length<1||m.length>8)throw new d("Hookr launch needs one to eight members.");if(T(String(s.salt),String(await H("launcher","SKIP_TAKEN"))))throw new d("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=s.existing===q?b(await H("launcher","predictToken",[a,s])):b(s.existing),M=0n;for(let y of m){let I=BigInt(x)<BigInt(String(y.quote)),D=I?y.amount0Max:y.amount1Max;s.existing===q?M+=D:h(x,D),h(y.quote,I?y.amount1Max:y.amount0Max)}if(M>s.supply)throw new d("Hookr launch seeds more new tokens than its supply.");let oe=l==="launchFamily"?o.buys:l==="launchWithBuy"?[p(c.buy)]:[];for(let y of oe){let I=m[Number(y.member)];if(!I)throw new d("Hookr dev buy references an unavailable member.");h(I.quote,y.quoteIn)}let F=await $.readContract({address:u,abi:G,functionName:"launchFee"});if(!Array.isArray(F)||typeof F[0]!="bigint"||F[0]<0n)throw new d("Hookr launch fee is unavailable.");w+=F[0]}else if(f==="launcher"&&l==="addLiquidity"){let o=p(await H("launcher","position",[c.familyId,c.member])),s=p(o.key);h(s.currency0,c.max0),h(s.currency1,c.max1)}else if(f==="ownedFactory"&&l==="deploy"){let o=await H("ownedFactory","deployFee");if(typeof o!="bigint"||o<0n)throw new d("Hookr own-hook deployment fee is unavailable.");w=o}else if(f==="programs"&&l==="createProgram"){let o=p(c.t);if(h(o.rewardToken,o.cashBudget),w)throw new d("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&l==="createCampaign"){let o=p(c.t),s=o.end-o.start;if(s<=0n||s%86400n!==0n||s/86400n>366n)throw new d("Hookr referral campaigns must cover one to 366 whole days.");h(o.currency,o.dailyBudget*(s/86400n))}else if(f==="reserve"&&l==="fundReserve")h(c.token,c.amount);else if(f==="tokenizer"){let o=p(c.arg1);if(o.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(s=>o[s].length>0))throw new d("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let s of o.revenueTokens)h(s.token,s.amount);if(l==="tokenize"&&p(c.arg2).open){let s=await $.readContract({address:b(A.launcher.address),abi:G,functionName:"launchFee"});if(!Array.isArray(s)||typeof s[0]!="bigint"||s[0]<0n)throw new d("Hookr revenue market launch fee is unavailable.");w+=s[0]}}else if(f==="boost"&&["fund","notify"].includes(l)){let o=p(await H("boost","gauge",[c.id]));if(h(p(o.terms).rewardToken,c.amount),w)throw new d("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&l==="stake"){let o=b(await H("boost","positionManager"));if(o!==ie("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new d("Hookr boost position manager disagrees with the published deployment.");let s=await $.readContract({address:o,abi:V,functionName:"ownerOf",args:[c.tokenId]});if(!T(s,a))throw new d("The signing wallet must own the position NFT it stakes.");v.push(t.unsignedTx({to:o,data:J({abi:V,functionName:"approve",args:[u,c.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${c.tokenId} to ${u}.`})),P.push({token:o,id:c.tokenId,amount:1n,to:u})}let j=await $.getBlock();if(typeof j.timestamp!="bigint"||j.timestamp<=0n)throw new d("Hookr chain time is unavailable.");let S=o=>{if(Array.isArray(o)){o.forEach(S);return}if(!(!o||typeof o!="object"))for(let[s,m]of Object.entries(o)){if(s==="deadline"&&typeof m=="bigint"&&m<j.timestamp)throw new d("Hookr deadline expired. Refresh the action terms.");S(m)}};S(c);for(let[o,s]of O){if(s>=(1n<<256n)-1n)throw new d("Hookr aggregate funding exceeds its exact approval bound.");let m=await $.readContract({address:o,abi:re,functionName:"allowance",args:[a,u]});m>0n&&m!==s&&v.push(t.approval(o,u,"0",k)),v.push(t.approval(o,u,s.toString(),k)),P.push({token:o,amount:s})}return w&&P.push({token:W,amount:w,to:u}),v.push(t.unsignedTx({to:u,data:J({abi:[n],functionName:n.name,args:i}),value:w.toString(),chainId:k,description:`Hookr ${f}.${l}: ${JSON.stringify(ne(c))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:v,inputs:P}}function ke(t,e,a={}){let r=(n,i)=>!a.gasLimitCeiling||n===void 0||i===void 0?n===i:/^[1-9][0-9]{0,77}$/.test(n)&&/^[1-9][0-9]{0,77}$/.test(i)&&BigInt(n)<=BigInt(i);if(t.length!==e.length||t.some((n,i)=>n.chainId!==e[i].chainId||!T(n.to,e[i].to)||n.value!==e[i].value||!r(n.gasLimit,e[i].gasLimit)||!T(n.data,e[i].data)))throw new d("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function xe(t){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{...te,description:"Only this pinned contract role; omit for every contract."},function:{type:"string",description:"Only this function name; omit for every function of the selected contracts."}},additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(r=>!["contract","function"].includes(r))||e.contract!==void 0&&(typeof e.contract!="string"||!Object.hasOwn(A,e.contract))||e.function!==void 0&&typeof e.function!="string")throw new d("Choose a documented Hookr contract and function filter.");let a=r=>e.function===void 0||r.name===e.function;return{chainId:k,contracts:Object.entries(A).filter(([r])=>e.contract===void 0||r===e.contract).map(([r,n])=>({role:r,address:b(n.address),source:n.source,match:n.match,reads:_(n).filter(i=>Y(i)&&a(i)).map(i=>({function:i.name,params:E(i.inputs,i.name)})),actions:n.actions.filter(i=>e.function===void 0||i===e.function).map(i=>({function:i,params:E(_(n).find(c=>c.name===i).inputs,i)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...Q,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async e=>{let{pin:a,fn:r,values:n,target:i}=ee(e,!0),c=await t.clientFor(k).readContract({address:i,abi:[r],functionName:r.name,args:n});return{chainId:k,contract:i,function:r.name,result:ne(c),source:a.source}}},{name:"hookr_action",inputSchema:{...Q,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(e,a)=>{let r=await me(t,e,a),n=await t.preview(r.txs,a);return{txs:r.txs,preview:n,summary:`Hookr ${e.contract}.${e.function}; review the preview and human confirmation.`}}}]}export{ue as a,E as b,ye as c,me as d,ke as e,xe as f};
@@ -1 +1 @@
1
- import{a as B}from"./ZXFJKW6H.js";import{c as V}from"./ZQPC54J5.js";import{c as x}from"./R73R4KN3.js";import{c as P}from"./QIB6OMQV.js";import{b as M}from"./WQ2XTDHO.js";import{k as F}from"./YXXK6EPI.js";import{a as _}from"./A3PN3PK3.js";import{b as O,o as R}from"./GYPMUYB5.js";import{b as I}from"./SPJCSEKP.js";import{a as S}from"./43LI5NKJ.js";import{a as H}from"./66F5ZH34.js";import{g as A,m as N,n as W}from"./NWNYJ26T.js";import{b as m,j as G}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as L,getAddress as b,parseAbi as z}from"viem";var c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function balanceOf(address) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),Q=z(["function deposit() payable"]),p=G[m],T=[{key:"core",name:"Longbow Core USDG",vault:p.vaults.longbowCore.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"frontier",name:"Longbow Frontier USDG",vault:p.vaults.longbowFrontier.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"eth",name:"Longbow ETH",vault:p.vaults.longbowEth.address,asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}],D=[{key:"v1-usdg",name:"Longbow USDG Core V1 (legacy)",vault:b("0x8cb8AA35228c96C1C4E956E69AbAEBCc2aA7Dcfe"),asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"v1-weth",name:"Longbow WETH Core V1 (legacy)",vault:b("0x93777a9b917be3c8259c84456222f43a01dd6492"),asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}];function j(s,i){return W(s,`${i} must be positive and within the uint256 range.`,{notString:`${i} must be a positive integer string in base units.`,positive:!0})}function h(s){return N(s,"Longbow returned an invalid integer response.")}function q(s,i=!1){if(typeof s!="string")throw new u("Provide the address of a current Longbow vault.");let w=D.find(y=>A(y.vault,s));if(w&&!i)throw new u("Longbow V1 vaults are withdraw-only; deposit into a current V2 vault from longbow_list instead.");let g=w??T.find(y=>A(y.vault,s));if(!g)throw new u("Provide the address of a current Longbow vault, or a Longbow V1 vault to withdraw from. Other vaults are not supported.");return g}function C(s,i){if(Object.keys(s).some(w=>!i.includes(w)))throw new u("Unsupported Longbow input. Use the fields in the tool schema.")}var X=s=>{async function i(e){try{return await e()}catch(t){throw new u(s.plainError(t))}}async function w(){let e=s.clientFor(m);if(await e.getChainId()!==m)throw new u("Longbow requires a client on chain 4663.");return e}async function g(e,t){let[o,r,a,n]=await Promise.all([e.readContract({address:t.vault,abi:c,functionName:"asset"}),e.readContract({address:t.vault,abi:c,functionName:"decimals"}),e.readContract({address:t.asset,abi:c,functionName:"decimals"}),_(e,t.vault)]);if(typeof o!="string"||!A(o,t.asset))throw new u("Longbow vault asset does not match the recorded deployment.");if(r!==18||a!==t.decimals)throw new u("Longbow token decimals do not match the recorded deployment.");return{vault:t.vault,key:t.key,name:t.name,asset:{address:b(t.asset),symbol:t.symbol,decimals:a,chainId:m},share:{address:t.vault,symbol:n,decimals:r,chainId:m}}}async function y(e,t,o,r){let a=R(o.amount,O);if(BigInt(a)===0n)throw new u("The expected output is too small for a nonzero simulation minimum.");let n=await s.preview(e,t);if(n.changes.filter(l=>l.token.chainId===o.token.chainId&&A(l.token.address,o.token.address)&&l.token.decimals===o.token.decimals).reduce((l,v)=>l+BigInt(v.amount),0n)<BigInt(a))throw new u("Longbow simulated output is below the expected minimum.");let d=n.changes.map(({token:l,amount:v})=>{let U=v.startsWith("-");return`${U?"-":"+"}${s.formatAmount(U?v.slice(1):v,l.decimals)} ${l.symbol} (${l.address}, chain ${l.chainId})`}).join("; ");return{txs:e,preview:n,expectedOutput:o,minimumOutput:{token:o.token,amount:a},minimumEnforcedOnchain:!1,summary:`${r} ${d}. Simulation only; no on-chain minimum is enforced by these ERC-4626 calls. ${n.summary}`}}async function Y(e){C(e,[]);let t=await w();return Promise.all(T.map(async o=>{let[r,a,n,f]=await Promise.all([g(t,o),t.readContract({address:o.vault,abi:c,functionName:"totalAssets"}),t.readContract({address:o.vault,abi:c,functionName:"performanceFee"}),t.readContract({address:o.vault,abi:c,functionName:"managementFee"})]);return{...r,totalAssets:{token:r.asset,amount:h(a).toString()},fees:{performanceFeeE18:h(n).toString(),managementFeeE18:h(f).toString()},caveat:"Morpho V2 max views can be zero even when writes succeed. Simulate the requested action; listing does not prove availability."}}))}async function K(e,t){C(e,["vault","amount","wrapEth"]),S(t);let o=q(e.vault),r=j(e.amount,"Deposit amount");if(e.wrapEth!==void 0&&typeof e.wrapEth!="boolean")throw new u("wrapEth must be a boolean.");if(e.wrapEth&&!A(o.asset,p.tokens.WETH.address))throw new u("Only a WETH vault accepts explicit ETH wrapping.");let a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"previewDeposit",args:[r]})),d=[];return e.wrapEth&&d.push(s.unsignedTx({to:n.asset.address,data:L({abi:Q,functionName:"deposit"}),value:r.toString(),chainId:m,description:`Wrap ${s.formatAmount(r.toString(),18)} ETH into WETH for ${n.name}.`})),d.push(s.approval(n.asset.address,n.vault,r.toString(),m)),d.push(s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"deposit",args:[r,b(t)]}),value:"0",chainId:m,description:`Deposit ${s.formatAmount(r.toString(),n.asset.decimals)} ${n.asset.symbol} into ${n.name}.`})),y(d,t,{token:n.share,amount:f.toString()},`Deposit into ${n.name}.`)}async function J(e,t){C(e,["vault","shares"]),S(t);let o=q(e.vault,!0),r=e.shares==="all"?void 0:j(e.shares,"Redeem shares"),a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"balanceOf",args:[t]})),d=r??f;if(d===0n||d>f)throw new u("The wallet has insufficient Longbow shares for this redemption.");let l=h(await a.readContract({address:n.vault,abi:c,functionName:"previewRedeem",args:[d]})),v=[s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"redeem",args:[d,b(t),b(t)]}),value:"0",chainId:m,description:`Redeem ${s.formatAmount(d.toString(),n.share.decimals)} shares from ${n.name} into ${n.asset.symbol}.`})];return y(v,t,{token:n.asset,amount:l.toString()},`Redeem from ${n.name}.`)}let E={type:"string",enum:T.map(e=>e.vault),description:"Current vault address on chain 4663."},$=H('Positive amount of the vault asset in base units, never a human-unit decimal (USDG has 6 decimals, WETH 18). Example: "1000000" = 1 USDG.'),k=(e,t,o,r)=>({name:e,inputSchema:{type:"object",description:e==="longbow_deposit"?"Deposit the selected vault\u2019s USDG (6 decimals) or WETH (18 decimals) in base units for shares. Exit with longbow_withdraw; check positions after confirmation.":e==="longbow_withdraw"?"Redeem shares in 18-decimal base units, or shares all for a full exit. Returns USDG or WETH according to the selected vault.":"List current Longbow vault assets and shares; exit existing shares with longbow_withdraw.",properties:t,required:o,additionalProperties:!1},execute:(a,n)=>i(()=>r(a,n))});return{tools:[k("longbow_list",{},[],Y),k("longbow_deposit",{vault:E,amount:$,wrapEth:{type:"boolean",default:!1,description:"Explicitly wrap this amount of native ETH before depositing into the WETH vault."}},["vault","amount"],K),k("longbow_withdraw",{vault:{...E,enum:[...E.enum,...D.map(e=>e.vault)],description:"Current vault address, or a Longbow V1 vault (withdraw-only) on chain 4663."},shares:{anyOf:[$,{const:"all"}],description:"Share base units (18 decimals), or all for the fresh wallet share balance. Returns the underlying asset, including WETH."}},["vault","shares"],J)],positions:e=>i(async()=>{S(e);let t=await w();return(await Promise.all([...T,...D].map(async r=>{let a=await g(t,r),n=h(await t.readContract({address:a.vault,abi:c,functionName:"balanceOf",args:[e]}));if(n===0n)return[];let f=h(await t.readContract({address:a.vault,abi:c,functionName:"previewRedeem",args:[n]}));return[{module:"longbow",id:`${m}:${a.vault.toLowerCase()}`,chainId:m,assets:[{token:a.asset,amount:f.toString()}],description:`${a.name}: ${s.formatAmount(n.toString(),a.share.decimals)} shares (${a.share.address}, ${a.share.decimals} decimals). Underlying is a preview, not a guaranteed redemption.`}]}))).flat()})}};function he(s){return I("longbow",[X(s),P(s),F(s),x(s),M(s),V(s),{tools:B(s,"longbow",T.map(i=>({vault:i.vault,asset:{address:b(i.asset),symbol:i.symbol,decimals:i.decimals,chainId:m}})))}])}export{D as a,X as b,he as c};
1
+ import{a as B}from"./QAVP3CWL.js";import{c as P}from"./5O67QQIY.js";import{b as M}from"./7X5JVF3F.js";import{c as V}from"./LKRAUTYI.js";import{c as x}from"./YBLJ2MCR.js";import{k as F}from"./QBHY2QRC.js";import{a as _}from"./A3PN3PK3.js";import{b as O,o as R}from"./TTBB6EFN.js";import{b as I}from"./SPJCSEKP.js";import{a as S}from"./43LI5NKJ.js";import{a as H}from"./66F5ZH34.js";import{g as A,m as N,n as W}from"./NWNYJ26T.js";import{b as m,j as G}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as L,getAddress as b,parseAbi as z}from"viem";var c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function balanceOf(address) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),Q=z(["function deposit() payable"]),p=G[m],T=[{key:"core",name:"Longbow Core USDG",vault:p.vaults.longbowCore.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"frontier",name:"Longbow Frontier USDG",vault:p.vaults.longbowFrontier.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"eth",name:"Longbow ETH",vault:p.vaults.longbowEth.address,asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}],D=[{key:"v1-usdg",name:"Longbow USDG Core V1 (legacy)",vault:b("0x8cb8AA35228c96C1C4E956E69AbAEBCc2aA7Dcfe"),asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"v1-weth",name:"Longbow WETH Core V1 (legacy)",vault:b("0x93777a9b917be3c8259c84456222f43a01dd6492"),asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}];function j(s,i){return W(s,`${i} must be positive and within the uint256 range.`,{notString:`${i} must be a positive integer string in base units.`,positive:!0})}function h(s){return N(s,"Longbow returned an invalid integer response.")}function q(s,i=!1){if(typeof s!="string")throw new u("Provide the address of a current Longbow vault.");let w=D.find(y=>A(y.vault,s));if(w&&!i)throw new u("Longbow V1 vaults are withdraw-only; deposit into a current V2 vault from longbow_list instead.");let g=w??T.find(y=>A(y.vault,s));if(!g)throw new u("Provide the address of a current Longbow vault, or a Longbow V1 vault to withdraw from. Other vaults are not supported.");return g}function C(s,i){if(Object.keys(s).some(w=>!i.includes(w)))throw new u("Unsupported Longbow input. Use the fields in the tool schema.")}var X=s=>{async function i(e){try{return await e()}catch(t){throw new u(s.plainError(t))}}async function w(){let e=s.clientFor(m);if(await e.getChainId()!==m)throw new u("Longbow requires a client on chain 4663.");return e}async function g(e,t){let[o,r,a,n]=await Promise.all([e.readContract({address:t.vault,abi:c,functionName:"asset"}),e.readContract({address:t.vault,abi:c,functionName:"decimals"}),e.readContract({address:t.asset,abi:c,functionName:"decimals"}),_(e,t.vault)]);if(typeof o!="string"||!A(o,t.asset))throw new u("Longbow vault asset does not match the recorded deployment.");if(r!==18||a!==t.decimals)throw new u("Longbow token decimals do not match the recorded deployment.");return{vault:t.vault,key:t.key,name:t.name,asset:{address:b(t.asset),symbol:t.symbol,decimals:a,chainId:m},share:{address:t.vault,symbol:n,decimals:r,chainId:m}}}async function y(e,t,o,r){let a=R(o.amount,O);if(BigInt(a)===0n)throw new u("The expected output is too small for a nonzero simulation minimum.");let n=await s.preview(e,t);if(n.changes.filter(l=>l.token.chainId===o.token.chainId&&A(l.token.address,o.token.address)&&l.token.decimals===o.token.decimals).reduce((l,v)=>l+BigInt(v.amount),0n)<BigInt(a))throw new u("Longbow simulated output is below the expected minimum.");let d=n.changes.map(({token:l,amount:v})=>{let U=v.startsWith("-");return`${U?"-":"+"}${s.formatAmount(U?v.slice(1):v,l.decimals)} ${l.symbol} (${l.address}, chain ${l.chainId})`}).join("; ");return{txs:e,preview:n,expectedOutput:o,minimumOutput:{token:o.token,amount:a},minimumEnforcedOnchain:!1,summary:`${r} ${d}. Simulation only; no on-chain minimum is enforced by these ERC-4626 calls. ${n.summary}`}}async function Y(e){C(e,[]);let t=await w();return Promise.all(T.map(async o=>{let[r,a,n,f]=await Promise.all([g(t,o),t.readContract({address:o.vault,abi:c,functionName:"totalAssets"}),t.readContract({address:o.vault,abi:c,functionName:"performanceFee"}),t.readContract({address:o.vault,abi:c,functionName:"managementFee"})]);return{...r,totalAssets:{token:r.asset,amount:h(a).toString()},fees:{performanceFeeE18:h(n).toString(),managementFeeE18:h(f).toString()},caveat:"Morpho V2 max views can be zero even when writes succeed. Simulate the requested action; listing does not prove availability."}}))}async function K(e,t){C(e,["vault","amount","wrapEth"]),S(t);let o=q(e.vault),r=j(e.amount,"Deposit amount");if(e.wrapEth!==void 0&&typeof e.wrapEth!="boolean")throw new u("wrapEth must be a boolean.");if(e.wrapEth&&!A(o.asset,p.tokens.WETH.address))throw new u("Only a WETH vault accepts explicit ETH wrapping.");let a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"previewDeposit",args:[r]})),d=[];return e.wrapEth&&d.push(s.unsignedTx({to:n.asset.address,data:L({abi:Q,functionName:"deposit"}),value:r.toString(),chainId:m,description:`Wrap ${s.formatAmount(r.toString(),18)} ETH into WETH for ${n.name}.`})),d.push(s.approval(n.asset.address,n.vault,r.toString(),m)),d.push(s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"deposit",args:[r,b(t)]}),value:"0",chainId:m,description:`Deposit ${s.formatAmount(r.toString(),n.asset.decimals)} ${n.asset.symbol} into ${n.name}.`})),y(d,t,{token:n.share,amount:f.toString()},`Deposit into ${n.name}.`)}async function J(e,t){C(e,["vault","shares"]),S(t);let o=q(e.vault,!0),r=e.shares==="all"?void 0:j(e.shares,"Redeem shares"),a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"balanceOf",args:[t]})),d=r??f;if(d===0n||d>f)throw new u("The wallet has insufficient Longbow shares for this redemption.");let l=h(await a.readContract({address:n.vault,abi:c,functionName:"previewRedeem",args:[d]})),v=[s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"redeem",args:[d,b(t),b(t)]}),value:"0",chainId:m,description:`Redeem ${s.formatAmount(d.toString(),n.share.decimals)} shares from ${n.name} into ${n.asset.symbol}.`})];return y(v,t,{token:n.asset,amount:l.toString()},`Redeem from ${n.name}.`)}let E={type:"string",enum:T.map(e=>e.vault),description:"Current vault address on chain 4663."},$=H('Positive amount of the vault asset in base units, never a human-unit decimal (USDG has 6 decimals, WETH 18). Example: "1000000" = 1 USDG.'),k=(e,t,o,r)=>({name:e,inputSchema:{type:"object",description:e==="longbow_deposit"?"Deposit the selected vault\u2019s USDG (6 decimals) or WETH (18 decimals) in base units for shares. Exit with longbow_withdraw; check positions after confirmation.":e==="longbow_withdraw"?"Redeem shares in 18-decimal base units, or shares all for a full exit. Returns USDG or WETH according to the selected vault.":"List current Longbow vault assets and shares; exit existing shares with longbow_withdraw.",properties:t,required:o,additionalProperties:!1},execute:(a,n)=>i(()=>r(a,n))});return{tools:[k("longbow_list",{},[],Y),k("longbow_deposit",{vault:E,amount:$,wrapEth:{type:"boolean",default:!1,description:"Explicitly wrap this amount of native ETH before depositing into the WETH vault."}},["vault","amount"],K),k("longbow_withdraw",{vault:{...E,enum:[...E.enum,...D.map(e=>e.vault)],description:"Current vault address, or a Longbow V1 vault (withdraw-only) on chain 4663."},shares:{anyOf:[$,{const:"all"}],description:"Share base units (18 decimals), or all for the fresh wallet share balance. Returns the underlying asset, including WETH."}},["vault","shares"],J)],positions:e=>i(async()=>{S(e);let t=await w();return(await Promise.all([...T,...D].map(async r=>{let a=await g(t,r),n=h(await t.readContract({address:a.vault,abi:c,functionName:"balanceOf",args:[e]}));if(n===0n)return[];let f=h(await t.readContract({address:a.vault,abi:c,functionName:"previewRedeem",args:[n]}));return[{module:"longbow",id:`${m}:${a.vault.toLowerCase()}`,chainId:m,assets:[{token:a.asset,amount:f.toString()}],description:`${a.name}: ${s.formatAmount(n.toString(),a.share.decimals)} shares (${a.share.address}, ${a.share.decimals} decimals). Underlying is a preview, not a guaranteed redemption.`}]}))).flat()})}};function he(s){return I("longbow",[X(s),P(s),F(s),x(s),M(s),V(s),{tools:B(s,"longbow",T.map(i=>({vault:i.vault,asset:{address:b(i.asset),symbol:i.symbol,decimals:i.decimals,chainId:m}})))}])}export{D as a,X as b,he as c};
@@ -1 +1 @@
1
- import{b as q,o as U}from"./GYPMUYB5.js";import{a as J,b as ue,c as me}from"./C76D54YG.js";import{a as le}from"./ELHRXA5U.js";import{a as pe,b as fe}from"./DGDMRATN.js";import{a as ye}from"./4Z3IGMU6.js";import{e as F,h as L,m as ce}from"./TXGZ6NWN.js";import{b as ae}from"./SPJCSEKP.js";import{a as E}from"./IOYRL6AY.js";import{c as de}from"./SCG5HWMN.js";import{c as O,e as A,g as w,k as ie,l as oe,m as re,n as se}from"./NWNYJ26T.js";import{b as h,j as te}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{decodeFunctionResult as Ce,encodeAbiParameters as j,encodeFunctionData as D,erc20Abi as V,isAddress as Ie,parseAbi as xe,parseAbiParameters as W,toHex as z,zeroAddress as Z}from"viem";var x=te[h].clanker,he=xe(["function deployToken(((address tokenAdmin,string name,string symbol,bytes32 salt,string image,string metadata,string context,uint256 originatingChainId) tokenConfig,(address hook,address pairedToken,int24 tickIfToken0IsClanker,int24 tickSpacing,bytes poolData) poolConfig,(address locker,address[] rewardAdmins,address[] rewardRecipients,uint16[] rewardBps,int24[] tickLower,int24[] tickUpper,uint16[] positionBps,bytes lockerData) lockerConfig,(address mevModule,bytes mevModuleData) mevModuleConfig,(address extension,uint256 msgValue,uint16 extensionBps,bytes extensionData)[] extensionConfigs) config) payable returns (address)","function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),T=xe(["function availableFees(address,address) view returns (uint256)","function claim(address,address)","function collectRewards(address)","function mevModuleEnabled(bytes32) view returns (bool)","function mevModuleOperational(bytes32) returns (bool)"]),P={address:x.paired_weth.address,symbol:"WETH",decimals:18,chainId:h},ve="https://www.clanker.world/api/tokens",be={type:"string",pattern:"^\\d+$"},ge={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"};function C(e){return oe(ie(e,F),F)}function ke(e,t){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r(`Provide an explicit bytes32 ${t}.`);return e}function I(e,t,s=!1){if(e===void 0&&!s)return"";if(typeof e!="string"||s&&!e.trim())throw new r(`Provide ${t} as text.`);return e}function G(e,t=256){return se(e,`Amount exceeds the uint${t} range.`,{bits:t})}function K(e){return re(e,"The contract returned an invalid amount.").toString()}function B(e,t){let s=Object.keys(e).find(u=>!t.includes(u));if(s)throw new r(`Unsupported Clanker input: ${s}.`)}function we(e,t){return t.changes.map(({token:s,amount:u})=>{let g=u.startsWith("-");return`${g?"-":"+"}${e.formatAmount(g?u.slice(1):u,s.decimals)} ${s.symbol} (${s.address}, chain ${s.chainId})`}).join("; ")}function Se(e){return A(e)&&Array.isArray(e.data)&&Number.isSafeInteger(e.total)&&Number(e.total)>=0&&Number.isSafeInteger(e.tokensDeployed)&&Number(e.tokensDeployed)>=0&&(e.cursor===null||e.cursor===void 0||typeof e.cursor=="string")&&e.data.every(t=>A(t)&&typeof t.name=="string"&&typeof t.symbol=="string"&&Number.isSafeInteger(t.chain_id)&&["contract_address","admin","msg_sender","factory_address"].every(s=>typeof t[s]=="string"&&Ie(t[s],{strict:!1})))}function Q(e,t=0){return typeof e=="string"?N(e):e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:t>=4?null:Array.isArray(e)?e.slice(0,20).map(s=>Q(s,t+1)):A(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,u])=>[s,Q(u,t+1)])):null}function _e(e){return{...Q(e),contract_address:e.contract_address,admin:e.admin,msg_sender:e.msg_sender,chain_id:e.chain_id,factory_address:e.factory_address,name:N(e.name),symbol:N(e.symbol)}}function $e(e){try{if(typeof e!="string"||!/^[A-Za-z0-9_-]{1,256}={0,2}$/.test(e))throw new Error;let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));if(!A(t)||typeof t.id!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z?$/.test(t.id)||!Number.isFinite(Date.parse(t.id)))throw new Error;return e}catch{throw new r("Use the cursor returned by the previous clanker_browse page.")}}async function Ne(e,t={}){B(t,["q","limit","cursor","deployer"]);let s=t.limit??10;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>20)throw new r("Choose an indexer limit from 1 to 20.");let u=new URL(ve);u.searchParams.set("chainId",String(h)),u.searchParams.set("limit",String(s)),t.q!==void 0&&u.searchParams.set("q",I(t.q,"search")),t.cursor!==void 0&&u.searchParams.set("cursor",I(t.cursor,"cursor",!0)),t.deployer!==void 0&&u.searchParams.set("msgSender",C(t.deployer));let g=await de(e.http,u.toString(),{headers:{"User-Agent":"Oak-Clanker/1.0"}},Se);return{tokens:g.data.filter(v=>v.chain_id===h&&w(v.factory_address,x.factory.address)),total:g.total,cursor:g.cursor||null,tokensDeployed:g.tokensDeployed}}var Oe=e=>{let t=()=>e.clientFor(h),s=async n=>{try{return await n()}catch(i){throw new r(e.plainError(i))}},u=(n,i,a,c="0")=>e.unsignedTx({to:n,data:i,value:c,chainId:h,description:a}),g=async(n,i)=>K(await t().readContract({address:x.fee_locker.address,abi:T,functionName:"availableFees",args:[n,i]})),v=async n=>{if(w(n,P.address))return P;let[i,a]=await Promise.all([t().readContract({address:n,abi:V,functionName:"symbol"}),t().readContract({address:n,abi:V,functionName:"decimals"})]);if(typeof i!="string"||!i.trim()||!Number.isInteger(a)||a<0||a>255)throw new r("The contract returned invalid token metadata.");return{address:n,chainId:h,symbol:i,decimals:a}},X=async n=>{n.cursor!==void 0&&$e(n.cursor);let i=await Ne(e,n);return{...i,tokens:i.tokens.map(_e)}},Ae=async(n,i)=>{if(B(n,["name","symbol","salt","image","metadata","context","vanity","initialBuy","minAmountOut","slippageBps","rewards","vault","airdrop","feeBps","pool"]),n.vanity!==void 0&&n.vanity!==!1)throw new r("Clanker launches use vanity false and an explicit salt.");let a=I(n.name,"token name",!0),c=I(n.symbol,"token symbol",!0),b=ke(n.salt,"salt"),y=G(n.initialBuy??"0"),l=n.slippageBps??q;if(typeof l!="number")throw new r("Slippage must be an integer from 0 to 9999 bps.");U("0",l);let o=n.minAmountOut===void 0?void 0:G(n.minAmountOut,128);if(o!==void 0&&o<=1n)throw new r("Initial-buy minimum must exceed one base unit.");if(!y&&o!==void 0)throw new r("A minimum requires a positive initial buy.");let m=ue(n,i);L(n.feeBps??100,0,1e3);let p=fe(n);if(y&&!w(p.poolConfig.pairedToken,P.address))throw new r("An initial ETH buy currently requires a WETH-paired pool. Launch without an initial buy and obtain a protected swap quote separately.");let d=n.rewards??[{admin:i,recipient:i,bps:1e4,feePreference:0}];if(!Array.isArray(d)||!d.length||d.length>7)throw new r("Provide one to seven reward allocations.");let k=d.map(f=>{if(!A(f))throw new r("Provide reward allocations as objects.");return B(f,["admin","recipient","bps","feePreference"]),{admin:C(f.admin),recipient:C(f.recipient),bps:L(f.bps,1,1e4),feePreference:L(f.feePreference??0,0,2)}});if(k.reduce((f,S)=>f+S.bps,0)!==1e4)throw new r("Reward allocations must total 10000 bps.");let _={tokenConfig:{tokenAdmin:i,name:a,symbol:c,salt:b,image:I(n.image,"image"),metadata:I(n.metadata,"metadata"),context:n.context===void 0?JSON.stringify({interface:"Oak",platform:"robinhood"}):I(n.context,"context"),originatingChainId:BigInt(h)},poolConfig:p.poolConfig,lockerConfig:{locker:x.locker.address,rewardAdmins:k.map(f=>f.admin),rewardRecipients:k.map(f=>f.recipient),rewardBps:k.map(f=>f.bps),tickLower:p.tickLower,tickUpper:p.tickUpper,positionBps:p.positionBps,lockerData:j(W("(uint8[])"),[[k.map(f=>f.feePreference)]])},mevModuleConfig:{mevModule:x.mev_module.address,mevModuleData:j(W("(uint24,uint24,uint256)"),[[666777,41673,15n]])},extensionConfigs:m},Pe=await t().simulateContract({address:x.factory.address,abi:he,functionName:"deployToken",args:[_],account:i,value:0n,gas:E}),M=C(Pe.result),Y=f=>{let S=[...m,...y?[{extension:x.devbuy.address,msgValue:y,extensionBps:0,extensionData:j(W("(address,address,uint24,int24,address),uint128,address"),[[Z,Z,0,0,Z],f,i])}]:[]];return u(x.factory.address,D({abi:he,functionName:"deployToken",args:[{..._,extensionConfigs:S}]}),`Launch ${a} (${c}); initial buy ${y} native ETH base units.`,y.toString())};if(y&&o===void 0){let S=(await e.preview([Y(0n)],i)).changes.filter($=>$.token.chainId===h&&w($.token.address,M)&&$.token.decimals===18).reduce(($,ne)=>$+(/^-?\d+$/.test(ne.amount)?BigInt(ne.amount):(()=>{throw new r("Invalid initial-buy simulation amount.")})()),0n);if(S<=0n)throw new r("Initial-buy simulation returned no token output.");if(o=G(U(S.toString(),l),128),o<=1n)throw new r("Initial-buy output is too small for a protected minimum.")}let ee=[Y(o??0n)],H=await e.preview(ee,i);return{txs:ee,preview:H,predictedToken:M,token:{address:M,chainId:h,symbol:c,decimals:18},...o!==void 0?{minAmountOut:o.toString()}:{},summary:`Launch ${c} at ${M} (CREATE2 address predicted from simulation); vanity false; salt ${b}. Supply 100000000000000000000000000000 base units (18 decimals). ${p.feeSummary}; protocol adds 20% of LP fees. Pool and LP allocations: ${JSON.stringify(p)}. Reward allocations: ${JSON.stringify(k)}. Extensions: ${JSON.stringify({vault:n.vault,airdrop:n.airdrop})}. Sniper fees 666777 to 41673 over 15 seconds. ${H.summary} ${we(e,H)}`}},Te=async(n,i)=>{if(B(n,["token","poolId","collect"]),n.collect!==void 0&&typeof n.collect!="boolean")throw new r("collect must be boolean.");if(n.collect===!1&&n.poolId!==void 0)throw new r("poolId requires collection.");if(n.collect===!0&&n.token===void 0)throw new r("Collection requires a Clanker token.");if(n.poolId!==void 0&&n.token===void 0)throw new r("A pool ID requires its Clanker token.");let a=[P],c=[];if(n.token!==void 0){let o=C(n.token);if(w(o,P.address))throw new r("Provide the launched Clanker token, not WETH.");if(n.collect!==!1){let m=await ce(e,o),{poolId:p,hook:d,locker:k}=m;if(n.poolId!==void 0&&!w(ke(n.poolId,"pool ID for fee collection"),p))throw new r("The supplied pool ID does not match the onchain Clanker pool.");w(m.pairedToken,P.address)||a.splice(0,1,await v(m.pairedToken));let _=await t().readContract({address:d,abi:T,functionName:"mevModuleEnabled",args:[p]});if(typeof _!="boolean")throw new r("The hook returned an invalid MEV guard state.");_&&c.push(u(d,D({abi:T,functionName:"mevModuleOperational",args:[p]}),"Update the Clanker pool MEV guard before collection.")),c.push(u(k,D({abi:T,functionName:"collectRewards",args:[o]}),"Collect pending LP fees into the fee locker."))}a.push(await v(o))}let b;if(c.length){if(await t().getChainId()!==h)throw new r("Fee simulation endpoint is on the wrong chain.");let o=[...c.map(d=>({from:i,gas:z(E),to:d.to,data:d.data,value:z(BigInt(d.value))})),...a.map(d=>({from:i,gas:z(E),to:x.fee_locker.address,data:D({abi:T,functionName:"availableFees",args:[i,d.address]}),value:"0x0"}))],m=await t().request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:o}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(m)||m.length!==1||!A(m[0])||!Array.isArray(m[0].calls)||m[0].calls.length!==o.length)throw new r("The endpoint returned an unexpected fee simulation response.");let p=m[0].calls;if(!p.every(d=>A(d)&&d.status==="0x1"&&!d.error))throw new r("Clanker fee collection simulation failed.");b=p.slice(c.length).map(d=>{if(!A(d)||typeof d.returnData!="string"||!/^0x[0-9a-fA-F]{64}$/.test(d.returnData))throw new r("The endpoint returned an invalid fee balance.");return K(Ce({abi:T,functionName:"availableFees",data:d.returnData}))})}else b=await Promise.all(a.map(o=>g(i,o.address)));let y=a.flatMap((o,m)=>BigInt(b[m])>0n?[{token:o,amount:b[m]}]:[]);if(!y.length)throw new r("No claimable fees for this wallet; pending LP fees may require the MEV window to end.");for(let{token:o}of y)c.push(u(x.fee_locker.address,D({abi:T,functionName:"claim",args:[i,o.address]}),`Claim ${o.symbol} fees to ${i}.`));let l=await e.preview(c,i);return{txs:c,preview:l,fees:y,summary:`Claim fees to ${i}. WETH fees aggregate across all Clanker launches for this recipient. ${l.summary} ${we(e,l)}`}},R=(n,i,a,c)=>({name:`clanker_${n}`,inputSchema:{type:"object",properties:i,required:a,additionalProperties:!1},execute:(b,y)=>s(async()=>c(b,C(y)))});return{tools:[R("launch",{name:{type:"string",description:"Token name, shown publicly."},symbol:{type:"string",description:"Token ticker symbol, shown publicly."},salt:{...ge,description:"Deployment salt as 0x followed by 64 hex digits; it fixes the predicted token address."},image:{type:"string",description:"Image URL for the token. Public."},metadata:{type:"string",description:"Token metadata as a JSON string (description, social links). Public."},context:{type:"string",description:"Launch context as a JSON string. Defaults to Oak on Robinhood."},vanity:{const:!1,description:"Vanity address mining is not supported; leave false or omit."},initialBuy:{...be,description:"Native ETH base units, 18 decimals."},minAmountOut:{...be,description:"Minimum new token base units, 18 decimals; derived from simulation when omitted."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:q,description:"Slippage in basis points (50 = 0.5%) applied to the initial buy when minAmountOut is omitted."},feeBps:{type:"integer",minimum:0,maximum:1e3,default:100,description:"Static LP fee in basis points (100 = 1%). Not allowed together with pool.dynamicFee."},pool:{...pe,description:"Optional pool setup: paired token, starting tick, tick spacing, liquidity positions and dynamic fee. Defaults to a WETH pool."},rewards:{type:"array",minItems:1,maxItems:7,description:"How LP fees are split, 1 to 7 rows with bps totaling 10000. Default: all to the launching wallet.",items:{type:"object",properties:{admin:{...O,description:"Address that can later change this row."},recipient:{...O,description:"Address that receives this row's share of LP fees."},bps:{type:"integer",minimum:1,maximum:1e4,description:"This row's share of LP fees in basis points (5000 = 50%)."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in: 0 = both tokens (default), 1 = paired token, 2 = launched token."}},required:["admin","recipient","bps"],additionalProperties:!1}},vault:{...J.vault,description:"Optional vault extension: lock part of the supply, then vest it to an admin."},airdrop:{...J.airdrop,description:"Optional airdrop extension: reserve part of the supply for a Merkle-tree airdrop."}},["name","symbol","salt"],async(n,i)=>{let a=await Ae(n,i);return{...a,summary:`${a.summary} After the launch is mined, use clanker_status to inspect ${a.predictedToken} and clanker_claim to collect creator fees.`}}),R("claim",{token:{...O,description:"Launched token; derives its onchain pool and collects pending LP fees before claiming."},poolId:{...ge,description:"Optional assertion against the derived pool ID."},collect:{type:"boolean",default:!0,description:"Set false to claim only already-collected fees."}},[],Te),R("browse",{q:{type:"string",description:"Optional search text matched against token name or symbol."},limit:{type:"integer",minimum:1,maximum:20,description:"Maximum tokens to return, 1 to 20 (default 10)."},cursor:{type:"string",description:"Opaque pagination cursor returned by a previous clanker_browse call."},deployer:{...O,description:"Optional address of the deploying wallet to filter tokens by."}},[],X)],positions:n=>s(async()=>{C(n);let i=new Map,a=new Set,c;do{let l=await X({deployer:n,limit:20,...c?{cursor:c}:{}});for(let o of l.tokens)w(o.msg_sender,n)&&i.set(o.contract_address.toLowerCase(),o);if(l.cursor&&a.has(l.cursor))throw new r("The Clanker indexer repeated a pagination cursor.");l.cursor&&a.add(l.cursor),c=l.cursor??void 0}while(c);let b=[],y=[P];for(let[l,o]of i){let m=await v(o.contract_address),p={...m,symbol:N(m.symbol)},d=K(await t().readContract({address:p.address,abi:V,functionName:"balanceOf",args:[n]}));b.push({module:"clanker",id:`launch:${l}`,chainId:h,assets:[{token:p,amount:d}],description:`Indexed launch ${o.name}; wallet token balance, not locked LP principal.`}),y.some(k=>w(k.address,p.address))||y.push(p)}for(let l of y){let o=await g(n,l.address);BigInt(o)>0n&&b.push({module:"clanker",id:`fees:${l.address.toLowerCase()}`,chainId:h,assets:[{token:l,amount:o}],description:"Collected fees across launches for this recipient. Pending LP fees excluded; token-side discovery covers indexed launches by this wallet."})}return b})}},ze=e=>ae("clanker",[Oe(e),le(e),me(e),ye(e)]);export{Ne as a,Oe as b,ze as c};
1
+ import{b as q,o as U}from"./TTBB6EFN.js";import{a as J,b as ue,c as me}from"./HGSFRN57.js";import{a as le}from"./QFK335LC.js";import{a as pe,b as fe}from"./ICHT3H3W.js";import{a as ye}from"./7AYP4ATZ.js";import{e as F,h as L,m as ce}from"./PG7HZIZL.js";import{b as ae}from"./SPJCSEKP.js";import{a as E}from"./IOYRL6AY.js";import{c as de}from"./SCG5HWMN.js";import{c as O,e as A,g as w,k as ie,l as oe,m as re,n as se}from"./NWNYJ26T.js";import{b as h,j as te}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{decodeFunctionResult as Ce,encodeAbiParameters as j,encodeFunctionData as D,erc20Abi as V,isAddress as Ie,parseAbi as xe,parseAbiParameters as W,toHex as z,zeroAddress as Z}from"viem";var x=te[h].clanker,he=xe(["function deployToken(((address tokenAdmin,string name,string symbol,bytes32 salt,string image,string metadata,string context,uint256 originatingChainId) tokenConfig,(address hook,address pairedToken,int24 tickIfToken0IsClanker,int24 tickSpacing,bytes poolData) poolConfig,(address locker,address[] rewardAdmins,address[] rewardRecipients,uint16[] rewardBps,int24[] tickLower,int24[] tickUpper,uint16[] positionBps,bytes lockerData) lockerConfig,(address mevModule,bytes mevModuleData) mevModuleConfig,(address extension,uint256 msgValue,uint16 extensionBps,bytes extensionData)[] extensionConfigs) config) payable returns (address)","function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),T=xe(["function availableFees(address,address) view returns (uint256)","function claim(address,address)","function collectRewards(address)","function mevModuleEnabled(bytes32) view returns (bool)","function mevModuleOperational(bytes32) returns (bool)"]),P={address:x.paired_weth.address,symbol:"WETH",decimals:18,chainId:h},ve="https://www.clanker.world/api/tokens",be={type:"string",pattern:"^\\d+$"},ge={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"};function C(e){return oe(ie(e,F),F)}function ke(e,t){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r(`Provide an explicit bytes32 ${t}.`);return e}function I(e,t,s=!1){if(e===void 0&&!s)return"";if(typeof e!="string"||s&&!e.trim())throw new r(`Provide ${t} as text.`);return e}function G(e,t=256){return se(e,`Amount exceeds the uint${t} range.`,{bits:t})}function K(e){return re(e,"The contract returned an invalid amount.").toString()}function B(e,t){let s=Object.keys(e).find(u=>!t.includes(u));if(s)throw new r(`Unsupported Clanker input: ${s}.`)}function we(e,t){return t.changes.map(({token:s,amount:u})=>{let g=u.startsWith("-");return`${g?"-":"+"}${e.formatAmount(g?u.slice(1):u,s.decimals)} ${s.symbol} (${s.address}, chain ${s.chainId})`}).join("; ")}function Se(e){return A(e)&&Array.isArray(e.data)&&Number.isSafeInteger(e.total)&&Number(e.total)>=0&&Number.isSafeInteger(e.tokensDeployed)&&Number(e.tokensDeployed)>=0&&(e.cursor===null||e.cursor===void 0||typeof e.cursor=="string")&&e.data.every(t=>A(t)&&typeof t.name=="string"&&typeof t.symbol=="string"&&Number.isSafeInteger(t.chain_id)&&["contract_address","admin","msg_sender","factory_address"].every(s=>typeof t[s]=="string"&&Ie(t[s],{strict:!1})))}function Q(e,t=0){return typeof e=="string"?N(e):e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:t>=4?null:Array.isArray(e)?e.slice(0,20).map(s=>Q(s,t+1)):A(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,u])=>[s,Q(u,t+1)])):null}function _e(e){return{...Q(e),contract_address:e.contract_address,admin:e.admin,msg_sender:e.msg_sender,chain_id:e.chain_id,factory_address:e.factory_address,name:N(e.name),symbol:N(e.symbol)}}function $e(e){try{if(typeof e!="string"||!/^[A-Za-z0-9_-]{1,256}={0,2}$/.test(e))throw new Error;let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));if(!A(t)||typeof t.id!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z?$/.test(t.id)||!Number.isFinite(Date.parse(t.id)))throw new Error;return e}catch{throw new r("Use the cursor returned by the previous clanker_browse page.")}}async function Ne(e,t={}){B(t,["q","limit","cursor","deployer"]);let s=t.limit??10;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>20)throw new r("Choose an indexer limit from 1 to 20.");let u=new URL(ve);u.searchParams.set("chainId",String(h)),u.searchParams.set("limit",String(s)),t.q!==void 0&&u.searchParams.set("q",I(t.q,"search")),t.cursor!==void 0&&u.searchParams.set("cursor",I(t.cursor,"cursor",!0)),t.deployer!==void 0&&u.searchParams.set("msgSender",C(t.deployer));let g=await de(e.http,u.toString(),{headers:{"User-Agent":"Oak-Clanker/1.0"}},Se);return{tokens:g.data.filter(v=>v.chain_id===h&&w(v.factory_address,x.factory.address)),total:g.total,cursor:g.cursor||null,tokensDeployed:g.tokensDeployed}}var Oe=e=>{let t=()=>e.clientFor(h),s=async n=>{try{return await n()}catch(i){throw new r(e.plainError(i))}},u=(n,i,a,c="0")=>e.unsignedTx({to:n,data:i,value:c,chainId:h,description:a}),g=async(n,i)=>K(await t().readContract({address:x.fee_locker.address,abi:T,functionName:"availableFees",args:[n,i]})),v=async n=>{if(w(n,P.address))return P;let[i,a]=await Promise.all([t().readContract({address:n,abi:V,functionName:"symbol"}),t().readContract({address:n,abi:V,functionName:"decimals"})]);if(typeof i!="string"||!i.trim()||!Number.isInteger(a)||a<0||a>255)throw new r("The contract returned invalid token metadata.");return{address:n,chainId:h,symbol:i,decimals:a}},X=async n=>{n.cursor!==void 0&&$e(n.cursor);let i=await Ne(e,n);return{...i,tokens:i.tokens.map(_e)}},Ae=async(n,i)=>{if(B(n,["name","symbol","salt","image","metadata","context","vanity","initialBuy","minAmountOut","slippageBps","rewards","vault","airdrop","feeBps","pool"]),n.vanity!==void 0&&n.vanity!==!1)throw new r("Clanker launches use vanity false and an explicit salt.");let a=I(n.name,"token name",!0),c=I(n.symbol,"token symbol",!0),b=ke(n.salt,"salt"),y=G(n.initialBuy??"0"),l=n.slippageBps??q;if(typeof l!="number")throw new r("Slippage must be an integer from 0 to 9999 bps.");U("0",l);let o=n.minAmountOut===void 0?void 0:G(n.minAmountOut,128);if(o!==void 0&&o<=1n)throw new r("Initial-buy minimum must exceed one base unit.");if(!y&&o!==void 0)throw new r("A minimum requires a positive initial buy.");let m=ue(n,i);L(n.feeBps??100,0,1e3);let p=fe(n);if(y&&!w(p.poolConfig.pairedToken,P.address))throw new r("An initial ETH buy currently requires a WETH-paired pool. Launch without an initial buy and obtain a protected swap quote separately.");let d=n.rewards??[{admin:i,recipient:i,bps:1e4,feePreference:0}];if(!Array.isArray(d)||!d.length||d.length>7)throw new r("Provide one to seven reward allocations.");let k=d.map(f=>{if(!A(f))throw new r("Provide reward allocations as objects.");return B(f,["admin","recipient","bps","feePreference"]),{admin:C(f.admin),recipient:C(f.recipient),bps:L(f.bps,1,1e4),feePreference:L(f.feePreference??0,0,2)}});if(k.reduce((f,S)=>f+S.bps,0)!==1e4)throw new r("Reward allocations must total 10000 bps.");let _={tokenConfig:{tokenAdmin:i,name:a,symbol:c,salt:b,image:I(n.image,"image"),metadata:I(n.metadata,"metadata"),context:n.context===void 0?JSON.stringify({interface:"Oak",platform:"robinhood"}):I(n.context,"context"),originatingChainId:BigInt(h)},poolConfig:p.poolConfig,lockerConfig:{locker:x.locker.address,rewardAdmins:k.map(f=>f.admin),rewardRecipients:k.map(f=>f.recipient),rewardBps:k.map(f=>f.bps),tickLower:p.tickLower,tickUpper:p.tickUpper,positionBps:p.positionBps,lockerData:j(W("(uint8[])"),[[k.map(f=>f.feePreference)]])},mevModuleConfig:{mevModule:x.mev_module.address,mevModuleData:j(W("(uint24,uint24,uint256)"),[[666777,41673,15n]])},extensionConfigs:m},Pe=await t().simulateContract({address:x.factory.address,abi:he,functionName:"deployToken",args:[_],account:i,value:0n,gas:E}),M=C(Pe.result),Y=f=>{let S=[...m,...y?[{extension:x.devbuy.address,msgValue:y,extensionBps:0,extensionData:j(W("(address,address,uint24,int24,address),uint128,address"),[[Z,Z,0,0,Z],f,i])}]:[]];return u(x.factory.address,D({abi:he,functionName:"deployToken",args:[{..._,extensionConfigs:S}]}),`Launch ${a} (${c}); initial buy ${y} native ETH base units.`,y.toString())};if(y&&o===void 0){let S=(await e.preview([Y(0n)],i)).changes.filter($=>$.token.chainId===h&&w($.token.address,M)&&$.token.decimals===18).reduce(($,ne)=>$+(/^-?\d+$/.test(ne.amount)?BigInt(ne.amount):(()=>{throw new r("Invalid initial-buy simulation amount.")})()),0n);if(S<=0n)throw new r("Initial-buy simulation returned no token output.");if(o=G(U(S.toString(),l),128),o<=1n)throw new r("Initial-buy output is too small for a protected minimum.")}let ee=[Y(o??0n)],H=await e.preview(ee,i);return{txs:ee,preview:H,predictedToken:M,token:{address:M,chainId:h,symbol:c,decimals:18},...o!==void 0?{minAmountOut:o.toString()}:{},summary:`Launch ${c} at ${M} (CREATE2 address predicted from simulation); vanity false; salt ${b}. Supply 100000000000000000000000000000 base units (18 decimals). ${p.feeSummary}; protocol adds 20% of LP fees. Pool and LP allocations: ${JSON.stringify(p)}. Reward allocations: ${JSON.stringify(k)}. Extensions: ${JSON.stringify({vault:n.vault,airdrop:n.airdrop})}. Sniper fees 666777 to 41673 over 15 seconds. ${H.summary} ${we(e,H)}`}},Te=async(n,i)=>{if(B(n,["token","poolId","collect"]),n.collect!==void 0&&typeof n.collect!="boolean")throw new r("collect must be boolean.");if(n.collect===!1&&n.poolId!==void 0)throw new r("poolId requires collection.");if(n.collect===!0&&n.token===void 0)throw new r("Collection requires a Clanker token.");if(n.poolId!==void 0&&n.token===void 0)throw new r("A pool ID requires its Clanker token.");let a=[P],c=[];if(n.token!==void 0){let o=C(n.token);if(w(o,P.address))throw new r("Provide the launched Clanker token, not WETH.");if(n.collect!==!1){let m=await ce(e,o),{poolId:p,hook:d,locker:k}=m;if(n.poolId!==void 0&&!w(ke(n.poolId,"pool ID for fee collection"),p))throw new r("The supplied pool ID does not match the onchain Clanker pool.");w(m.pairedToken,P.address)||a.splice(0,1,await v(m.pairedToken));let _=await t().readContract({address:d,abi:T,functionName:"mevModuleEnabled",args:[p]});if(typeof _!="boolean")throw new r("The hook returned an invalid MEV guard state.");_&&c.push(u(d,D({abi:T,functionName:"mevModuleOperational",args:[p]}),"Update the Clanker pool MEV guard before collection.")),c.push(u(k,D({abi:T,functionName:"collectRewards",args:[o]}),"Collect pending LP fees into the fee locker."))}a.push(await v(o))}let b;if(c.length){if(await t().getChainId()!==h)throw new r("Fee simulation endpoint is on the wrong chain.");let o=[...c.map(d=>({from:i,gas:z(E),to:d.to,data:d.data,value:z(BigInt(d.value))})),...a.map(d=>({from:i,gas:z(E),to:x.fee_locker.address,data:D({abi:T,functionName:"availableFees",args:[i,d.address]}),value:"0x0"}))],m=await t().request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:o}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(m)||m.length!==1||!A(m[0])||!Array.isArray(m[0].calls)||m[0].calls.length!==o.length)throw new r("The endpoint returned an unexpected fee simulation response.");let p=m[0].calls;if(!p.every(d=>A(d)&&d.status==="0x1"&&!d.error))throw new r("Clanker fee collection simulation failed.");b=p.slice(c.length).map(d=>{if(!A(d)||typeof d.returnData!="string"||!/^0x[0-9a-fA-F]{64}$/.test(d.returnData))throw new r("The endpoint returned an invalid fee balance.");return K(Ce({abi:T,functionName:"availableFees",data:d.returnData}))})}else b=await Promise.all(a.map(o=>g(i,o.address)));let y=a.flatMap((o,m)=>BigInt(b[m])>0n?[{token:o,amount:b[m]}]:[]);if(!y.length)throw new r("No claimable fees for this wallet; pending LP fees may require the MEV window to end.");for(let{token:o}of y)c.push(u(x.fee_locker.address,D({abi:T,functionName:"claim",args:[i,o.address]}),`Claim ${o.symbol} fees to ${i}.`));let l=await e.preview(c,i);return{txs:c,preview:l,fees:y,summary:`Claim fees to ${i}. WETH fees aggregate across all Clanker launches for this recipient. ${l.summary} ${we(e,l)}`}},R=(n,i,a,c)=>({name:`clanker_${n}`,inputSchema:{type:"object",properties:i,required:a,additionalProperties:!1},execute:(b,y)=>s(async()=>c(b,C(y)))});return{tools:[R("launch",{name:{type:"string",description:"Token name, shown publicly."},symbol:{type:"string",description:"Token ticker symbol, shown publicly."},salt:{...ge,description:"Deployment salt as 0x followed by 64 hex digits; it fixes the predicted token address."},image:{type:"string",description:"Image URL for the token. Public."},metadata:{type:"string",description:"Token metadata as a JSON string (description, social links). Public."},context:{type:"string",description:"Launch context as a JSON string. Defaults to Oak on Robinhood."},vanity:{const:!1,description:"Vanity address mining is not supported; leave false or omit."},initialBuy:{...be,description:"Native ETH base units, 18 decimals."},minAmountOut:{...be,description:"Minimum new token base units, 18 decimals; derived from simulation when omitted."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:q,description:"Slippage in basis points (50 = 0.5%) applied to the initial buy when minAmountOut is omitted."},feeBps:{type:"integer",minimum:0,maximum:1e3,default:100,description:"Static LP fee in basis points (100 = 1%). Not allowed together with pool.dynamicFee."},pool:{...pe,description:"Optional pool setup: paired token, starting tick, tick spacing, liquidity positions and dynamic fee. Defaults to a WETH pool."},rewards:{type:"array",minItems:1,maxItems:7,description:"How LP fees are split, 1 to 7 rows with bps totaling 10000. Default: all to the launching wallet.",items:{type:"object",properties:{admin:{...O,description:"Address that can later change this row."},recipient:{...O,description:"Address that receives this row's share of LP fees."},bps:{type:"integer",minimum:1,maximum:1e4,description:"This row's share of LP fees in basis points (5000 = 50%)."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in: 0 = both tokens (default), 1 = paired token, 2 = launched token."}},required:["admin","recipient","bps"],additionalProperties:!1}},vault:{...J.vault,description:"Optional vault extension: lock part of the supply, then vest it to an admin."},airdrop:{...J.airdrop,description:"Optional airdrop extension: reserve part of the supply for a Merkle-tree airdrop."}},["name","symbol","salt"],async(n,i)=>{let a=await Ae(n,i);return{...a,summary:`${a.summary} After the launch is mined, use clanker_status to inspect ${a.predictedToken} and clanker_claim to collect creator fees.`}}),R("claim",{token:{...O,description:"Launched token; derives its onchain pool and collects pending LP fees before claiming."},poolId:{...ge,description:"Optional assertion against the derived pool ID."},collect:{type:"boolean",default:!0,description:"Set false to claim only already-collected fees."}},[],Te),R("browse",{q:{type:"string",description:"Optional search text matched against token name or symbol."},limit:{type:"integer",minimum:1,maximum:20,description:"Maximum tokens to return, 1 to 20 (default 10)."},cursor:{type:"string",description:"Opaque pagination cursor returned by a previous clanker_browse call."},deployer:{...O,description:"Optional address of the deploying wallet to filter tokens by."}},[],X)],positions:n=>s(async()=>{C(n);let i=new Map,a=new Set,c;do{let l=await X({deployer:n,limit:20,...c?{cursor:c}:{}});for(let o of l.tokens)w(o.msg_sender,n)&&i.set(o.contract_address.toLowerCase(),o);if(l.cursor&&a.has(l.cursor))throw new r("The Clanker indexer repeated a pagination cursor.");l.cursor&&a.add(l.cursor),c=l.cursor??void 0}while(c);let b=[],y=[P];for(let[l,o]of i){let m=await v(o.contract_address),p={...m,symbol:N(m.symbol)},d=K(await t().readContract({address:p.address,abi:V,functionName:"balanceOf",args:[n]}));b.push({module:"clanker",id:`launch:${l}`,chainId:h,assets:[{token:p,amount:d}],description:`Indexed launch ${o.name}; wallet token balance, not locked LP principal.`}),y.some(k=>w(k.address,p.address))||y.push(p)}for(let l of y){let o=await g(n,l.address);BigInt(o)>0n&&b.push({module:"clanker",id:`fees:${l.address.toLowerCase()}`,chainId:h,assets:[{token:l,amount:o}],description:"Collected fees across launches for this recipient. Pending LP fees excluded; token-side discovery covers indexed launches by this wallet."})}return b})}},ze=e=>ae("clanker",[Oe(e),le(e),me(e),ye(e)]);export{Ne as a,Oe as b,ze as c};
@@ -1 +1 @@
1
- import{d as b,h as v,l as I,n as k,r as S}from"./3A2IKFTV.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};
1
+ import{d as b,h as v,l as I,n as k,r as S}from"./BIFANUTV.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};