@oakagentkit/core 0.3.5 → 0.3.7

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 (525) hide show
  1. package/build/dist/api/addresses.d.ts +14 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/chain.js +1 -1
  4. package/build/dist/api/history.d.ts +2 -0
  5. package/build/dist/api/history.js +1 -1
  6. package/build/dist/api/identity-link.js +1 -1
  7. package/build/dist/api/metadata.js +1 -1
  8. package/build/dist/api/modules/beefy/boosts.js +1 -1
  9. package/build/dist/api/modules/beefy/clm.js +1 -1
  10. package/build/dist/api/modules/beefy/guard.js +1 -1
  11. package/build/dist/api/modules/beefy/index.js +1 -1
  12. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  13. package/build/dist/api/modules/beefy/management.js +1 -1
  14. package/build/dist/api/modules/beefy/vaults.js +1 -1
  15. package/build/dist/api/modules/borro/actions.js +1 -1
  16. package/build/dist/api/modules/borro/index.js +1 -1
  17. package/build/dist/api/modules/borro/liquidity.js +1 -1
  18. package/build/dist/api/modules/borro/positions.js +1 -1
  19. package/build/dist/api/modules/borro/reader.js +1 -1
  20. package/build/dist/api/modules/chop/display.js +1 -1
  21. package/build/dist/api/modules/chop/guard.js +1 -1
  22. package/build/dist/api/modules/chop/index.js +1 -1
  23. package/build/dist/api/modules/clanker/extensions.js +1 -1
  24. package/build/dist/api/modules/clanker/index.js +1 -1
  25. package/build/dist/api/modules/clanker/manage.js +1 -1
  26. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  27. package/build/dist/api/modules/clanker/protocol.js +1 -1
  28. package/build/dist/api/modules/clanker/state.js +1 -1
  29. package/build/dist/api/modules/earn/index.js +1 -1
  30. package/build/dist/api/modules/erc8004/common.js +1 -1
  31. package/build/dist/api/modules/erc8004/domain.js +1 -1
  32. package/build/dist/api/modules/erc8004/index.js +1 -1
  33. package/build/dist/api/modules/erc8004/management.js +1 -1
  34. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  35. package/build/dist/api/modules/erc8004/services.js +1 -1
  36. package/build/dist/api/modules/erc8004/thesis.js +1 -1
  37. package/build/dist/api/modules/erc8004/validation.js +1 -1
  38. package/build/dist/api/modules/fobo/index.js +1 -1
  39. package/build/dist/api/modules/fobo/intent.js +1 -1
  40. package/build/dist/api/modules/fobo/steps.js +1 -1
  41. package/build/dist/api/modules/fobo/verify.js +1 -1
  42. package/build/dist/api/modules/grove/index.js +1 -1
  43. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  44. package/build/dist/api/modules/heyresearch/index.js +1 -1
  45. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  46. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  47. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  48. package/build/dist/api/modules/hoodag/index.js +1 -1
  49. package/build/dist/api/modules/hoodag/management.js +1 -1
  50. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  51. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  52. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  53. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  54. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  55. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  56. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  57. package/build/dist/api/modules/hoodlock/index.js +1 -1
  58. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  59. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  60. package/build/dist/api/modules/hoodlock/public.js +1 -1
  61. package/build/dist/api/modules/hookr/actions.d.ts +39 -2
  62. package/build/dist/api/modules/hookr/actions.js +1 -1
  63. package/build/dist/api/modules/hookr/addons.js +1 -1
  64. package/build/dist/api/modules/hookr/agent-gate.d.ts +14 -2
  65. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  66. package/build/dist/api/modules/hookr/agent-link.d.ts +17 -0
  67. package/build/dist/api/modules/hookr/agent-link.js +1 -0
  68. package/build/dist/api/modules/hookr/api-client.d.ts +9 -0
  69. package/build/dist/api/modules/hookr/api-client.js +1 -0
  70. package/build/dist/api/modules/hookr/blocks/advisory.d.ts +41 -0
  71. package/build/dist/api/modules/hookr/blocks/advisory.js +1 -0
  72. package/build/dist/api/modules/hookr/blocks/buy-sell-block.d.ts +7 -0
  73. package/build/dist/api/modules/hookr/blocks/buy-sell-block.js +1 -0
  74. package/build/dist/api/modules/hookr/blocks/core-settings.d.ts +6 -0
  75. package/build/dist/api/modules/hookr/blocks/core-settings.js +1 -0
  76. package/build/dist/api/modules/hookr/blocks/exit-clock.d.ts +14 -0
  77. package/build/dist/api/modules/hookr/blocks/exit-clock.js +1 -0
  78. package/build/dist/api/modules/hookr/blocks/holder-pot.d.ts +30 -0
  79. package/build/dist/api/modules/hookr/blocks/holder-pot.js +1 -0
  80. package/build/dist/api/modules/hookr/blocks/managed-fee.d.ts +96 -0
  81. package/build/dist/api/modules/hookr/blocks/managed-fee.js +1 -0
  82. package/build/dist/api/modules/hookr/blocks/market-guard.d.ts +116 -0
  83. package/build/dist/api/modules/hookr/blocks/market-guard.js +1 -0
  84. package/build/dist/api/modules/hookr/blocks/market-hours-fee.d.ts +87 -0
  85. package/build/dist/api/modules/hookr/blocks/market-hours-fee.js +1 -0
  86. package/build/dist/api/modules/hookr/blocks/pay-later.d.ts +199 -0
  87. package/build/dist/api/modules/hookr/blocks/pay-later.js +1 -0
  88. package/build/dist/api/modules/hookr/blocks/sandwich-guard.d.ts +3 -0
  89. package/build/dist/api/modules/hookr/blocks/sandwich-guard.js +1 -0
  90. package/build/dist/api/modules/hookr/blocks/storm-fee.d.ts +3 -0
  91. package/build/dist/api/modules/hookr/blocks/storm-fee.js +1 -0
  92. package/build/dist/api/modules/hookr/blocks/swap-cut.d.ts +3 -0
  93. package/build/dist/api/modules/hookr/blocks/swap-cut.js +1 -0
  94. package/build/dist/api/modules/hookr/blocks/swap-reward-mint.d.ts +125 -0
  95. package/build/dist/api/modules/hookr/blocks/swap-reward-mint.js +1 -0
  96. package/build/dist/api/modules/hookr/blocks/wallet-cap.d.ts +3 -0
  97. package/build/dist/api/modules/hookr/blocks/wallet-cap.js +1 -0
  98. package/build/dist/api/modules/hookr/blocks/zap-source.d.ts +161 -0
  99. package/build/dist/api/modules/hookr/blocks/zap-source.js +1 -0
  100. package/build/dist/api/modules/hookr/blocks/zap-target.d.ts +51 -0
  101. package/build/dist/api/modules/hookr/blocks/zap-target.js +1 -0
  102. package/build/dist/api/modules/hookr/claims.d.ts +53 -0
  103. package/build/dist/api/modules/hookr/claims.js +1 -0
  104. package/build/dist/api/modules/hookr/contracts.d.ts +3 -1
  105. package/build/dist/api/modules/hookr/contracts.js +1 -1
  106. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  107. package/build/dist/api/modules/hookr/discovery.d.ts +2 -2
  108. package/build/dist/api/modules/hookr/discovery.js +1 -1
  109. package/build/dist/api/modules/hookr/fill-bounty.d.ts +2 -0
  110. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  111. package/build/dist/api/modules/hookr/gas.d.ts +48 -0
  112. package/build/dist/api/modules/hookr/gas.js +1 -0
  113. package/build/dist/api/modules/hookr/gates.d.ts +51 -0
  114. package/build/dist/api/modules/hookr/gates.js +1 -0
  115. package/build/dist/api/modules/hookr/hook-blocks.d.ts +304 -0
  116. package/build/dist/api/modules/hookr/hook-blocks.js +1 -0
  117. package/build/dist/api/modules/hookr/index.d.ts +4 -2
  118. package/build/dist/api/modules/hookr/index.js +1 -1
  119. package/build/dist/api/modules/hookr/jobs.d.ts +7 -0
  120. package/build/dist/api/modules/hookr/jobs.js +1 -0
  121. package/build/dist/api/modules/hookr/launch-options.d.ts +52 -3
  122. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  123. package/build/dist/api/modules/hookr/launch-profile.d.ts +8 -0
  124. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  125. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  126. package/build/dist/api/modules/hookr/launch.d.ts +24 -0
  127. package/build/dist/api/modules/hookr/launch.js +1 -1
  128. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  129. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  130. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  131. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  132. package/build/dist/api/modules/hookr/lp-state.d.ts +90 -2
  133. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  134. package/build/dist/api/modules/hookr/pay-later-actions.d.ts +52 -0
  135. package/build/dist/api/modules/hookr/pay-later-actions.js +1 -0
  136. package/build/dist/api/modules/hookr/pins.d.ts +5 -0
  137. package/build/dist/api/modules/hookr/pins.js +1 -1
  138. package/build/dist/api/modules/hookr/pm-liquidity.d.ts +215 -0
  139. package/build/dist/api/modules/hookr/pm-liquidity.js +1 -0
  140. package/build/dist/api/modules/hookr/public-reads.d.ts +1 -1
  141. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  142. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  143. package/build/dist/api/modules/hookr/relay.js +1 -1
  144. package/build/dist/api/modules/hookr/revenue.d.ts +4 -1
  145. package/build/dist/api/modules/hookr/revenue.js +1 -1
  146. package/build/dist/api/modules/hookr/scan.d.ts +25 -0
  147. package/build/dist/api/modules/hookr/scan.js +1 -0
  148. package/build/dist/api/modules/hookr/swap.d.ts +161 -0
  149. package/build/dist/api/modules/hookr/swap.js +1 -0
  150. package/build/dist/api/modules/kyberswap/index.js +1 -1
  151. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  152. package/build/dist/api/modules/layerbank/abi.js +1 -1
  153. package/build/dist/api/modules/layerbank/actions.js +1 -1
  154. package/build/dist/api/modules/layerbank/checks.js +1 -1
  155. package/build/dist/api/modules/layerbank/index.js +1 -1
  156. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  157. package/build/dist/api/modules/layerbank/reader.js +1 -1
  158. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  159. package/build/dist/api/modules/lighter/index.js +1 -1
  160. package/build/dist/api/modules/longbow/administration.js +1 -1
  161. package/build/dist/api/modules/longbow/analytics.js +1 -1
  162. package/build/dist/api/modules/longbow/fixed.js +1 -1
  163. package/build/dist/api/modules/longbow/index.js +1 -1
  164. package/build/dist/api/modules/longbow/nft.js +1 -1
  165. package/build/dist/api/modules/longbow/rebates.js +1 -1
  166. package/build/dist/api/modules/longbow/staking.js +1 -1
  167. package/build/dist/api/modules/meridian/index.js +1 -1
  168. package/build/dist/api/modules/meridian/markets.js +1 -1
  169. package/build/dist/api/modules/meridian/rfq.js +1 -1
  170. package/build/dist/api/modules/merkl/discovery.js +1 -1
  171. package/build/dist/api/modules/merkl/index.js +1 -1
  172. package/build/dist/api/modules/merkl/manage.js +1 -1
  173. package/build/dist/api/modules/merkl/protocol.js +1 -1
  174. package/build/dist/api/modules/merkl/stock-lp.d.ts +51 -0
  175. package/build/dist/api/modules/merkl/stock-lp.js +1 -0
  176. package/build/dist/api/modules/morpho/allocator.js +1 -1
  177. package/build/dist/api/modules/morpho/bundles.js +1 -1
  178. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  179. package/build/dist/api/modules/morpho/index.js +1 -1
  180. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  181. package/build/dist/api/modules/morpho/midnight.js +1 -1
  182. package/build/dist/api/modules/morpho/protocol.js +1 -1
  183. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  184. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  185. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  186. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  187. package/build/dist/api/modules/netnet/card-read.js +1 -1
  188. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  189. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  190. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  191. package/build/dist/api/modules/netnet/financial.js +1 -1
  192. package/build/dist/api/modules/netnet/index.js +1 -1
  193. package/build/dist/api/modules/netnet/staking.js +1 -1
  194. package/build/dist/api/modules/orbio/index.js +1 -1
  195. package/build/dist/api/modules/orbio/positions.js +1 -1
  196. package/build/dist/api/modules/pendle/costs.js +1 -1
  197. package/build/dist/api/modules/pendle/index.js +1 -1
  198. package/build/dist/api/modules/pendle/markets.js +1 -1
  199. package/build/dist/api/modules/pendle/positions.js +1 -1
  200. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  201. package/build/dist/api/modules/pendle/reader.js +1 -1
  202. package/build/dist/api/modules/pendle/redeem.js +1 -1
  203. package/build/dist/api/modules/pendle/trade.js +1 -1
  204. package/build/dist/api/modules/pendle/validate.js +1 -1
  205. package/build/dist/api/modules/pendle/verify.js +1 -1
  206. package/build/dist/api/modules/pons/claim.js +1 -1
  207. package/build/dist/api/modules/pons/index.js +1 -1
  208. package/build/dist/api/modules/pons/launch-status.js +1 -1
  209. package/build/dist/api/modules/pons/prices.js +1 -1
  210. package/build/dist/api/modules/pons/reads.js +1 -1
  211. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  212. package/build/dist/api/modules/pons/trade.js +1 -1
  213. package/build/dist/api/modules/poolstrade/index.js +1 -1
  214. package/build/dist/api/modules/priors/coverage.js +1 -1
  215. package/build/dist/api/modules/priors/discovery.js +1 -1
  216. package/build/dist/api/modules/priors/features.js +1 -1
  217. package/build/dist/api/modules/priors/holdings.js +1 -1
  218. package/build/dist/api/modules/priors/index.js +1 -1
  219. package/build/dist/api/modules/priors/integration.js +1 -1
  220. package/build/dist/api/modules/priors/market.js +1 -1
  221. package/build/dist/api/modules/priors/pt.js +1 -1
  222. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  223. package/build/dist/api/modules/priors/starter-line.js +1 -1
  224. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  225. package/build/dist/api/modules/raeto/index.js +1 -1
  226. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  227. package/build/dist/api/modules/relay/discovery.js +1 -1
  228. package/build/dist/api/modules/relay/inbound.js +1 -1
  229. package/build/dist/api/modules/relay/index.js +1 -1
  230. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  231. package/build/dist/api/modules/relay/reads.js +1 -1
  232. package/build/dist/api/modules/spark/actions.js +1 -1
  233. package/build/dist/api/modules/spark/details.js +1 -1
  234. package/build/dist/api/modules/spark/index.js +1 -1
  235. package/build/dist/api/modules/spark/management.js +1 -1
  236. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  237. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  238. package/build/dist/api/modules/steakhouse/index.js +1 -1
  239. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  240. package/build/dist/api/modules/steakhouse/management.js +1 -1
  241. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  242. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  243. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  244. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  249. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  250. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  251. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  252. package/build/dist/api/modules/tickerspring/research.js +1 -1
  253. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  254. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction.js +1 -1
  256. package/build/dist/api/modules/uniswap/batch.js +1 -1
  257. package/build/dist/api/modules/uniswap/common.js +1 -1
  258. package/build/dist/api/modules/uniswap/fees.js +1 -1
  259. package/build/dist/api/modules/uniswap/index.js +1 -1
  260. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  261. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  262. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  263. package/build/dist/api/modules/uniswap/pools.js +1 -1
  264. package/build/dist/api/modules/uniswap/position.js +1 -1
  265. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  266. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  267. package/build/dist/api/modules/uniswap/stock-prices.d.ts +25 -0
  268. package/build/dist/api/modules/uniswap/stock-prices.js +1 -1
  269. package/build/dist/api/modules/uniswap/stocks.js +1 -1
  270. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  271. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  272. package/build/dist/api/modules/uniswap/trade.js +1 -1
  273. package/build/dist/api/modules/uniswap/v2.js +1 -1
  274. package/build/dist/api/modules/uniswap/v3.js +1 -1
  275. package/build/dist/api/modules/uniswap/v4.js +1 -1
  276. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  277. package/build/dist/api/modules/upoch/index.js +1 -1
  278. package/build/dist/api/modules/upoch/reads.js +1 -1
  279. package/build/dist/api/modules/velora/claims.js +1 -1
  280. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  281. package/build/dist/api/modules/velora/index.js +1 -1
  282. package/build/dist/api/modules/wormhole/index.js +1 -1
  283. package/build/dist/api/modules/wormhole/scan-text.d.ts +1 -1
  284. package/build/dist/api/positions.js +1 -1
  285. package/build/dist/api/pricenote.js +1 -1
  286. package/build/dist/api/prices.js +1 -1
  287. package/build/dist/api/rpc.js +1 -1
  288. package/build/dist/api/send.js +1 -1
  289. package/build/dist/api/signing-registry.js +1 -1
  290. package/build/dist/api/signing.js +1 -1
  291. package/build/dist/api/simulate.js +1 -1
  292. package/build/dist/api/swap.d.ts +2 -0
  293. package/build/dist/api/swap.js +1 -1
  294. package/build/dist/api/tokens.d.ts +9 -1
  295. package/build/dist/api/tokens.js +1 -1
  296. package/build/dist/api/tool-policy.d.ts +1 -0
  297. package/build/dist/api/tool-policy.js +1 -1
  298. package/build/dist/api/universal-router.js +1 -1
  299. package/build/dist/api/usd-estimate.js +1 -1
  300. package/build/dist/chunks/{DMDOSHV7.js → 266VIESP.js} +1 -1
  301. package/build/dist/chunks/{HFVXNKA5.js → 2BM2WX2G.js} +1 -1
  302. package/build/dist/chunks/{HDBZZOHJ.js → 2GYL3N2O.js} +1 -1
  303. package/build/dist/chunks/{OY5W7ZSL.js → 2H2OZE6X.js} +1 -1
  304. package/build/dist/chunks/{E76Z2TT4.js → 2QQ5CGQI.js} +1 -1
  305. package/build/dist/chunks/{4PLLS6CT.js → 2VYA6WIN.js} +1 -1
  306. package/build/dist/chunks/{FRT6AC6M.js → 2ZYFBBOE.js} +1 -1
  307. package/build/dist/chunks/{LCH6F5HT.js → 342OZP53.js} +1 -1
  308. package/build/dist/chunks/{XADHV2DT.js → 35DTANJW.js} +1 -1
  309. package/build/dist/chunks/{4IOHSX3Z.js → 37UBQQWL.js} +1 -1
  310. package/build/dist/chunks/3RGED2KO.js +1 -0
  311. package/build/dist/chunks/{4HQEJHCD.js → 3XIJCHT7.js} +1 -1
  312. package/build/dist/chunks/3XY44BP5.js +1 -0
  313. package/build/dist/chunks/3YNXQ3EZ.js +1 -0
  314. package/build/dist/chunks/{JDHPMS7X.js → 4JU23O3Z.js} +1 -1
  315. package/build/dist/chunks/{Y2QADJOB.js → 4P6DRKY3.js} +1 -1
  316. package/build/dist/chunks/{W3DGFMQE.js → 4RTXP2YP.js} +1 -1
  317. package/build/dist/chunks/{CNDIAF3P.js → 4WYTIM4T.js} +1 -1
  318. package/build/dist/chunks/{HPS4KOU4.js → 52AEVHKJ.js} +1 -1
  319. package/build/dist/chunks/{ZTKT3ZQK.js → 53VBLEYS.js} +1 -1
  320. package/build/dist/chunks/{ADIPEGNN.js → 5AO2QPWE.js} +1 -1
  321. package/build/dist/chunks/{GQITAJVF.js → 5BPFF7NX.js} +1 -1
  322. package/build/dist/chunks/5EQTOA5F.js +1 -0
  323. package/build/dist/chunks/{WAKZWSHB.js → 5KKAN7XQ.js} +1 -1
  324. package/build/dist/chunks/{VVAM3EAK.js → 5N6YJFFA.js} +1 -1
  325. package/build/dist/chunks/{QIB6OMQV.js → 5O67QQIY.js} +1 -1
  326. package/build/dist/chunks/{FAH7FKUT.js → 5UWVXEPD.js} +1 -1
  327. package/build/dist/chunks/{KKTOBXIT.js → 5VA66LFF.js} +1 -1
  328. package/build/dist/chunks/5VKVAUFQ.js +1 -0
  329. package/build/dist/chunks/5Y457HYC.js +1 -0
  330. package/build/dist/chunks/627SGCTU.js +1 -0
  331. package/build/dist/chunks/64LAWFBE.js +1 -0
  332. package/build/dist/chunks/{6F527FLN.js → 6HNQAYBM.js} +1 -1
  333. package/build/dist/chunks/{FUP53K6G.js → 6LDC5D2S.js} +1 -1
  334. package/build/dist/chunks/6RVAV6BB.js +1 -0
  335. package/build/dist/chunks/{WSILNJS2.js → 6STUQOFL.js} +1 -1
  336. package/build/dist/chunks/{4Z3IGMU6.js → 7AYP4ATZ.js} +1 -1
  337. package/build/dist/chunks/{YGW4ODAP.js → 7EPU3XGY.js} +1 -1
  338. package/build/dist/chunks/7GL547YZ.js +1 -0
  339. package/build/dist/chunks/{E47UYYK4.js → 7KK3OC7Q.js} +1 -1
  340. package/build/dist/chunks/{IZP3EKKS.js → 7PBCV7VS.js} +1 -1
  341. package/build/dist/chunks/{A3BJSQ23.js → 7VU5VCTL.js} +1 -1
  342. package/build/dist/chunks/{Z7FGEWO2.js → 7WXAS54T.js} +1 -1
  343. package/build/dist/chunks/{DRLBTB4E.js → A72ADVYF.js} +1 -1
  344. package/build/dist/chunks/{ANIF3JMV.js → AG66NM3J.js} +1 -1
  345. package/build/dist/chunks/AODUTN65.js +1 -0
  346. package/build/dist/chunks/{DBOGRUPS.js → AONO47JX.js} +1 -1
  347. package/build/dist/chunks/{2I7XHRTI.js → AOTTQPK7.js} +1 -1
  348. package/build/dist/chunks/{JTPHZCO3.js → AQJLEG6B.js} +1 -1
  349. package/build/dist/chunks/AZBTNUXF.js +1 -0
  350. package/build/dist/chunks/B4U43D5Z.js +1 -0
  351. package/build/dist/chunks/B5B7U3NZ.js +1 -0
  352. package/build/dist/chunks/{ZX43P4BK.js → B75SS7H6.js} +1 -1
  353. package/build/dist/chunks/{GBIBRYOV.js → B7HVPHSS.js} +1 -1
  354. package/build/dist/chunks/{LT5P6PZW.js → B7WZJHIJ.js} +1 -1
  355. package/build/dist/chunks/{3A2IKFTV.js → BIFANUTV.js} +1 -1
  356. package/build/dist/chunks/BM4KHOFB.js +1 -0
  357. package/build/dist/chunks/{ZVY7GGSP.js → BW755PNH.js} +1 -1
  358. package/build/dist/chunks/{VXCGMALF.js → BWE5PXRE.js} +1 -1
  359. package/build/dist/chunks/{7U62MMUQ.js → BY2OWKZB.js} +1 -1
  360. package/build/dist/chunks/{F7MGYRPU.js → CCPG6PRL.js} +1 -1
  361. package/build/dist/chunks/{OI3N4EW4.js → CG7ABZXH.js} +1 -1
  362. package/build/dist/chunks/{S37D7HOK.js → CITHH7NK.js} +1 -1
  363. package/build/dist/chunks/CJMVRV34.js +1 -0
  364. package/build/dist/chunks/{JJSCDDQO.js → CLHA557R.js} +1 -1
  365. package/build/dist/chunks/CQPIR6ER.js +1 -0
  366. package/build/dist/chunks/{MI5HZDMH.js → D6JOXK7Q.js} +1 -1
  367. package/build/dist/chunks/{IZFED3R2.js → DLNDJZR4.js} +1 -1
  368. package/build/dist/chunks/{UUF4Z6K6.js → DUTAMN3F.js} +1 -1
  369. package/build/dist/chunks/{NMJVQX5M.js → DWRRIFXS.js} +1 -1
  370. package/build/dist/chunks/{3ZH5SOC2.js → EFOC337C.js} +1 -1
  371. package/build/dist/chunks/{2PS4GCOZ.js → EKHNXPWO.js} +1 -1
  372. package/build/dist/chunks/EWZFZUVF.js +1 -0
  373. package/build/dist/chunks/EXKV6QJD.js +1 -0
  374. package/build/dist/chunks/{OB7BFDOV.js → EYE3ZAJB.js} +1 -1
  375. package/build/dist/chunks/{MQ5F2VOK.js → EZUQMTLE.js} +1 -1
  376. package/build/dist/chunks/FMEO7RX7.js +1 -0
  377. package/build/dist/chunks/{ZQPC54J5.js → FYWK3UK6.js} +1 -1
  378. package/build/dist/chunks/G53U6Y4L.js +1 -0
  379. package/build/dist/chunks/{O5QTITN6.js → GRHBE4MQ.js} +1 -1
  380. package/build/dist/chunks/GV6FZ6UG.js +1 -0
  381. package/build/dist/chunks/GV6Z3MET.js +1 -0
  382. package/build/dist/chunks/{GK3D7OKG.js → GVCNTGLC.js} +1 -1
  383. package/build/dist/chunks/H5J2LFPZ.js +1 -0
  384. package/build/dist/chunks/{DCGNVMKG.js → HC3QFA5I.js} +1 -1
  385. package/build/dist/chunks/{C76D54YG.js → HGSFRN57.js} +1 -1
  386. package/build/dist/chunks/HJI7KO6F.js +1 -0
  387. package/build/dist/chunks/{G5AMH4IP.js → HN5RBTNE.js} +1 -1
  388. package/build/dist/chunks/{MSRCJ2BS.js → HPBTSJW7.js} +1 -1
  389. package/build/dist/chunks/HPO673QQ.js +1 -0
  390. package/build/dist/chunks/{C57DITTF.js → HTOP2OKU.js} +1 -1
  391. package/build/dist/chunks/{DGDMRATN.js → ICHT3H3W.js} +1 -1
  392. package/build/dist/chunks/IJVBCEA2.js +1 -0
  393. package/build/dist/chunks/ILTGXU6G.js +1 -0
  394. package/build/dist/chunks/{I4473OC6.js → IMD33NQS.js} +1 -1
  395. package/build/dist/chunks/{X24YTJST.js → IY7FWTAL.js} +1 -1
  396. package/build/dist/chunks/{TOIKOIY6.js → J5624CVF.js} +1 -1
  397. package/build/dist/chunks/JCS24YBB.js +1 -0
  398. package/build/dist/chunks/JFYC2LVI.js +1 -0
  399. package/build/dist/chunks/JQVTHPUO.js +1 -0
  400. package/build/dist/chunks/{TGXEKBLV.js → JUVY6PCR.js} +1 -1
  401. package/build/dist/chunks/JYED2PZ3.js +1 -0
  402. package/build/dist/chunks/{KO7ANIKY.js → K3HCSCXE.js} +1 -1
  403. package/build/dist/chunks/{7VH6JQ2H.js → K5C6QBOO.js} +1 -1
  404. package/build/dist/chunks/{W7BFM6CK.js → KAXLZJU6.js} +1 -1
  405. package/build/dist/chunks/{YW4W3LPQ.js → KHLM6NIZ.js} +1 -1
  406. package/build/dist/chunks/{OIQTZOBN.js → KKGHXNM4.js} +1 -1
  407. package/build/dist/chunks/{TZ7S5KRB.js → KW5LJGNY.js} +1 -1
  408. package/build/dist/chunks/{SUNTJ6IU.js → KYANIEPX.js} +1 -1
  409. package/build/dist/chunks/{ZZ6FZGHF.js → L4UFGM7M.js} +1 -1
  410. package/build/dist/chunks/{YWVPK3DV.js → L76P6WIH.js} +1 -1
  411. package/build/dist/chunks/{QMNUB2GM.js → LBT6WR4U.js} +1 -1
  412. package/build/dist/chunks/LD3A2KLN.js +1 -0
  413. package/build/dist/chunks/{WRUTW6CG.js → LFSNAQ7V.js} +1 -1
  414. package/build/dist/chunks/LHC2YV2U.js +1 -0
  415. package/build/dist/chunks/{R66NSNNQ.js → LHVGWNMW.js} +1 -1
  416. package/build/dist/chunks/{RUHNLNVX.js → LOH6LUVT.js} +1 -1
  417. package/build/dist/chunks/{23HNDJ76.js → M2SWILNG.js} +1 -1
  418. package/build/dist/chunks/{IT2JLILU.js → MFKDNAHB.js} +1 -1
  419. package/build/dist/chunks/MFQTBUSD.js +1 -0
  420. package/build/dist/chunks/MFRKZOU4.js +1 -0
  421. package/build/dist/chunks/{V4UJMUIB.js → MLN5KTG7.js} +1 -1
  422. package/build/dist/chunks/{TJU644I7.js → MSIT5Q3M.js} +1 -1
  423. package/build/dist/chunks/{S4JUFCT4.js → MSQNOK3I.js} +1 -1
  424. package/build/dist/chunks/NCCKCGKL.js +1 -0
  425. package/build/dist/chunks/NGHRUNXO.js +1 -0
  426. package/build/dist/chunks/{N65J3L2H.js → NIGRNLNM.js} +1 -1
  427. package/build/dist/chunks/{DXAPKN7H.js → NLC36QHL.js} +1 -1
  428. package/build/dist/chunks/NUTTPUYJ.js +1 -0
  429. package/build/dist/chunks/{QMIH6HXH.js → NWW6GY5E.js} +1 -1
  430. package/build/dist/chunks/{O4S6XAYV.js → O7L55XM3.js} +1 -1
  431. package/build/dist/chunks/{NAO7VWZF.js → OCIEVYPR.js} +1 -1
  432. package/build/dist/chunks/{4NBXBKOX.js → OD7CY6BY.js} +1 -1
  433. package/build/dist/chunks/{RUTSEGGD.js → OHZHQSCA.js} +1 -1
  434. package/build/dist/chunks/{A4K5GXVO.js → ORKXBYVC.js} +1 -1
  435. package/build/dist/chunks/OUXPOFY2.js +1 -0
  436. package/build/dist/chunks/{NIWAVMDR.js → OWHXYE2G.js} +1 -1
  437. package/build/dist/chunks/PD5NXIRT.js +1 -0
  438. package/build/dist/chunks/{TXGZ6NWN.js → PG7HZIZL.js} +1 -1
  439. package/build/dist/chunks/PLEJPTTK.js +1 -0
  440. package/build/dist/chunks/{VREGY7E6.js → PMFR47H3.js} +1 -1
  441. package/build/dist/chunks/{ZXRIJG6H.js → PX2G2H6G.js} +1 -1
  442. package/build/dist/chunks/QAAKUIWE.js +1 -0
  443. package/build/dist/chunks/{YXXK6EPI.js → QBHY2QRC.js} +1 -1
  444. package/build/dist/chunks/{WQ2XTDHO.js → QCPJZBEO.js} +1 -1
  445. package/build/dist/chunks/{ELHRXA5U.js → QFK335LC.js} +1 -1
  446. package/build/dist/chunks/{3PHJUFU2.js → QFUSCK5C.js} +1 -1
  447. package/build/dist/chunks/QGO4EKXZ.js +1 -0
  448. package/build/dist/chunks/{IPU656WB.js → QKH7ED6B.js} +1 -1
  449. package/build/dist/chunks/{XW3VGWXK.js → QMWHQRYC.js} +1 -1
  450. package/build/dist/chunks/{USGMGKAG.js → QXBQ7WPB.js} +1 -1
  451. package/build/dist/chunks/{MQXSCNUL.js → R5UOFPDO.js} +1 -1
  452. package/build/dist/chunks/{MDLJFCT4.js → R5Z4HPCA.js} +1 -1
  453. package/build/dist/chunks/{A4FLWHLP.js → REXGROOD.js} +1 -1
  454. package/build/dist/chunks/RKJFSDGV.js +1 -0
  455. package/build/dist/chunks/RKS3M7L5.js +1 -0
  456. package/build/dist/chunks/{GDOHHXNH.js → RLX6YTNT.js} +1 -1
  457. package/build/dist/chunks/{PV7FEVBD.js → RWEA4SWP.js} +1 -1
  458. package/build/dist/chunks/{ZKBOPZH5.js → RWUF6T4I.js} +1 -1
  459. package/build/dist/chunks/{USEF3QKG.js → S432S6NA.js} +1 -1
  460. package/build/dist/chunks/{XTXXWRN2.js → SDDYM2H3.js} +1 -1
  461. package/build/dist/chunks/{2OVJ2BTJ.js → SEXKWYUM.js} +1 -1
  462. package/build/dist/chunks/TKJ4GFUP.js +1 -0
  463. package/build/dist/chunks/{BSX4LFYI.js → TNHU5UBQ.js} +1 -1
  464. package/build/dist/chunks/{PDPTJMTJ.js → TT2ST3Q3.js} +1 -1
  465. package/build/dist/chunks/TTBB6EFN.js +1 -0
  466. package/build/dist/chunks/{OVM4QIET.js → U4MSIH4G.js} +1 -1
  467. package/build/dist/chunks/{LKUZAJPZ.js → UCMOQAVD.js} +1 -1
  468. package/build/dist/chunks/{OB3YMTDI.js → UIVOYAO2.js} +1 -1
  469. package/build/dist/chunks/{3YH5B5NQ.js → UL4DY6GX.js} +1 -1
  470. package/build/dist/chunks/{XRDLMTBJ.js → UMY6SP7C.js} +1 -1
  471. package/build/dist/chunks/UNBRUWSV.js +1 -0
  472. package/build/dist/chunks/{LGLWEGPY.js → UPX3OWKA.js} +1 -1
  473. package/build/dist/chunks/{MJGEGNDU.js → UYYYSFMQ.js} +1 -1
  474. package/build/dist/chunks/{4RCYYN6O.js → V7HTGO23.js} +1 -1
  475. package/build/dist/chunks/{O2QBSINK.js → V7P4PCLL.js} +1 -1
  476. package/build/dist/chunks/{FRVCSDKU.js → VMSGNN3D.js} +1 -1
  477. package/build/dist/chunks/VQMBPY2P.js +1 -0
  478. package/build/dist/chunks/{HZSYMGJ2.js → VS7ZA4OF.js} +1 -1
  479. package/build/dist/chunks/{BJ2U2VXJ.js → VTWAVH74.js} +1 -1
  480. package/build/dist/chunks/W3M4KAPX.js +1 -0
  481. package/build/dist/chunks/{LZM3DO5Q.js → W5GWK72I.js} +1 -1
  482. package/build/dist/chunks/{65OITTDL.js → W73SLWBT.js} +1 -1
  483. package/build/dist/chunks/{2FOI2625.js → W7BTXU3F.js} +1 -1
  484. package/build/dist/chunks/{6LVHN33V.js → WADRRW3E.js} +1 -1
  485. package/build/dist/chunks/{ZXFJKW6H.js → WG7PMGTJ.js} +1 -1
  486. package/build/dist/chunks/{N742W5KX.js → WRNPYW47.js} +1 -1
  487. package/build/dist/chunks/{XL3W7DAQ.js → X3BB6WME.js} +1 -1
  488. package/build/dist/chunks/{SX5YNFHG.js → XD4JA43O.js} +1 -1
  489. package/build/dist/chunks/{GBPB7JIB.js → XSQJOOEY.js} +1 -1
  490. package/build/dist/chunks/{3BQ5XHDJ.js → Y7SKGRWC.js} +1 -1
  491. package/build/dist/chunks/{R73R4KN3.js → YBLJ2MCR.js} +1 -1
  492. package/build/dist/chunks/{6CKCZJ3F.js → YDJHXSS7.js} +1 -1
  493. package/build/dist/chunks/{GKUPC4DO.js → YLU5JVRI.js} +1 -1
  494. package/build/dist/chunks/YR6Y6UIR.js +1 -0
  495. package/build/dist/chunks/{FHB7QYJO.js → Z5WRTISY.js} +1 -1
  496. package/build/dist/chunks/ZB67QDN2.js +1 -0
  497. package/build/dist/chunks/{O4P5IQCP.js → ZRG34Y7Q.js} +1 -1
  498. package/build/dist/chunks/ZSGW2ZSO.js +1 -0
  499. package/build/dist/chunks/{HRAHGYNK.js → ZTNBX4VH.js} +1 -1
  500. package/package.json +1 -1
  501. package/build/dist/chunks/5H7NVE6O.js +0 -1
  502. package/build/dist/chunks/7OOCAZBE.js +0 -1
  503. package/build/dist/chunks/7TRO6MBQ.js +0 -1
  504. package/build/dist/chunks/DFM4T6ZE.js +0 -1
  505. package/build/dist/chunks/FCVH4FYH.js +0 -1
  506. package/build/dist/chunks/GDUKZYE2.js +0 -1
  507. package/build/dist/chunks/GYPMUYB5.js +0 -1
  508. package/build/dist/chunks/J7OZLXSG.js +0 -1
  509. package/build/dist/chunks/JFC2QCMW.js +0 -1
  510. package/build/dist/chunks/M267JEDO.js +0 -1
  511. package/build/dist/chunks/M6JNGU4E.js +0 -1
  512. package/build/dist/chunks/M7OVMIIE.js +0 -1
  513. package/build/dist/chunks/MQK6OP7S.js +0 -1
  514. package/build/dist/chunks/N624NR7Y.js +0 -1
  515. package/build/dist/chunks/OSMOBKRQ.js +0 -1
  516. package/build/dist/chunks/Q3Q3YHEX.js +0 -1
  517. package/build/dist/chunks/QBNASL3T.js +0 -1
  518. package/build/dist/chunks/QQD4PV64.js +0 -1
  519. package/build/dist/chunks/RN3WUJIO.js +0 -1
  520. package/build/dist/chunks/RP5VCG54.js +0 -1
  521. package/build/dist/chunks/TI727O2H.js +0 -1
  522. package/build/dist/chunks/UHIJMDD2.js +0 -1
  523. package/build/dist/chunks/W32UECOL.js +0 -1
  524. package/build/dist/chunks/WWNAGOCD.js +0 -1
  525. package/build/dist/chunks/XWC6IC5E.js +0 -1
@@ -1 +1 @@
1
- import{a as d,d as T,e as p}from"./VXCGMALF.js";import{a as g}from"./66F5ZH34.js";import{b as r}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as k,erc20Abi as v,getAddress as m,parseAbi as I}from"viem";var e={router:m("0x888888888889758F76e7103c6CbF23ABbF58F946"),oracle:m("0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2"),market:m("0xc2b89e6eca583e2c232201ac557e9be58af55f4c"),pt:m("0x6982e39521A070a3C40782548bfBED6Dc8F566ef"),yt:m("0xF35Ee6bd9A93fE42BC7e628BFC4DDbdc6DE1f615"),expiry:1805932800n},$="(uint8 swapType,address extRouter,bytes extCalldata,bool needScale)",C="(uint256 salt,uint256 expiry,uint256 nonce,uint8 orderType,address token,address YT,address maker,address receiver,uint256 makingAmount,uint256 lnImpliedRate,uint256 failSafeRate,bytes permit)",w=`(${C} order,bytes signature,uint256 makingAmount)`,D=`(address limitRouter,uint256 epsSkipMarket,${w}[] normalFills,${w}[] flashFills,bytes optData)`,M=`(address tokenIn,uint256 netTokenIn,address tokenMintSy,address pendleSwap,${$} swapData)`,O=`(address tokenOut,uint256 minTokenOut,address tokenRedeemSy,address pendleSwap,${$} swapData)`,U="(uint256 guessMin,uint256 guessMax,uint256 guessOffchain,uint256 maxIteration,uint256 eps)",b=I([`function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,${U} guessPtOut,${M} input,${D} limit) payable returns (uint256 netPtOut,uint256 netSyFee,uint256 netSyInterm)`,`function swapExactPtForToken(address receiver,address market,uint256 exactPtIn,${O} output,${D} limit) returns (uint256 netTokenOut,uint256 netSyFee,uint256 netSyInterm)`,`function redeemPyToToken(address receiver,address YT,uint256 netPyIn,${O} output) returns (uint256 netTokenOut,uint256 netSyInterm)`]),_=I(["function getPtToAssetRate(address market,uint32 duration) view returns (uint256)"]),F={address:e.pt,symbol:"PT-USDG",decimals:6,chainId:r},l="0x0000000000000000000000000000000000000000",h={swapType:0,extRouter:l,extCalldata:"0x",needScale:!1},A={limitRouter:l,epsSkipMarket:0n,normalFills:[],flashFills:[],optData:"0x"},G={guessMin:0n,guessMax:(1n<<256n)-1n,guessOffchain:0n,maxIteration:256n,eps:10n**14n},f=g('Exact USDG or PT-USDG amount in base units (both 6 decimals). Example: "1000000" = 1 USDG.');function Y(i){let y=async()=>{if(i.network==="testnet")throw new u("Priors PT is configured only on chain 4663.");return i.clientFor(r).getBlock()};return{tools:[{name:"priors_pt_quote",inputSchema:{type:"object",properties:{side:{type:"string",enum:["buy","sell"],description:'Choose "buy": USDG in for PT-USDG; "sell": PT-USDG in for USDG.'},amount:f},required:["side","amount"],additionalProperties:!1},async execute(n){let o=await y();if(o.timestamp>=e.expiry)throw new u("This PT market matured; use redemption.");let t=p(n.amount,"amount");if(t===0n||!["buy","sell"].includes(String(n.side)))throw new u("Provide buy or sell and a positive base-unit amount.");let a=await i.clientFor(r).readContract({address:e.oracle,abi:_,functionName:"getPtToAssetRate",args:[e.market,0]});if(a===0n)throw new u("PT oracle returned a zero rate.");return{chainId:r,token:F,market:e.market,blockNumber:o.number?.toString(),amountIn:t.toString(),estimatedOutput:(n.side==="buy"?t*10n**18n/a:t*a/10n**18n).toString(),rateE18:a.toString(),caveat:"Oracle spot estimate excludes own price impact and execution fees. Specify minOut explicitly and inspect the actual swap preview."}}},{name:"priors_pt_position",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(n,o){let t=await y(),a=await i.clientFor(r).readContract({address:e.pt,abi:v,functionName:"balanceOf",args:[m(o)]});return{token:F,balance:a.toString(),market:e.market,expiry:e.expiry.toString(),matured:t.timestamp>=e.expiry}}},...["buy","sell","redeem"].map(n=>({name:`priors_pt_${n}`,inputSchema:{type:"object",properties:{amount:f,minOut:f},required:["amount","minOut"],additionalProperties:!1},async execute(o,t){t=m(t);let a=await y(),S=a.timestamp>=e.expiry;if(n==="redeem"!==S)throw new u(S?"Market matured; redeem PT instead.":"PT redemption opens at maturity.");let s=p(o.amount,"amount"),c=p(o.minOut,"minOut");if(s===0n||c===0n)throw new u("amount and minOut must be positive base units.");let x={tokenOut:d.usdg,minTokenOut:c,tokenRedeemSy:d.usdg,pendleSwap:l,swapData:h},R=n==="buy"?k({abi:b,functionName:"swapExactTokenForPt",args:[t,e.market,c,G,{tokenIn:d.usdg,netTokenIn:s,tokenMintSy:d.usdg,pendleSwap:l,swapData:h},A]}):n==="sell"?k({abi:b,functionName:"swapExactPtForToken",args:[t,e.market,s,x,A]}):k({abi:b,functionName:"redeemPyToToken",args:[t,e.yt,s,x]}),P=[i.approval(n==="buy"?d.usdg:e.pt,e.router,s.toString(),r),i.unsignedTx({to:e.router,data:R,value:"0",chainId:r,description:`${n} PT-USDG, exact input ${s}, minimum output ${c} (6 decimals).`})],E=await i.preview(P,t);return{txs:P,summary:`Pendle PT ${n}: ${s} base units, minimum ${c}, receiver ${t}. No external aggregator. ${E.summary}`,terms:T({expiry:e.expiry,market:e.market})}}}))]}}export{e as a,b,Y as c};
1
+ import{a as d,d as T,e as p}from"./BWE5PXRE.js";import{a as g}from"./66F5ZH34.js";import{b as r}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as k,erc20Abi as v,getAddress as m,parseAbi as I}from"viem";var e={router:m("0x888888888889758F76e7103c6CbF23ABbF58F946"),oracle:m("0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2"),market:m("0xc2b89e6eca583e2c232201ac557e9be58af55f4c"),pt:m("0x6982e39521A070a3C40782548bfBED6Dc8F566ef"),yt:m("0xF35Ee6bd9A93fE42BC7e628BFC4DDbdc6DE1f615"),expiry:1805932800n},$="(uint8 swapType,address extRouter,bytes extCalldata,bool needScale)",C="(uint256 salt,uint256 expiry,uint256 nonce,uint8 orderType,address token,address YT,address maker,address receiver,uint256 makingAmount,uint256 lnImpliedRate,uint256 failSafeRate,bytes permit)",w=`(${C} order,bytes signature,uint256 makingAmount)`,D=`(address limitRouter,uint256 epsSkipMarket,${w}[] normalFills,${w}[] flashFills,bytes optData)`,M=`(address tokenIn,uint256 netTokenIn,address tokenMintSy,address pendleSwap,${$} swapData)`,O=`(address tokenOut,uint256 minTokenOut,address tokenRedeemSy,address pendleSwap,${$} swapData)`,U="(uint256 guessMin,uint256 guessMax,uint256 guessOffchain,uint256 maxIteration,uint256 eps)",b=I([`function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,${U} guessPtOut,${M} input,${D} limit) payable returns (uint256 netPtOut,uint256 netSyFee,uint256 netSyInterm)`,`function swapExactPtForToken(address receiver,address market,uint256 exactPtIn,${O} output,${D} limit) returns (uint256 netTokenOut,uint256 netSyFee,uint256 netSyInterm)`,`function redeemPyToToken(address receiver,address YT,uint256 netPyIn,${O} output) returns (uint256 netTokenOut,uint256 netSyInterm)`]),_=I(["function getPtToAssetRate(address market,uint32 duration) view returns (uint256)"]),F={address:e.pt,symbol:"PT-USDG",decimals:6,chainId:r},l="0x0000000000000000000000000000000000000000",h={swapType:0,extRouter:l,extCalldata:"0x",needScale:!1},A={limitRouter:l,epsSkipMarket:0n,normalFills:[],flashFills:[],optData:"0x"},G={guessMin:0n,guessMax:(1n<<256n)-1n,guessOffchain:0n,maxIteration:256n,eps:10n**14n},f=g('Exact USDG or PT-USDG amount in base units (both 6 decimals). Example: "1000000" = 1 USDG.');function Y(i){let y=async()=>{if(i.network==="testnet")throw new u("Priors PT is configured only on chain 4663.");return i.clientFor(r).getBlock()};return{tools:[{name:"priors_pt_quote",inputSchema:{type:"object",properties:{side:{type:"string",enum:["buy","sell"],description:'Choose "buy": USDG in for PT-USDG; "sell": PT-USDG in for USDG.'},amount:f},required:["side","amount"],additionalProperties:!1},async execute(n){let o=await y();if(o.timestamp>=e.expiry)throw new u("This PT market matured; use redemption.");let t=p(n.amount,"amount");if(t===0n||!["buy","sell"].includes(String(n.side)))throw new u("Provide buy or sell and a positive base-unit amount.");let a=await i.clientFor(r).readContract({address:e.oracle,abi:_,functionName:"getPtToAssetRate",args:[e.market,0]});if(a===0n)throw new u("PT oracle returned a zero rate.");return{chainId:r,token:F,market:e.market,blockNumber:o.number?.toString(),amountIn:t.toString(),estimatedOutput:(n.side==="buy"?t*10n**18n/a:t*a/10n**18n).toString(),rateE18:a.toString(),caveat:"Oracle spot estimate excludes own price impact and execution fees. Specify minOut explicitly and inspect the actual swap preview."}}},{name:"priors_pt_position",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(n,o){let t=await y(),a=await i.clientFor(r).readContract({address:e.pt,abi:v,functionName:"balanceOf",args:[m(o)]});return{token:F,balance:a.toString(),market:e.market,expiry:e.expiry.toString(),matured:t.timestamp>=e.expiry}}},...["buy","sell","redeem"].map(n=>({name:`priors_pt_${n}`,inputSchema:{type:"object",properties:{amount:f,minOut:f},required:["amount","minOut"],additionalProperties:!1},async execute(o,t){t=m(t);let a=await y(),S=a.timestamp>=e.expiry;if(n==="redeem"!==S)throw new u(S?"Market matured; redeem PT instead.":"PT redemption opens at maturity.");let s=p(o.amount,"amount"),c=p(o.minOut,"minOut");if(s===0n||c===0n)throw new u("amount and minOut must be positive base units.");let x={tokenOut:d.usdg,minTokenOut:c,tokenRedeemSy:d.usdg,pendleSwap:l,swapData:h},R=n==="buy"?k({abi:b,functionName:"swapExactTokenForPt",args:[t,e.market,c,G,{tokenIn:d.usdg,netTokenIn:s,tokenMintSy:d.usdg,pendleSwap:l,swapData:h},A]}):n==="sell"?k({abi:b,functionName:"swapExactPtForToken",args:[t,e.market,s,x,A]}):k({abi:b,functionName:"redeemPyToToken",args:[t,e.yt,s,x]}),P=[i.approval(n==="buy"?d.usdg:e.pt,e.router,s.toString(),r),i.unsignedTx({to:e.router,data:R,value:"0",chainId:r,description:`${n} PT-USDG, exact input ${s}, minimum output ${c} (6 decimals).`})],E=await i.preview(P,t);return{txs:P,summary:`Pendle PT ${n}: ${s} base units, minimum ${c}, receiver ${t}. No external aggregator. ${E.summary}`,terms:T({expiry:e.expiry,market:e.market})}}}))]}}export{e as a,b,Y as c};
@@ -1 +1 @@
1
- import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as O,n as F}from"./NWNYJ26T.js";import{b as l}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as R,parseAbi as U}from"viem";var _={source:"https://github.com/beefyfinance/beefy-v2/blob/main/src/config/promos/chain/robinhood.json",observedAt:"2026-10-31",version:2,boosts:[{id:"moo_alandale-cow-robinhood-weth-shop-vault",address:"0xdC955E855148bE11621a74A5B4588846558215d1",token:"0xEBe70034de92614ebe06Cde98C12257f9397dC0e",vaultId:"alandale-cow-robinhood-weth-shop-vault"},{id:"moo_alandale-cow-robinhood-usdg-net-vault",address:"0x3bB573076462ab4E3De4542cFDAa4f36F0Ce082d",token:"0x857b3971E8038a8f8E2C0Da797145447eFbf6b86",vaultId:"alandale-cow-robinhood-usdg-net-vault"},{id:"moo_alandale-cow-robinhood-weth-usdg-vault",address:"0x13ec60CcFFD2cf989912CCBC038D618d3F56a30E",token:"0x4ED469Ac0080bE3CD192530D482E4d321823e743",vaultId:"alandale-cow-robinhood-weth-usdg-vault"},{id:"moo_alandale-cow-robinhood-weth-lute-vault",address:"0xC5ff71a8754c9A9FC0c27EE297025Ea7eEbDD19d",token:"0xd4A452bB077618b931603DbcB60ea43c05eBEa45",vaultId:"alandale-cow-robinhood-weth-lute-vault"},{id:"moo_alandale-cow-robinhood-usdg-lute-vault",address:"0x83a074A41c06c07631e284463ea2bfc3d2f674c5",token:"0xe50D89C43D0D13eE1439Bb5E94876A1163a26434",vaultId:"alandale-cow-robinhood-usdg-lute-vault"},{id:"moo_alandale-cow-robinhood-weth-spy-vault",address:"0xcdDa7830A6F034d66a46919f3D132f53A56a356d",token:"0x87673A619Fc4F3Fc08068A0BB04f60aA2D04ca62",vaultId:"alandale-cow-robinhood-weth-spy-vault"}]};var C=_.boosts.map(c=>({...c,address:R(c.address.toLowerCase()),token:R(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],P=U(["function stakedToken() view returns(address)","function owner() view returns(address)","function whitelisted(address) view returns(bool)","function earned(address) view returns(address[],uint256[])","function stake(uint256)","function withdraw(uint256)","function getReward()","function exit()","function notifyRewardAmount(address,uint256,uint256)","function removeReward(address,address)","function rescueTokens(address,address)","function setWhitelist(address,bool)","function transferOwnership(address)","function renounceOwnership()"]);function w(c){return D(c,"Provide an address.",S)}function x(c){return O(c,"Invalid Beefy reward-pool integer.")}function I(c){return F(c,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}var V=c=>{async function k(e){try{return await e()}catch(o){throw new d(c.plainError(o))}}function A(e,o){if(e.chainId!==void 0&&e.chainId!==l)throw new d("Beefy requires chain 4663.");for(let n of Object.keys(e))if(!["chainId",...o].includes(n))throw new d(`Unsupported Beefy input: ${n}.`)}function T(e){let o=C.find(n=>n.address===w(e.boost));if(!o)throw new d("Choose a pinned Robinhood Beefy v2 boost from beefy_boosts.");return o}async function y(){let e=c.clientFor(l);if(await e.getChainId()!==l)throw new d("The Beefy endpoint must report chain 4663.");let o=x(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:P,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>x(await e.readContract({address:s,abi:B,functionName:"balanceOf",args:[i],blockNumber:o}));async function a(s){let[i,r]=await Promise.all([e.readContract({address:s,abi:B,functionName:"symbol",blockNumber:o}),e.readContract({address:s,abi:B,functionName:"decimals",blockNumber:o})]);if(typeof i!="string"||!i.trim()||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)throw new d("Invalid Beefy boost token metadata.");return{address:s,symbol:i,decimals:r,chainId:l}}async function u(s,i){if(w(await n(s.address,"stakedToken"))!==s.token)throw new d("The Beefy boost staked token no longer matches its pinned configuration.");let r=await n(s.address,"earned",[i]);if(!Array.isArray(r)||r.length!==2||!Array.isArray(r[0])||!Array.isArray(r[1])||r[0].length!==r[1].length||r[0].length>100)throw new d("Invalid Beefy boost rewards.");let m=r[0].map(w);if(new Set(m).size!==m.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(m.map(async(h,g)=>({token:await a(h),amount:x(r[1][g]).toString()})));return{id:s.id,boost:s.address,vaultId:s.vaultId,staked:{token:await a(s.token),amount:(await t(s.address,i)).toString()},rewards:p,block:o.toString(),chainId:l,source:_.source}}return{read:n,balance:t,token:a,pool:u,blockNumber:o}}function f(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:P,functionName:o,args:n}),value:"0",chainId:l,description:`Beefy reward pool: ${o}.`})}async function E(e,o,n,t){return{txs:e,inputs:t,preview:await c.preview(e,o),summary:n}}return{tools:[{name:"beefy_boosts",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=w(o);let n=await y(),t=[];for(let a of C)t.push(await n.pool(a,o));return{boosts:t,summary:"Pinned Robinhood v2 reward pools. Staked moo receipts keep their underlying vault exposure. Earned amounts are estimates; inspect claim preview. Boost receipt acquisition depends on the corresponding vault adapter."}})},{name:"beefy_boost",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["stake","withdraw","claim","exit"],description:"stake: deposit moo receipts into the pool; withdraw: take staked receipts out; claim: collect rewards; exit: withdraw everything and claim."},amount:{description:'For stake and withdraw: amount of moo receipt (stake token) in base units of that token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals. "all" uses the full balance.',anyOf:[v(),{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n=String(e.action);if(!["stake","withdraw","claim","exit"].includes(n))throw new d("Choose stake, withdraw, claim or exit.");A(e,["boost","action",...["stake","withdraw"].includes(n)?["amount"]:[]]),o=w(o);let t=T(e),a=await y();await a.pool(t,o);let u,s=[];if(n==="stake"||n==="withdraw"){let i=n==="stake"?t.token:t.address,r=await a.balance(i,o),m=e.amount==="all"?r:I(e.amount);if(m===0n||m>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:m.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,m.toString(),l)]:[],f(t.address,n,[m])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[f(t.address,n==="claim"?"getReward":"exit")];return E(u,o,`${n} Beefy boost ${t.id}. Withdraw returns moo receipts; exit also claims rewards. Redeem moo receipts with the matching supported vault adapter afterward. No output amount is guaranteed by these calls.`,s)})},{name:"beefy_boost_manage",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"],description:"Owner or manager call: add a reward (notify_reward), remove a reward, rescue stuck tokens, set a manager, transfer ownership, or renounce it permanently."},token:{...b,description:"Address of the reward token for notify_reward, remove_reward or rescue_tokens."},amount:v('For notify_reward: reward amount in base units of the reward token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals.'),duration:v("For notify_reward: reward period in seconds, at least 3600 (86400 = 1 day). Decimal string."),recipient:{...b,description:"Address that receives removed or rescued tokens, or the new owner for transfer_ownership."},manager:{...b,description:"Address of the manager (reward notifier) to enable or disable with set_manager."},enabled:{type:"boolean",description:"For set_manager: true allows the manager to add rewards, false removes them."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n={notify_reward:["token","amount","duration"],remove_reward:["token","recipient"],rescue_tokens:["token","recipient"],set_manager:["manager","enabled"],transfer_ownership:["recipient"],renounce_ownership:[]},t=String(e.action);if(!Object.hasOwn(n,t))throw new d("Choose a documented Beefy reward-pool management action.");A(e,["boost","action",...n[t]]),o=w(o);let a=T(e),u=await y();if(await u.pool(a,o),!(t==="notify_reward"?await u.read(a.address,"whitelisted",[o])===!0:w(await u.read(a.address,"owner"))===o))throw new d("This wallet does not hold the required Beefy reward-pool owner or manager role.");let i=[],r=[];if(t==="notify_reward"){let p=w(e.token),h=I(e.amount),g=I(e.duration);if(p===a.token||g<3600n)throw new d("Reward token must differ from the stake token and duration must be at least 3600 seconds.");if(await u.balance(p,o)<h)throw new d("Insufficient reward token balance.");r.push({token:p,amount:h.toString()}),i.push(c.approval(p,a.address,h.toString(),l),f(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(f(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[w(e.token),w(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(f(a.address,"setWhitelist",[w(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(f(a.address,"transferOwnership",[w(e.recipient)])):i.push(f(a.address,"renounceOwnership"));let m=t==="remove_reward"?" Removing this reward discards all unclaimed entitlements for that token.":t==="renounce_ownership"?" Renouncing ownership permanently gives up owner administration.":"";return E(i,o,`Beefy owner/manager action ${t} on ${a.address}.${m} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=w(e);let o=await y(),n=[];for(let t of C){let a=await o.pool(t,e);a.staked.amount==="0"&&a.rewards.every(u=>u.amount==="0")||n.push({module:"beefy",id:t.address,chainId:l,assets:[a.staked,...a.rewards.filter(u=>u.amount!=="0")],description:`${t.id}: moo receipt stake and estimated claimable rewards at block ${o.blockNumber}. Unstake/exit before redeeming moo receipts.`})}return n})}};export{C as a,H as b,P as c,V as d};
1
+ import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as O,n as F}from"./NWNYJ26T.js";import{b as l}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as R,parseAbi as U}from"viem";var _={source:"https://github.com/beefyfinance/beefy-v2/blob/main/src/config/promos/chain/robinhood.json",observedAt:"2026-10-31",version:2,boosts:[{id:"moo_alandale-cow-robinhood-weth-shop-vault",address:"0xdC955E855148bE11621a74A5B4588846558215d1",token:"0xEBe70034de92614ebe06Cde98C12257f9397dC0e",vaultId:"alandale-cow-robinhood-weth-shop-vault"},{id:"moo_alandale-cow-robinhood-usdg-net-vault",address:"0x3bB573076462ab4E3De4542cFDAa4f36F0Ce082d",token:"0x857b3971E8038a8f8E2C0Da797145447eFbf6b86",vaultId:"alandale-cow-robinhood-usdg-net-vault"},{id:"moo_alandale-cow-robinhood-weth-usdg-vault",address:"0x13ec60CcFFD2cf989912CCBC038D618d3F56a30E",token:"0x4ED469Ac0080bE3CD192530D482E4d321823e743",vaultId:"alandale-cow-robinhood-weth-usdg-vault"},{id:"moo_alandale-cow-robinhood-weth-lute-vault",address:"0xC5ff71a8754c9A9FC0c27EE297025Ea7eEbDD19d",token:"0xd4A452bB077618b931603DbcB60ea43c05eBEa45",vaultId:"alandale-cow-robinhood-weth-lute-vault"},{id:"moo_alandale-cow-robinhood-usdg-lute-vault",address:"0x83a074A41c06c07631e284463ea2bfc3d2f674c5",token:"0xe50D89C43D0D13eE1439Bb5E94876A1163a26434",vaultId:"alandale-cow-robinhood-usdg-lute-vault"},{id:"moo_alandale-cow-robinhood-weth-spy-vault",address:"0xcdDa7830A6F034d66a46919f3D132f53A56a356d",token:"0x87673A619Fc4F3Fc08068A0BB04f60aA2D04ca62",vaultId:"alandale-cow-robinhood-weth-spy-vault"}]};var C=_.boosts.map(c=>({...c,address:R(c.address.toLowerCase()),token:R(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],P=U(["function stakedToken() view returns(address)","function owner() view returns(address)","function whitelisted(address) view returns(bool)","function earned(address) view returns(address[],uint256[])","function stake(uint256)","function withdraw(uint256)","function getReward()","function exit()","function notifyRewardAmount(address,uint256,uint256)","function removeReward(address,address)","function rescueTokens(address,address)","function setWhitelist(address,bool)","function transferOwnership(address)","function renounceOwnership()"]);function w(c){return D(c,"Provide an address.",S)}function x(c){return O(c,"Invalid Beefy reward-pool integer.")}function I(c){return F(c,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}var V=c=>{async function k(e){try{return await e()}catch(o){throw new d(c.plainError(o))}}function A(e,o){if(e.chainId!==void 0&&e.chainId!==l)throw new d("Beefy requires chain 4663.");for(let n of Object.keys(e))if(!["chainId",...o].includes(n))throw new d(`Unsupported Beefy input: ${n}.`)}function T(e){let o=C.find(n=>n.address===w(e.boost));if(!o)throw new d("Choose a pinned Robinhood Beefy v2 boost from beefy_boosts.");return o}async function y(){let e=c.clientFor(l);if(await e.getChainId()!==l)throw new d("The Beefy endpoint must report chain 4663.");let o=x(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:P,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>x(await e.readContract({address:s,abi:B,functionName:"balanceOf",args:[i],blockNumber:o}));async function a(s){let[i,r]=await Promise.all([e.readContract({address:s,abi:B,functionName:"symbol",blockNumber:o}),e.readContract({address:s,abi:B,functionName:"decimals",blockNumber:o})]);if(typeof i!="string"||!i.trim()||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)throw new d("Invalid Beefy boost token metadata.");return{address:s,symbol:i,decimals:r,chainId:l}}async function u(s,i){if(w(await n(s.address,"stakedToken"))!==s.token)throw new d("The Beefy boost staked token no longer matches its pinned configuration.");let r=await n(s.address,"earned",[i]);if(!Array.isArray(r)||r.length!==2||!Array.isArray(r[0])||!Array.isArray(r[1])||r[0].length!==r[1].length||r[0].length>100)throw new d("Invalid Beefy boost rewards.");let m=r[0].map(w);if(new Set(m).size!==m.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(m.map(async(h,g)=>({token:await a(h),amount:x(r[1][g]).toString()})));return{id:s.id,boost:s.address,vaultId:s.vaultId,staked:{token:await a(s.token),amount:(await t(s.address,i)).toString()},rewards:p,block:o.toString(),chainId:l,source:_.source}}return{read:n,balance:t,token:a,pool:u,blockNumber:o}}function f(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:P,functionName:o,args:n}),value:"0",chainId:l,description:`Beefy reward pool: ${o}.`})}async function E(e,o,n,t){return{txs:e,inputs:t,preview:await c.preview(e,o),summary:n}}return{tools:[{name:"beefy_boosts",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=w(o);let n=await y(),t=[];for(let a of C)t.push(await n.pool(a,o));return{boosts:t,summary:"Pinned Robinhood v2 reward pools. Staked moo receipts keep their underlying vault exposure. Earned amounts are estimates; inspect claim preview. Boost receipt acquisition depends on the corresponding vault adapter."}})},{name:"beefy_boost",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["stake","withdraw","claim","exit"],description:"stake: deposit moo receipts into the pool; withdraw: take staked receipts out; claim: collect rewards; exit: withdraw everything and claim."},amount:{description:'For stake and withdraw: amount of moo receipt (stake token) in base units of that token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals. "all" uses the full balance.',anyOf:[v(),{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n=String(e.action);if(!["stake","withdraw","claim","exit"].includes(n))throw new d("Choose stake, withdraw, claim or exit.");A(e,["boost","action",...["stake","withdraw"].includes(n)?["amount"]:[]]),o=w(o);let t=T(e),a=await y();await a.pool(t,o);let u,s=[];if(n==="stake"||n==="withdraw"){let i=n==="stake"?t.token:t.address,r=await a.balance(i,o),m=e.amount==="all"?r:I(e.amount);if(m===0n||m>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:m.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,m.toString(),l)]:[],f(t.address,n,[m])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[f(t.address,n==="claim"?"getReward":"exit")];return E(u,o,`${n} Beefy boost ${t.id}. Withdraw returns moo receipts; exit also claims rewards. Redeem moo receipts with the matching supported vault adapter afterward. No output amount is guaranteed by these calls.`,s)})},{name:"beefy_boost_manage",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"],description:"Owner or manager call: add a reward (notify_reward), remove a reward, rescue stuck tokens, set a manager, transfer ownership, or renounce it permanently."},token:{...b,description:"Address of the reward token for notify_reward, remove_reward or rescue_tokens."},amount:v('For notify_reward: reward amount in base units of the reward token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals.'),duration:v("For notify_reward: reward period in seconds, at least 3600 (86400 = 1 day). Decimal string."),recipient:{...b,description:"Address that receives removed or rescued tokens, or the new owner for transfer_ownership."},manager:{...b,description:"Address of the manager (reward notifier) to enable or disable with set_manager."},enabled:{type:"boolean",description:"For set_manager: true allows the manager to add rewards, false removes them."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n={notify_reward:["token","amount","duration"],remove_reward:["token","recipient"],rescue_tokens:["token","recipient"],set_manager:["manager","enabled"],transfer_ownership:["recipient"],renounce_ownership:[]},t=String(e.action);if(!Object.hasOwn(n,t))throw new d("Choose a documented Beefy reward-pool management action.");A(e,["boost","action",...n[t]]),o=w(o);let a=T(e),u=await y();if(await u.pool(a,o),!(t==="notify_reward"?await u.read(a.address,"whitelisted",[o])===!0:w(await u.read(a.address,"owner"))===o))throw new d("This wallet does not hold the required Beefy reward-pool owner or manager role.");let i=[],r=[];if(t==="notify_reward"){let p=w(e.token),h=I(e.amount),g=I(e.duration);if(p===a.token||g<3600n)throw new d("Reward token must differ from the stake token and duration must be at least 3600 seconds.");if(await u.balance(p,o)<h)throw new d("Insufficient reward token balance.");r.push({token:p,amount:h.toString()}),i.push(c.approval(p,a.address,h.toString(),l),f(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(f(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[w(e.token),w(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(f(a.address,"setWhitelist",[w(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(f(a.address,"transferOwnership",[w(e.recipient)])):i.push(f(a.address,"renounceOwnership"));let m=t==="remove_reward"?" Removing this reward discards all unclaimed entitlements for that token.":t==="renounce_ownership"?" Renouncing ownership permanently gives up owner administration.":"";return E(i,o,`Beefy owner/manager action ${t} on ${a.address}.${m} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=w(e);let o=await y(),n=[];for(let t of C){let a=await o.pool(t,e);a.staked.amount==="0"&&a.rewards.every(u=>u.amount==="0")||n.push({module:"beefy",id:t.address,chainId:l,assets:[a.staked,...a.rewards.filter(u=>u.amount!=="0")],description:`${t.id}: moo receipt stake and estimated claimable rewards at block ${o.blockNumber}. Unstake/exit before redeeming moo receipts.`})}return n})}};export{C as a,H as b,P as c,V as d};
@@ -1,2 +1,2 @@
1
- import{g as c}from"./NWNYJ26T.js";import{b as a,j as l}from"./TI727O2H.js";import{a as f}from"./XSD5NL7J.js";import{formatUnits as b,getAddress as d,hashTypedData as w,parseAbi as I}from"viem";var p=d("0x8BE478c754D9124D11e78dB20F5bf4dA45403275"),h=d("0x0c5091235A25bBFD3F5a009cBe04120D0CBAD573"),x=6228n,_="https://priors.trade/prove",$="https://priors.trade/invite",m=1800,k=3600,S=/^[0-9a-f]{32}$/,A=/^priors-invite:(\d{1,10}):(\d{1,12}):(0x[0-9a-fA-F]{130})$/,g=I(["function amount() view returns (uint256)","function unusedAfter() view returns (uint64)","function bonds(uint256 agentId) view returns ((address depositor, uint64 at, uint256 amount, uint256 qualifiedAt))","function releasable(uint256 agentId) view returns (bool)","function unusedReleaseAt(uint256 agentId) view returns (uint256)","function progress(uint256 agentId) view returns (uint256 repaid, uint256 needed)","function deposit(uint256 agentId)","function release(uint256 agentId)","error AlreadyBonded(uint256 agentId)","error NotOwner(uint256 agentId)","error AgentDefaulted(uint256 agentId)","error NoBond(uint256 agentId)","error NotReleasable(uint256 agentId)"]);async function E(e,t){let r=e.clientFor(a),n=await r.getBlockNumber({cacheTime:0}),[i,o,s]=await Promise.all([r.readContract({address:p,abi:g,functionName:"amount",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedAfter",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedReleaseAt",args:[t],blockNumber:n})]);if(typeof i!="bigint"||i<0n||typeof o!="bigint"||o<0n||typeof s!="bigint"||s<0n)throw new f("Priors bond terms are unavailable. Read amount, unusedAfter and unusedReleaseAt again before posting a bond.");return{amount:i.toString(),unusedAfter:o.toString(),unusedReleaseAt:s.toString(),blockNumber:n.toString(),summary:`Bond first: the starter line requires ${b(i,6)} USDG locked for at least ${o} seconds (${Number(o)/86400} days) after posting${s?`; unusedReleaseAt(${t}) is ${s} Unix seconds`:"; the exact release time is read after posting"}. Release requires no line and no open loan; default can forfeit the bond. Invites are not guaranteed. The credit score can lag qualifying repayments.`}}var R="(uint256 agentId, uint256 sponsorId, address owner, uint256 maxPremiumBps, uint256 nonce, uint256 deadline)",B=I(["function agentId() view returns (uint256)","function firstLined(uint256 id) view returns (bool)","function inviteDigest(uint256 id, uint64 expiry) view returns (bytes32)","function inviters(address who) view returns (bool)","function inviteUsed(bytes32 digest) view returns (bool)","function epochRoom() view returns (uint256)","function rules() view returns (uint256 reserveBps, uint256 firstLine, uint256 secondLine, uint256 epochCap, uint64 epochLength, uint64 minSeasoning, uint256 minQualified, uint256 minScore, uint64 idleAfter)",`function firstLine(uint256 id, uint64 expiry, bytes invite, ${R} c, bytes consentSig)`,"error NotAdopted()","error AlreadyLined(uint256 agentId)","error OwnerDefaulted(address owner)","error EpochCapReached(uint256 wanted, uint256 left)","error NotInvited(uint256 agentId, address signer)","error InviteExpired(uint256 agentId, uint64 expiry)","error InviteUsed(uint256 agentId)","error BadConsent()","error ConsentExpired()","error PremiumTooHigh(uint256 bps, uint256 cap)","error InsufficientBacking(uint256 rootId, uint256 requested, uint256 free)","error AgentDefaulted(uint256 agentId)","error IsRoot(uint256 agentId)","error V1Busy(uint256 agentId)","error LoanOpen(uint256 agentId)","error InvalidAgent(uint256 id)","error Paused()","error ECDSAInvalidSignature()","error ECDSAInvalidSignatureLength(uint256 length)","error ECDSAInvalidSignatureS(bytes32 s)"]),v={Consent:[{name:"agentId",type:"uint256"},{name:"sponsorId",type:"uint256"},{name:"owner",type:"address"},{name:"maxPremiumBps",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]};function D(){return{name:"Priors Credit",version:"2",chainId:a,verifyingContract:d(l[4663].priors.pool.address)}}function q(e){return{domain:{...D()},types:{Consent:v.Consent.map(t=>({...t}))},primaryType:"Consent",message:{agentId:e.agentId,sponsorId:x.toString(),owner:d(e.owner),maxPremiumBps:"0",nonce:e.nonce,deadline:e.deadline}}}function L(e){return w(e)}function U(e,t){return w({domain:{name:"Priors Treasury",version:"4",chainId:a,verifyingContract:h},types:{Invite:[{name:"agentId",type:"uint256"},{name:"expiry",type:"uint64"}]},primaryType:"Invite",message:{agentId:e,expiry:t}})}function O(e,t,r){return["priors.trade seat request","",`I own agent #${e} on Robinhood Chain and I am asking for a seat.`,"Asked from the priors.trade start page","","This signature only proves ownership. It sends no transaction and moves no funds.","",`request: ${t}`,`expires: ${new Date(r*1e3).toISOString().replace(".000","")}`].join(`
1
+ import{g as c}from"./NWNYJ26T.js";import{b as a,j as l}from"./EWZFZUVF.js";import{a as f}from"./XSD5NL7J.js";import{formatUnits as b,getAddress as d,hashTypedData as w,parseAbi as I}from"viem";var p=d("0x8BE478c754D9124D11e78dB20F5bf4dA45403275"),h=d("0x0c5091235A25bBFD3F5a009cBe04120D0CBAD573"),x=6228n,_="https://priors.trade/prove",$="https://priors.trade/invite",m=1800,k=3600,S=/^[0-9a-f]{32}$/,A=/^priors-invite:(\d{1,10}):(\d{1,12}):(0x[0-9a-fA-F]{130})$/,g=I(["function amount() view returns (uint256)","function unusedAfter() view returns (uint64)","function bonds(uint256 agentId) view returns ((address depositor, uint64 at, uint256 amount, uint256 qualifiedAt))","function releasable(uint256 agentId) view returns (bool)","function unusedReleaseAt(uint256 agentId) view returns (uint256)","function progress(uint256 agentId) view returns (uint256 repaid, uint256 needed)","function deposit(uint256 agentId)","function release(uint256 agentId)","error AlreadyBonded(uint256 agentId)","error NotOwner(uint256 agentId)","error AgentDefaulted(uint256 agentId)","error NoBond(uint256 agentId)","error NotReleasable(uint256 agentId)"]);async function E(e,t){let r=e.clientFor(a),n=await r.getBlockNumber({cacheTime:0}),[i,o,s]=await Promise.all([r.readContract({address:p,abi:g,functionName:"amount",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedAfter",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedReleaseAt",args:[t],blockNumber:n})]);if(typeof i!="bigint"||i<0n||typeof o!="bigint"||o<0n||typeof s!="bigint"||s<0n)throw new f("Priors bond terms are unavailable. Read amount, unusedAfter and unusedReleaseAt again before posting a bond.");return{amount:i.toString(),unusedAfter:o.toString(),unusedReleaseAt:s.toString(),blockNumber:n.toString(),summary:`Bond first: the starter line requires ${b(i,6)} USDG locked for at least ${o} seconds (${Number(o)/86400} days) after posting${s?`; unusedReleaseAt(${t}) is ${s} Unix seconds`:"; the exact release time is read after posting"}. Release requires no line and no open loan; default can forfeit the bond. Invites are not guaranteed. The credit score can lag qualifying repayments.`}}var R="(uint256 agentId, uint256 sponsorId, address owner, uint256 maxPremiumBps, uint256 nonce, uint256 deadline)",B=I(["function agentId() view returns (uint256)","function firstLined(uint256 id) view returns (bool)","function inviteDigest(uint256 id, uint64 expiry) view returns (bytes32)","function inviters(address who) view returns (bool)","function inviteUsed(bytes32 digest) view returns (bool)","function epochRoom() view returns (uint256)","function rules() view returns (uint256 reserveBps, uint256 firstLine, uint256 secondLine, uint256 epochCap, uint64 epochLength, uint64 minSeasoning, uint256 minQualified, uint256 minScore, uint64 idleAfter)",`function firstLine(uint256 id, uint64 expiry, bytes invite, ${R} c, bytes consentSig)`,"error NotAdopted()","error AlreadyLined(uint256 agentId)","error OwnerDefaulted(address owner)","error EpochCapReached(uint256 wanted, uint256 left)","error NotInvited(uint256 agentId, address signer)","error InviteExpired(uint256 agentId, uint64 expiry)","error InviteUsed(uint256 agentId)","error BadConsent()","error ConsentExpired()","error PremiumTooHigh(uint256 bps, uint256 cap)","error InsufficientBacking(uint256 rootId, uint256 requested, uint256 free)","error AgentDefaulted(uint256 agentId)","error IsRoot(uint256 agentId)","error V1Busy(uint256 agentId)","error LoanOpen(uint256 agentId)","error InvalidAgent(uint256 id)","error Paused()","error ECDSAInvalidSignature()","error ECDSAInvalidSignatureLength(uint256 length)","error ECDSAInvalidSignatureS(bytes32 s)"]),v={Consent:[{name:"agentId",type:"uint256"},{name:"sponsorId",type:"uint256"},{name:"owner",type:"address"},{name:"maxPremiumBps",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]};function D(){return{name:"Priors Credit",version:"2",chainId:a,verifyingContract:d(l[4663].priors.pool.address)}}function q(e){return{domain:{...D()},types:{Consent:v.Consent.map(t=>({...t}))},primaryType:"Consent",message:{agentId:e.agentId,sponsorId:x.toString(),owner:d(e.owner),maxPremiumBps:"0",nonce:e.nonce,deadline:e.deadline}}}function L(e){return w(e)}function U(e,t){return w({domain:{name:"Priors Treasury",version:"4",chainId:a,verifyingContract:h},types:{Invite:[{name:"agentId",type:"uint256"},{name:"expiry",type:"uint64"}]},primaryType:"Invite",message:{agentId:e,expiry:t}})}function O(e,t,r){return["priors.trade seat request","",`I own agent #${e} on Robinhood Chain and I am asking for a seat.`,"Asked from the priors.trade start page","","This signature only proves ownership. It sends no transaction and moves no funds.","",`request: ${t}`,`expires: ${new Date(r*1e3).toISOString().replace(".000","")}`].join(`
2
2
  `)}var u=e=>typeof e=="string"?JSON.stringify(e.length>80?`${e.slice(0,80)}...`:e):typeof e=="number"?String(e):e===null?"null":typeof e;function V(e,t){let r=o=>({ok:!1,why:o});if(!e||typeof e!="object"||Array.isArray(e))return r("its answer is not the bot's form");let n=e;if(n.ok!==!0)return{ok:!1,refused:!0,why:typeof n.error=="string"&&n.error?n.error:"it answered no, with no reason"};if(typeof n.agentId!="string"&&typeof n.agentId!="number"||String(n.agentId)!==t.agentId)return r(`it is for agent ${u(n.agentId)}, not agent #${t.agentId}`);if(typeof n.owner!="string"||!c(n.owner,t.owner))return r(`it names ${u(n.owner)} as the agent's owner, not this wallet (${t.owner})`);if(typeof n.n!="string"||!S.test(n.n))return r(`its request ${u(n.n)} is not the bot's form (32 hex digits)`);if(typeof n.exp!="number"||!Number.isSafeInteger(n.exp))return r(`its expiry ${u(n.exp)} is not a time`);if(n.exp<=t.now)return r(`its expiry (${new Date(n.exp*1e3).toISOString()}) has already passed`);if(n.exp>t.now+m+300)return r(`its expiry (${new Date(n.exp*1e3).toISOString()}) is further away than the bot's ${m/60} minutes`);let i=O(t.agentId,n.n,n.exp);if(typeof n.message!="string")return r("it carries no message");if(n.message!==i){let o=0;for(;o<i.length&&n.message[o]===i[o];)o++;return r(`its message is not the bot's own form for agent #${t.agentId}, request ${n.n} and that expiry: the two first differ at character ${o+1} of ${i.length}`)}return{ok:!0,n:n.n,exp:n.exp,message:i}}function H(e,t,r){let n=A.exec(typeof e=="string"?e:"");if(!n)return{ok:!1,why:"it is not an invite code (priors-invite:<id>:<expiry>:<signature>)"};if(n[1]!==t)return{ok:!1,why:`it is for agent #${n[1]}, not agent #${t}`};let i=Number(n[2]);return i<=r?{ok:!1,why:`it expired at ${new Date(i*1e3).toISOString()}`}:{ok:!0,expiry:BigInt(n[2]),signature:n[3]}}var y=e=>`${new Date(e*1e3).toISOString().slice(0,16).replace("T"," ")} UTC`;function F(e){let t=typeof e.reopensAt=="number"&&Number.isSafeInteger(e.reopensAt)&&e.reopensAt>0?e.reopensAt:null;switch(e.reason){case"default":return"A default on this wallet's record stops new lines for its agents, so a bond would bring no invite.";case"day":return"Today's automatic invites are taken. New ones open at 00:00 UTC: call priors_starter_line again after that.";case"room":return e.held===!0&&t?`This week's first lines are held by invites that haven't been used yet. One may be free after ${y(t)}: call priors_starter_line again then.`:`This week's first lines are taken.${t?` New ones open after ${y(t)}: call priors_starter_line again then.`:" Come back next week."}`;case"owner":return`This wallet already used its ${typeof e.perOwner=="number"&&Number.isSafeInteger(e.perOwner)&&e.perOwner>0?e.perOwner:2} automatic invites, so a bond would bring no invite.`;case"waiting":return"Another agent of this wallet has an invite waiting. Use it, or let it expire, before asking for this one.";case"backing":return"The treasury can't back a new line right now. Try again later.";default:return"Automatic invites aren't open right now, so a bond would bring no invite. Try again later."}}export{p as a,h as b,x as c,_ as d,$ as e,m as f,k as g,S as h,A as i,g as j,E as k,B as l,v as m,D as n,q as o,L as p,U as q,O as r,V as s,H as t,F as u};
@@ -1 +1 @@
1
- import{a as l}from"./43LI5NKJ.js";import{a as F}from"./66F5ZH34.js";import{g as D}from"./NWNYJ26T.js";import{b as U}from"./IX3GZMTM.js";import{b as c}from"./TI727O2H.js";import{a as w}from"./XSD5NL7J.js";import{encodeFunctionData as A,getAddress as S,parseAbi as _}from"viem";var N={address:S("0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"),symbol:"NET",decimals:9,chainId:c},r={address:S("0xb773ec2C326B7f98a5a83fc098825492F020a4c7"),symbol:"sNET",decimals:9,chainId:c},u={address:S("0x63C12667638f2Ae6fC6ae09B43D98Ec84a8586eA"),symbol:"wsNET",decimals:18,chainId:c},i=S("0xB078cc304A0B264C5F3680DC0488954ACcd02E87"),k=S("0xA1ee052EC32532304a7522bd9A4b594eC28fF1b1"),tt=[i,u.address,k],p=_(["function net() view returns (address)","function sNet() view returns (address)","function warmupEpochs() view returns (uint256)","function epoch() view returns (uint64 length,uint64 number,uint64 end,uint256 distribute)","function warmup(address) view returns (uint256 gons,uint64 releaseEpoch)","function totalStaked() view returns (uint256)","function enabled() view returns (bool)","function claim(address to) returns (uint256)","function rebase()","function stake(address to, uint256 amount) returns (uint256)","function unstake(address to, uint256 amount) returns (uint256)"]),E=_(["function sNet() view returns (address)","function wrap(uint256 sNetAmount) returns (uint256)","function unwrap(uint256 wsAmount) returns (uint256)","function sNetToWs(uint256 sNetAmount) view returns (uint256)","function wsToSNet(uint256 wsAmount) view returns (uint256)"]),$=_(["function net() view returns (address)","function sNet() view returns (address)","function staking() view returns (address)","function wsNet() view returns (address)","function zap(uint256 netAmount) returns (uint256)"]),W=_(["function balanceOf(address owner) view returns (uint256)","function balanceForGons(uint256) view returns (uint256)"]),z="The expected output is a chain-read estimate; these calls encode no minimum output. No transaction was sent.",O=o=>({description:`${o.symbol} amount in base units (${o.symbol} has ${o.decimals} decimals; "${"1".padEnd(o.decimals+1,"0")}" = 1 ${o.symbol}), or "max" for the whole wallet balance.`,anyOf:[F(`Positive ${o.symbol} amount in integer base units (${o.decimals} decimals).`),{const:"max",description:`The fresh full ${o.symbol} wallet balance.`}]}),et=o=>{async function v(e){try{return await e()}catch(t){throw new w(o.plainError(t))}}function y(e,t){if(Object.keys(e).some(n=>!t.includes(n)))throw new w("Unsupported NetNet staking argument. Use the fields in the tool schema.")}async function f(e=!1){let t=o.clientFor(c);if(await t.getChainId()!==c)throw new w("NetNet staking requires chain 4663.");let n=[t.readContract({address:i,abi:p,functionName:"net"}),t.readContract({address:i,abi:p,functionName:"sNet"}),t.readContract({address:u.address,abi:E,functionName:"sNet"}),...e?[t.readContract({address:k,abi:$,functionName:"net"}),t.readContract({address:k,abi:$,functionName:"sNet"}),t.readContract({address:k,abi:$,functionName:"staking"}),t.readContract({address:k,abi:$,functionName:"wsNet"})]:[]],[s,a,d,...m]=await Promise.all(n),b=[N.address,r.address,r.address,...e?[N.address,r.address,i,u.address]:[]];if(![s,a,d,...m].every((T,q)=>typeof T=="string"&&D(T,b[q])))throw new w("NetNet staking contracts do not report the pinned NET, sNET and wsNET links.");return t}async function x(e,t){return o.clientFor(c).readContract({address:e.address,abi:W,functionName:"balanceOf",args:[t]})}async function C(e,t,n){let s=await x(t,n),a;if(e==="max")a=s;else{if(typeof e!="string")throw new w(`Provide an integer ${t.symbol} amount in base units, or "max".`);a=U(e)}if(a<=0n||a>=1n<<256n)throw new w(`This wallet has no ${t.symbol} to use; the amount must be positive.`);if(a>s)throw new w(`Insufficient ${t.symbol}: wallet holds ${s.toString()} base units, requested ${a.toString()}.`);return a}async function g(e,t,n,s){let a=await o.preview(e,t),d=a.changes.map(({token:m,amount:b})=>{let T=b.startsWith("-");return`${T?"-":"+"}${o.formatAmount(T?b.slice(1):b,m.decimals)} ${m.symbol}`}).join(", ");return{txs:e,preview:a,expectedOutput:n,summary:`${s} ${a.summary} ${d?`Estimated changes: ${d}. `:""}${z}`}}let h=(e,t,n)=>o.unsignedTx({to:e,data:t,value:"0",chainId:c,description:n});async function j(e,t){if(y(e,["amount","wrap"]),l(t),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new w("wrap must be a boolean.");let n=await f(e.wrap===!0);if(e.amount==="max")throw new w("Provide an exact NET amount in base units to stake.");let s=await n.readContract({address:i,abi:p,functionName:"warmupEpochs"});if(s!==0n&&e.wrap===!0)throw new w("NetNet warmup prevents immediate Zap wrapping; stake directly, then claim matured sNET before wrapping.");let a=await C(e.amount,N,t),d=o.formatAmount(a.toString(),N.decimals);if(e.wrap===!0){let m=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[a]});return g([o.approval(N.address,k,a.toString(),c),h(k,A({abi:$,functionName:"zap",args:[a]}),`Stake ${d} NET and wrap it into wsNET with NetNet's Zap.`)],t,{token:u,amount:m.toString()},`Approve exactly ${d} NET, then stake and wrap it into wsNET in one call.`)}return g([o.approval(N.address,i,a.toString(),c),h(i,A({abi:p,functionName:"stake",args:[S(t),a]}),`Stake ${d} NET into sNET.`)],t,{token:r,amount:s===0n?a.toString():"0"},s===0n?`Approve exactly ${d} NET, then stake it 1:1 into rebasing sNET.`:`Approve exactly ${d} NET and stake it into a ${s}-epoch warmup. No immediate sNET receipt; netnet_claim_stake releases matured sNET. Another stake resets your release epoch.`)}async function B(e,t){y(e,["amount"]),l(t),await f();let n=await C(e.amount,r,t),s=o.formatAmount(n.toString(),r.decimals);return g([o.approval(r.address,i,n.toString(),c),h(i,A({abi:p,functionName:"unstake",args:[S(t),n]}),`Unstake ${s} sNET into NET.`)],t,{token:N,amount:n.toString()},`Approve exactly ${s} sNET, then unstake it 1:1 into NET.`)}async function L(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,r,t),a=o.formatAmount(s.toString(),r.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[s]});return g([o.approval(r.address,u.address,s.toString(),c),h(u.address,A({abi:E,functionName:"wrap",args:[s]}),`Wrap ${a} sNET into wsNET.`)],t,{token:u,amount:d.toString()},`Approve exactly ${a} sNET, then wrap it into non-rebasing wsNET, the Loopback collateral.`)}async function G(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,u,t),a=o.formatAmount(s.toString(),u.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});return g([h(u.address,A({abi:E,functionName:"unwrap",args:[s]}),`Unwrap ${a} wsNET into sNET.`)],t,{token:r,amount:d.toString()},`Unwrap ${a} wsNET into sNET; no approval is needed.`)}async function M(e){return v(async()=>{l(e);let t=await f(),[n,s]=await Promise.all([x(r,e),x(u,e)]),a=[];if(n>0n&&a.push({module:"netnet",id:`${c}:${r.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:n.toString()}],description:`${o.formatAmount(n.toString(),r.decimals)} sNET staked NET (rebasing; unstakes 1:1 into NET with netnet_unstake).`}),s>0n){let m=await t.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});a.push({module:"netnet",id:`${c}:${u.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:m.toString()}],description:`${o.formatAmount(s.toString(),u.decimals)} wsNET in the wallet, worth ${o.formatAmount(m.toString(),r.decimals)} sNET (NET 1:1) at the current index. wsNET posted as Morpho collateral appears under Morpho instead.`})}if(await t.readContract({address:i,abi:p,functionName:"warmupEpochs"})>0n){let m=await I({},e);BigInt(m.warmup.pendingSNet)>0n&&a.push({module:"netnet",id:`${c}:${i.toLowerCase()}:warmup`,chainId:c,assets:[{token:N,amount:m.warmup.pendingSNet}],description:`Pending NetNet warmup stake; releases sNET at epoch ${m.warmup.releaseEpoch}. Claim with netnet_claim_stake, then wrap or unstake.`})}return a})}async function I(e,t){y(e,[]),l(t);let n=await f(),[s,a,d,m,b]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.readContract({address:i,abi:p,functionName:"warmup",args:[t]}),n.readContract({address:i,abi:p,functionName:"warmupEpochs"}),n.readContract({address:i,abi:p,functionName:"totalStaked"}),n.readContract({address:i,abi:p,functionName:"enabled"})]),T=await n.readContract({address:r.address,abi:W,functionName:"balanceForGons",args:[a[0]]});return{chainId:c,staking:i,tokens:{net:N,sNet:r,wsNet:u},enabled:b,epoch:{length:s[0].toString(),number:s[1].toString(),end:s[2].toString(),distribute:s[3].toString()},warmupEpochs:d.toString(),totalStaked:m.toString(),warmup:{gons:a[0].toString(),releaseEpoch:a[1].toString(),pendingSNet:T.toString(),matured:a[0]>0n&&s[1]>=a[1]},caveat:"Warmup uses epoch numbers, not wall-clock time. Each rebase advances at most one due epoch; a claim also rebases once if due. A new stake resets the warmup release epoch."}}async function R(e,t){let n=await I(e,t);if(!n.enabled||!n.warmup.matured)throw new w("No matured NetNet warmup stake. Read netnet_staking_status and advance a due epoch before claiming.");return g([h(i,A({abi:p,functionName:"claim",args:[t]}),`Claim matured sNET to this wallet ${t}.`)],t,{token:r,amount:n.warmup.pendingSNet},"Claim matured NetNet staking warmup; rebase may change the sNET receipt.")}async function Z(e,t){y(e,[]),l(t);let n=await f(),[s,a,d]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.getBlock(),n.readContract({address:i,abi:p,functionName:"enabled"})]);if(!d||a.timestamp<s[2])throw new w("No enabled NetNet epoch is due to rebase.");return g([h(i,A({abi:p,functionName:"rebase"}),"Advance one due NetNet staking epoch and checkpoint its oracle.")],t,{token:r,amount:"0"},"Advance one due epoch. Distribution depends on live protocol state; this does not guarantee a reward.")}let P=(e,t,n)=>({name:e,inputSchema:{type:"object",properties:t,required:["amount"],additionalProperties:!1},execute:(s,a)=>v(()=>n(s,a))});return{positions:M,tools:[{name:"netnet_staking_status",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>I(e,t))},{name:"netnet_claim_stake",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>R(e,t))},{name:"netnet_rebase",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>Z(e,t))},P("netnet_stake",{amount:F("Positive NET amount in integer base units (9 decimals)."),wrap:{type:"boolean",default:!1,description:"Stake and wrap into wsNET in one call through NetNet's Zap."}},j),P("netnet_wrap",{amount:O(r)},L),P("netnet_unwrap",{amount:O(u)},G),P("netnet_unstake",{amount:O(r)},B)]}};export{N as a,r as b,u as c,i as d,k as e,tt as f,et as g};
1
+ import{a as l}from"./43LI5NKJ.js";import{a as F}from"./66F5ZH34.js";import{g as D}from"./NWNYJ26T.js";import{b as U}from"./IX3GZMTM.js";import{b as c}from"./EWZFZUVF.js";import{a as w}from"./XSD5NL7J.js";import{encodeFunctionData as A,getAddress as S,parseAbi as _}from"viem";var N={address:S("0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"),symbol:"NET",decimals:9,chainId:c},r={address:S("0xb773ec2C326B7f98a5a83fc098825492F020a4c7"),symbol:"sNET",decimals:9,chainId:c},u={address:S("0x63C12667638f2Ae6fC6ae09B43D98Ec84a8586eA"),symbol:"wsNET",decimals:18,chainId:c},i=S("0xB078cc304A0B264C5F3680DC0488954ACcd02E87"),k=S("0xA1ee052EC32532304a7522bd9A4b594eC28fF1b1"),tt=[i,u.address,k],p=_(["function net() view returns (address)","function sNet() view returns (address)","function warmupEpochs() view returns (uint256)","function epoch() view returns (uint64 length,uint64 number,uint64 end,uint256 distribute)","function warmup(address) view returns (uint256 gons,uint64 releaseEpoch)","function totalStaked() view returns (uint256)","function enabled() view returns (bool)","function claim(address to) returns (uint256)","function rebase()","function stake(address to, uint256 amount) returns (uint256)","function unstake(address to, uint256 amount) returns (uint256)"]),E=_(["function sNet() view returns (address)","function wrap(uint256 sNetAmount) returns (uint256)","function unwrap(uint256 wsAmount) returns (uint256)","function sNetToWs(uint256 sNetAmount) view returns (uint256)","function wsToSNet(uint256 wsAmount) view returns (uint256)"]),$=_(["function net() view returns (address)","function sNet() view returns (address)","function staking() view returns (address)","function wsNet() view returns (address)","function zap(uint256 netAmount) returns (uint256)"]),W=_(["function balanceOf(address owner) view returns (uint256)","function balanceForGons(uint256) view returns (uint256)"]),z="The expected output is a chain-read estimate; these calls encode no minimum output. No transaction was sent.",O=o=>({description:`${o.symbol} amount in base units (${o.symbol} has ${o.decimals} decimals; "${"1".padEnd(o.decimals+1,"0")}" = 1 ${o.symbol}), or "max" for the whole wallet balance.`,anyOf:[F(`Positive ${o.symbol} amount in integer base units (${o.decimals} decimals).`),{const:"max",description:`The fresh full ${o.symbol} wallet balance.`}]}),et=o=>{async function v(e){try{return await e()}catch(t){throw new w(o.plainError(t))}}function y(e,t){if(Object.keys(e).some(n=>!t.includes(n)))throw new w("Unsupported NetNet staking argument. Use the fields in the tool schema.")}async function f(e=!1){let t=o.clientFor(c);if(await t.getChainId()!==c)throw new w("NetNet staking requires chain 4663.");let n=[t.readContract({address:i,abi:p,functionName:"net"}),t.readContract({address:i,abi:p,functionName:"sNet"}),t.readContract({address:u.address,abi:E,functionName:"sNet"}),...e?[t.readContract({address:k,abi:$,functionName:"net"}),t.readContract({address:k,abi:$,functionName:"sNet"}),t.readContract({address:k,abi:$,functionName:"staking"}),t.readContract({address:k,abi:$,functionName:"wsNet"})]:[]],[s,a,d,...m]=await Promise.all(n),b=[N.address,r.address,r.address,...e?[N.address,r.address,i,u.address]:[]];if(![s,a,d,...m].every((T,q)=>typeof T=="string"&&D(T,b[q])))throw new w("NetNet staking contracts do not report the pinned NET, sNET and wsNET links.");return t}async function x(e,t){return o.clientFor(c).readContract({address:e.address,abi:W,functionName:"balanceOf",args:[t]})}async function C(e,t,n){let s=await x(t,n),a;if(e==="max")a=s;else{if(typeof e!="string")throw new w(`Provide an integer ${t.symbol} amount in base units, or "max".`);a=U(e)}if(a<=0n||a>=1n<<256n)throw new w(`This wallet has no ${t.symbol} to use; the amount must be positive.`);if(a>s)throw new w(`Insufficient ${t.symbol}: wallet holds ${s.toString()} base units, requested ${a.toString()}.`);return a}async function g(e,t,n,s){let a=await o.preview(e,t),d=a.changes.map(({token:m,amount:b})=>{let T=b.startsWith("-");return`${T?"-":"+"}${o.formatAmount(T?b.slice(1):b,m.decimals)} ${m.symbol}`}).join(", ");return{txs:e,preview:a,expectedOutput:n,summary:`${s} ${a.summary} ${d?`Estimated changes: ${d}. `:""}${z}`}}let h=(e,t,n)=>o.unsignedTx({to:e,data:t,value:"0",chainId:c,description:n});async function j(e,t){if(y(e,["amount","wrap"]),l(t),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new w("wrap must be a boolean.");let n=await f(e.wrap===!0);if(e.amount==="max")throw new w("Provide an exact NET amount in base units to stake.");let s=await n.readContract({address:i,abi:p,functionName:"warmupEpochs"});if(s!==0n&&e.wrap===!0)throw new w("NetNet warmup prevents immediate Zap wrapping; stake directly, then claim matured sNET before wrapping.");let a=await C(e.amount,N,t),d=o.formatAmount(a.toString(),N.decimals);if(e.wrap===!0){let m=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[a]});return g([o.approval(N.address,k,a.toString(),c),h(k,A({abi:$,functionName:"zap",args:[a]}),`Stake ${d} NET and wrap it into wsNET with NetNet's Zap.`)],t,{token:u,amount:m.toString()},`Approve exactly ${d} NET, then stake and wrap it into wsNET in one call.`)}return g([o.approval(N.address,i,a.toString(),c),h(i,A({abi:p,functionName:"stake",args:[S(t),a]}),`Stake ${d} NET into sNET.`)],t,{token:r,amount:s===0n?a.toString():"0"},s===0n?`Approve exactly ${d} NET, then stake it 1:1 into rebasing sNET.`:`Approve exactly ${d} NET and stake it into a ${s}-epoch warmup. No immediate sNET receipt; netnet_claim_stake releases matured sNET. Another stake resets your release epoch.`)}async function B(e,t){y(e,["amount"]),l(t),await f();let n=await C(e.amount,r,t),s=o.formatAmount(n.toString(),r.decimals);return g([o.approval(r.address,i,n.toString(),c),h(i,A({abi:p,functionName:"unstake",args:[S(t),n]}),`Unstake ${s} sNET into NET.`)],t,{token:N,amount:n.toString()},`Approve exactly ${s} sNET, then unstake it 1:1 into NET.`)}async function L(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,r,t),a=o.formatAmount(s.toString(),r.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[s]});return g([o.approval(r.address,u.address,s.toString(),c),h(u.address,A({abi:E,functionName:"wrap",args:[s]}),`Wrap ${a} sNET into wsNET.`)],t,{token:u,amount:d.toString()},`Approve exactly ${a} sNET, then wrap it into non-rebasing wsNET, the Loopback collateral.`)}async function G(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,u,t),a=o.formatAmount(s.toString(),u.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});return g([h(u.address,A({abi:E,functionName:"unwrap",args:[s]}),`Unwrap ${a} wsNET into sNET.`)],t,{token:r,amount:d.toString()},`Unwrap ${a} wsNET into sNET; no approval is needed.`)}async function M(e){return v(async()=>{l(e);let t=await f(),[n,s]=await Promise.all([x(r,e),x(u,e)]),a=[];if(n>0n&&a.push({module:"netnet",id:`${c}:${r.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:n.toString()}],description:`${o.formatAmount(n.toString(),r.decimals)} sNET staked NET (rebasing; unstakes 1:1 into NET with netnet_unstake).`}),s>0n){let m=await t.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});a.push({module:"netnet",id:`${c}:${u.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:m.toString()}],description:`${o.formatAmount(s.toString(),u.decimals)} wsNET in the wallet, worth ${o.formatAmount(m.toString(),r.decimals)} sNET (NET 1:1) at the current index. wsNET posted as Morpho collateral appears under Morpho instead.`})}if(await t.readContract({address:i,abi:p,functionName:"warmupEpochs"})>0n){let m=await I({},e);BigInt(m.warmup.pendingSNet)>0n&&a.push({module:"netnet",id:`${c}:${i.toLowerCase()}:warmup`,chainId:c,assets:[{token:N,amount:m.warmup.pendingSNet}],description:`Pending NetNet warmup stake; releases sNET at epoch ${m.warmup.releaseEpoch}. Claim with netnet_claim_stake, then wrap or unstake.`})}return a})}async function I(e,t){y(e,[]),l(t);let n=await f(),[s,a,d,m,b]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.readContract({address:i,abi:p,functionName:"warmup",args:[t]}),n.readContract({address:i,abi:p,functionName:"warmupEpochs"}),n.readContract({address:i,abi:p,functionName:"totalStaked"}),n.readContract({address:i,abi:p,functionName:"enabled"})]),T=await n.readContract({address:r.address,abi:W,functionName:"balanceForGons",args:[a[0]]});return{chainId:c,staking:i,tokens:{net:N,sNet:r,wsNet:u},enabled:b,epoch:{length:s[0].toString(),number:s[1].toString(),end:s[2].toString(),distribute:s[3].toString()},warmupEpochs:d.toString(),totalStaked:m.toString(),warmup:{gons:a[0].toString(),releaseEpoch:a[1].toString(),pendingSNet:T.toString(),matured:a[0]>0n&&s[1]>=a[1]},caveat:"Warmup uses epoch numbers, not wall-clock time. Each rebase advances at most one due epoch; a claim also rebases once if due. A new stake resets the warmup release epoch."}}async function R(e,t){let n=await I(e,t);if(!n.enabled||!n.warmup.matured)throw new w("No matured NetNet warmup stake. Read netnet_staking_status and advance a due epoch before claiming.");return g([h(i,A({abi:p,functionName:"claim",args:[t]}),`Claim matured sNET to this wallet ${t}.`)],t,{token:r,amount:n.warmup.pendingSNet},"Claim matured NetNet staking warmup; rebase may change the sNET receipt.")}async function Z(e,t){y(e,[]),l(t);let n=await f(),[s,a,d]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.getBlock(),n.readContract({address:i,abi:p,functionName:"enabled"})]);if(!d||a.timestamp<s[2])throw new w("No enabled NetNet epoch is due to rebase.");return g([h(i,A({abi:p,functionName:"rebase"}),"Advance one due NetNet staking epoch and checkpoint its oracle.")],t,{token:r,amount:"0"},"Advance one due epoch. Distribution depends on live protocol state; this does not guarantee a reward.")}let P=(e,t,n)=>({name:e,inputSchema:{type:"object",properties:t,required:["amount"],additionalProperties:!1},execute:(s,a)=>v(()=>n(s,a))});return{positions:M,tools:[{name:"netnet_staking_status",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>I(e,t))},{name:"netnet_claim_stake",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>R(e,t))},{name:"netnet_rebase",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>Z(e,t))},P("netnet_stake",{amount:F("Positive NET amount in integer base units (9 decimals)."),wrap:{type:"boolean",default:!1,description:"Stake and wrap into wsNET in one call through NetNet's Zap."}},j),P("netnet_wrap",{amount:O(r)},L),P("netnet_unwrap",{amount:O(u)},G),P("netnet_unstake",{amount:O(r)},B)]}};export{N as a,r as b,u as c,i as d,k as e,tt as f,et as g};
@@ -1 +1 @@
1
- import{b as s}from"./SX5YNFHG.js";import{a as o,c as t}from"./VXCGMALF.js";import{getAddress as i}from"viem";var f=new Set(["priors_status",...s,...t.filter(r=>r.read).map(r=>r.name),"priors_ethos_status","priors_request_borrow","priors_request_repay","priors_request_stock","priors_request_backing","priors_pt_quote","priors_pt_position","priors_stock_quote","priors_savings_liquidity","priors_market_origin","priors_market_pins","priors_capabilities"]),p=new Set(["priors_sign_consent",...t.filter(r=>r.consentRoot).map(r=>r.name)]),u=new Set([...p,"priors_starter_line"]),R=new Set([...t.filter(r=>!r.read).map(r=>r.name),"priors_root_offer","priors_autopay_on","priors_autopay_off","priors_pt_buy","priors_pt_sell","priors_pt_redeem","priors_savings_force_withdraw","priors_stock_swap","priors_market_clear_bid_budget","priors_market_revoke_nft","priors_x_link"]),S=["priors_lend","priors_withdraw","priors_borrow","priors_repay","priors_starter_line","priors_close_line","priors_release_bond"];function c(r){let _=t.find(e=>e.name===r);return _?[o[_.contract],..._.approval==="bid"?[o.bidSpender]:[]]:r==="priors_root_offer"?[o.pool]:r==="priors_autopay_on"||r==="priors_autopay_off"?[o.autopay]:r==="priors_savings_force_withdraw"?[o.savings]:r==="priors_stock_swap"?[i("0xCaf681a66D020601342297493863E78C959E5cb2"),i("0x7Cd4E04E433E69e588728c86A3832753B5F846d4")]:r==="priors_pt_buy"||r==="priors_pt_sell"||r==="priors_pt_redeem"?[i("0x888888888889758F76e7103c6CbF23ABbF58F946")]:r==="priors_market_clear_bid_budget"?[o.bidSpender]:r==="priors_market_revoke_nft"?[o.registry,"0x0000000000000000000000000000000000000000"]:r==="priors_x_link"?[o.registry]:[]}export{f as a,p as b,u as c,R as d,S as e,c as f};
1
+ import{b as s}from"./XD4JA43O.js";import{a as o,c as t}from"./BWE5PXRE.js";import{getAddress as i}from"viem";var f=new Set(["priors_status",...s,...t.filter(r=>r.read).map(r=>r.name),"priors_ethos_status","priors_request_borrow","priors_request_repay","priors_request_stock","priors_request_backing","priors_pt_quote","priors_pt_position","priors_stock_quote","priors_savings_liquidity","priors_market_origin","priors_market_pins","priors_capabilities"]),p=new Set(["priors_sign_consent",...t.filter(r=>r.consentRoot).map(r=>r.name)]),u=new Set([...p,"priors_starter_line"]),R=new Set([...t.filter(r=>!r.read).map(r=>r.name),"priors_root_offer","priors_autopay_on","priors_autopay_off","priors_pt_buy","priors_pt_sell","priors_pt_redeem","priors_savings_force_withdraw","priors_stock_swap","priors_market_clear_bid_budget","priors_market_revoke_nft","priors_x_link"]),S=["priors_lend","priors_withdraw","priors_borrow","priors_repay","priors_starter_line","priors_close_line","priors_release_bond"];function c(r){let _=t.find(e=>e.name===r);return _?[o[_.contract],..._.approval==="bid"?[o.bidSpender]:[]]:r==="priors_root_offer"?[o.pool]:r==="priors_autopay_on"||r==="priors_autopay_off"?[o.autopay]:r==="priors_savings_force_withdraw"?[o.savings]:r==="priors_stock_swap"?[i("0xCaf681a66D020601342297493863E78C959E5cb2"),i("0x7Cd4E04E433E69e588728c86A3832753B5F846d4")]:r==="priors_pt_buy"||r==="priors_pt_sell"||r==="priors_pt_redeem"?[i("0x888888888889758F76e7103c6CbF23ABbF58F946")]:r==="priors_market_clear_bid_budget"?[o.bidSpender]:r==="priors_market_revoke_nft"?[o.registry,"0x0000000000000000000000000000000000000000"]:r==="priors_x_link"?[o.registry]:[]}export{f as a,p as b,u as c,R as d,S as e,c as f};
@@ -0,0 +1 @@
1
+ import{a as O,e as se,h as ae,i as oe,k as de}from"./KHOUBQJK.js";import{m as ie}from"./6STUQOFL.js";import{c as N,d as Y,e as J,f as Z,g as ee,h as te,j as ne}from"./GV6Z3MET.js";import{a as re}from"./4P6DRKY3.js";import{b as ce,e as U,r as ue}from"./GV6FZ6UG.js";import{a as g,b as C}from"./7WXAS54T.js";import{a as P}from"./LIUXNOLP.js";import{e as j,f as Q}from"./S65KXMZ7.js";import{f as V,l as z}from"./CW37EGPL.js";import{a as X,c as A}from"./CFPJDLTZ.js";import{a as D}from"./5N6YJFFA.js";import{a as F}from"./SPJCSEKP.js";import{b as $}from"./SCG5HWMN.js";import{b as E}from"./IX3GZMTM.js";import{t as T}from"./EZUQMTLE.js";import{b as m,c as l,d as q,e as v,j as h,k as W,l as B,q as K}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{a as x,b as G}from"./JXOEJPJ4.js";import{getAddress as p,isAddress as le,parseAbi as ye,zeroAddress as fe}from"viem";var me=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];function tt(n){return"source"in n&&n.source==="pool-spot-estimate"?void 0:n}var M=300,xe="1000000000000000000",we=p(h[m].tokens.USDG.address),ge=p(h[l].deployments.test_USDG.address),L=p(h[m].tokens.WETH.address),I=p(h[l].deployments.test_WETH.address),R=p(X.chop);function he(n){return n.chainId===m&&n.address.toLowerCase()===R.toLowerCase()}async function nt(n,e,t,o){let a=o?.find(b=>b.measuredAtBlock===t.toString()&&[b.log.address,b.staking.address].some(y=>y.toLowerCase()===n.address.toLowerCase())),i=n.address;try{a||(i=p(await V(e,n.address,"INDEX_FUND",[],t)))}catch{}let s=a??await z(e,i,"read",t);if(s.drift.length)throw new c("Chop code changed; share backing cannot be estimated.");let r=10n**BigInt(n.decimals),d=n.address.toLowerCase()===s.log.address.toLowerCase(),u=n.address.toLowerCase()===s.staking.address.toLowerCase();if(!d&&!u||n.chainId!==m||n.decimals!==(d?s.log.decimals:s.staking.decimals))throw new c("Chop share identity does not match the verified log.");let f=d?[(await j(e,s,fe,r,t)).net]:(await Q(e,s,fe,r,t)).assets;if(!f.length)throw new c("Chop LP reserves or net log backing could not be verified.");return{assets:f,isLog:d}}function Ee(n){let e=n.address.toLowerCase();return n.chainId===m?e===we.toLowerCase():n.chainId===l?e===ge.toLowerCase():!1}function Te(n){return n.chainId!==m&&n.chainId!==l?!1:C(n.address)===g}function Se(n){let e=n.address.toLowerCase();return n.chainId===m?e===L.toLowerCase():n.chainId===l?e===I.toLowerCase():!1}function ve(n){return Te(n)||Se(n)}var Pe=-887272,Ce=887272,De=(1n<<256n)-1n,Ae=ye(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]),pe=ye(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Ne=1n<<192n;async function Oe(n,e){let t=p(A.stateView),o=A.poolId,[a,i]=await Promise.all([n.readContract({address:t,abi:pe,functionName:"getSlot0",args:[o],blockNumber:e}),n.readContract({address:t,abi:pe,functionName:"getLiquidity",args:[o],blockNumber:e})]),s=a[0],r=Number(a[1]);if(s<=0n||i<=0n||!Number.isInteger(r)||r<Pe||r>Ce)throw new c("The pinned Uniswap v4 WETH/CHOP pool has no active liquidity, and the only other route is a near-empty pool.");return{numerator:Ne,denominator:s*s}}function H(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new c(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new c(`Invalid ${e} timestamp.`)}function rt(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){try{return w(n,e,t),!0}catch{return!1}}function w(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){if(!Number.isInteger(t)||t<0)throw new c("Maximum price age must be a non-negative integer.");let o=H(n,"price"),a=H(e,"current");if(o<=0n)throw new c("Price timestamp must be positive.");if(o>a)throw new c("Price timestamp is in the future.");let i=a-o;if(i>BigInt(t))throw new c(`Price is stale: age ${i}s exceeds ${t}s.`);return o.toString()}function Ue(n){if(!Number.isInteger(n)||n<Pe||n>Ce)throw new c(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=De/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function be(n,e,t,o){let a=async()=>{throw new c("Price identity resolution is read-only.")},i=F({network:e===l?"testnet":"mainnet",clientFor:r=>t.client??T(t.rpcUrl,r),http:t.http??$(),preview:a,quoteSwap:a,buildSwap:a}),s=await ue(n,{context:i,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:o,blockNumber:t.blockNumber,readMetadata:async r=>{let d=t.client??T(t.rpcUrl,e),[u,f]=await Promise.all([D(d,e,r,"symbol",t.blockNumber),D(d,e,r,"decimals",t.blockNumber)]);return{address:r,symbol:u,decimals:f,chainId:e}}});return{address:s.address,symbol:s.kind==="erc20"&&o?o.symbol:s.symbol,decimals:s.decimals,chainId:s.chainId}}async function _e(n,e,t){if(typeof n=="object"&&n!==null){let r=n.chainId??e,d=C(n.address)===g?g:p(n.address),u={address:d,symbol:n.symbol,decimals:n.decimals,chainId:r};return Ee(u)?{address:d,symbol:"USDG",decimals:v,chainId:r}:Te(u)?{address:g,symbol:"ETH",decimals:18,chainId:r}:Se(u)?{address:d,symbol:"WETH",decimals:18,chainId:r}:he(u)?{address:d,symbol:"CHOP",decimals:18,chainId:r}:be(u.address,r,t,u)}let o=n.trim(),a=o.toUpperCase(),i=o.toLowerCase();if(a==="ETH"||le(o,{strict:!1})&&C(o)===g)return{...ce,chainId:e};if(a==="WETH"||e===m&&i===L.toLowerCase()||e===l&&i===I.toLowerCase()){if(e!==m&&e!==l)throw new c(`No canonical WETH address configured for chain ${e}.`);return{address:e===l?I:L,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===m&&i===W.toLowerCase()||e===l&&i===B.toLowerCase()){if(e!==m&&e!==l)throw new c(`No canonical USDG address configured for chain ${e}.`);return{address:e===l?ge:we,symbol:"USDG",decimals:v,chainId:e}}if(e===m&&(a==="USDE"||i===U.address.toLowerCase()))return{...U,chainId:e};if(e===m&&(a==="CHOP"||i===R.toLowerCase()))return{address:R,symbol:"CHOP",decimals:18,chainId:e};let s=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||s&&o.toLowerCase()===s.toLowerCase()){if(!s&&!le(o,{strict:!1}))throw new c("OAK token address is required to price OAK.");return{address:p(s??o),symbol:"OAK",decimals:q,chainId:e}}return be(n,e,t)}async function k(n,e,t){if(e)return(await n.readContract({address:e,abi:me,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:p(K),abi:Ae,functionName:"observe",args:[[O,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new c("ETH/USDG pool observation returned insufficient tick cumulatives.");let i=ae(a[0],a[1],O),s=Ue(i);return oe(s)}async function S(n,e,t,o){if(n.timestamp!==void 0)return w(n.timestamp,t(),o);if(e&&typeof e.getBlock=="function"){let i=await P(e,n.blockNumber);return w(i.timestamp,t(),o)}let a=t();return w(a,a,o)}function _(n){if(n.startsWith("untrusted "))try{let e=JSON.parse(n.slice(10));if(typeof e=="string"&&x(e)===n)return n}catch{}return x(n)}async function it(n,e={}){let t=e.chainId??m,o=e.maxAgeSeconds??M,a=()=>e.now!==void 0?H(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),i=await _e(n,t,e);if((G(i.symbol)||i.symbol.length>256)&&(i.symbol=_(i.symbol)),e.trades){let r=await S(e,e.client,a,o),d=de(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!ie(d,e.spotOakPerEthE18))throw new c("30-minute average is outside the 50% spot guard band.");let u=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await k(e.client??T(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:se(u,d),timestamp:r}}if(e.usdE18!==void 0){let r=await S(e,e.client,a,o),d=E(e.usdE18.toString());if(d<=0n)throw new c("USD price must be positive.");return{token:i,usdE18:d.toString(),timestamp:r}}if(e.resolver){let r=await e.resolver(i),d=w(r.timestamp,a(),o),u=E(r.usdE18);if(u<=0n)throw new c("USD price must be positive.");return{token:i,usdE18:u.toString(),timestamp:d,...r.source==="pool-spot-estimate"?{source:r.source,sourceLabel:N}:{}}}let s=e.client??T(e.rpcUrl,t);if(Ee(i)){let r=await S(e,s,a,o);return{token:i,usdE18:xe,timestamp:r}}if(ve(i)){let r=await S(e,s,a,o),d=await k(s,e.oracleAddress,e.blockNumber);return{token:i,usdE18:d,timestamp:r}}if(he(i)){let r=e.timestamp===void 0&&s&&typeof s.getBlock=="function"?await P(s,e.blockNumber):void 0,d=r?w(r.timestamp,a(),o):await S(e,s,a,o);if(r&&r.number===null)throw new c("CHOP reference requires a mined block.");let u=r?.number??e.blockNumber,[f,b]=await Promise.all([Oe(s,u),e.ethUsdE18!==void 0?Promise.resolve(e.ethUsdE18.toString()):k(s,e.oracleAddress,u)]),y=E(b)*f.numerator/f.denominator;if(y<=0n)throw new c("CHOP USD reference price must be positive.");return{token:i,usdE18:y.toString(),timestamp:d}}if(i.chainId===m)try{let r=await P(s,e.blockNumber),d=w(r.timestamp,a(),o);if(r.number===null)throw new c("Pons reference requires a mined block.");let u=await ne(i,s,r.number);if(u!==void 0&&u>0n)return{token:i,usdE18:u.toString(),timestamp:d,source:"pool-spot-estimate",sourceLabel:N};let[f,b]=await Promise.all([re(i,s,r.number),k(s,e.oracleAddress,r.number)]),y=E(b)*f.numerator/f.denominator;if(y<=0n)throw new c("Pons USD reference price must be positive.");return{token:i,usdE18:y.toString(),timestamp:d}}catch(r){let d=Y(i),u=r instanceof J?Z(r.symbol,r.gap):te(r)?ee:void 0;if(u)throw new c(`Price unavailable for now for ${d?.symbol??_(i.symbol)}: ${u}. Oak has no fresh on-chain trade price for it, so it shows no price.`)}throw new c(`Oak has no fresh on-chain trade price for ${_(i.symbol)}, so it shows no price. balances and positions show a labeled estimate where one exists; an estimate is not a quote.`)}export{tt as a,M as b,xe as c,he as d,nt as e,Ee as f,Te as g,Se as h,ve as i,Oe as j,rt as k,w as l,Ue as m,k as n,it as o};
@@ -1 +1 @@
1
- import{a as c,f as d,g as s}from"./ZXRIJG6H.js";import{f as a}from"./FRT6AC6M.js";import{a as p}from"./66F5ZH34.js";import{b as i}from"./TI727O2H.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as m,erc20Abi as h,parseAbi as E}from"viem";var w=E(["function deposit() payable","function withdraw(uint256)"]);function y(n){return{tools:[{name:"uniswap_wrap",inputSchema:{type:"object",additionalProperties:!1,required:["direction","amount"],properties:{direction:{description:'Choose "wrap" to exchange ETH for WETH, or "unwrap" to exchange WETH for ETH.',type:"string",enum:["wrap","unwrap"]},amount:p('Amount of ETH or WETH in base units (18 decimals). Example: "1000000000000000000" = 1 ETH or WETH.')}},async execute(t,u){if(s(t,["direction","amount"]),t.direction!=="wrap"&&t.direction!=="unwrap")throw new e("Choose direction wrap or unwrap.");let o=c(t.amount,"amount");if(t.direction==="unwrap"){let r=await n.clientFor(i).readContract({address:a,abi:h,functionName:"balanceOf",args:[u]});if(r===0n)throw new e("You have no WETH to unwrap. Wrap ETH or receive WETH first.");if(r<o)throw new e(`You do not have enough WETH to unwrap this amount. Request ${r} base units or less.`)}let f=t.direction==="wrap"?m({abi:w,functionName:"deposit"}):m({abi:w,functionName:"withdraw",args:[o]});return d(n,[n.unsignedTx({to:a,data:f,value:t.direction==="wrap"?o.toString():"0",chainId:i,description:`${t.direction} ${o} ETH/WETH base units to the signing wallet.`})],u,"Wrap or unwrap native ETH at the pinned WETH contract. Ratio 1:1; network gas is additional.")}}]}}export{w as a,y as b};
1
+ import{a as c,f as d,g as s}from"./PX2G2H6G.js";import{f as a}from"./2ZYFBBOE.js";import{a as p}from"./66F5ZH34.js";import{b as i}from"./EWZFZUVF.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as m,erc20Abi as h,parseAbi as E}from"viem";var w=E(["function deposit() payable","function withdraw(uint256)"]);function y(n){return{tools:[{name:"uniswap_wrap",inputSchema:{type:"object",additionalProperties:!1,required:["direction","amount"],properties:{direction:{description:'Choose "wrap" to exchange ETH for WETH, or "unwrap" to exchange WETH for ETH.',type:"string",enum:["wrap","unwrap"]},amount:p('Amount of ETH or WETH in base units (18 decimals). Example: "1000000000000000000" = 1 ETH or WETH.')}},async execute(t,u){if(s(t,["direction","amount"]),t.direction!=="wrap"&&t.direction!=="unwrap")throw new e("Choose direction wrap or unwrap.");let o=c(t.amount,"amount");if(t.direction==="unwrap"){let r=await n.clientFor(i).readContract({address:a,abi:h,functionName:"balanceOf",args:[u]});if(r===0n)throw new e("You have no WETH to unwrap. Wrap ETH or receive WETH first.");if(r<o)throw new e(`You do not have enough WETH to unwrap this amount. Request ${r} base units or less.`)}let f=t.direction==="wrap"?m({abi:w,functionName:"deposit"}):m({abi:w,functionName:"withdraw",args:[o]});return d(n,[n.unsignedTx({to:a,data:f,value:t.direction==="wrap"?o.toString():"0",chainId:i,description:`${t.direction} ${o} ETH/WETH base units to the signing wallet.`})],u,"Wrap or unwrap native ETH at the pinned WETH contract. Ratio 1:1; network gas is additional.")}}]}}export{w as a,y as b};
@@ -0,0 +1 @@
1
+ import{b as j,d as H,f as O}from"./LD3A2KLN.js";import{g as P}from"./3RGED2KO.js";import{b as A,j as S}from"./EWZFZUVF.js";import{a as g}from"./XSD5NL7J.js";import{encodeFunctionData as B,formatEther as D,getAddress as k,parseAbi as h,zeroAddress as R}from"viem";var I=k(S[4663].hookr.HookrLimitOrders.address),_=["0x522723A7a09684515881568Ab8247f3846D66F43","0xfb3c1501c727f30883cd7B36Ec380381af7412Ef"].map(f=>k(f)),W=[h(["function tokenizations(address token) view returns ((address creator,address forwarder,bytes32 marketFamilyId,uint64 createdAt))"]),h(["function tokenizations(address token) view returns ((address creator,uint8 way,address forwarder,address adapter,address door,bytes32 familyId,bytes32 marketFamilyId,uint64 unlockBlock,uint16 legBps))"])],x=h(["function getOrder(uint256 orderId) view returns (((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) key,address owner,uint40 createdAt,uint40 expiry,bool zeroForOne,uint8 status,address recipient,uint128 amountIn,uint128 minAmountOut,uint128 bounty,uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable,uint256 amountOut)","function fill(uint256 orderId) returns (uint256 amountOut)"]),G=h(["function sync() returns (uint256 tip)"]);function U(f){return{name:"hookr_jobs",inputSchema:{type:"object",properties:{},additionalProperties:!1,description:"Find currently profitable Hookr fill and revenue sync jobs. Coverage is bounded and reported."},async execute($,v){if(f.network==="testnet")throw new g("Hookr jobs require Robinhood Chain 4663.");if(Object.keys($).length)throw new g("Hookr jobs takes no arguments.");let l=f.clientFor(A),n=await l.getBlock();if(typeof n.number!="bigint"||typeof n.timestamp!="bigint"||!n.hash)throw new g("Hookr jobs need a valid named chain block. Coverage is unknown.");let y=[],b=[],E=async(o,e,t,r,d)=>{let a,s=new Set,i=new Set;for(let c=0;c<2;c++)try{let u=await P(f,o,{limit:t,...a?{cursor:a}:{}});if(u.status!=="ready"||!Array.isArray(u[e])||u[e].length>t||!("nextCursor"in u))throw new Error("Invalid page");for(let p of u[e]){if(!p||typeof p!="object"||Array.isArray(p)){b.push(`${e}: malformed candidate`);continue}let w=p,F=e==="orders"?w.id??w.orderId:w.address;if(typeof F=="string"){let N=F.toLowerCase();if(i.has(N))continue;i.add(N)}try{await d(w)}catch{b.push(`${e}: candidate could not be checked`)}}let m=u.nextCursor;if(m===null)return;if(typeof m!="string"||!r.test(m)||s.has(m))throw new Error("Invalid cursor");s.add(m),a=m}catch{b.push(`${e}: discovery unavailable or malformed`);return}b.push(`${e}: scan limit reached; more candidates unknown`)},C=async(o,e,t,r=0n)=>{let d=await l.estimateGas({account:v,to:o,data:e,value:0n,blockNumber:n.number});if(typeof d!="bigint"||d<=0n)throw new Error("Gas unavailable");let a=H(d,r),s=n.baseFeePerGas,i=await l.estimateMaxPriorityFeePerGas();if(typeof s!="bigint"||s<0n||typeof i!="bigint"||i<0n||s*2n+i<=0n)throw new Error("Network fee data unavailable");let c=s*2n+i,u=a*c;return{gasLimit:a.toString(),maxFeePerGas:c.toString(),gasCostWei:u.toString(),gasCostEth:D(u),netWei:(t-u).toString()}};if(await E("hookr_open_orders","orders",5,/^[1-9][0-9]{0,19}$/,async o=>{if(o={...o,id:o.id??o.orderId},typeof o.id!="string"||!/^[1-9][0-9]{0,19}$/.test(o.id))throw new Error("Invalid id");let e=BigInt(o.id),[t,r]=await Promise.all([l.readContract({address:I,abi:x,functionName:"getOrder",args:[e],blockNumber:n.number}),l.readContract({address:I,abi:x,functionName:"quoteFill",args:[e],blockNumber:n.number})]);if(!t||typeof t!="object"||typeof t.bounty!="bigint"||typeof t.minAmountOut!="bigint"||typeof t.amountIn!="bigint"||!t.key||typeof t.owner!="string"||typeof t.recipient!="string"||typeof t.zeroForOne!="boolean"||typeof t.expiry!="number"&&typeof t.expiry!="bigint"||typeof n.timestamp!="bigint"||!Array.isArray(r)||typeof r[0]!="boolean"||typeof r[1]!="bigint")throw new Error("Invalid order");if(Number(t.status)!==1||BigInt(t.expiry)<n.timestamp||!r[0]||r[1]<=0n||r[1]<t.minAmountOut||t.amountIn<=0n||t.minAmountOut<=0n||t.bounty===0n)return;let d=B({abi:x,functionName:"fill",args:[e]}),a=await O(f,e,n.number),s=await C(I,d,t.bounty,a);BigInt(s.netWei)>0n&&y.push({type:"fill",orderId:o.id,rewardWei:t.bounty.toString(),...s,action:"hookr_fill",note:"Bounty accrues on a successful fill; later claim gas is excluded from this net."})}),await E("hookr_revenue_tokens","tokens",50,/^(?:v1|v1:[1-9][0-9]{0,19}|v2:[1-9][0-9]{0,19})$/,async o=>{if(typeof o.address!="string")throw new Error("Invalid token");let e=k(o.address),t=!1;for(let i=0;i<_.length;i++){let c=await l.readContract({address:_[i],abi:W[i],functionName:"tokenizations",args:[e],blockNumber:n.number});if(!c||typeof c.creator!="string"||i===0&&typeof c.createdAt!="bigint")throw new Error("Invalid record");if(k(c.creator)!==R&&(i!==0||c.createdAt>0n)){t=!0;break}}if(!t)throw new Error("Unregistered");let r=await l.simulateContract({address:e,abi:G,functionName:"sync",account:v,blockNumber:n.number});if(typeof r.result!="bigint"||r.result<0n)throw new Error("Invalid tip");if(r.result===0n)return;let d=B({abi:G,functionName:"sync"}),a=null;try{a=(await j(l,e,v,d,n.number)).pendingPull.toString()}catch{}let s=await C(e,d,r.result);BigInt(s.netWei)>0n&&y.push({type:"sync",token:e,rewardWei:r.result.toString(),pendingPull:a??"unknown",...s,action:"hookr_revenue_action"})}),(await l.getBlock({blockNumber:n.number})).hash!==n.hash)throw new g("Hookr job block changed; retry the complete read.");let z=b.length?"partial: some jobs are unknown":y.length?"paying jobs found":"nothing pays right now";return{chainId:A,blockNumber:n.number.toString(),status:z,jobs:y,unknown:b,relay:"relay: no public list",notice:"Paid only on success; someone may get there first. Net uses the signed gas ceiling: buffered gas limit times (2 times base fee plus priority fee). Candidate coverage comes from Hookr\u2019s directory, with at most two pages per family; this is not an exhaustive chain-wide search."}}}}export{U as a};
@@ -1 +1 @@
1
- import{e as y,g as a,i as l,l as h,m as A,n as g}from"./NWNYJ26T.js";import{b as f,j as k}from"./TI727O2H.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{b as f,j as k}from"./EWZFZUVF.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};
@@ -0,0 +1 @@
1
+ import{a as R}from"./G2LAO23N.js";import{C as X,H as Y,I as M,L as Z,a as g,z as C}from"./37UBQQWL.js";import{a as B,g as E}from"./3RGED2KO.js";import{a as W}from"./66F5ZH34.js";import{f as J,g as D}from"./NWNYJ26T.js";import{b as Q,d as V}from"./IX3GZMTM.js";import{b as p}from"./EWZFZUVF.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as ne,erc20Abi as ie,getAddress as w,parseAbi as re}from"viem";var ee=re(["function fill(uint256 orderId) returns (uint256)","function fillGasFloor(uint256 orderId) view returns (uint256)"]),N={type:"string",pattern:"^[1-9][0-9]*$"},oe={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},te={type:"string",enum:["buy","sell"],description:R.enumValues({buy:"spend the pool quote token to receive the listed token",sell:"spend the listed token to receive the quote token"})},se={cursor:{...N,description:"Order ID to start from, scanning downward (newest first). Use nextCursor from the previous page; omit for the latest order."},limit:{type:"integer",minimum:1,maximum:32,description:"Maximum number of order IDs to scan in this page, 1 to 32. Default 16."}};function T(n,h){if(typeof n!="string"||!/^[1-9][0-9]*$/.test(n)||n.length>78||BigInt(n)>=1n<<256n)throw new i(`Provide ${h} as a positive decimal integer string.`);return BigInt(n)}function S(n){return J(n,"Hookr returned an invalid read response. Retry later.")}function H(n,h,e,o){return{name:n,inputSchema:{type:"object",description:`Read ${n.replace("hookr_","Hookr ")}. No signature or transaction.`,properties:h,required:e,additionalProperties:!1},execute:async(t,a)=>{if(Object.keys(t).some(d=>!Object.hasOwn(h,d))||e.some(d=>t[d]===void 0))throw new i(`Provide the documented arguments for ${n}.`);return o(t,a)}}}function $(n){if(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))throw new i("Provide a 32-byte Hookr poolId.");return n}function F(n,h){let e=S(n),o=S(e.key);if(typeof o.fee!="number"||!Number.isInteger(o.fee)||o.fee<0||o.fee>16777215||typeof o.tickSpacing!="number"||!Number.isInteger(o.tickSpacing)||o.tickSpacing<=0||o.tickSpacing>8388607)throw new i("Hookr pool key is invalid.");let t={currency0:w(String(o.currency0)),currency1:w(String(o.currency1)),fee:o.fee,tickSpacing:o.tickSpacing,hooks:w(String(o.hooks))},a=h??$(e.poolId);if(BigInt(t.currency0)>=BigInt(t.currency1)||!D(X(t),a))throw new i("Hookr pool key does not match its PoolId.");let d=S(e.token),s=S(e.quote),u=r=>{let k=w(String(r.address));if(typeof r.symbol!="string"||!r.symbol.trim()||typeof r.decimals!="number"||!Number.isInteger(r.decimals)||r.decimals<0||r.decimals>255||![t.currency0,t.currency1].includes(k))throw new i("Hookr listed token metadata is invalid.");return{...r,address:k,chainId:p}},c=u(d),l=u(s);if(c.address===l.address)throw new i("Hookr listed token pair is invalid.");return{...e,poolId:a,key:t,token:c,quote:l}}var O=E;function be(n){let h=e=>H(e?"hookr_orders":"hookr_open_orders",se,[],async(o,t)=>{let a=o.limit??16;if(typeof a!="number"||!Number.isInteger(a)||a<1||a>32)throw new i("Hookr page limit must be an integer from 1 to 32.");let d=n.clientFor(p),s=await d.getBlock();if(typeof s.number!="bigint"||typeof s.timestamp!="bigint"||s.timestamp<=0n)throw new i("Hookr order reads need a valid chain block and timestamp.");let u=new Proxy(Z(d),{get(b,m,f){return m==="readContract"?y=>b.readContract({...y,blockNumber:s.number}):Reflect.get(b,m,f)}}),c={...n,clientFor:()=>u},l=await u.readContract({address:g,abi:C,functionName:"lastOrderId"});if(typeof l!="bigint"||l<0n)throw new i("Could not read the last Hookr order ID. Coverage is unknown.");let r=o.cursor===void 0?l:T(o.cursor,"cursor");if(r>l)throw new i("Hookr cursor exceeds the latest order ID. Restart pagination.");let k=[],x=new Map,A=r,I=r>BigInt(a)?r-BigInt(a):0n;for(;r>I;){let b=r--,m=Y(await u.readContract({address:g,abi:C,functionName:"getOrder",args:[b]}));if(Number(m.status)===0||BigInt(m.owner)===0n)throw new i(`Hookr order #${b} is missing. Coverage is unknown.`);if(e?!D(m.owner,t):Number(m.status)!==1)continue;let f=await M(c,b,{order:m,tokens:x});if(e){k.push(f);continue}let y=null,G=null,z=null,L=null,U=BigInt(f.expiry)<s.timestamp,j=f.fillable&&!U;if(j)try{let P=await u.readContract({address:g,abi:ee,functionName:"fillGasFloor",args:[BigInt(f.orderId)]}),_=await d.estimateGas({account:t,to:g,data:ne({abi:ee,functionName:"fill",args:[BigInt(f.orderId)]}),blockNumber:s.number}),v=await d.getGasPrice();if(typeof P!="bigint"||P<0n||typeof _!="bigint"||_<=0n||typeof v!="bigint"||v<0n)throw new Error("Invalid gas data");let K=(P*6n+4n)/5n,q=_>K?_:K;y=q.toString(),G=v.toString(),z=(q*v).toString(),L=(BigInt(f.bounty)-q*v).toString()}catch{}k.push({...f,fillable:j,expired:U,economics:{gasLimit:y,gasPrice:G,estimatedGasCost:z,bountyLessEstimatedGas:L,note:"Estimate only; excludes bounty claim gas and competition. Recheck the fill preview."}})}return{chainId:p,book:g,blockNumber:s.number.toString(),chainTime:s.timestamp.toString(),orders:k,scanned:{from:A.toString(),through:(r+1n).toString()},nextCursor:r>0n?r.toString():null,complete:r===0n}});return[h(!1),h(!0),H("hookr_order",{orderId:{...N,description:R.id("Hookr limit order")}},["orderId"],async e=>M(n,T(e.orderId,"orderId"))),H("hookr_pools",{sort:{type:"string",enum:["liquidity","volume","newest"],description:"Sort by USD liquidity, 24-hour volume, or opening block."},includeTests:{type:"boolean",description:"Include pools with test tickers."},agentsOnly:{type:"boolean",description:"Only pools with an agent gate."},token:{type:"string",description:R.address("listed token whose pools to return")},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of pools to return, 1 to 50."},cursor:{type:"string",pattern:"^[0-9]{1,6}$",description:"Paging cursor: the nextCursor from the previous pools page; omit for the first page."}},[],async e=>{if(e.sort!==void 0&&!["liquidity","volume","newest"].includes(String(e.sort)))throw new i("Choose liquidity, volume or newest sorting.");for(let t of["includeTests","agentsOnly"])if(e[t]!==void 0&&typeof e[t]!="boolean")throw new i(`Provide ${t} as a boolean.`);if(e.token!==void 0)try{w(String(e.token))}catch{throw new i("Provide a valid token address.")}if(e.limit!==void 0&&(typeof e.limit!="number"||!Number.isInteger(e.limit)||e.limit<1||e.limit>50))throw new i("Pool page limit must be from 1 to 50.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||!/^[0-9]{1,6}$/.test(e.cursor)))throw new i("Provide the pool nextCursor from the previous page.");let o=await O(n,"hookr_pools",e);if(!Array.isArray(o.pools))throw new i("Hookr pool coverage is unknown. Retry later.");return{...o,pools:o.pools.map(t=>F(t)),chainId:p,source:B}}),H("hookr_pool",{poolId:oe,side:te,amountIn:{...N,description:'Order input amount in base units of the input token (quote token for buy, listed token for sell); read its decimals. Example: "1000000". Give with side and minAmountOut.'},minAmountOut:{...N,description:'Minimum output in base units of the output token (listed token for buy, quote token for sell); read its decimals. Example: "1000000". Give with side and amountIn.'}},["poolId"],async e=>{let o=$(e.poolId),t=[e.side,e.amountIn,e.minAmountOut].some(y=>y!==void 0);if(t&&(e.side!=="buy"&&e.side!=="sell"||e.amountIn===void 0||e.minAmountOut===void 0))throw new i("Provide side, amountIn and minAmountOut together for order-specific bounty bounds.");let a=t?T(e.amountIn,"amountIn"):void 0,d=t?T(e.minAmountOut,"minAmountOut"):void 0;if(a!==void 0&&(a>=1n<<128n||d>=1n<<128n))throw new i("Hookr order amounts must fit uint128 base units.");let s=await O(n,"hookr_pool",{poolId:o}),u=s.listing?F(s.listing,o):void 0,c={...s,...u?{listing:u}:{},chainId:p,source:B};if(!t)return{...c,bountyBounds:{status:"requires-order-terms",note:"The keeper bounty floor depends on the order. Supply side, amountIn and minAmountOut in base units. The batch-1 0.0005 ETH observation is not a permanent floor."}};if(!u)throw new i("Hookr pool key is unavailable; bounty floor is unknown.");let l=u.key,r=S(e.side==="buy"?u.quote:u.token),k=w(String(r.address))===l.currency0,x=n.clientFor(p),A=await x.getBlock(),I=await x.readContract({address:g,abi:C,functionName:"bountyBounds",args:[l,k,a,d],blockNumber:A.number});if(!Array.isArray(I)||I.length!==3||I.some(y=>typeof y!="bigint"||y<0n||y>=1n<<128n))throw new i("Hookr bounty bounds are unavailable; the floor is unknown.");let[b,m,f]=I;return{...c,bountyBounds:{status:"available",blockNumber:A.number.toString(),token:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",symbol:"ETH",decimals:18,chainId:p},minBounty:b.toString(),defaultBounty:m.toString(),maxBounty:f.toString(),effectiveFloor:(b>0n?b:m).toString(),note:"ETH wei for this order at this block. Oak create uses the positive minimum, or the default when minimum is zero; recheck at creation."}}}),H("hookr_quote",{poolId:oe,side:te,amountIn:{...W(),description:'Amount of the input token in base units (quote token for buy, listed token for sell); read its decimals. Example: "1000000" = 1 token with 6 decimals.'}},["poolId","side","amountIn"],async(e,o)=>{let t=$(e.poolId);if(e.side!=="buy"&&e.side!=="sell")throw new i("Hookr side must be buy or sell.");if(typeof e.amountIn!="string"||Q(e.amountIn)<=0n)throw new i("Provide a positive amountIn in base units.");let a=await O(n,"hookr_pool",{poolId:t}),d=F(a.listing,t),s=S(e.side==="buy"?d.quote:d.token),u=w(String(s.address)),c=u==="0x0000000000000000000000000000000000000000"?18:await n.clientFor(p).readContract({address:u,abi:ie,functionName:"decimals"});if(typeof c!="number"||!Number.isInteger(c)||c<0||c>255||typeof s.symbol!="string")throw new i("Hookr input token metadata is unavailable.");let l=V(e.amountIn,c),r=await O(n,"hookr_quote",{poolId:t,side:e.side,amount:l,payer:o}),k=await O(n,"hookr_check_trade",{poolId:t,side:e.side,amount:l,wallet:o});return{chainId:p,source:B,input:{token:{address:u,symbol:s.symbol,decimals:c,chainId:p},amount:e.amountIn},quote:r,check:k,note:"Informational quote. Review pool rules; unknown trade checks do not authorize a trade."}})]}export{be as a};
@@ -1 +1 @@
1
- import{a}from"./O2J5I4VA.js";import{a as I}from"./FXOFR432.js";import{a as w}from"./XSD5NL7J.js";import{a as v}from"./JXOEJPJ4.js";import{isAddress as P,isHex as E,parseAbi as U}from"viem";var x=86400;function H(n){return Math.round((n+Number.EPSILON)*10)/10}function W(n,t,b,l,d,i=Math.floor(Date.now()/1e3)){let u=n.policy,f=(b.length>=1&&u.guardianThreshold>=1?12:0)+(u.timelock>=3600?10:0)+(u.ownerApprovalRequired||u.guardianThreshold>=2?4:0)+(t.length?4:0),p=n.checkpointCount===0n?0:Math.min(30,H(30*Math.log10(Number(n.checkpointCount)+1)/Math.log10(101))),m=n.status!==0||n.checkpointCount===0n||!d?0:i-Number(d.timestamp)<=x?20:i-Number(d.timestamp)<=7*x?12:i-Number(d.timestamp)<=30*x?6:0,r=l?Math.min(20,H(20*Math.max(0,i-Number(l.timestamp))/(30*x))):0,h=Math.round(f+p+m+r);return{total:h,grade:h>=80?"A":h>=60?"B":h>=40?"C":"D",breakdown:{recoveryProtection:{points:f,max:30},checkpointHistory:{points:Math.round(p),rawPoints:p,max:30},activity:{points:m,max:20},timeOnChain:{points:Math.round(r),rawPoints:r,max:20}},note:I}}function R(n){let t=v(n.slice(0,4096)),b,l=/^data:application\/json;base64,([A-Za-z0-9+/]*={0,2})$/.exec(n.slice(0,5500));if(l)try{let i=atob(l[1]);if(i.length<=4096){let u=JSON.parse(new TextDecoder().decode(Uint8Array.from(i,f=>f.charCodeAt(0))));u&&typeof u=="object"&&!Array.isArray(u)&&(b=u)}}catch{}let d=i=>typeof b?.[i]=="string"?v(b[i]):void 0;return{rawUri:t,name:d("name"),agentType:d("agentType"),description:d("description")}}function q(n){if(n===void 0)return 20;if(!Number.isSafeInteger(n)||Number(n)<1||Number(n)>50)throw new w("Explorer limit must be an integer from 1 to 50.");return Number(n)}var c=U(["function workflowCount() view returns (uint256)","function getWorkflow(uint256) view returns ((address owner,address pendingOwner,uint8 status,(uint8 guardianThreshold,bool ownerApprovalRequired,uint32 ownerFallbackDelay,uint32 timelock,uint32 approvalWindow,uint32 executionWindow) policy,uint64 checkpointCount,uint64 headSequence,bytes32 headHash,uint256 activeProposalId,string metadataURI))","function getExecutors(uint256) view returns (address[])","function getGuardians(uint256) view returns (address[])","function getCheckpoint(uint256,uint64) view returns ((bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp))","function getCheckpoints(uint256,uint64,uint256) view returns ((bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp)[])","function getCheckpointById(bytes32) view returns (uint256 workflowId,uint64 sequence,(bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp) checkpoint)","function activeProposalId(uint256) view returns (uint256)","function proposalCount(uint256) view returns (uint256)","function rollbackCount(uint256) view returns (uint256)","function recoveryOutcomeCount(uint256) view returns (uint256)","function getRollbackRecords(uint256,uint256,uint256) view returns ((uint256 proposalId,uint64 fromSequence,uint64 toSequence,uint64 executedAt)[])","function getRecoveryOutcomes(uint256,uint256,uint256) view returns ((bytes32 recoveryId,uint64 checkpointSequence,uint8 outcome,bytes32 resultHash,address recorder,uint64 recordedAt)[])"]);function T(n){if(n===void 0)return a.defaultCheckpointLimit;if(!Number.isInteger(n)||Number(n)<1||Number(n)>a.maxCheckpointLimit)throw new w("Checkpoint limit must be an integer from 1 to 25.");return Number(n)}async function D(n,t){if([t.workflowId!==void 0,t.address!==void 0,t.checkpointHash!==void 0].filter(Boolean).length>1)throw new w("Choose one Upoch selector: workflowId, address, or checkpointHash.");if(await n.getChainId()!==a.chainId)throw new w("Upoch reads require Robinhood Chain 4663.");if(t.checkpointHash!==void 0){if(typeof t.checkpointHash!="string"||!E(t.checkpointHash,{strict:!0})||t.checkpointHash.length!==66)throw new w("Provide a 32-byte Upoch checkpoint hash.");let[r]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"getCheckpointById",args:[t.checkpointHash]}]});return{workflowId:r[0],selectedCheckpoint:r[2],matchingWorkflowIds:[r[0]],workflowScanTruncated:!1}}if(t.workflowId!==void 0){if(!Number.isSafeInteger(t.workflowId)||Number(t.workflowId)<1)throw new w("Workflow IDs are positive 1-indexed integers.");let r=BigInt(Number(t.workflowId));return{workflowId:r,matchingWorkflowIds:[r],workflowScanTruncated:!1}}let l=t.address===void 0?t.wallet:t.address;if(typeof l!="string"||!P(l))throw new w("Provide a valid Upoch owner, executor, or guardian address.");let[d]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"workflowCount"}]}),i=Number(d);if(!Number.isSafeInteger(i)||i<0)throw new w("Epoch returned an invalid workflow count.");let u=Math.min(i,a.maxWorkflows);if(!u)throw new w("No Upoch workflow matched this address.");let f=Array.from({length:u},(r,h)=>h+1).flatMap(r=>[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[BigInt(r)]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[BigInt(r)]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[BigInt(r)]}]),p=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:f}),m=[];for(let r=0;r<u;r++){let h=p[r*3],g=p[r*3+1],o=p[r*3+2];[h.owner,...g,...o].some(y=>y.toLowerCase()===l.toLowerCase())&&m.push(BigInt(r+1))}if(!m.length)throw new w(`No Upoch workflow matched address ${l}${i>u?" within the first 100 workflows":""}.`);return{workflowId:m[m.length-1],matchingWorkflowIds:m,workflowScanTruncated:i>u}}async function L(n,t,b,l,d={}){let i=T(b),[u,f,p,m,r,h,g]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[t]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[t]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[t]},{address:a.epoch,abi:c,functionName:"activeProposalId",args:[t]},{address:a.epoch,abi:c,functionName:"proposalCount",args:[t]},{address:a.epoch,abi:c,functionName:"rollbackCount",args:[t]},{address:a.epoch,abi:c,functionName:"recoveryOutcomeCount",args:[t]}]}),o=u,y=o.checkpointCount>0n?[{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[t,0n]},{address:a.epoch,abi:c,functionName:"getCheckpoints",args:[t,o.checkpointCount>BigInt(i)?o.checkpointCount-BigInt(i):0n,BigInt(i)]}]:[],S=[...h>0n?[{address:a.epoch,abi:c,functionName:"getRollbackRecords",args:[t,h>5n?h-5n:0n,5n]}]:[],...g>0n?[{address:a.epoch,abi:c,functionName:"getRecoveryOutcomes",args:[t,g>5n?g-5n:0n,5n]}]:[]],[e,s]=await Promise.all([y.length?n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:y}):Promise.resolve([]),S.length?n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:S}):Promise.resolve([])]),k=e[0],A=e[1]??[];return{workflowId:t.toString(),status:o.status===0?"Active":o.status===1?"Paused":"unknown",owner:o.owner,pendingOwner:o.pendingOwner,executors:f,guardians:p,policy:{guardianThreshold:o.policy.guardianThreshold,ownerApprovalRequired:o.policy.ownerApprovalRequired,ownerFallbackDelaySeconds:o.policy.ownerFallbackDelay,timelockSeconds:o.policy.timelock,approvalWindowSeconds:o.policy.approvalWindow,executionWindowSeconds:o.policy.executionWindow},metadata:R(o.metadataURI),metadataTruncated:o.metadataURI.length>4096,upochScore:W(o,f,p,k,A[A.length-1]??k),checkpoints:{total:o.checkpointCount.toString(),headSequence:o.checkpointCount>0n?o.headSequence.toString():null,headHash:o.checkpointCount>0n?o.headHash:null,firstCheckpointAt:k?k.timestamp.toString():null,recent:A.map(C=>({...C,timestamp:C.timestamp.toString()})),selected:l?{...l,timestamp:l.timestamp.toString()}:void 0},recovery:{activeProposalId:m>0n?m.toString():null,proposalCount:r.toString(),rollbackCount:h.toString(),recoveryOutcomeCount:g.toString(),recent:s},matchingWorkflowIds:(d.matchingWorkflowIds??[t]).map(C=>C.toString()),coverage:{checkpointHistory:"complete",recoveryHistory:S.length?"recent-five":"complete",workflowScan:d.workflowScanTruncated?"partial-first-100":"complete"}}}async function _(n,t={}){let b=q(t.limit);if(t.status!==void 0&&!["all","Active","Paused"].includes(String(t.status)))throw new w("Explorer status must be all, Active, or Paused.");if(await n.getChainId()!==a.chainId)throw new w("Upoch reads require Robinhood Chain 4663.");let[l]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"workflowCount"}]}),d=Number(l);if(!Number.isSafeInteger(d)||d<0)throw new w("Epoch returned an invalid workflow count.");let i=Math.min(d,a.maxWorkflows),u=Array.from({length:i},(e,s)=>BigInt(s+1)).flatMap(e=>[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[e]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[e]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[e]}]),f=u.length?await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:u}):[],p=Array.from({length:i},(e,s)=>({id:BigInt(s+1),workflow:f[s*3],executors:f[s*3+1],guardians:f[s*3+2]})),m=p.flatMap(({id:e,workflow:s})=>s.checkpointCount>0n?[{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[e,0n]},{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[e,s.headSequence]}]:[]),r=m.length?await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:m}):[],h=0,g=Math.floor(Date.now()/1e3),o=p.map(({id:e,workflow:s,executors:k,guardians:A})=>{let C=s.checkpointCount>0n?r[h++]:void 0,N=s.checkpointCount>0n?r[h++]:void 0;return{id:e,workflow:s,executors:k,guardians:A,first:C,head:N,score:W(s,k,A,C,N,g)}}).filter(e=>t.status===void 0||t.status==="all"||(t.status==="Active"?e.workflow.status===0:e.workflow.status===1));o.sort((e,s)=>s.score.total-e.score.total||Number(e.id-s.id));let y=o.reduce((e,s)=>e+(s.head&&g-Number(s.head.timestamp)<=x?1:0),0),S=o.slice(0,b).map((e,s)=>({rank:s+1,workflowId:e.id.toString(),...R(e.workflow.metadataURI),status:e.workflow.status===0?"Active":"Paused",owner:e.workflow.owner,upochScore:{total:e.score.total,grade:e.score.grade},checkpointCount:e.workflow.checkpointCount.toString(),lastCheckpointAt:e.head?.timestamp.toString()??null,guardianCount:e.guardians.length,executorCount:e.executors.length,agentUrl:`https://upoch.tech/app/agents/${e.id}`}));return{summary:{totalWorkflows:d,scannedWorkflows:i,totalCheckpoints:p.reduce((e,s)=>e+Number(s.workflow.checkpointCount),0),checkpointsLast24h:null,workflowsWithCheckpointLast24h:y,averageScore:o.length?Math.round(o.reduce((e,s)=>e+s.score.total,0)/o.length):0},agents:S,coverage:{workflows:i<d?"partial-first-100":"complete",recentCheckpointCount:"unavailable-head-only-read",statusFilter:t.status??"all"}}}export{W as a,c as b,T as c,D as d,L as e,_ as f};
1
+ import{a as I}from"./FXOFR432.js";import{a}from"./O2J5I4VA.js";import{a as w}from"./XSD5NL7J.js";import{a as v}from"./JXOEJPJ4.js";import{isAddress as P,isHex as E,parseAbi as U}from"viem";var x=86400;function H(n){return Math.round((n+Number.EPSILON)*10)/10}function W(n,t,b,l,d,i=Math.floor(Date.now()/1e3)){let u=n.policy,f=(b.length>=1&&u.guardianThreshold>=1?12:0)+(u.timelock>=3600?10:0)+(u.ownerApprovalRequired||u.guardianThreshold>=2?4:0)+(t.length?4:0),p=n.checkpointCount===0n?0:Math.min(30,H(30*Math.log10(Number(n.checkpointCount)+1)/Math.log10(101))),m=n.status!==0||n.checkpointCount===0n||!d?0:i-Number(d.timestamp)<=x?20:i-Number(d.timestamp)<=7*x?12:i-Number(d.timestamp)<=30*x?6:0,r=l?Math.min(20,H(20*Math.max(0,i-Number(l.timestamp))/(30*x))):0,h=Math.round(f+p+m+r);return{total:h,grade:h>=80?"A":h>=60?"B":h>=40?"C":"D",breakdown:{recoveryProtection:{points:f,max:30},checkpointHistory:{points:Math.round(p),rawPoints:p,max:30},activity:{points:m,max:20},timeOnChain:{points:Math.round(r),rawPoints:r,max:20}},note:I}}function R(n){let t=v(n.slice(0,4096)),b,l=/^data:application\/json;base64,([A-Za-z0-9+/]*={0,2})$/.exec(n.slice(0,5500));if(l)try{let i=atob(l[1]);if(i.length<=4096){let u=JSON.parse(new TextDecoder().decode(Uint8Array.from(i,f=>f.charCodeAt(0))));u&&typeof u=="object"&&!Array.isArray(u)&&(b=u)}}catch{}let d=i=>typeof b?.[i]=="string"?v(b[i]):void 0;return{rawUri:t,name:d("name"),agentType:d("agentType"),description:d("description")}}function q(n){if(n===void 0)return 20;if(!Number.isSafeInteger(n)||Number(n)<1||Number(n)>50)throw new w("Explorer limit must be an integer from 1 to 50.");return Number(n)}var c=U(["function workflowCount() view returns (uint256)","function getWorkflow(uint256) view returns ((address owner,address pendingOwner,uint8 status,(uint8 guardianThreshold,bool ownerApprovalRequired,uint32 ownerFallbackDelay,uint32 timelock,uint32 approvalWindow,uint32 executionWindow) policy,uint64 checkpointCount,uint64 headSequence,bytes32 headHash,uint256 activeProposalId,string metadataURI))","function getExecutors(uint256) view returns (address[])","function getGuardians(uint256) view returns (address[])","function getCheckpoint(uint256,uint64) view returns ((bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp))","function getCheckpoints(uint256,uint64,uint256) view returns ((bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp)[])","function getCheckpointById(bytes32) view returns (uint256 workflowId,uint64 sequence,(bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp) checkpoint)","function activeProposalId(uint256) view returns (uint256)","function proposalCount(uint256) view returns (uint256)","function rollbackCount(uint256) view returns (uint256)","function recoveryOutcomeCount(uint256) view returns (uint256)","function getRollbackRecords(uint256,uint256,uint256) view returns ((uint256 proposalId,uint64 fromSequence,uint64 toSequence,uint64 executedAt)[])","function getRecoveryOutcomes(uint256,uint256,uint256) view returns ((bytes32 recoveryId,uint64 checkpointSequence,uint8 outcome,bytes32 resultHash,address recorder,uint64 recordedAt)[])"]);function T(n){if(n===void 0)return a.defaultCheckpointLimit;if(!Number.isInteger(n)||Number(n)<1||Number(n)>a.maxCheckpointLimit)throw new w("Checkpoint limit must be an integer from 1 to 25.");return Number(n)}async function D(n,t){if([t.workflowId!==void 0,t.address!==void 0,t.checkpointHash!==void 0].filter(Boolean).length>1)throw new w("Choose one Upoch selector: workflowId, address, or checkpointHash.");if(await n.getChainId()!==a.chainId)throw new w("Upoch reads require Robinhood Chain 4663.");if(t.checkpointHash!==void 0){if(typeof t.checkpointHash!="string"||!E(t.checkpointHash,{strict:!0})||t.checkpointHash.length!==66)throw new w("Provide a 32-byte Upoch checkpoint hash.");let[r]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"getCheckpointById",args:[t.checkpointHash]}]});return{workflowId:r[0],selectedCheckpoint:r[2],matchingWorkflowIds:[r[0]],workflowScanTruncated:!1}}if(t.workflowId!==void 0){if(!Number.isSafeInteger(t.workflowId)||Number(t.workflowId)<1)throw new w("Workflow IDs are positive 1-indexed integers.");let r=BigInt(Number(t.workflowId));return{workflowId:r,matchingWorkflowIds:[r],workflowScanTruncated:!1}}let l=t.address===void 0?t.wallet:t.address;if(typeof l!="string"||!P(l))throw new w("Provide a valid Upoch owner, executor, or guardian address.");let[d]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"workflowCount"}]}),i=Number(d);if(!Number.isSafeInteger(i)||i<0)throw new w("Epoch returned an invalid workflow count.");let u=Math.min(i,a.maxWorkflows);if(!u)throw new w("No Upoch workflow matched this address.");let f=Array.from({length:u},(r,h)=>h+1).flatMap(r=>[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[BigInt(r)]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[BigInt(r)]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[BigInt(r)]}]),p=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:f}),m=[];for(let r=0;r<u;r++){let h=p[r*3],g=p[r*3+1],o=p[r*3+2];[h.owner,...g,...o].some(y=>y.toLowerCase()===l.toLowerCase())&&m.push(BigInt(r+1))}if(!m.length)throw new w(`No Upoch workflow matched address ${l}${i>u?" within the first 100 workflows":""}.`);return{workflowId:m[m.length-1],matchingWorkflowIds:m,workflowScanTruncated:i>u}}async function L(n,t,b,l,d={}){let i=T(b),[u,f,p,m,r,h,g]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[t]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[t]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[t]},{address:a.epoch,abi:c,functionName:"activeProposalId",args:[t]},{address:a.epoch,abi:c,functionName:"proposalCount",args:[t]},{address:a.epoch,abi:c,functionName:"rollbackCount",args:[t]},{address:a.epoch,abi:c,functionName:"recoveryOutcomeCount",args:[t]}]}),o=u,y=o.checkpointCount>0n?[{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[t,0n]},{address:a.epoch,abi:c,functionName:"getCheckpoints",args:[t,o.checkpointCount>BigInt(i)?o.checkpointCount-BigInt(i):0n,BigInt(i)]}]:[],S=[...h>0n?[{address:a.epoch,abi:c,functionName:"getRollbackRecords",args:[t,h>5n?h-5n:0n,5n]}]:[],...g>0n?[{address:a.epoch,abi:c,functionName:"getRecoveryOutcomes",args:[t,g>5n?g-5n:0n,5n]}]:[]],[e,s]=await Promise.all([y.length?n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:y}):Promise.resolve([]),S.length?n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:S}):Promise.resolve([])]),k=e[0],A=e[1]??[];return{workflowId:t.toString(),status:o.status===0?"Active":o.status===1?"Paused":"unknown",owner:o.owner,pendingOwner:o.pendingOwner,executors:f,guardians:p,policy:{guardianThreshold:o.policy.guardianThreshold,ownerApprovalRequired:o.policy.ownerApprovalRequired,ownerFallbackDelaySeconds:o.policy.ownerFallbackDelay,timelockSeconds:o.policy.timelock,approvalWindowSeconds:o.policy.approvalWindow,executionWindowSeconds:o.policy.executionWindow},metadata:R(o.metadataURI),metadataTruncated:o.metadataURI.length>4096,upochScore:W(o,f,p,k,A[A.length-1]??k),checkpoints:{total:o.checkpointCount.toString(),headSequence:o.checkpointCount>0n?o.headSequence.toString():null,headHash:o.checkpointCount>0n?o.headHash:null,firstCheckpointAt:k?k.timestamp.toString():null,recent:A.map(C=>({...C,timestamp:C.timestamp.toString()})),selected:l?{...l,timestamp:l.timestamp.toString()}:void 0},recovery:{activeProposalId:m>0n?m.toString():null,proposalCount:r.toString(),rollbackCount:h.toString(),recoveryOutcomeCount:g.toString(),recent:s},matchingWorkflowIds:(d.matchingWorkflowIds??[t]).map(C=>C.toString()),coverage:{checkpointHistory:"complete",recoveryHistory:S.length?"recent-five":"complete",workflowScan:d.workflowScanTruncated?"partial-first-100":"complete"}}}async function _(n,t={}){let b=q(t.limit);if(t.status!==void 0&&!["all","Active","Paused"].includes(String(t.status)))throw new w("Explorer status must be all, Active, or Paused.");if(await n.getChainId()!==a.chainId)throw new w("Upoch reads require Robinhood Chain 4663.");let[l]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"workflowCount"}]}),d=Number(l);if(!Number.isSafeInteger(d)||d<0)throw new w("Epoch returned an invalid workflow count.");let i=Math.min(d,a.maxWorkflows),u=Array.from({length:i},(e,s)=>BigInt(s+1)).flatMap(e=>[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[e]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[e]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[e]}]),f=u.length?await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:u}):[],p=Array.from({length:i},(e,s)=>({id:BigInt(s+1),workflow:f[s*3],executors:f[s*3+1],guardians:f[s*3+2]})),m=p.flatMap(({id:e,workflow:s})=>s.checkpointCount>0n?[{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[e,0n]},{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[e,s.headSequence]}]:[]),r=m.length?await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:m}):[],h=0,g=Math.floor(Date.now()/1e3),o=p.map(({id:e,workflow:s,executors:k,guardians:A})=>{let C=s.checkpointCount>0n?r[h++]:void 0,N=s.checkpointCount>0n?r[h++]:void 0;return{id:e,workflow:s,executors:k,guardians:A,first:C,head:N,score:W(s,k,A,C,N,g)}}).filter(e=>t.status===void 0||t.status==="all"||(t.status==="Active"?e.workflow.status===0:e.workflow.status===1));o.sort((e,s)=>s.score.total-e.score.total||Number(e.id-s.id));let y=o.reduce((e,s)=>e+(s.head&&g-Number(s.head.timestamp)<=x?1:0),0),S=o.slice(0,b).map((e,s)=>({rank:s+1,workflowId:e.id.toString(),...R(e.workflow.metadataURI),status:e.workflow.status===0?"Active":"Paused",owner:e.workflow.owner,upochScore:{total:e.score.total,grade:e.score.grade},checkpointCount:e.workflow.checkpointCount.toString(),lastCheckpointAt:e.head?.timestamp.toString()??null,guardianCount:e.guardians.length,executorCount:e.executors.length,agentUrl:`https://upoch.tech/app/agents/${e.id}`}));return{summary:{totalWorkflows:d,scannedWorkflows:i,totalCheckpoints:p.reduce((e,s)=>e+Number(s.workflow.checkpointCount),0),checkpointsLast24h:null,workflowsWithCheckpointLast24h:y,averageScore:o.length?Math.round(o.reduce((e,s)=>e+s.score.total,0)/o.length):0},agents:S,coverage:{workflows:i<d?"partial-first-100":"complete",recentCheckpointCount:"unavailable-head-only-read",statusFilter:t.status??"all"}}}export{W as a,c as b,T as c,D as d,L as e,_ as f};
@@ -1 +1 @@
1
- import{j as p}from"./3BQ5XHDJ.js";import{a as d}from"./Z7FGEWO2.js";import{a as f}from"./43LI5NKJ.js";import{d as a,i as c}from"./NWNYJ26T.js";import{b as m}from"./IX3GZMTM.js";import{b as i}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
1
+ import{j as p}from"./Y7SKGRWC.js";import{a as d}from"./7WXAS54T.js";import{a as f}from"./43LI5NKJ.js";import{d as a,i as c}from"./NWNYJ26T.js";import{b as m}from"./IX3GZMTM.js";import{b as i}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
@@ -0,0 +1 @@
1
+ import{i as u,m as y,n as l}from"./5Y457HYC.js";import{a as g}from"./IJVBCEA2.js";import{e as f,i as p}from"./UMY6SP7C.js";import{a as s}from"./XSD5NL7J.js";import{decodeAbiParameters as k,encodeAbiParameters as A,zeroAddress as w}from"viem";var Z="Zap Target requires its own advisory and a frozen list of factory-created feeder vaults; this launch uses the advisory slot for the agent gate.",h=[{type:"tuple",components:[{name:"factory",type:"address"},{name:"feeders",type:"address[]"}]}],b={id:"zap-target",address:"0x59834ed88E72c59EB4fB0eF3cB0D95eCA98223E3",minGas:3e5};function x(e){f(e,["factory","feeders"],["factory","feeders"]);let a=p(e.factory);if(!Array.isArray(e.feeders)||e.feeders.length<1||e.feeders.length>4)throw new s("Zap Target requires one to four feeder vaults.");let t=e.feeders.map(p);if(a===w||t.some(o=>o===w)||new Set(t.map(o=>o.toLowerCase())).size!==t.length)throw new s("Zap Target requires a nonzero factory and distinct nonzero feeders.");return A(h,[{factory:a,feeders:t}])}function T(e){let[a]=k(h,e);if(x(a).toLowerCase()!==e.toLowerCase())throw new s("Non-canonical Zap Target terms; session tiers are not supported.");return a}function S(e){let a=T(e);return`Zap Target: buys are gated to feeder vaults ${a.feeders.join(", ")} created by ${a.factory}; sells remain open. Only the liquidity owner and feeder vaults may add liquidity. Each vault's immutable route controls custody, protocol share, caller bounty, timing and target purchases and must be verified separately.`}var z={address:b.address,codeHash:"0xf9fb16725ac563c7684f22596e08450624230b66f58fd5872f37ff1699921037",schemaHash:"0x67fad64d676b583a8d694af1d0bfe44ab753db2e6eff0fcac13d6c25ed1b6b5e",phaseMask:1,feeOnly:!1,gasMin:3e5};async function B(e,a,t,o){if(f(t,["feeders","routes"],["feeders","routes"]),!Array.isArray(t.feeders)||!Array.isArray(t.routes)||t.feeders.length!==t.routes.length)throw new s("Zap Target requires one complete requested route per feeder.");let i=x({factory:u.address,feeders:t.feeders}),{feeders:m}=T(i);await g(e,a,u,1,{maxLpFeePips:0n,maxQuoteTakePips:0n,maxSubjectTakeBps:0n});let c=await Promise.all(m.map((r,d)=>y(e,a,r,t.routes[d]))),n=(r,d)=>String(r).toLowerCase()===String(d).toLowerCase();for(let{terms:r}of c)if(!o.rules||!n(r.targetId,o.poolId)||!n(r.gate,b.address)||!n(r.quote,o.quote)||!n(r.subject,o.subject)||!n(r.rules,o.rules)||r.tickSpacing!==BigInt(o.tickSpacing)||r.windowScope!==c[0].terms.windowScope)throw new s("Zap Target feeder pool, quote, rules, gate or impact-window scope differs from this launch.");return{data:i,descriptor:z,phases:1,bounds:{maxLpFeePips:0n,maxQuoteTakePips:0n,maxSubjectTakeBps:0n},summary:`${S(i)} Buys are feeder-only and require no agent identity; sells stay open. ${c.map((r,d)=>l(m[d],r.terms)).join(" ")}`}}export{Z as a,h as b,b as c,x as d,T as e,S as f,z as g,B as h};
@@ -1 +1 @@
1
- import{h as re,i as ae}from"./2GXHYI23.js";import{a as j}from"./43LI5NKJ.js";import{a as G}from"./66F5ZH34.js";import{d as ne,f as te,g as v,i as oe}from"./NWNYJ26T.js";import{b as f,j as ee}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{a as E}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as me,erc20Abi as V,getAddress as y,hashMessage as pe,keccak256 as ge,parseAbi as D,recoverMessageAddress as we,toHex as be,zeroAddress as _}from"viem";var w=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),N=y("0xf08c65564eb07d880021105489552080b08e4319"),ie=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),se=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),ue=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),F={address:y(ee[f].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:f},A=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)"]),he=D(["function getContract(bytes32) view returns (address)"]),ye=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],Ie={loanPrincipalAmount:'Amount of USDG the lender advances, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.',maximumRepaymentAmount:'Maximum USDG the borrower repays at maturity, in base units (USDG has 6 decimals). Example: "1100000" = 1.1 USDG.',nftCollateralId:"Token id of the Robinhood Punks NFT pledged as collateral, as a decimal string.",nftCollateralContract:"Address of the NFT collection contract pledged as collateral; must be the Robinhood Punks collection.",loanDuration:"Loan length in seconds, as a decimal string (86400 = 1 day).",loanAdminFeeInBasisPoints:"Protocol admin fee in basis points (50 = 0.5%), as a decimal string, copied from the lender offer.",loanERC20Denomination:"Address of the ERC-20 token the loan is denominated in; must be canonical USDG.",referrer:"Referrer address recorded in the offer; must be the zero address 0x0000000000000000000000000000000000000000."},Ae={nonce:"Lender signature nonce, as a decimal string; a used nonce cannot be reused.",expiry:"Unix seconds after which the lender signature is no longer valid, as a decimal string.",signer:"Address of the lender who signed the offer.",signature:"Lender signature over the offer terms, as 0x-prefixed hex bytes. Oak never signs lender offers."},R=n=>te(n,"Provide the documented Longbow NFT object.");function x(n,l){if(Object.keys(n).some(i=>!l.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,l=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(l))throw new o(`NFT amounts and IDs must be uint${l} decimal strings.`);return BigInt(n)}function m(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 de(n,l,i=!0){let s=R(n),e=R(l);x(s,M),x(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:m(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:m(s.loanERC20Denomination),referrer:m(s.referrer)};if(i&&(!v(t.nftCollateralContract,N)||!v(t.loanERC20Denomination,F.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:m(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function Ne(n){let{offer:l,signature:i}=n;return ge(me(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[l.loanERC20Denomination,l.loanPrincipalAmount,l.maximumRepaymentAmount,l.nftCollateralContract,l.nftCollateralId,l.referrer,l.loanDuration,l.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,w,BigInt(f)]))}function le(n,l){if(n.filter(s=>s.token.chainId===f&&v(s.token.address,F.address)).reduce((s,e)=>{if(e.token.decimals!==F.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==l)throw new o("NFT preview does not match the exact principal or payoff.")}async function ce(n){let l=n.clientFor(f);if(await l.getChainId()!==f)throw new o("Longbow NFT loans require chain 4663.");let i=await l.getBlock(),s=(a,g,p,u=[])=>l.readContract({address:a,abi:g,functionName:p,args:u,blockNumber:i.number}),[e,t,r,c]=await Promise.all([s(w,A,"hub"),s(ie,he,"getContract",[be("PERMITTED_NFTS",{size:32})]),s(se,ye,"getNFTWrapper",[N]),s(N,J,"supportsInterface",["0x80ac58cd"])]);if(m(e)!==ie||m(t)!==se||m(r)!==ue||c!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:l,block:i,read:s}}async function q(n,l){let i=Number(h(l,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(f);if(await s.getChainId()!==f)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,U,b=[])=>s.readContract({address:T,abi:I,functionName:U,args:b,blockNumber:e.number}),[r,c,a]=await Promise.all([t(w,A,"loanIdToLoan",[i]),t(w,A,"loanRepaidOrLiquidated",[i]),t(w,A,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof c!="boolean")throw new o("Invalid NFT loan state.");let[g,p,u,d,z,,,$,S,B,L]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let O=m(d)===F.address&&m(B)===N&&m($)===ue&&m(L)!==_,k=F;if(m(d)!==F.address){let[T,I]=await Promise.all([t(m(d),V,"symbol"),t(m(d),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");k={address:m(d),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:f}}if(typeof a!="bigint"||a!==BigInt(p)||a<BigInt(g))throw new o("NFT payoff does not match the fixed loan terms.");let C=BigInt(S)+BigInt(z);return{loanId:l,loanContract:w,chainId:f,blockNumber:e.number.toString(),collection:m(B),wrapper:m($),tokenId:String(u),borrower:m(L),currency:k,supportedForActions:O,principalAmount:String(g),payoffAmount:a.toString(),startedAt:String(S),deadline:C.toString(),deadlineUtc:K(C),status:c?"repaid_or_liquidated":e.timestamp>C?"overdue":"active",repayable:!c&&e.timestamp<=C,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,l){let i=await n.http(`https://longbow.credit/api/nft${l}`,{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(R)}var Re=n=>{async function l(e,t,r){if(j(t),r){if(x(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await q(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 fe=h(e.maxPayoff);if(await ce(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 P=BigInt(b.payoffAmount);if(P>fe)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(f).readContract({address:F.address,abi:V,functionName:"balanceOf",args:[t]})<P)throw new o(`NFT repayment needs ${P} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${P} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(F.address,w,P.toString(),f),n.unsignedTx({to:w,data:W({abi:A,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:f,description:Y})],X=await n.preview(Q,t);return le(X.changes,-P),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}x(e,["offer","lenderSignature"]);let c=de(e.offer,e.lenderSignature),{offer:a,signature:g}=c,{client:p,block:u,read:d}=await ce(n),[z,$,S,B,L]=await Promise.all([d(N,J,"ownerOf",[a.nftCollateralId]),d(w,A,"getWhetherNonceHasBeenUsedForUser",[g.signer,g.nonce]),d(w,A,"paused"),d(w,A,"maximumLoanDuration"),d(w,A,"adminFeeInBasisPoints")]);if(m(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if($!==!1||S!==!1||g.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==L)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let O=Ne(c),k=!1;try{k=v(await we({message:{raw:O},signature:g.signature}),g.signer)}catch{}if(!k){let b=await p.getCode({address:g.signer,blockNumber:u.number});b&&b!=="0x"&&(k=await d(g.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[pe({raw:O}),g.signature])==="0x1626ba7e")}if(!k)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let C=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(C)} 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 ${w}.`,I=[n.unsignedTx({to:N,data:W({abi:J,functionName:"approve",args:[w,a.nftCollateralId]}),value:"0",chainId:f,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:w,data:W({abi:A,functionName:"acceptOffer",args:[a,g,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:f,description:T})],U=await n.preview(I,t);return le(U.changes,a.loanPrincipalAmount),{txs:I,preview:U,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(C),deadlineIsEstimate:!0}}let i=(e,t,r,c)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,g)=>{try{return await c(a,g)}catch(p){throw new o(n.plainError(p))}}});async function s(e){j(e);let t=(r,c)=>{let a=`Longbow borrower NFT loans unreadable: ${n.plainError(c)}`;return{module:"longbow",id:`4663:${w.toLowerCase()}:${r}`,chainId:f,incomplete:!0,assets:[],economics:{principal:[],debt:[],rewards:[],backing:[],coverage:{complete:!1,reason:a}},description:`${a} 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 c=new Set,a=[];for(let[g,p]of r.entries()){let u=`unreadable-${g}`;try{if(p.loanContract!==void 0&&m(p.loanContract)!==w)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(p.loanId??p.id),32).toString(),c.has(u))continue;c.add(u);let d=await q(n,u);if(d.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(d.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${w.toLowerCase()}:${u}`,chainId:f,assets:[],economics:{principal:[re("collateral",{token:{address:d.collection,symbol:"NFT",decimals:0,chainId:f},amount:"1",tokenId:d.tokenId,source:"longbow.nft.collateral",measuredAtBlock:d.blockNumber})],debt:[ae({token:d.currency,amount:d.payoffAmount,source:"longbow.nft.payoffAmount",dueAt:d.deadline,measuredAtBlock:d.blockNumber})],rewards:[],backing:[],coverage:{complete:!0}},description:`Longbow borrower NFT loan ${u}: ${d.status}, payoff debt ${d.payoffAmount} ${d.currency.symbol} base units (token ${d.currency.address}, decimals ${d.currency.decimals}); collateral ${d.collection} token ID ${d.tokenId} is escrowed. Deadline ${d.deadlineUtc}. ${d.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(d){a.push(t(u,d))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{x(e,[]);let t=await H(n,"/listings");return{chainId:f,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==f)throw new o("Longbow returned a listing on another chain.");return{id:E(String(r.id)),collection:m(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:m(r.borrower??r.owner),status:E(String(r.status)),note:r.note==null?null:E(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128,description:"Longbow NFT listing id, as returned by longbow_nft_listings (letters, digits, underscore or hyphen)."}},["listingId"],async e=>{if(x(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 c=r.raw?R(r.raw):r,a={...R(c.offer??Object.fromEntries(M.map(p=>[p,c[p]])))};for(let p of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[p];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[p]=String(u))}let g=de(a,typeof c.signature=="object"?c.signature:{nonce:c.nonce,expiry:c.expiry,signer:c.signer??c.lender,signature:c.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...g},(p,u)=>typeof u=="bigint"||p==="loanDuration"||p==="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:G('Longbow NFT loan id, as a decimal string. Example: "1".')},["loanId"],async e=>{if(x(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return q(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"],description:'Which loans to list for this wallet: "borrower" (default) for loans it took out, "lender" for loans it funded.'}},[],async(e,t)=>{x(e,["role"]),j(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let c=await H(n,`/loans/${r}/${y(t)}`);if(c.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(c.map(a=>{if(a.loanContract!==void 0&&m(a.loanContract)!==w)throw new o("The NFT indexer returned a loan from another contract.");return q(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",description:"Lender-signed NFT loan terms to accept, exactly as returned by longbow_nft_offers.",properties:Object.fromEntries(M.map(e=>[e,{type:"string",description:Ie[e]}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",description:"The lender signature and its nonce, expiry and signer, as returned with the offer.",properties:Object.fromEntries(Z.map(e=>[e,{type:"string",description:Ae[e]}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>l(e,t,!1)),i("longbow_nft_repay",{loanId:G('Longbow NFT loan id to repay, as a decimal string. Example: "1".'),maxPayoff:G('Highest USDG payoff you accept, in base units (USDG has 6 decimals). Example: "1100000" = 1.1 USDG.')},["loanId","maxPayoff"],(e,t)=>l(e,t,!0))]}};async function $e(n,l,i){if(await n.getChainId()!==f||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:N,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,l))return;let t=await n.readContract({address:N,abi:s,functionName:"getApproved",args:[i]});if(v(t,w))return{to:N,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:f,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{w as a,N as b,ie as c,se as d,ue as e,A as f,h as g,de as h,Ne as i,q as j,Re as k,$e as l};
1
+ import{h as re,i as ae}from"./2GXHYI23.js";import{a as j}from"./43LI5NKJ.js";import{a as G}from"./66F5ZH34.js";import{d as ne,f as te,g as v,i as oe}from"./NWNYJ26T.js";import{b as f,j as ee}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{a as E}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as me,erc20Abi as V,getAddress as y,hashMessage as pe,keccak256 as ge,parseAbi as D,recoverMessageAddress as we,toHex as be,zeroAddress as _}from"viem";var w=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),N=y("0xf08c65564eb07d880021105489552080b08e4319"),ie=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),se=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),ue=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),F={address:y(ee[f].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:f},A=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)"]),he=D(["function getContract(bytes32) view returns (address)"]),ye=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],Ie={loanPrincipalAmount:'Amount of USDG the lender advances, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.',maximumRepaymentAmount:'Maximum USDG the borrower repays at maturity, in base units (USDG has 6 decimals). Example: "1100000" = 1.1 USDG.',nftCollateralId:"Token id of the Robinhood Punks NFT pledged as collateral, as a decimal string.",nftCollateralContract:"Address of the NFT collection contract pledged as collateral; must be the Robinhood Punks collection.",loanDuration:"Loan length in seconds, as a decimal string (86400 = 1 day).",loanAdminFeeInBasisPoints:"Protocol admin fee in basis points (50 = 0.5%), as a decimal string, copied from the lender offer.",loanERC20Denomination:"Address of the ERC-20 token the loan is denominated in; must be canonical USDG.",referrer:"Referrer address recorded in the offer; must be the zero address 0x0000000000000000000000000000000000000000."},Ae={nonce:"Lender signature nonce, as a decimal string; a used nonce cannot be reused.",expiry:"Unix seconds after which the lender signature is no longer valid, as a decimal string.",signer:"Address of the lender who signed the offer.",signature:"Lender signature over the offer terms, as 0x-prefixed hex bytes. Oak never signs lender offers."},R=n=>te(n,"Provide the documented Longbow NFT object.");function x(n,l){if(Object.keys(n).some(i=>!l.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,l=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(l))throw new o(`NFT amounts and IDs must be uint${l} decimal strings.`);return BigInt(n)}function m(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 de(n,l,i=!0){let s=R(n),e=R(l);x(s,M),x(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:m(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:m(s.loanERC20Denomination),referrer:m(s.referrer)};if(i&&(!v(t.nftCollateralContract,N)||!v(t.loanERC20Denomination,F.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:m(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function Ne(n){let{offer:l,signature:i}=n;return ge(me(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[l.loanERC20Denomination,l.loanPrincipalAmount,l.maximumRepaymentAmount,l.nftCollateralContract,l.nftCollateralId,l.referrer,l.loanDuration,l.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,w,BigInt(f)]))}function le(n,l){if(n.filter(s=>s.token.chainId===f&&v(s.token.address,F.address)).reduce((s,e)=>{if(e.token.decimals!==F.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==l)throw new o("NFT preview does not match the exact principal or payoff.")}async function ce(n){let l=n.clientFor(f);if(await l.getChainId()!==f)throw new o("Longbow NFT loans require chain 4663.");let i=await l.getBlock(),s=(a,g,p,u=[])=>l.readContract({address:a,abi:g,functionName:p,args:u,blockNumber:i.number}),[e,t,r,c]=await Promise.all([s(w,A,"hub"),s(ie,he,"getContract",[be("PERMITTED_NFTS",{size:32})]),s(se,ye,"getNFTWrapper",[N]),s(N,J,"supportsInterface",["0x80ac58cd"])]);if(m(e)!==ie||m(t)!==se||m(r)!==ue||c!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:l,block:i,read:s}}async function q(n,l){let i=Number(h(l,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(f);if(await s.getChainId()!==f)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,U,b=[])=>s.readContract({address:T,abi:I,functionName:U,args:b,blockNumber:e.number}),[r,c,a]=await Promise.all([t(w,A,"loanIdToLoan",[i]),t(w,A,"loanRepaidOrLiquidated",[i]),t(w,A,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof c!="boolean")throw new o("Invalid NFT loan state.");let[g,p,u,d,z,,,$,S,B,L]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let O=m(d)===F.address&&m(B)===N&&m($)===ue&&m(L)!==_,k=F;if(m(d)!==F.address){let[T,I]=await Promise.all([t(m(d),V,"symbol"),t(m(d),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");k={address:m(d),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:f}}if(typeof a!="bigint"||a!==BigInt(p)||a<BigInt(g))throw new o("NFT payoff does not match the fixed loan terms.");let C=BigInt(S)+BigInt(z);return{loanId:l,loanContract:w,chainId:f,blockNumber:e.number.toString(),collection:m(B),wrapper:m($),tokenId:String(u),borrower:m(L),currency:k,supportedForActions:O,principalAmount:String(g),payoffAmount:a.toString(),startedAt:String(S),deadline:C.toString(),deadlineUtc:K(C),status:c?"repaid_or_liquidated":e.timestamp>C?"overdue":"active",repayable:!c&&e.timestamp<=C,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,l){let i=await n.http(`https://longbow.credit/api/nft${l}`,{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(R)}var Re=n=>{async function l(e,t,r){if(j(t),r){if(x(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await q(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 fe=h(e.maxPayoff);if(await ce(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 P=BigInt(b.payoffAmount);if(P>fe)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(f).readContract({address:F.address,abi:V,functionName:"balanceOf",args:[t]})<P)throw new o(`NFT repayment needs ${P} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${P} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(F.address,w,P.toString(),f),n.unsignedTx({to:w,data:W({abi:A,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:f,description:Y})],X=await n.preview(Q,t);return le(X.changes,-P),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}x(e,["offer","lenderSignature"]);let c=de(e.offer,e.lenderSignature),{offer:a,signature:g}=c,{client:p,block:u,read:d}=await ce(n),[z,$,S,B,L]=await Promise.all([d(N,J,"ownerOf",[a.nftCollateralId]),d(w,A,"getWhetherNonceHasBeenUsedForUser",[g.signer,g.nonce]),d(w,A,"paused"),d(w,A,"maximumLoanDuration"),d(w,A,"adminFeeInBasisPoints")]);if(m(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if($!==!1||S!==!1||g.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==L)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let O=Ne(c),k=!1;try{k=v(await we({message:{raw:O},signature:g.signature}),g.signer)}catch{}if(!k){let b=await p.getCode({address:g.signer,blockNumber:u.number});b&&b!=="0x"&&(k=await d(g.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[pe({raw:O}),g.signature])==="0x1626ba7e")}if(!k)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let C=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(C)} 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 ${w}.`,I=[n.unsignedTx({to:N,data:W({abi:J,functionName:"approve",args:[w,a.nftCollateralId]}),value:"0",chainId:f,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:w,data:W({abi:A,functionName:"acceptOffer",args:[a,g,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:f,description:T})],U=await n.preview(I,t);return le(U.changes,a.loanPrincipalAmount),{txs:I,preview:U,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(C),deadlineIsEstimate:!0}}let i=(e,t,r,c)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,g)=>{try{return await c(a,g)}catch(p){throw new o(n.plainError(p))}}});async function s(e){j(e);let t=(r,c)=>{let a=`Longbow borrower NFT loans unreadable: ${n.plainError(c)}`;return{module:"longbow",id:`4663:${w.toLowerCase()}:${r}`,chainId:f,incomplete:!0,assets:[],economics:{principal:[],debt:[],rewards:[],backing:[],coverage:{complete:!1,reason:a}},description:`${a} 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 c=new Set,a=[];for(let[g,p]of r.entries()){let u=`unreadable-${g}`;try{if(p.loanContract!==void 0&&m(p.loanContract)!==w)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(p.loanId??p.id),32).toString(),c.has(u))continue;c.add(u);let d=await q(n,u);if(d.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(d.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${w.toLowerCase()}:${u}`,chainId:f,assets:[],economics:{principal:[re("collateral",{token:{address:d.collection,symbol:"NFT",decimals:0,chainId:f},amount:"1",tokenId:d.tokenId,source:"longbow.nft.collateral",measuredAtBlock:d.blockNumber})],debt:[ae({token:d.currency,amount:d.payoffAmount,source:"longbow.nft.payoffAmount",dueAt:d.deadline,measuredAtBlock:d.blockNumber})],rewards:[],backing:[],coverage:{complete:!0}},description:`Longbow borrower NFT loan ${u}: ${d.status}, payoff debt ${d.payoffAmount} ${d.currency.symbol} base units (token ${d.currency.address}, decimals ${d.currency.decimals}); collateral ${d.collection} token ID ${d.tokenId} is escrowed. Deadline ${d.deadlineUtc}. ${d.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(d){a.push(t(u,d))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{x(e,[]);let t=await H(n,"/listings");return{chainId:f,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==f)throw new o("Longbow returned a listing on another chain.");return{id:E(String(r.id)),collection:m(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:m(r.borrower??r.owner),status:E(String(r.status)),note:r.note==null?null:E(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128,description:"Longbow NFT listing id, as returned by longbow_nft_listings (letters, digits, underscore or hyphen)."}},["listingId"],async e=>{if(x(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 c=r.raw?R(r.raw):r,a={...R(c.offer??Object.fromEntries(M.map(p=>[p,c[p]])))};for(let p of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[p];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[p]=String(u))}let g=de(a,typeof c.signature=="object"?c.signature:{nonce:c.nonce,expiry:c.expiry,signer:c.signer??c.lender,signature:c.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...g},(p,u)=>typeof u=="bigint"||p==="loanDuration"||p==="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:G('Longbow NFT loan id, as a decimal string. Example: "1".')},["loanId"],async e=>{if(x(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return q(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"],description:'Which loans to list for this wallet: "borrower" (default) for loans it took out, "lender" for loans it funded.'}},[],async(e,t)=>{x(e,["role"]),j(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let c=await H(n,`/loans/${r}/${y(t)}`);if(c.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(c.map(a=>{if(a.loanContract!==void 0&&m(a.loanContract)!==w)throw new o("The NFT indexer returned a loan from another contract.");return q(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",description:"Lender-signed NFT loan terms to accept, exactly as returned by longbow_nft_offers.",properties:Object.fromEntries(M.map(e=>[e,{type:"string",description:Ie[e]}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",description:"The lender signature and its nonce, expiry and signer, as returned with the offer.",properties:Object.fromEntries(Z.map(e=>[e,{type:"string",description:Ae[e]}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>l(e,t,!1)),i("longbow_nft_repay",{loanId:G('Longbow NFT loan id to repay, as a decimal string. Example: "1".'),maxPayoff:G('Highest USDG payoff you accept, in base units (USDG has 6 decimals). Example: "1100000" = 1.1 USDG.')},["loanId","maxPayoff"],(e,t)=>l(e,t,!0))]}};async function $e(n,l,i){if(await n.getChainId()!==f||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:N,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,l))return;let t=await n.readContract({address:N,abi:s,functionName:"getApproved",args:[i]});if(v(t,w))return{to:N,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:f,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{w as a,N as b,ie as c,se as d,ue as e,A as f,h as g,de as h,Ne as i,q as j,Re as k,$e as l};
@@ -1 +1 @@
1
- import{L as P}from"./MQXSCNUL.js";import{a as u}from"./YXXK6EPI.js";import{a as O}from"./43LI5NKJ.js";import{a as A}from"./66F5ZH34.js";import{d as g,i as T}from"./NWNYJ26T.js";import{b as p}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as k}from"./JXOEJPJ4.js";import{encodeFunctionData as E,getAddress as f,parseAbi as v,zeroAddress as R}from"viem";var w=v(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),C=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(d){return T(d,"Provide an explicit checksummed address.",g)}var S=d=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(O(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(d.plainError(a))}}});async function b(){let n=d.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string",description:"Optional ERC-20 token address to check whether the NFT loan contract permits it as a loan currency."}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:u,abi:w,functionName:s})));return{chainId:p,contract:u,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:u,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:C,description:"Owner administration call: pause or unpause the protocol, update the admin fee or maximum loan duration, permit tokens, or manage ownership transfer."},value:A("Integer in base units of the setting, as a decimal string. updateAdminFee: basis points (50 = 0.5%, max 10000). updateMaximumLoanDuration: seconds (86400 = 1 day)."),account:{type:"string",description:"Address of the ERC-20 token for setERC20Permit, or of the proposed new owner for requestTransferOwnership."},enabled:{type:"boolean",description:"For setERC20Permit: true permits the token as a loan currency, false removes the permission."},tokens:{type:"array",maxItems:32,description:"For setERC20Permits: unique token addresses to update; pairs by position with permissions.",items:{type:"string",description:"ERC-20 token address."}},permissions:{type:"array",maxItems:32,description:"For setERC20Permits: true/false per token, same length and order as tokens.",items:{type:"boolean",description:"True permits the token at the same index as a loan currency."}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!C.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:u,abi:w,functionName:"owner"});if(f(o)!==f(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=P(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(l=>typeof l!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===R)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${u}, values ${JSON.stringify(t,(o,l)=>typeof l=="bigint"?String(l):l)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[d.unsignedTx({to:u,data:E({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await d.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await d.http(`https://longbow.credit/api/referral/stats/${f(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==f(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:f(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:k("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};
1
+ import{L as P}from"./R5UOFPDO.js";import{a as u}from"./QBHY2QRC.js";import{a as O}from"./43LI5NKJ.js";import{a as A}from"./66F5ZH34.js";import{d as g,i as T}from"./NWNYJ26T.js";import{b as p}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{a as k}from"./JXOEJPJ4.js";import{encodeFunctionData as E,getAddress as f,parseAbi as v,zeroAddress as R}from"viem";var w=v(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),C=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(d){return T(d,"Provide an explicit checksummed address.",g)}var S=d=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(O(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(d.plainError(a))}}});async function b(){let n=d.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string",description:"Optional ERC-20 token address to check whether the NFT loan contract permits it as a loan currency."}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:u,abi:w,functionName:s})));return{chainId:p,contract:u,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:u,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:C,description:"Owner administration call: pause or unpause the protocol, update the admin fee or maximum loan duration, permit tokens, or manage ownership transfer."},value:A("Integer in base units of the setting, as a decimal string. updateAdminFee: basis points (50 = 0.5%, max 10000). updateMaximumLoanDuration: seconds (86400 = 1 day)."),account:{type:"string",description:"Address of the ERC-20 token for setERC20Permit, or of the proposed new owner for requestTransferOwnership."},enabled:{type:"boolean",description:"For setERC20Permit: true permits the token as a loan currency, false removes the permission."},tokens:{type:"array",maxItems:32,description:"For setERC20Permits: unique token addresses to update; pairs by position with permissions.",items:{type:"string",description:"ERC-20 token address."}},permissions:{type:"array",maxItems:32,description:"For setERC20Permits: true/false per token, same length and order as tokens.",items:{type:"boolean",description:"True permits the token at the same index as a loan currency."}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!C.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:u,abi:w,functionName:"owner"});if(f(o)!==f(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=P(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(l=>typeof l!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===R)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${u}, values ${JSON.stringify(t,(o,l)=>typeof l=="bigint"?String(l):l)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[d.unsignedTx({to:u,data:E({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await d.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await d.http(`https://longbow.credit/api/referral/stats/${f(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==f(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:f(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:k("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};