@oakagentkit/core 0.2.3 → 0.2.4

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 (535) hide show
  1. package/build/dist/api/addresses.d.ts +112 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/amounts.js +1 -1
  4. package/build/dist/api/args.js +1 -1
  5. package/build/dist/api/cache.js +1 -1
  6. package/build/dist/api/canonical.js +1 -1
  7. package/build/dist/api/chain.js +1 -1
  8. package/build/dist/api/deployments.js +1 -1
  9. package/build/dist/api/errors.d.ts +1 -0
  10. package/build/dist/api/errors.js +1 -1
  11. package/build/dist/api/gas.js +1 -1
  12. package/build/dist/api/grandfather.js +1 -1
  13. package/build/dist/api/guards.js +1 -1
  14. package/build/dist/api/history.js +1 -1
  15. package/build/dist/api/http.js +1 -1
  16. package/build/dist/api/identity-link.d.ts +1 -0
  17. package/build/dist/api/identity-link.js +1 -1
  18. package/build/dist/api/launch.js +1 -1
  19. package/build/dist/api/merkle.js +1 -1
  20. package/build/dist/api/metadata.js +1 -1
  21. package/build/dist/api/module.js +1 -1
  22. package/build/dist/api/modules/beefy/boosts.js +1 -1
  23. package/build/dist/api/modules/beefy/clm.js +1 -1
  24. package/build/dist/api/modules/beefy/guard.js +1 -1
  25. package/build/dist/api/modules/beefy/index.js +1 -1
  26. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  27. package/build/dist/api/modules/beefy/management.js +1 -1
  28. package/build/dist/api/modules/beefy/vaults.js +1 -1
  29. package/build/dist/api/modules/clanker/extensions.js +1 -1
  30. package/build/dist/api/modules/clanker/index.js +1 -1
  31. package/build/dist/api/modules/clanker/manage.js +1 -1
  32. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  33. package/build/dist/api/modules/clanker/protocol.js +1 -1
  34. package/build/dist/api/modules/clanker/state.js +1 -1
  35. package/build/dist/api/modules/earn/copy.d.ts +114 -0
  36. package/build/dist/api/modules/earn/copy.js +1 -0
  37. package/build/dist/api/modules/earn/cost.d.ts +47 -0
  38. package/build/dist/api/modules/earn/cost.js +1 -0
  39. package/build/dist/api/modules/earn/index.d.ts +8 -0
  40. package/build/dist/api/modules/earn/index.js +1 -0
  41. package/build/dist/api/modules/earn/lp.d.ts +17 -0
  42. package/build/dist/api/modules/earn/lp.js +1 -0
  43. package/build/dist/api/modules/earn/options.d.ts +36 -0
  44. package/build/dist/api/modules/earn/options.js +1 -0
  45. package/build/dist/api/modules/earn/types.d.ts +39 -0
  46. package/build/dist/api/modules/earn/types.js +0 -0
  47. package/build/dist/api/modules/erc8004/abi.js +1 -1
  48. package/build/dist/api/modules/erc8004/common.js +1 -1
  49. package/build/dist/api/modules/erc8004/domain.js +1 -1
  50. package/build/dist/api/modules/erc8004/index.js +1 -1
  51. package/build/dist/api/modules/erc8004/management.js +1 -1
  52. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  53. package/build/dist/api/modules/erc8004/services.js +1 -1
  54. package/build/dist/api/modules/erc8004/validation.js +1 -1
  55. package/build/dist/api/modules/grove/index.js +1 -1
  56. package/build/dist/api/modules/heyresearch/backoff.js +1 -1
  57. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  58. package/build/dist/api/modules/heyresearch/freshness.js +1 -1
  59. package/build/dist/api/modules/heyresearch/index.js +1 -1
  60. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  61. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  62. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  63. package/build/dist/api/modules/heyresearch/status-labels.d.ts +1 -1
  64. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  65. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  66. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  67. package/build/dist/api/modules/hoodag/index.js +1 -1
  68. package/build/dist/api/modules/hoodag/management.js +1 -1
  69. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  70. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  71. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  72. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  73. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  74. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  75. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  76. package/build/dist/api/modules/hoodlock/index.js +1 -1
  77. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  78. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  79. package/build/dist/api/modules/hoodlock/public.js +1 -1
  80. package/build/dist/api/modules/hookr/actions.js +1 -1
  81. package/build/dist/api/modules/hookr/addons.js +1 -1
  82. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  83. package/build/dist/api/modules/hookr/contracts.js +1 -1
  84. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  85. package/build/dist/api/modules/hookr/discovery.js +1 -1
  86. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  87. package/build/dist/api/modules/hookr/index.js +1 -1
  88. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  89. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  90. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  91. package/build/dist/api/modules/hookr/launch.js +1 -1
  92. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  93. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  94. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  95. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  96. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  97. package/build/dist/api/modules/hookr/pins.js +1 -1
  98. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  99. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  100. package/build/dist/api/modules/hookr/relay.js +1 -1
  101. package/build/dist/api/modules/hookr/revenue.js +1 -1
  102. package/build/dist/api/modules/kyberswap/index.js +1 -1
  103. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  104. package/build/dist/api/modules/layerbank/abi.d.ts +165 -0
  105. package/build/dist/api/modules/layerbank/abi.js +1 -0
  106. package/build/dist/api/modules/layerbank/actions.d.ts +2 -0
  107. package/build/dist/api/modules/layerbank/actions.js +1 -0
  108. package/build/dist/api/modules/layerbank/checks.d.ts +21 -0
  109. package/build/dist/api/modules/layerbank/checks.js +1 -0
  110. package/build/dist/api/modules/layerbank/index.d.ts +2 -0
  111. package/build/dist/api/modules/layerbank/index.js +1 -0
  112. package/build/dist/api/modules/layerbank/merkl.d.ts +6 -0
  113. package/build/dist/api/modules/layerbank/merkl.js +1 -0
  114. package/build/dist/api/modules/layerbank/reader.d.ts +15 -0
  115. package/build/dist/api/modules/layerbank/reader.js +1 -0
  116. package/build/dist/api/modules/layerbank/reserve.d.ts +13 -0
  117. package/build/dist/api/modules/layerbank/reserve.js +1 -0
  118. package/build/dist/api/modules/lighter/index.js +1 -1
  119. package/build/dist/api/modules/longbow/administration.js +1 -1
  120. package/build/dist/api/modules/longbow/analytics.js +1 -1
  121. package/build/dist/api/modules/longbow/fixed.js +1 -1
  122. package/build/dist/api/modules/longbow/index.js +1 -1
  123. package/build/dist/api/modules/longbow/nft.js +1 -1
  124. package/build/dist/api/modules/longbow/rebates.js +1 -1
  125. package/build/dist/api/modules/longbow/staking.js +1 -1
  126. package/build/dist/api/modules/meridian/index.js +1 -1
  127. package/build/dist/api/modules/meridian/markets.js +1 -1
  128. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  129. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  130. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  131. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  132. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  133. package/build/dist/api/modules/meridian/perps.js +1 -1
  134. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  135. package/build/dist/api/modules/meridian/rfq.js +1 -1
  136. package/build/dist/api/modules/merkl/discovery.js +1 -1
  137. package/build/dist/api/modules/merkl/index.js +1 -1
  138. package/build/dist/api/modules/merkl/manage.js +1 -1
  139. package/build/dist/api/modules/merkl/protocol.js +1 -1
  140. package/build/dist/api/modules/morpho/allocator.js +1 -1
  141. package/build/dist/api/modules/morpho/bundles-abi.js +1 -1
  142. package/build/dist/api/modules/morpho/bundles.js +1 -1
  143. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  144. package/build/dist/api/modules/morpho/index.js +1 -1
  145. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  146. package/build/dist/api/modules/morpho/midnight-abi.js +1 -1
  147. package/build/dist/api/modules/morpho/midnight.js +1 -1
  148. package/build/dist/api/modules/morpho/protocol.js +1 -1
  149. package/build/dist/api/modules/morpho/surface.js +1 -1
  150. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  151. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  152. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  153. package/build/dist/api/modules/netnet/blackjack-hashes.js +1 -1
  154. package/build/dist/api/modules/netnet/card-abi.js +1 -1
  155. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  156. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  157. package/build/dist/api/modules/netnet/card-read.js +1 -1
  158. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  159. package/build/dist/api/modules/netnet/desk-action-abi.js +1 -1
  160. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  161. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  162. package/build/dist/api/modules/netnet/desk-registry.js +1 -1
  163. package/build/dist/api/modules/netnet/financial-abi.js +1 -1
  164. package/build/dist/api/modules/netnet/financial.js +1 -1
  165. package/build/dist/api/modules/netnet/index.js +1 -1
  166. package/build/dist/api/modules/netnet/staking.js +1 -1
  167. package/build/dist/api/modules/orbio/gateway.js +1 -1
  168. package/build/dist/api/modules/orbio/index.js +1 -1
  169. package/build/dist/api/modules/orbio/pins.js +1 -1
  170. package/build/dist/api/modules/orbio/positions.d.ts +2 -0
  171. package/build/dist/api/modules/orbio/positions.js +1 -0
  172. package/build/dist/api/modules/pendle/abi.d.ts +205 -0
  173. package/build/dist/api/modules/pendle/abi.js +1 -0
  174. package/build/dist/api/modules/pendle/convert.d.ts +24 -0
  175. package/build/dist/api/modules/pendle/convert.js +1 -0
  176. package/build/dist/api/modules/pendle/costs.d.ts +3 -0
  177. package/build/dist/api/modules/pendle/costs.js +1 -0
  178. package/build/dist/api/modules/pendle/index.d.ts +11 -0
  179. package/build/dist/api/modules/pendle/index.js +1 -0
  180. package/build/dist/api/modules/pendle/markets.d.ts +37 -0
  181. package/build/dist/api/modules/pendle/markets.js +1 -0
  182. package/build/dist/api/modules/pendle/positions.d.ts +18 -0
  183. package/build/dist/api/modules/pendle/positions.js +1 -0
  184. package/build/dist/api/modules/pendle/pricecheck.d.ts +95 -0
  185. package/build/dist/api/modules/pendle/pricecheck.js +1 -0
  186. package/build/dist/api/modules/pendle/reader.d.ts +17 -0
  187. package/build/dist/api/modules/pendle/reader.js +1 -0
  188. package/build/dist/api/modules/pendle/redeem.d.ts +15 -0
  189. package/build/dist/api/modules/pendle/redeem.js +1 -0
  190. package/build/dist/api/modules/pendle/trade.d.ts +2 -0
  191. package/build/dist/api/modules/pendle/trade.js +1 -0
  192. package/build/dist/api/modules/pendle/types.d.ts +26 -0
  193. package/build/dist/api/modules/pendle/types.js +0 -0
  194. package/build/dist/api/modules/pendle/validate.d.ts +424 -0
  195. package/build/dist/api/modules/pendle/validate.js +1 -0
  196. package/build/dist/api/modules/pendle/verify.d.ts +22 -0
  197. package/build/dist/api/modules/pendle/verify.js +1 -0
  198. package/build/dist/api/modules/pons/claim.js +1 -1
  199. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  200. package/build/dist/api/modules/pons/index.js +1 -1
  201. package/build/dist/api/modules/pons/launch-status.js +1 -1
  202. package/build/dist/api/modules/pons/prices.js +1 -1
  203. package/build/dist/api/modules/pons/reads.d.ts +38 -2
  204. package/build/dist/api/modules/pons/reads.js +1 -1
  205. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  206. package/build/dist/api/modules/pons/trade.js +1 -1
  207. package/build/dist/api/modules/poolstrade/index.js +1 -1
  208. package/build/dist/api/modules/priors/coverage.js +1 -1
  209. package/build/dist/api/modules/priors/discovery.js +1 -1
  210. package/build/dist/api/modules/priors/features.js +1 -1
  211. package/build/dist/api/modules/priors/holdings.d.ts +4 -0
  212. package/build/dist/api/modules/priors/holdings.js +1 -0
  213. package/build/dist/api/modules/priors/index.js +1 -1
  214. package/build/dist/api/modules/priors/integration.js +1 -1
  215. package/build/dist/api/modules/priors/market.js +1 -1
  216. package/build/dist/api/modules/priors/pt.js +1 -1
  217. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  218. package/build/dist/api/modules/priors/starter-line.js +1 -1
  219. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  220. package/build/dist/api/modules/relay/api.js +1 -1
  221. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  222. package/build/dist/api/modules/relay/discovery.js +1 -1
  223. package/build/dist/api/modules/relay/inbound.js +1 -1
  224. package/build/dist/api/modules/relay/index.js +1 -1
  225. package/build/dist/api/modules/relay/order.js +1 -1
  226. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  227. package/build/dist/api/modules/relay/readiness.js +1 -1
  228. package/build/dist/api/modules/relay/reads.js +1 -1
  229. package/build/dist/api/modules/relay/vaults.js +1 -1
  230. package/build/dist/api/modules/spark/actions.js +1 -1
  231. package/build/dist/api/modules/spark/details.js +1 -1
  232. package/build/dist/api/modules/spark/index.js +1 -1
  233. package/build/dist/api/modules/spark/management.js +1 -1
  234. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  235. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  236. package/build/dist/api/modules/steakhouse/index.js +1 -1
  237. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  238. package/build/dist/api/modules/steakhouse/management.js +1 -1
  239. package/build/dist/api/modules/steakhouse/share-symbol.d.ts +3 -0
  240. package/build/dist/api/modules/steakhouse/share-symbol.js +1 -0
  241. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  242. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  243. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  244. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  249. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  250. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  251. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  252. package/build/dist/api/modules/tickerspring/research.js +1 -1
  253. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  254. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction.js +1 -1
  256. package/build/dist/api/modules/uniswap/batch.js +1 -1
  257. package/build/dist/api/modules/uniswap/common.js +1 -1
  258. package/build/dist/api/modules/uniswap/fees.js +1 -1
  259. package/build/dist/api/modules/uniswap/index.js +1 -1
  260. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  261. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  262. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  263. package/build/dist/api/modules/uniswap/pools.js +1 -1
  264. package/build/dist/api/modules/uniswap/position.js +1 -1
  265. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  266. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  267. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  268. package/build/dist/api/modules/uniswap/trade.js +1 -1
  269. package/build/dist/api/modules/uniswap/v2.js +1 -1
  270. package/build/dist/api/modules/uniswap/v3.d.ts +1 -0
  271. package/build/dist/api/modules/uniswap/v3.js +1 -1
  272. package/build/dist/api/modules/uniswap/v4.js +1 -1
  273. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  274. package/build/dist/api/modules/velora/claims.js +1 -1
  275. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  276. package/build/dist/api/modules/velora/index.js +1 -1
  277. package/build/dist/api/modules/wormhole/index.js +1 -1
  278. package/build/dist/api/modules/wormhole/license.js +1 -1
  279. package/build/dist/api/modules/wormhole/quotetext.js +1 -1
  280. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  281. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  282. package/build/dist/api/owner-signature.js +1 -1
  283. package/build/dist/api/positions.d.ts +5 -5
  284. package/build/dist/api/positions.js +1 -1
  285. package/build/dist/api/pricenote.js +1 -1
  286. package/build/dist/api/prices.js +1 -1
  287. package/build/dist/api/pricing.js +1 -1
  288. package/build/dist/api/reads.js +1 -1
  289. package/build/dist/api/routes.js +1 -1
  290. package/build/dist/api/rpc.js +1 -1
  291. package/build/dist/api/secret-fields.js +1 -1
  292. package/build/dist/api/send.js +1 -1
  293. package/build/dist/api/signing-registry.js +1 -1
  294. package/build/dist/api/signing.js +1 -1
  295. package/build/dist/api/simulate.js +1 -1
  296. package/build/dist/api/swap.js +1 -1
  297. package/build/dist/api/token-output.js +1 -1
  298. package/build/dist/api/tokens.js +1 -1
  299. package/build/dist/api/tool-policy.js +1 -1
  300. package/build/dist/api/tx.js +1 -1
  301. package/build/dist/api/types.d.ts +7 -2
  302. package/build/dist/api/untrusted.js +1 -1
  303. package/build/dist/api/vendor-limits.js +1 -1
  304. package/build/dist/chunks/{7YU6DELJ.js → 24CQ2SPB.js} +1 -1
  305. package/build/dist/chunks/2DUCTO5C.js +1 -0
  306. package/build/dist/chunks/2MZXTOZU.js +1 -0
  307. package/build/dist/chunks/2OJAOVMG.js +1 -0
  308. package/build/dist/chunks/2ZUP7ZEV.js +1 -0
  309. package/build/dist/chunks/{ZXQMF56D.js → 3AXVB23N.js} +1 -1
  310. package/build/dist/chunks/3ESNHZT5.js +1 -0
  311. package/build/dist/chunks/{GIV5JMTE.js → 3VAJW6TQ.js} +1 -1
  312. package/build/dist/chunks/{ALK6NKFP.js → 3WXK2FUA.js} +1 -1
  313. package/build/dist/chunks/{TQL7UDFL.js → 42DQTKEO.js} +1 -1
  314. package/build/dist/chunks/{E7R3J4H7.js → 43CSMYDO.js} +1 -1
  315. package/build/dist/chunks/46547QT3.js +1 -0
  316. package/build/dist/chunks/{XV2HQKND.js → 47YN4OUI.js} +1 -1
  317. package/build/dist/chunks/{S3HNPTXA.js → 4ALMYJJV.js} +1 -1
  318. package/build/dist/chunks/{SOYQOE5P.js → 4BVP652W.js} +1 -1
  319. package/build/dist/chunks/{GCWA4Z3W.js → 4ISR2U72.js} +1 -1
  320. package/build/dist/chunks/{AAGDMH54.js → 4TQQH7N6.js} +1 -1
  321. package/build/dist/chunks/{WTSMPDT5.js → 4YFVAYKR.js} +1 -1
  322. package/build/dist/chunks/{PTAWEHKB.js → 57JFKIMK.js} +1 -1
  323. package/build/dist/chunks/{3RFSGU2Y.js → 5CAAFU7R.js} +1 -1
  324. package/build/dist/chunks/{73N3TOJL.js → 5KUWLUPM.js} +1 -1
  325. package/build/dist/chunks/{SKQGLGES.js → 5MQ5KSSV.js} +1 -1
  326. package/build/dist/chunks/{AJP5LDM2.js → 5N4A5XAW.js} +1 -1
  327. package/build/dist/chunks/{OQVZVR2S.js → 5OKJEGBH.js} +1 -1
  328. package/build/dist/chunks/5U7TCKX2.js +2 -0
  329. package/build/dist/chunks/5WUKOQIJ.js +1 -0
  330. package/build/dist/chunks/5ZLOCQA4.js +1 -0
  331. package/build/dist/chunks/63YRSLDK.js +1 -0
  332. package/build/dist/chunks/64WKYWZV.js +1 -0
  333. package/build/dist/chunks/{JPOYTTTW.js → 65EQECL3.js} +1 -1
  334. package/build/dist/chunks/{57HAXNQV.js → 6AAARNZ3.js} +1 -1
  335. package/build/dist/chunks/6FTYNYGF.js +1 -0
  336. package/build/dist/chunks/{L7YBCMZU.js → 6L5KTE6Y.js} +1 -1
  337. package/build/dist/chunks/{53N7PNJH.js → 6PY3IRDS.js} +1 -1
  338. package/build/dist/chunks/{5VHH5PW3.js → 6YYCGUCU.js} +1 -1
  339. package/build/dist/chunks/{UNZRE3YU.js → 7UOOIDR3.js} +1 -1
  340. package/build/dist/chunks/{LQUDJCAR.js → 7WQEPZJY.js} +1 -1
  341. package/build/dist/chunks/A3PN3PK3.js +1 -0
  342. package/build/dist/chunks/A6YQ5H24.js +1 -0
  343. package/build/dist/chunks/{CXLEQCP3.js → ABPL3ZZI.js} +1 -1
  344. package/build/dist/chunks/{R7FXNZRM.js → AG67Z3SC.js} +1 -1
  345. package/build/dist/chunks/{BX7XQANB.js → ALPYEM7B.js} +1 -1
  346. package/build/dist/chunks/{OE3CLZHR.js → ALRRW7SF.js} +1 -1
  347. package/build/dist/chunks/AUOXDNUO.js +7 -0
  348. package/build/dist/chunks/AWXJV2YH.js +1 -0
  349. package/build/dist/chunks/{PEA32CWB.js → BAAXGB4K.js} +1 -1
  350. package/build/dist/chunks/{R53P2K3C.js → BIRMUW7Z.js} +1 -1
  351. package/build/dist/chunks/{EA6IYKIB.js → BK23XJXE.js} +1 -1
  352. package/build/dist/chunks/{NATG6YA6.js → BNG2IWZL.js} +1 -1
  353. package/build/dist/chunks/BQICZFLR.js +1 -0
  354. package/build/dist/chunks/{ASDKY5NX.js → BXHNYCH2.js} +1 -1
  355. package/build/dist/chunks/{L62M7LOB.js → C5ZZAYXD.js} +1 -1
  356. package/build/dist/chunks/{52DHGSG4.js → CERNEJ2F.js} +1 -1
  357. package/build/dist/chunks/{LKJBMHCE.js → CTMA4BTM.js} +1 -1
  358. package/build/dist/chunks/{QXNPPCOU.js → D6ZJPNK7.js} +1 -1
  359. package/build/dist/chunks/DFM4T6ZE.js +1 -0
  360. package/build/dist/chunks/{SJPM5ST4.js → DP2NIYBP.js} +1 -1
  361. package/build/dist/chunks/DVVFT42J.js +1 -0
  362. package/build/dist/chunks/E3UBHTJO.js +1 -0
  363. package/build/dist/chunks/E6RRXNV2.js +1 -0
  364. package/build/dist/chunks/{ZT47KN7A.js → E6UU7DL2.js} +1 -1
  365. package/build/dist/chunks/ECWGKLBW.js +1 -0
  366. package/build/dist/chunks/EKNSLLJK.js +1 -0
  367. package/build/dist/chunks/{XWEFKXKA.js → ENX72ARB.js} +1 -1
  368. package/build/dist/chunks/{DRWWPBOQ.js → EOQYLFXA.js} +1 -1
  369. package/build/dist/chunks/{ELZNT5Q3.js → ET23SES4.js} +1 -1
  370. package/build/dist/chunks/EU3OAJU2.js +1 -0
  371. package/build/dist/chunks/{2W46IRX6.js → EYFBVQ46.js} +1 -1
  372. package/build/dist/chunks/{VXLJRRKV.js → F26FK47J.js} +1 -1
  373. package/build/dist/chunks/{O5IVZHHP.js → F3BSEE52.js} +1 -1
  374. package/build/dist/chunks/FWD4L3CJ.js +1 -0
  375. package/build/dist/chunks/G7XSFUDL.js +1 -0
  376. package/build/dist/chunks/{5O5ZE3ZV.js → GHPREYQK.js} +1 -1
  377. package/build/dist/chunks/{AFHHRDPJ.js → GRIGSPD4.js} +1 -1
  378. package/build/dist/chunks/{TPDOUL4N.js → GVPX5XCL.js} +1 -1
  379. package/build/dist/chunks/{TLJPVYRJ.js → GW5IXLKU.js} +1 -1
  380. package/build/dist/chunks/H4NYYJ3Z.js +1 -0
  381. package/build/dist/chunks/{J3GFCBZZ.js → HSFOWJ3Z.js} +1 -1
  382. package/build/dist/chunks/{CY75R4FK.js → HTXKERNS.js} +1 -1
  383. package/build/dist/chunks/{6ZYLNB2B.js → HVM2EEXB.js} +1 -1
  384. package/build/dist/chunks/{U3F6DDML.js → I4TGMF2C.js} +1 -1
  385. package/build/dist/chunks/I6KUORFT.js +1 -0
  386. package/build/dist/chunks/{AMICUXS6.js → IKEJCBYU.js} +1 -1
  387. package/build/dist/chunks/IMRXZ7JB.js +1 -0
  388. package/build/dist/chunks/IQGY5FW7.js +1 -0
  389. package/build/dist/chunks/{L3ZM77SJ.js → IQIWASRD.js} +1 -1
  390. package/build/dist/chunks/JG27HM4P.js +1 -0
  391. package/build/dist/chunks/{V5LTA42G.js → JPNYUEQP.js} +1 -1
  392. package/build/dist/chunks/JZXYLHI7.js +1 -0
  393. package/build/dist/chunks/{QYYFRAWY.js → K22EXPWN.js} +1 -1
  394. package/build/dist/chunks/K72EYD6R.js +1 -0
  395. package/build/dist/chunks/KA7BPBCV.js +2 -0
  396. package/build/dist/chunks/KBKK7UNY.js +1 -0
  397. package/build/dist/chunks/{LBEMCOND.js → KBXU7U6Q.js} +1 -1
  398. package/build/dist/chunks/L6D26AMO.js +1 -0
  399. package/build/dist/chunks/{GGUEKSR4.js → L7OQUHM5.js} +1 -1
  400. package/build/dist/chunks/{F6WBPPBN.js → LDT3QTSY.js} +1 -1
  401. package/build/dist/chunks/{CE7D6MUS.js → LROVANUR.js} +1 -1
  402. package/build/dist/chunks/{WWFOYZT2.js → LVLVP5KQ.js} +1 -1
  403. package/build/dist/chunks/MBTARLZQ.js +1 -0
  404. package/build/dist/chunks/{SSTROLQM.js → MDDHG34Y.js} +1 -1
  405. package/build/dist/chunks/{OVK4EEOD.js → MDV7GECM.js} +1 -1
  406. package/build/dist/chunks/{DCTUYDWF.js → MFCPL6LF.js} +1 -1
  407. package/build/dist/chunks/MGPHD4VV.js +1 -0
  408. package/build/dist/chunks/{VC2RCYQE.js → MKAPRRKF.js} +1 -1
  409. package/build/dist/chunks/{FBSUTF3B.js → MKBNLGDD.js} +1 -1
  410. package/build/dist/chunks/{NRBIXV7V.js → MOPETB64.js} +1 -1
  411. package/build/dist/chunks/{ACN2BFMA.js → MQK6OP7S.js} +1 -1
  412. package/build/dist/chunks/{TWCSCRFS.js → MQYOG66Q.js} +1 -1
  413. package/build/dist/chunks/{2UU5TBBB.js → MXW2TP5P.js} +1 -1
  414. package/build/dist/chunks/MYFAKCQI.js +1 -0
  415. package/build/dist/chunks/{MKQVS3IO.js → NA7R6J5N.js} +1 -1
  416. package/build/dist/chunks/NB3LYS3G.js +1 -0
  417. package/build/dist/chunks/{TNSKEHPC.js → NDW5DAFL.js} +1 -1
  418. package/build/dist/chunks/{MRWCFTMS.js → NKX3FE34.js} +1 -1
  419. package/build/dist/chunks/NYNJITCM.js +1 -0
  420. package/build/dist/chunks/{YZSTP2E6.js → NZXQWDGF.js} +1 -1
  421. package/build/dist/chunks/{Z7RL4NGX.js → O6L4BJP4.js} +1 -1
  422. package/build/dist/chunks/{KSZMMNXK.js → OFI3Y55L.js} +1 -1
  423. package/build/dist/chunks/{2LM7U4S7.js → OTIXQZ3X.js} +1 -1
  424. package/build/dist/chunks/{WCKMQFGS.js → PADWZX7J.js} +1 -1
  425. package/build/dist/chunks/{6IM6A5VA.js → PBQSJSZO.js} +1 -1
  426. package/build/dist/chunks/PLZKXQ76.js +1 -0
  427. package/build/dist/chunks/{XUYHMOHS.js → PQC5635W.js} +1 -1
  428. package/build/dist/chunks/PSVOVZH7.js +70 -0
  429. package/build/dist/chunks/{PWBL4WKB.js → PWH464CJ.js} +1 -1
  430. package/build/dist/chunks/QJFXLYZG.js +1 -0
  431. package/build/dist/chunks/{4KQZTPMS.js → QRC4ZPDA.js} +1 -1
  432. package/build/dist/chunks/{4AKIXLXH.js → QSN6Y2K6.js} +1 -1
  433. package/build/dist/chunks/{C3TJLARP.js → QVYCJ6WV.js} +1 -1
  434. package/build/dist/chunks/{WVXW6VL3.js → RNC463IM.js} +1 -1
  435. package/build/dist/chunks/RPNAFUM5.js +1 -0
  436. package/build/dist/chunks/RVO3QK2B.js +1 -0
  437. package/build/dist/chunks/{FUXT7GRK.js → S2TAJHHK.js} +1 -1
  438. package/build/dist/chunks/{YHPOXAKA.js → S3FPF537.js} +1 -1
  439. package/build/dist/chunks/{H4S2ZCWK.js → S5WICHIS.js} +1 -1
  440. package/build/dist/chunks/SDHPFXRM.js +1 -0
  441. package/build/dist/chunks/{3NDVXEBR.js → SGEZIYJW.js} +1 -1
  442. package/build/dist/chunks/SK2VBNAU.js +1 -0
  443. package/build/dist/chunks/SKMPKAZI.js +1 -0
  444. package/build/dist/chunks/{5IIR3GIN.js → SQL6HD5E.js} +1 -1
  445. package/build/dist/chunks/SSIENQVU.js +1 -0
  446. package/build/dist/chunks/{EXRKBBX2.js → SUFA2GKR.js} +1 -1
  447. package/build/dist/chunks/TBCSZDAF.js +1 -0
  448. package/build/dist/chunks/{LMVB3B6T.js → TBIVTEP5.js} +1 -1
  449. package/build/dist/chunks/{2FSX7MMR.js → TJWVY4VO.js} +1 -1
  450. package/build/dist/chunks/{7XLEYOZH.js → TNKVRVTH.js} +1 -1
  451. package/build/dist/chunks/{VCLPOU7T.js → TPL4U3AQ.js} +1 -1
  452. package/build/dist/chunks/{QRDDKA4I.js → U4JGEMKT.js} +1 -1
  453. package/build/dist/chunks/{6AWTAE4Q.js → UA4O226F.js} +1 -1
  454. package/build/dist/chunks/UFVPMWPJ.js +1 -0
  455. package/build/dist/chunks/UHRCM7AG.js +1 -0
  456. package/build/dist/chunks/{XQXLFF7Y.js → UOGHQLQX.js} +1 -1
  457. package/build/dist/chunks/UP7FBDMJ.js +1 -0
  458. package/build/dist/chunks/{YQUKU2LS.js → UPMGGK34.js} +1 -1
  459. package/build/dist/chunks/VHLINDDS.js +1 -0
  460. package/build/dist/chunks/{PARWLWXW.js → VV2HEIFI.js} +1 -1
  461. package/build/dist/chunks/{YA5WWDEW.js → VVA72C6O.js} +1 -1
  462. package/build/dist/chunks/{TCPPYBGQ.js → W2OJ57ZO.js} +1 -1
  463. package/build/dist/chunks/{WQ6H62DM.js → W76QC2AW.js} +1 -1
  464. package/build/dist/chunks/{VFSRRDLY.js → WD37MEMZ.js} +1 -1
  465. package/build/dist/chunks/{R7QPJQP6.js → WGL46F3S.js} +1 -1
  466. package/build/dist/chunks/WIVYKLQM.js +2 -0
  467. package/build/dist/chunks/{XQUPZ3GU.js → WMNRP3YH.js} +1 -1
  468. package/build/dist/chunks/WOEKXQAH.js +1 -0
  469. package/build/dist/chunks/WPAF55SP.js +1 -0
  470. package/build/dist/chunks/{EVANKNJV.js → WPFAEBE7.js} +1 -1
  471. package/build/dist/chunks/WVONJOWN.js +1 -0
  472. package/build/dist/chunks/{TWSTOFN3.js → WWHCEMNB.js} +1 -1
  473. package/build/dist/chunks/{DZGEQBO7.js → XDZRO5JQ.js} +1 -1
  474. package/build/dist/chunks/XFKVU46U.js +3 -0
  475. package/build/dist/chunks/{RAKUK5VR.js → XJEOEMDS.js} +1 -1
  476. package/build/dist/chunks/XSD5NL7J.js +1 -0
  477. package/build/dist/chunks/{NU4K3TEZ.js → XSRIJUFU.js} +1 -1
  478. package/build/dist/chunks/{VFKNXQXI.js → Y7PRJOIK.js} +1 -1
  479. package/build/dist/chunks/Y7RPSDD2.js +1 -0
  480. package/build/dist/chunks/YAJYDD6C.js +1 -0
  481. package/build/dist/chunks/{5OEHZJ6X.js → YEXUSRIZ.js} +1 -1
  482. package/build/dist/chunks/YHRUAQQK.js +1 -0
  483. package/build/dist/chunks/{3EFV4FQF.js → YPM2UITD.js} +1 -1
  484. package/build/dist/chunks/{3WBDHUV2.js → YRXT3HTW.js} +1 -1
  485. package/build/dist/chunks/Z4SRGAVL.js +1 -0
  486. package/build/dist/chunks/{SQ5BNSXR.js → ZBFKKUNP.js} +1 -1
  487. package/build/dist/chunks/{NWSPC3NH.js → ZCOFMGPS.js} +1 -1
  488. package/build/dist/chunks/ZCUXM52B.js +1 -0
  489. package/build/dist/chunks/ZE7EU2CS.js +1 -0
  490. package/build/dist/chunks/{CQCVFRQ5.js → ZET37EIG.js} +1 -1
  491. package/build/dist/chunks/{VVEUJ36E.js → ZGKVXFM5.js} +1 -1
  492. package/build/dist/chunks/{WQQJ7UPJ.js → ZSQOMSOC.js} +1 -1
  493. package/build/dist/chunks/{JST5JGAP.js → ZYH4B2GR.js} +1 -1
  494. package/package.json +2 -2
  495. package/build/dist/chunks/2MSQ6JII.js +0 -1
  496. package/build/dist/chunks/3SC5UI35.js +0 -1
  497. package/build/dist/chunks/4GHVIBL5.js +0 -1
  498. package/build/dist/chunks/4X2JOQ2L.js +0 -1
  499. package/build/dist/chunks/5YS5V2LK.js +0 -1
  500. package/build/dist/chunks/6UPPUHCL.js +0 -1
  501. package/build/dist/chunks/AXYOJBX6.js +0 -1
  502. package/build/dist/chunks/CEIPDEXZ.js +0 -1
  503. package/build/dist/chunks/CUNQ5RG5.js +0 -1
  504. package/build/dist/chunks/EG6M6SSO.js +0 -1
  505. package/build/dist/chunks/EGUMOD3A.js +0 -1
  506. package/build/dist/chunks/G3MHDTGT.js +0 -1
  507. package/build/dist/chunks/G6HCV67X.js +0 -1
  508. package/build/dist/chunks/GJY3P6OG.js +0 -1
  509. package/build/dist/chunks/HIMVOTIU.js +0 -1
  510. package/build/dist/chunks/IBXYIN7Q.js +0 -1
  511. package/build/dist/chunks/IUE6RASI.js +0 -1
  512. package/build/dist/chunks/JWCOXLYA.js +0 -1
  513. package/build/dist/chunks/KHJFXJBU.js +0 -1
  514. package/build/dist/chunks/LLM5WDM3.js +0 -1
  515. package/build/dist/chunks/LQGPMOD2.js +0 -1
  516. package/build/dist/chunks/MYBDO5SA.js +0 -1
  517. package/build/dist/chunks/NAYRD43N.js +0 -1
  518. package/build/dist/chunks/NMYGNJIJ.js +0 -1
  519. package/build/dist/chunks/NSOEDRBU.js +0 -3
  520. package/build/dist/chunks/PZHR4ITH.js +0 -1
  521. package/build/dist/chunks/R7SXC74O.js +0 -1
  522. package/build/dist/chunks/RETS2ZEK.js +0 -1
  523. package/build/dist/chunks/SJPYXNOK.js +0 -1
  524. package/build/dist/chunks/SQZRVIVF.js +0 -1
  525. package/build/dist/chunks/SXAIXD56.js +0 -1
  526. package/build/dist/chunks/SXX3VTBP.js +0 -1
  527. package/build/dist/chunks/TMGWXDCZ.js +0 -1
  528. package/build/dist/chunks/TNLHMDWL.js +0 -1
  529. package/build/dist/chunks/UFS2RVEZ.js +0 -1
  530. package/build/dist/chunks/USSOVTD5.js +0 -1
  531. package/build/dist/chunks/UWOFA6GV.js +0 -1
  532. package/build/dist/chunks/V2OOOV6B.js +0 -1
  533. package/build/dist/chunks/XVFLT275.js +0 -1
  534. package/build/dist/chunks/YHB55C5T.js +0 -1
  535. package/build/dist/chunks/YOENHHKI.js +0 -1
@@ -1 +1 @@
1
- import{a as h,c as A}from"./MYBDO5SA.js";import{d as l,e as m,f as y,j as w}from"./73N3TOJL.js";import{a as t}from"./5YS5V2LK.js";import{a as f}from"./JXOEJPJ4.js";import{erc20Abi as g,parseAbi as R}from"viem";var x="https://api.relay.link",I="0x0000000000000000000000000000000000000000",L=R(["function depositNative(address depositor, bytes32 id) payable","function depositErc20(address depositor, address token, uint256 amount, bytes32 id)"]),k=(1n<<256n)-1n;function p(e){return y(e,"Relay returned an unexpected response.")}function _(e){if(!Array.isArray(e))throw new t("Relay returned an unexpected list.");return e}function b(e){return w(e,"Provide a valid wallet or token address.",l)}function S(e){let n=b(e);return n==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"?I:n}function E(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Provide a positive integer chain ID.");return e}function P(e){if(typeof e!="string"||!/^(0|[1-9]\d*)$/.test(e)||BigInt(e)>k)throw new t("Amounts must be decimal base-unit strings within the uint256 range.");return e}function $(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Relay returned an invalid order or refund deadline. Request a fresh quote.");return e}function q(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new t("Provide a valid Relay request or order ID.");return e}function T(e){let n=p(e);if(typeof n.symbol!="string"||!n.symbol.trim()||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)throw new t("Relay returned invalid token metadata.");return{address:b(n.address),chainId:E(n.chainId),decimals:n.decimals,symbol:n.symbol}}function D(e){let n=p(e);return{token:T(n.currency),amount:P(n.amount)}}function M(e){if(!e)throw new t("Relay quote does not match the requested amount, chain, recipient, minimum or transaction.")}function V(e){return e===void 0?[]:_(e).map(q)}function z(e){if(!(e==null||e==="N/A")){if(typeof e!="string")throw new t("Relay returned an invalid failure reason.");return f(e)}}function H(e,n="symbol"){if(!(typeof e!="string"||!e.trim()))return(n==="symbol"?/^[A-Za-z0-9._-]{1,32}$/:/^[A-Za-z0-9 ()+-]{1,32}$/).test(e)?e:f(e)}async function J(e,n,r,o,s,c){let i=await e.clientFor(s).readContract({address:n,abi:g,functionName:"allowance",args:[c,r]});if(typeof i!="bigint"||i<0n||i>k)throw new t("Could not read the Relay token allowance.");return[...i>0n?[e.approval(n,r,"0",s)]:[],e.approval(n,r,o,s)]}function j(e){return async(n,r)=>p(await v(e)(n,r))}function v(e){return async(n,r)=>{let o=process.env.OAK_RELAY_API_KEY?.trim(),s=n.split("?")[0],c=s==="/quote/v2",i=s==="/requests/v3"||/^\/balance\/[^/]+\/events$/.test(s);if(!o&&i)throw new t("Configure OAK_RELAY_API_KEY on the server: Relay request history and balance events require an API key. A missing key does not mean this wallet has no requests or events. Check a saved request with relay_status.");if(!o&&c)throw new t("Configure the Relay API key (OAK_RELAY_API_KEY) on the server: Relay quote/v2 requires a valid API key since October 2, 2026. Status and chain reads remain available without it.");try{return await A(e.http,`${x}${n}`,{method:r===void 0?"GET":"POST",headers:{...o?{"x-api-key":o}:{},"Content-Type":"application/json","User-Agent":"oak-relay/1.0"},...r===void 0?{}:{body:JSON.stringify(r)}},a=>m(a)||Array.isArray(a))}catch(a){let d=a instanceof h?a.response.status:void 0,u=e.plainError(a);throw d===401||d===403||/HTTP (401|403)\b/.test(u)?new t("Relay requires an authorized API key for this endpoint. Ask the operator to configure a valid OAK_RELAY_API_KEY on the server with access to this resource; never pass keys in tool arguments."):s==="/prices/rates"&&(d!==void 0&&d>=500||/HTTP 5\d\d\b/.test(u))?new t("Relay exchange rates are unavailable because the upstream service failed. Retry later; no rates were returned. Use relay_token_price with chainId and address for an individual token."):new t(o?u.replaceAll(o,"[redacted]"):u)}}}export{x as a,I as b,L as c,p as d,_ as e,b as f,S as g,E as h,P as i,$ as j,q as k,T as l,D as m,M as n,V as o,z as p,H as q,J as r,j as s,v as t};
1
+ import{a as h,c as A}from"./MYFAKCQI.js";import{d as l,e as m,f as y,j as w}from"./5KUWLUPM.js";import{a as t}from"./XSD5NL7J.js";import{a as f}from"./JXOEJPJ4.js";import{erc20Abi as g,parseAbi as R}from"viem";var x="https://api.relay.link",I="0x0000000000000000000000000000000000000000",L=R(["function depositNative(address depositor, bytes32 id) payable","function depositErc20(address depositor, address token, uint256 amount, bytes32 id)"]),k=(1n<<256n)-1n;function p(e){return y(e,"Relay returned an unexpected response.")}function _(e){if(!Array.isArray(e))throw new t("Relay returned an unexpected list.");return e}function b(e){return w(e,"Provide a valid wallet or token address.",l)}function S(e){let n=b(e);return n==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"?I:n}function E(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Provide a positive integer chain ID.");return e}function P(e){if(typeof e!="string"||!/^(0|[1-9]\d*)$/.test(e)||BigInt(e)>k)throw new t("Amounts must be decimal base-unit strings within the uint256 range.");return e}function $(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Relay returned an invalid order or refund deadline. Request a fresh quote.");return e}function q(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new t("Provide a valid Relay request or order ID.");return e}function T(e){let n=p(e);if(typeof n.symbol!="string"||!n.symbol.trim()||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)throw new t("Relay returned invalid token metadata.");return{address:b(n.address),chainId:E(n.chainId),decimals:n.decimals,symbol:n.symbol}}function D(e){let n=p(e);return{token:T(n.currency),amount:P(n.amount)}}function M(e){if(!e)throw new t("Relay quote does not match the requested amount, chain, recipient, minimum or transaction.")}function V(e){return e===void 0?[]:_(e).map(q)}function z(e){if(!(e==null||e==="N/A")){if(typeof e!="string")throw new t("Relay returned an invalid failure reason.");return f(e)}}function H(e,n="symbol"){if(!(typeof e!="string"||!e.trim()))return(n==="symbol"?/^[A-Za-z0-9._-]{1,32}$/:/^[A-Za-z0-9 ()+-]{1,32}$/).test(e)?e:f(e)}async function J(e,n,r,o,s,c){let i=await e.clientFor(s).readContract({address:n,abi:g,functionName:"allowance",args:[c,r]});if(typeof i!="bigint"||i<0n||i>k)throw new t("Could not read the Relay token allowance.");return[...i>0n?[e.approval(n,r,"0",s)]:[],e.approval(n,r,o,s)]}function j(e){return async(n,r)=>p(await v(e)(n,r))}function v(e){return async(n,r)=>{let o=process.env.OAK_RELAY_API_KEY?.trim(),s=n.split("?")[0],c=s==="/quote/v2",i=s==="/requests/v3"||/^\/balance\/[^/]+\/events$/.test(s);if(!o&&i)throw new t("Configure OAK_RELAY_API_KEY on the server: Relay request history and balance events require an API key. A missing key does not mean this wallet has no requests or events. Check a saved request with relay_status.");if(!o&&c)throw new t("Configure the Relay API key (OAK_RELAY_API_KEY) on the server: Relay quote/v2 requires a valid API key since October 2, 2026. Status and chain reads remain available without it.");try{return await A(e.http,`${x}${n}`,{method:r===void 0?"GET":"POST",headers:{...o?{"x-api-key":o}:{},"Content-Type":"application/json","User-Agent":"oak-relay/1.0"},...r===void 0?{}:{body:JSON.stringify(r)}},a=>m(a)||Array.isArray(a))}catch(a){let d=a instanceof h?a.response.status:void 0,u=e.plainError(a);throw d===401||d===403||/HTTP (401|403)\b/.test(u)?new t("Relay requires an authorized API key for this endpoint. Ask the operator to configure a valid OAK_RELAY_API_KEY on the server with access to this resource; never pass keys in tool arguments."):s==="/prices/rates"&&(d!==void 0&&d>=500||/HTTP 5\d\d\b/.test(u))?new t("Relay exchange rates are unavailable because the upstream service failed. Retry later; no rates were returned. Use relay_token_price with chainId and address for an individual token."):new t(o?u.replaceAll(o,"[redacted]"):u)}}}export{x as a,I as b,L as c,p as d,_ as e,b as f,S as g,E as h,P as i,$ as j,q as k,T as l,D as m,M as n,V as o,z as p,H as q,J as r,j as s,v as t};
@@ -1 +1 @@
1
- import{b as pe,c as me}from"./OQVZVR2S.js";import{a as ue}from"./AXYOJBX6.js";import{a as be}from"./6IM6A5VA.js";import{c as le}from"./MYBDO5SA.js";import{a as O}from"./UWOFA6GV.js";import{c as Y,d as oe,g as I,i as fe,m as re,n as se}from"./73N3TOJL.js";import{a as S,i as de,j as ie}from"./G6HCV67X.js";import{a as o}from"./5YS5V2LK.js";import{decodeFunctionData as J,encodeFunctionData as T,erc20Abi as te,getAddress as he,keccak256 as Ce,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"}};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],Z=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ce=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),Fe=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),ge={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ye=P(["function deposit() payable"]),z={vault:Y,chainId:{const:S},slippageBps:{type:"integer",minimum:0,maximum:500}},Be=10n**36n,K=he(de[S].uniswap.WETH.address),ve="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ke=Object.fromEntries(Object.entries(q.codeHashes).map(([d,s])=>[d.toLowerCase(),s])),Ae=Object.fromEntries(Object.entries(q.delegates).map(([d,s])=>[d.toLowerCase(),s]));function f(d){return fe(d,"Provide a token or vault address.",oe)}function F(d){return re(d,"Invalid Beefy CLM integer.")}function G(d,s=!1){return se(d,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!s})}function Q(d){let s=d??50;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>500)throw new o("Use integer slippageBps from 0 to 500.");return BigInt(s)}function X(d,s){let m=d*(10000n-s)/10000n;if(m<=0n)throw new o("This CLM amount is too small for a positive output minimum.");return m}function ne(d,s){if(!Array.isArray(d)||d.length!==s)throw new o("Invalid Beefy CLM quote.");return d.map(F)}function Se(d){let s=f(d),m=De.find(b=>I(b.vault,s));if(!m)throw new o("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return m}function Me(d,s,m,b,h){if(d<=0n||m<=0n||b<0n||h<0n)throw new o("The CLM price or budget is invalid.");let x=s?d*m/Be:d;if(x===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=h>e?h-e:e-h,a=x<t?x:t,r=(x-a)/2n,c=d*(h>e?a+r:r)/x;return[c,d-c]}var xe=d=>{async function s(e){try{return await e()}catch(t){throw new o(d.plainError(t))}}function m(e,t){if(e.chainId!==void 0&&e.chainId!==S)throw new o("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new o(`Unsupported Beefy CLM input: ${a}.`);return Se(e.vault)}async function b(e,t){be(t);let a=d.clientFor(S);if(await a.getChainId()!==S)throw new o("The Beefy CLM endpoint must report chain 4663.");let r=F(await a.getBlockNumber()),c=await a.getBlock({blockNumber:r}),n=(B,p,A=[])=>a.readContract({address:f(B),abi:Z,functionName:p,args:A,blockNumber:r}),i=new Set;async function l(B){let p=B.toLowerCase();if(i.has(p))return;let A=ke[p];if(!A)throw new o("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:r});if(!D||Ce(D)!==A)throw new o("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");i.add(p),Ae[p]&&await l(Ae[p])}await me(a,f(e.vault),r);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await l(B);let[g,u,y,E,C,k,w,M,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(g)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,p)=>f(B)!==e.wants[p])||f(y)!==e.strategy||f(E)!==e.implementation||f(C)!==e.pool||f(k)!==e.manager||f(w)!==e.wants[0]||f(M)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new o("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>F(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:r}));async function ae(B){let p=f(B),[A,D]=await Promise.all([a.readContract({address:p,abi:te,functionName:"symbol",blockNumber:r}),a.readContract({address:p,abi:te,functionName:"decimals",blockNumber:r})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new o("Invalid CLM token metadata.");return{address:p,symbol:A,decimals:D,chainId:S}}async function U(){let p=(await le(d.http,"https://api.beefy.finance/vaults",{},v=>Array.isArray(v)&&v.every($=>$!==null&&typeof $=="object"))).filter(v=>v.chain==="robinhood"&&typeof v.earnContractAddress=="string"&&I(v.earnContractAddress,e.vault)),A=p[0],D=pe(f(e.vault));if(p.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new o("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new o(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),_=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(_.some(v=>typeof v!="boolean"))throw new o("Invalid Beefy strategy pause flag.");if(_.some(Boolean))throw new o("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new o("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,p){let A=new Set([...e.wants,f(ie),K]);if(!A.has(B)||!A.has(p)||B===p)throw new o("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=q.routes.find(H=>H.from===B&&H.to===p&&(H.pools[0]===e.pool||H.kind==="v3"));if(!D)throw new o("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=q.markets[D.kind];for(let H of[L.router,L.quoter,L.factory,...D.pools])await l(H);let _=D.path;if(_.length!==88||f(_.slice(0,42))!==B||f(`0x${_.slice(-40)}`)!==p)throw new o("Invalid qualified CLM swap path.");let v=Number.parseInt(_.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:ge[D.kind],functionName:"getPool",args:[B,p,v],blockNumber:r});if(f($)!==D.pools[0])throw new o("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new o("The CLM quoter factory differs from its pin.");return D}async function j(B,p,A){let D=await N(B,p),L=q.markets[D.kind],_=await a.simulateContract({address:f(L.quoter),abi:Fe,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:r}),v=F(_.result[0]);if(v===0n)throw new o("No positive quote for this CLM swap.");return{selected:D,market:L,out:v}}return{client:a,blockNumber:r,deadline:c.timestamp+600n,read:n,balance:V,token:ae,code:l,entryAvailable:U,quote:j}}function h(e,t,a,r="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:r,chainId:S})}async function x(e,t,a){let r=await d.preview(e,t);return{txs:e,preview:r,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount","slippageBps"]),r=Q(e.slippageBps),c=await b(a,t),[n,i,l,g,u,y,E,C]=await Promise.all([c.token(a.wants[0]),c.token(a.wants[1]),c.token(a.manager),c.balance(a.wants[0]),c.balance(a.wants[1]),c.balance(a.manager),c.read(a.manager,"balances"),c.read(a.strategy,"price")]),k;if(e.amount!==void 0){await c.entryAvailable();let w=G(e.amount),[M,R]=ne(E,2),ee=Me(w,a.bridge===n.address,F(C),M,R),V=[];for(let[ae,U]of[n,i].entries()){let N=ee[ae],j=N===0n||U.address===a.bridge?N:(await c.quote(f(a.bridge),U.address,N)).out;V.push({token:U,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":X(j,r).toString(),swapRequired:N>0n&&U.address!==a.bridge})}k={bridge:await c.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:S,vault:a.vault,manager:a.manager,bridge:await c.token(a.bridge),constituents:[{token:n,balance:g.toString()},{token:i,balance:u.toString()}],shares:{token:l,amount:y.toString()},entryPlan:k,block:c.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...z,from:Y,to:Y,amount:O()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["from","to","amount","slippageBps"]),r=Q(e.slippageBps),c=f(e.from),n=f(e.to),i=G(e.amount),l=c.toLowerCase()===ve,g=l?K:c,u=await b(a,t);if((l?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(c))<i)throw new o("Insufficient CLM swap balance; keep ETH for gas.");let y=[];l&&(await u.code(K),y.push(h(K,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",i.toString())));let E=i,C=i;if(g!==n){let w=await u.quote(g,n,i);E=w.out,C=X(E,r),y.push(d.approval(g,f(w.market.router),i.toString(),S));let M={path:w.selected.path,recipient:t,amountIn:i,amountOutMinimum:C},R=w.selected.kind==="cl"?T({abi:ce,functionName:"exactInput",args:[{...M,deadline:u.deadline}]}):T({abi:W,functionName:"multicall",args:[u.deadline,[T({abi:W,functionName:"exactInput",args:[M]})]]});y.push(h(w.market.router,R,`Swap exact input with at least ${C} output base units to the calling wallet.`))}else if(!l)throw new o("The CLM swap requires different input and output tokens.");let k=await u.token(n);return{...await x(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:k,amount:E.toString()},minimumOutput:{token:k,amount:C.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...z,amount0:O(),amount1:O()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount0","amount1","slippageBps"]),r=Q(e.slippageBps),c=G(e.amount0,!0),n=G(e.amount1,!0);if(c===0n&&n===0n)throw new o("At least one CLM deposit amount must be positive.");let i=await b(a,t);if(await i.entryAvailable(),await i.balance(a.wants[0])<c||await i.balance(a.wants[1])<n)throw new o("Acquire the CLM constituents first and retry with their mined balances.");let[l,g,u,y,E]=ne(await i.read(a.manager,"previewDeposit",[c,n]),5);if(g>c||u>n||g+u===0n||y>g||E>u)throw new o("The CLM returned invalid deposit amounts or fees.");let C=X(l,r),k=[];for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),M.toString(),S));k.push(h(a.manager,T({abi:Z,functionName:"deposit",args:[c,n,C]}),`Mint at least ${C} CLM share base units to the calling wallet.`));for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),"0",S));return{...await x(k,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await i.token(a.manager),amount:l.toString()},minimumShares:C.toString(),usedAmounts:[g.toString(),u.toString()],fees:[y.toString(),E.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...z,shares:{anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["shares","slippageBps"]),r=Q(e.slippageBps),c=e.shares==="all"?void 0:G(e.shares),n=await b(a,t),i=await n.balance(a.manager),l=c??i;if(l===0n||l>i)throw new o("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[l]),2).map(E=>E===0n?0n:X(E,r));if(u.every(E=>E===0n))throw new o("No positive CLM withdrawal output is available.");let y=[h(a.manager,T({abi:Z,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await x(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(E,C)=>({token:await n.token(a.wants[C]),amount:E.toString()})))}})}]}};async function je(d,s,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let h=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},x=ue({clientFor:()=>b,http:fetch,quoteSwap:h,buildSwap:h,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await xe(x).tools.find(t=>t.name===d).execute(s,m)).txs}function Ge(d,s,m){let b=()=>{throw new o("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function h(x,e,t){if(x===e)return;let a=J({abi:t,data:x}),r=J({abi:t,data:e});(a.functionName!==r.functionName||!a.args||!r.args)&&b();let c=[...a.args],n=[...r.args];if(I(T({abi:t,functionName:a.functionName,args:c}),x)||b(),a.functionName==="deposit"||a.functionName==="withdraw")for(let i of a.functionName==="deposit"?[2]:[1,2])F(c[i])<F(n[i])&&b(),c[i]=n[i];else if(a.functionName==="multicall"){let i=F(c[0]);(i<=m||i>F(n[0]))&&b(),(!Array.isArray(c[1])||!Array.isArray(n[1])||c[1].length!==1||n[1].length!==1)&&b(),h(c[1][0],n[1][0],W),c[0]=n[0],c[1]=n[1]}else if(a.functionName==="exactInput"){let i={...c[0]},l=n[0];F(i.amountOutMinimum)<F(l.amountOutMinimum)&&b(),i.amountOutMinimum=l.amountOutMinimum,"deadline"in i&&((F(i.deadline)<=m||F(i.deadline)>F(l.deadline))&&b(),i.deadline=l.deadline),c[0]=i}else b();I(T({abi:t,functionName:a.functionName,args:c}),e)||b()}(!s.length||d.length!==s.length)&&b();for(let[x,e]of d.entries()){let t=s[x];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&b();try{if(I(t.to,q.markets.cl.router))J({abi:ce,data:t.data}).args[0].deadline<=m&&b();else if(I(t.to,q.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=m)&&b()}}catch{b()}if(!I(e.data,t.data))try{let a=De.find(r=>I(r.manager,t.to));h(e.data,t.data,a?Z:I(t.to,q.markets.cl.router)?ce:W)}catch{b()}}}var We=d=>({tools:xe(d).tools.slice(1)});export{De as a,we as b,Z as c,ce as d,W as e,Se as f,Me as g,xe as h,je as i,Ge as j,We as k};
1
+ import{b as pe,c as me}from"./5OKJEGBH.js";import{a as ue}from"./Z4SRGAVL.js";import{a as be}from"./PBQSJSZO.js";import{c as le}from"./MYFAKCQI.js";import{a as O}from"./5ZLOCQA4.js";import{c as Y,d as oe,g as I,i as fe,m as re,n as se}from"./5KUWLUPM.js";import{a as S,i as de,j as ie}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{decodeFunctionData as J,encodeFunctionData as T,erc20Abi as te,getAddress as he,keccak256 as Ce,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"}};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],Z=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ce=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),Fe=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),ge={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ye=P(["function deposit() payable"]),z={vault:Y,chainId:{const:S},slippageBps:{type:"integer",minimum:0,maximum:500}},Be=10n**36n,K=he(de[S].uniswap.WETH.address),ve="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ke=Object.fromEntries(Object.entries(q.codeHashes).map(([d,s])=>[d.toLowerCase(),s])),Ae=Object.fromEntries(Object.entries(q.delegates).map(([d,s])=>[d.toLowerCase(),s]));function f(d){return fe(d,"Provide a token or vault address.",oe)}function F(d){return re(d,"Invalid Beefy CLM integer.")}function G(d,s=!1){return se(d,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!s})}function Q(d){let s=d??50;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>500)throw new o("Use integer slippageBps from 0 to 500.");return BigInt(s)}function X(d,s){let m=d*(10000n-s)/10000n;if(m<=0n)throw new o("This CLM amount is too small for a positive output minimum.");return m}function ne(d,s){if(!Array.isArray(d)||d.length!==s)throw new o("Invalid Beefy CLM quote.");return d.map(F)}function Se(d){let s=f(d),m=De.find(b=>I(b.vault,s));if(!m)throw new o("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return m}function Me(d,s,m,b,h){if(d<=0n||m<=0n||b<0n||h<0n)throw new o("The CLM price or budget is invalid.");let x=s?d*m/Be:d;if(x===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=h>e?h-e:e-h,a=x<t?x:t,r=(x-a)/2n,c=d*(h>e?a+r:r)/x;return[c,d-c]}var xe=d=>{async function s(e){try{return await e()}catch(t){throw new o(d.plainError(t))}}function m(e,t){if(e.chainId!==void 0&&e.chainId!==S)throw new o("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new o(`Unsupported Beefy CLM input: ${a}.`);return Se(e.vault)}async function b(e,t){be(t);let a=d.clientFor(S);if(await a.getChainId()!==S)throw new o("The Beefy CLM endpoint must report chain 4663.");let r=F(await a.getBlockNumber()),c=await a.getBlock({blockNumber:r}),n=(B,p,A=[])=>a.readContract({address:f(B),abi:Z,functionName:p,args:A,blockNumber:r}),i=new Set;async function l(B){let p=B.toLowerCase();if(i.has(p))return;let A=ke[p];if(!A)throw new o("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:r});if(!D||Ce(D)!==A)throw new o("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");i.add(p),Ae[p]&&await l(Ae[p])}await me(a,f(e.vault),r);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await l(B);let[g,u,y,E,C,k,w,M,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(g)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,p)=>f(B)!==e.wants[p])||f(y)!==e.strategy||f(E)!==e.implementation||f(C)!==e.pool||f(k)!==e.manager||f(w)!==e.wants[0]||f(M)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new o("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>F(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:r}));async function ae(B){let p=f(B),[A,D]=await Promise.all([a.readContract({address:p,abi:te,functionName:"symbol",blockNumber:r}),a.readContract({address:p,abi:te,functionName:"decimals",blockNumber:r})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new o("Invalid CLM token metadata.");return{address:p,symbol:A,decimals:D,chainId:S}}async function U(){let p=(await le(d.http,"https://api.beefy.finance/vaults",{},v=>Array.isArray(v)&&v.every($=>$!==null&&typeof $=="object"))).filter(v=>v.chain==="robinhood"&&typeof v.earnContractAddress=="string"&&I(v.earnContractAddress,e.vault)),A=p[0],D=pe(f(e.vault));if(p.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new o("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new o(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),_=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(_.some(v=>typeof v!="boolean"))throw new o("Invalid Beefy strategy pause flag.");if(_.some(Boolean))throw new o("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new o("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,p){let A=new Set([...e.wants,f(ie),K]);if(!A.has(B)||!A.has(p)||B===p)throw new o("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=q.routes.find(H=>H.from===B&&H.to===p&&(H.pools[0]===e.pool||H.kind==="v3"));if(!D)throw new o("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=q.markets[D.kind];for(let H of[L.router,L.quoter,L.factory,...D.pools])await l(H);let _=D.path;if(_.length!==88||f(_.slice(0,42))!==B||f(`0x${_.slice(-40)}`)!==p)throw new o("Invalid qualified CLM swap path.");let v=Number.parseInt(_.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:ge[D.kind],functionName:"getPool",args:[B,p,v],blockNumber:r});if(f($)!==D.pools[0])throw new o("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new o("The CLM quoter factory differs from its pin.");return D}async function j(B,p,A){let D=await N(B,p),L=q.markets[D.kind],_=await a.simulateContract({address:f(L.quoter),abi:Fe,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:r}),v=F(_.result[0]);if(v===0n)throw new o("No positive quote for this CLM swap.");return{selected:D,market:L,out:v}}return{client:a,blockNumber:r,deadline:c.timestamp+600n,read:n,balance:V,token:ae,code:l,entryAvailable:U,quote:j}}function h(e,t,a,r="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:r,chainId:S})}async function x(e,t,a){let r=await d.preview(e,t);return{txs:e,preview:r,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount","slippageBps"]),r=Q(e.slippageBps),c=await b(a,t),[n,i,l,g,u,y,E,C]=await Promise.all([c.token(a.wants[0]),c.token(a.wants[1]),c.token(a.manager),c.balance(a.wants[0]),c.balance(a.wants[1]),c.balance(a.manager),c.read(a.manager,"balances"),c.read(a.strategy,"price")]),k;if(e.amount!==void 0){await c.entryAvailable();let w=G(e.amount),[M,R]=ne(E,2),ee=Me(w,a.bridge===n.address,F(C),M,R),V=[];for(let[ae,U]of[n,i].entries()){let N=ee[ae],j=N===0n||U.address===a.bridge?N:(await c.quote(f(a.bridge),U.address,N)).out;V.push({token:U,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":X(j,r).toString(),swapRequired:N>0n&&U.address!==a.bridge})}k={bridge:await c.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:S,vault:a.vault,manager:a.manager,bridge:await c.token(a.bridge),constituents:[{token:n,balance:g.toString()},{token:i,balance:u.toString()}],shares:{token:l,amount:y.toString()},entryPlan:k,block:c.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...z,from:Y,to:Y,amount:O()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["from","to","amount","slippageBps"]),r=Q(e.slippageBps),c=f(e.from),n=f(e.to),i=G(e.amount),l=c.toLowerCase()===ve,g=l?K:c,u=await b(a,t);if((l?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(c))<i)throw new o("Insufficient CLM swap balance; keep ETH for gas.");let y=[];l&&(await u.code(K),y.push(h(K,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",i.toString())));let E=i,C=i;if(g!==n){let w=await u.quote(g,n,i);E=w.out,C=X(E,r),y.push(d.approval(g,f(w.market.router),i.toString(),S));let M={path:w.selected.path,recipient:t,amountIn:i,amountOutMinimum:C},R=w.selected.kind==="cl"?T({abi:ce,functionName:"exactInput",args:[{...M,deadline:u.deadline}]}):T({abi:W,functionName:"multicall",args:[u.deadline,[T({abi:W,functionName:"exactInput",args:[M]})]]});y.push(h(w.market.router,R,`Swap exact input with at least ${C} output base units to the calling wallet.`))}else if(!l)throw new o("The CLM swap requires different input and output tokens.");let k=await u.token(n);return{...await x(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:k,amount:E.toString()},minimumOutput:{token:k,amount:C.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...z,amount0:O(),amount1:O()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount0","amount1","slippageBps"]),r=Q(e.slippageBps),c=G(e.amount0,!0),n=G(e.amount1,!0);if(c===0n&&n===0n)throw new o("At least one CLM deposit amount must be positive.");let i=await b(a,t);if(await i.entryAvailable(),await i.balance(a.wants[0])<c||await i.balance(a.wants[1])<n)throw new o("Acquire the CLM constituents first and retry with their mined balances.");let[l,g,u,y,E]=ne(await i.read(a.manager,"previewDeposit",[c,n]),5);if(g>c||u>n||g+u===0n||y>g||E>u)throw new o("The CLM returned invalid deposit amounts or fees.");let C=X(l,r),k=[];for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),M.toString(),S));k.push(h(a.manager,T({abi:Z,functionName:"deposit",args:[c,n,C]}),`Mint at least ${C} CLM share base units to the calling wallet.`));for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),"0",S));return{...await x(k,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await i.token(a.manager),amount:l.toString()},minimumShares:C.toString(),usedAmounts:[g.toString(),u.toString()],fees:[y.toString(),E.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...z,shares:{anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["shares","slippageBps"]),r=Q(e.slippageBps),c=e.shares==="all"?void 0:G(e.shares),n=await b(a,t),i=await n.balance(a.manager),l=c??i;if(l===0n||l>i)throw new o("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[l]),2).map(E=>E===0n?0n:X(E,r));if(u.every(E=>E===0n))throw new o("No positive CLM withdrawal output is available.");let y=[h(a.manager,T({abi:Z,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await x(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(E,C)=>({token:await n.token(a.wants[C]),amount:E.toString()})))}})}]}};async function je(d,s,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let h=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},x=ue({clientFor:()=>b,http:fetch,quoteSwap:h,buildSwap:h,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await xe(x).tools.find(t=>t.name===d).execute(s,m)).txs}function Ge(d,s,m){let b=()=>{throw new o("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function h(x,e,t){if(x===e)return;let a=J({abi:t,data:x}),r=J({abi:t,data:e});(a.functionName!==r.functionName||!a.args||!r.args)&&b();let c=[...a.args],n=[...r.args];if(I(T({abi:t,functionName:a.functionName,args:c}),x)||b(),a.functionName==="deposit"||a.functionName==="withdraw")for(let i of a.functionName==="deposit"?[2]:[1,2])F(c[i])<F(n[i])&&b(),c[i]=n[i];else if(a.functionName==="multicall"){let i=F(c[0]);(i<=m||i>F(n[0]))&&b(),(!Array.isArray(c[1])||!Array.isArray(n[1])||c[1].length!==1||n[1].length!==1)&&b(),h(c[1][0],n[1][0],W),c[0]=n[0],c[1]=n[1]}else if(a.functionName==="exactInput"){let i={...c[0]},l=n[0];F(i.amountOutMinimum)<F(l.amountOutMinimum)&&b(),i.amountOutMinimum=l.amountOutMinimum,"deadline"in i&&((F(i.deadline)<=m||F(i.deadline)>F(l.deadline))&&b(),i.deadline=l.deadline),c[0]=i}else b();I(T({abi:t,functionName:a.functionName,args:c}),e)||b()}(!s.length||d.length!==s.length)&&b();for(let[x,e]of d.entries()){let t=s[x];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&b();try{if(I(t.to,q.markets.cl.router))J({abi:ce,data:t.data}).args[0].deadline<=m&&b();else if(I(t.to,q.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=m)&&b()}}catch{b()}if(!I(e.data,t.data))try{let a=De.find(r=>I(r.manager,t.to));h(e.data,t.data,a?Z:I(t.to,q.markets.cl.router)?ce:W)}catch{b()}}}var We=d=>({tools:xe(d).tools.slice(1)});export{De as a,we as b,Z as c,ce as d,W as e,Se as f,Me as g,xe as h,je as i,Ge as j,We as k};
@@ -1 +1 @@
1
- import{a as A}from"./SSTROLQM.js";import{a,b as g,c as b,e as w,f as x,g as h}from"./3NDVXEBR.js";import{a as r}from"./UWOFA6GV.js";import{c as y}from"./73N3TOJL.js";import{a as m}from"./G6HCV67X.js";import{a as i}from"./5YS5V2LK.js";import{encodeAbiParameters as S,encodeFunctionData as B,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as C,parseAbiParameters as N,zeroAddress as R}from"viem";var O=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),$=N("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=C(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),Q=C(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:y,amount:r(),currency:y,startBlock:r(),endBlock:r(),claimBlock:r(),tickSpacing:r(),floorPrice:r(),requiredCurrencyRaised:r(),salt:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:r(),duration:r()}}}};function D(e,t){let s=a(e.startBlock,"startBlock",64),o=a(e.endBlock,"endBlock",64),c=a(e.claimBlock,"claimBlock",64);if(o<=s||c<o)throw new i("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new i("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new i("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let n=d,k=a(n.mps,"mps",24,!0),f=a(n.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(f)]).slice(2)}`,l+=k*f,p+=f}if(l!==10000000n||p!==o-s)throw new i("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S($,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:s,endBlock:o,claimBlock:c,tickSpacing:a(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:a(e.floorPrice,"floorPrice"),requiredCurrencyRaised:a(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function U(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,s){h(t,Object.keys(v));let o=g(t.token),c=a(t.amount,"amount",128);if(o===R||o===b(t.currency))throw new i("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=D(t,s);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new i("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(m),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new i("Choose a future auction startBlock with time for confirmation and approvals.");let n=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[o,c,u,p,s]});if((await l.getCode({address:n})??"0x")!=="0x")throw new i("This auction already exists; choose a fresh salt or configuration.");let k=await w(e,o),f=[e.unsignedTx({to:A,data:B({abi:P,functionName:"create",args:[o,c,u,p]}),value:"0",chainId:m,description:`Create CCA ${n}; proceeds and unsold tokens go to ${s}.`}),e.unsignedTx({to:o,data:B({abi:I,functionName:"transfer",args:[n,c]}),value:"0",chainId:m,description:`Fund the factory-predicted auction ${n} with exactly ${c} base units of ${o}.`}),e.unsignedTx({to:n,data:B({abi:C(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:m,description:`Activate CCA ${n} after its sale tokens arrive.`})];return{...await x(e,f,s,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:n,sale:{token:k,amount:c.toString()}}}}]}}export{O as a,$ as b,P as c,Q as d,D as e,U as f};
1
+ import{a as A}from"./MDDHG34Y.js";import{a,b as g,c as b,e as w,f as x,g as h}from"./SGEZIYJW.js";import{a as r}from"./5ZLOCQA4.js";import{c as y}from"./5KUWLUPM.js";import{a as m}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as B,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as C,parseAbiParameters as N,zeroAddress as R}from"viem";var O=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),$=N("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=C(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),Q=C(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:y,amount:r(),currency:y,startBlock:r(),endBlock:r(),claimBlock:r(),tickSpacing:r(),floorPrice:r(),requiredCurrencyRaised:r(),salt:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:r(),duration:r()}}}};function D(e,t){let s=a(e.startBlock,"startBlock",64),o=a(e.endBlock,"endBlock",64),c=a(e.claimBlock,"claimBlock",64);if(o<=s||c<o)throw new i("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new i("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new i("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let n=d,k=a(n.mps,"mps",24,!0),f=a(n.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(f)]).slice(2)}`,l+=k*f,p+=f}if(l!==10000000n||p!==o-s)throw new i("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S($,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:s,endBlock:o,claimBlock:c,tickSpacing:a(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:a(e.floorPrice,"floorPrice"),requiredCurrencyRaised:a(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function U(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,s){h(t,Object.keys(v));let o=g(t.token),c=a(t.amount,"amount",128);if(o===R||o===b(t.currency))throw new i("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=D(t,s);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new i("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(m),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new i("Choose a future auction startBlock with time for confirmation and approvals.");let n=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[o,c,u,p,s]});if((await l.getCode({address:n})??"0x")!=="0x")throw new i("This auction already exists; choose a fresh salt or configuration.");let k=await w(e,o),f=[e.unsignedTx({to:A,data:B({abi:P,functionName:"create",args:[o,c,u,p]}),value:"0",chainId:m,description:`Create CCA ${n}; proceeds and unsold tokens go to ${s}.`}),e.unsignedTx({to:o,data:B({abi:I,functionName:"transfer",args:[n,c]}),value:"0",chainId:m,description:`Fund the factory-predicted auction ${n} with exactly ${c} base units of ${o}.`}),e.unsignedTx({to:n,data:B({abi:C(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:m,description:`Activate CCA ${n} after its sale tokens arrive.`})];return{...await x(e,f,s,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:n,sale:{token:k,amount:c.toString()}}}}]}}export{O as a,$ as b,P as c,Q as d,D as e,U as f};
@@ -1 +1 @@
1
- import{d as a}from"./BX7XQANB.js";import{a as i}from"./SPRVVJXI.js";import{a as o}from"./G6HCV67X.js";var d=n=>({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}$"}}},execute:async(s,c)=>{let r=await a(e,s,c,n.clientFor(o));return{txs:r.txs,summary:r.decision}}}})});export{d as a};
1
+ import{d as a}from"./ALPYEM7B.js";import{a as i}from"./SPRVVJXI.js";import{a as o}from"./FWD4L3CJ.js";var d=n=>({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}$"}}},execute:async(s,c)=>{let r=await a(e,s,c,n.clientFor(o));return{txs:r.txs,summary:r.decision}}}})});export{d as a};
@@ -0,0 +1 @@
1
+ import{a as i}from"./XSD5NL7J.js";import{erc20Abi as a}from"viem";async function d(e,o,t){let r=await e.readContract({address:o,abi:a,functionName:"symbol",...t===void 0?{}:{blockNumber:t}});if(typeof r!="string"||!/^[A-Za-z0-9$._-]{1,64}$/.test(r))throw new i("Vault share symbol is unavailable or invalid.");return r}export{d as a};
@@ -0,0 +1 @@
1
+ import{a as N}from"./ZGKVXFM5.js";import{a as E}from"./L6D26AMO.js";import{b as _,c as q,d as O,e as R}from"./PWH464CJ.js";import{a as I}from"./SSIENQVU.js";import{c as M}from"./IKEJCBYU.js";import{b as G}from"./Z4SRGAVL.js";import{a as y}from"./PBQSJSZO.js";import{a as x}from"./UP7FBDMJ.js";import{a as o,d as U,i as P,j as b}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as g,erc20Abi as k,parseAbi as F}from"viem";var i=P[o].vaults.steakhouse.address,j=(1n<<256n)-1n,l=F(["function asset() view returns (address)","function totalAssets() view returns (uint256)","function convertToAssets(uint256 shares) view returns (uint256 assets)","function previewWithdraw(uint256 assets) view returns (uint256 shares)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]);function S(e){if(typeof e!="bigint"||e<0n||e>j)throw new r("The vault returned an invalid base-unit amount.");return e}function D(e){if(typeof e!="string")throw new r("Amount must be an integer string in base units.");let c=x(e);if(c===0n)throw new r("Amount must be positive.");if(c>j)throw new r("Amount exceeds the uint256 range.");return c}function T(e,c,h=!1){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(w=>!c||!["amount",...h?["force","maxPenaltyAssets","minAmountOut"]:[]].includes(w)))throw new r("Unexpected Steakhouse argument.")}var L=e=>{async function c(t){try{return await t()}catch(s){throw new r(e.plainError(s))}}async function h(){let t=e.clientFor(o);if(await t.getChainId()!==o)throw new r("Steakhouse requires chain 4663.");let s=await t.readContract({address:i,abi:l,functionName:"asset"});if(typeof s!="string"||s.toLowerCase()!==b.toLowerCase())throw new r("The Steakhouse vault asset does not match USDG on chain 4663.");let[a,n]=await Promise.all([t.readContract({address:b,abi:k,functionName:"decimals"}),t.readContract({address:i,abi:k,functionName:"decimals"})]);if(a!==U||!Number.isInteger(n)||n<0||n>255)throw new r("The vault returned invalid asset or share decimals.");return{client:t,asset:{address:b,symbol:"USDG",decimals:a,chainId:o},shares:{address:i,symbol:"steakUSDG",decimals:n,chainId:o}}}async function w(t,s){return S(await t.readContract({address:i,abi:k,functionName:"balanceOf",args:[s]}))}async function C(t,s,a){let n=await e.preview(t,s);if(n.changes.length===0)throw new r("The Steakhouse simulation returned no token balance changes.");let u=n.changes.map(({token:m,amount:d})=>{let f=d.startsWith("-"),p=e.formatAmount(f?d.slice(1):d,m.decimals);return`${f?"-":""}${p} ${m.symbol} (${m.address}, chain ${m.chainId}, decimals ${m.decimals})`});return{txs:t,summary:`${a} ${n.summary} Changes: ${u.join("; ")}.`}}return{tools:[q(e,"steakhouse_details",i),I(e,"steakhouse_analytics",i),E(e,"steakhouse_manage",i),...N(e,"steakhouse",i),{name:"steakhouse_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>c(async()=>{T(t,!1);let{client:s,asset:a,shares:n}=await h(),u=S(await s.readContract({address:i,abi:l,functionName:"totalAssets"}));return[{name:"Steakhouse USDG",vault:n,asset:a,totalAssets:{token:a,amount:u.toString()}}]})},{name:"steakhouse_deposit",inputSchema:{...$(!1),description:"Deposit USDG in base units (1 USDG = 1000000) for vault shares. Exit with steakhouse_withdraw; check positions after confirmation."},execute:async(t,s)=>c(async()=>{T(t,!0);let a=D(t.amount);y(s);let{asset:n}=await h(),u=[e.approval(n.address,i,a.toString(),o),e.unsignedTx({to:i,data:g({abi:l,functionName:"deposit",args:[a,s]}),value:"0",chainId:o,description:`Deposit ${e.formatAmount(a.toString(),n.decimals)} USDG into Steakhouse.`})];return C(u,s,"Approve the exact USDG amount, then deposit into Steakhouse.")})},{name:"steakhouse_withdraw",inputSchema:{...$(!0),description:"Withdraw USDG in 6-decimal base units, or amount max to redeem every share for USDG. Check positions after confirmation.",properties:{...$(!0).properties,force:{type:"boolean",description:"Explicitly plan a full Morpho V2 force exit with penalty disclosure."},maxPenaltyAssets:{type:"string",pattern:"^[0-9]+$"},minAmountOut:{type:"string",pattern:"^[0-9]+$"}}},execute:async(t,s)=>c(async()=>{T(t,!0,!0);let a=t.amount==="max"?null:D(t.amount);y(s);let{client:n,asset:u,shares:m}=await h(),d=await w(n,s);if(d===0n)throw new r("The wallet has no Steakhouse shares to withdraw.");if(t.force!==void 0&&typeof t.force!="boolean")throw new r("force must be a boolean.");if(t.force===!0){if(a!==null)throw new r("Force exit currently requires amount max.");let p=M(t.maxPenaltyAssets),W=D(t.minAmountOut),v=await _(e,n,i,s,d,p),A=await e.preview([v.tx],s);return R(A.changes,i,d,W),{txs:[v.tx],preview:A,summary:`${O(v.plan)} ${A.summary}`}}if(t.maxPenaltyAssets!==void 0||t.minAmountOut!==void 0)throw new r("Penalty and output limits require force true.");let f;if(a===null)f=e.unsignedTx({to:i,data:g({abi:l,functionName:"redeem",args:[d,s,s]}),value:"0",chainId:o,description:`Redeem all ${e.formatAmount(d.toString(),m.decimals)} steakUSDG shares.`});else{let p=S(await n.readContract({address:i,abi:l,functionName:"previewWithdraw",args:[a]}));if(p===0n||p>d)throw new r("The withdrawal exceeds the available share balance or has an invalid share quote.");f=e.unsignedTx({to:i,data:g({abi:l,functionName:"withdraw",args:[a,s,s]}),value:"0",chainId:o,description:`Withdraw ${e.formatAmount(a.toString(),u.decimals)} USDG from Steakhouse.`})}return C([f],s,a===null?"Redeem the current full share balance from Steakhouse.":"Withdraw the requested USDG amount from Steakhouse.")})}],positions:t=>c(async()=>{y(t);let{client:s,asset:a,shares:n}=await h(),u=await w(s,t);if(u===0n)return[];let m=S(await s.readContract({address:i,abi:l,functionName:"convertToAssets",args:[u]}));return[{module:"steakhouse",id:`${o}:${i.toLowerCase()}`,chainId:o,assets:[{token:a,amount:m.toString()}],description:`${e.formatAmount(u.toString(),n.decimals)} steakUSDG shares (${i}, chain ${o}, decimals ${n.decimals}); USDG conversion is indicative, not guaranteed exit liquidity.`}]})}};function $(e){return{type:"object",additionalProperties:!1,required:["amount"],properties:{amount:{type:"string",pattern:e?"^(?:[0-9]+|max)$":"^[0-9]+$",description:`USDG base-unit integer string (6 decimals)${e?", or max to redeem every share":""}.`}}}}var te=e=>G("steakhouse",[L(e)]);export{L as a,te as b};
@@ -1 +1 @@
1
- import{a as p,b as g,i as _}from"./G6HCV67X.js";import{a as c}from"./5YS5V2LK.js";import{AsyncLocalStorage as j}from"node:async_hooks";import{custom as I}from"viem";import{createPublicClient as A,custom as k,defineChain as N}from"viem";var T="https://rpc.mainnet.chain.robinhood.com",F="oak-core/0.1.0",K=_[4663].ponsClaims.multicall3.address,v=new Set(["eth_sendTransaction","eth_sendRawTransaction","eth_sign","personal_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","wallet_sendTransaction","wallet_sign"]);function U(e=p,t=T){if(!Number.isSafeInteger(e)||e<=0)throw new c("Provide a positive integer chain ID.");let n=e===p?"Robinhood Chain":e===g?"Robinhood Chain Testnet":`Chain ${e}`;return N({id:e,name:n,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:[t]}},...e===p?{contracts:{multicall3:{address:K}}}:{}})}function Z(e=p,t){if(t?.chain&&t.chain.id===e)return t.chain.contracts?.multicall3?.address;if(!(!Number.isSafeInteger(e)||e<=0))return U(e).contracts?.multicall3?.address}function q(e,t,n){let s=e?.trim()||n?.rpcUrl?.trim()||n?.rpcUrls?.[t]?.trim(),r=t===p?process.env.OAK_RPC_URL?.trim():t===g?(process.env.OAK_TESTNET_RPC_URL??process.env.OAK_RPC_URL)?.trim():process.env[`OAK_RPC_URL_${t}`]?.trim(),a=s||r||(t===p?T:void 0);if(!a)throw new c(`No RPC URL configured for chain ${t}.`);if((n?.requireKeyedRpc??process.env.NODE_ENV==="production")&&t===p&&a===T)throw new c("Production requires a keyed OAK_RPC_URL.");return a}var $=1e4;async function P(e,t=$){if(!Number.isFinite(t)||t<=0||t>3e4)throw new c("RPC timeout must be greater than zero and at most 30000 ms.");let n=new AbortController,s;try{return await Promise.race([new Promise((r,a)=>{s=setTimeout(()=>{a(new c("The RPC request timed out. Please try again.")),n.abort()},t)}),e(n.signal)])}finally{clearTimeout(s)}}function H(e,t=p,n){let s=typeof e=="object"&&e!==null,r=s?e:n??{},a=typeof e=="string"?e:r.rpcUrl,i=s?r.chainId??t:t;if(!Number.isSafeInteger(i)||i<=0)throw new c("Provide a positive integer chain ID.");if(r.timeoutMs!==void 0&&(!Number.isFinite(r.timeoutMs)||r.timeoutMs<=0||r.timeoutMs>3e4))throw new c("RPC timeout must be greater than zero and at most 30000 ms.");let d=q(a,i,r),u=U(i,d);if(r.transport){let o=r.transport({chain:u,retryCount:0});return A({chain:u,transport:k({request:m=>{if(v.has(m.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(m.method))throw new c("Read-only RPC client does not allow this method.");return P(()=>o.request(m),r.timeoutMs)}},{retryCount:0})})}let l=M({url:d,chainId:i,fetch:r.fetch,userAgent:r.userAgent?.trim()||F,retries:r.retries,retryDelayMs:r.retryDelayMs,maxRetryDelayMs:r.maxRetryDelayMs,timeoutMs:r.timeoutMs,fallbackUrls:r.rpcFallbackUrls?.[i]??r.fallbackRpcUrls??C(process.env[`OAK_RPC_FALLBACK_URLS_${i}`]??(i===p?process.env.OAK_RPC_FALLBACK_URLS:void 0))})({chain:u,retryCount:0}),h=k({request:o=>{if(v.has(o.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(o.method))throw new c("Read-only RPC client does not allow this method.");return l.request(o)}},{retryCount:0});return A({chain:u,transport:h})}function ee(e={}){let t=new Map;return n=>{let s=t.get(n);if(s)return s;let r=H(e.rpcUrls?.[n],n,e);return t.set(n,r),r}}var y=class extends c{};function D(e){let t=[];for(;e&&typeof e=="object"&&!t.includes(e);)t.push(e),e=e.cause;return t}function B(e){return D(e).find(t=>t instanceof y)}function z(e){if(!B(e))for(let t of D(e)){let n=Number(t.status??t.code);if(n===429||n>=500&&n<=599)return{status:n,delay:typeof t.retryAfterMs=="number"?t.retryAfterMs:void 0};if(/rate.?limit|too many requests/i.test(String(t.message??"")))return{status:429}}}async function x(e,t,n={},s){let r=n.retries??3,a=n.retryDelayMs??250,i=n.maxRetryDelayMs??2e3;if(!Number.isInteger(r)||r<0||r>5||!Number.isFinite(a)||a<0||!Number.isFinite(i)||i<0||i>3e4)throw new c("RPC retries must be 0 to 5; backoff must be non-negative and at most 30000 ms.");for(let d=0;;d++){s?.throwIfAborted();try{return await e()}catch(u){let f=z(u);if(!f)throw u;let l=Math.min(i,a*2**d),h=Math.max(Math.min(i,l+Math.floor(Math.random()*l/4)),f.delay??0);if(d>=r||h>i){let o=f.status===429?"public RPC rate-limited":`RPC returned HTTP ${f.status}`,m=f.delay?` Retry after ${Math.max(1,Math.ceil(f.delay/1e3))} seconds.`:"";throw new y(`${o}, retried ${d} times (${t}).${m} ${f.status===429?"The RPC rate limit remains active. ":""}Configure a keyed OAK_RPC_URL or comma-separated OAK_RPC_FALLBACK_URLS for this chain.`)}await new Promise((o,m)=>{let w=()=>{clearTimeout(b),m(s?.reason)},b=setTimeout(()=>{s?.removeEventListener("abort",w),o()},h);s?.addEventListener("abort",w,{once:!0}),s?.aborted&&w()})}}}function C(e){if(e===void 0||e.trim()==="")return[];let t=e.split(",").map(n=>n.trim());if(t.length>4)throw new c("Configure at most four ordered fallback RPC URLs.");for(let n of t){let s;try{s=new URL(n)}catch{throw new c("Fallback RPC URLs must use HTTP or HTTPS.")}if(!["http:","https:"].includes(s.protocol))throw new c("Fallback RPC URLs must use HTTP or HTTPS.")}return t}var R=new Map;async function J(e,t,n){let s=R.get(e)??Promise.resolve(),r,a=new Promise(d=>{r=d}),i=s.then(()=>a);R.set(e,i);try{return await s,n.throwIfAborted(),await t()}finally{r(),R.get(e)===i&&R.delete(e)}}var L=new j,S=new Map,E=e=>{let t=new URL(e).origin,n=S.get(t);return n||(n={interactive:0},S.set(t,n)),n};async function V(e,t){let n=L.getStore(),s=[...new Set(e.map(E))].filter(r=>!n?.has(r));s.forEach(r=>{r.interactive++});try{let r=s.flatMap(a=>a.background?[a.background.catch(()=>{})]:[]);return r.length&&await Promise.all(r),await t()}finally{s.forEach(r=>{r.interactive--})}}async function oe(e,t,n=s=>new Promise(r=>{setTimeout(r,s).unref()})){let s=E(e);for(;s.interactive||s.background;)await n(100);let r=Promise.resolve().then(()=>L.run(new Set([s]),t));s.background=r;try{return await r}finally{s.background===r&&(s.background=void 0)}}function M(e){let t=[...new Set([e.url,...e.fallbackUrls??[]])];C(t.slice(1).join(","));let n=new Set,s=0;return I({request:({method:r,params:a})=>V(t,()=>P(async i=>{let d;for(let u of t){let f=async(l,h=[])=>{let o=await(e.fetch??globalThis.fetch)(u,{method:"POST",redirect:"error",signal:i,headers:{"content-type":"application/json","user-agent":e.userAgent??"oak-core/0.1.0"},body:JSON.stringify({jsonrpc:"2.0",id:++s,method:l,params:h})});if(!o.ok){let w=o.headers.get("retry-after"),b=w===null?void 0:/^\d+(\.\d+)?$/.test(w.trim())?Number(w)*1e3:Math.max(0,Date.parse(w)-Date.now()),O=typeof b=="number"&&Number.isFinite(b)?b:void 0;throw await o.body?.cancel(),o.status===429||o.status>=500?Object.assign(new Error("Transient RPC HTTP failure"),{status:o.status,retryAfterMs:O}):new y(`RPC returned HTTP ${o.status} (${l}).`)}let m;try{m=await o.json()}catch{throw new y("The RPC endpoint returned malformed JSON.")}if(m.error)throw Object.assign(new Error(m.error.message??"RPC error"),{code:m.error.code,data:m.error.data});return m.result};try{if(u!==t[0]&&r!=="eth_chainId"&&(!n.has(u)||r==="eth_sendRawTransaction")){let o=await x(()=>f("eth_chainId"),"eth_chainId",e,i);if(Number(o)!==e.chainId)throw new y("RPC chain does not match the requested chain.");n.add(u)}let l=()=>x(()=>f(r,a),r,e,i),h=await(r==="eth_simulateV1"?J(u,l,i):l());if(r==="eth_chainId")if(Number(h)!==e.chainId){if(u!==t[0])throw new y("RPC chain does not match the requested chain.")}else n.add(u);return h}catch(l){if(d=l,!(l instanceof y)||!/rate-limited|HTTP 5\d\d|chain does not match/.test(l.message))throw l}}throw d},e.timeoutMs))},{retryCount:0})}export{y as a,B as b,x as c,C as d,V as e,oe as f,M as g,T as h,F as i,K as j,U as k,Z as l,$ as m,P as n,H as o,ee as p};
1
+ import{a as p,b as g,i as _}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{AsyncLocalStorage as j}from"node:async_hooks";import{custom as I}from"viem";import{createPublicClient as A,custom as k,defineChain as N}from"viem";var T="https://rpc.mainnet.chain.robinhood.com",F="oak-core/0.1.0",K=_[4663].ponsClaims.multicall3.address,v=new Set(["eth_sendTransaction","eth_sendRawTransaction","eth_sign","personal_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","wallet_sendTransaction","wallet_sign"]);function U(e=p,t=T){if(!Number.isSafeInteger(e)||e<=0)throw new c("Provide a positive integer chain ID.");let n=e===p?"Robinhood Chain":e===g?"Robinhood Chain Testnet":`Chain ${e}`;return N({id:e,name:n,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:[t]}},...e===p?{contracts:{multicall3:{address:K}}}:{}})}function Z(e=p,t){if(t?.chain&&t.chain.id===e)return t.chain.contracts?.multicall3?.address;if(!(!Number.isSafeInteger(e)||e<=0))return U(e).contracts?.multicall3?.address}function q(e,t,n){let s=e?.trim()||n?.rpcUrl?.trim()||n?.rpcUrls?.[t]?.trim(),r=t===p?process.env.OAK_RPC_URL?.trim():t===g?(process.env.OAK_TESTNET_RPC_URL??process.env.OAK_RPC_URL)?.trim():process.env[`OAK_RPC_URL_${t}`]?.trim(),a=s||r||(t===p?T:void 0);if(!a)throw new c(`No RPC URL configured for chain ${t}.`);if((n?.requireKeyedRpc??process.env.NODE_ENV==="production")&&t===p&&a===T)throw new c("Production requires a keyed OAK_RPC_URL.");return a}var $=1e4;async function P(e,t=$){if(!Number.isFinite(t)||t<=0||t>3e4)throw new c("RPC timeout must be greater than zero and at most 30000 ms.");let n=new AbortController,s;try{return await Promise.race([new Promise((r,a)=>{s=setTimeout(()=>{a(new c("The RPC request timed out. Please try again.")),n.abort()},t)}),e(n.signal)])}finally{clearTimeout(s)}}function H(e,t=p,n){let s=typeof e=="object"&&e!==null,r=s?e:n??{},a=typeof e=="string"?e:r.rpcUrl,i=s?r.chainId??t:t;if(!Number.isSafeInteger(i)||i<=0)throw new c("Provide a positive integer chain ID.");if(r.timeoutMs!==void 0&&(!Number.isFinite(r.timeoutMs)||r.timeoutMs<=0||r.timeoutMs>3e4))throw new c("RPC timeout must be greater than zero and at most 30000 ms.");let d=q(a,i,r),u=U(i,d);if(r.transport){let o=r.transport({chain:u,retryCount:0});return A({chain:u,transport:k({request:m=>{if(v.has(m.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(m.method))throw new c("Read-only RPC client does not allow this method.");return P(()=>o.request(m),r.timeoutMs)}},{retryCount:0})})}let l=M({url:d,chainId:i,fetch:r.fetch,userAgent:r.userAgent?.trim()||F,retries:r.retries,retryDelayMs:r.retryDelayMs,maxRetryDelayMs:r.maxRetryDelayMs,timeoutMs:r.timeoutMs,fallbackUrls:r.rpcFallbackUrls?.[i]??r.fallbackRpcUrls??C(process.env[`OAK_RPC_FALLBACK_URLS_${i}`]??(i===p?process.env.OAK_RPC_FALLBACK_URLS:void 0))})({chain:u,retryCount:0}),h=k({request:o=>{if(v.has(o.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(o.method))throw new c("Read-only RPC client does not allow this method.");return l.request(o)}},{retryCount:0});return A({chain:u,transport:h})}function ee(e={}){let t=new Map;return n=>{let s=t.get(n);if(s)return s;let r=H(e.rpcUrls?.[n],n,e);return t.set(n,r),r}}var y=class extends c{};function D(e){let t=[];for(;e&&typeof e=="object"&&!t.includes(e);)t.push(e),e=e.cause;return t}function B(e){return D(e).find(t=>t instanceof y)}function z(e){if(!B(e))for(let t of D(e)){let n=Number(t.status??t.code);if(n===429||n>=500&&n<=599)return{status:n,delay:typeof t.retryAfterMs=="number"?t.retryAfterMs:void 0};if(/rate.?limit|too many requests/i.test(String(t.message??"")))return{status:429}}}async function x(e,t,n={},s){let r=n.retries??3,a=n.retryDelayMs??250,i=n.maxRetryDelayMs??2e3;if(!Number.isInteger(r)||r<0||r>5||!Number.isFinite(a)||a<0||!Number.isFinite(i)||i<0||i>3e4)throw new c("RPC retries must be 0 to 5; backoff must be non-negative and at most 30000 ms.");for(let d=0;;d++){s?.throwIfAborted();try{return await e()}catch(u){let f=z(u);if(!f)throw u;let l=Math.min(i,a*2**d),h=Math.max(Math.min(i,l+Math.floor(Math.random()*l/4)),f.delay??0);if(d>=r||h>i){let o=f.status===429?"public RPC rate-limited":`RPC returned HTTP ${f.status}`,m=f.delay?` Retry after ${Math.max(1,Math.ceil(f.delay/1e3))} seconds.`:"";throw new y(`${o}, retried ${d} times (${t}).${m} ${f.status===429?"The RPC rate limit remains active. ":""}Configure a keyed OAK_RPC_URL or comma-separated OAK_RPC_FALLBACK_URLS for this chain.`)}await new Promise((o,m)=>{let w=()=>{clearTimeout(b),m(s?.reason)},b=setTimeout(()=>{s?.removeEventListener("abort",w),o()},h);s?.addEventListener("abort",w,{once:!0}),s?.aborted&&w()})}}}function C(e){if(e===void 0||e.trim()==="")return[];let t=e.split(",").map(n=>n.trim());if(t.length>4)throw new c("Configure at most four ordered fallback RPC URLs.");for(let n of t){let s;try{s=new URL(n)}catch{throw new c("Fallback RPC URLs must use HTTP or HTTPS.")}if(!["http:","https:"].includes(s.protocol))throw new c("Fallback RPC URLs must use HTTP or HTTPS.")}return t}var R=new Map;async function J(e,t,n){let s=R.get(e)??Promise.resolve(),r,a=new Promise(d=>{r=d}),i=s.then(()=>a);R.set(e,i);try{return await s,n.throwIfAborted(),await t()}finally{r(),R.get(e)===i&&R.delete(e)}}var L=new j,S=new Map,E=e=>{let t=new URL(e).origin,n=S.get(t);return n||(n={interactive:0},S.set(t,n)),n};async function V(e,t){let n=L.getStore(),s=[...new Set(e.map(E))].filter(r=>!n?.has(r));s.forEach(r=>{r.interactive++});try{let r=s.flatMap(a=>a.background?[a.background.catch(()=>{})]:[]);return r.length&&await Promise.all(r),await t()}finally{s.forEach(r=>{r.interactive--})}}async function oe(e,t,n=s=>new Promise(r=>{setTimeout(r,s).unref()})){let s=E(e);for(;s.interactive||s.background;)await n(100);let r=Promise.resolve().then(()=>L.run(new Set([s]),t));s.background=r;try{return await r}finally{s.background===r&&(s.background=void 0)}}function M(e){let t=[...new Set([e.url,...e.fallbackUrls??[]])];C(t.slice(1).join(","));let n=new Set,s=0;return I({request:({method:r,params:a})=>V(t,()=>P(async i=>{let d;for(let u of t){let f=async(l,h=[])=>{let o=await(e.fetch??globalThis.fetch)(u,{method:"POST",redirect:"error",signal:i,headers:{"content-type":"application/json","user-agent":e.userAgent??"oak-core/0.1.0"},body:JSON.stringify({jsonrpc:"2.0",id:++s,method:l,params:h})});if(!o.ok){let w=o.headers.get("retry-after"),b=w===null?void 0:/^\d+(\.\d+)?$/.test(w.trim())?Number(w)*1e3:Math.max(0,Date.parse(w)-Date.now()),O=typeof b=="number"&&Number.isFinite(b)?b:void 0;throw await o.body?.cancel(),o.status===429||o.status>=500?Object.assign(new Error("Transient RPC HTTP failure"),{status:o.status,retryAfterMs:O}):new y(`RPC returned HTTP ${o.status} (${l}).`)}let m;try{m=await o.json()}catch{throw new y("The RPC endpoint returned malformed JSON.")}if(m.error)throw Object.assign(new Error(m.error.message??"RPC error"),{code:m.error.code,data:m.error.data});return m.result};try{if(u!==t[0]&&r!=="eth_chainId"&&(!n.has(u)||r==="eth_sendRawTransaction")){let o=await x(()=>f("eth_chainId"),"eth_chainId",e,i);if(Number(o)!==e.chainId)throw new y("RPC chain does not match the requested chain.");n.add(u)}let l=()=>x(()=>f(r,a),r,e,i),h=await(r==="eth_simulateV1"?J(u,l,i):l());if(r==="eth_chainId")if(Number(h)!==e.chainId){if(u!==t[0])throw new y("RPC chain does not match the requested chain.")}else n.add(u);return h}catch(l){if(d=l,!(l instanceof y)||!/rate-limited|HTTP 5\d\d|chain does not match/.test(l.message))throw l}}throw d},e.timeoutMs))},{retryCount:0})}export{y as a,B as b,x as c,C as d,V as e,oe as f,M as g,T as h,F as i,K as j,U as k,Z as l,$ as m,P as n,H as o,ee as p};
@@ -1 +1 @@
1
- import{e as g,f as T,g as k,i as E}from"./L3ZM77SJ.js";import{c as _,d as S}from"./JPOYTTTW.js";import{g as h}from"./73N3TOJL.js";import{a as l}from"./G6HCV67X.js";import{a as i}from"./5YS5V2LK.js";import{decodeAbiParameters as B,encodeAbiParameters as H,getAddress as d}from"viem";var D=d("0xcEF685D4796FA80F71a97e803D2c0b6719F1b4E2"),O=[{name:"items",type:"tuple[]",components:[{...k[0],name:"offer"},{name:"ratifierData",type:"bytes"}]}],G=p=>({tools:[{name:"longbow_fixed_offers",inputSchema:{type:"object",additionalProperties:!1,properties:{limit:{type:"integer",minimum:1,maximum:50},marketId:{type:"string"}}},execute:async o=>{try{let a=o.limit??20;if(Object.keys(o).some(s=>!["limit","marketId"].includes(s))||!Number.isInteger(a)||Number(a)<1||Number(a)>50||o.marketId!==void 0&&(typeof o.marketId!="string"||!/^0x[0-9a-f]{64}$/i.test(o.marketId)))throw new i("Use limit 1..50 and an optional exact bytes32 marketId.");let f=await p.http("https://longbow.credit/api/fixed/offers",{method:"GET",redirect:"error"});if(!f.ok)throw new i(`Longbow fixed order book returned HTTP ${f.status}; offers are unavailable.`);let x=await f.text();if(x.length>2e6)throw new i("Longbow fixed order book exceeds the supported response size.");let t=JSON.parse(x);if(!t||t.chainId!==l||typeof t.mempool!="string"||d(t.mempool)!==D||!Array.isArray(t.publications)||t.publications.length>1e3||!Number.isSafeInteger(t.head)||Number(t.head)<0)throw new i("Longbow fixed indexer does not match the pinned chain, mempool or publication schema.");let c=[],u=[],y=0;for(let[s,m]of t.publications.entries())try{if(!m||typeof m!="object")throw new i("Invalid publication.");let r=m,n=r.itemsAbi;if(!Number.isSafeInteger(r.blockNumber)||Number(r.blockNumber)<0||Number(r.blockNumber)>Number(t.head))throw new i("Invalid publication block.");if(typeof n!="string"||!/^0x[0-9a-f]+$/i.test(n)||n.length>1e6||n.length<130||BigInt(`0x${n.slice(2,66)}`)!==32n||BigInt(`0x${n.slice(66,130)}`)>512n)throw new i("Invalid or oversized publication encoding.");let[I]=B(O,n);if(I.length!==r.items)throw new i("Publication count mismatch.");for(let b of I){y++;let e=b.offer;if(e.market.chainId!==BigInt(l)||d(e.market.midnight)!==g||b.ratifierData.length>32770)throw new i("Publication market or proof is unqualified.");let w=E(e.market);if(o.marketId!==void 0&&!h(w,String(o.marketId)))continue;let N=[_,S].find(P=>h(P.address,e.market.loanToken));c.push({marketId:w,offer:H(k,[e]),ratifierData:b.ratifierData,maker:d(e.maker),buy:e.buy,maturity:e.market.maturity.toString(),start:e.start.toString(),expiry:e.expiry.toString(),tick:e.tick.toString(),loanToken:N??null,directBuilderSupported:!!N&&/^0x0{40}$/i.test(e.callback)&&e.callbackData==="0x"&&T.includes(d(e.ratifier)),sourceBlock:String(r.blockNumber)})}}catch(r){u.push({publication:s,reason:p.plainError(r)})}return c.sort((s,m)=>BigInt(s.expiry)>BigInt(m.expiry)?-1:BigInt(s.expiry)<BigInt(m.expiry)?1:0),{chainId:l,midnight:g,mempool:D,indexedHead:String(t.head),decodedCount:y,matchingCount:c.length,offers:c.slice(0,Number(a)),incomplete:u.length>0||t.skipped!==0,rejected:u,warning:"Historical off-chain publications, not executable quotes. Expiry, consumption, authorization, signatures and liquidity are not verified here. Use morpho_midnight_status and preview morpho_midnight_take with the returned exact offer/proof; callback offers need a separately qualified builder. This read publishes nothing and creates no signature."}}catch(a){throw new i(p.plainError(a))}}}]});export{D as a,O as b,G as c};
1
+ import{e as g,f as T,g as k,i as E}from"./IQIWASRD.js";import{c as _,d as S}from"./65EQECL3.js";import{g as h}from"./5KUWLUPM.js";import{a as l}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{decodeAbiParameters as B,encodeAbiParameters as H,getAddress as d}from"viem";var D=d("0xcEF685D4796FA80F71a97e803D2c0b6719F1b4E2"),O=[{name:"items",type:"tuple[]",components:[{...k[0],name:"offer"},{name:"ratifierData",type:"bytes"}]}],G=p=>({tools:[{name:"longbow_fixed_offers",inputSchema:{type:"object",additionalProperties:!1,properties:{limit:{type:"integer",minimum:1,maximum:50},marketId:{type:"string"}}},execute:async o=>{try{let a=o.limit??20;if(Object.keys(o).some(s=>!["limit","marketId"].includes(s))||!Number.isInteger(a)||Number(a)<1||Number(a)>50||o.marketId!==void 0&&(typeof o.marketId!="string"||!/^0x[0-9a-f]{64}$/i.test(o.marketId)))throw new i("Use limit 1..50 and an optional exact bytes32 marketId.");let f=await p.http("https://longbow.credit/api/fixed/offers",{method:"GET",redirect:"error"});if(!f.ok)throw new i(`Longbow fixed order book returned HTTP ${f.status}; offers are unavailable.`);let x=await f.text();if(x.length>2e6)throw new i("Longbow fixed order book exceeds the supported response size.");let t=JSON.parse(x);if(!t||t.chainId!==l||typeof t.mempool!="string"||d(t.mempool)!==D||!Array.isArray(t.publications)||t.publications.length>1e3||!Number.isSafeInteger(t.head)||Number(t.head)<0)throw new i("Longbow fixed indexer does not match the pinned chain, mempool or publication schema.");let c=[],u=[],y=0;for(let[s,m]of t.publications.entries())try{if(!m||typeof m!="object")throw new i("Invalid publication.");let r=m,n=r.itemsAbi;if(!Number.isSafeInteger(r.blockNumber)||Number(r.blockNumber)<0||Number(r.blockNumber)>Number(t.head))throw new i("Invalid publication block.");if(typeof n!="string"||!/^0x[0-9a-f]+$/i.test(n)||n.length>1e6||n.length<130||BigInt(`0x${n.slice(2,66)}`)!==32n||BigInt(`0x${n.slice(66,130)}`)>512n)throw new i("Invalid or oversized publication encoding.");let[I]=B(O,n);if(I.length!==r.items)throw new i("Publication count mismatch.");for(let b of I){y++;let e=b.offer;if(e.market.chainId!==BigInt(l)||d(e.market.midnight)!==g||b.ratifierData.length>32770)throw new i("Publication market or proof is unqualified.");let w=E(e.market);if(o.marketId!==void 0&&!h(w,String(o.marketId)))continue;let N=[_,S].find(P=>h(P.address,e.market.loanToken));c.push({marketId:w,offer:H(k,[e]),ratifierData:b.ratifierData,maker:d(e.maker),buy:e.buy,maturity:e.market.maturity.toString(),start:e.start.toString(),expiry:e.expiry.toString(),tick:e.tick.toString(),loanToken:N??null,directBuilderSupported:!!N&&/^0x0{40}$/i.test(e.callback)&&e.callbackData==="0x"&&T.includes(d(e.ratifier)),sourceBlock:String(r.blockNumber)})}}catch(r){u.push({publication:s,reason:p.plainError(r)})}return c.sort((s,m)=>BigInt(s.expiry)>BigInt(m.expiry)?-1:BigInt(s.expiry)<BigInt(m.expiry)?1:0),{chainId:l,midnight:g,mempool:D,indexedHead:String(t.head),decodedCount:y,matchingCount:c.length,offers:c.slice(0,Number(a)),incomplete:u.length>0||t.skipped!==0,rejected:u,warning:"Historical off-chain publications, not executable quotes. Expiry, consumption, authorization, signatures and liquidity are not verified here. Use morpho_midnight_status and preview morpho_midnight_take with the returned exact offer/proof; callback offers need a separately qualified builder. This read publishes nothing and creates no signature."}}catch(a){throw new i(p.plainError(a))}}}]});export{D as a,O as b,G as c};
@@ -1 +1 @@
1
- import{b as W}from"./NU4K3TEZ.js";import{d as R,e as _}from"./XV6F3RET.js";import{b as z,c as I}from"./SPRVVJXI.js";import{K as E}from"./L3ZM77SJ.js";import{a as F}from"./6IM6A5VA.js";import{d as H,g as A,i as j}from"./73N3TOJL.js";import{a as C,s as S}from"./G6HCV67X.js";import{a as s}from"./5YS5V2LK.js";import{encodeFunctionData as M,erc20Abi as V,getAddress as Z,keccak256 as K,zeroAddress as x}from"viem";var r=R.turbo,h=R.blackjack,g=m=>j(m,"Provide an explicit card address.",H);function G(m,d){if(/^uint\d*\[\]$/.test(m.type)&&Array.isArray(d))return d.map(c=>G({...m,type:m.type.slice(0,-2)},c));if(/^uint\d*$/.test(m.type)&&(typeof d!="string"||!/^(0|[1-9]\d*)$/.test(d)))throw new s("Card integers must be canonical decimal strings, without leading zeros.");return W(m,d)}var J=["buy","cashOut","claimExpiry","refund","safeTransferFrom","safeBatchTransferFrom"],X=["liquidate","recordKnock","liquidateKnock","clearKnock","recordDrift","settle","markVoid","depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries","haltSales","resumeSales","sweepFees","skim"],Q=m=>m==="netnet_turbo_action"||m.startsWith("netnet_blackjack_")&&["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"].includes(m);async function de(m,d,c,k){if(F(c),!Q(m))throw new s("No local NetNet card action builder exists.");let v=m!=="netnet_turbo_action";if(Object.keys(d).some(e=>!(v?["sessionId","seriesId"]:["operation","values","minimum","allowZeroPayout"]).includes(e)))throw new s("Unexpected card action argument.");if(v&&!z(m,d))throw new s("Recovery accepts exactly one positive decimal session or series ID.");if(await k.getChainId()!==C)throw new s("NetNet cards require chain 4663.");let w=await k.getBlock();if(w.number===null||!w.hash)throw new s("Card action block is unavailable.");let p=(e,t,i=[])=>k.readContract({address:e.address,abi:e.abi,functionName:t,args:i,blockNumber:w.number});for(let e of v?[r,h]:[r]){let t=await k.getCode({address:e.address,blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet card runtime changed or is unavailable. Requalify this deployment before signing.")}for(let e of v?Object.values(_):[_.turbo]){let t=await k.getCode({address:Z(e.address),blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet linked card library changed or is unavailable. Requalify before signing.")}let l={txs:[],inputs:[],cards:[],decision:"",blockNumber:w.number,blockHash:w.hash},$=(e,t,i,a,o)=>({chainId:4663,collection:r.address,operator:e,from:t,to:i,id:a,amount:o,operation:t===x?"mint":i===x?"burn":"transfer"}),T=(e,t,i,a,o=[])=>{l.txs.push({to:e,chainId:C,value:"0",data:M({abi:t,functionName:i,args:a}),description:l.decision}),l.cards.push(o)},D=(e,t)=>{if(t<=0n||t>=1n<<128n)throw new s("Card payment must be positive and below the exact-approval ceiling.");l.inputs.push({token:e,amount:t,to:r.address}),T(e,V,"approve",[r.address,t])};if(v){if(g(await p(h,"cards"))!==r.address||g(await p(h,"turbo"))!==r.address)throw new s("Blackjack card wiring changed.");let e=m==="netnet_blackjack_claim";if(Object.keys(d).some(b=>b!==(e?"seriesId":"sessionId")))throw new s("Recovery accepts only its one exact session or series ID.");let t=E(e?d.seriesId:d.sessionId),i,a,o,u="Original-series parked payout; self-claim only.";if(e){if(i=t,a=await p(h,"unclaimedChips",[t,c]),o="claimUnclaimedChips",a===0n)throw new s("This wallet has no parked chips for that series.")}else{let b=await p(h,"sessionOf",[t]);if(!b||!A(b.player,c))throw new s("Recovery is limited to this wallet\u2019s recorded blackjack session.");let y=m==="netnet_blackjack_finalize";if(o=y?"finalize":"expireSession",b.state!==(y?2:1))throw new s(y?"Session is not Closing. Use its current on-chain state to choose recovery.":"Session is not Open. A Closing session uses finalize after its challenge window.");let N=y?b.closeAt:b.deadline;if(u=y?`Challenge ends ${new Date(Number(N)*1e3).toISOString()}.`:`Session deadline ${new Date(Number(N)*1e3).toISOString()}; player-only expiry until ${new Date(Number(N+3600n)*1e3).toISOString()}.`,w.timestamp<N)throw new s(`Recovery is not due until ${N} Unix seconds.`);i=await p(h,"tableSeries"),a=b.chips}if(i<=0n||a<0n)throw new s("Blackjack recovery accounting is unavailable.");return l.decision=`${o} ${e?"series":"session"} ${t} at ${h.address}: return ${a} whole cards of collection ${r.address}, series ${i}, to ${Z(c)}. ${u} Last on-chain chips may omit off-chain winnings; cards may be worthless. A failed receiver parks the payout at ${h.address}; self-claim only. ETH gas extra.`,T(h.address,h.abi,o,[t],a===0n?[]:[$(h.address,h.address,c,i,a)]),l.recovery={...e?{}:{sessionId:t.toString()},seriesId:i.toString(),count:a.toString(),player:c,operation:o},l}let n=String(d.operation);if(n==="setApprovalForAll")throw new s(I.setApprovalForAll);if(["convertPremiums","convertSleeveFees"].includes(n))throw new s(I.conversion);if(![...J,...X].includes(n))throw new s("Choose a qualified finite TURBO operation.");if(!Array.isArray(d.values))throw new s("Provide ordered TURBO values using decimal integer strings.");let U=n==="safeTransferFrom"||n==="safeBatchTransferFrom",B=r.abi.find(e=>e.name===n),q=U?B.inputs.slice(1,-1):B.inputs;if(d.values.length!==q.length)throw new s("TURBO values do not match the exact operation inputs.");let f=q.map((e,t)=>G(e,d.values[t])),O=g(await p(r,"manager")),L=g(await p(r,"sleeve")),P=[];if(U){if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Transfer has no payout floor.");let e=g(f[0]);if(e===x||A(e,c))throw new s("Name a nonzero, non-self card recipient.");let t=await k.getCode({address:e,blockNumber:w.number});if(t&&t!=="0x")throw new s("Card transfer to a contract requires qualified credit and recovery. New blackjack seating remains disabled.");let i=n==="safeTransferFrom"?[f[1]]:f[1],a=n==="safeTransferFrom"?[f[2]]:f[2];if(!i.length||i.length>8||i.length!==a.length||new Set(i.map(String)).size!==i.length||i.some((o,u)=>o<=0n||a[u]<=0n||u>0&&o<=i[u-1]))throw new s("Use at most eight unique positive series IDs in increasing order and exact positive counts.");for(let o=0;o<i.length;o++){if(await p(r,"balanceOf",[c,i[o]])<a[o])throw new s("Card transfer exceeds this wallet\u2019s balance.");P.push($(c,c,e,i[o],a[o])),l.inputs.push({token:r.address,id:i[o],amount:a[o],to:e,exact:!0})}l.decision=`Transfer whole cards of collection ${r.address}: ${i.map((o,u)=>`series ${o} count ${a[u]}`).join(", ")} to ${e}. Basis does not travel with cards; no operator approval. No payout; transfer is irreversible. ETH gas extra.`,f=[c,...f,"0x"]}else if(["buy","cashOut","claimExpiry","refund"].includes(n)){let e=f[0],t=f[1],i=await p(r,"seriesOf",[e]);if(!i||i.asset===x||t<=0n)throw new s("Choose a known series and positive whole-card count.");let a=i.side===0?g(i.asset):S.mainnet.usdg,o=await k.readContract({address:a,abi:V,functionName:"decimals",blockNumber:w.number});if((n==="buy"||n==="cashOut")&&(i.state!==1||w.timestamp>=i.expiry))throw new s("This TURBO series is not OPEN and unexpired.");if(n==="buy"){let[u]=await p(r,"quoteBuy",[e,t]);if(!u||u>f[2])throw new s("Current card quote exceeds the explicit maximum USDG payment.");if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Buy uses its exact count and maximum USDG price.");l.decision=`Spend at most ${f[2]} USDG base units (${S.mainnet.usdg}, decimals 6) at ${r.address}; receive ${t} whole cards, collection ${r.address}, series ${e}, into this wallet. Exact quoted approval ${u}; fees included. Strike ${i.strikeWad} WAD; expiry ${new Date(Number(i.expiry)*1e3).toISOString()}; cards can lose all value. Any residual USDG allowance requires zero cleanup. ETH gas extra.`,D(S.mainnet.usdg,u),P=[$(c,x,c,e,t)]}else{if(n==="cashOut"&&d.minimum!==void 0)throw new s("cashOut takes its one encoded minimum in values, not a second local minimum.");if(await p(r,"balanceOf",[c,e])<t)throw new s("Card burn exceeds this wallet\u2019s balance.");let u=n==="cashOut"?f[2]:E(d.minimum,!0);if(u===0n&&d.allowZeroPayout!==!0)throw new s("A zero payout floor requires allowZeroPayout:true and explicit human confirmation.");let b=0n;if(n==="cashOut"){let y=await p(r,"quoteCashOut",[e,t,c]);if(y[0]<u)throw new s("The current cash-out quote misses the payout minimum.");b=y[1]}else if(i.state!==(n==="claimExpiry"?3:4))throw new s("Expiry claims require EXPIRED; pro-rata refunds require VOID.");l.decision=`Burn ${t} whole cards of ${r.address}, series ${e}; ${n==="refund"?"series pro-rata VOID refund, not personal purchase-price repayment":n}; receive >=${u} base units of ${a} (decimals ${o}) into this wallet. ${n==="cashOut"?`Minimum encoded in calldata; current performance fee ${b}.`:"Floor is local simulation only; no on-chain minimum. Settled payout includes applicable fees."} Burned cards cannot be returned; ETH gas extra.`,P=[$(c,c,x,e,t)],l.inputs.push({token:r.address,id:e,amount:t,to:x,exact:!0}),l.receipt={token:a,minimum:u,recipient:c,enforcement:n==="cashOut"?"calldata":"simulation"}}}else{if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("This TURBO operation has no caller payout floor.");if(["withdrawHouse","withdrawPutPot","createSeries","resumeSales"].includes(n)&&!A(O,c))throw new s(`This TURBO operation requires manager ${O}.`);if(n==="haltSales"&&!A(c,O)&&!A(c,g(await p(r,"halter"))))throw new s("TURBO haltSales requires the current manager or halter.");if(["depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries"].includes(n)){let t=g(f[0]);if(!(await Promise.all(["asset0","asset1","asset2"].map(a=>p(r,a)))).some(a=>typeof a=="string"&&A(a,t)))throw new s("This is not a pinned TURBO reserve asset.")}l.decision=`${n} at ${r.address}; values ${JSON.stringify(f,(t,i)=>typeof i=="bigint"?String(i):i)}. Protocol capital/accounting action; manager ${O}; sleeve ${L}; no caller reward. ${n.startsWith("deposit")?"Irreversible house funding; no personal withdrawable balance.":n.startsWith("withdraw")?"Pays the current manager; operating and reservation floors still apply.":"Series state, risk or protocol fee allocation may change."} No card approval; ETH gas extra.`,(n==="depositHouse"||n==="depositPutPot")&&D(n==="depositHouse"?g(f[0]):S.mainnet.usdg,f[1])}if(l.decision.length>1024)throw new s("Card decision terms exceed the complete confirmation label capacity. Use fewer card IDs.");T(r.address,r.abi,n,f,P);for(let e of l.txs)e.description=l.decision;return l}export{J as a,X as b,Q as c,de as d};
1
+ import{b as z,c as I}from"./SPRVVJXI.js";import{b as W}from"./XSRIJUFU.js";import{d as R,e as _}from"./XV6F3RET.js";import{K as E}from"./IQIWASRD.js";import{a as F}from"./PBQSJSZO.js";import{d as H,g as A,i as j}from"./5KUWLUPM.js";import{a as C,s as S}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as M,erc20Abi as V,getAddress as Z,keccak256 as K,zeroAddress as x}from"viem";var r=R.turbo,h=R.blackjack,g=m=>j(m,"Provide an explicit card address.",H);function G(m,d){if(/^uint\d*\[\]$/.test(m.type)&&Array.isArray(d))return d.map(c=>G({...m,type:m.type.slice(0,-2)},c));if(/^uint\d*$/.test(m.type)&&(typeof d!="string"||!/^(0|[1-9]\d*)$/.test(d)))throw new s("Card integers must be canonical decimal strings, without leading zeros.");return W(m,d)}var J=["buy","cashOut","claimExpiry","refund","safeTransferFrom","safeBatchTransferFrom"],X=["liquidate","recordKnock","liquidateKnock","clearKnock","recordDrift","settle","markVoid","depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries","haltSales","resumeSales","sweepFees","skim"],Q=m=>m==="netnet_turbo_action"||m.startsWith("netnet_blackjack_")&&["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"].includes(m);async function de(m,d,c,k){if(F(c),!Q(m))throw new s("No local NetNet card action builder exists.");let v=m!=="netnet_turbo_action";if(Object.keys(d).some(e=>!(v?["sessionId","seriesId"]:["operation","values","minimum","allowZeroPayout"]).includes(e)))throw new s("Unexpected card action argument.");if(v&&!z(m,d))throw new s("Recovery accepts exactly one positive decimal session or series ID.");if(await k.getChainId()!==C)throw new s("NetNet cards require chain 4663.");let w=await k.getBlock();if(w.number===null||!w.hash)throw new s("Card action block is unavailable.");let p=(e,t,i=[])=>k.readContract({address:e.address,abi:e.abi,functionName:t,args:i,blockNumber:w.number});for(let e of v?[r,h]:[r]){let t=await k.getCode({address:e.address,blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet card runtime changed or is unavailable. Requalify this deployment before signing.")}for(let e of v?Object.values(_):[_.turbo]){let t=await k.getCode({address:Z(e.address),blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet linked card library changed or is unavailable. Requalify before signing.")}let l={txs:[],inputs:[],cards:[],decision:"",blockNumber:w.number,blockHash:w.hash},$=(e,t,i,a,o)=>({chainId:4663,collection:r.address,operator:e,from:t,to:i,id:a,amount:o,operation:t===x?"mint":i===x?"burn":"transfer"}),T=(e,t,i,a,o=[])=>{l.txs.push({to:e,chainId:C,value:"0",data:M({abi:t,functionName:i,args:a}),description:l.decision}),l.cards.push(o)},D=(e,t)=>{if(t<=0n||t>=1n<<128n)throw new s("Card payment must be positive and below the exact-approval ceiling.");l.inputs.push({token:e,amount:t,to:r.address}),T(e,V,"approve",[r.address,t])};if(v){if(g(await p(h,"cards"))!==r.address||g(await p(h,"turbo"))!==r.address)throw new s("Blackjack card wiring changed.");let e=m==="netnet_blackjack_claim";if(Object.keys(d).some(b=>b!==(e?"seriesId":"sessionId")))throw new s("Recovery accepts only its one exact session or series ID.");let t=E(e?d.seriesId:d.sessionId),i,a,o,u="Original-series parked payout; self-claim only.";if(e){if(i=t,a=await p(h,"unclaimedChips",[t,c]),o="claimUnclaimedChips",a===0n)throw new s("This wallet has no parked chips for that series.")}else{let b=await p(h,"sessionOf",[t]);if(!b||!A(b.player,c))throw new s("Recovery is limited to this wallet\u2019s recorded blackjack session.");let y=m==="netnet_blackjack_finalize";if(o=y?"finalize":"expireSession",b.state!==(y?2:1))throw new s(y?"Session is not Closing. Use its current on-chain state to choose recovery.":"Session is not Open. A Closing session uses finalize after its challenge window.");let N=y?b.closeAt:b.deadline;if(u=y?`Challenge ends ${new Date(Number(N)*1e3).toISOString()}.`:`Session deadline ${new Date(Number(N)*1e3).toISOString()}; player-only expiry until ${new Date(Number(N+3600n)*1e3).toISOString()}.`,w.timestamp<N)throw new s(`Recovery is not due until ${N} Unix seconds.`);i=await p(h,"tableSeries"),a=b.chips}if(i<=0n||a<0n)throw new s("Blackjack recovery accounting is unavailable.");return l.decision=`${o} ${e?"series":"session"} ${t} at ${h.address}: return ${a} whole cards of collection ${r.address}, series ${i}, to ${Z(c)}. ${u} Last on-chain chips may omit off-chain winnings; cards may be worthless. A failed receiver parks the payout at ${h.address}; self-claim only. ETH gas extra.`,T(h.address,h.abi,o,[t],a===0n?[]:[$(h.address,h.address,c,i,a)]),l.recovery={...e?{}:{sessionId:t.toString()},seriesId:i.toString(),count:a.toString(),player:c,operation:o},l}let n=String(d.operation);if(n==="setApprovalForAll")throw new s(I.setApprovalForAll);if(["convertPremiums","convertSleeveFees"].includes(n))throw new s(I.conversion);if(![...J,...X].includes(n))throw new s("Choose a qualified finite TURBO operation.");if(!Array.isArray(d.values))throw new s("Provide ordered TURBO values using decimal integer strings.");let U=n==="safeTransferFrom"||n==="safeBatchTransferFrom",B=r.abi.find(e=>e.name===n),q=U?B.inputs.slice(1,-1):B.inputs;if(d.values.length!==q.length)throw new s("TURBO values do not match the exact operation inputs.");let f=q.map((e,t)=>G(e,d.values[t])),O=g(await p(r,"manager")),L=g(await p(r,"sleeve")),P=[];if(U){if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Transfer has no payout floor.");let e=g(f[0]);if(e===x||A(e,c))throw new s("Name a nonzero, non-self card recipient.");let t=await k.getCode({address:e,blockNumber:w.number});if(t&&t!=="0x")throw new s("Card transfer to a contract requires qualified credit and recovery. New blackjack seating remains disabled.");let i=n==="safeTransferFrom"?[f[1]]:f[1],a=n==="safeTransferFrom"?[f[2]]:f[2];if(!i.length||i.length>8||i.length!==a.length||new Set(i.map(String)).size!==i.length||i.some((o,u)=>o<=0n||a[u]<=0n||u>0&&o<=i[u-1]))throw new s("Use at most eight unique positive series IDs in increasing order and exact positive counts.");for(let o=0;o<i.length;o++){if(await p(r,"balanceOf",[c,i[o]])<a[o])throw new s("Card transfer exceeds this wallet\u2019s balance.");P.push($(c,c,e,i[o],a[o])),l.inputs.push({token:r.address,id:i[o],amount:a[o],to:e,exact:!0})}l.decision=`Transfer whole cards of collection ${r.address}: ${i.map((o,u)=>`series ${o} count ${a[u]}`).join(", ")} to ${e}. Basis does not travel with cards; no operator approval. No payout; transfer is irreversible. ETH gas extra.`,f=[c,...f,"0x"]}else if(["buy","cashOut","claimExpiry","refund"].includes(n)){let e=f[0],t=f[1],i=await p(r,"seriesOf",[e]);if(!i||i.asset===x||t<=0n)throw new s("Choose a known series and positive whole-card count.");let a=i.side===0?g(i.asset):S.mainnet.usdg,o=await k.readContract({address:a,abi:V,functionName:"decimals",blockNumber:w.number});if((n==="buy"||n==="cashOut")&&(i.state!==1||w.timestamp>=i.expiry))throw new s("This TURBO series is not OPEN and unexpired.");if(n==="buy"){let[u]=await p(r,"quoteBuy",[e,t]);if(!u||u>f[2])throw new s("Current card quote exceeds the explicit maximum USDG payment.");if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Buy uses its exact count and maximum USDG price.");l.decision=`Spend at most ${f[2]} USDG base units (${S.mainnet.usdg}, decimals 6) at ${r.address}; receive ${t} whole cards, collection ${r.address}, series ${e}, into this wallet. Exact quoted approval ${u}; fees included. Strike ${i.strikeWad} WAD; expiry ${new Date(Number(i.expiry)*1e3).toISOString()}; cards can lose all value. Any residual USDG allowance requires zero cleanup. ETH gas extra.`,D(S.mainnet.usdg,u),P=[$(c,x,c,e,t)]}else{if(n==="cashOut"&&d.minimum!==void 0)throw new s("cashOut takes its one encoded minimum in values, not a second local minimum.");if(await p(r,"balanceOf",[c,e])<t)throw new s("Card burn exceeds this wallet\u2019s balance.");let u=n==="cashOut"?f[2]:E(d.minimum,!0);if(u===0n&&d.allowZeroPayout!==!0)throw new s("A zero payout floor requires allowZeroPayout:true and explicit human confirmation.");let b=0n;if(n==="cashOut"){let y=await p(r,"quoteCashOut",[e,t,c]);if(y[0]<u)throw new s("The current cash-out quote misses the payout minimum.");b=y[1]}else if(i.state!==(n==="claimExpiry"?3:4))throw new s("Expiry claims require EXPIRED; pro-rata refunds require VOID.");l.decision=`Burn ${t} whole cards of ${r.address}, series ${e}; ${n==="refund"?"series pro-rata VOID refund, not personal purchase-price repayment":n}; receive >=${u} base units of ${a} (decimals ${o}) into this wallet. ${n==="cashOut"?`Minimum encoded in calldata; current performance fee ${b}.`:"Floor is local simulation only; no on-chain minimum. Settled payout includes applicable fees."} Burned cards cannot be returned; ETH gas extra.`,P=[$(c,c,x,e,t)],l.inputs.push({token:r.address,id:e,amount:t,to:x,exact:!0}),l.receipt={token:a,minimum:u,recipient:c,enforcement:n==="cashOut"?"calldata":"simulation"}}}else{if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("This TURBO operation has no caller payout floor.");if(["withdrawHouse","withdrawPutPot","createSeries","resumeSales"].includes(n)&&!A(O,c))throw new s(`This TURBO operation requires manager ${O}.`);if(n==="haltSales"&&!A(c,O)&&!A(c,g(await p(r,"halter"))))throw new s("TURBO haltSales requires the current manager or halter.");if(["depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries"].includes(n)){let t=g(f[0]);if(!(await Promise.all(["asset0","asset1","asset2"].map(a=>p(r,a)))).some(a=>typeof a=="string"&&A(a,t)))throw new s("This is not a pinned TURBO reserve asset.")}l.decision=`${n} at ${r.address}; values ${JSON.stringify(f,(t,i)=>typeof i=="bigint"?String(i):i)}. Protocol capital/accounting action; manager ${O}; sleeve ${L}; no caller reward. ${n.startsWith("deposit")?"Irreversible house funding; no personal withdrawable balance.":n.startsWith("withdraw")?"Pays the current manager; operating and reservation floors still apply.":"Series state, risk or protocol fee allocation may change."} No card approval; ETH gas extra.`,(n==="depositHouse"||n==="depositPutPot")&&D(n==="depositHouse"?g(f[0]):S.mainnet.usdg,f[1])}if(l.decision.length>1024)throw new s("Card decision terms exceed the complete confirmation label capacity. Use fewer card IDs.");T(r.address,r.abi,n,f,P);for(let e of l.txs)e.description=l.decision;return l}export{J as a,X as b,Q as c,de as d};
@@ -1 +1 @@
1
- import{j as s}from"./FUXT7GRK.js";import{formatUnits as c}from"viem";function l(e){return`HoodLock creation fee: ${e.eth} ETH (${e.amount} wei; ${e.usd===null?"USD unavailable: no fresh ETH/USD reference":`approximately $${e.usd} USD`}), not refundable after creation. Paid to ${e.contract}; separate from network gas.`}async function p(e,t,d,r){let o=r===0n?"0":null;if(r>0n)try{let a=await s("ETH",{client:e.clientFor(4663),chainId:4663});BigInt(a.usdE18)>0n&&(o=c(r*BigInt(a.usdE18)/10n**18n,18))}catch{}let n={contract:d,amount:r.toString(),eth:c(r,18),usd:o,refundable:!1},i=l(n);return{...t,summary:`${t.summary} ${i}`,preview:{...t.preview,summary:`${t.preview.summary} ${i}`},protocolFee:n}}export{l as a,p as b};
1
+ import{j as s}from"./S2TAJHHK.js";import{formatUnits as c}from"viem";function l(e){return`HoodLock creation fee: ${e.eth} ETH (${e.amount} wei; ${e.usd===null?"USD unavailable: no fresh ETH/USD reference":`approximately $${e.usd} USD`}), not refundable after creation. Paid to ${e.contract}; separate from network gas.`}async function p(e,t,d,r){let o=r===0n?"0":null;if(r>0n)try{let a=await s("ETH",{client:e.clientFor(4663),chainId:4663});BigInt(a.usdE18)>0n&&(o=c(r*BigInt(a.usdE18)/10n**18n,18))}catch{}let n={contract:d,amount:r.toString(),eth:c(r,18),usd:o,refundable:!1},i=l(n);return{...t,summary:`${t.summary} ${i}`,preview:{...t.preview,summary:`${t.preview.summary} ${i}`},protocolFee:n}}export{l as a,p as b};
@@ -0,0 +1,7 @@
1
+ import{b as k,f as P,g as H,i as ie,j as $,k as ue,l as ce,m as u,n as S,o as I,p as j,q as le}from"./KBKK7UNY.js";import{Q as se,R as oe,S as re,T as L,U as ae,W as de,b as s,c as T,d as y,e as z,f as K,g as q,m as Y,n as Z,o as Q,p as V,q as R,r as D,s as v,t as J,u as W,v as X,w as ee,x as ne,y as te}from"./PSVOVZH7.js";import{a as w}from"./XSD5NL7J.js";var M=6,me=/^[A-Za-z0-9._-]{1,12}$/;function ge(e){return me.test(e)?e:"the stock token"}function F(e){return e instanceof w?e.message:"unexpected error"}function h(e,n=M){return $({redeemOutBase:e,amountBase:0n,decimals:n})}function fe(e,n,a){let d={amount_usd:u(n),gross_usd:u(e.grossUsd),horizon:a,costs_usd:u(e.costsUsd),net_usd:u(e.netUsd)};return e.suggestUsd===void 0?s(oe,d):s(se,{...d,suggest_usd:`$${e.suggestUsd}`})}function pe(e){return`${Number.isInteger(e)?e.toString():e.toFixed(2)} USDG`}function be(e,n,a,d){let f={id:"A",project:"layerbank"},o=h(n);if(!Number.isFinite(e.rateBasePct)||e.rateBasePct<0)return d.push("LayerBank rate was malformed"),{option:{...f,offered:!1,reason:"cant_check"},block:s(R,{})};if(!e.open)return{option:{...f,offered:!1,reason:"closed"},block:s(v,{})};if(e.capRoomBase<n)return{option:{...f,offered:!1,reason:"no_room"},block:s(J,{cap_room_usd:u(h(e.capRoomBase)),amount_usd:u(o)})};let r=e.bonus,g=r!==void 0&&Number.isFinite(r.ratePct)&&r.ratePct>0&&r.endsAt>a,i=e.rateBasePct+(g?r.ratePct:0),b=P(e.gasInUsd),c=P(e.gasOutUsd),_=b.usd+c.usd,m=b.estimatedHigh||c.estimatedHigh,U=ie({amountUsd:o,ratePct:i,days:30}),l=H({gross:U,costs:_,amount:o}),p=s(Y,{lb_total_rate:S(i),lb_base_rate:S(e.rateBasePct),bonus_clause:g?s(Z,{lb_bonus_rate:S(r.ratePct),bonus_end:I(r.endsAt)}):"",lb_cash_usd:u(h(e.cashUsdgBase)),lb_gas_in_usd:u(b.usd),lb_gas_out_usd:u(c.usd)});return m&&(p+=`
2
+ ${s(L,{})}`),l.tooSmall&&(p+=`
3
+ ${fe(l,o,j(30))}`),{option:{...f,offered:!0,amountUsd:o,ratePct:i,grossUsd:U,costsUsd:_,netUsd:l.netUsd,tooSmall:l.tooSmall,...l.suggestUsd===void 0?{}:{suggestUsd:l.suggestUsd},estimatedHigh:m},block:p,gross30d:U,horizonEndsAt:a+30*86400}}function Ae(e,n,a){return e.filter(o=>o.kind==="stable"&&!o.matured&&o.endsAt>n).filter(o=>o.unitDecimals===M&&Number.isFinite(o.ratePct)?!0:(a.push(`Pendle term ${o.market} skipped: its USDG figures were not in the expected form`),!1)).sort((o,r)=>r.liquidityUsd-o.liquidityUsd||o.endsAt-r.endsAt)[0]}async function Ue(e,n,a,d,f){let o={id:"B",project:"pendle"};if(!n)return{option:{...o,offered:!1,reason:"no_term"},block:s(V,{})};let r={option:{...o,offered:!1,reason:"cant_check"},block:s(D,{})},g=h(a),i;try{i=await e.pendleQuoteCosts(n.market,a)}catch(G){return f.push(`Pendle quote failed: ${F(G)}`),r}if(typeof i.ptOutBase!="bigint"||i.ptOutBase<=0n)return f.push("Pendle quote was malformed"),r;let b=i.ptOutBase,c=$({redeemOutBase:b,amountBase:a,decimals:M}),_=P(n.gasInUsd),m=P(n.gasOutUsd),U=Number.isFinite(i.feeUsd)&&i.feeUsd>0?i.feeUsd:0,l=_.usd+m.usd,p=_.estimatedHigh||m.estimatedHigh,E=ce(d,n.endsAt),O=H({gross:c,costs:l,amount:g}),N=I(n.endsAt),A=s(Q,{pendle_end_date:N,pendle_rate:S(n.ratePct),pendle_payout_usd:u(h(b)),pendle_unit_usd:u(g),pendle_cost_in_usd:u(U+_.usd),pendle_gas_out_usd:u(m.usd)});return p&&(A+=`
4
+ ${s(L,{})}`),O.tooSmall&&(A+=`
5
+ ${fe(O,g,`the ${j(E)} until ${N}`)}`),{option:{...o,offered:!0,amountUsd:g,ratePct:n.ratePct,market:n.market,endsAt:n.endsAt,grossUsd:c,costsUsd:l,netUsd:O.netUsd,tooSmall:O.tooSmall,...O.suggestUsd===void 0?{}:{suggestUsd:O.suggestUsd},estimatedHigh:p},block:A,gross30d:E>30?c*(30/E):c,horizonEndsAt:n.endsAt}}function Oe(e){return e.filter(n=>n.matured&&n.ptBalanceBase>0n).map(n=>{let a=I(n.endsAt);if(n.kind==="stock")return s(de,{stock_symbol:ge(n.unitSymbol),pendle_end_date:a});let d=le(n.ptBalanceBase,n.unitDecimals);return s(ae,{pendle_end_date:a,pt_amount:d,usdg_out:d})})}function he(e){if(e!==void 0){if(!/^[0-9]+$/.test(e))throw new w("The amount must be a whole number of USDG base units (6 decimals), for example 50000000 for 50 USDG.");return BigInt(e)}}async function Se(e,n,a,d={}){let f=he(d.amount),o=n.nowSec(),r=[],[g,i]=await Promise.allSettled([e.layerbank(a),e.pendleTerms(a)]),b=g.status==="fulfilled"?g.value:void 0,c=i.status==="fulfilled"?i.value:void 0;g.status==="rejected"&&r.push(`LayerBank could not be read: ${F(g.reason)}`),i.status==="rejected"&&r.push(`Pendle could not be read: ${F(i.reason)}`),r.push(...b?.checks??[],...c?.flatMap(t=>t.checks)??[]);let _=b?.walletUsdgBase;if(_===void 0)try{_=await n.usdgBalance(a)}catch{r.push("wallet USDG balance could not be read")}let m=f??_,U=c?Oe(c):[],l=(t,_e)=>({card:[...U,...t].join(`
6
+
7
+ `),options:_e,notices:U,checks:[...new Set(r)]}),p=await Ee(n,a,r),E=t=>p&&p.paidUntil<=o?[s(te,{plan_price:pe(p.priceUsd),project_site:t.join(" or ")})]:[];if(m===void 0)return l([s(R,{}),s(D,{})],[{id:"A",project:"layerbank",offered:!1,reason:"cant_check"},{id:"B",project:"pendle",offered:!1,reason:"cant_check"}]);if(m===0n){let t=0n;try{t=await n.ethBalance(a)}catch{r.push("wallet ETH balance could not be read")}return t>0n?l([s(ee,{}),...E([T,y])],[]):l([s(ne,{})],[])}let O=b?be(b,m,o,r):{option:{id:"A",project:"layerbank",offered:!1,reason:"cant_check"},block:s(R,{})},N=c?await Ue(e,Ae(c,o,r),m,o,r):{option:{id:"B",project:"pendle",offered:!1,reason:"cant_check"},block:s(D,{})},A=[O,N],B=[f===void 0||f===_?s(z,{amount_usd:u(h(m))}):s(_!==void 0&&f<_?K:q,{amount_usd:u(h(m))}),...A.map(t=>t.block)];p&&A.some(t=>t.option.offered&&t.gross30d!==void 0&&t.horizonEndsAt!==void 0&&ue({gross30d:t.gross30d,planPriceUsd:p.priceUsd,paidUntil:p.paidUntil,horizonEndsAt:t.horizonEndsAt,nowSec:o}))&&B.push(s(re,{plan_price:pe(p.priceUsd)}));let C=A.filter(t=>t.option.offered&&!t.option.tooSmall).map(t=>t.option.id);if(C.length>0){let t=C.length===2?"A, B, or neither":`${C[0]}, or neither`;B.push(s(W,{choices:t}))}else A.some(t=>t.option.offered)&&B.push(s(X,{}));let x=A.filter(t=>t.option.offered).map(t=>t.option.project==="layerbank"?T:y);return B.push(...E(x.length>0?x:[T,y])),l(B,A.map(t=>t.option))}async function Ee(e,n,a){let d;try{d=await e.plan?.(n)}catch{d=void 0}if(!d||!Number.isFinite(d.priceUsd)||d.priceUsd<=0||!Number.isFinite(d.paidUntil)){a.push("plan price unavailable");return}return d}export{Se as a};
@@ -0,0 +1 @@
1
+ import{a as n,b as o,c,g as b,h as i}from"./2MZXTOZU.js";import{e as m,h as t}from"./5KUWLUPM.js";import{a as d}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";var p="LayerBank's setup no longer matches what Oak checked. Nothing was signed.";async function C(r,u){try{if(await r.getChainId()!==d)throw new a("LayerBank requires chain 4663.");let e=u??await r.getBlockNumber({cacheTime:0}),[l,k,f,s]=await Promise.all([r.readContract({address:o,abi:i,functionName:"POOL",blockNumber:e}),r.readContract({address:o,abi:i,functionName:"UNDERLYING_ASSET_ADDRESS",blockNumber:e}),r.readContract({address:o,abi:i,functionName:"decimals",blockNumber:e}),r.readContract({address:n,abi:b,functionName:"getReserveData",args:[c.address],blockNumber:e})]);if(!t(l,n)||!t(k,c.address)||f!==6||!m(s)||!t(s.aTokenAddress,o))throw new a(p);return s}catch(e){throw e instanceof a?e:new a("LayerBank setup could not be read. Please try again.")}}export{p as a,C as b};
@@ -1 +1 @@
1
- import{d as P,g as A,m as S}from"./IBXYIN7Q.js";import{a as N,b as h,f as y,g as v}from"./3NDVXEBR.js";import{N as k,b as I}from"./YOENHHKI.js";import{a as b}from"./UWOFA6GV.js";import{c as w,g}from"./73N3TOJL.js";import{a as m}from"./G6HCV67X.js";import{a as r}from"./5YS5V2LK.js";import{encodeFunctionData as f,parseAbi as T,zeroAddress as _}from"viem";var i=T(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function getPositionLiquidity(uint256) view returns (uint128)","function safeTransferFrom(address from,address to,uint256 tokenId)","function approve(address spender,uint256 tokenId)","function burn(uint256 tokenId)"]),q={version:{type:"string",enum:["v3","v4"]},tokenId:b(),operation:{type:"string",enum:["transfer","approve","revoke","burn"]},target:w};function D(s){return{tools:[!1,!0].map(c=>({name:c?"uniswap_position_manage":"uniswap_position_status",inputSchema:{type:"object",additionalProperties:!1,required:c?["version","tokenId","operation"]:["version","tokenId"],properties:q},async execute(e,p){if(e.version!=="v3"&&e.version!=="v4")throw new r("Specify position version v3 or v4.");let o=N(e.tokenId,"tokenId"),a=e.version==="v3"?P.positionManager:I,d=s.clientFor(m),l=await d.readContract({address:a,abi:i,functionName:"ownerOf",args:[o]});if(!c){v(e,["version","tokenId"]);let n=await d.readContract({address:a,abi:i,functionName:"getApproved",args:[o]});return{version:e.version,tokenId:o.toString(),manager:a,owner:l,approved:n}}if(!g(l,p))throw new r("Only manage a Uniswap NFT owned by the signing wallet.");let t=e.operation;v(e,["version","tokenId","operation",...["transfer","approve"].includes(String(t))?["target"]:[]]);let u;if(t==="transfer"||t==="approve"){let n=h(e.target);if(n===_)throw new r("Choose a nonzero target, or operation revoke to clear approval.");u=t==="transfer"?f({abi:i,functionName:"safeTransferFrom",args:[p,n,o]}):f({abi:i,functionName:"approve",args:[n,o]})}else if(t==="revoke")u=f({abi:i,functionName:"approve",args:[_,o]});else if(t==="burn"){if(e.version==="v4"){if(await d.readContract({address:a,abi:i,functionName:"getPositionLiquidity",args:[o]})!==0n)throw new r("Remove all liquidity before burning an empty position.");return k(s).tools.find(O=>O.name==="uniswap_remove").execute({version:"v4",tokenId:o.toString(),liquidity:"all",amount0Min:"0",amount1Min:"0"},p)}let n=S(await d.readContract({address:a,abi:A,functionName:"positions",args:[o]}));if(n.liquidity!==0n||n.tokensOwed0!==0n||n.tokensOwed1!==0n)throw new r("Remove liquidity and collect all owed tokens before burning a v3 NFT.");u=f({abi:i,functionName:"burn",args:[o]})}else throw new r("Choose transfer, approve, revoke or burn. Operator-wide approvals are not exact approvals.");return y(s,[s.unsignedTx({to:a,data:u,value:"0",chainId:m,description:`${t} Uniswap ${e.version} NFT #${o}${e.target?` with target ${e.target}`:""}.`})],p,"Position ownership or exact per-NFT approval changes. A transferred position includes its liquidity and accrued rights; burn requires an empty NFT.")}}))}}export{i as a,D as b};
1
+ import{d as P,g as A,m as S}from"./JG27HM4P.js";import{a as N,b as h,f as y,g as v}from"./SGEZIYJW.js";import{N as k,b as I}from"./WPAF55SP.js";import{a as b}from"./5ZLOCQA4.js";import{c as w,g}from"./5KUWLUPM.js";import{a as m}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as f,parseAbi as T,zeroAddress as _}from"viem";var i=T(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function getPositionLiquidity(uint256) view returns (uint128)","function safeTransferFrom(address from,address to,uint256 tokenId)","function approve(address spender,uint256 tokenId)","function burn(uint256 tokenId)"]),q={version:{type:"string",enum:["v3","v4"]},tokenId:b(),operation:{type:"string",enum:["transfer","approve","revoke","burn"]},target:w};function D(s){return{tools:[!1,!0].map(c=>({name:c?"uniswap_position_manage":"uniswap_position_status",inputSchema:{type:"object",additionalProperties:!1,required:c?["version","tokenId","operation"]:["version","tokenId"],properties:q},async execute(e,p){if(e.version!=="v3"&&e.version!=="v4")throw new r("Specify position version v3 or v4.");let o=N(e.tokenId,"tokenId"),a=e.version==="v3"?P.positionManager:I,d=s.clientFor(m),l=await d.readContract({address:a,abi:i,functionName:"ownerOf",args:[o]});if(!c){v(e,["version","tokenId"]);let n=await d.readContract({address:a,abi:i,functionName:"getApproved",args:[o]});return{version:e.version,tokenId:o.toString(),manager:a,owner:l,approved:n}}if(!g(l,p))throw new r("Only manage a Uniswap NFT owned by the signing wallet.");let t=e.operation;v(e,["version","tokenId","operation",...["transfer","approve"].includes(String(t))?["target"]:[]]);let u;if(t==="transfer"||t==="approve"){let n=h(e.target);if(n===_)throw new r("Choose a nonzero target, or operation revoke to clear approval.");u=t==="transfer"?f({abi:i,functionName:"safeTransferFrom",args:[p,n,o]}):f({abi:i,functionName:"approve",args:[n,o]})}else if(t==="revoke")u=f({abi:i,functionName:"approve",args:[_,o]});else if(t==="burn"){if(e.version==="v4"){if(await d.readContract({address:a,abi:i,functionName:"getPositionLiquidity",args:[o]})!==0n)throw new r("Remove all liquidity before burning an empty position.");return k(s).tools.find(O=>O.name==="uniswap_remove").execute({version:"v4",tokenId:o.toString(),liquidity:"all",amount0Min:"0",amount1Min:"0"},p)}let n=S(await d.readContract({address:a,abi:A,functionName:"positions",args:[o]}));if(n.liquidity!==0n||n.tokensOwed0!==0n||n.tokensOwed1!==0n)throw new r("Remove liquidity and collect all owed tokens before burning a v3 NFT.");u=f({abi:i,functionName:"burn",args:[o]})}else throw new r("Choose transfer, approve, revoke or burn. Operator-wide approvals are not exact approvals.");return y(s,[s.unsignedTx({to:a,data:u,value:"0",chainId:m,description:`${t} Uniswap ${e.version} NFT #${o}${e.target?` with target ${e.target}`:""}.`})],p,"Position ownership or exact per-NFT approval changes. A transferred position includes its liquidity and accrued rights; burn requires an empty NFT.")}}))}}export{i as a,D as b};
@@ -1 +1 @@
1
- import{e as h}from"./VFSRRDLY.js";import{c as k}from"./MYBDO5SA.js";import{a as p}from"./UWOFA6GV.js";import{i as u}from"./73N3TOJL.js";import{a as n}from"./5YS5V2LK.js";var _="hoodlock_public",t="https://hoodlock.tech",f=["lp_locks","lp_lock","airdrop_history","airdrop_list","airdrop_list_by_root","featured","feature_tiers","buyback_status","referral_available","links"];function x(c){return{tools:[{name:_,inputSchema:{type:"object",properties:{route:{type:"string",enum:[...f]},id:p(),account:{type:"string"},token:{type:"string"},root:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},code:{type:"string",minLength:1,maxLength:64}},required:["route"],additionalProperties:!1},async execute(e,b){try{let i=String(e.route);if(!f.includes(i))throw new n("Choose a published HoodLock public read route.");let m=e.account??b,s=r=>u(r,"Provide a checksummed wallet or token address."),a=()=>h(e.id,"id").toString(),o;switch(i){case"links":{let r=e.id===void 0?void 0:a();return{source:t,links:{lockChecker:`${t}/lock-checker`,liquidityChecker:`${t}/liquidity-lock-checker`,burnChecker:`${t}/burn-checker`,vestingChecker:`${t}/vesting-checker`,embedDocs:`${t}/docs/embed`,badgeDocs:`${t}/docs/badge`,...e.token===void 0?{}:{token:`${t}/token/${s(e.token)}`},...r===void 0?{}:Object.fromEntries(["lock","burn","vesting","position"].map(l=>[l,`${t}/proof/${l}/${r}`]))},summary:"HoodLock-only records and integration links. Empty HoodLock results do not establish that no external locks or burns exist."}}case"lp_locks":o="/api/lp/locks";break;case"lp_lock":o=`/api/lp/lock/${a()}`;break;case"airdrop_history":o=`/api/airdrop/history?address=${s(m)}`;break;case"airdrop_list":o=`/api/airdrop/${a()}/list.json`;break;case"airdrop_list_by_root":if(typeof e.root!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.root))throw new n("Provide a bytes32 Merkle root.");o=`/api/airdrop/list-by-root/${e.root}.json`;break;case"featured":o="/api/featured";break;case"feature_tiers":o="/api/feature/tiers";break;case"referral_available":if(typeof e.code!="string"||e.code.length<1||e.code.length>64)throw new n("Provide a referral code with 1 to 64 characters.");o=`/api/aff/available?code=${encodeURIComponent(e.code)}`;break;default:o="/api/revenue/pool"}let d=`${t}${o}`,y=await k(c.http,d,{method:"GET",redirect:"error",signal:AbortSignal.timeout(1e4)},r=>r!==null&&typeof r=="object");return{source:d,data:y,untrusted:!0,summary:"Public off-chain HoodLock data. Verify custody, proofs, balances and authority on chain; API labels and indexes may lag. No transaction, authentication, payment or publication was performed."}}catch(i){throw new n(c.plainError(i))}}}]}}export{_ as a,x as b};
1
+ import{e as h}from"./WD37MEMZ.js";import{c as k}from"./MYFAKCQI.js";import{a as p}from"./5ZLOCQA4.js";import{i as u}from"./5KUWLUPM.js";import{a as n}from"./XSD5NL7J.js";var _="hoodlock_public",t="https://hoodlock.tech",f=["lp_locks","lp_lock","airdrop_history","airdrop_list","airdrop_list_by_root","featured","feature_tiers","buyback_status","referral_available","links"];function x(c){return{tools:[{name:_,inputSchema:{type:"object",properties:{route:{type:"string",enum:[...f]},id:p(),account:{type:"string"},token:{type:"string"},root:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},code:{type:"string",minLength:1,maxLength:64}},required:["route"],additionalProperties:!1},async execute(e,b){try{let i=String(e.route);if(!f.includes(i))throw new n("Choose a published HoodLock public read route.");let m=e.account??b,s=r=>u(r,"Provide a checksummed wallet or token address."),a=()=>h(e.id,"id").toString(),o;switch(i){case"links":{let r=e.id===void 0?void 0:a();return{source:t,links:{lockChecker:`${t}/lock-checker`,liquidityChecker:`${t}/liquidity-lock-checker`,burnChecker:`${t}/burn-checker`,vestingChecker:`${t}/vesting-checker`,embedDocs:`${t}/docs/embed`,badgeDocs:`${t}/docs/badge`,...e.token===void 0?{}:{token:`${t}/token/${s(e.token)}`},...r===void 0?{}:Object.fromEntries(["lock","burn","vesting","position"].map(l=>[l,`${t}/proof/${l}/${r}`]))},summary:"HoodLock-only records and integration links. Empty HoodLock results do not establish that no external locks or burns exist."}}case"lp_locks":o="/api/lp/locks";break;case"lp_lock":o=`/api/lp/lock/${a()}`;break;case"airdrop_history":o=`/api/airdrop/history?address=${s(m)}`;break;case"airdrop_list":o=`/api/airdrop/${a()}/list.json`;break;case"airdrop_list_by_root":if(typeof e.root!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.root))throw new n("Provide a bytes32 Merkle root.");o=`/api/airdrop/list-by-root/${e.root}.json`;break;case"featured":o="/api/featured";break;case"feature_tiers":o="/api/feature/tiers";break;case"referral_available":if(typeof e.code!="string"||e.code.length<1||e.code.length>64)throw new n("Provide a referral code with 1 to 64 characters.");o=`/api/aff/available?code=${encodeURIComponent(e.code)}`;break;default:o="/api/revenue/pool"}let d=`${t}${o}`,y=await k(c.http,d,{method:"GET",redirect:"error",signal:AbortSignal.timeout(1e4)},r=>r!==null&&typeof r=="object");return{source:d,data:y,untrusted:!0,summary:"Public off-chain HoodLock data. Verify custody, proofs, balances and authority on chain; API labels and indexes may lag. No transaction, authentication, payment or publication was performed."}}catch(i){throw new n(c.plainError(i))}}}]}}export{_ as a,x as b};
@@ -1 +1 @@
1
- import{a as l,c as w}from"./MYBDO5SA.js";import{e as d}from"./73N3TOJL.js";import{a as h}from"./5HCXZWUH.js";import{a as p}from"./5YS5V2LK.js";var m=new WeakMap;async function x(o,r,s){let n=new URL(r);if(!(n.origin==="https://aggregator-api.kyberswap.com"&&n.pathname==="/robinhood/api/v1/routes")&&!(n.origin==="https://api.velora.xyz"&&n.pathname==="/prices"))throw new Error("Only supported public price routes may be shared.");let e=m.get(o);e||(e=new h(3e3),m.set(o,e));let i=await e.read(r,()=>w(o,r,{method:"GET"},s));return{value:i.value,expiresAt:Math.floor(i.started/1e3)+60}}var y="No route through verified sources.",g=new WeakMap;function E(o){let r=g.get(o);return r||(r=async(s,n)=>{let e=new URL(s instanceof Request?s.url:String(s)),i=["aggregator-api.kyberswap.com","api.kyberswap.com"].includes(e.hostname)&&e.pathname.endsWith("/robinhood/api/v1/routes"),u=e.origin==="https://api.velora.xyz"&&e.pathname==="/prices",f=async a=>{if(!(i||u)||![200,400,404].includes(a.status))return!1;let t=await a.clone().json().catch(()=>{});return d(t)?i&&(t.code===4008&&t.message==="route not found"||t.code===40011&&t.message==="filtered liquidity sources")||u&&typeof t.error=="string"&&/^(No routes found|No liquidity|No price route found)/i.test(t.error):!1},c;try{c=await o(s,n)}catch(a){throw a instanceof l&&await f(a.response)?new p(y):a}if(await f(c))throw new p(y);return c},g.set(o,r)),r}export{x as a,y as b,E as c};
1
+ import{a as l,c as w}from"./MYFAKCQI.js";import{e as d}from"./5KUWLUPM.js";import{a as h}from"./5HCXZWUH.js";import{a as p}from"./XSD5NL7J.js";var m=new WeakMap;async function x(o,r,s){let n=new URL(r);if(!(n.origin==="https://aggregator-api.kyberswap.com"&&n.pathname==="/robinhood/api/v1/routes")&&!(n.origin==="https://api.velora.xyz"&&n.pathname==="/prices"))throw new Error("Only supported public price routes may be shared.");let e=m.get(o);e||(e=new h(3e3),m.set(o,e));let i=await e.read(r,()=>w(o,r,{method:"GET"},s));return{value:i.value,expiresAt:Math.floor(i.started/1e3)+60}}var y="No route through verified sources.",g=new WeakMap;function E(o){let r=g.get(o);return r||(r=async(s,n)=>{let e=new URL(s instanceof Request?s.url:String(s)),i=["aggregator-api.kyberswap.com","api.kyberswap.com"].includes(e.hostname)&&e.pathname.endsWith("/robinhood/api/v1/routes"),u=e.origin==="https://api.velora.xyz"&&e.pathname==="/prices",f=async a=>{if(!(i||u)||![200,400,404].includes(a.status))return!1;let t=await a.clone().json().catch(()=>{});return d(t)?i&&(t.code===4008&&t.message==="route not found"||t.code===40011&&t.message==="filtered liquidity sources")||u&&typeof t.error=="string"&&/^(No routes found|No liquidity|No price route found)/i.test(t.error):!1},c;try{c=await o(s,n)}catch(a){throw a instanceof l&&await f(a.response)?new p(y):a}if(await f(c))throw new p(y);return c},g.set(o,r)),r}export{x as a,y as b,E as c};
@@ -1 +1 @@
1
- import{a as J,h as K}from"./5VHH5PW3.js";import{a as F}from"./6IM6A5VA.js";import{a as E}from"./UWOFA6GV.js";import{c as D,d as Y,g as _,i as V,m as Q,n as z}from"./73N3TOJL.js";import{a as p,i as G,j}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";import{decodeFunctionData as X,encodeFunctionData as U,erc20Abi as O,getAddress as N,parseAbi as Z}from"viem";var e={router:N("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:N("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:N("0x8697bb63743678640710b1270e98772a29642b3c"),weth:N("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:N("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},L=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),W={vault:D,chainId:{const:p},slippageBps:{type:"integer",minimum:0,maximum:500}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,w){let l=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==w.length&&l();for(let S=0;S<s.length;S++){let q=s[S],v=w[S];if((q.chainId!==v.chainId||!_(q.to,v.to)||q.value!==v.value)&&l(),!_(q.data,v.data))try{let B=X({abi:L,data:q.data}),n=X({abi:L,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&l();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:l(),i=U({abi:L,functionName:B.functionName,args:t});_(i,q.data)||l();let u=t.length-1;(f(t[u])<=f(a[u])-600n||f(t[u])>f(a[u]))&&l(),t[u]=a[u];for(let o of r)f(t[o])<f(a[o])&&l(),t[o]=a[o];_(U({abi:L,functionName:B.functionName,args:t}),v.data)||l()}catch{l()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function R(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function f(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let w=s??50;if(typeof w!="number"||!Number.isInteger(w)||w<0||w>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(w)}function H(s,w){let l=s*(10000n-w)/10000n;if(l===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return l}var ce=s=>{async function w(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function l(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==N(G[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function S(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=f(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=f(a.timestamp)+600n,i=(P,g,A=[])=>n.readContract({address:P,abi:L,functionName:g,args:A,blockNumber:t}),[u,o,m,c,h,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:G[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||h!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(P,g)=>f(await n.readContract({address:P,abi:O,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(P){let[g,A]=await Promise.all([n.readContract({address:P,abi:O,functionName:"symbol",blockNumber:t}),n.readContract({address:P,abi:O,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:P,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function q(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:D,chainId:{const:p},amount:{...E(),description:"Optional CLM entry budget in the bridge token base units."},slippageBps:W.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>w(async()=>{if(J.some(b=>_(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);l(n,[]),F(t);let a=await S(),[r,i,u,o,m,c,h]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:f(o[0]).toString()},{token:i,balance:c.toString(),reserve:f(o[1]).toString()}],lp:{token:u,balance:h.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...W,from:D,to:D,amount:E()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["from","to","amount","slippageBps"]),F(t);let a=y(n.from),r=y(n.to),i=R(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,N(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await S();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let h=[];m&&h.push(v(e.weth,U({abi:L,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let I=0;I<g.length-1;I++){let C={from:g[I],to:g[I+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let x=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(x)||x.length!==g.length||f(x[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let I of x)if(f(I)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=f(x.at(-1)),T=H(k,u),h.push(s.approval(b,e.router,i.toString(),p)),h.push(v(e.router,U({abi:L,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let P=await c.token(r);return{...await q(h,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:P,amount:k.toString()},minimumOutput:{token:P,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...W,amount0:E(),amount1:E()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["amount0","amount1","slippageBps"]),F(t);let a=R(n.amount0),r=R(n.amount1),i=M(n.slippageBps),u=await S();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=f(o[0]),c=f(o[1]),h=f(o[2]);if(m>a||c>r||h===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=H(m,i),k=H(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,U({abi:L,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await q(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:h.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...W,amount:{anyOf:[E(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["amount","slippageBps"]),F(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:R(n.amount),i=await S(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,h]=await Promise.all([i.client.readContract({address:e.pair,abi:O,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(f(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=H(c*o/m,a),k=H(h*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,U({abi:L,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await q(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,L as b,ue as c,de as d,ce as e};
1
+ import{a as J,h as K}from"./6YYCGUCU.js";import{a as F}from"./PBQSJSZO.js";import{a as E}from"./5ZLOCQA4.js";import{c as D,d as Y,g as _,i as V,m as Q,n as z}from"./5KUWLUPM.js";import{a as p,i as G,j}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{decodeFunctionData as X,encodeFunctionData as U,erc20Abi as O,getAddress as N,parseAbi as Z}from"viem";var e={router:N("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:N("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:N("0x8697bb63743678640710b1270e98772a29642b3c"),weth:N("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:N("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},L=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),W={vault:D,chainId:{const:p},slippageBps:{type:"integer",minimum:0,maximum:500}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,w){let l=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==w.length&&l();for(let S=0;S<s.length;S++){let q=s[S],v=w[S];if((q.chainId!==v.chainId||!_(q.to,v.to)||q.value!==v.value)&&l(),!_(q.data,v.data))try{let B=X({abi:L,data:q.data}),n=X({abi:L,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&l();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:l(),i=U({abi:L,functionName:B.functionName,args:t});_(i,q.data)||l();let u=t.length-1;(f(t[u])<=f(a[u])-600n||f(t[u])>f(a[u]))&&l(),t[u]=a[u];for(let o of r)f(t[o])<f(a[o])&&l(),t[o]=a[o];_(U({abi:L,functionName:B.functionName,args:t}),v.data)||l()}catch{l()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function R(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function f(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let w=s??50;if(typeof w!="number"||!Number.isInteger(w)||w<0||w>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(w)}function H(s,w){let l=s*(10000n-w)/10000n;if(l===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return l}var ce=s=>{async function w(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function l(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==N(G[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function S(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=f(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=f(a.timestamp)+600n,i=(P,g,A=[])=>n.readContract({address:P,abi:L,functionName:g,args:A,blockNumber:t}),[u,o,m,c,h,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:G[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||h!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(P,g)=>f(await n.readContract({address:P,abi:O,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(P){let[g,A]=await Promise.all([n.readContract({address:P,abi:O,functionName:"symbol",blockNumber:t}),n.readContract({address:P,abi:O,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:P,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function q(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:D,chainId:{const:p},amount:{...E(),description:"Optional CLM entry budget in the bridge token base units."},slippageBps:W.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>w(async()=>{if(J.some(b=>_(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);l(n,[]),F(t);let a=await S(),[r,i,u,o,m,c,h]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:f(o[0]).toString()},{token:i,balance:c.toString(),reserve:f(o[1]).toString()}],lp:{token:u,balance:h.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...W,from:D,to:D,amount:E()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["from","to","amount","slippageBps"]),F(t);let a=y(n.from),r=y(n.to),i=R(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,N(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await S();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let h=[];m&&h.push(v(e.weth,U({abi:L,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let I=0;I<g.length-1;I++){let C={from:g[I],to:g[I+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let x=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(x)||x.length!==g.length||f(x[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let I of x)if(f(I)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=f(x.at(-1)),T=H(k,u),h.push(s.approval(b,e.router,i.toString(),p)),h.push(v(e.router,U({abi:L,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let P=await c.token(r);return{...await q(h,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:P,amount:k.toString()},minimumOutput:{token:P,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...W,amount0:E(),amount1:E()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["amount0","amount1","slippageBps"]),F(t);let a=R(n.amount0),r=R(n.amount1),i=M(n.slippageBps),u=await S();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=f(o[0]),c=f(o[1]),h=f(o[2]);if(m>a||c>r||h===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=H(m,i),k=H(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,U({abi:L,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await q(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:h.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...W,amount:{anyOf:[E(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["amount","slippageBps"]),F(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:R(n.amount),i=await S(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,h]=await Promise.all([i.client.readContract({address:e.pair,abi:O,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(f(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=H(c*o/m,a),k=H(h*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,U({abi:L,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await q(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,L as b,ue as c,de as d,ce as e};
@@ -0,0 +1 @@
1
+ import{c as o}from"./UP7FBDMJ.js";import{a as g}from"./XSD5NL7J.js";var s=10000000n;function A(t,i){let n=s;return typeof t=="bigint"&&t>0n&&t<n&&(n=t),typeof i=="bigint"&&i>0n&&i*2n<n&&(n=i*2n),n}function b(t,i,n,r){return`needs ETH for network fees: need at least ${n} wei including transaction value; held ${r} wei. Send ETH to ${t} on chain ${i}. Approximately ${o(n.toString(),18)} ETH needed; ${o(r.toString(),18)} ETH held.`}function a(t,i,n,r,d,u){let e=n+21000n*r;if(i<e)throw new g(b(d,u,e,i));let f=r>0n?(i-n)/r:t;return f<t?f:t}export{s as a,A as b,b as c,a as d};
@@ -1 +1 @@
1
- import{d as b,g as W,h as j,m as z}from"./IBXYIN7Q.js";import{a as B,e as F,g as R}from"./3NDVXEBR.js";import{b as C,c as q,s as X,z as D}from"./YOENHHKI.js";import{a as U}from"./UWOFA6GV.js";import{g as T}from"./73N3TOJL.js";import{a as O}from"./G6HCV67X.js";import{a as c}from"./5YS5V2LK.js";import{decodeEventLog as J,parseAbi as V,toEventSelector as Z,toHex as x}from"viem";var K=V(["function getPositionInfo(bytes32 poolId,address owner,int24 tickLower,int24 tickUpper,bytes32 salt) view returns (uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128)","function getFeeGrowthInside(bytes32 poolId,int24 tickLower,int24 tickUpper) view returns (uint256,uint256)"]),Q=V(["function ownerOf(uint256) view returns (address)","function getPoolAndPositionInfo(uint256) view returns ((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks),uint256)"]),A=V(["function slot0() view returns (uint160,int24,uint16,uint16,uint16,uint8,bool)","function feeGrowthGlobal0X128() view returns (uint256)","function feeGrowthGlobal1X128() view returns (uint256)","function ticks(int24) view returns (uint128,int128,uint256,uint256,int56,uint160,uint32,bool)"]),$=(1n<<256n)-1n,ee=1n<<128n,P=(s,t)=>s-t&$;function G(s,t,r,n=0n){return P(s,t)*r/ee+n}function ue(s){return{tools:[{name:"uniswap_fees",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenId"],properties:{includeHistory:{type:"boolean",description:"V3 only: read the complete NFT collect/decrease event history for lifetime fees. This can require multiple RPC log windows."},version:{type:"string",enum:["v3","v4"]},tokenId:U()}},async execute(t){if(R(t,["version","tokenId","includeHistory"]),t.includeHistory!==void 0&&typeof t.includeHistory!="boolean")throw new c("includeHistory must be a boolean.");if(t.includeHistory===!0&&t.version!=="v3")throw new c("V4 position lifetime fees need historical liquidity/fee-growth checkpoints; no verified history source is configured.");let r=B(t.tokenId,"tokenId"),n=s.clientFor(O),i=await n.getBlockNumber();if(t.version!=="v3"&&t.version!=="v4")throw new c("Provide version v3 or v4 for fee reads.");let _=await n.readContract({address:t.version==="v4"?C:b.positionManager,abi:Q,functionName:"ownerOf",args:[r],blockNumber:i}),v,m,a,d,u,w=0n,p=0n;if(t.version==="v4"){let[e,f]=await n.readContract({address:C,abi:Q,functionName:"getPoolAndPositionInfo",args:[r],blockNumber:i}),{tickLower:h,tickUpper:N}=D(f),S=X(e),[k,I]=await Promise.all([n.readContract({address:q,abi:K,functionName:"getPositionInfo",args:[S,C,h,N,x(r,{size:32})],blockNumber:i}),n.readContract({address:q,abi:K,functionName:"getFeeGrowthInside",args:[S,h,N],blockNumber:i})]);[v,m,a]=[e.currency0,e.currency1,k[0]],[d,u]=[G(I[0],k[1],a),G(I[1],k[2],a)]}else if(t.version==="v3"){let e=z(await n.readContract({address:b.positionManager,abi:W,functionName:"positions",args:[r],blockNumber:i})),f=await n.readContract({address:b.factory,abi:j,functionName:"getPool",args:[e.token0,e.token1,e.fee],blockNumber:i}),[h,N,S,k,I]=await Promise.all([n.readContract({address:f,abi:A,functionName:"slot0",blockNumber:i}),n.readContract({address:f,abi:A,functionName:"feeGrowthGlobal0X128",blockNumber:i}),n.readContract({address:f,abi:A,functionName:"feeGrowthGlobal1X128",blockNumber:i}),n.readContract({address:f,abi:A,functionName:"ticks",args:[e.tickLower],blockNumber:i}),n.readContract({address:f,abi:A,functionName:"ticks",args:[e.tickUpper],blockNumber:i})]),M=(L,E,H)=>P(P(L,h[1]>=e.tickLower?E:P(L,E)),h[1]<e.tickUpper?H:P(L,H));[v,m,a]=[e.token0,e.token1,e.liquidity],[w,p]=[e.tokensOwed0,e.tokensOwed1],[d,u]=[G(M(N,k[2],I[2]),e.feeGrowthInside0LastX128,a,e.tokensOwed0),G(M(S,k[3],I[3]),e.feeGrowthInside1LastX128,a,e.tokensOwed1)]}else throw new c('Provide version "v3" or "v4" for fee reads.');let[o,g]=await Promise.all([F(s,v,i),F(s,m,i)]),y=[{token:o,amount:d.toString()},{token:g,amount:u.toString()}],l=t.includeHistory===!0?await te(s,r,i,d,u):void 0;return{version:t.version,tokenId:r.toString(),owner:_,blockNumber:i.toString(),liquidity:a.toString(),...t.version==="v4"?{uncollected:y}:{},collectable:y,feeGrowthAccrual:[{token:o,amount:(d-w).toString()},{token:g,amount:(u-p).toString()}],tokensOwed:[{token:o,amount:w.toString()},{token:g,amount:p.toString()}],...l?{lifetimeFees:[{token:o,amount:l[0].toString()},{token:g,amount:l[1].toString()}]}:{},summary:"One-block collectable estimate, excluding gas. V3 tokensOwed may include withdrawn principal; feeGrowthAccrual excludes those stored amounts. V4 hook accounting can change actual collections. V4 current liquidity times lifetime range growth is not lifetime position earnings."}}}]}}var Y=V(["event IncreaseLiquidity(uint256 indexed tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)","event DecreaseLiquidity(uint256 indexed tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)","event Collect(uint256 indexed tokenId,address recipient,uint256 amount0,uint256 amount1)"]);async function te(s,t,r,n,i){let _=s.clientFor(O),v=Y.map(o=>Z(o)),m=0n,a=0n,d=0n,u=0n,w=0;for(let o=0n;o<=r;o+=10000000n){let g=o+9999999n<r?o+9999999n:r,y=await _.request({method:"eth_getLogs",params:[{address:b.positionManager,topics:[v,x(t,{size:32})],fromBlock:x(o),toBlock:x(g)}]});if(!Array.isArray(y))throw new c("V3 lifetime fee history is unavailable; do not treat missing history as zero earnings.");for(let l of y){if(!T(l.address,b.positionManager))throw new c("Unexpected contract in v3 lifetime fee history.");let e=J({abi:Y,data:l.data,topics:l.topics});if(e.args.tokenId!==t)throw new c("Unexpected NFT in v3 fee history.");e.eventName==="Collect"?(m+=e.args.amount0,a+=e.args.amount1):e.eventName==="DecreaseLiquidity"?(d+=e.args.amount0,u+=e.args.amount1):w++}}if(w===0)throw new c("V3 mint/increase history is missing for this existing NFT; lifetime earnings are unknown.");let p=[m+n-d,a+i-u];if(p.some(o=>o<0n))throw new c("V3 fee history is incomplete or inconsistent; lifetime earnings are unknown.");return p}export{K as a,P as b,G as c,ue as d};
1
+ import{d as b,g as W,h as j,m as z}from"./JG27HM4P.js";import{a as B,e as F,g as R}from"./SGEZIYJW.js";import{b as C,c as q,s as X,z as D}from"./WPAF55SP.js";import{a as U}from"./5ZLOCQA4.js";import{g as T}from"./5KUWLUPM.js";import{a as O}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{decodeEventLog as J,parseAbi as V,toEventSelector as Z,toHex as x}from"viem";var K=V(["function getPositionInfo(bytes32 poolId,address owner,int24 tickLower,int24 tickUpper,bytes32 salt) view returns (uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128)","function getFeeGrowthInside(bytes32 poolId,int24 tickLower,int24 tickUpper) view returns (uint256,uint256)"]),Q=V(["function ownerOf(uint256) view returns (address)","function getPoolAndPositionInfo(uint256) view returns ((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks),uint256)"]),A=V(["function slot0() view returns (uint160,int24,uint16,uint16,uint16,uint8,bool)","function feeGrowthGlobal0X128() view returns (uint256)","function feeGrowthGlobal1X128() view returns (uint256)","function ticks(int24) view returns (uint128,int128,uint256,uint256,int56,uint160,uint32,bool)"]),$=(1n<<256n)-1n,ee=1n<<128n,P=(s,t)=>s-t&$;function G(s,t,r,n=0n){return P(s,t)*r/ee+n}function ue(s){return{tools:[{name:"uniswap_fees",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenId"],properties:{includeHistory:{type:"boolean",description:"V3 only: read the complete NFT collect/decrease event history for lifetime fees. This can require multiple RPC log windows."},version:{type:"string",enum:["v3","v4"]},tokenId:U()}},async execute(t){if(R(t,["version","tokenId","includeHistory"]),t.includeHistory!==void 0&&typeof t.includeHistory!="boolean")throw new c("includeHistory must be a boolean.");if(t.includeHistory===!0&&t.version!=="v3")throw new c("V4 position lifetime fees need historical liquidity/fee-growth checkpoints; no verified history source is configured.");let r=B(t.tokenId,"tokenId"),n=s.clientFor(O),i=await n.getBlockNumber();if(t.version!=="v3"&&t.version!=="v4")throw new c("Provide version v3 or v4 for fee reads.");let _=await n.readContract({address:t.version==="v4"?C:b.positionManager,abi:Q,functionName:"ownerOf",args:[r],blockNumber:i}),v,m,a,d,u,w=0n,p=0n;if(t.version==="v4"){let[e,f]=await n.readContract({address:C,abi:Q,functionName:"getPoolAndPositionInfo",args:[r],blockNumber:i}),{tickLower:h,tickUpper:N}=D(f),S=X(e),[k,I]=await Promise.all([n.readContract({address:q,abi:K,functionName:"getPositionInfo",args:[S,C,h,N,x(r,{size:32})],blockNumber:i}),n.readContract({address:q,abi:K,functionName:"getFeeGrowthInside",args:[S,h,N],blockNumber:i})]);[v,m,a]=[e.currency0,e.currency1,k[0]],[d,u]=[G(I[0],k[1],a),G(I[1],k[2],a)]}else if(t.version==="v3"){let e=z(await n.readContract({address:b.positionManager,abi:W,functionName:"positions",args:[r],blockNumber:i})),f=await n.readContract({address:b.factory,abi:j,functionName:"getPool",args:[e.token0,e.token1,e.fee],blockNumber:i}),[h,N,S,k,I]=await Promise.all([n.readContract({address:f,abi:A,functionName:"slot0",blockNumber:i}),n.readContract({address:f,abi:A,functionName:"feeGrowthGlobal0X128",blockNumber:i}),n.readContract({address:f,abi:A,functionName:"feeGrowthGlobal1X128",blockNumber:i}),n.readContract({address:f,abi:A,functionName:"ticks",args:[e.tickLower],blockNumber:i}),n.readContract({address:f,abi:A,functionName:"ticks",args:[e.tickUpper],blockNumber:i})]),M=(L,E,H)=>P(P(L,h[1]>=e.tickLower?E:P(L,E)),h[1]<e.tickUpper?H:P(L,H));[v,m,a]=[e.token0,e.token1,e.liquidity],[w,p]=[e.tokensOwed0,e.tokensOwed1],[d,u]=[G(M(N,k[2],I[2]),e.feeGrowthInside0LastX128,a,e.tokensOwed0),G(M(S,k[3],I[3]),e.feeGrowthInside1LastX128,a,e.tokensOwed1)]}else throw new c('Provide version "v3" or "v4" for fee reads.');let[o,g]=await Promise.all([F(s,v,i),F(s,m,i)]),y=[{token:o,amount:d.toString()},{token:g,amount:u.toString()}],l=t.includeHistory===!0?await te(s,r,i,d,u):void 0;return{version:t.version,tokenId:r.toString(),owner:_,blockNumber:i.toString(),liquidity:a.toString(),...t.version==="v4"?{uncollected:y}:{},collectable:y,feeGrowthAccrual:[{token:o,amount:(d-w).toString()},{token:g,amount:(u-p).toString()}],tokensOwed:[{token:o,amount:w.toString()},{token:g,amount:p.toString()}],...l?{lifetimeFees:[{token:o,amount:l[0].toString()},{token:g,amount:l[1].toString()}]}:{},summary:"One-block collectable estimate, excluding gas. V3 tokensOwed may include withdrawn principal; feeGrowthAccrual excludes those stored amounts. V4 hook accounting can change actual collections. V4 current liquidity times lifetime range growth is not lifetime position earnings."}}}]}}var Y=V(["event IncreaseLiquidity(uint256 indexed tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)","event DecreaseLiquidity(uint256 indexed tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)","event Collect(uint256 indexed tokenId,address recipient,uint256 amount0,uint256 amount1)"]);async function te(s,t,r,n,i){let _=s.clientFor(O),v=Y.map(o=>Z(o)),m=0n,a=0n,d=0n,u=0n,w=0;for(let o=0n;o<=r;o+=10000000n){let g=o+9999999n<r?o+9999999n:r,y=await _.request({method:"eth_getLogs",params:[{address:b.positionManager,topics:[v,x(t,{size:32})],fromBlock:x(o),toBlock:x(g)}]});if(!Array.isArray(y))throw new c("V3 lifetime fee history is unavailable; do not treat missing history as zero earnings.");for(let l of y){if(!T(l.address,b.positionManager))throw new c("Unexpected contract in v3 lifetime fee history.");let e=J({abi:Y,data:l.data,topics:l.topics});if(e.args.tokenId!==t)throw new c("Unexpected NFT in v3 fee history.");e.eventName==="Collect"?(m+=e.args.amount0,a+=e.args.amount1):e.eventName==="DecreaseLiquidity"?(d+=e.args.amount0,u+=e.args.amount1):w++}}if(w===0)throw new c("V3 mint/increase history is missing for this existing NFT; lifetime earnings are unknown.");let p=[m+n-d,a+i-u];if(p.some(o=>o<0n))throw new c("V3 fee history is incomplete or inconsistent; lifetime earnings are unknown.");return p}export{K as a,P as b,G as c,ue as d};
@@ -1 +1 @@
1
- import{a as u}from"./G6HCV67X.js";import{a as c}from"./5YS5V2LK.js";import{decodeErrorResult as h,encodeFunctionData as k,formatEther as p,keccak256 as w,parseAbi as y}from"viem";var l="0x5aeB8269977Ce12f62D2cD9a1f04E9A7894512ee",m="0x5236857c06be1bf151306dcc5ac134b2a2353760f3d73817da769dee67d7ef24",O=["hoodlock_buyback"],b=y(["function execute() returns(uint256)","error NotReady(uint256 balance,uint256 need,uint64 readyAt)"]);function g(e){let s=new Set;for(let o=0;e&&typeof e=="object"&&o<16&&!s.has(e);o++){s.add(e);let t=e,a=t.raw??t.data;if(typeof a=="string"&&/^0x[0-9a-f]+$/i.test(a))try{let n=h({abi:b,data:a});if(n.errorName==="NotReady"){let[r,i,d]=n.args;return`HoodLock buyback is not ready: ${p(r)} ETH pending in the vault; threshold ${p(i)} ETH${r<i?" not reached":""}. Contract readiness time: ${d} Unix seconds. No wallet funds were spent; retry when the vault is ready.`}}catch{}e=t.cause}}var v=e=>({tools:[{name:"hoodlock_buyback",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(s,o){if(Object.keys(s).length)throw new c("HoodLock buyback accepts no amount, recipient or calldata.");let t=e.clientFor(u);if(await t.getChainId()!==u)throw new c("HoodLock buyback requires chain 4663.");let a=await t.getBlockNumber(),n=await t.getCode({address:l,blockNumber:a});if(!n||w(n)!==m)throw new c("The HoodLock buyback vault no longer matches its pinned runtime code.");let r=[e.unsignedTx({to:l,chainId:u,value:"0",data:k({abi:b,functionName:"execute"}),description:"Trigger the HoodLock vault to buy back and burn LOCK using its own ETH. No wallet funds or approvals."})];try{await t.simulateContract({address:l,abi:b,functionName:"execute",account:o,blockNumber:a})}catch(d){let f=g(d);throw new c(f??e.plainError(d))}let i=await e.preview(r,o);return{txs:r,preview:i,summary:"Permissionless HoodLock buyback and burn. The vault enforces its threshold, cooldown, oracle and slippage checks. The caller pays gas and receives no reward. Confirm the local preview before signing."}}}]});export{l as a,m as b,O as c,b as d,g as e,v as f};
1
+ import{a as u}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{decodeErrorResult as h,encodeFunctionData as k,formatEther as p,keccak256 as w,parseAbi as y}from"viem";var l="0x5aeB8269977Ce12f62D2cD9a1f04E9A7894512ee",m="0x5236857c06be1bf151306dcc5ac134b2a2353760f3d73817da769dee67d7ef24",O=["hoodlock_buyback"],b=y(["function execute() returns(uint256)","error NotReady(uint256 balance,uint256 need,uint64 readyAt)"]);function g(e){let s=new Set;for(let o=0;e&&typeof e=="object"&&o<16&&!s.has(e);o++){s.add(e);let t=e,a=t.raw??t.data;if(typeof a=="string"&&/^0x[0-9a-f]+$/i.test(a))try{let n=h({abi:b,data:a});if(n.errorName==="NotReady"){let[r,i,d]=n.args;return`HoodLock buyback is not ready: ${p(r)} ETH pending in the vault; threshold ${p(i)} ETH${r<i?" not reached":""}. Contract readiness time: ${d} Unix seconds. No wallet funds were spent; retry when the vault is ready.`}}catch{}e=t.cause}}var v=e=>({tools:[{name:"hoodlock_buyback",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(s,o){if(Object.keys(s).length)throw new c("HoodLock buyback accepts no amount, recipient or calldata.");let t=e.clientFor(u);if(await t.getChainId()!==u)throw new c("HoodLock buyback requires chain 4663.");let a=await t.getBlockNumber(),n=await t.getCode({address:l,blockNumber:a});if(!n||w(n)!==m)throw new c("The HoodLock buyback vault no longer matches its pinned runtime code.");let r=[e.unsignedTx({to:l,chainId:u,value:"0",data:k({abi:b,functionName:"execute"}),description:"Trigger the HoodLock vault to buy back and burn LOCK using its own ETH. No wallet funds or approvals."})];try{await t.simulateContract({address:l,abi:b,functionName:"execute",account:o,blockNumber:a})}catch(d){let f=g(d);throw new c(f??e.plainError(d))}let i=await e.preview(r,o);return{txs:r,preview:i,summary:"Permissionless HoodLock buyback and burn. The vault enforces its threshold, cooldown, oracle and slippage checks. The caller pays gas and receives no reward. Confirm the local preview before signing."}}}]});export{l as a,m as b,O as c,b as d,g as e,v as f};