@oakagentkit/core 0.2.4 → 0.2.5

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 (448) hide show
  1. package/build/dist/api/amounts.d.ts +2 -0
  2. package/build/dist/api/amounts.js +1 -1
  3. package/build/dist/api/args.js +1 -1
  4. package/build/dist/api/gas.js +1 -1
  5. package/build/dist/api/grandfather.js +1 -1
  6. package/build/dist/api/guards.js +1 -1
  7. package/build/dist/api/history.js +1 -1
  8. package/build/dist/api/http.js +1 -1
  9. package/build/dist/api/merkle.js +1 -1
  10. package/build/dist/api/module.js +1 -1
  11. package/build/dist/api/modules/beefy/boosts.js +1 -1
  12. package/build/dist/api/modules/beefy/clm.js +1 -1
  13. package/build/dist/api/modules/beefy/guard.js +1 -1
  14. package/build/dist/api/modules/beefy/index.js +1 -1
  15. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  16. package/build/dist/api/modules/beefy/management.js +1 -1
  17. package/build/dist/api/modules/beefy/vaults.js +1 -1
  18. package/build/dist/api/modules/borro/abi.d.ts +149 -0
  19. package/build/dist/api/modules/borro/abi.js +1 -0
  20. package/build/dist/api/modules/borro/actions.d.ts +2 -0
  21. package/build/dist/api/modules/borro/actions.js +1 -0
  22. package/build/dist/api/modules/borro/checks.d.ts +151 -0
  23. package/build/dist/api/modules/borro/checks.js +1 -0
  24. package/build/dist/api/modules/borro/copy.d.ts +174 -0
  25. package/build/dist/api/modules/borro/copy.js +1 -0
  26. package/build/dist/api/modules/borro/index.d.ts +13 -0
  27. package/build/dist/api/modules/borro/index.js +1 -0
  28. package/build/dist/api/modules/borro/liquidity.d.ts +4 -0
  29. package/build/dist/api/modules/borro/liquidity.js +1 -0
  30. package/build/dist/api/modules/borro/pins.d.ts +264 -0
  31. package/build/dist/api/modules/borro/pins.js +1 -0
  32. package/build/dist/api/modules/borro/positions.d.ts +8 -0
  33. package/build/dist/api/modules/borro/positions.js +1 -0
  34. package/build/dist/api/modules/borro/rates.d.ts +20 -0
  35. package/build/dist/api/modules/borro/rates.js +1 -0
  36. package/build/dist/api/modules/borro/reader.d.ts +32 -0
  37. package/build/dist/api/modules/borro/reader.js +1 -0
  38. package/build/dist/api/modules/borro/types.d.ts +120 -0
  39. package/build/dist/api/modules/borro/types.js +0 -0
  40. package/build/dist/api/modules/clanker/extensions.js +1 -1
  41. package/build/dist/api/modules/clanker/index.js +1 -1
  42. package/build/dist/api/modules/clanker/manage.js +1 -1
  43. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  44. package/build/dist/api/modules/clanker/protocol.js +1 -1
  45. package/build/dist/api/modules/clanker/state.js +1 -1
  46. package/build/dist/api/modules/earn/copy.d.ts +2 -2
  47. package/build/dist/api/modules/earn/copy.js +1 -1
  48. package/build/dist/api/modules/earn/index.js +1 -1
  49. package/build/dist/api/modules/earn/lp.js +1 -1
  50. package/build/dist/api/modules/earn/options.js +1 -1
  51. package/build/dist/api/modules/erc8004/common.js +1 -1
  52. package/build/dist/api/modules/erc8004/domain.js +1 -1
  53. package/build/dist/api/modules/erc8004/index.js +1 -1
  54. package/build/dist/api/modules/erc8004/management.js +1 -1
  55. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  56. package/build/dist/api/modules/erc8004/services.js +1 -1
  57. package/build/dist/api/modules/erc8004/validation.js +1 -1
  58. package/build/dist/api/modules/grove/index.js +1 -1
  59. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  60. package/build/dist/api/modules/heyresearch/index.js +1 -1
  61. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  62. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  63. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  64. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  65. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  66. package/build/dist/api/modules/hoodag/index.js +1 -1
  67. package/build/dist/api/modules/hoodag/management.js +1 -1
  68. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  69. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  70. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  71. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  72. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  73. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  74. package/build/dist/api/modules/hoodlock/index.js +1 -1
  75. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  76. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  77. package/build/dist/api/modules/hoodlock/public.js +1 -1
  78. package/build/dist/api/modules/hookr/actions.js +1 -1
  79. package/build/dist/api/modules/hookr/addons.js +1 -1
  80. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  81. package/build/dist/api/modules/hookr/contracts.js +1 -1
  82. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  83. package/build/dist/api/modules/hookr/discovery.js +1 -1
  84. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  85. package/build/dist/api/modules/hookr/index.js +1 -1
  86. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  87. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  88. package/build/dist/api/modules/hookr/launch.js +1 -1
  89. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  90. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  91. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  92. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  93. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  94. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  95. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  96. package/build/dist/api/modules/hookr/relay.js +1 -1
  97. package/build/dist/api/modules/hookr/revenue.js +1 -1
  98. package/build/dist/api/modules/kyberswap/index.js +1 -1
  99. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  100. package/build/dist/api/modules/layerbank/actions.js +1 -1
  101. package/build/dist/api/modules/layerbank/checks.js +1 -1
  102. package/build/dist/api/modules/layerbank/index.js +1 -1
  103. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  104. package/build/dist/api/modules/layerbank/reader.js +1 -1
  105. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  106. package/build/dist/api/modules/lighter/index.js +1 -1
  107. package/build/dist/api/modules/longbow/administration.js +1 -1
  108. package/build/dist/api/modules/longbow/analytics.js +1 -1
  109. package/build/dist/api/modules/longbow/fixed.js +1 -1
  110. package/build/dist/api/modules/longbow/index.js +1 -1
  111. package/build/dist/api/modules/longbow/nft.js +1 -1
  112. package/build/dist/api/modules/longbow/rebates.js +1 -1
  113. package/build/dist/api/modules/longbow/staking.js +1 -1
  114. package/build/dist/api/modules/meridian/index.js +1 -1
  115. package/build/dist/api/modules/meridian/markets.js +1 -1
  116. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  117. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  118. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  119. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  120. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  121. package/build/dist/api/modules/meridian/perps.d.ts +1 -0
  122. package/build/dist/api/modules/meridian/perps.js +1 -1
  123. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  124. package/build/dist/api/modules/meridian/rfq.js +1 -1
  125. package/build/dist/api/modules/merkl/discovery.js +1 -1
  126. package/build/dist/api/modules/merkl/index.js +1 -1
  127. package/build/dist/api/modules/merkl/manage.js +1 -1
  128. package/build/dist/api/modules/merkl/protocol.js +1 -1
  129. package/build/dist/api/modules/morpho/allocator.js +1 -1
  130. package/build/dist/api/modules/morpho/bundles.js +1 -1
  131. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  132. package/build/dist/api/modules/morpho/index.js +1 -1
  133. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  134. package/build/dist/api/modules/morpho/midnight.js +1 -1
  135. package/build/dist/api/modules/morpho/protocol.js +1 -1
  136. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  137. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  138. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  139. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  140. package/build/dist/api/modules/netnet/card-read.js +1 -1
  141. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  142. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  143. package/build/dist/api/modules/netnet/financial.js +1 -1
  144. package/build/dist/api/modules/netnet/index.js +1 -1
  145. package/build/dist/api/modules/netnet/staking.js +1 -1
  146. package/build/dist/api/modules/orbio/gateway.js +1 -1
  147. package/build/dist/api/modules/orbio/index.js +1 -1
  148. package/build/dist/api/modules/orbio/positions.js +1 -1
  149. package/build/dist/api/modules/pendle/convert.js +1 -1
  150. package/build/dist/api/modules/pendle/costs.js +1 -1
  151. package/build/dist/api/modules/pendle/index.js +1 -1
  152. package/build/dist/api/modules/pendle/markets.js +1 -1
  153. package/build/dist/api/modules/pendle/positions.js +1 -1
  154. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  155. package/build/dist/api/modules/pendle/reader.js +1 -1
  156. package/build/dist/api/modules/pendle/redeem.js +1 -1
  157. package/build/dist/api/modules/pendle/trade.js +1 -1
  158. package/build/dist/api/modules/pendle/types.d.ts +16 -1
  159. package/build/dist/api/modules/pendle/validate.js +1 -1
  160. package/build/dist/api/modules/pendle/verify.js +1 -1
  161. package/build/dist/api/modules/pons/claim.js +1 -1
  162. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  163. package/build/dist/api/modules/pons/index.js +1 -1
  164. package/build/dist/api/modules/pons/launch-status.js +1 -1
  165. package/build/dist/api/modules/pons/prices.js +1 -1
  166. package/build/dist/api/modules/pons/reads.js +1 -1
  167. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  168. package/build/dist/api/modules/pons/trade.js +1 -1
  169. package/build/dist/api/modules/poolstrade/index.js +1 -1
  170. package/build/dist/api/modules/priors/coverage.js +1 -1
  171. package/build/dist/api/modules/priors/discovery.js +1 -1
  172. package/build/dist/api/modules/priors/features.js +1 -1
  173. package/build/dist/api/modules/priors/holdings.js +1 -1
  174. package/build/dist/api/modules/priors/index.js +1 -1
  175. package/build/dist/api/modules/priors/integration.js +1 -1
  176. package/build/dist/api/modules/priors/market.js +1 -1
  177. package/build/dist/api/modules/priors/pt.js +1 -1
  178. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  179. package/build/dist/api/modules/priors/starter-line.js +1 -1
  180. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  181. package/build/dist/api/modules/relay/api.js +1 -1
  182. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  183. package/build/dist/api/modules/relay/discovery.js +1 -1
  184. package/build/dist/api/modules/relay/inbound.d.ts +2 -0
  185. package/build/dist/api/modules/relay/inbound.js +1 -1
  186. package/build/dist/api/modules/relay/index.js +1 -1
  187. package/build/dist/api/modules/relay/order.js +1 -1
  188. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  189. package/build/dist/api/modules/relay/readiness.js +1 -1
  190. package/build/dist/api/modules/relay/reads.js +1 -1
  191. package/build/dist/api/modules/relay/vaults.js +1 -1
  192. package/build/dist/api/modules/spark/actions.js +1 -1
  193. package/build/dist/api/modules/spark/details.js +1 -1
  194. package/build/dist/api/modules/spark/index.js +1 -1
  195. package/build/dist/api/modules/spark/management.js +1 -1
  196. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  197. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  198. package/build/dist/api/modules/steakhouse/index.js +1 -1
  199. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  200. package/build/dist/api/modules/steakhouse/management.js +1 -1
  201. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  202. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  203. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  204. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  205. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  206. package/build/dist/api/modules/tickerspring/index.js +1 -1
  207. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  208. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  209. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  210. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  211. package/build/dist/api/modules/tickerspring/research.js +1 -1
  212. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  213. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  214. package/build/dist/api/modules/uniswap/auction.js +1 -1
  215. package/build/dist/api/modules/uniswap/batch.js +1 -1
  216. package/build/dist/api/modules/uniswap/common.js +1 -1
  217. package/build/dist/api/modules/uniswap/fees.js +1 -1
  218. package/build/dist/api/modules/uniswap/index.js +1 -1
  219. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  220. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  221. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  222. package/build/dist/api/modules/uniswap/pools.js +1 -1
  223. package/build/dist/api/modules/uniswap/position.js +1 -1
  224. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  225. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  226. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  227. package/build/dist/api/modules/uniswap/trade.js +1 -1
  228. package/build/dist/api/modules/uniswap/v2.js +1 -1
  229. package/build/dist/api/modules/uniswap/v3.d.ts +11 -1
  230. package/build/dist/api/modules/uniswap/v3.js +1 -1
  231. package/build/dist/api/modules/uniswap/v4.js +1 -1
  232. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  233. package/build/dist/api/modules/velora/claims.js +1 -1
  234. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  235. package/build/dist/api/modules/velora/index.js +1 -1
  236. package/build/dist/api/modules/wormhole/index.js +1 -1
  237. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  238. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  239. package/build/dist/api/positions.js +1 -1
  240. package/build/dist/api/pricenote.js +1 -1
  241. package/build/dist/api/prices.js +1 -1
  242. package/build/dist/api/pricing.js +1 -1
  243. package/build/dist/api/routes.js +1 -1
  244. package/build/dist/api/send.js +1 -1
  245. package/build/dist/api/signing-registry.js +1 -1
  246. package/build/dist/api/simulate.js +1 -1
  247. package/build/dist/api/swap.js +1 -1
  248. package/build/dist/api/tokens.d.ts +1 -0
  249. package/build/dist/api/tokens.js +1 -1
  250. package/build/dist/api/tool-policy.js +1 -1
  251. package/build/dist/api/tx.js +1 -1
  252. package/build/dist/api/vendor-limits.js +1 -1
  253. package/build/dist/chunks/{BAAXGB4K.js → 2KYAMXTS.js} +1 -1
  254. package/build/dist/chunks/{WVONJOWN.js → 2MAMJJJC.js} +1 -1
  255. package/build/dist/chunks/{MKAPRRKF.js → 2TK3ETUO.js} +1 -1
  256. package/build/dist/chunks/{CTMA4BTM.js → 326QMOTR.js} +1 -1
  257. package/build/dist/chunks/{ALRRW7SF.js → 3FUVMSCF.js} +1 -1
  258. package/build/dist/chunks/{YPM2UITD.js → 3GOHSYHW.js} +1 -1
  259. package/build/dist/chunks/{HTXKERNS.js → 3MLUCYCB.js} +1 -1
  260. package/build/dist/chunks/{GHPREYQK.js → 3NJ5KQ3Q.js} +1 -1
  261. package/build/dist/chunks/{WPFAEBE7.js → 3XNZUIRU.js} +1 -1
  262. package/build/dist/chunks/3XXBLNEX.js +1 -0
  263. package/build/dist/chunks/{PBQSJSZO.js → 43LI5NKJ.js} +1 -1
  264. package/build/dist/chunks/{NZXQWDGF.js → 45BRW2ZF.js} +1 -1
  265. package/build/dist/chunks/{QVYCJ6WV.js → 46KWRAYK.js} +1 -1
  266. package/build/dist/chunks/{UHRCM7AG.js → 4HG6FRVH.js} +1 -1
  267. package/build/dist/chunks/{TBCSZDAF.js → 4MXM6Q4W.js} +1 -1
  268. package/build/dist/chunks/{ZCOFMGPS.js → 4PY3UFNR.js} +1 -1
  269. package/build/dist/chunks/{WIVYKLQM.js → 52ELWNXJ.js} +1 -1
  270. package/build/dist/chunks/{F3BSEE52.js → 553UE2ZQ.js} +1 -1
  271. package/build/dist/chunks/{S2TAJHHK.js → 57MEFFCU.js} +1 -1
  272. package/build/dist/chunks/{ENX72ARB.js → 5APS4T2D.js} +1 -1
  273. package/build/dist/chunks/{UA4O226F.js → 5SMVQCAP.js} +1 -1
  274. package/build/dist/chunks/{6PY3IRDS.js → 64GOINYS.js} +1 -1
  275. package/build/dist/chunks/{5ZLOCQA4.js → 66F5ZH34.js} +1 -1
  276. package/build/dist/chunks/{HVM2EEXB.js → 6B3VVISQ.js} +1 -1
  277. package/build/dist/chunks/{E6RRXNV2.js → 6D5DJA5B.js} +1 -1
  278. package/build/dist/chunks/{XDZRO5JQ.js → 6I4NTKB2.js} +1 -1
  279. package/build/dist/chunks/{MFCPL6LF.js → 6OGDTEGH.js} +1 -1
  280. package/build/dist/chunks/6PBGEPUK.js +20 -0
  281. package/build/dist/chunks/{43CSMYDO.js → 6WD4HHID.js} +1 -1
  282. package/build/dist/chunks/{XJEOEMDS.js → 6WZX7C4T.js} +1 -1
  283. package/build/dist/chunks/{NA7R6J5N.js → 74Y2KDNR.js} +1 -1
  284. package/build/dist/chunks/{IKEJCBYU.js → 7WSHW7KW.js} +1 -1
  285. package/build/dist/chunks/{UPMGGK34.js → AFBEZXNV.js} +1 -1
  286. package/build/dist/chunks/{AUOXDNUO.js → AKYF5264.js} +1 -1
  287. package/build/dist/chunks/{BXHNYCH2.js → APGLZXIW.js} +1 -1
  288. package/build/dist/chunks/{7UOOIDR3.js → AVG4W3Y7.js} +1 -1
  289. package/build/dist/chunks/{Y7PRJOIK.js → B3RXD5ET.js} +1 -1
  290. package/build/dist/chunks/{JPNYUEQP.js → BBS3ODWZ.js} +1 -1
  291. package/build/dist/chunks/{I4TGMF2C.js → BJ2VGRF4.js} +1 -1
  292. package/build/dist/chunks/{WD37MEMZ.js → BTD5SMOW.js} +1 -1
  293. package/build/dist/chunks/{57JFKIMK.js → BTPXJAUX.js} +1 -1
  294. package/build/dist/chunks/{BIRMUW7Z.js → C36BFZH6.js} +1 -1
  295. package/build/dist/chunks/{ZGKVXFM5.js → C7AXJHBT.js} +1 -1
  296. package/build/dist/chunks/{5U7TCKX2.js → CBG5HARQ.js} +1 -1
  297. package/build/dist/chunks/{ET23SES4.js → CCTXCMH4.js} +1 -1
  298. package/build/dist/chunks/{5N4A5XAW.js → CHXBOXOD.js} +1 -1
  299. package/build/dist/chunks/D3YLXQPW.js +1 -0
  300. package/build/dist/chunks/{L7OQUHM5.js → DJN3JAWB.js} +1 -1
  301. package/build/dist/chunks/{CERNEJ2F.js → DW4V5PUY.js} +1 -1
  302. package/build/dist/chunks/E3RACZUY.js +1 -0
  303. package/build/dist/chunks/{TPL4U3AQ.js → E674J2MD.js} +1 -1
  304. package/build/dist/chunks/EE64JSLY.js +1 -0
  305. package/build/dist/chunks/EJ7O75A7.js +1 -0
  306. package/build/dist/chunks/{3AXVB23N.js → ELSXLZN5.js} +1 -1
  307. package/build/dist/chunks/{IQGY5FW7.js → ER47KGRM.js} +1 -1
  308. package/build/dist/chunks/FQ6UZCM6.js +1 -0
  309. package/build/dist/chunks/{WPAF55SP.js → GEIFITAQ.js} +1 -1
  310. package/build/dist/chunks/{4ALMYJJV.js → GGSAKCND.js} +1 -1
  311. package/build/dist/chunks/{EKNSLLJK.js → GL4NCUMH.js} +1 -1
  312. package/build/dist/chunks/GNC6RXLT.js +1 -0
  313. package/build/dist/chunks/{VVA72C6O.js → GQ5GYUEH.js} +1 -1
  314. package/build/dist/chunks/{6AAARNZ3.js → GW626GG2.js} +1 -1
  315. package/build/dist/chunks/{LROVANUR.js → H2XDMFQQ.js} +1 -1
  316. package/build/dist/chunks/H43RNCX2.js +1 -0
  317. package/build/dist/chunks/{VHLINDDS.js → HAQPIBYR.js} +1 -1
  318. package/build/dist/chunks/{ZE7EU2CS.js → HCUHMCBW.js} +1 -1
  319. package/build/dist/chunks/{64WKYWZV.js → HKEMQBFA.js} +1 -1
  320. package/build/dist/chunks/{4YFVAYKR.js → HM72DH4V.js} +1 -1
  321. package/build/dist/chunks/HSCQZ66A.js +1 -0
  322. package/build/dist/chunks/{QRC4ZPDA.js → I26DMNJG.js} +1 -1
  323. package/build/dist/chunks/{S3FPF537.js → IMO3GDA5.js} +1 -1
  324. package/build/dist/chunks/{ECWGKLBW.js → INOZIE55.js} +1 -1
  325. package/build/dist/chunks/{BQICZFLR.js → IOYRL6AY.js} +1 -1
  326. package/build/dist/chunks/IX3GZMTM.js +1 -0
  327. package/build/dist/chunks/IY7BXLT4.js +1 -0
  328. package/build/dist/chunks/{NYNJITCM.js → J2OT4KAH.js} +1 -1
  329. package/build/dist/chunks/{Y7RPSDD2.js → JKD2B6OX.js} +1 -1
  330. package/build/dist/chunks/{PSVOVZH7.js → JUZ5JU6D.js} +5 -5
  331. package/build/dist/chunks/{YEXUSRIZ.js → JVLLVNF2.js} +1 -1
  332. package/build/dist/chunks/{SSIENQVU.js → K3RDPI5J.js} +1 -1
  333. package/build/dist/chunks/{PADWZX7J.js → K4DHHQBI.js} +1 -1
  334. package/build/dist/chunks/KIFSRO5K.js +1 -0
  335. package/build/dist/chunks/{NB3LYS3G.js → KIFZ5ZSK.js} +1 -1
  336. package/build/dist/chunks/{QSN6Y2K6.js → KPCY5V35.js} +1 -1
  337. package/build/dist/chunks/{3ESNHZT5.js → L4N2RSK2.js} +1 -1
  338. package/build/dist/chunks/{EYFBVQ46.js → L5BLHY34.js} +1 -1
  339. package/build/dist/chunks/{E6UU7DL2.js → LSXUAHOE.js} +1 -1
  340. package/build/dist/chunks/{BNG2IWZL.js → M37654RL.js} +1 -1
  341. package/build/dist/chunks/{XFKVU46U.js → MJ6WEWMI.js} +1 -1
  342. package/build/dist/chunks/{47YN4OUI.js → MR5L7V6Z.js} +1 -1
  343. package/build/dist/chunks/{DVVFT42J.js → MRMR4QHA.js} +1 -1
  344. package/build/dist/chunks/{WWHCEMNB.js → N4Q6GN65.js} +1 -1
  345. package/build/dist/chunks/{S5WICHIS.js → NAZPDRIF.js} +1 -1
  346. package/build/dist/chunks/{MKBNLGDD.js → NDCLTVIU.js} +1 -1
  347. package/build/dist/chunks/{5WUKOQIJ.js → NEEZBJBC.js} +1 -1
  348. package/build/dist/chunks/{HSFOWJ3Z.js → NKZKKCK2.js} +1 -1
  349. package/build/dist/chunks/{5KUWLUPM.js → NWNYJ26T.js} +1 -1
  350. package/build/dist/chunks/{KBXU7U6Q.js → O7HCEPQY.js} +1 -1
  351. package/build/dist/chunks/{LDT3QTSY.js → OJ4WJUPP.js} +1 -1
  352. package/build/dist/chunks/{QJFXLYZG.js → OJPG45AC.js} +1 -1
  353. package/build/dist/chunks/{5MQ5KSSV.js → OKUO3BVM.js} +1 -1
  354. package/build/dist/chunks/OTXSKFUD.js +1 -0
  355. package/build/dist/chunks/{4TQQH7N6.js → P3S4BR5G.js} +1 -1
  356. package/build/dist/chunks/P56RZC2M.js +1 -0
  357. package/build/dist/chunks/{BK23XJXE.js → P5PYFK7L.js} +1 -1
  358. package/build/dist/chunks/{ZYH4B2GR.js → P7I62KFR.js} +1 -1
  359. package/build/dist/chunks/{SQL6HD5E.js → PK66GCDT.js} +1 -1
  360. package/build/dist/chunks/{6FTYNYGF.js → PSBQWDYI.js} +1 -1
  361. package/build/dist/chunks/{W76QC2AW.js → PV5FDT6O.js} +1 -1
  362. package/build/dist/chunks/{42DQTKEO.js → PXT5YTWU.js} +1 -1
  363. package/build/dist/chunks/{IMRXZ7JB.js → Q42YI3EP.js} +1 -1
  364. package/build/dist/chunks/{ZBFKKUNP.js → QA3UHEO3.js} +1 -1
  365. package/build/dist/chunks/QC3HH5UD.js +3 -0
  366. package/build/dist/chunks/{MQYOG66Q.js → QF52OIBS.js} +1 -1
  367. package/build/dist/chunks/{7WQEPZJY.js → QO3KCJMP.js} +1 -1
  368. package/build/dist/chunks/QQECG3WP.js +1 -0
  369. package/build/dist/chunks/QSHCBASA.js +1 -0
  370. package/build/dist/chunks/{RVO3QK2B.js → QU5XKRGK.js} +1 -1
  371. package/build/dist/chunks/{GVPX5XCL.js → QZZ4O34L.js} +1 -1
  372. package/build/dist/chunks/{A6YQ5H24.js → RQ4GHJXE.js} +1 -1
  373. package/build/dist/chunks/{3WXK2FUA.js → RUC7KH7A.js} +1 -1
  374. package/build/dist/chunks/{MBTARLZQ.js → RUX3RY7Y.js} +1 -1
  375. package/build/dist/chunks/{3VAJW6TQ.js → RVDUSNWW.js} +1 -1
  376. package/build/dist/chunks/{SDHPFXRM.js → S47VUTHM.js} +1 -1
  377. package/build/dist/chunks/{OTIXQZ3X.js → S7IFAQPG.js} +1 -1
  378. package/build/dist/chunks/{WMNRP3YH.js → SIYUNOLI.js} +1 -1
  379. package/build/dist/chunks/{TNKVRVTH.js → SJJR4ZBZ.js} +1 -1
  380. package/build/dist/chunks/{UFVPMWPJ.js → SMYWWIE6.js} +1 -1
  381. package/build/dist/chunks/{Z4SRGAVL.js → SPJCSEKP.js} +1 -1
  382. package/build/dist/chunks/{IQIWASRD.js → SSHCD6RZ.js} +1 -1
  383. package/build/dist/chunks/{SGEZIYJW.js → T2WHOZXM.js} +1 -1
  384. package/build/dist/chunks/{WOEKXQAH.js → T3AJSQYT.js} +1 -1
  385. package/build/dist/chunks/{SKMPKAZI.js → TAEZTP4L.js} +1 -1
  386. package/build/dist/chunks/{E3UBHTJO.js → TEJ7W534.js} +1 -1
  387. package/build/dist/chunks/{AWXJV2YH.js → TFDPEAVZ.js} +1 -1
  388. package/build/dist/chunks/{MGPHD4VV.js → TM2XCRU7.js} +1 -1
  389. package/build/dist/chunks/{UOGHQLQX.js → TMVO2DAK.js} +1 -1
  390. package/build/dist/chunks/{MXW2TP5P.js → TVWMTMEF.js} +1 -1
  391. package/build/dist/chunks/{GRIGSPD4.js → TX2EOIRS.js} +1 -1
  392. package/build/dist/chunks/{VV2HEIFI.js → U5PMVP56.js} +1 -1
  393. package/build/dist/chunks/{K72EYD6R.js → U67J4BCH.js} +1 -1
  394. package/build/dist/chunks/{MDDHG34Y.js → UHTRW2R6.js} +1 -1
  395. package/build/dist/chunks/{PQC5635W.js → UHVSINR5.js} +1 -1
  396. package/build/dist/chunks/{MOPETB64.js → UMIZMJWW.js} +1 -1
  397. package/build/dist/chunks/{F26FK47J.js → UNJJRQIU.js} +1 -1
  398. package/build/dist/chunks/V74F6IDY.js +1 -0
  399. package/build/dist/chunks/{MYFAKCQI.js → VEQBHI6O.js} +1 -1
  400. package/build/dist/chunks/VHV6WQ5F.js +1 -0
  401. package/build/dist/chunks/{EOQYLFXA.js → VJS4DHQQ.js} +1 -1
  402. package/build/dist/chunks/{AG67Z3SC.js → VOMGT5SG.js} +1 -1
  403. package/build/dist/chunks/{D6ZJPNK7.js → VY7XRHZQ.js} +1 -1
  404. package/build/dist/chunks/{W2OJ57ZO.js → VYAJXLND.js} +1 -1
  405. package/build/dist/chunks/{LVLVP5KQ.js → VYN2NRAP.js} +1 -1
  406. package/build/dist/chunks/{MDV7GECM.js → VYYSL557.js} +1 -1
  407. package/build/dist/chunks/{KA7BPBCV.js → W2BYU5JQ.js} +1 -1
  408. package/build/dist/chunks/W6BS3T7S.js +1 -0
  409. package/build/dist/chunks/WCNHZYQQ.js +1 -0
  410. package/build/dist/chunks/{ALPYEM7B.js → WDK6VOG4.js} +1 -1
  411. package/build/dist/chunks/{K22EXPWN.js → WIRBCS4W.js} +1 -1
  412. package/build/dist/chunks/{YRXT3HTW.js → WLMWWEP7.js} +1 -1
  413. package/build/dist/chunks/{NDW5DAFL.js → WP6RHXGN.js} +1 -1
  414. package/build/dist/chunks/{PLZKXQ76.js → WTXC3XKW.js} +1 -1
  415. package/build/dist/chunks/{WGL46F3S.js → WU7XIAXB.js} +1 -1
  416. package/build/dist/chunks/{5OKJEGBH.js → WV3A3OUU.js} +1 -1
  417. package/build/dist/chunks/{4ISR2U72.js → X2KFXCVD.js} +1 -1
  418. package/build/dist/chunks/{RPNAFUM5.js → X3BYCOWS.js} +1 -1
  419. package/build/dist/chunks/{6L5KTE6Y.js → X3PQMS4N.js} +1 -1
  420. package/build/dist/chunks/{RNC463IM.js → XBE3B6Y2.js} +1 -1
  421. package/build/dist/chunks/XLOYBLFI.js +1 -0
  422. package/build/dist/chunks/{2ZUP7ZEV.js → XR7VK24E.js} +1 -1
  423. package/build/dist/chunks/{ZSQOMSOC.js → Y25EXZCO.js} +1 -1
  424. package/build/dist/chunks/{TJWVY4VO.js → YCZPSMZ5.js} +1 -1
  425. package/build/dist/chunks/{JZXYLHI7.js → YDNTY67T.js} +1 -1
  426. package/build/dist/chunks/{2DUCTO5C.js → YN56C7PN.js} +1 -1
  427. package/build/dist/chunks/{G7XSFUDL.js → YWRDZQI6.js} +1 -1
  428. package/build/dist/chunks/{DP2NIYBP.js → YXTSWRV5.js} +1 -1
  429. package/build/dist/chunks/{I6KUORFT.js → Z43BTOTE.js} +1 -1
  430. package/build/dist/chunks/{PWH464CJ.js → Z4FZVJ5Z.js} +1 -1
  431. package/build/dist/chunks/{YAJYDD6C.js → ZMFRMWHR.js} +1 -1
  432. package/build/dist/chunks/{OFI3Y55L.js → ZQAFFWDK.js} +1 -1
  433. package/build/dist/chunks/{TBIVTEP5.js → ZSN4IRI5.js} +1 -1
  434. package/build/dist/chunks/{ZET37EIG.js → ZV5HIQXC.js} +1 -1
  435. package/package.json +1 -1
  436. package/build/dist/chunks/24CQ2SPB.js +0 -1
  437. package/build/dist/chunks/2OJAOVMG.js +0 -1
  438. package/build/dist/chunks/65EQECL3.js +0 -1
  439. package/build/dist/chunks/6YYCGUCU.js +0 -1
  440. package/build/dist/chunks/EU3OAJU2.js +0 -1
  441. package/build/dist/chunks/H4NYYJ3Z.js +0 -1
  442. package/build/dist/chunks/JG27HM4P.js +0 -1
  443. package/build/dist/chunks/L6D26AMO.js +0 -1
  444. package/build/dist/chunks/O6L4BJP4.js +0 -1
  445. package/build/dist/chunks/SUFA2GKR.js +0 -1
  446. package/build/dist/chunks/UP7FBDMJ.js +0 -1
  447. package/build/dist/chunks/YHRUAQQK.js +0 -1
  448. package/build/dist/chunks/ZCUXM52B.js +0 -1
@@ -1 +1 @@
1
- import{a as q}from"./PBQSJSZO.js";import{a as j}from"./5ZLOCQA4.js";import{d as ne,f as te,g as v,i as oe}from"./5KUWLUPM.js";import{a as p,i as ee}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as U}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as ue,erc20Abi as V,getAddress as y,hashMessage as fe,keccak256 as pe,parseAbi as D,recoverMessageAddress as me,toHex as we,zeroAddress as _}from"viem";var g=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),A=y("0xf08c65564eb07d880021105489552080b08e4319"),re=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),ae=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),le=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),C={address:y(ee[p].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:p},N=D(["function acceptOffer((uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address nftCollateralContract,uint32 loanDuration,uint16 loanAdminFeeInBasisPoints,address loanERC20Denomination,address referrer) offer,(uint256 nonce,uint256 expiry,address signer,bytes signature) signature,(address revenueSharePartner,uint16 referralFeeInBasisPoints) borrowerSettings) returns (uint32)","function payBackLoan(uint32 loanId)","function getPayoffAmount(uint32 loanId) view returns (uint256)","function loanIdToLoan(uint32 loanId) view returns (uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address loanERC20Denomination,uint32 loanDuration,uint16 loanInterestRateForDurationInBasisPoints,uint16 loanAdminFeeInBasisPoints,address nftCollateralWrapper,uint64 loanStartTime,address nftCollateralContract,address borrower)","function loanRepaidOrLiquidated(uint32 loanId) view returns (bool)","function getWhetherNonceHasBeenUsedForUser(address user,uint256 nonce) view returns (bool)","function hub() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)"]),J=D(["function ownerOf(uint256 tokenId) view returns (address)","function approve(address spender,uint256 tokenId)","function supportsInterface(bytes4) view returns (bool)"]),ge=D(["function getContract(bytes32) view returns (address)"]),be=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],$=n=>te(n,"Provide the documented Longbow NFT object.");function F(n,d){if(Object.keys(n).some(i=>!d.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,d=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(d))throw new o(`NFT amounts and IDs must be uint${d} decimal strings.`);return BigInt(n)}function f(n){return oe(n,"Provide an NFT contract address.",ne)}var K=n=>{if(n>8640000000000n)throw new o("NFT deadline exceeds the supported timestamp range.");return new Date(Number(n)*1e3).toISOString()};function ie(n,d,i=!0){let s=$(n),e=$(d);F(s,M),F(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:f(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:f(s.loanERC20Denomination),referrer:f(s.referrer)};if(i&&(!v(t.nftCollateralContract,A)||!v(t.loanERC20Denomination,C.address)))throw new o("NFT borrowing supports only Robinhood Punks collateral and canonical USDG.");if(i&&(t.loanPrincipalAmount===0n||t.maximumRepaymentAmount<t.loanPrincipalAmount||t.loanDuration===0||t.referrer!==_))throw new o("NFT offer principal, payoff, duration or referrer is unsupported.");if(typeof e.signature!="string"||!/^0x(?:[0-9a-f]{2}){0,4096}$/i.test(e.signature))throw new o("Provide the existing lender\u2019s bounded hexadecimal offer signature; Oak does not sign lender offers.");let r={nonce:h(e.nonce),expiry:h(e.expiry),signer:f(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function he(n){let{offer:d,signature:i}=n;return pe(ue(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[d.loanERC20Denomination,d.loanPrincipalAmount,d.maximumRepaymentAmount,d.nftCollateralContract,d.nftCollateralId,d.referrer,d.loanDuration,d.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,g,BigInt(p)]))}function se(n,d){if(n.filter(s=>s.token.chainId===p&&v(s.token.address,C.address)).reduce((s,e)=>{if(e.token.decimals!==C.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==d)throw new o("NFT preview does not match the exact principal or payoff.")}async function de(n){let d=n.clientFor(p);if(await d.getChainId()!==p)throw new o("Longbow NFT loans require chain 4663.");let i=await d.getBlock(),s=(a,w,m,u=[])=>d.readContract({address:a,abi:w,functionName:m,args:u,blockNumber:i.number}),[e,t,r,l]=await Promise.all([s(g,N,"hub"),s(re,ge,"getContract",[we("PERMITTED_NFTS",{size:32})]),s(ae,be,"getNFTWrapper",[A]),s(A,J,"supportsInterface",["0x80ac58cd"])]);if(f(e)!==re||f(t)!==ae||f(r)!==le||l!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:d,block:i,read:s}}async function G(n,d){let i=Number(h(d,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(p);if(await s.getChainId()!==p)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,E,b=[])=>s.readContract({address:T,abi:I,functionName:E,args:b,blockNumber:e.number}),[r,l,a]=await Promise.all([t(g,N,"loanIdToLoan",[i]),t(g,N,"loanRepaidOrLiquidated",[i]),t(g,N,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof l!="boolean")throw new o("Invalid NFT loan state.");let[w,m,u,c,z,,,R,S,B,O]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let L=f(c)===C.address&&f(B)===A&&f(R)===le&&f(O)!==_,x=C;if(f(c)!==C.address){let[T,I]=await Promise.all([t(f(c),V,"symbol"),t(f(c),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");x={address:f(c),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:p}}if(typeof a!="bigint"||a!==BigInt(m)||a<BigInt(w))throw new o("NFT payoff does not match the fixed loan terms.");let P=BigInt(S)+BigInt(z);return{loanId:d,loanContract:g,chainId:p,blockNumber:e.number.toString(),collection:f(B),wrapper:f(R),tokenId:String(u),borrower:f(O),currency:x,supportedForActions:L,principalAmount:String(w),payoffAmount:a.toString(),startedAt:String(S),deadline:P.toString(),deadlineUtc:K(P),status:l?"repaid_or_liquidated":e.timestamp>P?"overdue":"active",repayable:!l&&e.timestamp<=P,warning:"After the on-chain deadline repayment is rejected; the lender can permanently take this NFT. Settled state alone does not distinguish repayment from liquidation."}}async function H(n,d){let i=await n.http(`https://longbow.credit/api/nft${d}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(1e4),redirect:"error"});if(!i.ok)throw new o("Longbow NFT discovery is unavailable. Retry the read; no loan was originated.");let s=await i.json();if(!Array.isArray(s)||s.length>1e3)throw new o("Longbow NFT discovery returned an invalid or oversized list.");return s.map($)}var ve=n=>{async function d(e,t,r){if(q(t),r){if(F(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await G(n,e.loanId);if(!b.supportedForActions)throw new o("This NFT loan is read-only in Oak; its collection, currency, wrapper or obligation-receipt borrower is not qualified for repayment.");let ce=h(e.maxPayoff);if(await de(n),b.borrower!==y(t))throw new o("Only this NFT loan\u2019s borrower may repay through Oak.");if(!b.repayable)throw new o("NFT loan is settled or overdue; repayment is unavailable.");let k=BigInt(b.payoffAmount);if(k>ce)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(p).readContract({address:C.address,abi:V,functionName:"balanceOf",args:[t]})<k)throw new o(`NFT repayment needs ${k} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${k} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(C.address,g,k.toString(),p),n.unsignedTx({to:g,data:W({abi:N,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:p,description:Y})],X=await n.preview(Q,t);return se(X.changes,-k),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}F(e,["offer","lenderSignature"]);let l=ie(e.offer,e.lenderSignature),{offer:a,signature:w}=l,{client:m,block:u,read:c}=await de(n),[z,R,S,B,O]=await Promise.all([c(A,J,"ownerOf",[a.nftCollateralId]),c(g,N,"getWhetherNonceHasBeenUsedForUser",[w.signer,w.nonce]),c(g,N,"paused"),c(g,N,"maximumLoanDuration"),c(g,N,"adminFeeInBasisPoints")]);if(f(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if(R!==!1||S!==!1||w.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==O)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let L=he(l),x=!1;try{x=v(await me({message:{raw:L},signature:w.signature}),w.signer)}catch{}if(!x){let b=await m.getCode({address:w.signer,blockNumber:u.number});b&&b!=="0x"&&(x=await c(w.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[fe({raw:L}),w.signature])==="0x1626ba7e")}if(!x)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let P=u.timestamp+BigInt(a.loanDuration),T=`Borrow ${a.loanPrincipalAmount} USDG base units; total payoff ${a.maximumRepaymentAmount} USDG base units. Escrow Robinhood Punks collection ${a.nftCollateralContract}, token ID ${a.nftCollateralId}. Estimated absolute repayment deadline ${K(P)} at snapshot ${u.number}; actual deadline is the mined start plus ${a.loanDuration} seconds. Read longbow_nft_loan after mining. Late repayment is rejected and you can permanently lose this NFT. Approve only this token ID to ${g}.`,I=[n.unsignedTx({to:A,data:W({abi:J,functionName:"approve",args:[g,a.nftCollateralId]}),value:"0",chainId:p,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:g,data:W({abi:N,functionName:"acceptOffer",args:[a,w,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:p,description:T})],E=await n.preview(I,t);return se(E.changes,a.loanPrincipalAmount),{txs:I,preview:E,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(P),deadlineIsEstimate:!0}}let i=(e,t,r,l)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,w)=>{try{return await l(a,w)}catch(m){throw new o(n.plainError(m))}}});async function s(e){q(e);let t=(r,l)=>({module:"longbow",id:`4663:${g.toLowerCase()}:${r}`,chainId:p,incomplete:!0,assets:[],description:`Longbow borrower NFT loans unreadable: ${n.plainError(l)} Use longbow_nft_loans or longbow_nft_loan for a known loanId.`});try{let r=await H(n,`/loans/borrower/${y(e)}`);if(r.length>100)throw new o("NFT loan discovery exceeds 100 rows; read specific loan IDs with longbow_nft_loan.");let l=new Set,a=[];for(let[w,m]of r.entries()){let u=`unreadable-${w}`;try{if(m.loanContract!==void 0&&f(m.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(m.loanId??m.id),32).toString(),l.has(u))continue;l.add(u);let c=await G(n,u);if(c.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(c.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${g.toLowerCase()}:${u}`,chainId:p,assets:[],description:`Longbow borrower NFT loan ${u}: ${c.status}, payoff debt ${c.payoffAmount} ${c.currency.symbol} base units (token ${c.currency.address}, decimals ${c.currency.decimals}); collateral ${c.collection} token ID ${c.tokenId} is escrowed. Deadline ${c.deadlineUtc}. ${c.repayable?"Use longbow_nft_repay before the deadline.":"Repayment is unavailable; the lender can permanently take the collateral."} Indexer discovery may be incomplete; lender interests are not included.`})}catch(c){a.push(t(u,c))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{F(e,[]);let t=await H(n,"/listings");return{chainId:p,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==p)throw new o("Longbow returned a listing on another chain.");return{id:U(String(r.id)),collection:f(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:f(r.borrower??r.owner),status:U(String(r.status)),note:r.note==null?null:U(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128}},["listingId"],async e=>{if(F(e,["listingId"]),typeof e.listingId!="string"||!/^[a-zA-Z0-9_-]{1,128}$/.test(e.listingId))throw new o("Provide the listingId returned by longbow_nft_listings.");let t=await H(n,`/listings/${encodeURIComponent(e.listingId)}/offers`);return{listingId:e.listingId,offers:t.map(r=>{let l=r.raw?$(r.raw):r,a={...$(l.offer??Object.fromEntries(M.map(m=>[m,l[m]])))};for(let m of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[m];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[m]=String(u))}let w=ie(a,typeof l.signature=="object"?l.signature:{nonce:l.nonce,expiry:l.expiry,signer:l.signer??l.lender,signature:l.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...w},(m,u)=>typeof u=="bigint"||m==="loanDuration"||m==="loanAdminFeeInBasisPoints"?String(u):u))}),caveat:"These are lender-signed terms from an untrusted indexer. Accept rechecks ownership, wrapper, nonce, expiry and signature on chain. Empty offers do not imply a discovery failure."}}),i("longbow_nft_loan",{loanId:j()},["loanId"],async e=>{if(F(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return G(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"]}},[],async(e,t)=>{F(e,["role"]),q(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let l=await H(n,`/loans/${r}/${y(t)}`);if(l.length>100)throw new o("NFT loan discovery exceeds 100 rows; read a specific loanId.");return{source:"Longbow indexer IDs, freshly checked on chain. Indexer completeness is not guaranteed.",loans:await Promise.all(l.map(a=>{if(a.loanContract!==void 0&&f(a.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");return G(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",properties:Object.fromEntries(M.map(e=>[e,{type:"string"}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",properties:Object.fromEntries(Z.map(e=>[e,{type:"string"}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>d(e,t,!1)),i("longbow_nft_repay",{loanId:j(),maxPayoff:j()},["loanId","maxPayoff"],(e,t)=>d(e,t,!0))]}};async function ke(n,d,i){if(await n.getChainId()!==p||i<0n||i>=1n<<256n)throw new o("NFT cleanup requires chain 4663 and the original token ID.");let s=D(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function approve(address,uint256)"]),e=await n.readContract({address:A,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,d))return;let t=await n.readContract({address:A,abi:s,functionName:"getApproved",args:[i]});if(v(t,g))return{to:A,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:p,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{g as a,A as b,re as c,ae as d,le as e,N as f,h as g,ie as h,he as i,G as j,ve as k,ke as l};
1
+ import{a as q}from"./43LI5NKJ.js";import{a as j}from"./66F5ZH34.js";import{d as ne,f as te,g as v,i as oe}from"./NWNYJ26T.js";import{a as p,i as ee}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as U}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as ue,erc20Abi as V,getAddress as y,hashMessage as fe,keccak256 as pe,parseAbi as D,recoverMessageAddress as me,toHex as we,zeroAddress as _}from"viem";var g=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),A=y("0xf08c65564eb07d880021105489552080b08e4319"),re=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),ae=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),le=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),C={address:y(ee[p].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:p},N=D(["function acceptOffer((uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address nftCollateralContract,uint32 loanDuration,uint16 loanAdminFeeInBasisPoints,address loanERC20Denomination,address referrer) offer,(uint256 nonce,uint256 expiry,address signer,bytes signature) signature,(address revenueSharePartner,uint16 referralFeeInBasisPoints) borrowerSettings) returns (uint32)","function payBackLoan(uint32 loanId)","function getPayoffAmount(uint32 loanId) view returns (uint256)","function loanIdToLoan(uint32 loanId) view returns (uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address loanERC20Denomination,uint32 loanDuration,uint16 loanInterestRateForDurationInBasisPoints,uint16 loanAdminFeeInBasisPoints,address nftCollateralWrapper,uint64 loanStartTime,address nftCollateralContract,address borrower)","function loanRepaidOrLiquidated(uint32 loanId) view returns (bool)","function getWhetherNonceHasBeenUsedForUser(address user,uint256 nonce) view returns (bool)","function hub() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)"]),J=D(["function ownerOf(uint256 tokenId) view returns (address)","function approve(address spender,uint256 tokenId)","function supportsInterface(bytes4) view returns (bool)"]),ge=D(["function getContract(bytes32) view returns (address)"]),be=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],$=n=>te(n,"Provide the documented Longbow NFT object.");function F(n,d){if(Object.keys(n).some(i=>!d.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,d=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(d))throw new o(`NFT amounts and IDs must be uint${d} decimal strings.`);return BigInt(n)}function f(n){return oe(n,"Provide an NFT contract address.",ne)}var K=n=>{if(n>8640000000000n)throw new o("NFT deadline exceeds the supported timestamp range.");return new Date(Number(n)*1e3).toISOString()};function ie(n,d,i=!0){let s=$(n),e=$(d);F(s,M),F(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:f(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:f(s.loanERC20Denomination),referrer:f(s.referrer)};if(i&&(!v(t.nftCollateralContract,A)||!v(t.loanERC20Denomination,C.address)))throw new o("NFT borrowing supports only Robinhood Punks collateral and canonical USDG.");if(i&&(t.loanPrincipalAmount===0n||t.maximumRepaymentAmount<t.loanPrincipalAmount||t.loanDuration===0||t.referrer!==_))throw new o("NFT offer principal, payoff, duration or referrer is unsupported.");if(typeof e.signature!="string"||!/^0x(?:[0-9a-f]{2}){0,4096}$/i.test(e.signature))throw new o("Provide the existing lender\u2019s bounded hexadecimal offer signature; Oak does not sign lender offers.");let r={nonce:h(e.nonce),expiry:h(e.expiry),signer:f(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function he(n){let{offer:d,signature:i}=n;return pe(ue(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[d.loanERC20Denomination,d.loanPrincipalAmount,d.maximumRepaymentAmount,d.nftCollateralContract,d.nftCollateralId,d.referrer,d.loanDuration,d.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,g,BigInt(p)]))}function se(n,d){if(n.filter(s=>s.token.chainId===p&&v(s.token.address,C.address)).reduce((s,e)=>{if(e.token.decimals!==C.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==d)throw new o("NFT preview does not match the exact principal or payoff.")}async function de(n){let d=n.clientFor(p);if(await d.getChainId()!==p)throw new o("Longbow NFT loans require chain 4663.");let i=await d.getBlock(),s=(a,w,m,u=[])=>d.readContract({address:a,abi:w,functionName:m,args:u,blockNumber:i.number}),[e,t,r,l]=await Promise.all([s(g,N,"hub"),s(re,ge,"getContract",[we("PERMITTED_NFTS",{size:32})]),s(ae,be,"getNFTWrapper",[A]),s(A,J,"supportsInterface",["0x80ac58cd"])]);if(f(e)!==re||f(t)!==ae||f(r)!==le||l!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:d,block:i,read:s}}async function G(n,d){let i=Number(h(d,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(p);if(await s.getChainId()!==p)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,E,b=[])=>s.readContract({address:T,abi:I,functionName:E,args:b,blockNumber:e.number}),[r,l,a]=await Promise.all([t(g,N,"loanIdToLoan",[i]),t(g,N,"loanRepaidOrLiquidated",[i]),t(g,N,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof l!="boolean")throw new o("Invalid NFT loan state.");let[w,m,u,c,z,,,R,S,B,O]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let L=f(c)===C.address&&f(B)===A&&f(R)===le&&f(O)!==_,x=C;if(f(c)!==C.address){let[T,I]=await Promise.all([t(f(c),V,"symbol"),t(f(c),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");x={address:f(c),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:p}}if(typeof a!="bigint"||a!==BigInt(m)||a<BigInt(w))throw new o("NFT payoff does not match the fixed loan terms.");let P=BigInt(S)+BigInt(z);return{loanId:d,loanContract:g,chainId:p,blockNumber:e.number.toString(),collection:f(B),wrapper:f(R),tokenId:String(u),borrower:f(O),currency:x,supportedForActions:L,principalAmount:String(w),payoffAmount:a.toString(),startedAt:String(S),deadline:P.toString(),deadlineUtc:K(P),status:l?"repaid_or_liquidated":e.timestamp>P?"overdue":"active",repayable:!l&&e.timestamp<=P,warning:"After the on-chain deadline repayment is rejected; the lender can permanently take this NFT. Settled state alone does not distinguish repayment from liquidation."}}async function H(n,d){let i=await n.http(`https://longbow.credit/api/nft${d}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(1e4),redirect:"error"});if(!i.ok)throw new o("Longbow NFT discovery is unavailable. Retry the read; no loan was originated.");let s=await i.json();if(!Array.isArray(s)||s.length>1e3)throw new o("Longbow NFT discovery returned an invalid or oversized list.");return s.map($)}var ve=n=>{async function d(e,t,r){if(q(t),r){if(F(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await G(n,e.loanId);if(!b.supportedForActions)throw new o("This NFT loan is read-only in Oak; its collection, currency, wrapper or obligation-receipt borrower is not qualified for repayment.");let ce=h(e.maxPayoff);if(await de(n),b.borrower!==y(t))throw new o("Only this NFT loan\u2019s borrower may repay through Oak.");if(!b.repayable)throw new o("NFT loan is settled or overdue; repayment is unavailable.");let k=BigInt(b.payoffAmount);if(k>ce)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(p).readContract({address:C.address,abi:V,functionName:"balanceOf",args:[t]})<k)throw new o(`NFT repayment needs ${k} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${k} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(C.address,g,k.toString(),p),n.unsignedTx({to:g,data:W({abi:N,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:p,description:Y})],X=await n.preview(Q,t);return se(X.changes,-k),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}F(e,["offer","lenderSignature"]);let l=ie(e.offer,e.lenderSignature),{offer:a,signature:w}=l,{client:m,block:u,read:c}=await de(n),[z,R,S,B,O]=await Promise.all([c(A,J,"ownerOf",[a.nftCollateralId]),c(g,N,"getWhetherNonceHasBeenUsedForUser",[w.signer,w.nonce]),c(g,N,"paused"),c(g,N,"maximumLoanDuration"),c(g,N,"adminFeeInBasisPoints")]);if(f(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if(R!==!1||S!==!1||w.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==O)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let L=he(l),x=!1;try{x=v(await me({message:{raw:L},signature:w.signature}),w.signer)}catch{}if(!x){let b=await m.getCode({address:w.signer,blockNumber:u.number});b&&b!=="0x"&&(x=await c(w.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[fe({raw:L}),w.signature])==="0x1626ba7e")}if(!x)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let P=u.timestamp+BigInt(a.loanDuration),T=`Borrow ${a.loanPrincipalAmount} USDG base units; total payoff ${a.maximumRepaymentAmount} USDG base units. Escrow Robinhood Punks collection ${a.nftCollateralContract}, token ID ${a.nftCollateralId}. Estimated absolute repayment deadline ${K(P)} at snapshot ${u.number}; actual deadline is the mined start plus ${a.loanDuration} seconds. Read longbow_nft_loan after mining. Late repayment is rejected and you can permanently lose this NFT. Approve only this token ID to ${g}.`,I=[n.unsignedTx({to:A,data:W({abi:J,functionName:"approve",args:[g,a.nftCollateralId]}),value:"0",chainId:p,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:g,data:W({abi:N,functionName:"acceptOffer",args:[a,w,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:p,description:T})],E=await n.preview(I,t);return se(E.changes,a.loanPrincipalAmount),{txs:I,preview:E,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(P),deadlineIsEstimate:!0}}let i=(e,t,r,l)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,w)=>{try{return await l(a,w)}catch(m){throw new o(n.plainError(m))}}});async function s(e){q(e);let t=(r,l)=>({module:"longbow",id:`4663:${g.toLowerCase()}:${r}`,chainId:p,incomplete:!0,assets:[],description:`Longbow borrower NFT loans unreadable: ${n.plainError(l)} Use longbow_nft_loans or longbow_nft_loan for a known loanId.`});try{let r=await H(n,`/loans/borrower/${y(e)}`);if(r.length>100)throw new o("NFT loan discovery exceeds 100 rows; read specific loan IDs with longbow_nft_loan.");let l=new Set,a=[];for(let[w,m]of r.entries()){let u=`unreadable-${w}`;try{if(m.loanContract!==void 0&&f(m.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(m.loanId??m.id),32).toString(),l.has(u))continue;l.add(u);let c=await G(n,u);if(c.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(c.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${g.toLowerCase()}:${u}`,chainId:p,assets:[],description:`Longbow borrower NFT loan ${u}: ${c.status}, payoff debt ${c.payoffAmount} ${c.currency.symbol} base units (token ${c.currency.address}, decimals ${c.currency.decimals}); collateral ${c.collection} token ID ${c.tokenId} is escrowed. Deadline ${c.deadlineUtc}. ${c.repayable?"Use longbow_nft_repay before the deadline.":"Repayment is unavailable; the lender can permanently take the collateral."} Indexer discovery may be incomplete; lender interests are not included.`})}catch(c){a.push(t(u,c))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{F(e,[]);let t=await H(n,"/listings");return{chainId:p,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==p)throw new o("Longbow returned a listing on another chain.");return{id:U(String(r.id)),collection:f(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:f(r.borrower??r.owner),status:U(String(r.status)),note:r.note==null?null:U(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128}},["listingId"],async e=>{if(F(e,["listingId"]),typeof e.listingId!="string"||!/^[a-zA-Z0-9_-]{1,128}$/.test(e.listingId))throw new o("Provide the listingId returned by longbow_nft_listings.");let t=await H(n,`/listings/${encodeURIComponent(e.listingId)}/offers`);return{listingId:e.listingId,offers:t.map(r=>{let l=r.raw?$(r.raw):r,a={...$(l.offer??Object.fromEntries(M.map(m=>[m,l[m]])))};for(let m of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[m];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[m]=String(u))}let w=ie(a,typeof l.signature=="object"?l.signature:{nonce:l.nonce,expiry:l.expiry,signer:l.signer??l.lender,signature:l.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...w},(m,u)=>typeof u=="bigint"||m==="loanDuration"||m==="loanAdminFeeInBasisPoints"?String(u):u))}),caveat:"These are lender-signed terms from an untrusted indexer. Accept rechecks ownership, wrapper, nonce, expiry and signature on chain. Empty offers do not imply a discovery failure."}}),i("longbow_nft_loan",{loanId:j()},["loanId"],async e=>{if(F(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return G(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"]}},[],async(e,t)=>{F(e,["role"]),q(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let l=await H(n,`/loans/${r}/${y(t)}`);if(l.length>100)throw new o("NFT loan discovery exceeds 100 rows; read a specific loanId.");return{source:"Longbow indexer IDs, freshly checked on chain. Indexer completeness is not guaranteed.",loans:await Promise.all(l.map(a=>{if(a.loanContract!==void 0&&f(a.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");return G(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",properties:Object.fromEntries(M.map(e=>[e,{type:"string"}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",properties:Object.fromEntries(Z.map(e=>[e,{type:"string"}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>d(e,t,!1)),i("longbow_nft_repay",{loanId:j(),maxPayoff:j()},["loanId","maxPayoff"],(e,t)=>d(e,t,!0))]}};async function ke(n,d,i){if(await n.getChainId()!==p||i<0n||i>=1n<<256n)throw new o("NFT cleanup requires chain 4663 and the original token ID.");let s=D(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function approve(address,uint256)"]),e=await n.readContract({address:A,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,d))return;let t=await n.readContract({address:A,abi:s,functionName:"getApproved",args:[i]});if(v(t,g))return{to:A,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:p,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{g as a,A as b,re as c,ae as d,le as e,N as f,h as g,ie as h,he as i,G as j,ve as k,ke as l};
@@ -1 +1 @@
1
- import{e as y,g as a,i as l,l as h,m as A,n as g}from"./5KUWLUPM.js";import{a as f,i as k}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,keccak256 as I,parseAbi as _,parseAbiParameters as P}from"viem";var u=k[f].clanker,O={type:"string",pattern:"^\\d+$"},$={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R=_(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))","function tokenRewards(address) view returns ((address token,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,uint256 positionId,uint256 numPositions,uint16[] rewardBps,address[] rewardAdmins,address[] rewardRecipients))","function feePreferences(address,uint256) view returns (uint8)","function updateRewardRecipient(address,uint256,address)","function updateRewardAdmin(address,uint256,address)","function updateFeePreference(address,uint256,uint8)"]),x="Provide a valid nonzero address.";function c(e,o=!1){let r=l(e,x);return o?r:h(r,x)}function F(e){return g(e,"Amount exceeds uint256.")}function w(e,o,r){if(typeof e!="number"||!Number.isSafeInteger(e)||e<o||e>r)throw new s(`Choose an integer from ${o} to ${r}.`);return e}function H(e,o){let r=Object.keys(e).find(n=>!o.includes(n));if(r)throw new s(`Unsupported Clanker input: ${r}.`)}function T(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new s("Provide bytes32 hexadecimal data.");return e}function b(e){return A(e,"Clanker returned an invalid amount.").toString()}async function v(e,o){let r=await e.clientFor(f).readContract({address:u.factory.address,abi:R,functionName:"tokenDeploymentInfo",args:[o]});if(!Array.isArray(r)||r.length!==4||typeof r[0]!="string"||!a(r[0],o)||!Array.isArray(r[3]))throw new s("The pinned factory did not identify this Clanker token.");let n=c(r[1]),d=c(r[2]);if(![u.locker.address,u.legacy_locker_v1.address].some(t=>a(t,d))||![u.fee_static_hook_v2.address,u.fee_dynamic_hook_v2.address].some(t=>a(t,n)))throw new s("This Clanker locker or hook has not been verified by Oak.");return{hook:n,locker:d,extensions:r[3].map(t=>c(t))}}async function K(e,o){let r=await v(e,o),n=await e.clientFor(f).readContract({address:r.locker,abi:R,functionName:"tokenRewards",args:[o]});if(!y(n)||typeof n.token!="string"||!a(n.token,o)||!y(n.poolKey)||!Array.isArray(n.rewardBps)||!Array.isArray(n.rewardAdmins)||!Array.isArray(n.rewardRecipients))throw new s("Clanker returned invalid reward configuration.");let d=n.poolKey,t={currency0:c(d.currency0),currency1:c(d.currency1),fee:w(d.fee,0,16777215),tickSpacing:w(d.tickSpacing,1,32767),hooks:c(d.hooks)};if(BigInt(t.currency0)>=BigInt(t.currency1)||!a(t.hooks,r.hook)||![t.currency0,t.currency1].some(i=>a(i,o)))throw new s("Clanker returned a mismatched pool key.");let p=n.rewardBps.length;if(!p||p>7||p!==n.rewardAdmins.length||p!==n.rewardRecipients.length)throw new s("Clanker returned mismatched rewards.");let m=n.rewardBps.map(i=>w(i,1,1e4));if(m.reduce((i,C)=>i+C,0)!==1e4)throw new s("Clanker returned invalid reward splits.");return{...r,poolKey:t,poolId:I(S(P("address,address,uint24,int24,address"),[t.currency0,t.currency1,t.fee,t.tickSpacing,t.hooks])),positionId:b(n.positionId),numPositions:b(n.numPositions),rewardBps:m,rewardAdmins:n.rewardAdmins.map(i=>c(i)),rewardRecipients:n.rewardRecipients.map(i=>c(i)),pairedToken:a(t.currency0,o)?t.currency1:t.currency0}}export{u as a,O as b,$ as c,R as d,x as e,c as f,F as g,w as h,H as i,T as j,b as k,v as l,K as m};
1
+ import{e as y,g as a,i as l,l as h,m as A,n as g}from"./NWNYJ26T.js";import{a as f,i as k}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,keccak256 as I,parseAbi as _,parseAbiParameters as P}from"viem";var u=k[f].clanker,O={type:"string",pattern:"^\\d+$"},$={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R=_(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))","function tokenRewards(address) view returns ((address token,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,uint256 positionId,uint256 numPositions,uint16[] rewardBps,address[] rewardAdmins,address[] rewardRecipients))","function feePreferences(address,uint256) view returns (uint8)","function updateRewardRecipient(address,uint256,address)","function updateRewardAdmin(address,uint256,address)","function updateFeePreference(address,uint256,uint8)"]),x="Provide a valid nonzero address.";function c(e,o=!1){let r=l(e,x);return o?r:h(r,x)}function F(e){return g(e,"Amount exceeds uint256.")}function w(e,o,r){if(typeof e!="number"||!Number.isSafeInteger(e)||e<o||e>r)throw new s(`Choose an integer from ${o} to ${r}.`);return e}function H(e,o){let r=Object.keys(e).find(n=>!o.includes(n));if(r)throw new s(`Unsupported Clanker input: ${r}.`)}function T(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new s("Provide bytes32 hexadecimal data.");return e}function b(e){return A(e,"Clanker returned an invalid amount.").toString()}async function v(e,o){let r=await e.clientFor(f).readContract({address:u.factory.address,abi:R,functionName:"tokenDeploymentInfo",args:[o]});if(!Array.isArray(r)||r.length!==4||typeof r[0]!="string"||!a(r[0],o)||!Array.isArray(r[3]))throw new s("The pinned factory did not identify this Clanker token.");let n=c(r[1]),d=c(r[2]);if(![u.locker.address,u.legacy_locker_v1.address].some(t=>a(t,d))||![u.fee_static_hook_v2.address,u.fee_dynamic_hook_v2.address].some(t=>a(t,n)))throw new s("This Clanker locker or hook has not been verified by Oak.");return{hook:n,locker:d,extensions:r[3].map(t=>c(t))}}async function K(e,o){let r=await v(e,o),n=await e.clientFor(f).readContract({address:r.locker,abi:R,functionName:"tokenRewards",args:[o]});if(!y(n)||typeof n.token!="string"||!a(n.token,o)||!y(n.poolKey)||!Array.isArray(n.rewardBps)||!Array.isArray(n.rewardAdmins)||!Array.isArray(n.rewardRecipients))throw new s("Clanker returned invalid reward configuration.");let d=n.poolKey,t={currency0:c(d.currency0),currency1:c(d.currency1),fee:w(d.fee,0,16777215),tickSpacing:w(d.tickSpacing,1,32767),hooks:c(d.hooks)};if(BigInt(t.currency0)>=BigInt(t.currency1)||!a(t.hooks,r.hook)||![t.currency0,t.currency1].some(i=>a(i,o)))throw new s("Clanker returned a mismatched pool key.");let p=n.rewardBps.length;if(!p||p>7||p!==n.rewardAdmins.length||p!==n.rewardRecipients.length)throw new s("Clanker returned mismatched rewards.");let m=n.rewardBps.map(i=>w(i,1,1e4));if(m.reduce((i,C)=>i+C,0)!==1e4)throw new s("Clanker returned invalid reward splits.");return{...r,poolKey:t,poolId:I(S(P("address,address,uint24,int24,address"),[t.currency0,t.currency1,t.fee,t.tickSpacing,t.hooks])),positionId:b(n.positionId),numPositions:b(n.numPositions),rewardBps:m,rewardAdmins:n.rewardAdmins.map(i=>c(i)),rewardRecipients:n.rewardRecipients.map(i=>c(i)),pairedToken:a(t.currency0,o)?t.currency1:t.currency0}}export{u as a,O as b,$ as c,R as d,x as e,c as f,F as g,w as h,H as i,T as j,b as k,v as l,K as m};
@@ -1 +1 @@
1
- import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./WWHCEMNB.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./PBQSJSZO.js";import{a as U}from"./5ZLOCQA4.js";import{c as _,e as K,g as p,h as G}from"./5KUWLUPM.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};
1
+ import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./N4Q6GN65.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./43LI5NKJ.js";import{a as U}from"./66F5ZH34.js";import{c as _,e as K,g as p,h as G}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};
@@ -1 +1 @@
1
- import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./MYFAKCQI.js";import{a as M}from"./YHRUAQQK.js";import{e as c}from"./5KUWLUPM.js";import{a as m,i as x}from"./FWD4L3CJ.js";import{a as l}from"./XSD5NL7J.js";import{a as h}from"./JXOEJPJ4.js";import{getAddress as q,isAddress as F}from"viem";var E=`https://api-v2.pendle.finance/core/v1/${m}/markets?limit=100`,T=x[m].pendle.marketFactory.address;function f(e){if(e?.aborted)throw new l("The request was cancelled.")}var C=e=>typeof e=="number"&&Number.isFinite(e);function p(e){return typeof e=="string"&&F(e,{strict:!1})?q(e):void 0}function I(e){if(!c(e))return"a row was not an object";let t=p(e.address);if(!t)return"a row had no valid market address";let n=c(e.pt)?p(e.pt.address):void 0,r=c(e.yt)?p(e.yt.address):void 0,o=c(e.sy)?p(e.sy.address):void 0;if(!n||!r||!o)return`market ${t} had no valid PT, YT and SY addresses`;let i=typeof e.expiry=="string"?Date.parse(e.expiry):Number.NaN;if(!Number.isFinite(i)||i%1e3!==0||i<=0)return`market ${t} had no valid end date`;if(typeof e.isActive!="boolean")return`market ${t} had no active flag`;let a=c(e.pt)&&typeof e.pt.symbol=="string"?e.pt.symbol:typeof e.name=="string"?e.name:t,s=c(e.liquidity)&&C(e.liquidity.usd)&&e.liquidity.usd>=0?e.liquidity.usd:void 0;return{market:t,sy:o,pt:n,yt:r,expiry:i/1e3,active:e.isActive,label:h(a),source:"api",...C(e.impliedApy)?{impliedApy:e.impliedApy}:{},...s!==void 0?{liquidityUsd:s}:{}}}async function D(e,t={}){let n=await v(e,E,{method:"GET",headers:{"User-Agent":"oak-core/pendle",Accept:"application/json"},...t.signal?{signal:t.signal}:{}},i=>c(i)&&Array.isArray(i.results)),r=[],o=[];for(let i of n.results){let a=I(i);typeof a=="string"?o.push(a):r.push(a)}return{rows:r,dropped:o}}var L=10000000n,B=1000000n,W=52515580n,O=new WeakMap;async function U(e,t,n){f(n);let r=await e.getBlockNumber(),o=L;for(;t.next<=r;){f(n);let i=t.next,a=i+o-1n>r?r:i+o-1n;try{let s=await e.getLogs({address:T,event:S,fromBlock:i,toBlock:a});for(let u of s){let d=p(u.args.market);d&&t.found.add(d)}t.next=a+1n}catch{if(o<=B)throw new l("Oak can't list Pendle markets from the chain because the node refused the history request.");o/=2n}}return[...t.found]}function $(e,t={}){let n=O.get(e);n||(n={next:W,found:new Set,turn:Promise.resolve()},O.set(e,n));let r=n,o=r.turn.then(()=>U(e,r,t.signal));return r.turn=o.catch(()=>{}),o}async function _(e,t,n=Math.floor(Date.now()/1e3),r={}){f(r.signal);let o=await y(e,t.flatMap(s=>[{address:s,abi:b,functionName:"readTokens"},{address:s,abi:b,functionName:"expiry"}])),i=t.flatMap((s,u)=>{let d=o[u*2],k=o[u*2+1];if(!d.ok||!k.ok||!Array.isArray(d.value)||typeof k.value!="bigint")return[];let[w,g,A]=d.value.map(p),R=Number(k.value);return w&&g&&A&&Number.isSafeInteger(R)?[{market:s,sy:w,pt:g,yt:A,end:R}]:[]});f(r.signal);let a=await y(e,i.map(s=>({address:s.pt,abi:N,functionName:"symbol"})));return i.map((s,u)=>{let d=a[u];return{market:s.market,sy:s.sy,pt:s.pt,yt:s.yt,expiry:s.end,active:s.end>n,label:h(d.ok&&typeof d.value=="string"?d.value:s.market),source:"chain"}})}async function Y(e,t,n={}){return _(e,await $(e,n),t,n)}async function X(e,t,n){let[r]=await y(e,[{address:T,abi:P,functionName:"isValidMarket",args:[t]}]);if(!r.ok)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");if(r.value!==!0)throw new l("This isn't a market the Pendle factory created. Oak won't use this market.");let[o]=await _(e,[t],n);if(!o)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");return o}async function Z(e,t){f(t.signal);try{return{source:"api",...await D(e.http,t)}}catch(n){if(!t.allowChain||n instanceof M)throw n;return f(t.signal),{source:"chain",rows:await Y(e.clientFor(m),t.now,t),dropped:[]}}}export{E as a,f as b,D as c,W as d,$ as e,_ as f,Y as g,X as h,Z as i};
1
+ import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./VEQBHI6O.js";import{a as M}from"./OTXSKFUD.js";import{e as c}from"./NWNYJ26T.js";import{a as m,i as x}from"./FWD4L3CJ.js";import{a as l}from"./XSD5NL7J.js";import{a as h}from"./JXOEJPJ4.js";import{getAddress as q,isAddress as F}from"viem";var E=`https://api-v2.pendle.finance/core/v1/${m}/markets?limit=100`,T=x[m].pendle.marketFactory.address;function f(e){if(e?.aborted)throw new l("The request was cancelled.")}var C=e=>typeof e=="number"&&Number.isFinite(e);function p(e){return typeof e=="string"&&F(e,{strict:!1})?q(e):void 0}function I(e){if(!c(e))return"a row was not an object";let t=p(e.address);if(!t)return"a row had no valid market address";let n=c(e.pt)?p(e.pt.address):void 0,r=c(e.yt)?p(e.yt.address):void 0,o=c(e.sy)?p(e.sy.address):void 0;if(!n||!r||!o)return`market ${t} had no valid PT, YT and SY addresses`;let i=typeof e.expiry=="string"?Date.parse(e.expiry):Number.NaN;if(!Number.isFinite(i)||i%1e3!==0||i<=0)return`market ${t} had no valid end date`;if(typeof e.isActive!="boolean")return`market ${t} had no active flag`;let a=c(e.pt)&&typeof e.pt.symbol=="string"?e.pt.symbol:typeof e.name=="string"?e.name:t,s=c(e.liquidity)&&C(e.liquidity.usd)&&e.liquidity.usd>=0?e.liquidity.usd:void 0;return{market:t,sy:o,pt:n,yt:r,expiry:i/1e3,active:e.isActive,label:h(a),source:"api",...C(e.impliedApy)?{impliedApy:e.impliedApy}:{},...s!==void 0?{liquidityUsd:s}:{}}}async function D(e,t={}){let n=await v(e,E,{method:"GET",headers:{"User-Agent":"oak-core/pendle",Accept:"application/json"},...t.signal?{signal:t.signal}:{}},i=>c(i)&&Array.isArray(i.results)),r=[],o=[];for(let i of n.results){let a=I(i);typeof a=="string"?o.push(a):r.push(a)}return{rows:r,dropped:o}}var L=10000000n,B=1000000n,W=52515580n,O=new WeakMap;async function U(e,t,n){f(n);let r=await e.getBlockNumber(),o=L;for(;t.next<=r;){f(n);let i=t.next,a=i+o-1n>r?r:i+o-1n;try{let s=await e.getLogs({address:T,event:S,fromBlock:i,toBlock:a});for(let u of s){let d=p(u.args.market);d&&t.found.add(d)}t.next=a+1n}catch{if(o<=B)throw new l("Oak can't list Pendle markets from the chain because the node refused the history request.");o/=2n}}return[...t.found]}function $(e,t={}){let n=O.get(e);n||(n={next:W,found:new Set,turn:Promise.resolve()},O.set(e,n));let r=n,o=r.turn.then(()=>U(e,r,t.signal));return r.turn=o.catch(()=>{}),o}async function _(e,t,n=Math.floor(Date.now()/1e3),r={}){f(r.signal);let o=await y(e,t.flatMap(s=>[{address:s,abi:b,functionName:"readTokens"},{address:s,abi:b,functionName:"expiry"}])),i=t.flatMap((s,u)=>{let d=o[u*2],k=o[u*2+1];if(!d.ok||!k.ok||!Array.isArray(d.value)||typeof k.value!="bigint")return[];let[w,g,A]=d.value.map(p),R=Number(k.value);return w&&g&&A&&Number.isSafeInteger(R)?[{market:s,sy:w,pt:g,yt:A,end:R}]:[]});f(r.signal);let a=await y(e,i.map(s=>({address:s.pt,abi:N,functionName:"symbol"})));return i.map((s,u)=>{let d=a[u];return{market:s.market,sy:s.sy,pt:s.pt,yt:s.yt,expiry:s.end,active:s.end>n,label:h(d.ok&&typeof d.value=="string"?d.value:s.market),source:"chain"}})}async function Y(e,t,n={}){return _(e,await $(e,n),t,n)}async function X(e,t,n){let[r]=await y(e,[{address:T,abi:P,functionName:"isValidMarket",args:[t]}]);if(!r.ok)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");if(r.value!==!0)throw new l("This isn't a market the Pendle factory created. Oak won't use this market.");let[o]=await _(e,[t],n);if(!o)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");return o}async function Z(e,t){f(t.signal);try{return{source:"api",...await D(e.http,t)}}catch(n){if(!t.allowChain||n instanceof M)throw n;return f(t.signal),{source:"chain",rows:await Y(e.clientFor(m),t.now,t),dropped:[]}}}export{E as a,f as b,D as c,W as d,$ as e,_ as f,Y as g,X as h,Z as i};
@@ -1 +1 @@
1
- import{h as l}from"./5KUWLUPM.js";import{a as i}from"./XSD5NL7J.js";async function m(a,e,t,r){let n=`OAK_RPC_URL_${e}`;try{let s=a(e);if(await s.getChainId()!==e)throw new Error("Wrong chain");let o=await s.request({method:"debug_traceCall",params:[{from:t,to:t,data:"0x",value:"0x0",gas:"0x5208"},"latest",{tracer:"callTracer"}]});if(o?.type!=="CALL"||!l(o.to,t)||o.error)throw new Error("Invalid trace")}catch{throw new i(`Relay return path is unavailable on the ${r} for chain ${e}. Set ${n} in both the Oak server and local add-on environments to an RPC for chain ${e} that supports debug_traceCall with callTracer, then restart both and retry bridge-out. Nothing was submitted.`)}return`Relay return path checked on the ${r}: chain ${e} RPC and debug_traceCall with callTracer are available. This checks setup now; it does not guarantee future RPC availability or Relay settlement. Keep destination ETH for return gas.`}var h=500;function d(a,e){let t=BigInt(a),r=BigInt(e),n=((t-r)*10000n+t-1n)/t;return new i(`Relay order minimum is below the allowed slippage minimum. This quote needs slippageBps at least ${n} (maximum 9999), or explicit minAmountOut "${e}". Review that minimum before retrying; a new quote alone may have the same floor.`)}export{m as a,h as b,d as c};
1
+ import{h as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";async function m(a,e,t,r){let n=`OAK_RPC_URL_${e}`;try{let s=a(e);if(await s.getChainId()!==e)throw new Error("Wrong chain");let o=await s.request({method:"debug_traceCall",params:[{from:t,to:t,data:"0x",value:"0x0",gas:"0x5208"},"latest",{tracer:"callTracer"}]});if(o?.type!=="CALL"||!l(o.to,t)||o.error)throw new Error("Invalid trace")}catch{throw new i(`Relay return path is unavailable on the ${r} for chain ${e}. Set ${n} in both the Oak server and local add-on environments to an RPC for chain ${e} that supports debug_traceCall with callTracer, then restart both and retry bridge-out. Nothing was submitted.`)}return`Relay return path checked on the ${r}: chain ${e} RPC and debug_traceCall with callTracer are available. This checks setup now; it does not guarantee future RPC availability or Relay settlement. Keep destination ETH for return gas.`}var h=500;function d(a,e){let t=BigInt(a),r=BigInt(e),n=((t-r)*10000n+t-1n)/t;return new i(`Relay order minimum is below the allowed slippage minimum. This quote needs slippageBps at least ${n} (maximum 9999), or explicit minAmountOut "${e}". Review that minimum before retrying; a new quote alone may have the same floor.`)}export{m as a,h as b,d as c};
@@ -0,0 +1,3 @@
1
+ import{a as v}from"./VHV6WQ5F.js";import{$ as M,_ as P,ca as x}from"./6PBGEPUK.js";import{g as A,i as B,m as _,n as q}from"./NWNYJ26T.js";import{a as p}from"./FWD4L3CJ.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as D}from"viem";var H={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; use vault if discovery is unavailable or ambiguous."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address verified on chain on every call; required for a rebuild without HTTP."}};function R(i){return{type:"object",additionalProperties:!1,properties:{...H,amount:{type:"string",pattern:i==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$"}},required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}}function O(i){return q(i,"Borro amount must be positive and fit uint256.",{positive:!0,notString:"Borro amount must be an integer string in asset base units."})}function g(i){return _(i,"Borro returned an invalid uint256 read.")}var U=i=>i*9950n/10000n;function z(i,l,h,d,N){let S=0n,m=0n;for(let y of i.changes){let b=y.token;if(typeof y.amount!="string"||!/^-?\d+$/.test(y.amount))throw new n("Borro preview returned invalid token changes. Nothing was signed.");let e=BigInt(y.amount);g(e<0n?-e:e);let o=A(b.address,l.address)?l:A(b.address,d.address)?d:void 0;if(!o||b.chainId!==p||b.decimals!==o.decimals)throw new n("Borro preview showed an unexpected token movement. Nothing was signed.");if(o===l){if(e>0n)throw new n("Borro preview showed a reversed input movement. Nothing was signed.");S-=e}else{if(e<0n)throw new n("Borro preview showed a reversed output movement. Nothing was signed.");m+=e}}if(g(S),g(m),S!==h||m<N||m===0n)throw new n("Borro preview did not match the requested receipt. Nothing was signed.")}var J=i=>{let{client:l,context:h,wallet:d}=i;async function N(e,o,a){if(B(a,"Provide a valid wallet address."),!A(a,d))throw new n("Borro action wallet differs from the signing wallet. Nothing was signed.");if(h.network==="testnet"||await l.getChainId()!==p)throw new n("Borro requires chain 4663. Nothing was signed.");if(Object.keys(e).some(r=>!["asset","vault","amount"].includes(r)))throw new n("Unsupported Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)||/^0x/i.test(e.asset)))throw new n("Provide an asset symbol, or put the vault address in vault.");let w=e.vault===void 0?void 0:B(e.vault,"Provide a valid Borro vault address.");if(!w&&e.asset===void 0)throw new n("Provide an asset symbol or a vault address.");let t=w?await i.verifyVault(l,w,o,{wallet:d}):await i.resolveVault(l,{asset:e.asset},o,d);if(w&&!A(w,t.vault)||e.asset!==void 0&&e.asset.toUpperCase()!==t.symbol.toUpperCase())throw new n("Borro vault and asset selectors do not match. Nothing was signed.");if(B(t.vault,"Borro returned an invalid vault address."),B(t.asset,"Borro returned an invalid asset address."),t.chainId!==p||t.shareDecimals!==18||A(t.asset,t.vault)||!Number.isInteger(t.assetDecimals)||t.assetDecimals<0||t.assetDecimals>255||t.mode!==o)throw new n(x("setup-mismatch",{}));let s=await i.verifySetup(l,t,o);if(!s.ok||o==="deposit"&&(!t.assetAllowed||s.drift.length>0))throw new n(x("setup-mismatch",{}));return{...t,setup:s}}function S(e){let o=e.mode==="withdraw"&&!/^[A-Za-z0-9.$_-]{1,16}$/.test(e.symbol)?"token":e.symbol;return{asset:{address:B(e.asset,"Borro returned an invalid asset."),symbol:o,decimals:e.assetDecimals,chainId:p},share:{address:B(e.vault,"Borro returned an invalid vault."),symbol:e.vaultSymbol,decimals:18,chainId:p}}}let m=(e,o)=>h.formatAmount(e.toString(),o),y="The minimum is checked in the preview; standard ERC-4626 calldata does not enforce it on chain. Re-preview before signing; execution output can change.",b=[{name:"borro_deposit",inputSchema:R("deposit"),execute:async(e,o)=>{let a=O(e.amount),w=await N(e,"deposit",o),{asset:t,share:s}=S(w),r=g(await l.readContract({address:t.address,abi:v,functionName:"balanceOf",args:[d]}));if(a>r)throw new n("This wallet does not hold enough of that asset for the Borro deposit.");let f=g(await l.readContract({address:s.address,abi:v,functionName:"previewDeposit",args:[a]}));if(f===0n)throw new n(x("deposit-would-revert",{}));let u=U(f),c=[h.approval(t.address,s.address,a.toString(),p),h.unsignedTx({to:s.address,data:D({abi:v,functionName:"deposit",args:[a,d]}),value:"0",chainId:p,description:`Deposit ${a} asset base units into Borro vault ${s.address}.`})],$;try{$=await h.preview(c,d),z($,t,a,s,u)}catch{throw new n(x("deposit-would-revert",{}))}let T=w.deployedAt===void 0?void 0:Date.parse(w.deployedAt)/1e3,k=P({amount:m(a,t.decimals),symbol:t.symbol,kind:t.symbol==="USDG"?"usdg":"stock",shares:m(f,18),sharesMin:m(u,18),vaultSymbol:s.symbol,deployedAtSeconds:T,nowSeconds:Math.floor(Date.now()/1e3)});return{txs:c,preview:$,vault:s.address,asset:t,shareToken:s,amount:a.toString(),shares:f.toString(),shares_min:u.toString(),summary:`${k}
2
+ Base units: amount ${a} (${t.address}, decimals ${t.decimals}); shares ${f} (${s.address}, decimals 18); shares_min ${u}. ${y}`}}},{name:"borro_withdraw",inputSchema:R("withdraw"),execute:async(e,o)=>{let a=e.amount==="max",w=a?void 0:O(e.amount),t=await N(e,"withdraw",o),{asset:s,share:r}=S(t),f=g(await l.readContract({address:r.address,abi:v,functionName:"balanceOf",args:[d]}));if(f===0n)throw new n(x("no-shares",{symbol:s.symbol}));let u=a?f:g(await l.readContract({address:r.address,abi:v,functionName:"previewWithdraw",args:[w]}));if(u===0n||u>f)throw new n("This wallet does not hold enough Borro shares for that withdrawal.");let c=w??g(await l.readContract({address:r.address,abi:v,functionName:"previewRedeem",args:[u]}));if(c===0n)throw new n("Borro preview returned no assets for these shares. Nothing was signed.");let $=await i.readLiquidity(l,t).catch(()=>({kind:"unknown"})),T=$.kind!=="unknown"&&"readyBase"in $?$.readyBase:void 0,k=typeof T=="bigint"&&T>=0n&&T<1n<<256n?T:void 0;if(k!==void 0&&k<c)return{txs:[],vault:r.address,asset:s,shareToken:r,amount:c.toString(),shares:u.toString(),max_now:k.toString(),summary:x("too-little-ready",{ready:m(k,s.decimals),requested:m(c,s.decimals),maxNow:m(k,s.decimals),symbol:s.symbol})};let C=a?U(c):c,V=[h.unsignedTx({to:r.address,data:a?D({abi:v,functionName:"redeem",args:[u,d,d]}):D({abi:v,functionName:"withdraw",args:[c,d,d]}),value:"0",chainId:p,description:`Withdraw ${c} asset base units from Borro vault ${r.address} for ${u} share base units.`})],I=await h.preview(V,d);z(I,r,u,s,C);let E=M({amount:m(c,s.decimals),isAll:a,symbol:s.symbol,out:m(c,s.decimals),shares:m(u,18),vaultSymbol:r.symbol,drift:t.setup.drift.length>0});return{txs:V,preview:I,vault:r.address,asset:s,shareToken:r,amount:c.toString(),shares:u.toString(),assets_min:C.toString(),isMax:a,setup:t.setup,summary:`${E}
3
+ Base units: amount ${c} (${s.address}, decimals ${s.decimals}); shares ${u} (${r.address}, decimals 18); assets_min ${C}. ${y}`}}}];for(let e of b){let o=e.execute;e.execute=async(a,w)=>{try{return await o(a,w)}catch(t){throw new n(h.plainError(t))}}}return b};export{J as a};
@@ -1 +1 @@
1
- import{a,b as o,d as r}from"./JPNYUEQP.js";import{c as s}from"./L7OQUHM5.js";import{a as t}from"./FWD4L3CJ.js";var i=[{feature:"Ethos claim",source:"https://go.priors.trade/start-ethos.js",missing:"Public claim endpoint signs/sends the sponsor transaction remotely. No unsigned final transaction with a local preview/confirmation handoff is published. Use the owner Go Start workflow; Oak offers status and route discovery."},{feature:"x402 pay_url, paid reports, hire payments and pay_gateway",source:"https://github.com/priors-agents/priors/tree/02230282d8888e00794207ed271ee01b4ce30309/packages/x402",missing:"These hand EIP-3009 payment authorization to an external merchant/facilitator. The recipient settles remotely; no Oak-local unsigned transaction handoff is exposed. Oak discovery is supported; external payment-signature validation, recipient/invoice binding and preview semantics require a shared add-on protocol, beyond this module write scope. Gateway source also says its live 402 surface was not measured."},{feature:"Go Google/Privy account, gas sponsorship, recovery and agent001 approvals",source:"https://go.priors.trade/account",missing:"Authenticated smart-account/session and sponsored-operation APIs are not publicly specified as an unsigned plain-wallet contract. Owner uses Priors UI. Underlying pool, stock, savings and backing contracts are supported here."},{feature:"Publish merchant listings, job offers/results, board requests and signed public offers",source:"https://priors.trade/agent",missing:"Hosted MCP supplies discovery and signed board reads. A versioned authenticated mutation/withdrawal contract is not pinned from the inspected public SDK. Existing owner consent plus direct sponsor offer is supported on chain; creating external listings/messages remains an owner workflow."},{feature:"Create the X proof post",source:"https://go.priors.trade/xlink-core.js",missing:"Requires the human account owner to publish on X. Oak can set or clear the canonical proof URL as public ERC-8004 metadata, but does not publish posts or claim metadata alone verifies X ownership."}];function p(){return{tools:[{name:"priors_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(){return{chainId:t,sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309",reads:[...a],actions:[...r],localOwnerSignatures:[...o],ownerOnly:s.filter(e=>e.owner).map(e=>e.name),blocked:i.map(e=>({...e,status:"BLOCKED"})),integration:"The shared bridge/server diffs must be integrated for open reads, local signing continuations, exact calldata reconstruction, action destinations and human confirmation. New core builders fail closed in older add-ons; a core-only install does not establish end-to-end feature availability.",safety:"Every local action previews its exact unsigned transaction bundle. Approvals equal inputs or explicit finite future budgets; never unlimited. Persistent autopay and bids authorize later third-party execution within the stated budget. Token backing is collateral and provides no promised returns."}}}]}}export{i as a,p as b};
1
+ import{a,b as o,d as r}from"./BBS3ODWZ.js";import{c as s}from"./DJN3JAWB.js";import{a as t}from"./FWD4L3CJ.js";var i=[{feature:"Ethos claim",source:"https://go.priors.trade/start-ethos.js",missing:"Public claim endpoint signs/sends the sponsor transaction remotely. No unsigned final transaction with a local preview/confirmation handoff is published. Use the owner Go Start workflow; Oak offers status and route discovery."},{feature:"x402 pay_url, paid reports, hire payments and pay_gateway",source:"https://github.com/priors-agents/priors/tree/02230282d8888e00794207ed271ee01b4ce30309/packages/x402",missing:"These hand EIP-3009 payment authorization to an external merchant/facilitator. The recipient settles remotely; no Oak-local unsigned transaction handoff is exposed. Oak discovery is supported; external payment-signature validation, recipient/invoice binding and preview semantics require a shared add-on protocol, beyond this module write scope. Gateway source also says its live 402 surface was not measured."},{feature:"Go Google/Privy account, gas sponsorship, recovery and agent001 approvals",source:"https://go.priors.trade/account",missing:"Authenticated smart-account/session and sponsored-operation APIs are not publicly specified as an unsigned plain-wallet contract. Owner uses Priors UI. Underlying pool, stock, savings and backing contracts are supported here."},{feature:"Publish merchant listings, job offers/results, board requests and signed public offers",source:"https://priors.trade/agent",missing:"Hosted MCP supplies discovery and signed board reads. A versioned authenticated mutation/withdrawal contract is not pinned from the inspected public SDK. Existing owner consent plus direct sponsor offer is supported on chain; creating external listings/messages remains an owner workflow."},{feature:"Create the X proof post",source:"https://go.priors.trade/xlink-core.js",missing:"Requires the human account owner to publish on X. Oak can set or clear the canonical proof URL as public ERC-8004 metadata, but does not publish posts or claim metadata alone verifies X ownership."}];function p(){return{tools:[{name:"priors_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(){return{chainId:t,sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309",reads:[...a],actions:[...r],localOwnerSignatures:[...o],ownerOnly:s.filter(e=>e.owner).map(e=>e.name),blocked:i.map(e=>({...e,status:"BLOCKED"})),integration:"The shared bridge/server diffs must be integrated for open reads, local signing continuations, exact calldata reconstruction, action destinations and human confirmation. New core builders fail closed in older add-ons; a core-only install does not establish end-to-end feature availability.",safety:"Every local action previews its exact unsigned transaction bundle. Approvals equal inputs or explicit finite future budgets; never unlimited. Persistent autopay and bids authorize later third-party execution within the stated budget. Token backing is collateral and provides no promised returns."}}}]}}export{i as a,p as b};
@@ -1 +1 @@
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};
1
+ import{d as a}from"./WDK6VOG4.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{b as pe,c as me}from"./WV3A3OUU.js";import{a as ue}from"./SPJCSEKP.js";import{a as be}from"./43LI5NKJ.js";import{c as le}from"./VEQBHI6O.js";import{a as O}from"./66F5ZH34.js";import{c as Y,d as oe,g as I,i as fe,m as re,n as se}from"./NWNYJ26T.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 Ce,keccak256 as he,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-11-04T21:56:26.556Z",block:"106231118",routeBlock:"106231118",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",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","0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6":"0xd6f09e63327b36d3c498f8de8768bd3e4336894cd00ddb36aa9e0a1e4a4c911e"},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"},qualificationHistory:[{observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",implementationHash:"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c"}],blockHash:"0xcb0e2862c6e22ca5854fb9264995749e497eb26f05a3370202db69909b891c47"};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],X=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,z=Ce(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 K(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 Q(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,C){if(d<=0n||m<=0n||b<0n||C<0n)throw new o("The CLM price or budget is invalid.");let E=s?d*m/Be:d;if(E===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=C>e?C-e:e-C,a=E<t?E:t,r=(E-a)/2n,c=d*(C>e?a+r:r)/E;return[c,d-c]}var Ee=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:X,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||he(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,x,h,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(x)!==e.implementation||f(h)!==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),z]);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 C(e,t,a,r="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:r,chainId:S})}async function E(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=K(e.slippageBps),c=await b(a,t),[n,i,l,g,u,y,x,h]=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(x,2),ee=Me(w,a.bridge===n.address,F(h),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":Q(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=K(e.slippageBps),c=f(e.from),n=f(e.to),i=G(e.amount),l=c.toLowerCase()===ve,g=l?z: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(z),y.push(C(z,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",i.toString())));let x=i,h=i;if(g!==n){let w=await u.quote(g,n,i);x=w.out,h=Q(x,r),y.push(d.approval(g,f(w.market.router),i.toString(),S));let M={path:w.selected.path,recipient:t,amountIn:i,amountOutMinimum:h},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(C(w.market.router,R,`Swap exact input with at least ${h} 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 E(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:k,amount:x.toString()},minimumOutput:{token:k,amount:h.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=K(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,x]=ne(await i.read(a.manager,"previewDeposit",[c,n]),5);if(g>c||u>n||g+u===0n||y>g||x>u)throw new o("The CLM returned invalid deposit amounts or fees.");let h=Q(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(C(a.manager,T({abi:X,functionName:"deposit",args:[c,n,h]}),`Mint at least ${h} 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 E(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:h.toString(),usedAmounts:[g.toString(),u.toString()],fees:[y.toString(),x.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=K(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(x=>x===0n?0n:Q(x,r));if(u.every(x=>x===0n))throw new o("No positive CLM withdrawal output is available.");let y=[C(a.manager,T({abi:X,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await E(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(x,h)=>({token:await n.token(a.wants[h]),amount:x.toString()})))}})}]}};async function je(d,s,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let C=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},E=ue({clientFor:()=>b,http:fetch,quoteSwap:C,buildSwap:C,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await Ee(E).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 C(E,e,t){if(E===e)return;let a=J({abi:t,data:E}),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}),E)||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(),C(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[E,e]of d.entries()){let t=s[E];(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));C(e.data,t.data,a?X:I(t.to,q.markets.cl.router)?ce:W)}catch{b()}}}var We=d=>({tools:Ee(d).tools.slice(1)});export{De as a,we as b,X as c,ce as d,W as e,Se as f,Me as g,Ee as h,je as i,Ge as j,We as k};
@@ -0,0 +1 @@
1
+ function c(r,t){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(t,"id")}var h=new Map([]),_="find_tool",l="run_tool",a=["oak_setup","oak_identity_unlink","oak_subscribe","oak_renew","oak_redeem","send","hoodlock_feature_buy","hoodlock_feature_claim","hoodlock_referral_register","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_unfollow","heyresearch_position_context"],d={oak:["account","balances","find_token","price","quote","swap","positions","send","oak_setup","oak_subscribe","oak_renew","oak_identity_unlink","oak_redeem"],kyberswap:[],velora:[],steakhouse:["steakhouse_deposit","steakhouse_withdraw"],spark:["spark_deposit","spark_withdraw"],layerbank:["layerbank_deposit","layerbank_withdraw"],borro:["borro_deposit","borro_withdraw"],pendle:["pendle_buy","pendle_sell","pendle_redeem"],earn:["earn_options"],netnet:["netnet_deposit","netnet_withdraw"],longbow:["longbow_list","longbow_deposit","longbow_withdraw"],grove:["grove_deposit","grove_withdraw"],beefy:["beefy_list","beefy_deposit","beefy_withdraw"],pons:["pons_browse","pons_buy","pons_sell","pons_launch"],orbio:["orbio_credit_status","orbio_buy_credit"],hoodlock:["hoodlock_list_locks","hoodlock_lock","hoodlock_withdraw"],merkl:["merkl_rewards","merkl_claim"],relay:["relay_bridge_in","relay_bridge_out","relay_status"],lighter:["lighter_funding"],wormhole:[],erc8004:["erc8004_identity"],hoodag:["hoodag_resolve","hoodag_register"],heyresearch:["heyresearch_research_project","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_position_context"],priors:["priors_status","priors_lend","priors_withdraw","priors_borrow","priors_repay"],morpho:["morpho_status","morpho_supply","morpho_withdraw","morpho_supply_collateral","morpho_withdraw_collateral","morpho_borrow","morpho_repay"],uniswap:["uniswap_list_positions","uniswap_add","uniswap_remove","uniswap_collect"],hookr:["hookr_orders","hookr_create","hookr_cancel"],meridian:["meridian_browse","meridian_positions","meridian_sell","meridian_redeem"],tickerspring:["tickerspring_account","tickerspring_create","tickerspring_cancel","tickerspring_claim"],clanker:["clanker_browse","clanker_launch"],poolstrade:["poolstrade_status","poolstrade_buy","poolstrade_sell","poolstrade_launch"]};function w(r,t){let i=new Set(r),s=new Set;for(let[o,n]of Object.entries(d))for(let e of n){if(s.has(e))throw new Error(`Visible tool ${e} is listed twice.`);if(o!=="oak"&&!e.startsWith(`${o}_`))throw new Error(`Visible tool ${e} is filed under ${o}.`);if(a.includes(e)||i.has(e))s.add(e);else if(t==="mainnet")throw new Error(`Visible tool ${e} is not registered.`)}for(let o of[_,l,...a,"oak_playbook"])if(i.has(o))throw new Error(`Tool name ${o} is reserved for the add-on.`);return s}export{c as a,h as b,_ as c,l as d,a as e,d as f,w as g};
@@ -1 +1 @@
1
- import{a as x,c}from"./UHRCM7AG.js";import{a}from"./XSD5NL7J.js";import{parseAbi as M}from"viem";var b=M(["function readState(address router) view returns ((int256 totalPt,int256 totalSy,int256 totalLp,address treasury,int256 scalarRoot,uint256 expiry,uint256 lnFeeRateRoot,uint256 reserveFeePercent,uint256 lastLnImpliedRate) market)","function pyIndexCurrent() returns(uint256)","function exchangeRate() view returns(uint256)","function previewDeposit(address tokenIn,uint256 amount) view returns(uint256)","function previewRedeem(address tokenOut,uint256 amount) view returns(uint256)"]),R=10n**18n,E=31536e3,P="Pendle's price doesn't match what Oak checked on the chain. Try a smaller amount. Nothing was signed.";function n(e,t=!1){if(typeof e!="bigint"||e<(t?1n:0n)||e>=1n<<256n)throw new a("Oak could not read the Pendle price check from the chain. Nothing was signed.");return e}function d(e){return c(Number.isInteger(e)&&e>=0&&e<=77,"unreadable token decimals"),10n**BigInt(e)}function k(e){if(!Number.isFinite(e)||Math.abs(e)>40)throw new a(P);return BigInt(Math.floor(Math.exp(e)*1e18))}async function A(e,t,v,p,u,f){try{c(Number.isFinite(f)&&Math.abs(f)<=.03,"unreadable or excessive price impact"),n(p,!0),n(u,!0);let i=await e.getBlock(),s=i.number,[h,C]=await Promise.all([e.readContract({address:t.market,abi:b,functionName:"readState",args:[x],blockNumber:s}),e.simulateContract({address:t.yt,abi:b,functionName:"pyIndexCurrent",blockNumber:s}).then(o=>o.result)]),I=n(h.lastLnImpliedRate),D=n(h.lnFeeRateRoot),w=n(C,!0);c(Number.isSafeInteger(t.expiry)&&t.expiry>Number(i.timestamp),"this term has ended; use pendle_redeem");let y=(t.expiry-Number(i.timestamp))/E,g=Number(I)/1e18*y,r;if(v==="buy")r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewDeposit",args:[t.inputToken,p],blockNumber:s}),!0)*w*k(g)*d(t.ptDecimals)/(R*R*d(t.syDecimals));else{let o=p*k(-g)*d(t.syDecimals)/(w*d(t.ptDecimals));n(o,!0),r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewRedeem",args:[t.inputToken,o],blockNumber:s}),!0)}n(r,!0);let m=1-Math.exp(-Number(D)/1e18*y);c(Number.isFinite(m)&&m>=0&&m<=1,"unreadable market fee");let N=.01+m,F=u>r?u-r:r-u,l=Number(F)/Number(r);if(!Number.isFinite(l)||l>N)throw new a(P);return{estimateBase:r,relativeDifference:l,tolerance:N,blockNumber:s}}catch(i){throw i instanceof a?i:new a("Oak could not read the Pendle price check from the chain. Nothing was signed.")}}export{b as a,n as b,A as c};
1
+ import{a as x,c}from"./4HG6FRVH.js";import{a}from"./XSD5NL7J.js";import{parseAbi as M}from"viem";var b=M(["function readState(address router) view returns ((int256 totalPt,int256 totalSy,int256 totalLp,address treasury,int256 scalarRoot,uint256 expiry,uint256 lnFeeRateRoot,uint256 reserveFeePercent,uint256 lastLnImpliedRate) market)","function pyIndexCurrent() returns(uint256)","function exchangeRate() view returns(uint256)","function previewDeposit(address tokenIn,uint256 amount) view returns(uint256)","function previewRedeem(address tokenOut,uint256 amount) view returns(uint256)"]),R=10n**18n,E=31536e3,P="Pendle's price doesn't match what Oak checked on the chain. Try a smaller amount. Nothing was signed.";function n(e,t=!1){if(typeof e!="bigint"||e<(t?1n:0n)||e>=1n<<256n)throw new a("Oak could not read the Pendle price check from the chain. Nothing was signed.");return e}function d(e){return c(Number.isInteger(e)&&e>=0&&e<=77,"unreadable token decimals"),10n**BigInt(e)}function k(e){if(!Number.isFinite(e)||Math.abs(e)>40)throw new a(P);return BigInt(Math.floor(Math.exp(e)*1e18))}async function A(e,t,v,p,u,f){try{c(Number.isFinite(f)&&Math.abs(f)<=.03,"unreadable or excessive price impact"),n(p,!0),n(u,!0);let i=await e.getBlock(),s=i.number,[h,C]=await Promise.all([e.readContract({address:t.market,abi:b,functionName:"readState",args:[x],blockNumber:s}),e.simulateContract({address:t.yt,abi:b,functionName:"pyIndexCurrent",blockNumber:s}).then(o=>o.result)]),I=n(h.lastLnImpliedRate),D=n(h.lnFeeRateRoot),w=n(C,!0);c(Number.isSafeInteger(t.expiry)&&t.expiry>Number(i.timestamp),"this term has ended; use pendle_redeem");let y=(t.expiry-Number(i.timestamp))/E,g=Number(I)/1e18*y,r;if(v==="buy")r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewDeposit",args:[t.inputToken,p],blockNumber:s}),!0)*w*k(g)*d(t.ptDecimals)/(R*R*d(t.syDecimals));else{let o=p*k(-g)*d(t.syDecimals)/(w*d(t.ptDecimals));n(o,!0),r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewRedeem",args:[t.inputToken,o],blockNumber:s}),!0)}n(r,!0);let m=1-Math.exp(-Number(D)/1e18*y);c(Number.isFinite(m)&&m>=0&&m<=1,"unreadable market fee");let N=.01+m,F=u>r?u-r:r-u,l=Number(F)/Number(r);if(!Number.isFinite(l)||l>N)throw new a(P);return{estimateBase:r,relativeDifference:l,tolerance:N,blockNumber:s}}catch(i){throw i instanceof a?i:new a("Oak could not read the Pendle price check from the chain. Nothing was signed.")}}export{b as a,n as b,A as c};
@@ -1 +1 @@
1
- import{b as Y,e as Z}from"./ZSQOMSOC.js";import{a as U,b as L,c as D,d as G,e as _,f as W,g as J}from"./SGEZIYJW.js";import{d as C,e as $,v as H}from"./WPAF55SP.js";import{a as K}from"./BQICZFLR.js";import{a as S}from"./5ZLOCQA4.js";import{c as h,g as Q}from"./5KUWLUPM.js";import{a as I,i as T}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as b,encodeFunctionData as ee,encodePacked as de,erc20Abi as me,getAddress as ue,parseAbi as N,parseAbiParameters as A,zeroAddress as v}from"viem";var te=ue("0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7"),ne=ue(T[4663].ponsTrade.quoter.address),fe=N(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),le=N(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),oe=N(["function factory() view returns (address)","function quoteExactInput(bytes path,uint256 amountIn) returns (uint256,uint160[],uint32[],uint256)","function quoteExactOutput(bytes path,uint256 amountOut) returns (uint256,uint160[],uint32[],uint256)"]),F="(address intermediateCurrency,uint24 fee,int24 tickSpacing,address hooks,bytes hookData)",M="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",re=N([`function quoteExactInput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactOutput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactInputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`,`function quoteExactOutputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`]),ye=A(`(address exactCurrency,${F}[] path,uint256[] minHopPriceX36,uint128 amount,uint128 limit)`);function he(u,t,r,d){let a=[],e=d?r:t,i=new Set([e]);for(let n of d?[...u].reverse():u){let s=n.currency0===e?n.currency1:n.currency1===e?n.currency0:void 0;if(!s||i.has(s))throw new o("V4 poolKeys must form a continuous route without repeated currencies.");a.push({intermediateCurrency:s,fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks,hookData:"0x"}),e=s,i.add(e)}if(e!==(d?t:r))throw new o("V4 route does not end at the requested currency.");return a}var xe=A(`(${M} poolKey,bool zeroForOne,uint128 amount,uint128 limit,uint256 minHopPriceX36,bytes hookData)`),be=A("address recipient,uint256 amount,uint256 limit,bytes path,bool payerIsUser,uint256[] minHopPriceX36"),we=A("address recipient,uint256 amount,uint256 limit,address[] path,bool payerIsUser,uint256[] minHopPriceX36"),ie=A("address,uint256"),ve=A("bytes,bytes[]");function Ae(u,t,r){let d=r?[...u].reverse():u,a=r?[...t].reverse():t,e=d[0];return a.forEach((i,n)=>{e=`${e}${de(["uint24","address"],[i,d[n+1]]).slice(2)}`}),e}var ae={version:{type:"string",enum:["v2","v3","v4"]},tokenIn:h,tokenOut:h,path:{type:"array",minItems:2,maxItems:6,items:h},fees:{type:"array",items:{type:"integer",minimum:0,maximum:1e6}},poolKeys:{type:"array",minItems:1,maxItems:5,items:{type:"object",required:["currency0","currency1","fee","tickSpacing","hooks"],properties:{currency0:h,currency1:h,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:h},additionalProperties:!1}},poolKey:{type:"object",properties:{currency0:h,currency1:h,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:h},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},amountIn:S(),amountOut:S(),minAmountOut:S(),maxAmountIn:S(),slippageBps:{type:"integer",minimum:0,maximum:9999}};async function ke(u,t,r,d=!1){J(t,Object.keys(ae));let a=t.version;if(!["v2","v3","v4"].includes(String(a)))throw new o("Provide version v2, v3 or v4.");let e=t.amountOut!==void 0;if(t.amountIn!==void 0===e)throw new o("Provide exactly one of amountIn or amountOut.");if(e&&t.minAmountOut!==void 0||!e&&t.maxAmountIn!==void 0)throw new o("Use maxAmountIn for exact output, minAmountOut for exact input.");let i=U(e?t.amountOut:t.amountIn,e?"amountOut":"amountIn",a==="v4"?128:160),n=D(t.tokenIn),s=D(t.tokenOut);if(n===s)throw new o("Swap requires different input and output currencies.");let w=u.clientFor(I),m=await w.getBlock(),z=G(t.slippageBps),g,f,q,k,x,p,R;if(a==="v4"){if(t.path!==void 0||t.fees!==void 0)throw new o("V4 uses poolKey or poolKeys; omit path and fees.");if(t.poolKey===void 0==(t.poolKeys===void 0))throw new o("Provide poolKey or poolKeys, not both.");if(t.poolKeys!==void 0){if(!Array.isArray(t.poolKeys)||t.poolKeys.length<1||t.poolKeys.length>5)throw new o("Provide 1 to 5 v4 poolKeys.");let c=t.poolKeys.map(P=>H(P));g=he(c,n,s,e),f=(await w.simulateContract({address:ne,abi:re,functionName:e?"quoteExactOutput":"quoteExactInput",args:[{exactCurrency:e?s:n,path:g,exactAmount:i}],account:r,gas:K,blockNumber:m.number})).result[0]}else{if(x=H(t.poolKey),![x.currency0,x.currency1].includes(n)||![x.currency0,x.currency1].includes(s))throw new o("PoolKey currencies differ from the requested swap.");f=(await w.simulateContract({address:ne,abi:re,functionName:e?"quoteExactOutputSingle":"quoteExactInputSingle",args:[{poolKey:x,zeroForOne:n===x.currency0,exactAmount:i,hookData:"0x"}],account:r,gas:K,blockNumber:m.number})).result[0]}k="0x10"}else{if(t.poolKey!==void 0||t.poolKeys!==void 0||n===v||s===v)throw new o("V2/v3 routes use ERC-20 tokens; wrap ETH to WETH first.");if(p=Array.isArray(t.path)?t.path.map(L):[n,s],p.length<2||p.length>6||p[0]!==n||p.at(-1)!==s||new Set(p).size!==p.length||p.includes(v))throw new o("Path must contain 2 to 6 distinct ERC-20 tokens in input-to-output order.");if(a==="v2"){if(t.fees!==void 0)throw new o("V2 fees are fixed by the pair; omit fees.");let c=await w.readContract({address:Y,abi:Z,functionName:e?"getAmountsIn":"getAmountsOut",args:[i,p],blockNumber:m.number});f=e?c[0]:c.at(-1),k=e?"0x09":"0x08"}else{let c=t.fees;if(!Array.isArray(c)||c.length!==p.length-1||c.some(P=>typeof P!="number"||!Number.isInteger(P)||P<0||P>1e6))throw new o("Provide one integer v3 fee in pips per path hop.");if(!Q(await w.readContract({address:te,abi:oe,functionName:"factory",blockNumber:m.number}),T[4663].uniswap.v3_factory.address))throw new o("V3 quoter is not configured for the pinned factory.");R=Ae(p,c,e),f=(await w.simulateContract({address:te,abi:oe,functionName:e?"quoteExactOutput":"quoteExactInput",args:[R,i],account:r,gas:K,blockNumber:m.number})).result[0],k=e?"0x01":"0x00"}}if(f<=0n)throw new o("No positive Uniswap quote is available.");let V=e?t.maxAmountIn:t.minAmountOut;if(!d&&V===void 0)throw new o(`Provide ${e?"maxAmountIn":"minAmountOut"} from uniswap_quote to confirm the trade bound.`);let l=V===void 0?e?(f*BigInt(1e4+z)+9999n)/10000n:f*BigInt(1e4-z)/10000n:U(V,e?"maxAmountIn":"minAmountOut",a==="v4"?128:160);if(l<=0n||(e?l<f:l>f))throw new o("The fresh quote does not satisfy the confirmed swap bound.");let y=e?l:i;if(y>=1n<<160n||a==="v4"&&(y>=1n<<128n||l>=1n<<128n))throw new o("Swap bounds exceed the router amount range.");let[se,ce]=await Promise.all([_(u,n,m.number),_(u,s,m.number)]),j={version:a,input:{token:se,amount:(e?f:i).toString()},output:{token:ce,amount:(e?i:f).toString()},[e?"maxAmountIn":"minAmountOut"]:l.toString(),blockNumber:m.number.toString(),expiresAt:(m.timestamp+60n).toString()};if(d)return{quote:j,summary:"Read-only on-chain quote. Repeat the same route with the returned bound in uniswap_swap; execution gets a fresh quote and preview."};let O=m.timestamp+300n,E=[],X="Native ETH input; no token approvals.";if(n!==v){let c=await w.readContract({address:n,abi:me,functionName:"allowance",args:[r,C],blockNumber:m.number});c!==y&&E.push(u.approval(n,C,y.toString(),I)),X=`${c===y?"Reuse existing exact ERC-20 allowance of":"Set ERC-20 allowance to exactly"} ${y} input base units to Permit2; exact router permit.`,E.push(u.unsignedTx({to:C,data:ee({abi:le,functionName:"approve",args:[n,$,y,Number(O)]}),value:"0",chainId:I,description:`Permit exactly ${y} input base units to Universal Router until ${O}.`}))}if(a==="v4"){let c=g?b(ye,[{exactCurrency:e?s:n,path:g,minHopPriceX36:[],amount:i,limit:l}]):b(xe,[{poolKey:x,zeroForOne:n===x.currency0,amount:i,limit:l,minHopPriceX36:0n,hookData:"0x"}]);q=b(ve,[g?e?"0x090c0f":"0x070c0f":e?"0x080c0f":"0x060c0f",[c,b(ie,[n,y]),b(ie,[s,e?i:l])]])}else a==="v2"?q=b(we,[r,i,l,p,!0,[]]):q=b(be,[r,i,l,R,!0,[]]);let B=[q];return n===v&&e&&(k=`${k}04`,B.push(b(A("address,address,uint256"),[v,r,0n]))),E.push(u.unsignedTx({to:$,data:ee({abi:fe,functionName:"execute",args:[k,B,O]}),value:n===v?y.toString():"0",chainId:I,description:`Uniswap ${a} ${e?"exact output":"exact input"} swap; recipient ${r}; deadline ${O}.`})),{...await W(u,E,r,`Swap through Universal Router 2.1.2. ${X} Fixed output/input bound and five-minute on-chain deadline. Venue fees included; gas excluded.`),quote:j}}function Ne(u){return{tools:[!0,!1].map(t=>({name:t?"uniswap_quote":"uniswap_swap",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenIn","tokenOut"],properties:ae},execute:(r,d)=>ke(u,r,d,t)}))}}export{te as a,ne as b,fe as c,le as d,oe as e,re as f,ye as g,he as h,xe as i,be as j,we as k,Ae as l,ke as m,Ne as n};
1
+ import{b as Y,e as Z}from"./Y25EXZCO.js";import{a as U,b as L,c as D,d as G,e as _,f as W,g as J}from"./T2WHOZXM.js";import{d as C,e as $,v as H}from"./GEIFITAQ.js";import{a as K}from"./IOYRL6AY.js";import{a as S}from"./66F5ZH34.js";import{c as h,g as Q}from"./NWNYJ26T.js";import{a as I,i as T}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as b,encodeFunctionData as ee,encodePacked as de,erc20Abi as me,getAddress as ue,parseAbi as N,parseAbiParameters as A,zeroAddress as v}from"viem";var te=ue("0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7"),ne=ue(T[4663].ponsTrade.quoter.address),fe=N(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),le=N(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),oe=N(["function factory() view returns (address)","function quoteExactInput(bytes path,uint256 amountIn) returns (uint256,uint160[],uint32[],uint256)","function quoteExactOutput(bytes path,uint256 amountOut) returns (uint256,uint160[],uint32[],uint256)"]),F="(address intermediateCurrency,uint24 fee,int24 tickSpacing,address hooks,bytes hookData)",M="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",re=N([`function quoteExactInput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactOutput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactInputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`,`function quoteExactOutputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`]),ye=A(`(address exactCurrency,${F}[] path,uint256[] minHopPriceX36,uint128 amount,uint128 limit)`);function he(u,t,r,d){let a=[],e=d?r:t,i=new Set([e]);for(let n of d?[...u].reverse():u){let s=n.currency0===e?n.currency1:n.currency1===e?n.currency0:void 0;if(!s||i.has(s))throw new o("V4 poolKeys must form a continuous route without repeated currencies.");a.push({intermediateCurrency:s,fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks,hookData:"0x"}),e=s,i.add(e)}if(e!==(d?t:r))throw new o("V4 route does not end at the requested currency.");return a}var xe=A(`(${M} poolKey,bool zeroForOne,uint128 amount,uint128 limit,uint256 minHopPriceX36,bytes hookData)`),be=A("address recipient,uint256 amount,uint256 limit,bytes path,bool payerIsUser,uint256[] minHopPriceX36"),we=A("address recipient,uint256 amount,uint256 limit,address[] path,bool payerIsUser,uint256[] minHopPriceX36"),ie=A("address,uint256"),ve=A("bytes,bytes[]");function Ae(u,t,r){let d=r?[...u].reverse():u,a=r?[...t].reverse():t,e=d[0];return a.forEach((i,n)=>{e=`${e}${de(["uint24","address"],[i,d[n+1]]).slice(2)}`}),e}var ae={version:{type:"string",enum:["v2","v3","v4"]},tokenIn:h,tokenOut:h,path:{type:"array",minItems:2,maxItems:6,items:h},fees:{type:"array",items:{type:"integer",minimum:0,maximum:1e6}},poolKeys:{type:"array",minItems:1,maxItems:5,items:{type:"object",required:["currency0","currency1","fee","tickSpacing","hooks"],properties:{currency0:h,currency1:h,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:h},additionalProperties:!1}},poolKey:{type:"object",properties:{currency0:h,currency1:h,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:h},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},amountIn:S(),amountOut:S(),minAmountOut:S(),maxAmountIn:S(),slippageBps:{type:"integer",minimum:0,maximum:9999}};async function ke(u,t,r,d=!1){J(t,Object.keys(ae));let a=t.version;if(!["v2","v3","v4"].includes(String(a)))throw new o("Provide version v2, v3 or v4.");let e=t.amountOut!==void 0;if(t.amountIn!==void 0===e)throw new o("Provide exactly one of amountIn or amountOut.");if(e&&t.minAmountOut!==void 0||!e&&t.maxAmountIn!==void 0)throw new o("Use maxAmountIn for exact output, minAmountOut for exact input.");let i=U(e?t.amountOut:t.amountIn,e?"amountOut":"amountIn",a==="v4"?128:160),n=D(t.tokenIn),s=D(t.tokenOut);if(n===s)throw new o("Swap requires different input and output currencies.");let w=u.clientFor(I),m=await w.getBlock(),z=G(t.slippageBps),g,f,q,k,x,p,R;if(a==="v4"){if(t.path!==void 0||t.fees!==void 0)throw new o("V4 uses poolKey or poolKeys; omit path and fees.");if(t.poolKey===void 0==(t.poolKeys===void 0))throw new o("Provide poolKey or poolKeys, not both.");if(t.poolKeys!==void 0){if(!Array.isArray(t.poolKeys)||t.poolKeys.length<1||t.poolKeys.length>5)throw new o("Provide 1 to 5 v4 poolKeys.");let c=t.poolKeys.map(P=>H(P));g=he(c,n,s,e),f=(await w.simulateContract({address:ne,abi:re,functionName:e?"quoteExactOutput":"quoteExactInput",args:[{exactCurrency:e?s:n,path:g,exactAmount:i}],account:r,gas:K,blockNumber:m.number})).result[0]}else{if(x=H(t.poolKey),![x.currency0,x.currency1].includes(n)||![x.currency0,x.currency1].includes(s))throw new o("PoolKey currencies differ from the requested swap.");f=(await w.simulateContract({address:ne,abi:re,functionName:e?"quoteExactOutputSingle":"quoteExactInputSingle",args:[{poolKey:x,zeroForOne:n===x.currency0,exactAmount:i,hookData:"0x"}],account:r,gas:K,blockNumber:m.number})).result[0]}k="0x10"}else{if(t.poolKey!==void 0||t.poolKeys!==void 0||n===v||s===v)throw new o("V2/v3 routes use ERC-20 tokens; wrap ETH to WETH first.");if(p=Array.isArray(t.path)?t.path.map(L):[n,s],p.length<2||p.length>6||p[0]!==n||p.at(-1)!==s||new Set(p).size!==p.length||p.includes(v))throw new o("Path must contain 2 to 6 distinct ERC-20 tokens in input-to-output order.");if(a==="v2"){if(t.fees!==void 0)throw new o("V2 fees are fixed by the pair; omit fees.");let c=await w.readContract({address:Y,abi:Z,functionName:e?"getAmountsIn":"getAmountsOut",args:[i,p],blockNumber:m.number});f=e?c[0]:c.at(-1),k=e?"0x09":"0x08"}else{let c=t.fees;if(!Array.isArray(c)||c.length!==p.length-1||c.some(P=>typeof P!="number"||!Number.isInteger(P)||P<0||P>1e6))throw new o("Provide one integer v3 fee in pips per path hop.");if(!Q(await w.readContract({address:te,abi:oe,functionName:"factory",blockNumber:m.number}),T[4663].uniswap.v3_factory.address))throw new o("V3 quoter is not configured for the pinned factory.");R=Ae(p,c,e),f=(await w.simulateContract({address:te,abi:oe,functionName:e?"quoteExactOutput":"quoteExactInput",args:[R,i],account:r,gas:K,blockNumber:m.number})).result[0],k=e?"0x01":"0x00"}}if(f<=0n)throw new o("No positive Uniswap quote is available.");let V=e?t.maxAmountIn:t.minAmountOut;if(!d&&V===void 0)throw new o(`Provide ${e?"maxAmountIn":"minAmountOut"} from uniswap_quote to confirm the trade bound.`);let l=V===void 0?e?(f*BigInt(1e4+z)+9999n)/10000n:f*BigInt(1e4-z)/10000n:U(V,e?"maxAmountIn":"minAmountOut",a==="v4"?128:160);if(l<=0n||(e?l<f:l>f))throw new o("The fresh quote does not satisfy the confirmed swap bound.");let y=e?l:i;if(y>=1n<<160n||a==="v4"&&(y>=1n<<128n||l>=1n<<128n))throw new o("Swap bounds exceed the router amount range.");let[se,ce]=await Promise.all([_(u,n,m.number),_(u,s,m.number)]),j={version:a,input:{token:se,amount:(e?f:i).toString()},output:{token:ce,amount:(e?i:f).toString()},[e?"maxAmountIn":"minAmountOut"]:l.toString(),blockNumber:m.number.toString(),expiresAt:(m.timestamp+60n).toString()};if(d)return{quote:j,summary:"Read-only on-chain quote. Repeat the same route with the returned bound in uniswap_swap; execution gets a fresh quote and preview."};let O=m.timestamp+300n,E=[],X="Native ETH input; no token approvals.";if(n!==v){let c=await w.readContract({address:n,abi:me,functionName:"allowance",args:[r,C],blockNumber:m.number});c!==y&&E.push(u.approval(n,C,y.toString(),I)),X=`${c===y?"Reuse existing exact ERC-20 allowance of":"Set ERC-20 allowance to exactly"} ${y} input base units to Permit2; exact router permit.`,E.push(u.unsignedTx({to:C,data:ee({abi:le,functionName:"approve",args:[n,$,y,Number(O)]}),value:"0",chainId:I,description:`Permit exactly ${y} input base units to Universal Router until ${O}.`}))}if(a==="v4"){let c=g?b(ye,[{exactCurrency:e?s:n,path:g,minHopPriceX36:[],amount:i,limit:l}]):b(xe,[{poolKey:x,zeroForOne:n===x.currency0,amount:i,limit:l,minHopPriceX36:0n,hookData:"0x"}]);q=b(ve,[g?e?"0x090c0f":"0x070c0f":e?"0x080c0f":"0x060c0f",[c,b(ie,[n,y]),b(ie,[s,e?i:l])]])}else a==="v2"?q=b(we,[r,i,l,p,!0,[]]):q=b(be,[r,i,l,R,!0,[]]);let B=[q];return n===v&&e&&(k=`${k}04`,B.push(b(A("address,address,uint256"),[v,r,0n]))),E.push(u.unsignedTx({to:$,data:ee({abi:fe,functionName:"execute",args:[k,B,O]}),value:n===v?y.toString():"0",chainId:I,description:`Uniswap ${a} ${e?"exact output":"exact input"} swap; recipient ${r}; deadline ${O}.`})),{...await W(u,E,r,`Swap through Universal Router 2.1.2. ${X} Fixed output/input bound and five-minute on-chain deadline. Venue fees included; gas excluded.`),quote:j}}function Ne(u){return{tools:[!0,!1].map(t=>({name:t?"uniswap_quote":"uniswap_swap",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenIn","tokenOut"],properties:ae},execute:(r,d)=>ke(u,r,d,t)}))}}export{te as a,ne as b,fe as c,le as d,oe as e,re as f,ye as g,he as h,xe as i,be as j,we as k,Ae as l,ke as m,Ne as n};
@@ -1 +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
+ import{b as _,c as q,d as O,e as R}from"./Z4FZVJ5Z.js";import{a as N}from"./C7AXJHBT.js";import{a as E}from"./XLOYBLFI.js";import{a as I}from"./K3RDPI5J.js";import{c as M}from"./7WSHW7KW.js";import{b as G}from"./SPJCSEKP.js";import{a as y}from"./43LI5NKJ.js";import{b as x}from"./IX3GZMTM.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{q as p}from"./WWHCEMNB.js";import{b as c,e as d}from"./5KUWLUPM.js";import{a as n}from"./XSD5NL7J.js";import{b as a}from"./JXOEJPJ4.js";var f=/^(?:[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?\.)+[\p{L}]{2,}$/u,m=/^did:[a-z0-9]+:[A-Za-z0-9._%:;=@/?#-]{1,512}$/,u=/^[^\s@<>()[\]\\,;:"]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?\.[A-Za-z]{2,}$/,w=/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}:[-.%a-zA-Z0-9]{1,128}$/,l=["web","a2a","mcp","oasf"],P=["web","A2A","MCP","OASF","ENS","DID","email","agentWallet"];function s(e,r){if(typeof e!="string"||!e.trim()||e.length>2048||a(e))throw new n(`Provide a valid profile ${r}.`);return e}function h(e){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)}function z(e){if(!d(e))throw new n("Provide valid profile services.");let r=s(e.name,"service name"),t=s(e.endpoint,"service endpoint");e.version!==void 0&&s(e.version,"service version");let i=r.toLowerCase(),o=()=>{try{p(t,"Profile service endpoint")}catch{throw new n("Profile service endpoint must be an HTTPS or IPFS URI without credentials.")}};if(l.includes(i))return o();if(i==="ens"){if(!f.test(t))throw new n("An ENS service endpoint must be an ENS name such as agent.eth.");return}if(i==="did"){if(!m.test(t))throw new n("A DID service endpoint must be a DID such as did:web:agent.example.");return}if(i==="email"){if(!u.test(t))throw new n("An email service endpoint must be an email address.");return}if(i==="agentwallet"||i==="wallet"){if(!w.test(t)&&!c.test(t))throw new n("A wallet service endpoint must be a CAIP-10 account such as eip155:4663:0x\u2026 or an 0x address.");return}if(h(t)||/^(?:ipfs|https):/.test(t))return o();if(!(f.test(t)||m.test(t)||u.test(t)||w.test(t)))throw new n("Profile service endpoint must be an HTTPS or IPFS URI, an ENS name, a DID, an email address or a CAIP-10 account.")}export{P as a,z as b};
1
+ import{q as p}from"./N4Q6GN65.js";import{b as c,e as d}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{b as a}from"./JXOEJPJ4.js";var f=/^(?:[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?\.)+[\p{L}]{2,}$/u,m=/^did:[a-z0-9]+:[A-Za-z0-9._%:;=@/?#-]{1,512}$/,u=/^[^\s@<>()[\]\\,;:"]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?\.[A-Za-z]{2,}$/,w=/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}:[-.%a-zA-Z0-9]{1,128}$/,l=["web","a2a","mcp","oasf"],P=["web","A2A","MCP","OASF","ENS","DID","email","agentWallet"];function s(e,r){if(typeof e!="string"||!e.trim()||e.length>2048||a(e))throw new n(`Provide a valid profile ${r}.`);return e}function h(e){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)}function z(e){if(!d(e))throw new n("Provide valid profile services.");let r=s(e.name,"service name"),t=s(e.endpoint,"service endpoint");e.version!==void 0&&s(e.version,"service version");let i=r.toLowerCase(),o=()=>{try{p(t,"Profile service endpoint")}catch{throw new n("Profile service endpoint must be an HTTPS or IPFS URI without credentials.")}};if(l.includes(i))return o();if(i==="ens"){if(!f.test(t))throw new n("An ENS service endpoint must be an ENS name such as agent.eth.");return}if(i==="did"){if(!m.test(t))throw new n("A DID service endpoint must be a DID such as did:web:agent.example.");return}if(i==="email"){if(!u.test(t))throw new n("An email service endpoint must be an email address.");return}if(i==="agentwallet"||i==="wallet"){if(!w.test(t)&&!c.test(t))throw new n("A wallet service endpoint must be a CAIP-10 account such as eip155:4663:0x\u2026 or an 0x address.");return}if(h(t)||/^(?:ipfs|https):/.test(t))return o();if(!(f.test(t)||m.test(t)||u.test(t)||w.test(t)))throw new n("Profile service endpoint must be an HTTPS or IPFS URI, an ENS name, a DID, an email address or a CAIP-10 account.")}export{P as a,z as b};
@@ -1 +1 @@
1
- import{a as S,b as N,d as k,f as c,g as $,h as p,i as T,k as v,l as F,m as P}from"./W76QC2AW.js";import{c as u,g as h}from"./5KUWLUPM.js";import{a as g}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{encodeFunctionData as l,erc20Abi as x,parseAbi as O}from"viem";var w=O(["function admin() view returns (address)","function originalAdmin() view returns (address)","function updateAdmin(address)","function updateImage(string)","function updateMetadata(string)","function verify()","function delegate(address)","function burn(uint256)"]),j=m=>{let f=()=>m.clientFor(g),y=(t,i,n,e)=>({name:`clanker_${t}`,inputSchema:{type:"object",properties:i,required:n,additionalProperties:!1},execute:async(r,a)=>{try{return T(r,Object.keys(i)),await e(r,c(a))}catch(o){throw new d(m.plainError(o))}}}),A=async(t,i,n,e)=>{let r=[m.unsignedTx({to:t,data:i,chainId:g,value:"0",description:n})],a=await m.preview(r,e);return{txs:r,preview:a,summary:`${n} ${a.summary}`}},C=async t=>{let[i,n]=await Promise.all([f().readContract({address:t,abi:x,functionName:"symbol"}),f().readContract({address:t,abi:x,functionName:"decimals"})]);if(typeof i!="string"||!i.trim())throw new d("Clanker returned invalid metadata.");return{address:t,symbol:I(i),decimals:p(n,0,255),chainId:g}};return{tools:[y("status",{token:u},["token"],async(t,i)=>{let n=c(t.token),e=await P(m,n),r=await C(n),[a,o,b]=await Promise.all([f().readContract({address:n,abi:x,functionName:"balanceOf",args:[i]}),Promise.all(e.rewardBps.map((s,_)=>f().readContract({address:e.locker,abi:k,functionName:"feePreferences",args:[n,BigInt(_)]}))),Promise.all([n,e.pairedToken].map(async s=>({token:await C(s),amount:v(await f().readContract({address:S.fee_locker.address,abi:O(["function availableFees(address,address) view returns (uint256)"]),functionName:"availableFees",args:[i,s]}))})))]);return{...e,token:r,balance:{token:r,amount:v(a)},feePreferences:o.map(s=>p(s,0,2)),collectedFees:b,summary:"Onchain pool and connected-wallet holdings. Collected fees exclude pending LP fees. Token metadata is untrusted public text."}}),y("update_reward",{token:u,rewardIndex:{type:"integer",minimum:0,maximum:6},field:{enum:["recipient","admin","feePreference"]},recipient:u,admin:u,feePreference:{type:"integer",minimum:0,maximum:2}},["token","rewardIndex","field"],async(t,i)=>{let n=c(t.token),e=await P(m,n),r=p(t.rewardIndex,0,e.rewardAdmins.length-1);if(!h(e.rewardAdmins[r],i))throw new d("Only this reward index administrator may update its configuration.");let a=t.field;if(!["recipient","admin","feePreference"].includes(String(a)))throw new d("Choose recipient, admin or feePreference.");for(let s of["recipient","admin","feePreference"])if(t[s]!==void 0&&s!==a)throw new d(`Input ${s} does not match field ${String(a)}.`);let o=`Update Clanker reward ${r} ${String(a)} for ${n} to ${String(t[String(a)])}. Existing collected fees keep their prior recipient; transferring admin transfers future control.`,b=a==="feePreference"?l({abi:k,functionName:"updateFeePreference",args:[n,BigInt(r),p(t.feePreference,0,2)]}):l({abi:k,functionName:a==="admin"?"updateRewardAdmin":"updateRewardRecipient",args:[n,BigInt(r),c(t[String(a)])]});return A(e.locker,b,o,i)}),y("update_token",{token:u,field:{enum:["image","metadata","admin","verify","delegate","burn"]},text:{type:"string"},recipient:u,amount:N},["token","field"],async(t,i)=>{let n=c(t.token);await F(m,n);let e=t.field;if(!["image","metadata","admin","verify","delegate","burn"].includes(String(e)))throw new d("Choose a supported token update.");let r=e==="image"||e==="metadata"?"text":e==="admin"||e==="delegate"?"recipient":e==="burn"?"amount":void 0;for(let o of["text","recipient","amount"])if(t[o]!==void 0&&o!==r)throw new d(`Input ${o} does not match this token update.`);if(["image","metadata","admin","verify"].includes(String(e))){let o=await f().readContract({address:n,abi:w,functionName:e==="verify"?"originalAdmin":"admin"});if(!h(c(o),i))throw new d("The connected wallet is not the required token administrator.")}let a;if(e==="image"||e==="metadata"){if(typeof t.text!="string")throw new d("Provide public metadata text.");a=l({abi:w,functionName:e==="image"?"updateImage":"updateMetadata",args:[t.text]})}else if(e==="admin"||e==="delegate")a=l({abi:w,functionName:e==="admin"?"updateAdmin":"delegate",args:[c(t.recipient,e==="delegate")]});else if(e==="verify")a=l({abi:w,functionName:"verify"});else{let o=$(t.amount);if(!o)throw new d("Provide a positive burn amount.");a=l({abi:w,functionName:"burn",args:[o]})}return A(n,a,`Clanker token ${n}: ${String(e)} ${String(t.text??t.recipient??t.amount??"")}. Burns are irreversible; verification records original-admin approval, not an Oak safety review.`,i)})]}};export{j as a};
1
+ import{a as S,b as N,d as k,f as c,g as $,h as p,i as T,k as v,l as F,m as P}from"./PV5FDT6O.js";import{c as u,g as h}from"./NWNYJ26T.js";import{a as g}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{encodeFunctionData as l,erc20Abi as x,parseAbi as O}from"viem";var w=O(["function admin() view returns (address)","function originalAdmin() view returns (address)","function updateAdmin(address)","function updateImage(string)","function updateMetadata(string)","function verify()","function delegate(address)","function burn(uint256)"]),j=m=>{let f=()=>m.clientFor(g),y=(t,i,n,e)=>({name:`clanker_${t}`,inputSchema:{type:"object",properties:i,required:n,additionalProperties:!1},execute:async(r,a)=>{try{return T(r,Object.keys(i)),await e(r,c(a))}catch(o){throw new d(m.plainError(o))}}}),A=async(t,i,n,e)=>{let r=[m.unsignedTx({to:t,data:i,chainId:g,value:"0",description:n})],a=await m.preview(r,e);return{txs:r,preview:a,summary:`${n} ${a.summary}`}},C=async t=>{let[i,n]=await Promise.all([f().readContract({address:t,abi:x,functionName:"symbol"}),f().readContract({address:t,abi:x,functionName:"decimals"})]);if(typeof i!="string"||!i.trim())throw new d("Clanker returned invalid metadata.");return{address:t,symbol:I(i),decimals:p(n,0,255),chainId:g}};return{tools:[y("status",{token:u},["token"],async(t,i)=>{let n=c(t.token),e=await P(m,n),r=await C(n),[a,o,b]=await Promise.all([f().readContract({address:n,abi:x,functionName:"balanceOf",args:[i]}),Promise.all(e.rewardBps.map((s,_)=>f().readContract({address:e.locker,abi:k,functionName:"feePreferences",args:[n,BigInt(_)]}))),Promise.all([n,e.pairedToken].map(async s=>({token:await C(s),amount:v(await f().readContract({address:S.fee_locker.address,abi:O(["function availableFees(address,address) view returns (uint256)"]),functionName:"availableFees",args:[i,s]}))})))]);return{...e,token:r,balance:{token:r,amount:v(a)},feePreferences:o.map(s=>p(s,0,2)),collectedFees:b,summary:"Onchain pool and connected-wallet holdings. Collected fees exclude pending LP fees. Token metadata is untrusted public text."}}),y("update_reward",{token:u,rewardIndex:{type:"integer",minimum:0,maximum:6},field:{enum:["recipient","admin","feePreference"]},recipient:u,admin:u,feePreference:{type:"integer",minimum:0,maximum:2}},["token","rewardIndex","field"],async(t,i)=>{let n=c(t.token),e=await P(m,n),r=p(t.rewardIndex,0,e.rewardAdmins.length-1);if(!h(e.rewardAdmins[r],i))throw new d("Only this reward index administrator may update its configuration.");let a=t.field;if(!["recipient","admin","feePreference"].includes(String(a)))throw new d("Choose recipient, admin or feePreference.");for(let s of["recipient","admin","feePreference"])if(t[s]!==void 0&&s!==a)throw new d(`Input ${s} does not match field ${String(a)}.`);let o=`Update Clanker reward ${r} ${String(a)} for ${n} to ${String(t[String(a)])}. Existing collected fees keep their prior recipient; transferring admin transfers future control.`,b=a==="feePreference"?l({abi:k,functionName:"updateFeePreference",args:[n,BigInt(r),p(t.feePreference,0,2)]}):l({abi:k,functionName:a==="admin"?"updateRewardAdmin":"updateRewardRecipient",args:[n,BigInt(r),c(t[String(a)])]});return A(e.locker,b,o,i)}),y("update_token",{token:u,field:{enum:["image","metadata","admin","verify","delegate","burn"]},text:{type:"string"},recipient:u,amount:N},["token","field"],async(t,i)=>{let n=c(t.token);await F(m,n);let e=t.field;if(!["image","metadata","admin","verify","delegate","burn"].includes(String(e)))throw new d("Choose a supported token update.");let r=e==="image"||e==="metadata"?"text":e==="admin"||e==="delegate"?"recipient":e==="burn"?"amount":void 0;for(let o of["text","recipient","amount"])if(t[o]!==void 0&&o!==r)throw new d(`Input ${o} does not match this token update.`);if(["image","metadata","admin","verify"].includes(String(e))){let o=await f().readContract({address:n,abi:w,functionName:e==="verify"?"originalAdmin":"admin"});if(!h(c(o),i))throw new d("The connected wallet is not the required token administrator.")}let a;if(e==="image"||e==="metadata"){if(typeof t.text!="string")throw new d("Provide public metadata text.");a=l({abi:w,functionName:e==="image"?"updateImage":"updateMetadata",args:[t.text]})}else if(e==="admin"||e==="delegate")a=l({abi:w,functionName:e==="admin"?"updateAdmin":"delegate",args:[c(t.recipient,e==="delegate")]});else if(e==="verify")a=l({abi:w,functionName:"verify"});else{let o=$(t.amount);if(!o)throw new d("Provide a positive burn amount.");a=l({abi:w,functionName:"burn",args:[o]})}return A(n,a,`Clanker token ${n}: ${String(e)} ${String(t.text??t.recipient??t.amount??"")}. Burns are irreversible; verification records original-admin approval, not an Oak safety review.`,i)})]}};export{j as a};
@@ -1 +1 @@
1
- import{a as f,b as O,f as c,g as _,i as D}from"./W76QC2AW.js";import{c as i,g as C}from"./5KUWLUPM.js";import{a as m}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{encodeFunctionData as F,parseAbi as P}from"viem";var E=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],w=P(E),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},R=p=>{let h=()=>p.clientFor(m),k=async(e,n,t)=>({txs:e,preview:await p.preview(e,n),summary:t}),y=(e,n,t,r)=>p.unsignedTx({to:e,chainId:m,data:F({abi:w,functionName:n,args:t}),value:"0",description:r}),$={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"]},contract:{enum:["factory","locker","fee_locker"]},target:i,hook:i,token:i,recipient:i,enabled:{type:"boolean"}},b=(e,n,t,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:n,required:t,additionalProperties:!1},execute:async(o,s)=>{try{return D(o,Object.keys(n)),await r(o,c(s))}catch(d){throw new a(p.plainError(d))}}});return{tools:[b("protocol_admin",$,["operation"],async(e,n)=>{let t=String(e.operation),r=t==="transferOwnership"||t==="renounceOwnership";if(!r&&!Object.hasOwn(g,t))throw new a("Choose a supported Clanker protocol operation.");let o=r?void 0:g[t],s=o?.contract??e.contract;if(s!=="factory"&&s!=="locker"&&s!=="fee_locker")throw new a("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==s)throw new a("This operation targets a different pinned contract.");let d=o?.fields??(t==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new a(`Input ${l} does not match this protocol operation.`);let u=f[s].address,A=c(await h().readContract({address:u,abi:w,functionName:"owner"}),!0);if(!C(A,n)&&(o?.admin&&await h().readContract({address:u,abi:w,functionName:"admins",args:[n]}))!==!0)throw new a("The connected wallet lacks the required Clanker protocol owner/admin role.");let T=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new a("Provide enabled as boolean.");return e.enabled}),v=`Clanker protocol ${s}: ${t} ${JSON.stringify(T)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,t,T,v)],n,v)}),b("store_fees",{token:i,recipient:i,amount:O},["token","recipient","amount"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=_(e.amount);if(!o)throw new a("Provide a positive fee deposit amount.");if(await h().readContract({address:f.fee_locker.address,abi:w,functionName:"allowedDepositors",args:[n]})!==!0)throw new a("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${o} base units of token ${t} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(t,f.fee_locker.address,o.toString(),m),y(f.fee_locker.address,"storeFees",[r,t,o],d)];return k(u,n,d)}),b("claim_for",{token:i,recipient:i},["token","recipient"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=`Permissionlessly claim already-collected Clanker ${t} fees for ${r}; all receipts go to that fee owner, while ${n} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,t],o)],n,o)})]}};export{R as a};
1
+ import{a as f,b as O,f as c,g as _,i as D}from"./PV5FDT6O.js";import{c as i,g as C}from"./NWNYJ26T.js";import{a as m}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{encodeFunctionData as F,parseAbi as P}from"viem";var E=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],w=P(E),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},R=p=>{let h=()=>p.clientFor(m),k=async(e,n,t)=>({txs:e,preview:await p.preview(e,n),summary:t}),y=(e,n,t,r)=>p.unsignedTx({to:e,chainId:m,data:F({abi:w,functionName:n,args:t}),value:"0",description:r}),$={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"]},contract:{enum:["factory","locker","fee_locker"]},target:i,hook:i,token:i,recipient:i,enabled:{type:"boolean"}},b=(e,n,t,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:n,required:t,additionalProperties:!1},execute:async(o,s)=>{try{return D(o,Object.keys(n)),await r(o,c(s))}catch(d){throw new a(p.plainError(d))}}});return{tools:[b("protocol_admin",$,["operation"],async(e,n)=>{let t=String(e.operation),r=t==="transferOwnership"||t==="renounceOwnership";if(!r&&!Object.hasOwn(g,t))throw new a("Choose a supported Clanker protocol operation.");let o=r?void 0:g[t],s=o?.contract??e.contract;if(s!=="factory"&&s!=="locker"&&s!=="fee_locker")throw new a("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==s)throw new a("This operation targets a different pinned contract.");let d=o?.fields??(t==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new a(`Input ${l} does not match this protocol operation.`);let u=f[s].address,A=c(await h().readContract({address:u,abi:w,functionName:"owner"}),!0);if(!C(A,n)&&(o?.admin&&await h().readContract({address:u,abi:w,functionName:"admins",args:[n]}))!==!0)throw new a("The connected wallet lacks the required Clanker protocol owner/admin role.");let T=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new a("Provide enabled as boolean.");return e.enabled}),v=`Clanker protocol ${s}: ${t} ${JSON.stringify(T)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,t,T,v)],n,v)}),b("store_fees",{token:i,recipient:i,amount:O},["token","recipient","amount"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=_(e.amount);if(!o)throw new a("Provide a positive fee deposit amount.");if(await h().readContract({address:f.fee_locker.address,abi:w,functionName:"allowedDepositors",args:[n]})!==!0)throw new a("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${o} base units of token ${t} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(t,f.fee_locker.address,o.toString(),m),y(f.fee_locker.address,"storeFees",[r,t,o],d)];return k(u,n,d)}),b("claim_for",{token:i,recipient:i},["token","recipient"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=`Permissionlessly claim already-collected Clanker ${t} fees for ${r}; all receipts go to that fee owner, while ${n} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,t],o)],n,o)})]}};export{R as a};
@@ -1 +1 @@
1
- import{b as T}from"./WIVYKLQM.js";import{c as A}from"./DVVFT42J.js";import{i as b}from"./IMRXZ7JB.js";import{j as P}from"./S2TAJHHK.js";import{a as f,i as g}from"./FWD4L3CJ.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};
1
+ import{b as T}from"./52ELWNXJ.js";import{c as A}from"./MRMR4QHA.js";import{i as b}from"./Q42YI3EP.js";import{j as P}from"./57MEFFCU.js";import{a as f,i as g}from"./FWD4L3CJ.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};