@oakagentkit/core 0.3.4 → 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 (564) 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/actions.d.ts +13 -1
  21. package/build/dist/api/modules/chop/actions.js +1 -1
  22. package/build/dist/api/modules/chop/checks.js +1 -1
  23. package/build/dist/api/modules/chop/copy.d.ts +1 -0
  24. package/build/dist/api/modules/chop/copy.js +1 -1
  25. package/build/dist/api/modules/chop/display.d.ts +36 -0
  26. package/build/dist/api/modules/chop/display.js +1 -0
  27. package/build/dist/api/modules/chop/guard.js +1 -1
  28. package/build/dist/api/modules/chop/index.js +1 -1
  29. package/build/dist/api/modules/chop/pins.d.ts +1 -0
  30. package/build/dist/api/modules/chop/pins.js +1 -1
  31. package/build/dist/api/modules/chop/positions.js +1 -1
  32. package/build/dist/api/modules/chop/reader.d.ts +6 -1
  33. package/build/dist/api/modules/chop/reader.js +1 -1
  34. package/build/dist/api/modules/chop/types.d.ts +7 -0
  35. package/build/dist/api/modules/chop/unfarm.d.ts +16 -0
  36. package/build/dist/api/modules/chop/unfarm.js +1 -0
  37. package/build/dist/api/modules/clanker/extensions.js +1 -1
  38. package/build/dist/api/modules/clanker/index.js +1 -1
  39. package/build/dist/api/modules/clanker/manage.js +1 -1
  40. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  41. package/build/dist/api/modules/clanker/protocol.js +1 -1
  42. package/build/dist/api/modules/clanker/state.js +1 -1
  43. package/build/dist/api/modules/earn/index.js +1 -1
  44. package/build/dist/api/modules/erc8004/common.js +1 -1
  45. package/build/dist/api/modules/erc8004/domain.js +1 -1
  46. package/build/dist/api/modules/erc8004/index.js +1 -1
  47. package/build/dist/api/modules/erc8004/management.js +1 -1
  48. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  49. package/build/dist/api/modules/erc8004/services.js +1 -1
  50. package/build/dist/api/modules/erc8004/thesis.js +1 -1
  51. package/build/dist/api/modules/erc8004/validation.js +1 -1
  52. package/build/dist/api/modules/factor/actions.js +1 -1
  53. package/build/dist/api/modules/factor/api.js +1 -1
  54. package/build/dist/api/modules/factor/checks.js +1 -1
  55. package/build/dist/api/modules/factor/copy.d.ts +11 -11
  56. package/build/dist/api/modules/factor/copy.js +1 -1
  57. package/build/dist/api/modules/factor/guard.js +1 -1
  58. package/build/dist/api/modules/factor/index.js +1 -1
  59. package/build/dist/api/modules/factor/reader.js +1 -1
  60. package/build/dist/api/modules/fobo/client.js +1 -1
  61. package/build/dist/api/modules/fobo/index.js +1 -1
  62. package/build/dist/api/modules/fobo/intent.js +1 -1
  63. package/build/dist/api/modules/fobo/steps.js +1 -1
  64. package/build/dist/api/modules/fobo/verify.js +1 -1
  65. package/build/dist/api/modules/gloam/index.js +1 -1
  66. package/build/dist/api/modules/grove/index.js +1 -1
  67. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  68. package/build/dist/api/modules/heyresearch/index.js +1 -1
  69. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  70. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  71. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  72. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  73. package/build/dist/api/modules/hoodag/index.js +1 -1
  74. package/build/dist/api/modules/hoodag/management.js +1 -1
  75. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  76. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  77. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  78. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  79. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  80. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  81. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  82. package/build/dist/api/modules/hoodlock/index.js +1 -1
  83. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  84. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  85. package/build/dist/api/modules/hoodlock/public.js +1 -1
  86. package/build/dist/api/modules/hookr/actions.d.ts +39 -2
  87. package/build/dist/api/modules/hookr/actions.js +1 -1
  88. package/build/dist/api/modules/hookr/addons.js +1 -1
  89. package/build/dist/api/modules/hookr/agent-gate.d.ts +14 -2
  90. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  91. package/build/dist/api/modules/hookr/agent-link.d.ts +17 -0
  92. package/build/dist/api/modules/hookr/agent-link.js +1 -0
  93. package/build/dist/api/modules/hookr/api-client.d.ts +9 -0
  94. package/build/dist/api/modules/hookr/api-client.js +1 -0
  95. package/build/dist/api/modules/hookr/blocks/advisory.d.ts +41 -0
  96. package/build/dist/api/modules/hookr/blocks/advisory.js +1 -0
  97. package/build/dist/api/modules/hookr/blocks/buy-sell-block.d.ts +7 -0
  98. package/build/dist/api/modules/hookr/blocks/buy-sell-block.js +1 -0
  99. package/build/dist/api/modules/hookr/blocks/core-settings.d.ts +6 -0
  100. package/build/dist/api/modules/hookr/blocks/core-settings.js +1 -0
  101. package/build/dist/api/modules/hookr/blocks/exit-clock.d.ts +14 -0
  102. package/build/dist/api/modules/hookr/blocks/exit-clock.js +1 -0
  103. package/build/dist/api/modules/hookr/blocks/holder-pot.d.ts +30 -0
  104. package/build/dist/api/modules/hookr/blocks/holder-pot.js +1 -0
  105. package/build/dist/api/modules/hookr/blocks/managed-fee.d.ts +96 -0
  106. package/build/dist/api/modules/hookr/blocks/managed-fee.js +1 -0
  107. package/build/dist/api/modules/hookr/blocks/market-guard.d.ts +116 -0
  108. package/build/dist/api/modules/hookr/blocks/market-guard.js +1 -0
  109. package/build/dist/api/modules/hookr/blocks/market-hours-fee.d.ts +87 -0
  110. package/build/dist/api/modules/hookr/blocks/market-hours-fee.js +1 -0
  111. package/build/dist/api/modules/hookr/blocks/pay-later.d.ts +199 -0
  112. package/build/dist/api/modules/hookr/blocks/pay-later.js +1 -0
  113. package/build/dist/api/modules/hookr/blocks/sandwich-guard.d.ts +3 -0
  114. package/build/dist/api/modules/hookr/blocks/sandwich-guard.js +1 -0
  115. package/build/dist/api/modules/hookr/blocks/storm-fee.d.ts +3 -0
  116. package/build/dist/api/modules/hookr/blocks/storm-fee.js +1 -0
  117. package/build/dist/api/modules/hookr/blocks/swap-cut.d.ts +3 -0
  118. package/build/dist/api/modules/hookr/blocks/swap-cut.js +1 -0
  119. package/build/dist/api/modules/hookr/blocks/swap-reward-mint.d.ts +125 -0
  120. package/build/dist/api/modules/hookr/blocks/swap-reward-mint.js +1 -0
  121. package/build/dist/api/modules/hookr/blocks/wallet-cap.d.ts +3 -0
  122. package/build/dist/api/modules/hookr/blocks/wallet-cap.js +1 -0
  123. package/build/dist/api/modules/hookr/blocks/zap-source.d.ts +161 -0
  124. package/build/dist/api/modules/hookr/blocks/zap-source.js +1 -0
  125. package/build/dist/api/modules/hookr/blocks/zap-target.d.ts +51 -0
  126. package/build/dist/api/modules/hookr/blocks/zap-target.js +1 -0
  127. package/build/dist/api/modules/hookr/claims.d.ts +53 -0
  128. package/build/dist/api/modules/hookr/claims.js +1 -0
  129. package/build/dist/api/modules/hookr/contracts.d.ts +3 -1
  130. package/build/dist/api/modules/hookr/contracts.js +1 -1
  131. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  132. package/build/dist/api/modules/hookr/discovery.d.ts +2 -2
  133. package/build/dist/api/modules/hookr/discovery.js +1 -1
  134. package/build/dist/api/modules/hookr/fill-bounty.d.ts +2 -0
  135. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  136. package/build/dist/api/modules/hookr/gas.d.ts +48 -0
  137. package/build/dist/api/modules/hookr/gas.js +1 -0
  138. package/build/dist/api/modules/hookr/gates.d.ts +51 -0
  139. package/build/dist/api/modules/hookr/gates.js +1 -0
  140. package/build/dist/api/modules/hookr/hook-blocks.d.ts +304 -0
  141. package/build/dist/api/modules/hookr/hook-blocks.js +1 -0
  142. package/build/dist/api/modules/hookr/index.d.ts +4 -2
  143. package/build/dist/api/modules/hookr/index.js +1 -1
  144. package/build/dist/api/modules/hookr/jobs.d.ts +7 -0
  145. package/build/dist/api/modules/hookr/jobs.js +1 -0
  146. package/build/dist/api/modules/hookr/launch-options.d.ts +52 -3
  147. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  148. package/build/dist/api/modules/hookr/launch-profile.d.ts +8 -0
  149. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  150. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  151. package/build/dist/api/modules/hookr/launch.d.ts +24 -0
  152. package/build/dist/api/modules/hookr/launch.js +1 -1
  153. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  154. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  155. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  156. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  157. package/build/dist/api/modules/hookr/lp-state.d.ts +90 -2
  158. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  159. package/build/dist/api/modules/hookr/pay-later-actions.d.ts +52 -0
  160. package/build/dist/api/modules/hookr/pay-later-actions.js +1 -0
  161. package/build/dist/api/modules/hookr/pins.d.ts +5 -0
  162. package/build/dist/api/modules/hookr/pins.js +1 -1
  163. package/build/dist/api/modules/hookr/pm-liquidity.d.ts +215 -0
  164. package/build/dist/api/modules/hookr/pm-liquidity.js +1 -0
  165. package/build/dist/api/modules/hookr/public-reads.d.ts +1 -1
  166. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  167. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  168. package/build/dist/api/modules/hookr/relay.js +1 -1
  169. package/build/dist/api/modules/hookr/revenue.d.ts +4 -1
  170. package/build/dist/api/modules/hookr/revenue.js +1 -1
  171. package/build/dist/api/modules/hookr/scan.d.ts +25 -0
  172. package/build/dist/api/modules/hookr/scan.js +1 -0
  173. package/build/dist/api/modules/hookr/swap.d.ts +161 -0
  174. package/build/dist/api/modules/hookr/swap.js +1 -0
  175. package/build/dist/api/modules/kyberswap/index.js +1 -1
  176. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  177. package/build/dist/api/modules/layerbank/abi.js +1 -1
  178. package/build/dist/api/modules/layerbank/actions.js +1 -1
  179. package/build/dist/api/modules/layerbank/checks.js +1 -1
  180. package/build/dist/api/modules/layerbank/index.js +1 -1
  181. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  182. package/build/dist/api/modules/layerbank/reader.js +1 -1
  183. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  184. package/build/dist/api/modules/lighter/index.js +1 -1
  185. package/build/dist/api/modules/longbow/administration.js +1 -1
  186. package/build/dist/api/modules/longbow/analytics.js +1 -1
  187. package/build/dist/api/modules/longbow/fixed.js +1 -1
  188. package/build/dist/api/modules/longbow/index.js +1 -1
  189. package/build/dist/api/modules/longbow/nft.js +1 -1
  190. package/build/dist/api/modules/longbow/rebates.js +1 -1
  191. package/build/dist/api/modules/longbow/staking.js +1 -1
  192. package/build/dist/api/modules/meridian/index.js +1 -1
  193. package/build/dist/api/modules/meridian/markets.js +1 -1
  194. package/build/dist/api/modules/meridian/rfq.js +1 -1
  195. package/build/dist/api/modules/merkl/discovery.js +1 -1
  196. package/build/dist/api/modules/merkl/index.js +1 -1
  197. package/build/dist/api/modules/merkl/manage.js +1 -1
  198. package/build/dist/api/modules/merkl/protocol.js +1 -1
  199. package/build/dist/api/modules/morpho/allocator.js +1 -1
  200. package/build/dist/api/modules/morpho/bundles.js +1 -1
  201. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  202. package/build/dist/api/modules/morpho/index.js +1 -1
  203. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  204. package/build/dist/api/modules/morpho/midnight.js +1 -1
  205. package/build/dist/api/modules/morpho/protocol.js +1 -1
  206. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  207. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  208. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  209. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  210. package/build/dist/api/modules/netnet/card-read.js +1 -1
  211. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  212. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  213. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  214. package/build/dist/api/modules/netnet/financial.js +1 -1
  215. package/build/dist/api/modules/netnet/index.js +1 -1
  216. package/build/dist/api/modules/netnet/staking.js +1 -1
  217. package/build/dist/api/modules/orbio/index.js +1 -1
  218. package/build/dist/api/modules/orbio/positions.js +1 -1
  219. package/build/dist/api/modules/pendle/costs.js +1 -1
  220. package/build/dist/api/modules/pendle/index.js +1 -1
  221. package/build/dist/api/modules/pendle/markets.js +1 -1
  222. package/build/dist/api/modules/pendle/positions.js +1 -1
  223. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  224. package/build/dist/api/modules/pendle/reader.js +1 -1
  225. package/build/dist/api/modules/pendle/redeem.js +1 -1
  226. package/build/dist/api/modules/pendle/trade.js +1 -1
  227. package/build/dist/api/modules/pendle/validate.js +1 -1
  228. package/build/dist/api/modules/pendle/verify.js +1 -1
  229. package/build/dist/api/modules/pons/claim.js +1 -1
  230. package/build/dist/api/modules/pons/index.js +1 -1
  231. package/build/dist/api/modules/pons/launch-status.js +1 -1
  232. package/build/dist/api/modules/pons/prices.js +1 -1
  233. package/build/dist/api/modules/pons/reads.js +1 -1
  234. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  235. package/build/dist/api/modules/pons/trade.js +1 -1
  236. package/build/dist/api/modules/poolstrade/index.js +1 -1
  237. package/build/dist/api/modules/priors/coverage.js +1 -1
  238. package/build/dist/api/modules/priors/discovery.js +1 -1
  239. package/build/dist/api/modules/priors/features.js +1 -1
  240. package/build/dist/api/modules/priors/holdings.js +1 -1
  241. package/build/dist/api/modules/priors/index.js +1 -1
  242. package/build/dist/api/modules/priors/integration.js +1 -1
  243. package/build/dist/api/modules/priors/market.js +1 -1
  244. package/build/dist/api/modules/priors/pt.js +1 -1
  245. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  246. package/build/dist/api/modules/priors/starter-line.js +1 -1
  247. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  248. package/build/dist/api/modules/raeto/index.js +1 -1
  249. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  250. package/build/dist/api/modules/relay/discovery.js +1 -1
  251. package/build/dist/api/modules/relay/inbound.js +1 -1
  252. package/build/dist/api/modules/relay/index.js +1 -1
  253. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  254. package/build/dist/api/modules/relay/reads.js +1 -1
  255. package/build/dist/api/modules/spark/actions.js +1 -1
  256. package/build/dist/api/modules/spark/details.js +1 -1
  257. package/build/dist/api/modules/spark/index.js +1 -1
  258. package/build/dist/api/modules/spark/management.js +1 -1
  259. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  260. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  261. package/build/dist/api/modules/steakhouse/index.js +1 -1
  262. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  263. package/build/dist/api/modules/steakhouse/management.js +1 -1
  264. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  265. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  266. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  267. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  268. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  269. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  270. package/build/dist/api/modules/tickerspring/index.js +1 -1
  271. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  272. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  273. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  274. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  275. package/build/dist/api/modules/tickerspring/research.js +1 -1
  276. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  277. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  278. package/build/dist/api/modules/uniswap/auction.js +1 -1
  279. package/build/dist/api/modules/uniswap/batch.js +1 -1
  280. package/build/dist/api/modules/uniswap/common.js +1 -1
  281. package/build/dist/api/modules/uniswap/fees.js +1 -1
  282. package/build/dist/api/modules/uniswap/index.js +1 -1
  283. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  284. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  285. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  286. package/build/dist/api/modules/uniswap/pools.js +1 -1
  287. package/build/dist/api/modules/uniswap/position.js +1 -1
  288. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  289. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  290. package/build/dist/api/modules/uniswap/stock-prices.d.ts +25 -0
  291. package/build/dist/api/modules/uniswap/stock-prices.js +1 -1
  292. package/build/dist/api/modules/uniswap/stocks.js +1 -1
  293. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  294. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  295. package/build/dist/api/modules/uniswap/trade.js +1 -1
  296. package/build/dist/api/modules/uniswap/v2.js +1 -1
  297. package/build/dist/api/modules/uniswap/v3.js +1 -1
  298. package/build/dist/api/modules/uniswap/v4.js +1 -1
  299. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  300. package/build/dist/api/modules/velora/claims.js +1 -1
  301. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  302. package/build/dist/api/modules/velora/index.js +1 -1
  303. package/build/dist/api/modules/wormhole/index.js +1 -1
  304. package/build/dist/api/modules/wormhole/scan-text.d.ts +1 -1
  305. package/build/dist/api/positions.js +1 -1
  306. package/build/dist/api/pricenote.js +1 -1
  307. package/build/dist/api/prices.d.ts +5 -0
  308. package/build/dist/api/prices.js +1 -1
  309. package/build/dist/api/rpc.js +1 -1
  310. package/build/dist/api/send.js +1 -1
  311. package/build/dist/api/signing-registry.js +1 -1
  312. package/build/dist/api/signing.js +1 -1
  313. package/build/dist/api/simulate.js +1 -1
  314. package/build/dist/api/swap.d.ts +2 -0
  315. package/build/dist/api/swap.js +1 -1
  316. package/build/dist/api/tokens.d.ts +10 -1
  317. package/build/dist/api/tokens.js +1 -1
  318. package/build/dist/api/tool-policy.js +1 -1
  319. package/build/dist/api/universal-router.js +1 -1
  320. package/build/dist/api/usd-estimate.d.ts +2 -0
  321. package/build/dist/api/usd-estimate.js +1 -1
  322. package/build/dist/chunks/{DMDOSHV7.js → 266VIESP.js} +1 -1
  323. package/build/dist/chunks/{KNBNKG7P.js → 2BKZLF5A.js} +1 -1
  324. package/build/dist/chunks/{HFVXNKA5.js → 2BM2WX2G.js} +1 -1
  325. package/build/dist/chunks/{OY5W7ZSL.js → 2H2OZE6X.js} +1 -1
  326. package/build/dist/chunks/{E76Z2TT4.js → 2QQ5CGQI.js} +1 -1
  327. package/build/dist/chunks/{4PLLS6CT.js → 2VYA6WIN.js} +1 -1
  328. package/build/dist/chunks/{LCH6F5HT.js → 342OZP53.js} +1 -1
  329. package/build/dist/chunks/{FQTO7VJG.js → 3HF6WE4L.js} +1 -1
  330. package/build/dist/chunks/3M7RMROZ.js +1 -0
  331. package/build/dist/chunks/3RGED2KO.js +1 -0
  332. package/build/dist/chunks/{RUSXMQSJ.js → 3XIJCHT7.js} +1 -1
  333. package/build/dist/chunks/3XY44BP5.js +1 -0
  334. package/build/dist/chunks/3YNXQ3EZ.js +1 -0
  335. package/build/dist/chunks/45QP74CE.js +1 -0
  336. package/build/dist/chunks/{NYHKIXJR.js → 4GAU3JLN.js} +1 -1
  337. package/build/dist/chunks/{Y2QADJOB.js → 4P6DRKY3.js} +1 -1
  338. package/build/dist/chunks/{W3DGFMQE.js → 4RTXP2YP.js} +1 -1
  339. package/build/dist/chunks/{7FYM7FJA.js → 4SXRXNHG.js} +1 -1
  340. package/build/dist/chunks/{ZTKT3ZQK.js → 53VBLEYS.js} +1 -1
  341. package/build/dist/chunks/5677LZOV.js +1 -0
  342. package/build/dist/chunks/{ADIPEGNN.js → 5AO2QPWE.js} +1 -1
  343. package/build/dist/chunks/{GQITAJVF.js → 5BPFF7NX.js} +1 -1
  344. package/build/dist/chunks/{PXUML7HJ.js → 5DWQUEBA.js} +1 -1
  345. package/build/dist/chunks/{WAKZWSHB.js → 5KKAN7XQ.js} +1 -1
  346. package/build/dist/chunks/{VVAM3EAK.js → 5N6YJFFA.js} +1 -1
  347. package/build/dist/chunks/{QIB6OMQV.js → 5O67QQIY.js} +1 -1
  348. package/build/dist/chunks/5PNFV7HH.js +1 -0
  349. package/build/dist/chunks/5RAZFRO4.js +1 -0
  350. package/build/dist/chunks/{FAH7FKUT.js → 5UWVXEPD.js} +1 -1
  351. package/build/dist/chunks/5VKVAUFQ.js +1 -0
  352. package/build/dist/chunks/5Y457HYC.js +1 -0
  353. package/build/dist/chunks/64LAWFBE.js +1 -0
  354. package/build/dist/chunks/{JJGZ7W3V.js → 6AS3TGOX.js} +1 -1
  355. package/build/dist/chunks/6EWSLHXL.js +1 -0
  356. package/build/dist/chunks/{6F527FLN.js → 6HNQAYBM.js} +1 -1
  357. package/build/dist/chunks/{FUP53K6G.js → 6LDC5D2S.js} +1 -1
  358. package/build/dist/chunks/{YR44GQG4.js → 6QXTL65K.js} +1 -1
  359. package/build/dist/chunks/6RVAV6BB.js +1 -0
  360. package/build/dist/chunks/{WSILNJS2.js → 6STUQOFL.js} +1 -1
  361. package/build/dist/chunks/{OKXKDDBX.js → 6Y2546JA.js} +1 -1
  362. package/build/dist/chunks/{4Z3IGMU6.js → 7AYP4ATZ.js} +1 -1
  363. package/build/dist/chunks/{YGW4ODAP.js → 7EPU3XGY.js} +1 -1
  364. package/build/dist/chunks/7GL547YZ.js +1 -0
  365. package/build/dist/chunks/7JTXYMNP.js +1 -0
  366. package/build/dist/chunks/{A3BJSQ23.js → 7VU5VCTL.js} +1 -1
  367. package/build/dist/chunks/{Z7FGEWO2.js → 7WXAS54T.js} +1 -1
  368. package/build/dist/chunks/{3D7FXI6G.js → 7X5JVF3F.js} +1 -1
  369. package/build/dist/chunks/{DRLBTB4E.js → A72ADVYF.js} +1 -1
  370. package/build/dist/chunks/{ANIF3JMV.js → AG66NM3J.js} +1 -1
  371. package/build/dist/chunks/{AOX6DKYU.js → AL6UXNGH.js} +1 -1
  372. package/build/dist/chunks/AODUTN65.js +1 -0
  373. package/build/dist/chunks/{PQG3ULRT.js → AONO47JX.js} +1 -1
  374. package/build/dist/chunks/{JTPHZCO3.js → AQJLEG6B.js} +1 -1
  375. package/build/dist/chunks/AZBTNUXF.js +1 -0
  376. package/build/dist/chunks/{O56EZB5Y.js → B5BU645H.js} +1 -1
  377. package/build/dist/chunks/{LQSPWRHN.js → B75SS7H6.js} +1 -1
  378. package/build/dist/chunks/{GBIBRYOV.js → B7HVPHSS.js} +1 -1
  379. package/build/dist/chunks/{LT5P6PZW.js → B7WZJHIJ.js} +1 -1
  380. package/build/dist/chunks/{3A2IKFTV.js → BIFANUTV.js} +1 -1
  381. package/build/dist/chunks/BM4KHOFB.js +1 -0
  382. package/build/dist/chunks/{X3YEDVRN.js → BSV65PCA.js} +1 -1
  383. package/build/dist/chunks/{HDBDBKEA.js → BW755PNH.js} +1 -1
  384. package/build/dist/chunks/{VXCGMALF.js → BWE5PXRE.js} +1 -1
  385. package/build/dist/chunks/{7U62MMUQ.js → BY2OWKZB.js} +1 -1
  386. package/build/dist/chunks/{SRHVSNPX.js → C2H3BWN5.js} +1 -1
  387. package/build/dist/chunks/{F7MGYRPU.js → CCPG6PRL.js} +1 -1
  388. package/build/dist/chunks/{ZTX4WT62.js → CFPJDLTZ.js} +1 -1
  389. package/build/dist/chunks/{OI3N4EW4.js → CG7ABZXH.js} +1 -1
  390. package/build/dist/chunks/CJMVRV34.js +1 -0
  391. package/build/dist/chunks/CQPIR6ER.js +1 -0
  392. package/build/dist/chunks/{FP7DHVK2.js → CR7DPGI6.js} +1 -1
  393. package/build/dist/chunks/{W5FM2OVB.js → CVVNAFUE.js} +1 -1
  394. package/build/dist/chunks/{LEHBRAZX.js → CW37EGPL.js} +1 -1
  395. package/build/dist/chunks/{MI5HZDMH.js → D6JOXK7Q.js} +1 -1
  396. package/build/dist/chunks/{SGHSCK22.js → DJRS3TR5.js} +1 -1
  397. package/build/dist/chunks/{IZFED3R2.js → DLNDJZR4.js} +1 -1
  398. package/build/dist/chunks/{SYERFEJ4.js → DPSFR3ZS.js} +1 -1
  399. package/build/dist/chunks/{2T6O77QZ.js → DV2HVFTM.js} +1 -1
  400. package/build/dist/chunks/{NMJVQX5M.js → DWRRIFXS.js} +1 -1
  401. package/build/dist/chunks/{3ZH5SOC2.js → EFOC337C.js} +1 -1
  402. package/build/dist/chunks/EHQRAA3R.js +1 -0
  403. package/build/dist/chunks/{WX7OYCNS.js → EJIP7RBG.js} +1 -1
  404. package/build/dist/chunks/EPOIAXCV.js +3 -0
  405. package/build/dist/chunks/EWZFZUVF.js +1 -0
  406. package/build/dist/chunks/{OB7BFDOV.js → EYE3ZAJB.js} +1 -1
  407. package/build/dist/chunks/{MQ5F2VOK.js → EZUQMTLE.js} +1 -1
  408. package/build/dist/chunks/F36IA5RI.js +1 -0
  409. package/build/dist/chunks/{DD47RZFU.js → F74ARK4H.js} +1 -1
  410. package/build/dist/chunks/{Q4HSQL65.js → FGGDAAHW.js} +1 -1
  411. package/build/dist/chunks/FMEO7RX7.js +1 -0
  412. package/build/dist/chunks/{V6EVQWAL.js → FN6XY6ET.js} +1 -1
  413. package/build/dist/chunks/G4IX4CYN.js +1 -0
  414. package/build/dist/chunks/G53U6Y4L.js +1 -0
  415. package/build/dist/chunks/{XHFAF5PZ.js → GBIL2I2K.js} +1 -1
  416. package/build/dist/chunks/{RKM62HC5.js → GCFHKJIO.js} +1 -1
  417. package/build/dist/chunks/{K7HTDKAT.js → GMMTHTCP.js} +1 -1
  418. package/build/dist/chunks/{O5QTITN6.js → GRHBE4MQ.js} +1 -1
  419. package/build/dist/chunks/GTJ6LBGB.js +1 -0
  420. package/build/dist/chunks/GV6Z3MET.js +1 -0
  421. package/build/dist/chunks/{GK3D7OKG.js → GVCNTGLC.js} +1 -1
  422. package/build/dist/chunks/GX2RCAHG.js +1 -0
  423. package/build/dist/chunks/{O3XWE4FO.js → H5KU4DUU.js} +1 -1
  424. package/build/dist/chunks/H7ZJ7LAB.js +1 -0
  425. package/build/dist/chunks/{DCGNVMKG.js → HC3QFA5I.js} +1 -1
  426. package/build/dist/chunks/{RK3PPFRX.js → HEQBTHFS.js} +1 -1
  427. package/build/dist/chunks/{C76D54YG.js → HGSFRN57.js} +1 -1
  428. package/build/dist/chunks/HJI7KO6F.js +1 -0
  429. package/build/dist/chunks/{L6CVMDWQ.js → HNBYPHTA.js} +1 -1
  430. package/build/dist/chunks/{MSRCJ2BS.js → HPBTSJW7.js} +1 -1
  431. package/build/dist/chunks/HPO673QQ.js +1 -0
  432. package/build/dist/chunks/{ZFRTBBIW.js → HRGLFGFL.js} +1 -1
  433. package/build/dist/chunks/{DGDMRATN.js → ICHT3H3W.js} +1 -1
  434. package/build/dist/chunks/IJVBCEA2.js +1 -0
  435. package/build/dist/chunks/{2TX7HP6M.js → IKVRFAUP.js} +1 -1
  436. package/build/dist/chunks/IM7ZF7XZ.js +1 -0
  437. package/build/dist/chunks/{I4473OC6.js → IMD33NQS.js} +1 -1
  438. package/build/dist/chunks/IR7KDBFU.js +1 -0
  439. package/build/dist/chunks/{X24YTJST.js → IY7FWTAL.js} +1 -1
  440. package/build/dist/chunks/IYOWMW5B.js +1 -0
  441. package/build/dist/chunks/J2J73XYU.js +1 -0
  442. package/build/dist/chunks/JCS24YBB.js +1 -0
  443. package/build/dist/chunks/JQVTHPUO.js +1 -0
  444. package/build/dist/chunks/{USZCTSPI.js → JTWJT2O3.js} +1 -1
  445. package/build/dist/chunks/{2YYKQGJZ.js → K4CYAWNL.js} +1 -1
  446. package/build/dist/chunks/{7VH6JQ2H.js → K5C6QBOO.js} +1 -1
  447. package/build/dist/chunks/K5OXLIPK.js +1 -0
  448. package/build/dist/chunks/{4PB6MSGZ.js → K6GECT3F.js} +1 -1
  449. package/build/dist/chunks/{HU2JXDLH.js → KB2JWQZ4.js} +1 -1
  450. package/build/dist/chunks/{EFESPGA2.js → KCZUJ57H.js} +1 -1
  451. package/build/dist/chunks/{YW4W3LPQ.js → KHLM6NIZ.js} +1 -1
  452. package/build/dist/chunks/{OIQTZOBN.js → KKGHXNM4.js} +1 -1
  453. package/build/dist/chunks/{SUNTJ6IU.js → KYANIEPX.js} +1 -1
  454. package/build/dist/chunks/{MOZBDCVV.js → L3IAEXQR.js} +1 -1
  455. package/build/dist/chunks/{ZZ6FZGHF.js → L4UFGM7M.js} +1 -1
  456. package/build/dist/chunks/{DMB64UIN.js → L76P6WIH.js} +1 -1
  457. package/build/dist/chunks/{QMNUB2GM.js → LBT6WR4U.js} +1 -1
  458. package/build/dist/chunks/LD3A2KLN.js +1 -0
  459. package/build/dist/chunks/{WRUTW6CG.js → LFSNAQ7V.js} +1 -1
  460. package/build/dist/chunks/{5ZVIAGLX.js → LKRAUTYI.js} +1 -1
  461. package/build/dist/chunks/{23HNDJ76.js → M2SWILNG.js} +1 -1
  462. package/build/dist/chunks/{IT2JLILU.js → MFKDNAHB.js} +1 -1
  463. package/build/dist/chunks/MFQTBUSD.js +1 -0
  464. package/build/dist/chunks/{V4UJMUIB.js → MLN5KTG7.js} +1 -1
  465. package/build/dist/chunks/{S4JUFCT4.js → MSQNOK3I.js} +1 -1
  466. package/build/dist/chunks/{FA3GBXQP.js → MXI7LX2F.js} +1 -1
  467. package/build/dist/chunks/N6YNJGEF.js +1 -0
  468. package/build/dist/chunks/{DXAPKN7H.js → NLC36QHL.js} +1 -1
  469. package/build/dist/chunks/NUTTPUYJ.js +1 -0
  470. package/build/dist/chunks/{O4S6XAYV.js → O7L55XM3.js} +1 -1
  471. package/build/dist/chunks/{NAO7VWZF.js → OCIEVYPR.js} +1 -1
  472. package/build/dist/chunks/{4NBXBKOX.js → OD7CY6BY.js} +1 -1
  473. package/build/dist/chunks/{RUTSEGGD.js → OHZHQSCA.js} +1 -1
  474. package/build/dist/chunks/{T3QEN3S6.js → OIGTTRN5.js} +1 -1
  475. package/build/dist/chunks/{5OTQCE2E.js → P6JE2NRA.js} +1 -1
  476. package/build/dist/chunks/PD5NXIRT.js +1 -0
  477. package/build/dist/chunks/{TXGZ6NWN.js → PG7HZIZL.js} +1 -1
  478. package/build/dist/chunks/{WXZ4LAKO.js → PXVF2SHU.js} +1 -1
  479. package/build/dist/chunks/{UBVE2U6X.js → Q43WPRYU.js} +1 -1
  480. package/build/dist/chunks/QA6Z2CYP.js +2 -0
  481. package/build/dist/chunks/QAAKUIWE.js +1 -0
  482. package/build/dist/chunks/{PQOWIRKQ.js → QAVP3CWL.js} +1 -1
  483. package/build/dist/chunks/{YXXK6EPI.js → QBHY2QRC.js} +1 -1
  484. package/build/dist/chunks/{ELHRXA5U.js → QFK335LC.js} +1 -1
  485. package/build/dist/chunks/{3PHJUFU2.js → QFUSCK5C.js} +1 -1
  486. package/build/dist/chunks/{IPU656WB.js → QKH7ED6B.js} +1 -1
  487. package/build/dist/chunks/{AHUCYDBC.js → QKIQ7ZKD.js} +1 -1
  488. package/build/dist/chunks/{XW3VGWXK.js → QMWHQRYC.js} +1 -1
  489. package/build/dist/chunks/{N6PHSHBE.js → QP2B7AYX.js} +1 -1
  490. package/build/dist/chunks/{VHK5AYC2.js → QZ6V6J6W.js} +1 -1
  491. package/build/dist/chunks/{MDLJFCT4.js → R5Z4HPCA.js} +1 -1
  492. package/build/dist/chunks/RKJFSDGV.js +1 -0
  493. package/build/dist/chunks/RKS3M7L5.js +1 -0
  494. package/build/dist/chunks/{GDOHHXNH.js → RLX6YTNT.js} +1 -1
  495. package/build/dist/chunks/RYEQIZ2H.js +1 -0
  496. package/build/dist/chunks/{USEF3QKG.js → S432S6NA.js} +1 -1
  497. package/build/dist/chunks/S47M3IPR.js +1 -0
  498. package/build/dist/chunks/S65KXMZ7.js +3 -0
  499. package/build/dist/chunks/{2OVJ2BTJ.js → SEXKWYUM.js} +1 -1
  500. package/build/dist/chunks/{2ILYVUFA.js → SRYX65GZ.js} +1 -1
  501. package/build/dist/chunks/{GNOHIL4Q.js → TMENUIBC.js} +1 -1
  502. package/build/dist/chunks/{BSX4LFYI.js → TNHU5UBQ.js} +1 -1
  503. package/build/dist/chunks/{PDPTJMTJ.js → TT2ST3Q3.js} +1 -1
  504. package/build/dist/chunks/TTBB6EFN.js +1 -0
  505. package/build/dist/chunks/{Z5YI6KLN.js → TWVDWNTG.js} +1 -1
  506. package/build/dist/chunks/TZG7HTVM.js +1 -0
  507. package/build/dist/chunks/{OVM4QIET.js → U4MSIH4G.js} +1 -1
  508. package/build/dist/chunks/UEOS6SHR.js +1 -0
  509. package/build/dist/chunks/{EIE2U4OX.js → UGFRBJDQ.js} +1 -1
  510. package/build/dist/chunks/{HUKDISRE.js → UIVOYAO2.js} +1 -1
  511. package/build/dist/chunks/{XRDLMTBJ.js → UMY6SP7C.js} +1 -1
  512. package/build/dist/chunks/UNBRUWSV.js +1 -0
  513. package/build/dist/chunks/{LGLWEGPY.js → UPX3OWKA.js} +1 -1
  514. package/build/dist/chunks/{MHONMLF6.js → URTQNYWU.js} +1 -1
  515. package/build/dist/chunks/{4RCYYN6O.js → V7HTGO23.js} +1 -1
  516. package/build/dist/chunks/{HZSYMGJ2.js → VS7ZA4OF.js} +1 -1
  517. package/build/dist/chunks/{BJ2U2VXJ.js → VTWAVH74.js} +1 -1
  518. package/build/dist/chunks/{5GQJVKVY.js → W5GWK72I.js} +1 -1
  519. package/build/dist/chunks/{65OITTDL.js → W73SLWBT.js} +1 -1
  520. package/build/dist/chunks/WRA3ZC6W.js +1 -0
  521. package/build/dist/chunks/{PRBIC3UK.js → WUONMIA2.js} +1 -1
  522. package/build/dist/chunks/{XL3W7DAQ.js → X3BB6WME.js} +1 -1
  523. package/build/dist/chunks/{K3TZYPSV.js → X53QVHBC.js} +1 -1
  524. package/build/dist/chunks/{LVFI74ST.js → XNJ6NDQQ.js} +1 -1
  525. package/build/dist/chunks/{GBPB7JIB.js → XSQJOOEY.js} +1 -1
  526. package/build/dist/chunks/XUDQYSPU.js +1 -0
  527. package/build/dist/chunks/{VKNKVUAA.js → XWZ5SL5Q.js} +1 -1
  528. package/build/dist/chunks/{365B4YEV.js → XXLQDQEX.js} +1 -1
  529. package/build/dist/chunks/{BDLV42SD.js → Y5T36EEU.js} +1 -1
  530. package/build/dist/chunks/{R73R4KN3.js → YBLJ2MCR.js} +1 -1
  531. package/build/dist/chunks/{WNWRF4HE.js → YZHJ4BAP.js} +1 -1
  532. package/build/dist/chunks/ZSGW2ZSO.js +1 -0
  533. package/build/dist/chunks/{HRAHGYNK.js → ZTNBX4VH.js} +1 -1
  534. package/package.json +1 -1
  535. package/build/dist/chunks/2QP6WGKZ.js +0 -1
  536. package/build/dist/chunks/3AOTYJPX.js +0 -1
  537. package/build/dist/chunks/4E7FJQLL.js +0 -1
  538. package/build/dist/chunks/4J245N3F.js +0 -1
  539. package/build/dist/chunks/4M6XBG6X.js +0 -1
  540. package/build/dist/chunks/BA66J5YQ.js +0 -1
  541. package/build/dist/chunks/BIY2F6MO.js +0 -1
  542. package/build/dist/chunks/CZ66MYKR.js +0 -1
  543. package/build/dist/chunks/DFM4T6ZE.js +0 -1
  544. package/build/dist/chunks/DGCJZ3HO.js +0 -1
  545. package/build/dist/chunks/DHX3Q5RV.js +0 -2
  546. package/build/dist/chunks/DWQJ7NSX.js +0 -1
  547. package/build/dist/chunks/EFUACKDK.js +0 -1
  548. package/build/dist/chunks/EQEMI54U.js +0 -1
  549. package/build/dist/chunks/GYPMUYB5.js +0 -1
  550. package/build/dist/chunks/JFC2QCMW.js +0 -1
  551. package/build/dist/chunks/JW7GLNLB.js +0 -3
  552. package/build/dist/chunks/MEB727X5.js +0 -1
  553. package/build/dist/chunks/MIKQWF6Q.js +0 -3
  554. package/build/dist/chunks/MQK6OP7S.js +0 -1
  555. package/build/dist/chunks/OSMOBKRQ.js +0 -1
  556. package/build/dist/chunks/P6MPKIU2.js +0 -1
  557. package/build/dist/chunks/P7C3TYI4.js +0 -1
  558. package/build/dist/chunks/RN3WUJIO.js +0 -1
  559. package/build/dist/chunks/TI727O2H.js +0 -1
  560. package/build/dist/chunks/UHIJMDD2.js +0 -1
  561. package/build/dist/chunks/VQJXQLFW.js +0 -1
  562. package/build/dist/chunks/W32UECOL.js +0 -1
  563. package/build/dist/chunks/WWNAGOCD.js +0 -1
  564. package/build/dist/chunks/ZNX3YVF2.js +0 -1
@@ -1,3 +1,3 @@
1
- import{b as W}from"./GBPB7JIB.js";import{a as b,b as P}from"./G2AA73ZE.js";import{fa as F,ga as G,ja as A}from"./HHYE42JG.js";import{a as M,b as U}from"./IBL6TL2Q.js";import{g as $,i as T,m as I,n as O}from"./NWNYJ26T.js";import{d as V}from"./IX3GZMTM.js";import{b as v}from"./TI727O2H.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as R}from"viem";var j={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; use vault if discovery is unavailable or ambiguous."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address verified on chain on every call; required for a rebuild without HTTP."}};function E(r){return{type:"object",additionalProperties:!1,properties:{...j,amount:{type:"string",pattern:r==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}},required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}}function H(r){return O(r,"Borro amount must be positive and fit uint256.",{positive:!0,notString:"Borro amount must be an integer string in asset base units."})}function B(r){return I(r,"Borro returned an invalid uint256 read.")}var L=r=>r*9950n/10000n,Z=new WeakMap;function oe(r,o){Z.set(r,{...o})}async function K(r,o,h,i=W){let k=await i(r,o).catch(()=>({kind:"unknown"})),f=k.kind!=="unknown"&&"readyBase"in k?k.readyBase:void 0,l=typeof f=="bigint"&&f>=0n&&f<1n<<256n?f:void 0,g=y=>V(y.toString(),o.assetDecimals);return{ready:l,...l!==void 0&&l<h?{refusal:A("too-little-ready",{ready:g(l),requested:g(h),maxNow:g(l),symbol:o.symbol})}:{}}}function z(r,o,h,i,k){let f=0n,l=0n;for(let g of r.changes){let y=g.token;if(typeof g.amount!="string"||!/^-?\d+$/.test(g.amount))throw new n("Borro preview returned invalid token changes. Nothing was signed.");let e=BigInt(g.amount);B(e<0n?-e:e);let d=$(y.address,o.address)?o:$(y.address,i.address)?i:void 0;if(!d||y.chainId!==v||y.decimals!==d.decimals)throw new n("Borro preview showed an unexpected token movement. Nothing was signed.");if(d===o){if(e>0n)throw new n("Borro preview showed a reversed input movement. Nothing was signed.");f-=e}else{if(e<0n)throw new n("Borro preview showed a reversed output movement. Nothing was signed.");l+=e}}if(B(f),B(l),f!==h||l<k||l===0n)throw new n("Borro preview did not match the requested receipt. Nothing was signed.")}var re=r=>{let{client:o,context:h,wallet:i}=r;async function k(e,d,s){if(T(s,"Provide a valid wallet address."),!$(s,i))throw new n("Borro action wallet differs from the signing wallet. Nothing was signed.");if(h.network==="testnet"||await o.getChainId()!==v)throw new n("Borro requires chain 4663. Nothing was signed.");if(Object.keys(e).some(m=>!["asset","vault","amount"].includes(m)))throw new n("Unsupported Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)||/^0x/i.test(e.asset)))throw new n("Provide an asset symbol, or put the vault address in vault.");let w=e.vault===void 0?void 0:T(e.vault,"Provide a valid Borro vault address.");if(!w&&e.asset===void 0)throw new n("Provide an asset symbol or a vault address.");let t=w?await r.verifyVault(o,w,d,{wallet:i}):await r.resolveVault(o,{asset:e.asset},d,i);if(w&&!$(w,t.vault)||e.asset!==void 0&&e.asset.toUpperCase()!==t.symbol.toUpperCase())throw new n("Borro vault and asset selectors do not match. Nothing was signed.");if(T(t.vault,"Borro returned an invalid vault address."),T(t.asset,"Borro returned an invalid asset address."),t.chainId!==v||t.shareDecimals!==18||$(t.asset,t.vault)||!Number.isInteger(t.assetDecimals)||t.assetDecimals<0||t.assetDecimals>255||t.mode!==d)throw new n(A("setup-mismatch",{}));let a=await r.verifySetup(o,t,d);if(!a.ok||d==="deposit"&&(!t.assetAllowed||a.drift.length>0))throw new n(A("setup-mismatch",{}));return{...t,setup:a}}function f(e){let d=e.mode==="withdraw"&&!/^[A-Za-z0-9.$_-]{1,16}$/.test(e.symbol)?"token":e.symbol;return{asset:{address:T(e.asset,"Borro returned an invalid asset."),symbol:d,decimals:e.assetDecimals,chainId:v},share:{address:T(e.vault,"Borro returned an invalid vault."),symbol:e.vaultSymbol,decimals:18,chainId:v}}}let l=(e,d)=>h.formatAmount(e.toString(),d),g="The minimum is checked in the preview; standard ERC-4626 calldata does not enforce it on chain. Re-preview before signing; execution output can change.",y=[{name:"borro_deposit",inputSchema:E("deposit"),execute:async(e,d)=>{let s=H(e.amount),w=await k(e,"deposit",d),{asset:t,share:a}=f(w),m=B(await o.readContract({address:t.address,abi:b,functionName:"balanceOf",args:[i]}));if(s>m)throw new n("This wallet does not hold enough of that asset for the Borro deposit.");let p=B(await o.readContract({address:a.address,abi:b,functionName:"previewDeposit",args:[s]}));if(p===0n)throw new n(A("deposit-would-revert",{}));let c=w.builderEligible===!0,u=Z.get(e);if(u&&(!c||!$(u.token,a.address)||!$(u.recipient,i)||u.minimum<=0n||u.minimum>p))throw new n(A("deposit-would-revert",{}));let S=u?.minimum??L(p),C=c?M.builders.address:a.address,N=[h.approval(t.address,C,s.toString(),v),h.unsignedTx({to:C,data:c?R({abi:P,functionName:"deposit",args:[a.address,s,U,S]}):R({abi:b,functionName:"deposit",args:[s,i]}),value:"0",chainId:v,description:`Deposit ${s} asset base units into Borro vault ${a.address}.`})],x;try{x=await h.preview(N,i),z(x,t,s,a,S)}catch{throw new n(A("deposit-would-revert",{}))}let D=w.deployedAt===void 0?void 0:Date.parse(w.deployedAt)/1e3,_=F({viaBuilder:c,amount:l(s,t.decimals),symbol:t.symbol,kind:t.symbol==="USDG"?"usdg":"stock",shares:l(p,18),sharesMin:l(S,18),vaultSymbol:a.symbol,deployedAtSeconds:D,nowSeconds:Math.floor(Date.now()/1e3)});return{txs:N,preview:x,vault:a.address,asset:t,shareToken:a,amount:s.toString(),shares:p.toString(),shares_min:S.toString(),summary:`${_}
1
+ import{b as W}from"./XSQJOOEY.js";import{a as b,b as P}from"./G2AA73ZE.js";import{fa as F,ga as G,ja as A}from"./HHYE42JG.js";import{a as M,b as U}from"./IBL6TL2Q.js";import{g as $,i as T,m as I,n as O}from"./NWNYJ26T.js";import{d as V}from"./IX3GZMTM.js";import{b as v}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as R}from"viem";var j={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; use vault if discovery is unavailable or ambiguous."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address verified on chain on every call; required for a rebuild without HTTP."}};function E(r){return{type:"object",additionalProperties:!1,properties:{...j,amount:{type:"string",pattern:r==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}},required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}}function H(r){return O(r,"Borro amount must be positive and fit uint256.",{positive:!0,notString:"Borro amount must be an integer string in asset base units."})}function B(r){return I(r,"Borro returned an invalid uint256 read.")}var L=r=>r*9950n/10000n,Z=new WeakMap;function oe(r,o){Z.set(r,{...o})}async function K(r,o,h,i=W){let k=await i(r,o).catch(()=>({kind:"unknown"})),f=k.kind!=="unknown"&&"readyBase"in k?k.readyBase:void 0,l=typeof f=="bigint"&&f>=0n&&f<1n<<256n?f:void 0,g=y=>V(y.toString(),o.assetDecimals);return{ready:l,...l!==void 0&&l<h?{refusal:A("too-little-ready",{ready:g(l),requested:g(h),maxNow:g(l),symbol:o.symbol})}:{}}}function z(r,o,h,i,k){let f=0n,l=0n;for(let g of r.changes){let y=g.token;if(typeof g.amount!="string"||!/^-?\d+$/.test(g.amount))throw new n("Borro preview returned invalid token changes. Nothing was signed.");let e=BigInt(g.amount);B(e<0n?-e:e);let d=$(y.address,o.address)?o:$(y.address,i.address)?i:void 0;if(!d||y.chainId!==v||y.decimals!==d.decimals)throw new n("Borro preview showed an unexpected token movement. Nothing was signed.");if(d===o){if(e>0n)throw new n("Borro preview showed a reversed input movement. Nothing was signed.");f-=e}else{if(e<0n)throw new n("Borro preview showed a reversed output movement. Nothing was signed.");l+=e}}if(B(f),B(l),f!==h||l<k||l===0n)throw new n("Borro preview did not match the requested receipt. Nothing was signed.")}var re=r=>{let{client:o,context:h,wallet:i}=r;async function k(e,d,s){if(T(s,"Provide a valid wallet address."),!$(s,i))throw new n("Borro action wallet differs from the signing wallet. Nothing was signed.");if(h.network==="testnet"||await o.getChainId()!==v)throw new n("Borro requires chain 4663. Nothing was signed.");if(Object.keys(e).some(m=>!["asset","vault","amount"].includes(m)))throw new n("Unsupported Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)||/^0x/i.test(e.asset)))throw new n("Provide an asset symbol, or put the vault address in vault.");let w=e.vault===void 0?void 0:T(e.vault,"Provide a valid Borro vault address.");if(!w&&e.asset===void 0)throw new n("Provide an asset symbol or a vault address.");let t=w?await r.verifyVault(o,w,d,{wallet:i}):await r.resolveVault(o,{asset:e.asset},d,i);if(w&&!$(w,t.vault)||e.asset!==void 0&&e.asset.toUpperCase()!==t.symbol.toUpperCase())throw new n("Borro vault and asset selectors do not match. Nothing was signed.");if(T(t.vault,"Borro returned an invalid vault address."),T(t.asset,"Borro returned an invalid asset address."),t.chainId!==v||t.shareDecimals!==18||$(t.asset,t.vault)||!Number.isInteger(t.assetDecimals)||t.assetDecimals<0||t.assetDecimals>255||t.mode!==d)throw new n(A("setup-mismatch",{}));let a=await r.verifySetup(o,t,d);if(!a.ok||d==="deposit"&&(!t.assetAllowed||a.drift.length>0))throw new n(A("setup-mismatch",{}));return{...t,setup:a}}function f(e){let d=e.mode==="withdraw"&&!/^[A-Za-z0-9.$_-]{1,16}$/.test(e.symbol)?"token":e.symbol;return{asset:{address:T(e.asset,"Borro returned an invalid asset."),symbol:d,decimals:e.assetDecimals,chainId:v},share:{address:T(e.vault,"Borro returned an invalid vault."),symbol:e.vaultSymbol,decimals:18,chainId:v}}}let l=(e,d)=>h.formatAmount(e.toString(),d),g="The minimum is checked in the preview; standard ERC-4626 calldata does not enforce it on chain. Re-preview before signing; execution output can change.",y=[{name:"borro_deposit",inputSchema:E("deposit"),execute:async(e,d)=>{let s=H(e.amount),w=await k(e,"deposit",d),{asset:t,share:a}=f(w),m=B(await o.readContract({address:t.address,abi:b,functionName:"balanceOf",args:[i]}));if(s>m)throw new n("This wallet does not hold enough of that asset for the Borro deposit.");let p=B(await o.readContract({address:a.address,abi:b,functionName:"previewDeposit",args:[s]}));if(p===0n)throw new n(A("deposit-would-revert",{}));let c=w.builderEligible===!0,u=Z.get(e);if(u&&(!c||!$(u.token,a.address)||!$(u.recipient,i)||u.minimum<=0n||u.minimum>p))throw new n(A("deposit-would-revert",{}));let S=u?.minimum??L(p),C=c?M.builders.address:a.address,N=[h.approval(t.address,C,s.toString(),v),h.unsignedTx({to:C,data:c?R({abi:P,functionName:"deposit",args:[a.address,s,U,S]}):R({abi:b,functionName:"deposit",args:[s,i]}),value:"0",chainId:v,description:`Deposit ${s} asset base units into Borro vault ${a.address}.`})],x;try{x=await h.preview(N,i),z(x,t,s,a,S)}catch{throw new n(A("deposit-would-revert",{}))}let D=w.deployedAt===void 0?void 0:Date.parse(w.deployedAt)/1e3,_=F({viaBuilder:c,amount:l(s,t.decimals),symbol:t.symbol,kind:t.symbol==="USDG"?"usdg":"stock",shares:l(p,18),sharesMin:l(S,18),vaultSymbol:a.symbol,deployedAtSeconds:D,nowSeconds:Math.floor(Date.now()/1e3)});return{txs:N,preview:x,vault:a.address,asset:t,shareToken:a,amount:s.toString(),shares:p.toString(),shares_min:S.toString(),summary:`${_}
2
2
  Base units: amount ${s} (${t.address}, decimals ${t.decimals}); shares ${p} (${a.address}, decimals 18); shares_min ${S}.`}}},{name:"borro_withdraw",inputSchema:E("withdraw"),execute:async(e,d)=>{let s=e.amount==="max",w=s?void 0:H(e.amount),t=await k(e,"withdraw",d),{asset:a,share:m}=f(t),p=B(await o.readContract({address:m.address,abi:b,functionName:"balanceOf",args:[i]}));if(p===0n)throw new n(A("no-shares",{symbol:a.symbol}));let c=s?p:B(await o.readContract({address:m.address,abi:b,functionName:"previewWithdraw",args:[w]}));if(c===0n||c>p)throw new n("This wallet does not hold enough Borro shares for that withdrawal.");let u=w??B(await o.readContract({address:m.address,abi:b,functionName:"previewRedeem",args:[c]}));if(u===0n)throw new n("Borro preview returned no assets for these shares. Nothing was signed.");let{ready:S,refusal:C}=await K(o,{...t,symbol:a.symbol},u,r.readLiquidity);if(C!==void 0)return{txs:[],vault:m.address,asset:a,shareToken:m,amount:u.toString(),shares:c.toString(),max_now:S.toString(),summary:C};let N=s?L(u):u,x=[h.unsignedTx({to:m.address,data:s?R({abi:b,functionName:"redeem",args:[c,i,i]}):R({abi:b,functionName:"withdraw",args:[u,i,i]}),value:"0",chainId:v,description:`Withdraw ${u} asset base units from Borro vault ${m.address}${s?` for ${c} share base units`:""}.`})],D=s?await h.preview(x,i):await h.preview(x,i,{reads:[{to:m.address,data:R({abi:b,functionName:"previewWithdraw",args:[u]}),chainId:v}]});if(!s){let q=D.readResults?.[0];if(D.readResults?.length!==1||typeof q!="string"||!/^0x[0-9a-fA-F]{64}$/.test(q))throw new n("Borro preview returned an invalid share quote. Nothing was signed.");if(c=B(BigInt(q)),c===0n||c>p)throw new n("This wallet does not hold enough Borro shares for that withdrawal.")}z(D,m,c,a,N);let _=G({amount:l(u,a.decimals),isAll:s,symbol:a.symbol,out:l(u,a.decimals),shares:l(c,18),vaultSymbol:m.symbol,drift:t.setup.drift.length>0});return{txs:x,preview:D,vault:m.address,asset:a,shareToken:m,amount:u.toString(),shares:c.toString(),assets_min:N.toString(),isMax:s,setup:t.setup,summary:`${_}
3
3
  Base units: amount ${u} (${a.address}, decimals ${a.decimals}); shares ${c} (${m.address}, decimals 18); assets_min ${N}. ${g}`}}}];for(let e of y){let d=e.execute;e.execute=async(s,w)=>{try{return await d(s,w)}catch(t){throw new n(h.plainError(t))}}}return y};export{oe as a,K as b,re as c};
@@ -1 +1 @@
1
- import{d as o}from"./MOZBDCVV.js";import{a as i}from"./LFSJDFMY.js";import{b as a}from"./TI727O2H.js";var m=s=>({tools:i.map(e=>{let t=e==="netnet_blackjack_claim"?"seriesId":"sessionId";return{name:e,inputSchema:{description:"Self-only recovery on chain 4663, available without an active identity or subscription; every action requires local human confirmation. Card counts use whole units.",type:"object",additionalProperties:!1,required:[t],properties:{[t]:{type:"string",pattern:"^[1-9][0-9]{0,77}$",description:t==="seriesId"?'Card series id holding your parked blackjack chips, as a decimal string. Example: "1".':'Blackjack session id to settle, as a decimal string. Example: "1".'}}},execute:async(n,c)=>{let r=await o(e,n,c,s.clientFor(a));return{txs:r.txs,summary:r.decision}}}})});export{m as a};
1
+ import{d as o}from"./L3IAEXQR.js";import{a as i}from"./LFSJDFMY.js";import{b as a}from"./EWZFZUVF.js";var m=s=>({tools:i.map(e=>{let t=e==="netnet_blackjack_claim"?"seriesId":"sessionId";return{name:e,inputSchema:{description:"Self-only recovery on chain 4663, available without an active identity or subscription; every action requires local human confirmation. Card counts use whole units.",type:"object",additionalProperties:!1,required:[t],properties:{[t]:{type:"string",pattern:"^[1-9][0-9]{0,77}$",description:t==="seriesId"?'Card series id holding your parked blackjack chips, as a decimal string. Example: "1".':'Blackjack session id to settle, as a decimal string. Example: "1".'}}},execute:async(n,c)=>{let r=await o(e,n,c,s.clientFor(a));return{txs:r.txs,summary:r.decision}}}})});export{m as a};
@@ -0,0 +1 @@
1
+ import{e as q,h as I,i as p,j as P,m as j,n as O,p as f,q as k,v as $}from"./UMY6SP7C.js";import{b as h,i as T,j as A,k as v}from"./CJMVRV34.js";import{a as s}from"./XSD5NL7J.js";import{a as H}from"./JXOEJPJ4.js";import{encodeFunctionData as R,getAddress as F,isAddress as U,parseAbi as M}from"viem";var _=M(["function poolConfig(bytes32 id) view returns ((address subject,address quote,address rules,address advisory,address liquidityOwner,uint24 baseLpFeePips,(uint24 maxLpFeePips,uint24 maxQuoteTakePips,uint16 maxSubjectTakeBps) caps,uint32 rulesGasLimit,uint32 advisoryGasLimit,uint8 advisoryPhases,bool advisoryFailOpen,bytes32 policyId) pc)"]),L=M(["function claimable(address currency,address beneficiary) view returns (uint256)","function claim(address currency) returns (uint256)"]),N={type:"object",additionalProperties:!1,properties:{poolId:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Pool ID on the current Hookr Root and core."},currency:{type:"string",enum:["quote","subject"],description:"Which currency of this pool to claim."}},required:["poolId","currency"]};async function S(t,y,a){let e=q(y,["poolId","currency"],["poolId","currency"]),u=I(e.poolId);if(e.currency!=="quote"&&e.currency!=="subject")throw new s("Choose the Hookr pool quote or subject currency.");if(t.network==="testnet")throw new s("Hookr claims require Robinhood Chain 4663.");if(!U(a))throw new s("A valid signing wallet is required for Hookr claims.");let d=F(a),c=F(h.rulesV1),n=t.clientFor(4663),o=await A(n);await T(n,o.number,[k,c,h.poolManager]);let b=j(await f(n,k,_,"poolConfig",[u],o.number));if(p(b.rules)!==c)throw new s("This pool does not use the reviewed current Hookr core.");let w=p(b.subject),g=p(b.quote);if(w===g)throw new s("Hookr pool currencies are invalid.");let l=e.currency==="quote"?g:w,[B,m]=await Promise.all([f(n,c,L,"claimable",[l,d],o.number),$(n,l,o.number)]),i=P(B),x=(1n<<127n)-1n,r=i>x?x:i,C=`${r?"Claim":"Nothing to claim:"} ${r} base units of ${H(m.symbol)} (${m.address}, ${m.decimals} decimals) for ${d}. Current core claim ledger is per currency and wallet, and can include prizes, royalties and recapture credits from multiple pools. ${i>r?`The remaining ${i-r} base units stay in the ledger.`:""}`,D=r?[t.unsignedTx({to:c,data:R({abi:L,functionName:"claim",args:[l]}),value:"0",chainId:4663,description:C})]:[];return await v(n,o),{txs:D,inputs:[],summary:C,terms:O({poolId:u,poolCurrency:e.currency,currency:l,token:m,beneficiary:d,recipient:d,claimable:i,amount:r,remaining:i-r,blockNumber:o.number,blockHash:o.hash,core:c})}}function Q(t){return{name:"hookr_claim",inputSchema:N,async execute(y,a){let e=await S(t,y,a),u=e.txs.length?await t.preview(e.txs,a):{txs:[],changes:[],summary:e.summary};return{...e,preview:u}}}}export{L as a,N as b,S as c,Q as d};
@@ -1 +1 @@
1
- import{b as D}from"./IX3GZMTM.js";import{b as d}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{concat as B,encodeAbiParameters as k,getAddress as v,isAddress as F,keccak256 as g,parseAbiParameters as O,recoverAddress as q,toHex as N}from"viem";import{privateKeyToAccount as U}from"viem/accounts";var T="OakPriceNote",l="1",w=300,E="0x0000000000000000000000000000000000000000",W=g(N("PriceNote(address wallet,uint256 oakPerEthE18,uint64 timestamp,bytes32 nonce)")),L=g(N("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")),M=(1n<<64n)-1n,P=(1n<<256n)-1n,z=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,G=0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;function X(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=Number.parseInt(e.slice(130,132),16);return!(i!==27&&i!==28||n<=0n||n>=z||t<=0n||t>G)}function m(e,n){if(typeof e!="string"||!F(e,{strict:!1}))throw new c(`Invalid ${n} address.`);return v(e)}function p(e,n){let t;if(typeof e=="bigint")t=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new c(`Invalid ${n}.`);t=BigInt(e)}else t=D(e);if(t<0n||t>P)throw new c(`${n} exceeds uint256 bounds.`);return t}function h(e,n){let t=p(e,n);if(t>M)throw new c(`${n} exceeds uint64 bounds.`);return t}function Y(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new c(`${n} must be a 32-byte hex string.`);return e}function j(e){if(typeof e=="bigint"){if(e<=0n||e>P)throw new c("Private key must be a positive scalar.");return`0x${e.toString(16).padStart(64,"0")}`}if(typeof e=="string"&&/^0x[0-9a-fA-F]{1,64}$/.test(e))return`0x${e.slice(2).padStart(64,"0")}`;throw new c("Invalid private key format.")}function K(e){let n=p(e.chainId,"chainId"),t=m(e.verifyingContract,"verifyingContract");return g(k(O("bytes32, bytes32, bytes32, uint256, address"),[L,g(N(e.name)),g(N(e.version)),n,t]))}function ae(e,n=d,t=l){return{name:T,version:t,chainId:Number(p(n,"chainId")),verifyingContract:m(e,"consumer")}}function J(e,n=d,t=l){return K({name:T,version:t,chainId:n,verifyingContract:e})}function Q(e){let n=m(e.wallet,"wallet"),t=p(e.oakPerEthE18,"oakPerEthE18"),i=h(e.timestamp,"timestamp"),r=Y(e.nonce,"nonce");return g(k(O("bytes32, address, uint256, uint64, bytes32"),[W,n,t,i,r]))}function C(e,n,t=d,i=l){let r=J(n,t,i),o=Q(e);return g(B(["0x1901",r,o]))}async function ce(e,n,t,i=d,r=l){let o=C(e,n,i,r);return typeof t=="object"&&t!==null&&"sign"in t?t.sign({hash:o}):U(j(t)).sign({hash:o})}async function Z(e,n,t,i=d,r=l){if(!X(n))return E;try{let o=C(e,t,i,r),x=await q({hash:o,signature:n});return v(x)}catch{return E}}function ee(e,n){let t=p(e,"oakPerEthE18"),i=p(n,"spotOakPerEthE18");if(i<=0n||t<=0n)return!1;if(t>P/2n||i>P/3n)throw new c("Guard arithmetic overflow.");let r=t*2n;return r>=i&&r<=i*3n}function te(e,n,t,i){if("signature"in e&&"consumer"in e&&"note"in e&&!("average"in e))return e;if("note"in e&&"signature"in e&&"consumer"in e){let a=e,f=n??{};return{...f,note:a.note,signature:a.signature,consumer:f.consumer??a.consumer,expiresAt:f.expiresAt??a.expiresAt}}return{...i??{},note:e,signature:n,consumer:t}}async function fe(e,n,t,i){let r=te(e,n,t,i),{note:o,signature:x,consumer:S}=r,a=h(o.timestamp,"timestamp"),f=p(o.oakPerEthE18,"oakPerEthE18"),y=(a+BigInt(w)).toString(),s=(b,V,H)=>({valid:!1,ok:!1,...H?{signer:H}:{},oakPerEthE18:f.toString(),expiresAt:y,reason:b,error:V}),I=r.wallet??r.boundWallet;if(I===void 0)return s("wrong_wallet","Bound wallet context is required to verify a price note.");if(m(o.wallet,"wallet")!==m(I,"boundWallet"))return s("wrong_wallet","Price note wallet does not match the bound wallet.");if(r.now===void 0)return s("expired","Current time (now) is required to verify price note expiry.");let A=h(r.now,"now");if(a>A)return s("not_yet_valid","Price note timestamp is in the future.");if(A-a>BigInt(w))return s("expired","Price note has expired.");if(r.expiresAt!==void 0){let b=h(r.expiresAt,"expiresAt");if(b!==a+BigInt(w)||A>b)return s("expired","Price note has expired.")}let R=r.chainId??d,$=r.version??l,u=await Z(o,x,S,R,$);if(u===E)return s("bad_signature","Price note signature could not be recovered.");if(r.signer===void 0)return s("bad_signature","Expected oracle signer is required to verify a price note.",u);let _=m(r.signer,"signer");return _===E||u!==_?s("bad_signature","Price note signer does not match the oracle signer.",u):r.spotOakPerEthE18===void 0?s("outside_guard","Spot OAK/ETH price is required to verify the price note guard band.",u):ee(f,r.spotOakPerEthE18)?{valid:!0,ok:!0,signer:u,oakPerEthE18:f.toString(),expiresAt:y}:s("outside_guard","Price note is outside the 50% spot guard band.",u)}export{T as a,l as b,w as c,E as d,W as e,K as f,ae as g,J as h,Q as i,C as j,ce as k,Z as l,ee as m,fe as n};
1
+ import{b as D}from"./IX3GZMTM.js";import{b as d}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{concat as B,encodeAbiParameters as k,getAddress as v,isAddress as F,keccak256 as g,parseAbiParameters as O,recoverAddress as q,toHex as N}from"viem";import{privateKeyToAccount as U}from"viem/accounts";var T="OakPriceNote",l="1",w=300,E="0x0000000000000000000000000000000000000000",W=g(N("PriceNote(address wallet,uint256 oakPerEthE18,uint64 timestamp,bytes32 nonce)")),L=g(N("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")),M=(1n<<64n)-1n,P=(1n<<256n)-1n,z=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,G=0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;function X(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=Number.parseInt(e.slice(130,132),16);return!(i!==27&&i!==28||n<=0n||n>=z||t<=0n||t>G)}function m(e,n){if(typeof e!="string"||!F(e,{strict:!1}))throw new c(`Invalid ${n} address.`);return v(e)}function p(e,n){let t;if(typeof e=="bigint")t=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new c(`Invalid ${n}.`);t=BigInt(e)}else t=D(e);if(t<0n||t>P)throw new c(`${n} exceeds uint256 bounds.`);return t}function h(e,n){let t=p(e,n);if(t>M)throw new c(`${n} exceeds uint64 bounds.`);return t}function Y(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new c(`${n} must be a 32-byte hex string.`);return e}function j(e){if(typeof e=="bigint"){if(e<=0n||e>P)throw new c("Private key must be a positive scalar.");return`0x${e.toString(16).padStart(64,"0")}`}if(typeof e=="string"&&/^0x[0-9a-fA-F]{1,64}$/.test(e))return`0x${e.slice(2).padStart(64,"0")}`;throw new c("Invalid private key format.")}function K(e){let n=p(e.chainId,"chainId"),t=m(e.verifyingContract,"verifyingContract");return g(k(O("bytes32, bytes32, bytes32, uint256, address"),[L,g(N(e.name)),g(N(e.version)),n,t]))}function ae(e,n=d,t=l){return{name:T,version:t,chainId:Number(p(n,"chainId")),verifyingContract:m(e,"consumer")}}function J(e,n=d,t=l){return K({name:T,version:t,chainId:n,verifyingContract:e})}function Q(e){let n=m(e.wallet,"wallet"),t=p(e.oakPerEthE18,"oakPerEthE18"),i=h(e.timestamp,"timestamp"),r=Y(e.nonce,"nonce");return g(k(O("bytes32, address, uint256, uint64, bytes32"),[W,n,t,i,r]))}function C(e,n,t=d,i=l){let r=J(n,t,i),o=Q(e);return g(B(["0x1901",r,o]))}async function ce(e,n,t,i=d,r=l){let o=C(e,n,i,r);return typeof t=="object"&&t!==null&&"sign"in t?t.sign({hash:o}):U(j(t)).sign({hash:o})}async function Z(e,n,t,i=d,r=l){if(!X(n))return E;try{let o=C(e,t,i,r),x=await q({hash:o,signature:n});return v(x)}catch{return E}}function ee(e,n){let t=p(e,"oakPerEthE18"),i=p(n,"spotOakPerEthE18");if(i<=0n||t<=0n)return!1;if(t>P/2n||i>P/3n)throw new c("Guard arithmetic overflow.");let r=t*2n;return r>=i&&r<=i*3n}function te(e,n,t,i){if("signature"in e&&"consumer"in e&&"note"in e&&!("average"in e))return e;if("note"in e&&"signature"in e&&"consumer"in e){let a=e,f=n??{};return{...f,note:a.note,signature:a.signature,consumer:f.consumer??a.consumer,expiresAt:f.expiresAt??a.expiresAt}}return{...i??{},note:e,signature:n,consumer:t}}async function fe(e,n,t,i){let r=te(e,n,t,i),{note:o,signature:x,consumer:S}=r,a=h(o.timestamp,"timestamp"),f=p(o.oakPerEthE18,"oakPerEthE18"),y=(a+BigInt(w)).toString(),s=(b,V,H)=>({valid:!1,ok:!1,...H?{signer:H}:{},oakPerEthE18:f.toString(),expiresAt:y,reason:b,error:V}),I=r.wallet??r.boundWallet;if(I===void 0)return s("wrong_wallet","Bound wallet context is required to verify a price note.");if(m(o.wallet,"wallet")!==m(I,"boundWallet"))return s("wrong_wallet","Price note wallet does not match the bound wallet.");if(r.now===void 0)return s("expired","Current time (now) is required to verify price note expiry.");let A=h(r.now,"now");if(a>A)return s("not_yet_valid","Price note timestamp is in the future.");if(A-a>BigInt(w))return s("expired","Price note has expired.");if(r.expiresAt!==void 0){let b=h(r.expiresAt,"expiresAt");if(b!==a+BigInt(w)||A>b)return s("expired","Price note has expired.")}let R=r.chainId??d,$=r.version??l,u=await Z(o,x,S,R,$);if(u===E)return s("bad_signature","Price note signature could not be recovered.");if(r.signer===void 0)return s("bad_signature","Expected oracle signer is required to verify a price note.",u);let _=m(r.signer,"signer");return _===E||u!==_?s("bad_signature","Price note signer does not match the oracle signer.",u):r.spotOakPerEthE18===void 0?s("outside_guard","Spot OAK/ETH price is required to verify the price note guard band.",u):ee(f,r.spotOakPerEthE18)?{valid:!0,ok:!0,signer:u,oakPerEthE18:f.toString(),expiresAt:y}:s("outside_guard","Price note is outside the 50% spot guard band.",u)}export{T as a,l as b,w as c,E as d,W as e,K as f,ae as g,J as h,Q as i,C as j,ce as k,Z as l,ee as m,fe as n};
@@ -1 +1 @@
1
- import{b}from"./FQTO7VJG.js";import{c as m,f as A}from"./V6EVQWAL.js";import{c as h}from"./FUP53K6G.js";import{b as w}from"./GBPB7JIB.js";import{c as u,i as v,l as y}from"./4CEV4FDG.js";import{i as f}from"./4J245N3F.js";import{b as p}from"./SPJCSEKP.js";import{a as n}from"./XSD5NL7J.js";var $={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; for multiple USDG vaults, select the largest only with at least 100 USDG and ten times the runner-up assets. Other ambiguous symbols require a vault address."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address to verify on chain; required for a rebuild without HTTP. If asset is also supplied, both must match."}};function M(e){return{type:"object",additionalProperties:!1,properties:{...$,...e?{amount:{type:"string",pattern:e==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}}:{}},...e?{required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}:{}}}function O(e,o){if(Object.keys(e).some(s=>!["asset","vault",...o?["amount"]:[]].includes(s)))throw new n("Unexpected Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)))throw new n("Provide an official asset symbol.");if(e.vault!==void 0&&u(e.vault),o&&(typeof e.amount!="string"||!(o==="withdraw"?/^(?:[0-9]+|max)$/:/^[0-9]+$/).test(e.amount)||!e.asset&&!e.vault))throw new n("Provide an asset symbol or vault address and a base-unit amount.")}function x(e,o={}){let s=m(e,o);if(o.resolveAllowedAsset||o.officialStockTokens)return s;let l=m(e,{...o,resolveAllowedAsset:(r,a,i)=>v(f())(r,a,i)}),t=(r,a,i,d)=>(a.vault?l:s).resolveVault(r,a,i,d);return{...l,discoverVaults:s.discoverVaults,resolveVault:t}}function P(e,o={}){let s=x(e,o),l=["deposit","withdraw"].map((t,r)=>({name:`borro_${t}`,inputSchema:M(t),execute:async(a,i)=>{O(a,t),u(i);let d=o.createActionTools??h,T=e.clientFor(4663),c=d({context:e,client:T,wallet:i,verifySetup:y,readLiquidity:w,...s})[r];if(!c||c.name!==`borro_${t}`)throw new n("Borro action wiring is unavailable.");return c.execute(a,i)}}));return{tools:[{name:"borro_list",inputSchema:M(),execute:async(t,r)=>(O(t),A(e,r,{...typeof t.asset=="string"?{asset:t.asset}:{},...t.vault?{vault:u(t.vault)}:{}},o,s))},...l],positions:(t,r)=>b(e,t,{...o,...r,discoverVaults:s.discoverVaults})}}var _=e=>p("borro",e.network==="testnet"?[]:[P(e)]);export{x as a,P as b,_ as c};
1
+ import{b}from"./3HF6WE4L.js";import{c as m,f as A}from"./FN6XY6ET.js";import{c as h}from"./6LDC5D2S.js";import{b as w}from"./XSQJOOEY.js";import{c as u,i as v,l as y}from"./4CEV4FDG.js";import{j as f}from"./5PNFV7HH.js";import{b as p}from"./SPJCSEKP.js";import{a as n}from"./XSD5NL7J.js";var $={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; for multiple USDG vaults, select the largest only with at least 100 USDG and ten times the runner-up assets. Other ambiguous symbols require a vault address."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address to verify on chain; required for a rebuild without HTTP. If asset is also supplied, both must match."}};function M(e){return{type:"object",additionalProperties:!1,properties:{...$,...e?{amount:{type:"string",pattern:e==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}}:{}},...e?{required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}:{}}}function O(e,o){if(Object.keys(e).some(s=>!["asset","vault",...o?["amount"]:[]].includes(s)))throw new n("Unexpected Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)))throw new n("Provide an official asset symbol.");if(e.vault!==void 0&&u(e.vault),o&&(typeof e.amount!="string"||!(o==="withdraw"?/^(?:[0-9]+|max)$/:/^[0-9]+$/).test(e.amount)||!e.asset&&!e.vault))throw new n("Provide an asset symbol or vault address and a base-unit amount.")}function x(e,o={}){let s=m(e,o);if(o.resolveAllowedAsset||o.officialStockTokens)return s;let l=m(e,{...o,resolveAllowedAsset:(r,a,i)=>v(f())(r,a,i)}),t=(r,a,i,d)=>(a.vault?l:s).resolveVault(r,a,i,d);return{...l,discoverVaults:s.discoverVaults,resolveVault:t}}function P(e,o={}){let s=x(e,o),l=["deposit","withdraw"].map((t,r)=>({name:`borro_${t}`,inputSchema:M(t),execute:async(a,i)=>{O(a,t),u(i);let d=o.createActionTools??h,T=e.clientFor(4663),c=d({context:e,client:T,wallet:i,verifySetup:y,readLiquidity:w,...s})[r];if(!c||c.name!==`borro_${t}`)throw new n("Borro action wiring is unavailable.");return c.execute(a,i)}}));return{tools:[{name:"borro_list",inputSchema:M(),execute:async(t,r)=>(O(t),A(e,r,{...typeof t.asset=="string"?{asset:t.asset}:{},...t.vault?{vault:u(t.vault)}:{}},o,s))},...l],positions:(t,r)=>b(e,t,{...o,...r,discoverVaults:s.discoverVaults})}}var _=e=>p("borro",e.network==="testnet"?[]:[P(e)]);export{x as a,P as b,_ as c};
@@ -1 +1 @@
1
- import{a as f,b as T,f as c,g as v,i as E}from"./TXGZ6NWN.js";import{c as a,g as O}from"./NWNYJ26T.js";import{b as m}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as $,parseAbi as x}from"viem";var F=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],h=x(F),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},N=p=>{let w=()=>p.clientFor(m),k=async(e,t,o)=>({txs:e,preview:await p.preview(e,t),summary:o}),y=(e,t,o,r)=>p.unsignedTx({to:e,chainId:m,data:$({abi:h,functionName:t,args:o}),value:"0",description:r}),_={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"],description:"Owner or admin call on a pinned Clanker contract: toggle admins, hooks, lockers, MEV modules, extensions or depositors, claim team fees, withdraw assets, or change ownership."},contract:{enum:["factory","locker","fee_locker"],description:"Which pinned Clanker contract to call; required only for transferOwnership and renounceOwnership, otherwise implied by the operation."},target:{...a,description:"Address of the admin, hook, locker, MEV module, extension or depositor being configured."},hook:{...a,description:"Address of the pool hook the locker is enabled for; used by setLocker."},token:{...a,description:"Address of the ERC-20 token to claim team fees on or withdraw."},recipient:{...a,description:"Address that receives funds, the new fee recipient, or the new owner, depending on the operation."},enabled:{type:"boolean",description:"True to enable (or deprecate, for setDeprecated) the target; false to disable."}},b=(e,t,o,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(n,i)=>{try{return E(n,Object.keys(t)),await r(n,c(i))}catch(d){throw new s(p.plainError(d))}}});return{tools:[b("protocol_admin",_,["operation"],async(e,t)=>{let o=String(e.operation),r=o==="transferOwnership"||o==="renounceOwnership";if(!r&&!Object.hasOwn(g,o))throw new s("Choose a supported Clanker protocol operation.");let n=r?void 0:g[o],i=n?.contract??e.contract;if(i!=="factory"&&i!=="locker"&&i!=="fee_locker")throw new s("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==i)throw new s("This operation targets a different pinned contract.");let d=n?.fields??(o==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new s(`Input ${l} does not match this protocol operation.`);let u=f[i].address,D=c(await w().readContract({address:u,abi:h,functionName:"owner"}),!0);if(!O(D,t)&&(n?.admin&&await w().readContract({address:u,abi:h,functionName:"admins",args:[t]}))!==!0)throw new s("The connected wallet lacks the required Clanker protocol owner/admin role.");let A=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new s("Provide enabled as boolean.");return e.enabled}),C=`Clanker protocol ${i}: ${o} ${JSON.stringify(A)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,o,A,C)],t,C)}),b("store_fees",{token:{...a,description:"Address of the ERC-20 token whose fees are deposited."},recipient:{...a,description:"Address of the fee owner who can later claim these fees."},amount:{...T,description:'Amount of the token to deposit, in base units of that token (read its decimals). Example: "1000000000000000000" = 1 token at 18 decimals.'}},["token","recipient","amount"],async(e,t)=>{let o=c(e.token),r=c(e.recipient),n=v(e.amount);if(!n)throw new s("Provide a positive fee deposit amount.");if(await w().readContract({address:f.fee_locker.address,abi:h,functionName:"allowedDepositors",args:[t]})!==!0)throw new s("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${n} base units of token ${o} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(o,f.fee_locker.address,n.toString(),m),y(f.fee_locker.address,"storeFees",[r,o,n],d)];return k(u,t,d)}),b("claim_for",{token:{...a,description:"Address of the fee token to claim for the owner."},recipient:{...a,description:"Address of the fee owner whose collected fees are claimed; receipts go to this address."}},["token","recipient"],async(e,t)=>{let o=c(e.token),r=c(e.recipient),n=`Permissionlessly claim already-collected Clanker ${o} fees for ${r}; all receipts go to that fee owner, while ${t} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,o],n)],t,n)})]}};export{N as a};
1
+ import{a as f,b as T,f as c,g as v,i as E}from"./PG7HZIZL.js";import{c as a,g as O}from"./NWNYJ26T.js";import{b as m}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as $,parseAbi as x}from"viem";var F=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],h=x(F),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},N=p=>{let w=()=>p.clientFor(m),k=async(e,t,o)=>({txs:e,preview:await p.preview(e,t),summary:o}),y=(e,t,o,r)=>p.unsignedTx({to:e,chainId:m,data:$({abi:h,functionName:t,args:o}),value:"0",description:r}),_={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"],description:"Owner or admin call on a pinned Clanker contract: toggle admins, hooks, lockers, MEV modules, extensions or depositors, claim team fees, withdraw assets, or change ownership."},contract:{enum:["factory","locker","fee_locker"],description:"Which pinned Clanker contract to call; required only for transferOwnership and renounceOwnership, otherwise implied by the operation."},target:{...a,description:"Address of the admin, hook, locker, MEV module, extension or depositor being configured."},hook:{...a,description:"Address of the pool hook the locker is enabled for; used by setLocker."},token:{...a,description:"Address of the ERC-20 token to claim team fees on or withdraw."},recipient:{...a,description:"Address that receives funds, the new fee recipient, or the new owner, depending on the operation."},enabled:{type:"boolean",description:"True to enable (or deprecate, for setDeprecated) the target; false to disable."}},b=(e,t,o,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(n,i)=>{try{return E(n,Object.keys(t)),await r(n,c(i))}catch(d){throw new s(p.plainError(d))}}});return{tools:[b("protocol_admin",_,["operation"],async(e,t)=>{let o=String(e.operation),r=o==="transferOwnership"||o==="renounceOwnership";if(!r&&!Object.hasOwn(g,o))throw new s("Choose a supported Clanker protocol operation.");let n=r?void 0:g[o],i=n?.contract??e.contract;if(i!=="factory"&&i!=="locker"&&i!=="fee_locker")throw new s("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==i)throw new s("This operation targets a different pinned contract.");let d=n?.fields??(o==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new s(`Input ${l} does not match this protocol operation.`);let u=f[i].address,D=c(await w().readContract({address:u,abi:h,functionName:"owner"}),!0);if(!O(D,t)&&(n?.admin&&await w().readContract({address:u,abi:h,functionName:"admins",args:[t]}))!==!0)throw new s("The connected wallet lacks the required Clanker protocol owner/admin role.");let A=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new s("Provide enabled as boolean.");return e.enabled}),C=`Clanker protocol ${i}: ${o} ${JSON.stringify(A)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,o,A,C)],t,C)}),b("store_fees",{token:{...a,description:"Address of the ERC-20 token whose fees are deposited."},recipient:{...a,description:"Address of the fee owner who can later claim these fees."},amount:{...T,description:'Amount of the token to deposit, in base units of that token (read its decimals). Example: "1000000000000000000" = 1 token at 18 decimals.'}},["token","recipient","amount"],async(e,t)=>{let o=c(e.token),r=c(e.recipient),n=v(e.amount);if(!n)throw new s("Provide a positive fee deposit amount.");if(await w().readContract({address:f.fee_locker.address,abi:h,functionName:"allowedDepositors",args:[t]})!==!0)throw new s("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${n} base units of token ${o} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(o,f.fee_locker.address,n.toString(),m),y(f.fee_locker.address,"storeFees",[r,o,n],d)];return k(u,t,d)}),b("claim_for",{token:{...a,description:"Address of the fee token to claim for the owner."},recipient:{...a,description:"Address of the fee owner whose collected fees are claimed; receipts go to this address."}},["token","recipient"],async(e,t)=>{let o=c(e.token),r=c(e.recipient),n=`Permissionlessly claim already-collected Clanker ${o} fees for ${r}; all receipts go to that fee owner, while ${t} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,o],n)],t,n)})]}};export{N as a};
@@ -1 +1 @@
1
- import{c as D}from"./DXAPKN7H.js";import{b as O,g as M,i as A,j as B,k as T,l as P,m as I,n as U,r as k,s as F,v as f,x as z}from"./Y64GFBTA.js";import{a as w,e as _}from"./NWNYJ26T.js";import{b as y}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";function $(u){return{...u,token:{...u.token,symbol:f(u.token.symbol)??"unknown"}}}var Q=u=>{let N=z(u);async function G(t,r){let g=T(r),i=I(t.originChainId),e=I(t.destinationChainId);if(i!==y&&e!==y)throw new d(`A Relay quote must start or end on chain ${y}.`);let h=P(t.originCurrency??O),b=P(t.destinationCurrency??O),c=T(t.recipient??g),a=U(t.amount);if(a==="0")throw new d("Provide a positive bridge amount.");let n=t.tradeType??"EXACT_INPUT";if(!["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"].includes(String(n)))throw new d("Choose EXACT_INPUT, EXACT_OUTPUT or EXPECTED_OUTPUT.");let m={};for(let E of["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"]){let p=t[E];if(p!==void 0){if(!Array.isArray(p)||p.length>100||p.some(j=>typeof j!="string"||!/^[A-Za-z0-9._ -]{1,128}$/.test(j)))throw new d("Provide valid Relay swap source names.");m[E]=p}}let S=await N("/quote/v2",{user:g,recipient:c,originChainId:i,destinationChainId:e,originCurrency:h,destinationCurrency:b,amount:a,tradeType:n,...m}),o=A(S.details),l=$(k(o.currencyIn)),s=$(k(o.currencyOut)),C=U(A(o.currencyOut).minimumAmount);F(T(o.sender)===g&&T(o.recipient)===c&&l.token.chainId===i&&l.token.address===h&&(n==="EXACT_INPUT"?l.amount===a:s.amount===a)&&s.token.chainId===e&&s.token.address===b&&BigInt(C)<=BigInt(s.amount));let H=Object.fromEntries(Object.entries(A(S.fees)).map(([E,p])=>[E,$(k(p))])),R=typeof o.timeEstimate=="number"&&Number.isFinite(o.timeEstimate)&&o.timeEstimate>=0?o.timeEstimate:void 0,v=M(S.fees),X=e===y,x=X?"relay_bridge_in":"relay_bridge_out",q=n==="EXACT_INPUT"&&Object.keys(m).length===0&&i!==e&&(!X||D(i)!==void 0);return{executable:!1,nextAction:q?x:void 0,originChainId:i,destinationChainId:e,recipient:c,tradeType:n,amountIn:l,amountOut:s,minAmountOut:{token:s.token,amount:C},fees:H,...v,slippage:{source:"provider",minimumAmount:C},...R===void 0?{}:{timeEstimateSeconds:R},summary:`${v.feeDisclosure} Read-only Relay estimate: ${l.amount} base units of ${l.token.symbol} (${l.token.decimals} decimals) on chain ${i} for about ${s.amount}, minimum ${C}, base units of ${s.token.symbol} (${s.token.decimals} decimals) on chain ${e} for ${c}. Slippage: selected by Relay; Oak sent no slippage setting. The returned minimum above is the quote floor. Relay fees are already deducted from the output; origin gas is separate. Nothing was built or signed, and this estimate cannot be executed. ${q?`To bridge, call ${x}; it fetches a fresh quote and shows its own preview for human confirmation.`:"This estimate shape has no matching Oak execution path. No action will preserve these trade type or routing options."}`}}async function Z(t){let r=t.chainId===void 0?void 0:I(t.chainId),i=B((await N("/chains")).chains).map(A).flatMap(e=>{if(typeof e.id!="number"||!Number.isSafeInteger(e.id)||e.id<=0)return[];if(r!==void 0&&e.id!==r)return[];let h=e.disabled===!1,b=_(e.currency)?e.currency:{},c={chainId:e.id,name:f(e.displayName,"name")??f(e.name,"name")??String(e.id),vmType:f(e.vmType),nativeCurrency:{symbol:f(b.symbol),decimals:typeof b.decimals=="number"?b.decimals:void 0},bridgeIn:e.id!==y&&h&&D(e.id)!==void 0,bridgeOut:e.id!==y&&h&&e.vmType==="evm"};if(r===void 0)return[c];let a=new Map;for(let n of[...Array.isArray(e.featuredTokens)?e.featuredTokens:[],...Array.isArray(e.erc20Currencies)?e.erc20Currencies:[]]){if(!_(n)||typeof n.address!="string"||!new RegExp(w).test(n.address)||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)continue;let m=T(n.address);a.has(m)||a.set(m,{address:m,symbol:f(n.symbol)??"unknown",decimals:n.decimals,bridgeable:n.supportsBridging===!0})}return[{...c,currencies:[...a.values()]}]});if(r!==void 0&&!i.length)throw new d(`Relay does not list chain ${r}.`);return{chains:i,summary:`${i.length} Relay chain${i.length===1?"":"s"}. bridgeIn marks origins relay_bridge_in can build from; bridgeOut marks destinations relay_bridge_out can reach. Currency lists are Relay-reported display data; bridgeable false means Relay does not bridge that token. Confirm token addresses before bridging.`}}return{tools:[{name:"relay_quote",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","destinationChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{type:"integer",minimum:1,description:"Destination chain ID."},originCurrency:{type:"string",pattern:w,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{type:"string",pattern:w,description:"Destination token address; defaults to the destination chain\u2019s native token."},amount:{type:"string",pattern:"^[1-9][0-9]*$",description:'Input token amount for EXACT_INPUT, otherwise output token amount, in base units using that token\u2019s decimals (USDG has 6: "1000000" = 1 USDG).'},recipient:{type:"string",pattern:w,description:"Destination recipient address; defaults to your wallet."},tradeType:{type:"string",enum:["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"],description:"EXACT_INPUT fixes input; EXACT_OUTPUT fixes output; EXPECTED_OUTPUT targets output."},...Object.fromEntries(["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"].map(t=>[t,{type:"array",description:t==="excludedSwapSources"?"Swap sources to exclude.":t==="includedOriginSwapSources"?"Origin swap sources to include.":t==="includedDestinationSwapSources"?"Destination swap sources to include.":"Swap sources to include.",maxItems:100,items:{type:"string",pattern:"^[A-Za-z0-9._ -]{1,128}$"}}]))}},execute:async(t,r)=>{try{return await G(t,r)}catch(g){throw new d(u.plainError(g))}}},{name:"relay_chains",inputSchema:{type:"object",additionalProperties:!1,properties:{chainId:{type:"integer",minimum:1,description:"Filter by chain ID."}}},execute:async t=>{try{return await Z(t)}catch(r){throw new d(u.plainError(r))}}}]}};export{Q as a};
1
+ import{c as D}from"./NLC36QHL.js";import{b as O,g as M,i as A,j as B,k as T,l as P,m as I,n as U,r as k,s as F,v as f,x as z}from"./Y64GFBTA.js";import{a as w,e as _}from"./NWNYJ26T.js";import{b as y}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";function $(u){return{...u,token:{...u.token,symbol:f(u.token.symbol)??"unknown"}}}var Q=u=>{let N=z(u);async function G(t,r){let g=T(r),i=I(t.originChainId),e=I(t.destinationChainId);if(i!==y&&e!==y)throw new d(`A Relay quote must start or end on chain ${y}.`);let h=P(t.originCurrency??O),b=P(t.destinationCurrency??O),c=T(t.recipient??g),a=U(t.amount);if(a==="0")throw new d("Provide a positive bridge amount.");let n=t.tradeType??"EXACT_INPUT";if(!["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"].includes(String(n)))throw new d("Choose EXACT_INPUT, EXACT_OUTPUT or EXPECTED_OUTPUT.");let m={};for(let E of["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"]){let p=t[E];if(p!==void 0){if(!Array.isArray(p)||p.length>100||p.some(j=>typeof j!="string"||!/^[A-Za-z0-9._ -]{1,128}$/.test(j)))throw new d("Provide valid Relay swap source names.");m[E]=p}}let S=await N("/quote/v2",{user:g,recipient:c,originChainId:i,destinationChainId:e,originCurrency:h,destinationCurrency:b,amount:a,tradeType:n,...m}),o=A(S.details),l=$(k(o.currencyIn)),s=$(k(o.currencyOut)),C=U(A(o.currencyOut).minimumAmount);F(T(o.sender)===g&&T(o.recipient)===c&&l.token.chainId===i&&l.token.address===h&&(n==="EXACT_INPUT"?l.amount===a:s.amount===a)&&s.token.chainId===e&&s.token.address===b&&BigInt(C)<=BigInt(s.amount));let H=Object.fromEntries(Object.entries(A(S.fees)).map(([E,p])=>[E,$(k(p))])),R=typeof o.timeEstimate=="number"&&Number.isFinite(o.timeEstimate)&&o.timeEstimate>=0?o.timeEstimate:void 0,v=M(S.fees),X=e===y,x=X?"relay_bridge_in":"relay_bridge_out",q=n==="EXACT_INPUT"&&Object.keys(m).length===0&&i!==e&&(!X||D(i)!==void 0);return{executable:!1,nextAction:q?x:void 0,originChainId:i,destinationChainId:e,recipient:c,tradeType:n,amountIn:l,amountOut:s,minAmountOut:{token:s.token,amount:C},fees:H,...v,slippage:{source:"provider",minimumAmount:C},...R===void 0?{}:{timeEstimateSeconds:R},summary:`${v.feeDisclosure} Read-only Relay estimate: ${l.amount} base units of ${l.token.symbol} (${l.token.decimals} decimals) on chain ${i} for about ${s.amount}, minimum ${C}, base units of ${s.token.symbol} (${s.token.decimals} decimals) on chain ${e} for ${c}. Slippage: selected by Relay; Oak sent no slippage setting. The returned minimum above is the quote floor. Relay fees are already deducted from the output; origin gas is separate. Nothing was built or signed, and this estimate cannot be executed. ${q?`To bridge, call ${x}; it fetches a fresh quote and shows its own preview for human confirmation.`:"This estimate shape has no matching Oak execution path. No action will preserve these trade type or routing options."}`}}async function Z(t){let r=t.chainId===void 0?void 0:I(t.chainId),i=B((await N("/chains")).chains).map(A).flatMap(e=>{if(typeof e.id!="number"||!Number.isSafeInteger(e.id)||e.id<=0)return[];if(r!==void 0&&e.id!==r)return[];let h=e.disabled===!1,b=_(e.currency)?e.currency:{},c={chainId:e.id,name:f(e.displayName,"name")??f(e.name,"name")??String(e.id),vmType:f(e.vmType),nativeCurrency:{symbol:f(b.symbol),decimals:typeof b.decimals=="number"?b.decimals:void 0},bridgeIn:e.id!==y&&h&&D(e.id)!==void 0,bridgeOut:e.id!==y&&h&&e.vmType==="evm"};if(r===void 0)return[c];let a=new Map;for(let n of[...Array.isArray(e.featuredTokens)?e.featuredTokens:[],...Array.isArray(e.erc20Currencies)?e.erc20Currencies:[]]){if(!_(n)||typeof n.address!="string"||!new RegExp(w).test(n.address)||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)continue;let m=T(n.address);a.has(m)||a.set(m,{address:m,symbol:f(n.symbol)??"unknown",decimals:n.decimals,bridgeable:n.supportsBridging===!0})}return[{...c,currencies:[...a.values()]}]});if(r!==void 0&&!i.length)throw new d(`Relay does not list chain ${r}.`);return{chains:i,summary:`${i.length} Relay chain${i.length===1?"":"s"}. bridgeIn marks origins relay_bridge_in can build from; bridgeOut marks destinations relay_bridge_out can reach. Currency lists are Relay-reported display data; bridgeable false means Relay does not bridge that token. Confirm token addresses before bridging.`}}return{tools:[{name:"relay_quote",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","destinationChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{type:"integer",minimum:1,description:"Destination chain ID."},originCurrency:{type:"string",pattern:w,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{type:"string",pattern:w,description:"Destination token address; defaults to the destination chain\u2019s native token."},amount:{type:"string",pattern:"^[1-9][0-9]*$",description:'Input token amount for EXACT_INPUT, otherwise output token amount, in base units using that token\u2019s decimals (USDG has 6: "1000000" = 1 USDG).'},recipient:{type:"string",pattern:w,description:"Destination recipient address; defaults to your wallet."},tradeType:{type:"string",enum:["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"],description:"EXACT_INPUT fixes input; EXACT_OUTPUT fixes output; EXPECTED_OUTPUT targets output."},...Object.fromEntries(["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"].map(t=>[t,{type:"array",description:t==="excludedSwapSources"?"Swap sources to exclude.":t==="includedOriginSwapSources"?"Origin swap sources to include.":t==="includedDestinationSwapSources"?"Destination swap sources to include.":"Swap sources to include.",maxItems:100,items:{type:"string",pattern:"^[A-Za-z0-9._ -]{1,128}$"}}]))}},execute:async(t,r)=>{try{return await G(t,r)}catch(g){throw new d(u.plainError(g))}}},{name:"relay_chains",inputSchema:{type:"object",additionalProperties:!1,properties:{chainId:{type:"integer",minimum:1,description:"Filter by chain ID."}}},execute:async t=>{try{return await Z(t)}catch(r){throw new d(u.plainError(r))}}}]}};export{Q as a};
@@ -0,0 +1 @@
1
+ import{b as s,f as C,i as k}from"./CJMVRV34.js";import{a as x}from"./B7WZJHIJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as F,getAddress as c,keccak256 as D,parseAbi as Z,zeroAddress as m,zeroHash as E}from"viem";var q="0x167ba3b15d65044b17c87154087d35fc5efde07538be66b804a54e63d6089136",N="0xc6848895ec12bfc54b1d011fdda88ab892250ccd0910f40dcf2025e17ac3225d",U=c(s.agentGateV2),M=c("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),K=c("0x8004BAa17C55a88189AE136b182e5fdA19dE9b63"),L=c("0x58daec3116aae6D93017bAAea7749052E8a04fA7"),j={schemaHash:q,termsBytes:160,healthFunction:"retired",supportsAge:!1,abi:x.agentGateV1.abi},Y={schemaHash:N,termsBytes:192,healthFunction:"suspended",supportsAge:!0,abi:x.agentGateV2.abi},ee=[{...j,address:c(s.agentGateV1),listed:!0,warning:null},{...Y,address:U,listed:!0,warning:null}],$=x.registry.abi,te=Z(["function isRevokedAdmission(address scope,address implementation) view returns (bool)"]),f=e=>{if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e))throw new o("Hookr address read is incomplete.");return c(e)},d=(e,t=256)=>{if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new o("Hookr integer read is incomplete.");let i=BigInt(e);if(i<0n||i>=1n<<BigInt(t))throw new o("Hookr integer read is outside its ABI bounds.");return i},_=e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new o("Hookr admission read is incomplete.");return e},u=e=>{if(typeof e!="boolean")throw new o("Hookr boolean read is incomplete.");return e};function re(e,t){let i=f(e),a=ee.find(n=>n.address===i);if(a){if(t!==void 0&&t!==a.schemaHash)throw new o("Hookr listed gate terms layout changed.");return a}let r=t===q?j:t===N?Y:void 0;if(!r)throw new o("Hookr gate terms layout is unknown. Update Oak before using this gate.");return{...r,address:i,listed:!1,warning:"new gate, Oak has not read its code"}}function ne(e,t,i,a){let r=_(e),n=_(r.caps),g=d(r.gasLimit,32);if(u(a)||f(r.implementation)!==t.address||r.codeHash!==i||r.schemaHash!==t.schemaHash||d(r.kind,8)!==1n||d(r.phaseMask,8)!==1n||u(r.failOpen)||g<400000n||g>2000000n||d(n.maxLpFeePips,24)>50000n||d(n.maxQuoteTakePips,24)!==0n||d(n.maxSubjectTakeBps,16)!==0n)throw new o("Hookr gate admission is revoked or differs from the supported fail-closed BEFORE_SWAP caps.");return u(r.feeOnly),r}async function de(e,t,i=U,a={}){let r=f(i);await k(e,t,[s.registry,s.rootV1]);let n=(w,h=[],v=x.agentGateV2.abi)=>e.readContract({address:r,abi:v,functionName:w,args:h,blockNumber:t}),[g,O]=await Promise.all([e.getCode({address:r,blockNumber:t}),n("configSchemaHash")]);if(!g||g==="0x"||g.startsWith("0xef0100"))throw new o("Hookr gate runtime is unavailable or delegated.");let y=D(g),p=re(r,O),l=C[r];if(l&&l.codeHash!==y)throw new o("Hookr listed gate runtime drifted. Refresh the reviewed pin.");p.listed&&await k(e,t,[r]);let[b,H,z,T,W,Q,G,X,P,J,R,S]=await Promise.all([n("identity"),n("reputation"),n("poolManager"),n(p.healthFunction,[],p.abi),n("MIN_ADVISORY_GAS"),n("MAX_ADVISORY_GAS"),n("linkOf",[m]),n("isAgent",[m]),n("reviewerSet",[E]),n("terms",[s.rootV1,E],p.abi),n("scoreOf",[m,E]),n("explainLiquidity",[s.rootV1,E,m])]);if(f(b)!==M||f(H)!==K||f(z)!==c(s.poolManager)||d(W)!==400000n||d(Q)!==2000000n)throw new o("Hookr gate dependency wiring or gas bounds changed.");if(u(T),u(X),!Array.isArray(G)||G.length!==2||!Array.isArray(P)||P.length!==2||!Array.isArray(P[0])||typeof P[1]!="string"||!Array.isArray(R)||R.length!==2||typeof R[1]!="bigint"||!Array.isArray(S)||S.length!==2)throw new o("Hookr gate expected read is incomplete.");u(G[0]),d(G[1]),u(R[0]),u(S[0]),d(S[1],8);let A=_(J);u(A.bound);for(let[w,h]of[["flags",16],["minScore",32],["tierScore",32],["tierPips",24]])d(A[w],h);if(f(A.launcher),f(A.curatedRouter),typeof A.reviewers!="string"||!/^0x[0-9a-fA-F]{64}$/.test(A.reviewers))throw new o("Hookr gate reviewer ID read is incomplete.");if(p.supportsAge){let[w,h,v]=await Promise.all([n("positionManager"),n("ageOf",[m]),n("pins")]);d(A.minAge,32),d(h);let I=_(v);if(f(w)!==L||["identityCode","identityVersion","reputationCode","reputationVersion"].some(B=>typeof I[B]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(I[B])))throw new o("Hookr gate position manager or registry pins are incomplete.");await k(e,t,[L,M,K])}let V=null;if(a.requireAdmission!==!1||!p.listed){let[w,h]=await Promise.all([e.readContract({address:c(s.registry),abi:$,functionName:"admission",args:[c(s.rootV1),r],blockNumber:t}),e.readContract({address:c(s.registry),abi:te,functionName:"isRevokedAdmission",args:[c(s.rootV1),r],blockNumber:t})]);V=ne(w,p,y,h)}return{profile:p,codeHash:y,admission:V,inactive:u(T),warnings:p.warning?[p.warning]:[]}}function ce(e,t){let i=[{type:"uint16"},{type:"uint32"},{type:"uint32"},{type:"uint24"},{type:"bytes32"}];if(!e.supportsAge&&(t.minAge??0)!==0)throw new o("The legacy Hookr gate has no link-age rule.");return e.supportsAge?F([...i,{type:"uint32"}],[t.flags,t.minScore,t.tierScore,t.tierPips,t.reviewers,t.minAge??0]):F(i,[t.flags,t.minScore,t.tierScore,t.tierPips,t.reviewers])}async function pe(e,t,i={}){await k(e,t,[s.registry,s.rootV1]);let a=await e.readContract({address:c(s.registry),abi:$,functionName:"activeLaneOf",args:[c(s.rootV1)],blockNumber:t});if(!Array.isArray(a)||a.length!==4||typeof a[1]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(a[1]))throw new o("Hookr active executor read is incomplete.");let r=f(a[0]),n=a[1],g=d(a[2],32),O=d(a[3],16),y=C[r],p=r===c(s.recaptureExecutor)&&y?.codeHash===n,l=r!==m&&p&&g>=50000n&&g<=5000000n&&O<=2500n;if(l){let H=await e.getCode({address:r,blockNumber:t});l=!!H&&H!=="0x"&&D(H)===n}let b=i.hint&&f(i.hint)!==r?["Hookr executor hint differs from the chain; the chain result is used."]:[];if(l||b.push("Arb recapture on is unavailable: active executor or its caps are not in Oak\u2019s reviewed list. Recapture off remains available."),i.required&&!l)throw new o(b.join(" "));return{address:r,codeHash:n,gasCap:g.toString(),partnerBps:O.toString(),listed:p,allowed:l,source:"source not public",warnings:b}}export{q as a,N as b,U as c,M as d,K as e,L as f,ee as g,re as h,ne as i,de as j,ce as k,pe as l};
@@ -0,0 +1 @@
1
+ import{a as c,b as u,e as a}from"./45QP74CE.js";import{b as R}from"./3YNXQ3EZ.js";import{g as T}from"./IM7ZF7XZ.js";import{a as O,b as d,e as P}from"./GX2RCAHG.js";import{a as s,c as f,h as H}from"./XUDQYSPU.js";import{c as A}from"./6RVAV6BB.js";import{a as C}from"./ZTNBX4VH.js";import{d as L}from"./AZBTNUXF.js";import{a as h,b as m}from"./NUTTPUYJ.js";import{e as _}from"./3XY44BP5.js";import{m as n}from"./UMY6SP7C.js";import{a as k}from"./XSD5NL7J.js";var B=[...s,...O,"hookr_launch","hookr_action","hookr_revenue_action","hookr_addon_action","hookr_agent_link","hookr_reviewer_set","hookr_claim","hookr_swap",...c];async function F(o,r,i,p,e={}){if(f(o))return H(o,r,i,p);if(o==="hookr_swap")return _(r,i,p,e);if(u(o)){let t=await a(o,r,i,p,e);return{...t,terms:{...n(t.terms),gasLimits:t.txs.map(S=>S.gasLimit)}}}if(o==="hookr_agent_link")return h(r,i,p);if(o==="hookr_reviewer_set")return m(r,i,p);if(o==="hookr_claim")return A(r,i,p);if(d(o))return P(o,r,i,p);if(o==="hookr_launch")return T(r,i,p);if(o==="hookr_action")return L(r,i,p);if(o==="hookr_revenue_action")return R(r,i,p);if(o==="hookr_addon_action")return C(r,i,p);throw new k("This Hookr tool has no local action reconstruction.")}export{B as a,F as b};
@@ -1 +1 @@
1
- import{a as k}from"./A3PN3PK3.js";import{g as P}from"./NWNYJ26T.js";import{b}from"./TI727O2H.js";import{a as t}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{getAddress as w,parseAbi as L}from"viem";var v={one_hour:3600n,six_hours:21600n,one_day:86400n,seven_days:604800n,thirty_days:2592000n,ninety_days:7776000n,one_year:31536000n},g=L(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewRedeem(uint256) view returns (uint256)"]);async function C(u,o,i){let a=0n,s=i.number,e=await u.getBlock({blockNumber:a});if(e.timestamp>o)throw new t("Longbow has insufficient chain history for this window.");for(let n=0;a+1n<s&&n<64;n++){let r=(a+s)/2n,c=await u.getBlock({blockNumber:r});if(c.number!==r||c.timestamp<e.timestamp||c.timestamp>i.timestamp)throw new t("Longbow historical block response is inconsistent.");c.timestamp<=o?(a=r,e=c):s=r}if(a+1n<s||e.number!==a)throw new t("Longbow historical block search exceeded its bound.");return e}async function _(u,o,i,a="six_hours"){let s=v[a];if(!Object.hasOwn(v,a)||!s)throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let e=u.clientFor(b);if(await e.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let n=await e.getBlock({blockTag:"latest"});if(n.number===null||n.timestamp<s)throw new t("Longbow has insufficient chain history for this window.");let r=await C(e,n.timestamp-s,{number:n.number,timestamp:n.timestamp}),c=10n**27n,d=await Promise.all([r,n].map(async m=>{let[S,N,Y,f]=await Promise.all([e.readContract({address:o,abi:g,functionName:"asset",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:i.address,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"previewRedeem",args:[c],blockNumber:m.number})]);if(w(S)!==w(i.address)||N!==18||Y!==i.decimals||typeof f!="bigint"||f<0n||f>=1n<<256n)throw new t("Longbow historical share price or token metadata is unavailable or invalid. No zero rate was inferred.");return f})),h=n.timestamp-r.timestamp;if(h<=0n||h>s+300n)throw new t("Longbow historical blocks do not cover the requested APY window within 300 seconds.");if(d[0]===0n)throw new t("Longbow starting share price is zero; a realized APY cannot be calculated.");let l=Number(d[1]-d[0])/Number(d[0]),p=Math.expm1(Math.log1p(l)*31536e3/Number(h));if(!Number.isFinite(p))throw new t("Longbow annualized share-price change is outside the supported numeric range.");let y=await k(e,o,n.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},source:"Oak-computed on-chain",view:"apy",stale:!1,window:{lookback:a,requestedSeconds:s.toString(),elapsedSeconds:h.toString(),fromTimestamp:r.timestamp.toString(),toTimestamp:n.timestamp.toString(),fromBlock:r.number.toString(),toBlock:n.number.toString()},sharePrice:{shareUnits:c.toString(),startAssets:d[0].toString(),endAssets:d[1].toString(),assetDecimals:i.decimals},data:{annualYieldFraction:String(p),annualYieldPercent:String(p*100),lookback:a,basis:"Oak-computed realized APY: (end share price / start share price)^(31536000 / elapsed seconds) - 1, using ERC-4626 previewRedeem at two pinned blocks."},caveat:"Historical share-price change includes what the vault accounts for in previewRedeem, excludes external rewards and gas, and is not a promised return. Archive RPC history is required; missing history is not zero APY."}}async function I(u,o,i,a){if(Object.keys(a).some(d=>!["view","lookback"].includes(d)))throw new t("Longbow APY takes a lookback, not pagination.");let s=a.lookback??"six_hours";if(typeof s!="string"||!Object.hasOwn(v,s))throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let[e,n]=await Promise.allSettled([O(u,o,i,{view:"published_apy"}),_(u,o,i,s)]),r=e.status==="fulfilled"&&!e.value.stale?e.value:void 0;if(!r&&n.status==="rejected")throw new t(`Longbow APY is unavailable: the vendor figure is unavailable or stale, and the on-chain window could not be measured. ${u.plainError(n.reason)}`);return{...r??(n.status==="fulfilled"?n.value:void 0),view:"apy",shown:r?"Longbow vendor":"Oak-computed on-chain",realized:n.status==="fulfilled"?n.value:null,published:e.status==="fulfilled"?e.value:null,warnings:[...r?[]:["Longbow vendor APY is unavailable or stale; showing Oak-computed realized APY."],...n.status==="rejected"?["Oak-computed APY is unavailable: the archive RPC window could not be measured."]:[]]}}async function O(u,o,i,a){if(Object.keys(a).some(m=>m!=="view")||a.view!=="published_apy")throw new t("published_apy takes no historical lookback, cursor or limit.");let s=u.clientFor(b);if(await s.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let[e,n]=await Promise.all([s.getBlock(),s.readContract({address:o,abi:L(["function asset() view returns (address)"]),functionName:"asset"})]);if(w(n)!==w(i.address))throw new t("Longbow vault does not use the pinned asset.");let r="https://longbow.credit/api/v2/vaults",c=await u.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(15e3)});if(!c.ok)throw new t(`Longbow published APY HTTP ${c.status}; the rate is unavailable.`);let d=await c.json();if(!d||typeof d!="object"||!Number.isSafeInteger(d.asOf)||Number(d.asOf)<0||!Array.isArray(d.vaults)||d.vaults.length>100)throw new t("Longbow published APY response has an invalid timestamp or vault inventory.");let h=d.vaults.filter(m=>m&&typeof m=="object"&&typeof m.address=="string"&&P(String(m.address),o));if(h.length!==1)throw new t("Longbow published APY omitted or duplicated this vault; no zero rate is inferred.");let l=h[0];if(l.error||typeof l.asset!="string"||w(l.asset)!==w(i.address)||l.decimals!==i.decimals||typeof l.apy!="number"||!Number.isFinite(l.apy)||l.apy<-100||typeof l.apyBasis!="string"||l.apyBasis.length>64)throw new t("Longbow published APY asset, units, basis or rate is invalid.");let p=BigInt(Number(d.asOf)),y=await k(s,o,e.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},sourceUrl:r,view:"published_apy",asOf:p.toString(),stale:e.timestamp>p+900n||p>e.timestamp+60n,data:{annualYieldPercent:String(l.apy),annualYieldFraction:String(l.apy/100),basis:A(l.apyBasis)},caveat:"Longbow publisher quote, not a realized Morpho lookback series or a promised return. The app formats this field directly as percent (0.03 means 0.03%, not 3%). No bonus, future payout or fee inclusion is inferred. Onchain book and fees remain available through longbow_details."}}export{_ as a,I as b,O as c};
1
+ import{a as k}from"./A3PN3PK3.js";import{g as P}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as t}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{getAddress as w,parseAbi as L}from"viem";var v={one_hour:3600n,six_hours:21600n,one_day:86400n,seven_days:604800n,thirty_days:2592000n,ninety_days:7776000n,one_year:31536000n},g=L(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewRedeem(uint256) view returns (uint256)"]);async function C(u,o,i){let a=0n,s=i.number,e=await u.getBlock({blockNumber:a});if(e.timestamp>o)throw new t("Longbow has insufficient chain history for this window.");for(let n=0;a+1n<s&&n<64;n++){let r=(a+s)/2n,c=await u.getBlock({blockNumber:r});if(c.number!==r||c.timestamp<e.timestamp||c.timestamp>i.timestamp)throw new t("Longbow historical block response is inconsistent.");c.timestamp<=o?(a=r,e=c):s=r}if(a+1n<s||e.number!==a)throw new t("Longbow historical block search exceeded its bound.");return e}async function _(u,o,i,a="six_hours"){let s=v[a];if(!Object.hasOwn(v,a)||!s)throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let e=u.clientFor(b);if(await e.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let n=await e.getBlock({blockTag:"latest"});if(n.number===null||n.timestamp<s)throw new t("Longbow has insufficient chain history for this window.");let r=await C(e,n.timestamp-s,{number:n.number,timestamp:n.timestamp}),c=10n**27n,d=await Promise.all([r,n].map(async m=>{let[S,N,Y,f]=await Promise.all([e.readContract({address:o,abi:g,functionName:"asset",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:i.address,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"previewRedeem",args:[c],blockNumber:m.number})]);if(w(S)!==w(i.address)||N!==18||Y!==i.decimals||typeof f!="bigint"||f<0n||f>=1n<<256n)throw new t("Longbow historical share price or token metadata is unavailable or invalid. No zero rate was inferred.");return f})),h=n.timestamp-r.timestamp;if(h<=0n||h>s+300n)throw new t("Longbow historical blocks do not cover the requested APY window within 300 seconds.");if(d[0]===0n)throw new t("Longbow starting share price is zero; a realized APY cannot be calculated.");let l=Number(d[1]-d[0])/Number(d[0]),p=Math.expm1(Math.log1p(l)*31536e3/Number(h));if(!Number.isFinite(p))throw new t("Longbow annualized share-price change is outside the supported numeric range.");let y=await k(e,o,n.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},source:"Oak-computed on-chain",view:"apy",stale:!1,window:{lookback:a,requestedSeconds:s.toString(),elapsedSeconds:h.toString(),fromTimestamp:r.timestamp.toString(),toTimestamp:n.timestamp.toString(),fromBlock:r.number.toString(),toBlock:n.number.toString()},sharePrice:{shareUnits:c.toString(),startAssets:d[0].toString(),endAssets:d[1].toString(),assetDecimals:i.decimals},data:{annualYieldFraction:String(p),annualYieldPercent:String(p*100),lookback:a,basis:"Oak-computed realized APY: (end share price / start share price)^(31536000 / elapsed seconds) - 1, using ERC-4626 previewRedeem at two pinned blocks."},caveat:"Historical share-price change includes what the vault accounts for in previewRedeem, excludes external rewards and gas, and is not a promised return. Archive RPC history is required; missing history is not zero APY."}}async function I(u,o,i,a){if(Object.keys(a).some(d=>!["view","lookback"].includes(d)))throw new t("Longbow APY takes a lookback, not pagination.");let s=a.lookback??"six_hours";if(typeof s!="string"||!Object.hasOwn(v,s))throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let[e,n]=await Promise.allSettled([O(u,o,i,{view:"published_apy"}),_(u,o,i,s)]),r=e.status==="fulfilled"&&!e.value.stale?e.value:void 0;if(!r&&n.status==="rejected")throw new t(`Longbow APY is unavailable: the vendor figure is unavailable or stale, and the on-chain window could not be measured. ${u.plainError(n.reason)}`);return{...r??(n.status==="fulfilled"?n.value:void 0),view:"apy",shown:r?"Longbow vendor":"Oak-computed on-chain",realized:n.status==="fulfilled"?n.value:null,published:e.status==="fulfilled"?e.value:null,warnings:[...r?[]:["Longbow vendor APY is unavailable or stale; showing Oak-computed realized APY."],...n.status==="rejected"?["Oak-computed APY is unavailable: the archive RPC window could not be measured."]:[]]}}async function O(u,o,i,a){if(Object.keys(a).some(m=>m!=="view")||a.view!=="published_apy")throw new t("published_apy takes no historical lookback, cursor or limit.");let s=u.clientFor(b);if(await s.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let[e,n]=await Promise.all([s.getBlock(),s.readContract({address:o,abi:L(["function asset() view returns (address)"]),functionName:"asset"})]);if(w(n)!==w(i.address))throw new t("Longbow vault does not use the pinned asset.");let r="https://longbow.credit/api/v2/vaults",c=await u.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(15e3)});if(!c.ok)throw new t(`Longbow published APY HTTP ${c.status}; the rate is unavailable.`);let d=await c.json();if(!d||typeof d!="object"||!Number.isSafeInteger(d.asOf)||Number(d.asOf)<0||!Array.isArray(d.vaults)||d.vaults.length>100)throw new t("Longbow published APY response has an invalid timestamp or vault inventory.");let h=d.vaults.filter(m=>m&&typeof m=="object"&&typeof m.address=="string"&&P(String(m.address),o));if(h.length!==1)throw new t("Longbow published APY omitted or duplicated this vault; no zero rate is inferred.");let l=h[0];if(l.error||typeof l.asset!="string"||w(l.asset)!==w(i.address)||l.decimals!==i.decimals||typeof l.apy!="number"||!Number.isFinite(l.apy)||l.apy<-100||typeof l.apyBasis!="string"||l.apyBasis.length>64)throw new t("Longbow published APY asset, units, basis or rate is invalid.");let p=BigInt(Number(d.asOf)),y=await k(s,o,e.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},sourceUrl:r,view:"published_apy",asOf:p.toString(),stale:e.timestamp>p+900n||p>e.timestamp+60n,data:{annualYieldPercent:String(l.apy),annualYieldFraction:String(l.apy/100),basis:A(l.apyBasis)},caveat:"Longbow publisher quote, not a realized Morpho lookback series or a promised return. The app formats this field directly as percent (0.03 means 0.03%, not 3%). No bonus, future payout or fee inclusion is inferred. Onchain book and fees remain available through longbow_details."}}export{_ as a,I as b,O as c};
@@ -1 +1 @@
1
- import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./VVAM3EAK.js";import{a as _,b as D}from"./43LI5NKJ.js";import{b as B,c as G,d as O}from"./IOYRL6AY.js";import{b as R,c as M,j as U,t as E}from"./TI727O2H.js";import{a as m,b as H,c as I,e as S}from"./XSD5NL7J.js";import{decodeFunctionResult as ee,encodeFunctionData as te,erc20Abi as V,getAddress as L,isAddress as ne,toEventSelector as re,toHex as T,zeroAddress as se}from"viem";var C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function ae(e){let s=e.toLowerCase();return s===se||s===C?C:e}var oe=re("Transfer(address,address,uint256)"),W="Preview note: simulation transfer-based token changes exclude gas and do not prove external settlement.";function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function x(){throw new m("The endpoint returned an unexpected simulation response.")}function j(e,s,l){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s+l)&&x();let d=e[0].calls,a=d.slice(0,s).map(n=>{if(!p(n)||n.status!=="0x1"||n.error||!Array.isArray(n.logs)||n.logs.length!==0||typeof n.returnData!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n.returnData))throw new m("Preview auxiliary read failed or returned invalid data.");return n.returnData});return{result:[{calls:d.slice(s)}],readResults:a}}async function N(e,s,l,d){let a=await e.getChainId();if(a!==s)throw new m(`Preview is on chain ${s}, but the endpoint reports chain ${a}.`);let n=await z(e),t=await K(e,n);if(n.number===null||typeof n.baseFeePerGas!="bigint"||n.baseFeePerGas<0n||typeof t!="bigint"||t<0n)throw new m("Current block base fee and gas price are unavailable or inconsistent. Retry the preview.");let r=t<n.baseFeePerGas?n.baseFeePerGas:t,A=B(n.gasLimit),c=l.map(u=>({from:d,to:u.to,data:u.data,value:T(BigInt(u.value)),gasPrice:T(r),gas:T(A)})),y=()=>e.request({method:"eth_simulateV1",params:[{blockStateCalls:[{blockOverrides:{baseFeePerGas:T(n.baseFeePerGas)},calls:c}],validation:!1,traceTransfers:!0},T(n.number)]},{retryCount:0});try{return await y()}catch(u){if(!I(u))throw u;let g=await e.getBalance({address:d,blockNumber:n.number}),w=await Promise.all(l.map(o=>e.estimateGas({account:d,to:o.to,data:o.data,value:BigInt(o.value),gas:A,blockNumber:n.number}).catch(()=>{}))),k=g;for(let[o,i]of c.entries()){let f=BigInt(i.value),F=O(B(n.gasLimit,w[o]),k,f,r,d,s),h=w[o];if(h!==void 0&&h>F)throw new m(G(d,s,g-k+f+h*r,g));i.gas=T(F),k-=f}let v=await y();if(Array.isArray(v)&&p(v[0])&&Array.isArray(v[0].calls))for(let[o,i]of v[0].calls.entries()){let f=c[o];if(f&&p(i)&&i.status==="0x0"&&typeof i.gasUsed=="string"&&/^0x[0-9a-f]+$/i.test(i.gasUsed)&&BigInt(i.gasUsed)>=BigInt(f.gas))throw new m(G(d,s,BigInt(f.value)+(BigInt(f.gas)+1n)*r,g))}return v}}function J(e,s,l,d){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s)&&x();let a=new Map;for(let[n,t]of e[0].calls.entries()){if(p(t)||x(),t.status==="0x0")throw new m(`Preview call ${n+1} on chain ${d} reverted. ${S(t.error)}`);(t.status!=="0x1"||t.error||!Array.isArray(t.logs))&&x();for(let r of t.logs){if((!p(r)||!Array.isArray(r.topics))&&x(),typeof r.topics[0]!="string"||r.topics[0].toLowerCase()!==oe||r.topics.length===4)continue;(r.topics.length!==3||typeof r.address!="string"||!ne(r.address,{strict:!1})||typeof r.data!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r.data)||!r.topics.slice(1).every(w=>typeof w=="string"&&/^0x0{24}[0-9a-fA-F]{40}$/.test(w)))&&x();let A=r.topics[1].slice(-40).toLowerCase(),c=r.topics[2].slice(-40).toLowerCase(),y=l.slice(2).toLowerCase(),u=BigInt(r.data),g=(c===y?u:0n)-(A===y?u:0n);if(g!==0n){let w=ae(r.address.toLowerCase());a.set(w,(a.get(w)??0n)+g)}}}return a}async function Q(e,s,l,d){let a=s===R?E.mainnet:s===M?E.testnet:void 0,n=a&&[{address:a.usdg,symbol:"USDG",decimals:6},{address:a.weth,symbol:"WETH",decimals:18},...s===R?[{address:U[4663].meridian.CollateralToken_USDe.address,symbol:"USDe",decimals:18}]:[]].find(r=>r.address.toLowerCase()===e);if(n)return{...n,address:L(e),chainId:s};let t;if(e===C){let r=l.chain?.nativeCurrency??(s===4663?{symbol:"ETH",decimals:18}:void 0);if(!r)throw new m(`Native token metadata is unavailable for chain ${s}.`);t={address:e,chainId:s,symbol:r.symbol,decimals:r.decimals}}else if(d)t=await d(e,s,l);else{let r=await q(l,s,e,"decimals");t={address:e,chainId:s,symbol:e,decimals:r}}if(!t||typeof t.address!="string"||t.address.toLowerCase()!==e||t.chainId!==s||typeof t.symbol!="string"||!t.symbol.trim()||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new m(`Invalid token metadata for ${e} on chain ${s}.`);return{address:e===C?e:L(e),chainId:s,symbol:e===C?t.symbol:L(e),decimals:t.decimals}}function ge(e){return async(s,l,d)=>{_(l);let a=s.map(D),n=(d?.reads??[]).map(c=>D({...c,value:"0",description:"Read before simulated transactions."})),t=a[0]?.chainId;if(t===void 0&&n.length)throw new m("Preview auxiliary reads require a transaction bundle.");if(t===void 0)return{txs:a,changes:[],summary:W};let r=[...n,...a].find(c=>c.chainId!==t);if(r)throw new m(`Preview cannot combine chain ${t} with chain ${r.chainId}. Preview each chain separately.`);let A=n.length?[...n,...a]:a;try{let c=e.clientFor(t),y;try{y=await N(c,t,A,l)}catch(o){if(!H(o,-32601,-32004)||!e.anvilFor)throw o;c=await e.anvilFor(t),y=await N(c,t,A,l)}let u;n.length&&({result:y,readResults:u}=j(y,n.length,a.length));let g=J(y,a.length,l,t),w=new Map,k=[];for(let[o,i]of g)if(i!==0n)try{w.set(o,await Q(o,t,c,e.tokenFor))}catch(f){if(o===C||e.tokenFor||(await c.getCode({address:o})??"0x")!=="0x")throw f;k.push(o)}if(k.length){let o=k.flatMap(h=>["symbol","decimals"].map(b=>D({to:h,data:te({abi:V,functionName:b}),value:"0",chainId:t,description:`Read simulated token ${b}.`}))),i=await N(c,t,[...A,...o],l);if(u){let h=j(i,u.length,a.length+o.length);if(h.readResults.some((b,$)=>b!==u[$]))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");i=h.result}(!Array.isArray(i)||i.length!==1||!p(i[0])||!Array.isArray(i[0].calls)||i[0].calls.length!==a.length+o.length)&&x();let f=i[0].calls,F=J([{calls:f.slice(0,a.length)}],a.length,l,t);if(g.size!==F.size||[...g].some(([h,b])=>F.get(h)!==b))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");for(let[h,b]of k.entries()){let $=(Y,Z)=>{let P=f[a.length+h*2+Z];if(!p(P)||P.status!=="0x1"||P.error||typeof P.returnData!="string"||!/^0x[0-9a-fA-F]+$/.test(P.returnData))throw new m(`Invalid simulated token metadata for ${b} on chain ${t}.`);return ee({abi:V,functionName:Y,data:P.returnData})},X={address:b,chainId:t,symbol:$("symbol",0),decimals:$("decimals",1)};w.set(b,await Q(b,t,c,async()=>X))}}let v=[...g].filter(([,o])=>o!==0n).map(([o,i])=>({token:w.get(o),amount:i.toString()}));return{txs:a,changes:v,summary:W,...u?{readResults:u}:{}}}catch(c){throw new m(`Preview on chain ${t} failed: ${S(c)}`)}}}export{C as a,ae as b,ge as c};
1
+ import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./5N6YJFFA.js";import{a as _,b as D}from"./43LI5NKJ.js";import{b as B,c as G,d as O}from"./IOYRL6AY.js";import{b as R,c as M,j as U,t as E}from"./EWZFZUVF.js";import{a as m,b as H,c as I,e as S}from"./XSD5NL7J.js";import{decodeFunctionResult as ee,encodeFunctionData as te,erc20Abi as V,getAddress as L,isAddress as ne,toEventSelector as re,toHex as T,zeroAddress as se}from"viem";var C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function ae(e){let s=e.toLowerCase();return s===se||s===C?C:e}var oe=re("Transfer(address,address,uint256)"),W="Preview note: simulation transfer-based token changes exclude gas and do not prove external settlement.";function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function x(){throw new m("The endpoint returned an unexpected simulation response.")}function j(e,s,l){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s+l)&&x();let d=e[0].calls,a=d.slice(0,s).map(n=>{if(!p(n)||n.status!=="0x1"||n.error||!Array.isArray(n.logs)||n.logs.length!==0||typeof n.returnData!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n.returnData))throw new m("Preview auxiliary read failed or returned invalid data.");return n.returnData});return{result:[{calls:d.slice(s)}],readResults:a}}async function N(e,s,l,d){let a=await e.getChainId();if(a!==s)throw new m(`Preview is on chain ${s}, but the endpoint reports chain ${a}.`);let n=await z(e),t=await K(e,n);if(n.number===null||typeof n.baseFeePerGas!="bigint"||n.baseFeePerGas<0n||typeof t!="bigint"||t<0n)throw new m("Current block base fee and gas price are unavailable or inconsistent. Retry the preview.");let r=t<n.baseFeePerGas?n.baseFeePerGas:t,A=B(n.gasLimit),c=l.map(u=>({from:d,to:u.to,data:u.data,value:T(BigInt(u.value)),gasPrice:T(r),gas:T(A)})),y=()=>e.request({method:"eth_simulateV1",params:[{blockStateCalls:[{blockOverrides:{baseFeePerGas:T(n.baseFeePerGas)},calls:c}],validation:!1,traceTransfers:!0},T(n.number)]},{retryCount:0});try{return await y()}catch(u){if(!I(u))throw u;let g=await e.getBalance({address:d,blockNumber:n.number}),w=await Promise.all(l.map(o=>e.estimateGas({account:d,to:o.to,data:o.data,value:BigInt(o.value),gas:A,blockNumber:n.number}).catch(()=>{}))),k=g;for(let[o,i]of c.entries()){let f=BigInt(i.value),F=O(B(n.gasLimit,w[o]),k,f,r,d,s),h=w[o];if(h!==void 0&&h>F)throw new m(G(d,s,g-k+f+h*r,g));i.gas=T(F),k-=f}let v=await y();if(Array.isArray(v)&&p(v[0])&&Array.isArray(v[0].calls))for(let[o,i]of v[0].calls.entries()){let f=c[o];if(f&&p(i)&&i.status==="0x0"&&typeof i.gasUsed=="string"&&/^0x[0-9a-f]+$/i.test(i.gasUsed)&&BigInt(i.gasUsed)>=BigInt(f.gas))throw new m(G(d,s,BigInt(f.value)+(BigInt(f.gas)+1n)*r,g))}return v}}function J(e,s,l,d){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s)&&x();let a=new Map;for(let[n,t]of e[0].calls.entries()){if(p(t)||x(),t.status==="0x0")throw new m(`Preview call ${n+1} on chain ${d} reverted. ${S(t.error)}`);(t.status!=="0x1"||t.error||!Array.isArray(t.logs))&&x();for(let r of t.logs){if((!p(r)||!Array.isArray(r.topics))&&x(),typeof r.topics[0]!="string"||r.topics[0].toLowerCase()!==oe||r.topics.length===4)continue;(r.topics.length!==3||typeof r.address!="string"||!ne(r.address,{strict:!1})||typeof r.data!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r.data)||!r.topics.slice(1).every(w=>typeof w=="string"&&/^0x0{24}[0-9a-fA-F]{40}$/.test(w)))&&x();let A=r.topics[1].slice(-40).toLowerCase(),c=r.topics[2].slice(-40).toLowerCase(),y=l.slice(2).toLowerCase(),u=BigInt(r.data),g=(c===y?u:0n)-(A===y?u:0n);if(g!==0n){let w=ae(r.address.toLowerCase());a.set(w,(a.get(w)??0n)+g)}}}return a}async function Q(e,s,l,d){let a=s===R?E.mainnet:s===M?E.testnet:void 0,n=a&&[{address:a.usdg,symbol:"USDG",decimals:6},{address:a.weth,symbol:"WETH",decimals:18},...s===R?[{address:U[4663].meridian.CollateralToken_USDe.address,symbol:"USDe",decimals:18}]:[]].find(r=>r.address.toLowerCase()===e);if(n)return{...n,address:L(e),chainId:s};let t;if(e===C){let r=l.chain?.nativeCurrency??(s===4663?{symbol:"ETH",decimals:18}:void 0);if(!r)throw new m(`Native token metadata is unavailable for chain ${s}.`);t={address:e,chainId:s,symbol:r.symbol,decimals:r.decimals}}else if(d)t=await d(e,s,l);else{let r=await q(l,s,e,"decimals");t={address:e,chainId:s,symbol:e,decimals:r}}if(!t||typeof t.address!="string"||t.address.toLowerCase()!==e||t.chainId!==s||typeof t.symbol!="string"||!t.symbol.trim()||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new m(`Invalid token metadata for ${e} on chain ${s}.`);return{address:e===C?e:L(e),chainId:s,symbol:e===C?t.symbol:L(e),decimals:t.decimals}}function ge(e){return async(s,l,d)=>{_(l);let a=s.map(D),n=(d?.reads??[]).map(c=>D({...c,value:"0",description:"Read before simulated transactions."})),t=a[0]?.chainId;if(t===void 0&&n.length)throw new m("Preview auxiliary reads require a transaction bundle.");if(t===void 0)return{txs:a,changes:[],summary:W};let r=[...n,...a].find(c=>c.chainId!==t);if(r)throw new m(`Preview cannot combine chain ${t} with chain ${r.chainId}. Preview each chain separately.`);let A=n.length?[...n,...a]:a;try{let c=e.clientFor(t),y;try{y=await N(c,t,A,l)}catch(o){if(!H(o,-32601,-32004)||!e.anvilFor)throw o;c=await e.anvilFor(t),y=await N(c,t,A,l)}let u;n.length&&({result:y,readResults:u}=j(y,n.length,a.length));let g=J(y,a.length,l,t),w=new Map,k=[];for(let[o,i]of g)if(i!==0n)try{w.set(o,await Q(o,t,c,e.tokenFor))}catch(f){if(o===C||e.tokenFor||(await c.getCode({address:o})??"0x")!=="0x")throw f;k.push(o)}if(k.length){let o=k.flatMap(h=>["symbol","decimals"].map(b=>D({to:h,data:te({abi:V,functionName:b}),value:"0",chainId:t,description:`Read simulated token ${b}.`}))),i=await N(c,t,[...A,...o],l);if(u){let h=j(i,u.length,a.length+o.length);if(h.readResults.some((b,$)=>b!==u[$]))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");i=h.result}(!Array.isArray(i)||i.length!==1||!p(i[0])||!Array.isArray(i[0].calls)||i[0].calls.length!==a.length+o.length)&&x();let f=i[0].calls,F=J([{calls:f.slice(0,a.length)}],a.length,l,t);if(g.size!==F.size||[...g].some(([h,b])=>F.get(h)!==b))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");for(let[h,b]of k.entries()){let $=(Y,Z)=>{let P=f[a.length+h*2+Z];if(!p(P)||P.status!=="0x1"||P.error||typeof P.returnData!="string"||!/^0x[0-9a-fA-F]+$/.test(P.returnData))throw new m(`Invalid simulated token metadata for ${b} on chain ${t}.`);return ee({abi:V,functionName:Y,data:P.returnData})},X={address:b,chainId:t,symbol:$("symbol",0),decimals:$("decimals",1)};w.set(b,await Q(b,t,c,async()=>X))}}let v=[...g].filter(([,o])=>o!==0n).map(([o,i])=>({token:w.get(o),amount:i.toString()}));return{txs:a,changes:v,summary:W,...u?{readResults:u}:{}}}catch(c){throw new m(`Preview on chain ${t} failed: ${S(c)}`)}}}export{C as a,ae as b,ge as c};
@@ -1 +1 @@
1
- import{a as u}from"./YXXK6EPI.js";import{L as P}from"./SYERFEJ4.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};
@@ -1,4 +1,4 @@
1
- import{e as i}from"./NWNYJ26T.js";import{a as P}from"./XSD5NL7J.js";import{a as O}from"./JXOEJPJ4.js";var E="https://mcp.fobo.fun/mcp",k="2025-03-26",F=4*1024*1024,t=m=>new P(`FOBO ${m}. Nothing was signed. Please try again.`);function q(m={}){let v=m.fetch??globalThis.fetch,y=m.endpoint??E,b=m.timeoutMs??3e4;if(!Number.isSafeInteger(b)||b<=0)throw t("timeout must be a positive number of milliseconds");let d,c=k,x=0,h=!1,a,n=new Set;async function w(o,s,e,l="POST",r=!1){let u=new AbortController;n.add(u);let S,C=++x,A=new Promise((g,f)=>{S=setTimeout(()=>{f(t("request timed out")),u.abort()},b)});try{return await Promise.race([A,(async()=>{let g={"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":c};e&&(g["Mcp-Session-Id"]=e);let f=await v(y,{method:l,headers:g,signal:u.signal,...l==="POST"?{body:JSON.stringify({jsonrpc:"2.0",...r?{}:{id:C},method:o,params:s})}:{}});if(l==="DELETE"&&(f.ok||f.status===405||f.status===404))return{};if(r){if(!f.ok)throw t("session initialization was refused");return await f.body?.cancel(),{}}let R=await M(f,C);if(!f.ok&&R.error?.code!==-32e3)throw t("service is unavailable");return{rpc:R,session:f.headers.get("Mcp-Session-Id")??void 0}})()])}catch(g){throw g instanceof P?g:t("could not be reached")}finally{clearTimeout(S),n.delete(u),u.abort()}}async function T(){if(h)throw t("client is closed");d||(a||(a=(async()=>{let o=await w("initialize",{protocolVersion:k,capabilities:{},clientInfo:{name:"oak",version:"0.3.4"}});if(o.rpc?.error||!o.session||!i(o.rpc?.result))throw t("did not provide an MCP session");let s=o.rpc.result.protocolVersion;if(typeof s=="string"){if(!["2025-03-26","2025-06-18","2025-11-25"].includes(s))throw t("MCP protocol version is unsupported");c=s}if(h)throw t("client is closed");await w("notifications/initialized",{},o.session,"POST",!0),d=o.session})().finally(()=>{a=void 0})),await a)}async function p(o,s){await T();for(let e=0;e<2;e++){if(h)throw t("client is closed");let l=d,{rpc:r}=await w(o,s,l);if(r?.error?.code===-32e3){if(e===1)throw t("session expired");d===l&&(d=void 0),await T();continue}if(!r||r.error)throw t("request was refused");return r.result}throw t("session expired")}return{async listTools(){let o=[],s=new Set,e;for(let l=0;l<20;l++){let r=await p("tools/list",e?{cursor:e}:{});if(!i(r)||!Array.isArray(r.tools))throw t("returned an invalid tool list");for(let u of r.tools){if(!i(u)||typeof u.name!="string"||!i(u.inputSchema))throw t("returned an invalid tool schema");o.push({name:u.name,inputSchema:u.inputSchema})}if(r.nextCursor===void 0)return o;if(typeof r.nextCursor!="string"||!r.nextCursor||s.has(r.nextCursor))throw t("returned an invalid tool list cursor");e=r.nextCursor,s.add(e)}throw t("tool list has too many pages")},async call(o,s){let e=await p("tools/call",{name:o,arguments:s});if(i(e)&&e.isError===!0){let l=Array.isArray(e.content)?e.content.filter(i).filter(r=>r.type==="text"&&typeof r.text=="string").map(r=>r.text).join(" "):"";throw new P(`FOBO refused the request: ${O(l||"The tool returned an error.")}. Nothing was signed. Ask for a fresh summary.`)}if(i(e)&&i(e.structuredContent))return e.structuredContent;if(i(e)&&"content"in e){if(!Array.isArray(e.content)||e.content.length!==1||!i(e.content[0])||e.content[0].type!=="text"||typeof e.content[0].text!="string")throw t("returned an unsupported tool answer");try{return JSON.parse(e.content[0].text)}catch{throw t("returned an unreadable tool answer")}}return e},async close(){if(h)return;h=!0;for(let s of n)s.abort();let o=d;d=void 0,o&&await w("",{},o,"DELETE")}}}async function M(m,v){let y=m.body?.getReader();if(!y)throw t("returned an empty response");let b=new TextDecoder,d=m.headers.get("Content-Type")?.includes("text/event-stream"),c="",x=0,h=a=>{let n;try{n=JSON.parse(a)}catch{throw t("returned an unreadable response")}if(!i(n)||n.jsonrpc!=="2.0")throw t("returned an invalid response");if(!(d&&!("id"in n)&&typeof n.method=="string")){if(n.id!==v||"result"in n=="error"in n||"error"in n&&(!i(n.error)||typeof n.error.code!="number"))throw t("returned an invalid response");return n}};try{for(;;){let a=await y.read();if(x+=a.value?.length??0,x>F)throw t("response is too large");if(c+=b.decode(a.value,{stream:!a.done}),d){c=c.replace(/\r\n/g,`
1
+ import{e as i}from"./NWNYJ26T.js";import{a as P}from"./XSD5NL7J.js";import{a as O}from"./JXOEJPJ4.js";var E="https://mcp.fobo.fun/mcp",k="2025-03-26",F=4*1024*1024,t=m=>new P(`FOBO ${m}. Nothing was signed. Please try again.`);function q(m={}){let v=m.fetch??globalThis.fetch,y=m.endpoint??E,b=m.timeoutMs??3e4;if(!Number.isSafeInteger(b)||b<=0)throw t("timeout must be a positive number of milliseconds");let d,c=k,x=0,h=!1,a,n=new Set;async function w(o,s,e,l="POST",r=!1){let u=new AbortController;n.add(u);let S,C=++x,A=new Promise((g,f)=>{S=setTimeout(()=>{f(t("request timed out")),u.abort()},b)});try{return await Promise.race([A,(async()=>{let g={"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":c};e&&(g["Mcp-Session-Id"]=e);let f=await v(y,{method:l,headers:g,signal:u.signal,...l==="POST"?{body:JSON.stringify({jsonrpc:"2.0",...r?{}:{id:C},method:o,params:s})}:{}});if(l==="DELETE"&&(f.ok||f.status===405||f.status===404))return{};if(r){if(!f.ok)throw t("session initialization was refused");return await f.body?.cancel(),{}}let R=await M(f,C);if(!f.ok&&R.error?.code!==-32e3)throw t("service is unavailable");return{rpc:R,session:f.headers.get("Mcp-Session-Id")??void 0}})()])}catch(g){throw g instanceof P?g:t("could not be reached")}finally{clearTimeout(S),n.delete(u),u.abort()}}async function T(){if(h)throw t("client is closed");d||(a||(a=(async()=>{let o=await w("initialize",{protocolVersion:k,capabilities:{},clientInfo:{name:"oak",version:"0.3.5"}});if(o.rpc?.error||!o.session||!i(o.rpc?.result))throw t("did not provide an MCP session");let s=o.rpc.result.protocolVersion;if(typeof s=="string"){if(!["2025-03-26","2025-06-18","2025-11-25"].includes(s))throw t("MCP protocol version is unsupported");c=s}if(h)throw t("client is closed");await w("notifications/initialized",{},o.session,"POST",!0),d=o.session})().finally(()=>{a=void 0})),await a)}async function p(o,s){await T();for(let e=0;e<2;e++){if(h)throw t("client is closed");let l=d,{rpc:r}=await w(o,s,l);if(r?.error?.code===-32e3){if(e===1)throw t("session expired");d===l&&(d=void 0),await T();continue}if(!r||r.error)throw t("request was refused");return r.result}throw t("session expired")}return{async listTools(){let o=[],s=new Set,e;for(let l=0;l<20;l++){let r=await p("tools/list",e?{cursor:e}:{});if(!i(r)||!Array.isArray(r.tools))throw t("returned an invalid tool list");for(let u of r.tools){if(!i(u)||typeof u.name!="string"||!i(u.inputSchema))throw t("returned an invalid tool schema");o.push({name:u.name,inputSchema:u.inputSchema})}if(r.nextCursor===void 0)return o;if(typeof r.nextCursor!="string"||!r.nextCursor||s.has(r.nextCursor))throw t("returned an invalid tool list cursor");e=r.nextCursor,s.add(e)}throw t("tool list has too many pages")},async call(o,s){let e=await p("tools/call",{name:o,arguments:s});if(i(e)&&e.isError===!0){let l=Array.isArray(e.content)?e.content.filter(i).filter(r=>r.type==="text"&&typeof r.text=="string").map(r=>r.text).join(" "):"";throw new P(`FOBO refused the request: ${O(l||"The tool returned an error.")}. Nothing was signed. Ask for a fresh summary.`)}if(i(e)&&i(e.structuredContent))return e.structuredContent;if(i(e)&&"content"in e){if(!Array.isArray(e.content)||e.content.length!==1||!i(e.content[0])||e.content[0].type!=="text"||typeof e.content[0].text!="string")throw t("returned an unsupported tool answer");try{return JSON.parse(e.content[0].text)}catch{throw t("returned an unreadable tool answer")}}return e},async close(){if(h)return;h=!0;for(let s of n)s.abort();let o=d;d=void 0,o&&await w("",{},o,"DELETE")}}}async function M(m,v){let y=m.body?.getReader();if(!y)throw t("returned an empty response");let b=new TextDecoder,d=m.headers.get("Content-Type")?.includes("text/event-stream"),c="",x=0,h=a=>{let n;try{n=JSON.parse(a)}catch{throw t("returned an unreadable response")}if(!i(n)||n.jsonrpc!=="2.0")throw t("returned an invalid response");if(!(d&&!("id"in n)&&typeof n.method=="string")){if(n.id!==v||"result"in n=="error"in n||"error"in n&&(!i(n.error)||typeof n.error.code!="number"))throw t("returned an invalid response");return n}};try{for(;;){let a=await y.read();if(x+=a.value?.length??0,x>F)throw t("response is too large");if(c+=b.decode(a.value,{stream:!a.done}),d){c=c.replace(/\r\n/g,`
2
2
  `);let n;for(;(n=c.indexOf(`
3
3
 
4
4
  `))!==-1;){let w=c.slice(0,n);c=c.slice(n+2);let T=w.split(`
@@ -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{e as S}from"./NMJVQX5M.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{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};