@oakagentkit/core 0.2.7 → 0.3.0

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 (462) hide show
  1. package/build/dist/api/addresses.d.ts +9 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/chain.d.ts +4 -0
  4. package/build/dist/api/chain.js +1 -1
  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/abi.d.ts +54 -0
  16. package/build/dist/api/modules/borro/abi.js +1 -1
  17. package/build/dist/api/modules/borro/actions.d.ts +14 -1
  18. package/build/dist/api/modules/borro/actions.js +1 -1
  19. package/build/dist/api/modules/borro/checks.js +1 -1
  20. package/build/dist/api/modules/borro/copy.d.ts +10 -2
  21. package/build/dist/api/modules/borro/copy.js +1 -1
  22. package/build/dist/api/modules/borro/index.js +1 -1
  23. package/build/dist/api/modules/borro/liquidity.js +1 -1
  24. package/build/dist/api/modules/borro/pins.d.ts +30 -14
  25. package/build/dist/api/modules/borro/pins.js +1 -1
  26. package/build/dist/api/modules/borro/positions.js +1 -1
  27. package/build/dist/api/modules/borro/reader.js +1 -1
  28. package/build/dist/api/modules/borro/types.d.ts +1 -0
  29. package/build/dist/api/modules/chop/guard.js +1 -1
  30. package/build/dist/api/modules/chop/index.js +1 -1
  31. package/build/dist/api/modules/clanker/extensions.js +1 -1
  32. package/build/dist/api/modules/clanker/index.js +1 -1
  33. package/build/dist/api/modules/clanker/manage.js +1 -1
  34. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  35. package/build/dist/api/modules/clanker/protocol.js +1 -1
  36. package/build/dist/api/modules/clanker/state.js +1 -1
  37. package/build/dist/api/modules/earn/copy.d.ts +6 -6
  38. package/build/dist/api/modules/earn/copy.js +1 -1
  39. package/build/dist/api/modules/earn/cost.d.ts +1 -1
  40. package/build/dist/api/modules/earn/cost.js +1 -1
  41. package/build/dist/api/modules/earn/index.js +1 -1
  42. package/build/dist/api/modules/earn/lp.js +1 -1
  43. package/build/dist/api/modules/earn/options.js +1 -1
  44. package/build/dist/api/modules/erc8004/common.js +1 -1
  45. package/build/dist/api/modules/erc8004/domain.js +1 -1
  46. package/build/dist/api/modules/erc8004/index.js +1 -1
  47. package/build/dist/api/modules/erc8004/management.js +1 -1
  48. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  49. package/build/dist/api/modules/erc8004/services.js +1 -1
  50. package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
  51. package/build/dist/api/modules/erc8004/thesis.js +1 -0
  52. package/build/dist/api/modules/erc8004/validation.js +1 -1
  53. package/build/dist/api/modules/gloam/index.js +1 -1
  54. package/build/dist/api/modules/grove/index.js +1 -1
  55. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  56. package/build/dist/api/modules/heyresearch/index.js +1 -1
  57. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  58. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  59. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  60. package/build/dist/api/modules/hoodag/index.d.ts +12 -1
  61. package/build/dist/api/modules/hoodag/index.js +1 -1
  62. package/build/dist/api/modules/hoodag/management.js +1 -1
  63. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  64. package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
  65. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  66. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  67. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  68. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  69. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  70. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  71. package/build/dist/api/modules/hoodlock/index.js +1 -1
  72. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  73. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  74. package/build/dist/api/modules/hoodlock/public.js +1 -1
  75. package/build/dist/api/modules/hookr/actions.js +1 -1
  76. package/build/dist/api/modules/hookr/addons.js +1 -1
  77. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  78. package/build/dist/api/modules/hookr/contracts.js +1 -1
  79. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  80. package/build/dist/api/modules/hookr/discovery.js +1 -1
  81. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  82. package/build/dist/api/modules/hookr/index.js +1 -1
  83. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  84. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  85. package/build/dist/api/modules/hookr/launch.js +1 -1
  86. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  87. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  88. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  89. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  90. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  91. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  92. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  93. package/build/dist/api/modules/hookr/relay.js +1 -1
  94. package/build/dist/api/modules/hookr/revenue.js +1 -1
  95. package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
  96. package/build/dist/api/modules/kyberswap/index.js +1 -1
  97. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  98. package/build/dist/api/modules/layerbank/abi.js +1 -1
  99. package/build/dist/api/modules/layerbank/actions.js +1 -1
  100. package/build/dist/api/modules/layerbank/checks.js +1 -1
  101. package/build/dist/api/modules/layerbank/index.js +1 -1
  102. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  103. package/build/dist/api/modules/layerbank/reader.js +1 -1
  104. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  105. package/build/dist/api/modules/lighter/index.js +1 -1
  106. package/build/dist/api/modules/longbow/administration.js +1 -1
  107. package/build/dist/api/modules/longbow/analytics.js +1 -1
  108. package/build/dist/api/modules/longbow/fixed.js +1 -1
  109. package/build/dist/api/modules/longbow/index.js +1 -1
  110. package/build/dist/api/modules/longbow/nft.js +1 -1
  111. package/build/dist/api/modules/longbow/rebates.js +1 -1
  112. package/build/dist/api/modules/longbow/staking.js +1 -1
  113. package/build/dist/api/modules/meridian/index.js +1 -1
  114. package/build/dist/api/modules/meridian/markets.js +1 -1
  115. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  116. package/build/dist/api/modules/meridian/rfq.js +1 -1
  117. package/build/dist/api/modules/merkl/discovery.js +1 -1
  118. package/build/dist/api/modules/merkl/index.js +1 -1
  119. package/build/dist/api/modules/merkl/manage.js +1 -1
  120. package/build/dist/api/modules/merkl/protocol.js +1 -1
  121. package/build/dist/api/modules/morpho/allocator.js +1 -1
  122. package/build/dist/api/modules/morpho/bundles.js +1 -1
  123. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  124. package/build/dist/api/modules/morpho/index.js +1 -1
  125. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  126. package/build/dist/api/modules/morpho/midnight.js +1 -1
  127. package/build/dist/api/modules/morpho/protocol.js +1 -1
  128. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  129. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  130. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  131. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  132. package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
  133. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  134. package/build/dist/api/modules/netnet/card-read.js +1 -1
  135. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  136. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  137. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  138. package/build/dist/api/modules/netnet/financial.js +1 -1
  139. package/build/dist/api/modules/netnet/index.js +1 -1
  140. package/build/dist/api/modules/netnet/staking.js +1 -1
  141. package/build/dist/api/modules/orbio/index.d.ts +6 -0
  142. package/build/dist/api/modules/orbio/index.js +1 -1
  143. package/build/dist/api/modules/orbio/positions.js +1 -1
  144. package/build/dist/api/modules/pendle/costs.js +1 -1
  145. package/build/dist/api/modules/pendle/index.js +1 -1
  146. package/build/dist/api/modules/pendle/markets.js +1 -1
  147. package/build/dist/api/modules/pendle/positions.js +1 -1
  148. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  149. package/build/dist/api/modules/pendle/reader.js +1 -1
  150. package/build/dist/api/modules/pendle/redeem.js +1 -1
  151. package/build/dist/api/modules/pendle/trade.js +1 -1
  152. package/build/dist/api/modules/pendle/validate.js +1 -1
  153. package/build/dist/api/modules/pendle/verify.js +1 -1
  154. package/build/dist/api/modules/pons/claim.js +1 -1
  155. package/build/dist/api/modules/pons/index.js +1 -1
  156. package/build/dist/api/modules/pons/launch-status.js +1 -1
  157. package/build/dist/api/modules/pons/prices.js +1 -1
  158. package/build/dist/api/modules/pons/reads.js +1 -1
  159. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  160. package/build/dist/api/modules/pons/trade.js +1 -1
  161. package/build/dist/api/modules/poolstrade/index.js +1 -1
  162. package/build/dist/api/modules/priors/coverage.js +1 -1
  163. package/build/dist/api/modules/priors/discovery.js +1 -1
  164. package/build/dist/api/modules/priors/features.js +1 -1
  165. package/build/dist/api/modules/priors/holdings.js +1 -1
  166. package/build/dist/api/modules/priors/index.js +1 -1
  167. package/build/dist/api/modules/priors/integration.js +1 -1
  168. package/build/dist/api/modules/priors/market.js +1 -1
  169. package/build/dist/api/modules/priors/pt.js +1 -1
  170. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  171. package/build/dist/api/modules/priors/starter-line.js +1 -1
  172. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  173. package/build/dist/api/modules/raeto/index.js +1 -1
  174. package/build/dist/api/modules/relay/api.js +1 -1
  175. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  176. package/build/dist/api/modules/relay/discovery.js +1 -1
  177. package/build/dist/api/modules/relay/inbound.js +1 -1
  178. package/build/dist/api/modules/relay/index.js +1 -1
  179. package/build/dist/api/modules/relay/order.js +1 -1
  180. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  181. package/build/dist/api/modules/relay/readiness.js +1 -1
  182. package/build/dist/api/modules/relay/reads.js +1 -1
  183. package/build/dist/api/modules/relay/vaults.js +1 -1
  184. package/build/dist/api/modules/spark/actions.js +1 -1
  185. package/build/dist/api/modules/spark/details.js +1 -1
  186. package/build/dist/api/modules/spark/index.js +1 -1
  187. package/build/dist/api/modules/spark/management.js +1 -1
  188. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  189. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  190. package/build/dist/api/modules/steakhouse/index.js +1 -1
  191. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  192. package/build/dist/api/modules/steakhouse/management.js +1 -1
  193. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  194. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  195. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  196. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  197. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  198. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  199. package/build/dist/api/modules/tickerspring/index.js +1 -1
  200. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  201. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  202. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  203. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  204. package/build/dist/api/modules/tickerspring/research.js +1 -1
  205. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  206. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  207. package/build/dist/api/modules/uniswap/auction.js +1 -1
  208. package/build/dist/api/modules/uniswap/batch.js +1 -1
  209. package/build/dist/api/modules/uniswap/common.js +1 -1
  210. package/build/dist/api/modules/uniswap/fees.js +1 -1
  211. package/build/dist/api/modules/uniswap/index.js +1 -1
  212. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  213. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  214. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  215. package/build/dist/api/modules/uniswap/pools.js +1 -1
  216. package/build/dist/api/modules/uniswap/position.js +1 -1
  217. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  218. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  219. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  220. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  221. package/build/dist/api/modules/uniswap/trade.js +1 -1
  222. package/build/dist/api/modules/uniswap/v2.js +1 -1
  223. package/build/dist/api/modules/uniswap/v3.js +1 -1
  224. package/build/dist/api/modules/uniswap/v4.js +1 -1
  225. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  226. package/build/dist/api/modules/upoch/copy.d.ts +5 -0
  227. package/build/dist/api/modules/upoch/copy.js +1 -0
  228. package/build/dist/api/modules/upoch/index.d.ts +8 -0
  229. package/build/dist/api/modules/upoch/index.js +1 -0
  230. package/build/dist/api/modules/upoch/pins.d.ts +8 -0
  231. package/build/dist/api/modules/upoch/pins.js +1 -0
  232. package/build/dist/api/modules/upoch/reads.d.ts +509 -0
  233. package/build/dist/api/modules/upoch/reads.js +1 -0
  234. package/build/dist/api/modules/velora/claims.js +1 -1
  235. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  236. package/build/dist/api/modules/velora/index.js +1 -1
  237. package/build/dist/api/modules/wormhole/index.js +1 -1
  238. package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
  239. package/build/dist/api/modules/wormhole/x402-client.js +1 -1
  240. package/build/dist/api/positions.js +1 -1
  241. package/build/dist/api/pricenote.js +1 -1
  242. package/build/dist/api/prices.js +1 -1
  243. package/build/dist/api/pricing.js +1 -1
  244. package/build/dist/api/rpc.js +1 -1
  245. package/build/dist/api/secret-fields.d.ts +2 -0
  246. package/build/dist/api/secret-fields.js +1 -1
  247. package/build/dist/api/send.js +1 -1
  248. package/build/dist/api/signing-registry.js +1 -1
  249. package/build/dist/api/signing.js +1 -1
  250. package/build/dist/api/simulate.js +1 -1
  251. package/build/dist/api/swap.js +1 -1
  252. package/build/dist/api/tokens.js +1 -1
  253. package/build/dist/api/tool-policy.d.ts +1 -0
  254. package/build/dist/api/tool-policy.js +1 -1
  255. package/build/dist/api/usd-estimate.js +1 -1
  256. package/build/dist/chunks/23HNDJ76.js +2 -0
  257. package/build/dist/chunks/{JS53DQVT.js → 24Q3FNGX.js} +1 -1
  258. package/build/dist/chunks/{N245WC5R.js → 25C4DTVA.js} +1 -1
  259. package/build/dist/chunks/{PV4AK32X.js → 2HN3U6OG.js} +1 -1
  260. package/build/dist/chunks/{GQYV4TFO.js → 2OVJ2BTJ.js} +1 -1
  261. package/build/dist/chunks/{DYYEA5HB.js → 2QGLPY2D.js} +1 -1
  262. package/build/dist/chunks/{ZFU65MB4.js → 2WRXH6BL.js} +1 -1
  263. package/build/dist/chunks/{EZZM2GQT.js → 2ZBSE2LD.js} +1 -1
  264. package/build/dist/chunks/{HIX5N25Z.js → 2ZQ7X223.js} +1 -1
  265. package/build/dist/chunks/{V37L4DU4.js → 3A2IKFTV.js} +1 -1
  266. package/build/dist/chunks/{FWIFTPSE.js → 3PU2SD3U.js} +1 -1
  267. package/build/dist/chunks/{SBY4RJ7I.js → 3ZH5SOC2.js} +1 -1
  268. package/build/dist/chunks/4NBXBKOX.js +2 -0
  269. package/build/dist/chunks/{FOKEFXGP.js → 4PLLS6CT.js} +1 -1
  270. package/build/dist/chunks/{KREBNL2D.js → 4R3G3H42.js} +1 -1
  271. package/build/dist/chunks/{XHYFISVV.js → 4Z3IGMU6.js} +1 -1
  272. package/build/dist/chunks/{CSDN4MYP.js → 5GQJVKVY.js} +1 -1
  273. package/build/dist/chunks/{JOKL5L6X.js → 5R576SDB.js} +1 -1
  274. package/build/dist/chunks/{UUID2E22.js → 5W74Z4WZ.js} +1 -1
  275. package/build/dist/chunks/{EH5G4O3U.js → 65356YKW.js} +1 -1
  276. package/build/dist/chunks/{QFSBDPLN.js → 65OITTDL.js} +1 -1
  277. package/build/dist/chunks/{DSTMEY5F.js → 6F527FLN.js} +1 -1
  278. package/build/dist/chunks/{CO4GCF4L.js → 6MDYKE2O.js} +1 -1
  279. package/build/dist/chunks/{IEG6GLFR.js → 6OCLWSMZ.js} +1 -1
  280. package/build/dist/chunks/75SULXNT.js +1 -0
  281. package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
  282. package/build/dist/chunks/{AMTRDPVO.js → 7U62MMUQ.js} +1 -1
  283. package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
  284. package/build/dist/chunks/{XVJ7ILKK.js → A2V4NFVA.js} +1 -1
  285. package/build/dist/chunks/A3BJSQ23.js +1 -0
  286. package/build/dist/chunks/{YSMWCKIX.js → ADIPEGNN.js} +1 -1
  287. package/build/dist/chunks/ANIF3JMV.js +4 -0
  288. package/build/dist/chunks/{RLI4JDOL.js → ATEVAJ5Y.js} +1 -1
  289. package/build/dist/chunks/{F3VDVTMS.js → B2HSLY5F.js} +1 -1
  290. package/build/dist/chunks/{N4XNNXOJ.js → B7BNDW35.js} +1 -1
  291. package/build/dist/chunks/{GLF7WEY2.js → C6VJAL5B.js} +1 -1
  292. package/build/dist/chunks/{5PI57UC2.js → C76D54YG.js} +1 -1
  293. package/build/dist/chunks/{GRSXWQWD.js → CD2JQ32C.js} +1 -1
  294. package/build/dist/chunks/{4GNUXN4K.js → CI5ENLYA.js} +1 -1
  295. package/build/dist/chunks/{F4UQEPJT.js → CZQ2CGYV.js} +1 -1
  296. package/build/dist/chunks/{APHNOGNS.js → D2IYA4LP.js} +1 -1
  297. package/build/dist/chunks/{4RQAOOO2.js → D7QXZM3S.js} +1 -1
  298. package/build/dist/chunks/{TDZTC5WR.js → DBOGRUPS.js} +1 -1
  299. package/build/dist/chunks/{Y77EVVT4.js → DGDMRATN.js} +1 -1
  300. package/build/dist/chunks/{3DNJTJ2X.js → DMB64UIN.js} +1 -1
  301. package/build/dist/chunks/{TM7Z5SA4.js → DMDOSHV7.js} +1 -1
  302. package/build/dist/chunks/{WHVZ372B.js → DRLBTB4E.js} +1 -1
  303. package/build/dist/chunks/{FZ6IJZZM.js → E76Z2TT4.js} +1 -1
  304. package/build/dist/chunks/{C75MT5SD.js → EHK7CDTU.js} +1 -1
  305. package/build/dist/chunks/{KKPMOAVI.js → ELHRXA5U.js} +1 -1
  306. package/build/dist/chunks/{XCKTE4ON.js → F7MGYRPU.js} +1 -1
  307. package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
  308. package/build/dist/chunks/{M7ZXDLKM.js → FGEGJOAA.js} +1 -1
  309. package/build/dist/chunks/{N6GIC7HJ.js → FN6GNTPR.js} +1 -1
  310. package/build/dist/chunks/{ZF2VPDRQ.js → FTMA24EC.js} +1 -1
  311. package/build/dist/chunks/FXOFR432.js +1 -0
  312. package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
  313. package/build/dist/chunks/{JWR5XVP2.js → GBIBRYOV.js} +1 -1
  314. package/build/dist/chunks/{FNGIJKMZ.js → GDOHHXNH.js} +1 -1
  315. package/build/dist/chunks/{LR4XTZ37.js → GP6YO24Z.js} +1 -1
  316. package/build/dist/chunks/{2OKYXT25.js → GQITAJVF.js} +1 -1
  317. package/build/dist/chunks/H3E7UD2X.js +1 -0
  318. package/build/dist/chunks/HFVXNKA5.js +1 -0
  319. package/build/dist/chunks/HHYE42JG.js +21 -0
  320. package/build/dist/chunks/{UOCRYXAB.js → HRAHGYNK.js} +1 -1
  321. package/build/dist/chunks/{U363GQTF.js → HS5HWBMU.js} +1 -1
  322. package/build/dist/chunks/{ARI72OYT.js → HVFMIURK.js} +1 -1
  323. package/build/dist/chunks/IBL6TL2Q.js +1 -0
  324. package/build/dist/chunks/{HCBX4NFM.js → IT2JLILU.js} +1 -1
  325. package/build/dist/chunks/{REWXG6X6.js → JDSSYT6R.js} +1 -1
  326. package/build/dist/chunks/{XRDXFHIK.js → JFWJBZ7M.js} +1 -1
  327. package/build/dist/chunks/{523ZIR3J.js → JI5DXDMY.js} +1 -1
  328. package/build/dist/chunks/{7QKYDNF6.js → JPPQDELB.js} +1 -1
  329. package/build/dist/chunks/{ZP36DSOD.js → K4P5VYDP.js} +1 -1
  330. package/build/dist/chunks/{32RXFUOH.js → KBU3PYP7.js} +1 -1
  331. package/build/dist/chunks/{BB765L75.js → KH4QFN72.js} +1 -1
  332. package/build/dist/chunks/{YTLH4M4Y.js → KMSAUFYV.js} +1 -1
  333. package/build/dist/chunks/{6UVGQYZ3.js → KOTGFD2V.js} +1 -1
  334. package/build/dist/chunks/{4JTTA3BX.js → KZA5GYZR.js} +1 -1
  335. package/build/dist/chunks/{WUT7TZYM.js → LCH6F5HT.js} +1 -1
  336. package/build/dist/chunks/{ARLGF5MU.js → LDJI2JAL.js} +1 -1
  337. package/build/dist/chunks/LEV5SNNC.js +3 -0
  338. package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
  339. package/build/dist/chunks/{J73ATSEQ.js → LJJYYUEG.js} +1 -1
  340. package/build/dist/chunks/{CAWTAR5V.js → LKX5WDOQ.js} +1 -1
  341. package/build/dist/chunks/M7BUKZW2.js +1 -0
  342. package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
  343. package/build/dist/chunks/{YWZQJJYY.js → MMCM3GSM.js} +1 -1
  344. package/build/dist/chunks/MQ5F2VOK.js +1 -0
  345. package/build/dist/chunks/{TE6D3OIX.js → MSMHS456.js} +1 -1
  346. package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
  347. package/build/dist/chunks/{YMV5TL5C.js → N64JJN37.js} +1 -1
  348. package/build/dist/chunks/{JKRBGAX2.js → NAO7VWZF.js} +1 -1
  349. package/build/dist/chunks/ND32LJWI.js +1 -0
  350. package/build/dist/chunks/{RT7IU6TI.js → NMJVQX5M.js} +1 -1
  351. package/build/dist/chunks/{67BWOVET.js → NMQBOBWJ.js} +1 -1
  352. package/build/dist/chunks/NQ4MTIU3.js +1 -0
  353. package/build/dist/chunks/{XWKK75TO.js → NWPAQER2.js} +1 -1
  354. package/build/dist/chunks/O2J5I4VA.js +1 -0
  355. package/build/dist/chunks/{2SUHQWND.js → O4S6XAYV.js} +1 -1
  356. package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
  357. package/build/dist/chunks/{NA424YAL.js → OB7BFDOV.js} +1 -1
  358. package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
  359. package/build/dist/chunks/{FL5SSHUL.js → OIQTZOBN.js} +1 -1
  360. package/build/dist/chunks/{XPEDQBLI.js → OODSXDIH.js} +1 -1
  361. package/build/dist/chunks/OOPMZIG7.js +1 -0
  362. package/build/dist/chunks/{GG24LO2R.js → OQFNUDMQ.js} +1 -1
  363. package/build/dist/chunks/{Q2ACLVWR.js → ORG6LVKJ.js} +1 -1
  364. package/build/dist/chunks/{XYPGLG6A.js → OSMOBKRQ.js} +1 -1
  365. package/build/dist/chunks/{EGZREEG2.js → OTLUQWLF.js} +1 -1
  366. package/build/dist/chunks/{OYJFXEDU.js → OTYB6BHK.js} +1 -1
  367. package/build/dist/chunks/{OZ5MDUD2.js → OVM4QIET.js} +1 -1
  368. package/build/dist/chunks/{OYPAVXGQ.js → OYDKAIS2.js} +1 -1
  369. package/build/dist/chunks/P6OB2AFW.js +1 -0
  370. package/build/dist/chunks/{UQEEF5W5.js → PDPTJMTJ.js} +1 -1
  371. package/build/dist/chunks/PEHXHQVA.js +1 -0
  372. package/build/dist/chunks/PMFR47H3.js +1 -0
  373. package/build/dist/chunks/{HHO5ISMM.js → PQXYTOV5.js} +1 -1
  374. package/build/dist/chunks/{HKVQ646Q.js → PSGRZWES.js} +1 -1
  375. package/build/dist/chunks/Q7L3BX6U.js +1 -0
  376. package/build/dist/chunks/{753HZZTY.js → QBYV7NXH.js} +1 -1
  377. package/build/dist/chunks/{2LWBN35N.js → QIB6OMQV.js} +1 -1
  378. package/build/dist/chunks/{TPEKCXVE.js → QLAOBULN.js} +1 -1
  379. package/build/dist/chunks/{DNNFKDZR.js → QLFPAN6S.js} +1 -1
  380. package/build/dist/chunks/QMEGAKLI.js +1 -0
  381. package/build/dist/chunks/{TK55VASJ.js → QMNUB2GM.js} +1 -1
  382. package/build/dist/chunks/{YUHNPUNK.js → R73R4KN3.js} +1 -1
  383. package/build/dist/chunks/{VR344DAZ.js → RN3WUJIO.js} +1 -1
  384. package/build/dist/chunks/{5HIHUYA4.js → RNCMXKKS.js} +1 -1
  385. package/build/dist/chunks/{ZOMFHTB2.js → ROQQ62LP.js} +1 -1
  386. package/build/dist/chunks/{D742AYEV.js → RUTSEGGD.js} +1 -1
  387. package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
  388. package/build/dist/chunks/{KDGSYNOP.js → S4UJDZGN.js} +1 -1
  389. package/build/dist/chunks/{AI3VAPA3.js → SMSXZ3FN.js} +1 -1
  390. package/build/dist/chunks/{JLRHM2DQ.js → SUNTJ6IU.js} +1 -1
  391. package/build/dist/chunks/{2FHELZ7Y.js → TGFQQCRY.js} +1 -1
  392. package/build/dist/chunks/{4JRXEN7C.js → THL4TMQW.js} +2 -2
  393. package/build/dist/chunks/TI727O2H.js +1 -0
  394. package/build/dist/chunks/{RLMVA575.js → TMRAF2L2.js} +1 -1
  395. package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
  396. package/build/dist/chunks/U243AWCH.js +1 -0
  397. package/build/dist/chunks/U762746N.js +1 -0
  398. package/build/dist/chunks/{GDRQ2ANN.js → U7UPLF4F.js} +1 -1
  399. package/build/dist/chunks/{4Q2ZBZXM.js → UPKVD7WG.js} +1 -1
  400. package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
  401. package/build/dist/chunks/{VTPT5544.js → USEF3QKG.js} +1 -1
  402. package/build/dist/chunks/{U2YCQWZK.js → UVAR6BHU.js} +1 -1
  403. package/build/dist/chunks/{7VC53B5X.js → V5YSJKRH.js} +13 -13
  404. package/build/dist/chunks/{7D73A6KS.js → VB36EHIR.js} +1 -1
  405. package/build/dist/chunks/VMZYFO6I.js +1 -0
  406. package/build/dist/chunks/{UEDGYZOC.js → VVAM3EAK.js} +1 -1
  407. package/build/dist/chunks/VVJO6OYK.js +1 -0
  408. package/build/dist/chunks/{JESMX2UC.js → VXCGMALF.js} +1 -1
  409. package/build/dist/chunks/{ZKZUS3QU.js → VZVW5J7J.js} +1 -1
  410. package/build/dist/chunks/{NUFZUKYS.js → W32UECOL.js} +1 -1
  411. package/build/dist/chunks/{O3JWCJIF.js → W4RYRLL5.js} +1 -1
  412. package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
  413. package/build/dist/chunks/{BAIY32AV.js → WBNFRPAT.js} +1 -1
  414. package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
  415. package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
  416. package/build/dist/chunks/{L646YWDP.js → X24YTJST.js} +1 -1
  417. package/build/dist/chunks/{4FPV4CRC.js → X5AL3DUK.js} +1 -1
  418. package/build/dist/chunks/{SOTYQGPT.js → XBNZ7GTY.js} +1 -1
  419. package/build/dist/chunks/{BZ34ZR65.js → XEBMS5KU.js} +1 -1
  420. package/build/dist/chunks/{FOD34G2H.js → XL3W7DAQ.js} +1 -1
  421. package/build/dist/chunks/{GSFHM5L3.js → XPWGPZ2C.js} +1 -1
  422. package/build/dist/chunks/{2E4I7CJ7.js → XRDLMTBJ.js} +1 -1
  423. package/build/dist/chunks/{SKEKXEUU.js → XV3YJ4P6.js} +1 -1
  424. package/build/dist/chunks/XW3VGWXK.js +1 -0
  425. package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
  426. package/build/dist/chunks/Y64GFBTA.js +1 -0
  427. package/build/dist/chunks/{FJLJ7ZQ5.js → YARZE7SJ.js} +1 -1
  428. package/build/dist/chunks/{OARVU3RC.js → YBLJ75U5.js} +1 -1
  429. package/build/dist/chunks/YRSAZTTC.js +7 -0
  430. package/build/dist/chunks/{3VBIRLU3.js → YXXK6EPI.js} +1 -1
  431. package/build/dist/chunks/Z3IBPCY4.js +2 -0
  432. package/build/dist/chunks/{H5DY7CNB.js → Z7FGEWO2.js} +1 -1
  433. package/build/dist/chunks/{INOYMBWE.js → ZNPVBNC5.js} +1 -1
  434. package/build/dist/chunks/{EVBHQQQG.js → ZTKT3ZQK.js} +1 -1
  435. package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
  436. package/package.json +1 -1
  437. package/build/dist/chunks/3K2N5VFH.js +0 -1
  438. package/build/dist/chunks/3ZABD6ZF.js +0 -2
  439. package/build/dist/chunks/44MB6SA6.js +0 -1
  440. package/build/dist/chunks/4D4ZRZUW.js +0 -1
  441. package/build/dist/chunks/4OVIMYNH.js +0 -2
  442. package/build/dist/chunks/6NUNCD5J.js +0 -1
  443. package/build/dist/chunks/6PZGDVHV.js +0 -1
  444. package/build/dist/chunks/7MBVTNLU.js +0 -1
  445. package/build/dist/chunks/7VNO46LV.js +0 -1
  446. package/build/dist/chunks/DPE7SPW7.js +0 -1
  447. package/build/dist/chunks/E3RACZUY.js +0 -1
  448. package/build/dist/chunks/EI6GGPDS.js +0 -20
  449. package/build/dist/chunks/FV4WZOTD.js +0 -1
  450. package/build/dist/chunks/FWD4L3CJ.js +0 -1
  451. package/build/dist/chunks/JBTOZ6IH.js +0 -1
  452. package/build/dist/chunks/MVD3KWPP.js +0 -1
  453. package/build/dist/chunks/P6OMKZMR.js +0 -3
  454. package/build/dist/chunks/PXVREXCS.js +0 -1
  455. package/build/dist/chunks/QJNLLI6N.js +0 -1
  456. package/build/dist/chunks/RPB46QAC.js +0 -1
  457. package/build/dist/chunks/TID4C2KC.js +0 -1
  458. package/build/dist/chunks/UWBKAWX3.js +0 -7
  459. package/build/dist/chunks/WHTRPRRD.js +0 -1
  460. package/build/dist/chunks/WLMWWEP7.js +0 -2
  461. package/build/dist/chunks/XQ24RSEI.js +0 -1
  462. package/build/dist/chunks/YDNTY67T.js +0 -1
@@ -1 +1 @@
1
- import{m as J,n as Z}from"./WLMWWEP7.js";import{a as x}from"./G2LAO23N.js";import{a as V}from"./66F5ZH34.js";import{b as K,c as X,g as C}from"./NWNYJ26T.js";import{a as f}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as G,getAddress as b,hashTypedData as T,parseAbi as A,recoverTypedDataAddress as ie}from"viem";var oe={pool:b("0x281210097f0de7A8FB6F87310AF0f089c9C8DE21"),registry:b("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),usdg:b("0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"),priors:b("0xeDBf91223639800BCd5756815CAf908Df3b890bE"),stock:b("0xbEcd07EC689988e16b870C121756C4c2C8cb02B6"),backing:b("0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD"),treasury:b("0xFe8fdf43c4b0443aCF8E8CD8facD62F1B770e267"),bond:b("0x346d3360B7258a18E8a2a55fe20E0F467113a53A"),autopay:b("0x72B510AF4e66e5960aB9b975e0BdCf80239e83A0"),savings:b("0xBeEff033F34C046626B8D0A041844C5d1A5409dd"),market:b("0x6a4583242B8313313E684d02aB7dc6bFf8749670"),market1:b("0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19"),bidSpender:b("0x0dbd031a3e8cc91C2b0A3Bf6BD1d14c7AeD92878"),seats3:b("0x59D155C42A9263fA7596867b992bB3e84dF680a9"),seats4:b("0xb1c3a04496238D62E3c93118C297163855e22192")},c=oe,$="(uint256 agentId,uint256 sponsorId,address owner,uint256 maxPremiumBps,uint256 nonce,uint256 deadline)",ne=A(["function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),z=A(["function nonces(uint256) view returns (uint256)"]),re=A(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),ae="0x0000000000000000000000000000000000000000",O="Owner stake is collateral, not a return. A default burns 75% of owner stake (50% of other backing); pending and leaving stake remains at risk until released. New backing waits 24 hours. Exit mode 0 holds, 1 returns PRIORS, 2 requests USDG through the guarded exit queue; no immediate payout is promised.",e=(t,i,n,r,a={})=>({name:`priors_${t}`,contract:i,signature:`function ${n}`,fields:r,note:"",...a}),o=["agentId","id"],v=["amount","uint"],Q=["on","bool"],_=["generation","uint32"],D=["day","uint32"],P=["layer","uint8"],s={read:!0},te=[e("set_delegate","pool","setDelegate(uint256,address)",[o,["delegate","address"]],{owner:"agentId",note:"Owner only. Delegate controls borrowing/repayment, not transfer of identity; clear with the zero address."}),e("root_enroll","pool","enrollRoot(uint256,uint256)",[o,v],{owner:"agentId",approval:"usdg",note:"Owner only. Locks USDG pool shares behind this sponsor root; active delegated lines and fees constrain withdrawals."}),e("root_add_stake","pool","addStake(uint256,uint256)",[o,v],{approval:"usdg",note:"Anyone may add USDG; only the root owner can withdraw it. This may give funds to another owner."}),e("root_unlock","pool","unlock(uint256,uint256,address)",[o,["shares","uint"]],{owner:"agentId",args:["agentId","shares","$wallet"],note:"Owner only. Withdraw root pool shares to this wallet, subject to delegated backing and fee locks."}),e("root_retire","pool","retireRoot(uint256)",[o],{owner:"agentId",note:"Owner only; requires no remaining stake or delegated lines."}),e("root_vouch","pool","vouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Adds the exact USDG amount of undrawn backing to an existing sponsored line."}),e("root_unvouch","pool","unvouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Recalls undrawn backing; outstanding debt remains backed."}),e("root_freeze","pool","freeze(uint256,bool)",[o,["frozen","bool"]],{note:"Current sponsor owner only; freeze/unfreeze the agent line. Contract checks sponsor ownership."}),e("root_set_premium","pool","setPremium(uint256,uint256)",[o,["premiumBps","uint"]],{note:"Current sponsor owner only. Future loan premium cannot exceed the owner-consented cap."}),e("root_claim_fees","pool","claimSponsorFees(uint256,address)",[o],{owner:"agentId",args:["agentId","$wallet"],note:"Owner only; claim sponsor USDG fees to this wallet."}),e("root_set_hook","pool","setHook(uint256,address)",[o,["hook","address"]],{owner:"agentId",note:"Owner only. Changes root lending policy hook; pool enforces the delay while backing is committed."}),e("root_apply_hook","pool","applyHook(uint256)",[o],{note:"Apply a previously scheduled root hook after its on-chain delay."}),e("mark_default","pool","markDefault(uint256)",[["loanId","id"]],{note:"Irreversible: mark a past-grace unpaid loan defaulted, burn sponsor backing and mark the owner. Preview and confirm deliberately."}),e("import_history","pool","importFromV1(uint256)",[o],{note:"Import the v1 record, including defaults; this never imports unbacked capacity."}),e("fund_reserve","pool","fundReserve(uint256)",[v],{approval:"usdg",note:"Donate USDG to the pool reserve; receives no redeemable shares."}),e("root_shares","pool","rootShares(uint256) view returns (uint256)",[o],s),e("root_fee_locked","pool","feeLocked(uint256) view returns (uint256)",[o],s),e("root_fees_owed","pool","sponsorFees(uint256) view returns (uint256)",[o],s),e("root_backing","pool","backing(uint256) view returns (uint256)",[o],s),e("root_free_backing","pool","freeBacking(uint256) view returns (uint256)",[o],s),e("pool_parameters","pool","getParams() view returns ((uint256 minLoan,uint256 maxLoan,uint64 minTerm,uint64 maxTerm,uint64 grace,uint64 minScoreTerm,uint256 feeBps,uint256 sponsorFeeBps,uint256 protocolFeeBps,uint256 minStake,uint256 maxUtilizationBps,uint256 keeperBounty))",[],s),e("bond_deposit","bond","deposit(uint256)",[o],{owner:"agentId",approval:"bond",note:"Owner only. V2 treasury bond remains locked while any line or loan is open; it may replace and refund a former owner bond. Leave and release the legacy bond before Treasury V5 migration."}),e("bond_release","bond","release(uint256)",[o],{note:"Return V2 bond to its original depositor, not necessarily this wallet; contract enforces no line, no loan and age."}),e("bond_slash","bond","slash(uint256)",[o],{note:"Irreversible: send defaulted agent V2 bond to the configured beneficiary."}),e("bond_status","bond","bonds(uint256) view returns ((address depositor,uint64 at,uint256 amount))",[o],s),e("bond_releasable","bond","releasable(uint256) view returns (bool)",[o],s),e("bond_release_at","bond","unusedReleaseAt(uint256) view returns (uint256)",[o],s),e("treasury_move","treasury",`move(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","$consent","$signature"],note:"Move a former Treasury V4 line to V5, no loan open. Close old line, release legacy bond, deposit V2 bond first. V4 record and current-owner V2 bond are required."}),e("treasury_raise","treasury","raise(uint256)",[o],{note:"Raise an eligible Treasury V5 line using its current rules, score, history, age, weekly room and free backing. No unbacked credit."}),e("treasury_reclaim","treasury","reclaim(uint256)",[o],{note:"Reclaim an idle treasury line under on-chain rules; this ends borrowing access."}),e("treasury_first_line","treasury",`firstLine(uint256,uint64,bytes,${$},bytes)`,[o,["expiry","uint"],["invite","bytes"]],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","expiry","invite","$consent","$signature"],note:"Redeem an already-issued Treasury V5 invite with V5 pool consent. Requires a valid V5 inviter signature; the current owner V2 bond is needed before borrowing. V4 invites cannot be reused."}),e("treasury_raise_room","treasury","raiseRoom() view returns (uint256)",[],s),e("treasury_first_lined","treasury","firstLined(uint256) view returns (bool)",[o],s),e("treasury_eligible_raise","treasury","eligibleForRaise(uint256) view returns (bool)",[o],s),e("treasury_room","treasury","epochRoom() view returns (uint256)",[],s),e("treasury_rules","treasury","rules() view returns (uint256 reserveBps,uint256 firstLine,uint256 secondLine,uint256 epochCap,uint64 epochLength,uint64 minSeasoning,uint256 minQualified,uint256 minScore,uint64 idleAfter)",[],s),e("stock_open","stock",`open(uint256,address,uint256,${$},bytes) returns (uint256)`,[o,["token","address"],v],{owner:"agentId",consentRoot:6424n,externalConsent:!0,approval:"stock",args:["agentId","token","amount","$consent","$signature"],note:"Owner or on-chain controller with a supplied owner consent posts exact collateral. Token must be accepted and usable; live price, LTV, line cap and backing determine the line. Default seizes debt plus buffer; issuer restrictions and burns may reduce returned collateral."}),e("stock_add","stock","addCollateral(uint256,uint256)",[o,v],{approval:"stock",note:"Depositor only. Adds exact position token collateral; contract decides resulting draw room."}),e("stock_close","stock","close(uint256)",[o],{note:"Depositor or controller closes/freezes the line; collateral pays its depositor after the last loan, subject to default and issuer shortfalls."}),e("stock_expire","stock","expire(uint256)",[o],{note:"Expire idle stock line after on-chain idle rules; may close borrowing access."}),e("stock_reconcile","stock","reconcile(uint256,uint256)",[o,["maxLoans","uint"]],{note:"Reconcile the collateral debt walk against pool loans; contract ignores maxLoans in this implementation."}),e("stock_settle","stock","settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile stock collateral after a default or missed hook; may seize collateral according to the loan."}),e("stock_record_feed","stock","record(address,uint256) returns (uint80)",[["feed","address"],["maxRounds","uint"]],{note:"Advance public oracle price tape; may unblock new stock lines and default settlement."}),e("stock_reclaim","stock","reclaim(uint256)",[o],{note:"Reclaim a written-off stock position after it is no longer backed; return remains subject to vault token shortfall."}),e("stock_state","stock","getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[o],s),e("stock_borrow_room","stock","borrowRoom(uint256) view returns (uint256)",[o],s),e("stock_asset_state","stock","assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)",[["token","address"]],s),e("stock_lending_status","stock","lendStatus(address) view returns (uint8)",[["token","address"]],s),e("stock_value","stock","valueOf(address,uint256) view returns (bool ok,uint256 value)",[["token","address"],v],s),e("stock_ltv","stock","ltvOf(uint256,address) view returns (uint256)",[o,["token","address"]],s),e("backing_open","backing",`open(uint256,uint256,bool,${$},bytes)`,[o,v,["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"priors",args:["agentId","amount","autoAdd","$consent","$signature"],note:O}),e("backing_open_with_usdg","backing",`openWithUsdg(uint256,uint256,uint256,uint256,uint256,bool,${$},bytes)`,[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"mixed",args:["agentId","priorsIn","usdgIn","minOut","deadline","autoAdd","$consent","$signature"],note:O}),e("backing_add","backing","back(uint256,uint256,bool)",[o,v,["autoAdd","bool"]],{approval:"priors",note:O+" Owner-only at launch; other backers require both global and individual permission."}),e("backing_add_with_usdg","backing","backWithUsdg(uint256,uint256,uint256,uint256,uint256,bool)",[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{approval:"mixed",note:O}),e("backing_leave","backing","leave(uint256,uint256,uint8)",[o,v,["exitMode","uint8"]],{note:O}),e("backing_close","backing","close(uint256,uint8)",[o,["exitMode","uint8"]],{note:O}),...["refresh","promote","expire","sync","pokeFees","recordRepay","noteDelegate"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256)`,[o],{note:"Reconcile this V5 book against current pool, owner, record, tier and backing rules; no payout is promised."})),...["setAutoAdd","setProtocolBacking","setOthersBacking"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256,bool)`,[o,Q],{note:"Change this V5 book setting under the contract ownership/holder rules. Auto-add can compound rewards into stake at risk."})),e("backing_reconsent","backing",`reconsent(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8762n,args:["agentId","$consent","$signature"],note:"Owner only. Renew the pool consent for V5 backing."}),e("backing_release","backing","release(uint256,uint32,uint32,uint256,uint256)",[o,_,D,["minUsdgOut","uint"],["deadline","uint"]],{note:"Release caller day bucket after its release rule. Zero minUsdgOut returns PRIORS; positive requests a guarded sale. Stake stays burnable until release. Read generation/day from chain events."}),e("backing_release_for","backing","releaseFor(uint256,uint32,address,uint32)",[o,_,["holder","address"],D],{note:"Return eligible PRIORS to its holder under generation/day release rules, never redirect proceeds."}),e("backing_finish_close","backing","finishClose(uint256,uint32)",[o,_],{note:"Finish an eligible generation close; pays the bound owner under its release rules."}),e("backing_claim_settled","backing","claimSettled(uint256,uint32,address)",[o,_,["holder","address"]],{note:"Pay settled generation stake to the named holder, after any default burn."}),e("backing_claim_record","backing","claimSettled(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Pay settled day record to its holder after any default burn."}),e("backing_queue_exit","backing","queueExit(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Holder/keeper queues ready USDG-mode stake; minimum and queue window apply. A queue entry is not a fill or payout."}),e("backing_settle","backing","settle(uint256,uint32,uint256)",[o,_,["loanId","id"]],{note:"Reconcile V5 generation with a pool loan/default after a missed hook."}),e("backing_record_loan","backing","recordLoan(uint256)",[["loanId","id"]],{note:"Record current pool loan in V5 book."}),e("backing_record_default","backing","recordDefault(uint256)",[["loanId","id"]],{note:"Reconcile a marked pool default and its stake burn."}),e("backing_collect","backing","collect(uint256[],uint32[]) returns (uint256)",[["agentIds","ids"],["generations","gens"]],{note:"Collect caller fees for explicitly selected generations; auto-add settings may retain stake."}),e("backing_fund","backing","fund(uint256)",[v],{approval:"usdg",note:"Donate USDG to V5 root backing; donor receives no withdrawable claim."}),e("backing_book","backing","getGen(uint256,uint32) view returns ((address owner,uint64 openedAt,uint8 status,bool ownerChanged,bool optOut,bool othersOff,bool pointsVoid,bool openRoomCharged,bool closedByOwner,bool movePending,bool splitPending,uint64 movePendingAt,uint8 tier,uint8 countedAtTier,uint8 listLen,uint32 tierStep,uint64 tierSince,uint64 lastLateAt,uint64 closedMark,uint64 lastRaiseAt,uint64 promoEpoch,uint64 stakeEpoch,uint64 placeEpoch,uint160 movePendingSqrt,uint256 roomLine,uint256 openLine,uint256 promoCredit,uint256 stakeRaised,uint256 placed,uint256 index,uint256 divisor,uint256 defaultProof,uint256 cLive,uint256 cUnits,uint256[3] list,uint256[3] counted,uint256[3] pendingTok,uint256[3] leavingLive,uint256[3] tokens,uint64[3] layerEnd,uint160[3] endSqrt,uint8[3] ownerEndMode,uint32[2][3] liveDay,uint32[3] leaveHead,(uint64 epoch,uint192 points)[5] points))",[o,_],s),e("backing_generation","backing","latestGen(uint256) view returns (uint32)",[o],s),e("backing_line","backing","lineOf(uint256) view returns (uint256)",[o],s),e("backing_quote","backing","needed(uint256,uint256,bool) view returns ((uint256 minA,uint256 fullLine,uint256 capA,uint160 sqrtP,uint8 k,uint8 kCached,bool depthGuard,uint256 line,uint256 ownerA,uint256 ownBacking,uint256 roomB,uint256 lineIfAdded,uint256 weekAfter))",[o,["tokens","uint"],["asOwner","bool"]],s),e("backing_position","backing","position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))",[o,_,P,["holder","address"]],s),e("backing_record","backing","record(uint256,uint32,uint8,uint32,address) view returns ((uint256 counted,uint256 uncounted,uint256 creditedTo,uint160 sqrtLeave,uint8 mode,uint64 entry))",[o,_,P,D,["holder","address"]],s),e("backing_bucket","backing","leavingBucket(uint256,uint32,uint8,uint32) view returns ((bool exists,bool retired,uint64 latestLeave,uint64 releasableAt,uint256 loanCount,uint256 counted,uint256 uncounted,uint256 retireIndex))",[o,_,P,D],s),e("backing_settings","backing","settings() view returns (bool openBacking,uint256 premiumCap,uint256 maxSwapUsdg,uint256 openRoom,uint256 raiseRoom,uint256 vouchCap,uint8 minDrawK,bool premiumCheck,uint64 pausedUntil)",[],s),e("backing_reopen_at","backing","reopenAt(uint256) view returns (uint64)",[o],s),e("backing_sync_prices","backing","sync()",[],{note:"Update global V5 price/guard observations."}),e("backing_exit_service_open","backing","exitServiceOpen() view returns (bool)",[],s),e("backing_usdg_path","backing","usdgPathOpen(uint256) view returns (bool,uint8)",[["usdgIn","uint"]],s),e("backing_entry_rule","backing","entryRule() view returns (uint8 minEntryLoans,uint32 minEntryDays)",[],s),e("backing_target_premium","backing","targetPremiumBps(uint256) view returns (uint256)",[o],s),e("backing_price_cache","backing","priceCache() view returns (uint160 sqrtMedian,uint64 obsAt,uint160 sqrtWeekLow,uint160 sqrtObservation)",[],s),e("backing_pending_bucket","backing","pendingBucket(uint256,uint32,uint8,uint32) view returns ((uint128 amount,uint64 lastDeposit,bool merged,bool dead,uint256 mergeIndex))",[o,_,P,D],s),e("backing_exit_head","backing","exitHead() view returns (uint256 entryId,address holder,uint256 rest,uint160 sqrtPLeave,uint64 joinedAt)",[],s),e("backing_exit_entry","backing","entry(uint256) view returns ((uint256 id,uint32 gen,uint8 layer,uint32 day,address holder,uint64 joinedAt,uint64 prev,uint64 next))",[["entryId","uint"]],s),e("backing_flush","backing","flush()",[],{note:"Reconcile V5 fees and backing buffers; no payout to caller is promised."}),e("backing_claimable","backing","claimable(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("autopay_hold","autopay","hold(bool)",[Q],{note:"Hold/resume future autopay attempts for this wallet; allowances remain until explicitly revoked."}),e("autopay_max_cap","autopay","MAX_CAP() view returns (uint256)",[],s),e("autopay_window","autopay","WINDOW() view returns (uint64)",[],s),e("autopay_paused_until","autopay","pausedUntil() view returns (uint64)",[],s),e("autopay_plan","autopay","planOf(address,uint256) view returns (uint32 cap,address owner,bool on,bool useSavings,bool late,uint32 epoch)",[o],{...s,args:["$wallet","agentId"]}),e("autopay_check","autopay","check(uint256) view returns ((uint8 status,uint256 agentId,uint256 due,uint64 opens,uint64 closes,address wallet,uint256 fromWallet,uint256 fromWalletSavings,address owner,uint256 fromOwner,uint256 fromOwnerSavings))",[["loanId","id"]],s),e("autopay_epoch","autopay","epochOf(uint256) view returns (uint32 epoch,bool stale)",[o],s),e("autopay_held","autopay","held(address) view returns (bool)",[],{...s,args:["$wallet"]}),e("savings_deposit","savings","deposit(uint256,address) returns (uint256)",[v],{approval:"usdg",args:["amount","$wallet"],note:"Deposit own USDG into Priors default external Morpho savings vault; vault/allocator risk and withdrawal liquidity apply."}),e("savings_withdraw","savings","withdraw(uint256,address,address) returns (uint256)",[v],{args:["amount","$wallet","$wallet"],note:"Withdraw exact USDG amount from own savings. Insufficient liquidity fails the preview; no immediate exit is promised."}),e("savings_redeem","savings","redeem(uint256,address,address) returns (uint256)",[["shares","uint"]],{args:["shares","$wallet","$wallet"],note:"Redeem exact own savings shares to this wallet; liquidity and rounding apply."}),e("savings_balance","savings","balanceOf(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("savings_value","savings","previewRedeem(uint256) view returns (uint256)",[["shares","uint"]],s),...["market","market1"].flatMap((t,i)=>[e(`market_v${i===0?2:1}_listing`,t,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[o],s),e(`market_v${i===0?2:1}_record_hash`,t,"recordHash(uint256) view returns (bytes32)",[o],s),e(`market_v${i===0?2:1}_list`,t,"list(uint256,uint256,uint64)",[o,["price","uint"],["expiry","uint"]],{owner:"agentId",approval:"nft",note:"Owner sells this ERC-8004 NFT, its record and any followed treasury line. This does not transfer code, keys or servers. Approves only this NFT; confirm the sale terms and contract-enforced hold/line rules."}),e(`market_v${i===0?2:1}_cancel`,t,"cancel(uint256)",[o],{note:"Cancel the standing listing; NFT approval can remain until explicitly cleared."}),e(`market_v${i===0?2:1}_buy`,t,"buy(uint256,uint256,uint256,bytes32,bytes32)",[o,["maxPrice","uint"],["nonce","uint"],["uriHash","bytes32"],["recordHash","bytes32"]],{approval:"market",note:"Buy an ERC-8004 NFT to this wallet with exact live asking-price approval and pinned listing nonce, tokenURI and current credit record. A followed line still needs the new owner bond before borrowing. No keys/code/servers are included."})]),e("market_bid","market","bid(uint256,uint256,uint64,bytes32,uint256,uint256) returns (uint256)",[o,["price","uint"],["expiry","uint"],["uriHash","bytes32"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["agentId","price","expiry","uriHash","minRepaid","minLine"],approval:"bid",note:"Standing future purchase authority: another owner can fill this bid later without a new click. Exact reserveBudget USDG allowance is shared by all this wallet bids and replaces the old allowance. Cancel bid and clear unused budget deliberately."}),e("market_bid_any","market","bidAny(bytes32,uint256,uint256,uint64,uint256,uint256) returns (uint256)",[["root","bytes32"],["count","uint"],["price","uint"],["expiry","uint"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["root","count","price","expiry","minRepaid","minLine"],approval:"bid",note:"Standing future authority to buy count identities committed by the explicit Merkle root; shared exact reserveBudget USDG allowance. Inspect the committed ID list before authorizing. No code, keys or servers transfer."}),e("market_cancel_bid","market","cancelBid(uint256)",[["bidId","id"]],{note:"Cancel this bid; shared USDG allowance is unchanged so other bids can still fill."}),e("market_accept_bid","market","acceptBid(uint256,uint256,bytes32[],uint256)",[["bidId","id"],o,["proof","proof"],["minNet","uint"]],{owner:"agentId",approval:"nft",note:"Sell only this NFT into a currently valid bid; minNet pins seller USDG proceeds. Merkle proof and current bid rules are checked on chain during preview."}),e("market_bid_state","market","bidOf(uint256) view returns ((address maker,uint64 expiry,uint16 left,bool any,uint96 price,uint96 minLine,uint64 minRepaid,bytes32 target,bytes32 uriHash))",[["bidId","id"]],s),e("market_builder","market","builderOf(uint256) view returns ((address to,uint16 bps))",[o],s),e("market_set_builder","market","setBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{owner:"agentId",note:"Owner-only attribution before first sale; assigns future sale revenue share to to. Contract enforces enabled switch, no listing, and maximum 500 bps."}),e("market_change_builder","market","changeBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{note:"Current builder only; may lower or redirect own revenue share, never increase it."}),e("market_sale_split","market","saleSplit(uint256) view returns (uint256 fee,uint256 share,uint256 net)",[o],s),...["seats3","seats4"].flatMap((t,i)=>[e(`legacy_v${i+3}_close`,t,"close(uint256)",[o],{note:"Existing seat only. Close/freeze and return stake to original staker after final loan; default burn still applies. No new seats are opened."}),e(`legacy_v${i+3}_withdraw_offer`,t,"withdrawOffer(uint256,address)",[o],{args:["agentId","$wallet"],note:"Withdraw caller unaccepted offer; PRIORS returns to the staker."}),e(`legacy_v${i+3}_expire`,t,"expire(uint256)",[o],{note:"Expire idle seat under current contract rules."}),e(`legacy_v${i+3}_settle`,t,"settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile existing seat against pool loan/default after a missed hook."}),e(`legacy_v${i+3}_claim`,t,"claim(address) returns (uint256)",[],{args:["$wallet"],note:"Claim caller legacy seat USDG fees to this wallet."}),e(`legacy_v${i+3}_seat`,t,"getSeat(uint256) view returns ((address staker,uint64 openedAt,bool closing,uint8 status,uint128 line,uint128 burnBps,uint256 amount,uint256 feeMark,address owner))",[o],s),e(`legacy_v${i+3}_pending_fees`,t,"pendingFees(uint256) view returns (uint256)",[o],s),e(`legacy_v${i+3}_fees`,t,"feesOwed(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e(`legacy_v${i+3}_offer`,t,"offers(uint256,address) view returns (uint256)",[o],{...s,args:["agentId","$wallet"]})])];function Y(t){return JSON.parse(JSON.stringify(t,(i,n)=>typeof n=="bigint"?n.toString():n))}function l(t,i,n=256){if(typeof t!="string"||!/^[0-9]+$/.test(t)||BigInt(t)>=1n<<BigInt(n))throw new u(`${i} must be a decimal base-unit string fitting uint${n}.`);return BigInt(t)}function se(t,[i,n]){let r=t[i];if(n==="address"){if(typeof r!="string"||!K.test(r))throw new u(`${i} must be a token or wallet address.`);return b(r)}if(n==="bool"){if(typeof r!="boolean")throw new u(`${i} must be true or false.`);return r}if(n==="bytes32"){if(typeof r!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r))throw new u(`${i} must be bytes32.`);return r}if(n==="proof"){if(!Array.isArray(r)||r.length>32||!r.every(d=>typeof d=="string"&&/^0x[0-9a-fA-F]{64}$/.test(d)))throw new u("proof needs at most 32 bytes32 hashes.");return r}if(n==="bytes"){if(typeof r!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(r)||r.length>32770)throw new u(`${i} must be bounded hexadecimal bytes.`);return r}if(n==="ids"||n==="gens"){if(!Array.isArray(r)||r.length===0||r.length>100)throw new u(`${i} needs 1 to 100 decimal strings.`);return r.map(d=>l(d,i,n==="gens"?32:256))}let a=l(r,i,n==="uint8"?8:n==="uint32"?32:256);if(n==="id"&&a===0n)throw new u(`${i} must be positive.`);if(i==="exitMode"&&a>2n)throw new u("exitMode must be 0 (hold), 1 (PRIORS), or 2 (USDG queue).");if(i==="layer"&&a>2n)throw new u("layer must be 0, 1, or 2.");return a}var R=x.amount("USDG",6,"1000000"),L=x.amount("PRIORS",18,"1000000000000000000"),H='Amount of the stock token in base units (read its decimals with priors_stock_asset_state). Example: "1000000000000000000" = 1 token at 18 decimals.',ue={priors_root_enroll:R,priors_root_add_stake:R,priors_root_vouch:R,priors_root_unvouch:R,priors_root_offer:R,priors_fund_reserve:R,priors_backing_fund:R,priors_savings_deposit:R,priors_savings_withdraw:R,priors_stock_open:H,priors_stock_add:H,priors_stock_value:H,priors_backing_open:L,priors_backing_add:L,priors_backing_leave:L},B={agentId:'ERC-8004 agent ID, as a decimal string. Example: "437".',sponsorId:'ERC-8004 ID of the sponsor root, as a decimal string. Example: "6228".',loanId:x.id("Priors pool loan"),bidId:x.id("AgentMarket V2 bid"),entryId:x.id("V5 exit-queue entry"),delegate:"Address to appoint as pool delegate (borrow and repay only, never identity transfer); the zero address clears it.",frozen:"true freezes the agent line; false unfreezes it.",premiumBps:"Loan premium in basis points (50 = 0.5%); at most the owner-consented cap.",maxPremiumBps:'Owner-consented maximum sponsor premium in basis points (50 = 0.5%), at most 200. Default "0".',hook:"Address of the root lending-policy hook contract (0x followed by 40 hex digits).",expiry:"Expiry in Unix seconds. Market listings and bids allow at most 30 days ahead; a V5 invite uses its issued expiry.",invite:"Treasury V5 inviter signature bytes as 0x hex, exactly as issued.",token:"Address of the stock token (0x followed by 40 hex digits); it must be an accepted Priors stock collateral.",maxLoans:"Loan count bound passed to reconcile, as a decimal string; this contract version ignores it.",feed:"Address of the public oracle price feed to record (0x followed by 40 hex digits).",maxRounds:"Maximum oracle rounds to record in this call, as a decimal string.",autoAdd:"true compounds rewards into the stake at risk; false leaves them out.",priorsIn:x.amount("PRIORS",18,"1000000000000000000"),usdgIn:x.amount("USDG",6,"1000000"),minOut:"Minimum PRIORS received from the USDG conversion, in base units (PRIORS has 18 decimals); must be positive when usdgIn is.",deadline:"Deadline in Unix seconds, within the next hour. Example: 1800000000.",exitMode:x.enumValues({0:"hold",1:"return PRIORS",2:"request USDG through the guarded exit queue"}),generation:"V5 book generation number, as a decimal string; read it from priors_backing_generation or chain events.",day:"Day bucket number, as a decimal string, read from chain events; never guess it.",layer:'Backing layer "0", "1" or "2", as recorded in chain events.',holder:"Address of the stake holder; any payout goes only to this holder.",minUsdgOut:'"0" returns PRIORS; a positive value requests a guarded USDG sale with this minimum, in USDG base units (6 decimals).',agentIds:"ERC-8004 agent IDs as decimal strings, paired by position with generations (1 to 100).",generations:"Generation numbers as decimal strings, paired by position with agentIds.",tokens:'PRIORS amount in base units (PRIORS has 18 decimals) passed to the contract needed() quote. Example: "0".',asOwner:"true quotes as the agent owner; false as another backer.",price:'Price per identity in USDG base units (6 decimals); minimum "5000000" = 5 USDG.',maxPrice:"Highest asking price you accept, in USDG base units (6 decimals); read the listing first.",nonce:"Listing nonce from the listing read, as a decimal string; it pins the exact listing.",uriHash:"bytes32 hash of the agent tokenURI (0x followed by 64 hex digits), from the listing or priors_market_pins.",recordHash:"bytes32 hash of the agent credit record (0x followed by 64 hex digits), from priors_market_v1/v2_record_hash.",minRepaid:"Minimum repaid-loan count in the agent record for the bid to fill, as a decimal string.",minLine:"Minimum credit line the agent must carry for the bid to fill, in USDG base units (6 decimals).",reserveBudget:"Exact USDG allowance shared by all bids of this wallet, in base units (6 decimals); must cover price times count.",root:"Merkle root (bytes32) committing the agent ID list; rebuild it with priors_market_origin.",count:"Number of identities to buy from the committed list, 1 to 20, as a decimal string.",proof:"Merkle proof for this agent in the bid root: at most 32 bytes32 hashes.",minNet:"Minimum seller USDG proceeds, in base units (USDG has 6 decimals).",to:x.recipient("builder sale share recipient"),bps:"Builder sale share in basis points (50 = 0.5%); at most 500.",on:"true turns this setting on; false turns it off.",cap:'Per-loan repayment cap in USDG base units (USDG has 6 decimals), at most the contract MAX_CAP. Example: "5000000" = 5 USDG.',budget:"Total USDG allowance for AutoRepay in base units (6 decimals); at least cap, and shared by all plans of this wallet.",savingsShares:'Savings vault share allowance in base units (read the vault decimals); "0" disables savings use.',late:"AutoRepay late flag stored in the plan (true or false); read priors_autopay_plan to confirm it.",continuation:"Opaque state from the previous step; pass it back unchanged. Never build it by hand.",signature:"Local signature for the confirmed step, as 0x hex; the bridge supplies it. Never a key."},de={priors_root_unlock:"Root pool shares to withdraw, in pool share base units (read root_shares); not USDG.",priors_savings_redeem:"Savings vault shares to redeem, in base units (read the vault decimals); not USDG.",priors_savings_value:"Savings vault shares to value, in base units (read the vault decimals); not USDG."};function le(t,i){return i==="amount"?ue[t]:i==="shares"?de[t]:t==="priors_autopay_hold"&&i==="on"?"true holds future autopay attempts; false resumes them.":B[i]}function ce(t,i,n){let r=le(t,i);return r===void 0?n:{...n,description:r}}function F(t,i,n={}){return{type:"object",additionalProperties:!1,required:i.map(([r])=>r),properties:Object.fromEntries([...i.map(([r,a])=>[r,ce(t,r,a==="bool"?{type:"boolean"}:a==="address"?X:a==="proof"?{type:"array",maxItems:32,items:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}}:a==="ids"||a==="gens"?{type:"array",maxItems:100,items:V()}:{type:"string",...a==="bytes32"?{pattern:"^0x[0-9a-fA-F]{64}$"}:a!=="bytes"?{pattern:"^[0-9]+$"}:{}})]),...Object.entries(n)])}}async function I(t,i,n,r=[]){let a=[`function ${n}`],d=A(a);return t.clientFor(f).readContract({address:i,abi:d,functionName:d[0].name,args:r})}async function U(t,i){return b(await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"ownerOf",args:[i]}))}function E(t){if(t.network==="testnet")throw new u("Priors ecosystem features are configured only on chain 4663.")}function M(t,i,n,r,a,d="0"){return{domain:Z(),types:{Consent:[...J.Consent]},primaryType:"Consent",message:{agentId:t,sponsorId:i,owner:b(n),nonce:r,deadline:a,maxPremiumBps:d}}}async function j(t,i,n){if(!i||!i.request||T(i.request)!==T(n)||typeof i.signature!="string"||!/^0x(?:[a-fA-F0-9]{2}){1,4096}$/.test(i.signature))throw new u("Consent differs from this agent, sponsor, owner, premium cap, nonce or deadline.");let r=n.message.owner,a=await t.clientFor(f).getCode({address:r});if(a&&a!=="0x"){if(await t.clientFor(f).readContract({address:r,abi:re,functionName:"isValidSignature",args:[T(n),i.signature]})!=="0x1626ba7e")throw new u("The owner contract rejected the consent signature.")}else if(!C(await ie({...n,signature:i.signature}),r))throw new u("The consent signature is not from the current agent owner.")}function pe(t,i,n,r,a,d){let g=te.find(k=>k.name===t),p=t==="priors_sign_consent"?l(i.sponsorId,"sponsorId"):g?.consentRoot;if(!p||a.stage!=="priors_consent"||a.tool!==t||a.wallet!==b(n)||a.chainId!==f||a.agentId!==i.agentId||r.length!==1||r[0]?.kind!=="typedData")throw new u("Unexpected Priors consent continuation.");let w=l(a.nonce,"nonce").toString(),h=l(a.deadline,"deadline");if(h<=BigInt(d)||h>BigInt(d+3600))throw new u("Priors consent expired or exceeds its one-hour window.");let y=M(String(i.agentId),p.toString(),n,w,h.toString(),String(i.maxPremiumBps??"0"));if(!r[0].request||T(r[0].request)!==T(y))throw new u("Priors consent differs from the requested agent, root, owner or premium.")}async function ee(t,i,n,r,a){let d=l(n.agentId,"agentId");if(!C(await U(t,d),r))throw new u("This operation requires the current identity owner wallet; a delegate cannot consent. Use the owner wallet.");let g=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),p=n.continuation,w=p?l(p.deadline,"deadline"):BigInt(Math.floor(Date.now()/1e3)+1800),h=l(n.maxPremiumBps??"0","maxPremiumBps");if(n.signature!==void 0&&!n.continuation)throw new u("A signature needs its locally confirmed Priors consent continuation.");if(h>200n)throw new u("maxPremiumBps exceeds the pool maximum of 200.");let y=M(d.toString(),a.toString(),r,g.toString(),w.toString(),h.toString());if(!p)return{steps:[{kind:"typedData",request:y}],continuation:{stage:"priors_consent",tool:i,wallet:r,chainId:f,agentId:d.toString(),nonce:g.toString(),deadline:w.toString()},summary:`Owner consent to sponsor #${a} for agent #${d}, premium cap ${h} bps; expires ${w}. No funds move from this signature. The local bridge must confirm the exact EIP-712 fields.`};if(pe(i,n,r,[{kind:"typedData",request:y}],p,Math.floor(Date.now()/1e3)),String(p.nonce)!==g.toString())throw new u("Priors consent nonce changed. Start the action again.");let k={request:y,signature:n.signature};return await j(t,k,y),{signedConsent:k}}async function ge(t,i,n,r){let a=c[i.contract],d=(p,w)=>w>0n?[t.approval(p,a,w.toString(),f)]:[];if(i.approval==="nft"){let p=l(n.agentId,"agentId"),w=await Promise.all([c.market,c.market1].map(h=>I(t,h,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[p])));for(let h of w){if(!h||typeof h!="object"||!("seller"in h)||typeof h.seller!="string")throw new u("Could not verify standing listings on both Priors markets; no NFT approval was built.");if(C(h.seller,r))throw new u("A standing listing in Priors market V1 or V2 could reactivate when NFT approval mines. Cancel it with priors_market_v1_cancel or priors_market_v2_cancel, verify both listings are cleared, then retry. No approval was built.")}return[t.approval(c.registry,a,p.toString(),f)]}if(i.approval==="market"){let p=await I(t,a,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[l(n.agentId,"agentId")]);if(p.price<=0n||p.price>l(n.maxPrice,"maxPrice")||p.nonce!==l(n.nonce,"nonce")||!C(p.uriHash,String(n.uriHash)))throw new u("Listing price, nonce or URI changed; read the listing again.");return d(c.usdg,p.price)}if(i.approval==="bid"){let p=l(n.reserveBudget,"reserveBudget");if(p>=1n<<128n||p<l(n.price,"price")*l(n.count??"1","count"))throw new u("Provide a finite exact bid reserve covering price times count.");return[t.approval(c.usdg,c.bidSpender,p.toString(),f)]}if(i.approval==="bond")return d(c.usdg,BigInt(await I(t,c.bond,"amount() view returns (uint256)")));if(i.approval==="mixed"){let p=l(n.priorsIn,"priorsIn"),w=l(n.usdgIn,"usdgIn");if(p+w===0n)throw new u("Provide a positive PRIORS or USDG input.");if(w>0n&&l(n.minOut,"minOut")===0n)throw new u("USDG conversion requires a positive minimum PRIORS output.");return[...d(c.priors,p),...d(c.usdg,w)]}if(!i.approval)return[];let g=l(n.amount,"amount");if(g===0n)throw new u("amount must be positive.");if(i.approval==="stock"){let p=i.name==="priors_stock_open"?b(String(n.token)):b((await I(t,c.stock,"getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[l(n.agentId,"agentId")])).token);if(p===ae)throw new u("No stock collateral position exists.");return d(p,g)}return d(c[i.approval],g)}function _e(t){let i=te.map(n=>({name:n.name,inputSchema:{...F(n.name,n.fields,n.consentRoot?{maxPremiumBps:V(B.maxPremiumBps),continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature},...n.externalConsent?{signedConsent:{type:"object",description:"Optional public owner signature from priors_sign_consent; controller may supply collateral. Never pass a key."}}:{}}:{}),description:n.note||"Read current Priors contract state. All amounts are token base-unit decimal strings."},async execute(r,a){E(t),a=b(a);let d=Object.fromEntries(n.fields.map(m=>[m[0],se(r,m)]));if(n.owner&&!(n.externalConsent&&r.signedConsent)&&!C(await U(t,d[n.owner]),a))throw new u("Owner-only feature: call from the current identity owner wallet. Nothing was signed.");if(n.contract==="savings"&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("The savings vault asset is not USDG. Nothing was signed.");if(n.contract==="autopay"&&await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2. Nothing was signed.");if(n.contract==="market"||n.contract==="market1"){if(r.expiry!==void 0){let m=l(r.expiry,"expiry",64),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+2592000n)throw new u("Market expiry must be within 30 days.")}if(r.price!==void 0&&l(r.price,"price")<5000000n)throw new u("Market price minimum is 5 USDG.");if(r.count!==void 0&&(l(r.count,"count")<1n||l(r.count,"count")>20n))throw new u("Bid count must be 1 to 20.")}if(n.name==="priors_treasury_first_line"&&l(r.expiry,"expiry",64)<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Treasury V5 invite expired.");if(r.deadline!==void 0){let m=l(r.deadline,"deadline"),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+3600n)throw new u("deadline must be in the next hour.")}if(r.agentIds&&r.agentIds.length!==r.generations.length)throw new u("agentIds and generations must have equal length.");let g;if(n.consentRoot)if(n.externalConsent&&r.signedConsent){if(g=r.signedConsent,!g.request?.message)throw new u("Provide the public signedConsent from the current identity owner.");let m=l(r.agentId,"agentId"),S=await U(t,m),q=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[m]}),N=l(g.request.message.deadline,"consent deadline");if(N<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired.");let W=l(r.maxPremiumBps??"0","maxPremiumBps");if(W>200n)throw new u("maxPremiumBps exceeds the pool cap.");await j(t,g,M(m.toString(),n.consentRoot.toString(),S,q.toString(),N.toString(),W.toString()))}else{let m=await ee(t,n.name,r,a,n.consentRoot);if("steps"in m)return m;g=m.signedConsent}let p=(n.args??n.fields.map(([m])=>m)).map(m=>m==="$wallet"?a:m==="$consent"?g.request.message:m==="$signature"?g.signature:d[m]),w=A([n.signature]),h=w[0].name;if(n.read)return{chainId:f,contract:c[n.contract],units:"Base units; USDG 6 decimals, PRIORS 18 decimals; stock/savings scales come from token metadata.",value:Y(await t.clientFor(f).readContract({address:c[n.contract],abi:w,functionName:h,args:p}))};let y=[...await ge(t,n,r,a),t.unsignedTx({to:c[n.contract],data:G({abi:w,functionName:h,args:p}),value:"0",chainId:f,description:`${n.name}: ${n.note}`})],k=await t.preview(y,a);return{txs:y,summary:`${n.note} Inputs (base units): ${JSON.stringify(Y(d))}. ${k.summary}`}}}));return i.push({name:"priors_sign_consent",inputSchema:F("priors_sign_consent",[o,["sponsorId","id"],["maxPremiumBps","uint"]],{continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature}}),async execute(n,r){return E(t),ee(t,"priors_sign_consent",n,b(r),l(n.sponsorId,"sponsorId"))}}),i.push({name:"priors_root_offer",inputSchema:F("priors_root_offer",[["sponsorId","id"],o,v,["premiumBps","uint"]],{signedConsent:{type:"object",description:"The current agent owner output of priors_sign_consent. This is public signed authorization, never a private key."}}),async execute(n,r){E(t),r=b(r);let a=l(n.sponsorId,"sponsorId"),d=l(n.agentId,"agentId");if(!C(await U(t,a),r))throw new u("Only the sponsor root owner can send this offer.");let g=n.signedConsent;if(!g?.request?.message)throw new u("Ask the current agent owner to run priors_sign_consent from their wallet first.");let p=g.request.message,w=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),h=l(p.deadline,"consent deadline");if(h<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired; request a fresh consent.");let y=l(n.premiumBps,"premiumBps"),k=l(p.maxPremiumBps,"maxPremiumBps");if(y>k||k>200n)throw new u("premiumBps exceeds the owner consent or pool cap.");let m=M(d.toString(),a.toString(),await U(t,d),w.toString(),h.toString(),k.toString());await j(t,g,m);let S=A([`function vouchWithConsent(uint256,uint256,uint256,uint256,${$},bytes)`]),q=[t.unsignedTx({to:c.pool,data:G({abi:S,functionName:"vouchWithConsent",args:[a,d,l(n.amount,"amount"),y,m.message,g.signature]}),value:"0",chainId:f,description:"Sponsor-owned backing handoff with exact current-owner consent."})],N=await t.preview(q,r);return{txs:q,summary:`Vouch ${n.amount} USDG base units from sponsor #${a} to agent #${d}; ${y} bps premium (cap ${k}). Replaces its old sponsor only with no loan open. ${N.summary}`}}}),i.push(...me(t)),{tools:i}}function me(t){return[{name:"priors_autopay_on",inputSchema:F("priors_autopay_on",[o,["cap","uint"],["budget","uint"],["savingsShares","uint"],["late","bool"]]),async execute(i,n){E(t),n=b(n);let r=l(i.agentId,"agentId"),a=l(i.cap,"cap"),d=l(i.budget,"budget"),g=l(i.savingsShares,"savingsShares");if(typeof i.late!="boolean")throw new u("late must be true or false.");if(await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2.");let p=await I(t,c.autopay,"MAX_CAP() view returns (uint256)");if(a===0n||a>p||a>=1n<<32n||d<a||d===(1n<<256n)-1n||g===(1n<<256n)-1n)throw new u("Provide a positive supported per-loan cap and explicit finite budget at least cap; unlimited approvals are refused.");let w=await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"getAgentWallet",args:[r]});if(b(w)!==n)throw new u("Autopay enrollment requires the ERC-8004 declared agent wallet, not just its owner or pool delegate.");if(g>0n&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("Savings asset is not USDG.");let h=g>0n?await I(t,c.savings,"previewRedeem(uint256) view returns (uint256)",[g]):0n,y=A(["function enroll(uint256,uint256,bool,bool)"]),k=[t.approval(c.usdg,c.autopay,d.toString(),f),t.approval(c.savings,c.autopay,g.toString(),f),t.unsignedTx({to:c.autopay,data:G({abi:y,functionName:"enroll",args:[r,a,g>0n,i.late]}),value:"0",chainId:f,description:"Enroll future autopay with explicit finite USDG and savings share budgets."})],m=await t.preview(k,n);return{txs:k,summary:`Persistent future spending authorization: AutoRepay v2 can repay agent #${r} loans without a confirmation per loan, at most ${a} USDG base units per loan; exact total wallet allowance ${d} USDG base units and ${g} savings shares (currently ${h} USDG base units). These two allowances replace the budgets shared by ALL this wallet autopay plans, including setting savings allowance to zero when disabled. late=${i.late}; savings=${g>0n}. Revoke with priors_autopay_off, which also clears both allowances. ${m.summary}`}}},{name:"priors_autopay_off",inputSchema:F("priors_autopay_off",[o]),async execute(i,n){E(t),n=b(n);let r=A(["function revoke(uint256)"]),a=[t.unsignedTx({to:c.autopay,data:G({abi:r,functionName:"revoke",args:[l(i.agentId,"agentId")]}),value:"0",chainId:f,description:"Revoke own autopay plan."}),t.approval(c.usdg,c.autopay,"0",f),t.approval(c.savings,c.autopay,"0",f)],d=await t.preview(a,n);return{txs:a,summary:`Revoke this wallet autopay plan and zero both shared AutoRepay allowances. This also stops funding other plans using this wallet. ${d.summary}`}}}]}export{oe as a,O as b,te as c,Y as d,l as e,M as f,pe as g,_e as h};
1
+ import{m as J,n as Z}from"./4NBXBKOX.js";import{a as x}from"./G2LAO23N.js";import{a as V}from"./66F5ZH34.js";import{b as K,c as X,g as C}from"./NWNYJ26T.js";import{b as f}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as G,getAddress as b,hashTypedData as T,parseAbi as A,recoverTypedDataAddress as ie}from"viem";var oe={pool:b("0x281210097f0de7A8FB6F87310AF0f089c9C8DE21"),registry:b("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),usdg:b("0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"),priors:b("0xeDBf91223639800BCd5756815CAf908Df3b890bE"),stock:b("0xbEcd07EC689988e16b870C121756C4c2C8cb02B6"),backing:b("0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD"),treasury:b("0xFe8fdf43c4b0443aCF8E8CD8facD62F1B770e267"),bond:b("0x346d3360B7258a18E8a2a55fe20E0F467113a53A"),autopay:b("0x72B510AF4e66e5960aB9b975e0BdCf80239e83A0"),savings:b("0xBeEff033F34C046626B8D0A041844C5d1A5409dd"),market:b("0x6a4583242B8313313E684d02aB7dc6bFf8749670"),market1:b("0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19"),bidSpender:b("0x0dbd031a3e8cc91C2b0A3Bf6BD1d14c7AeD92878"),seats3:b("0x59D155C42A9263fA7596867b992bB3e84dF680a9"),seats4:b("0xb1c3a04496238D62E3c93118C297163855e22192")},c=oe,$="(uint256 agentId,uint256 sponsorId,address owner,uint256 maxPremiumBps,uint256 nonce,uint256 deadline)",ne=A(["function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),z=A(["function nonces(uint256) view returns (uint256)"]),re=A(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),ae="0x0000000000000000000000000000000000000000",O="Owner stake is collateral, not a return. A default burns 75% of owner stake (50% of other backing); pending and leaving stake remains at risk until released. New backing waits 24 hours. Exit mode 0 holds, 1 returns PRIORS, 2 requests USDG through the guarded exit queue; no immediate payout is promised.",e=(t,i,n,r,a={})=>({name:`priors_${t}`,contract:i,signature:`function ${n}`,fields:r,note:"",...a}),o=["agentId","id"],v=["amount","uint"],Q=["on","bool"],_=["generation","uint32"],D=["day","uint32"],P=["layer","uint8"],s={read:!0},te=[e("set_delegate","pool","setDelegate(uint256,address)",[o,["delegate","address"]],{owner:"agentId",note:"Owner only. Delegate controls borrowing/repayment, not transfer of identity; clear with the zero address."}),e("root_enroll","pool","enrollRoot(uint256,uint256)",[o,v],{owner:"agentId",approval:"usdg",note:"Owner only. Locks USDG pool shares behind this sponsor root; active delegated lines and fees constrain withdrawals."}),e("root_add_stake","pool","addStake(uint256,uint256)",[o,v],{approval:"usdg",note:"Anyone may add USDG; only the root owner can withdraw it. This may give funds to another owner."}),e("root_unlock","pool","unlock(uint256,uint256,address)",[o,["shares","uint"]],{owner:"agentId",args:["agentId","shares","$wallet"],note:"Owner only. Withdraw root pool shares to this wallet, subject to delegated backing and fee locks."}),e("root_retire","pool","retireRoot(uint256)",[o],{owner:"agentId",note:"Owner only; requires no remaining stake or delegated lines."}),e("root_vouch","pool","vouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Adds the exact USDG amount of undrawn backing to an existing sponsored line."}),e("root_unvouch","pool","unvouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Recalls undrawn backing; outstanding debt remains backed."}),e("root_freeze","pool","freeze(uint256,bool)",[o,["frozen","bool"]],{note:"Current sponsor owner only; freeze/unfreeze the agent line. Contract checks sponsor ownership."}),e("root_set_premium","pool","setPremium(uint256,uint256)",[o,["premiumBps","uint"]],{note:"Current sponsor owner only. Future loan premium cannot exceed the owner-consented cap."}),e("root_claim_fees","pool","claimSponsorFees(uint256,address)",[o],{owner:"agentId",args:["agentId","$wallet"],note:"Owner only; claim sponsor USDG fees to this wallet."}),e("root_set_hook","pool","setHook(uint256,address)",[o,["hook","address"]],{owner:"agentId",note:"Owner only. Changes root lending policy hook; pool enforces the delay while backing is committed."}),e("root_apply_hook","pool","applyHook(uint256)",[o],{note:"Apply a previously scheduled root hook after its on-chain delay."}),e("mark_default","pool","markDefault(uint256)",[["loanId","id"]],{note:"Irreversible: mark a past-grace unpaid loan defaulted, burn sponsor backing and mark the owner. Preview and confirm deliberately."}),e("import_history","pool","importFromV1(uint256)",[o],{note:"Import the v1 record, including defaults; this never imports unbacked capacity."}),e("fund_reserve","pool","fundReserve(uint256)",[v],{approval:"usdg",note:"Donate USDG to the pool reserve; receives no redeemable shares."}),e("root_shares","pool","rootShares(uint256) view returns (uint256)",[o],s),e("root_fee_locked","pool","feeLocked(uint256) view returns (uint256)",[o],s),e("root_fees_owed","pool","sponsorFees(uint256) view returns (uint256)",[o],s),e("root_backing","pool","backing(uint256) view returns (uint256)",[o],s),e("root_free_backing","pool","freeBacking(uint256) view returns (uint256)",[o],s),e("pool_parameters","pool","getParams() view returns ((uint256 minLoan,uint256 maxLoan,uint64 minTerm,uint64 maxTerm,uint64 grace,uint64 minScoreTerm,uint256 feeBps,uint256 sponsorFeeBps,uint256 protocolFeeBps,uint256 minStake,uint256 maxUtilizationBps,uint256 keeperBounty))",[],s),e("bond_deposit","bond","deposit(uint256)",[o],{owner:"agentId",approval:"bond",note:"Owner only. V2 treasury bond remains locked while any line or loan is open; it may replace and refund a former owner bond. Leave and release the legacy bond before Treasury V5 migration."}),e("bond_release","bond","release(uint256)",[o],{note:"Return V2 bond to its original depositor, not necessarily this wallet; contract enforces no line, no loan and age."}),e("bond_slash","bond","slash(uint256)",[o],{note:"Irreversible: send defaulted agent V2 bond to the configured beneficiary."}),e("bond_status","bond","bonds(uint256) view returns ((address depositor,uint64 at,uint256 amount))",[o],s),e("bond_releasable","bond","releasable(uint256) view returns (bool)",[o],s),e("bond_release_at","bond","unusedReleaseAt(uint256) view returns (uint256)",[o],s),e("treasury_move","treasury",`move(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","$consent","$signature"],note:"Move a former Treasury V4 line to V5, no loan open. Close old line, release legacy bond, deposit V2 bond first. V4 record and current-owner V2 bond are required."}),e("treasury_raise","treasury","raise(uint256)",[o],{note:"Raise an eligible Treasury V5 line using its current rules, score, history, age, weekly room and free backing. No unbacked credit."}),e("treasury_reclaim","treasury","reclaim(uint256)",[o],{note:"Reclaim an idle treasury line under on-chain rules; this ends borrowing access."}),e("treasury_first_line","treasury",`firstLine(uint256,uint64,bytes,${$},bytes)`,[o,["expiry","uint"],["invite","bytes"]],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","expiry","invite","$consent","$signature"],note:"Redeem an already-issued Treasury V5 invite with V5 pool consent. Requires a valid V5 inviter signature; the current owner V2 bond is needed before borrowing. V4 invites cannot be reused."}),e("treasury_raise_room","treasury","raiseRoom() view returns (uint256)",[],s),e("treasury_first_lined","treasury","firstLined(uint256) view returns (bool)",[o],s),e("treasury_eligible_raise","treasury","eligibleForRaise(uint256) view returns (bool)",[o],s),e("treasury_room","treasury","epochRoom() view returns (uint256)",[],s),e("treasury_rules","treasury","rules() view returns (uint256 reserveBps,uint256 firstLine,uint256 secondLine,uint256 epochCap,uint64 epochLength,uint64 minSeasoning,uint256 minQualified,uint256 minScore,uint64 idleAfter)",[],s),e("stock_open","stock",`open(uint256,address,uint256,${$},bytes) returns (uint256)`,[o,["token","address"],v],{owner:"agentId",consentRoot:6424n,externalConsent:!0,approval:"stock",args:["agentId","token","amount","$consent","$signature"],note:"Owner or on-chain controller with a supplied owner consent posts exact collateral. Token must be accepted and usable; live price, LTV, line cap and backing determine the line. Default seizes debt plus buffer; issuer restrictions and burns may reduce returned collateral."}),e("stock_add","stock","addCollateral(uint256,uint256)",[o,v],{approval:"stock",note:"Depositor only. Adds exact position token collateral; contract decides resulting draw room."}),e("stock_close","stock","close(uint256)",[o],{note:"Depositor or controller closes/freezes the line; collateral pays its depositor after the last loan, subject to default and issuer shortfalls."}),e("stock_expire","stock","expire(uint256)",[o],{note:"Expire idle stock line after on-chain idle rules; may close borrowing access."}),e("stock_reconcile","stock","reconcile(uint256,uint256)",[o,["maxLoans","uint"]],{note:"Reconcile the collateral debt walk against pool loans; contract ignores maxLoans in this implementation."}),e("stock_settle","stock","settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile stock collateral after a default or missed hook; may seize collateral according to the loan."}),e("stock_record_feed","stock","record(address,uint256) returns (uint80)",[["feed","address"],["maxRounds","uint"]],{note:"Advance public oracle price tape; may unblock new stock lines and default settlement."}),e("stock_reclaim","stock","reclaim(uint256)",[o],{note:"Reclaim a written-off stock position after it is no longer backed; return remains subject to vault token shortfall."}),e("stock_state","stock","getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[o],s),e("stock_borrow_room","stock","borrowRoom(uint256) view returns (uint256)",[o],s),e("stock_asset_state","stock","assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)",[["token","address"]],s),e("stock_lending_status","stock","lendStatus(address) view returns (uint8)",[["token","address"]],s),e("stock_value","stock","valueOf(address,uint256) view returns (bool ok,uint256 value)",[["token","address"],v],s),e("stock_ltv","stock","ltvOf(uint256,address) view returns (uint256)",[o,["token","address"]],s),e("backing_open","backing",`open(uint256,uint256,bool,${$},bytes)`,[o,v,["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"priors",args:["agentId","amount","autoAdd","$consent","$signature"],note:O}),e("backing_open_with_usdg","backing",`openWithUsdg(uint256,uint256,uint256,uint256,uint256,bool,${$},bytes)`,[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"mixed",args:["agentId","priorsIn","usdgIn","minOut","deadline","autoAdd","$consent","$signature"],note:O}),e("backing_add","backing","back(uint256,uint256,bool)",[o,v,["autoAdd","bool"]],{approval:"priors",note:O+" Owner-only at launch; other backers require both global and individual permission."}),e("backing_add_with_usdg","backing","backWithUsdg(uint256,uint256,uint256,uint256,uint256,bool)",[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{approval:"mixed",note:O}),e("backing_leave","backing","leave(uint256,uint256,uint8)",[o,v,["exitMode","uint8"]],{note:O}),e("backing_close","backing","close(uint256,uint8)",[o,["exitMode","uint8"]],{note:O}),...["refresh","promote","expire","sync","pokeFees","recordRepay","noteDelegate"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256)`,[o],{note:"Reconcile this V5 book against current pool, owner, record, tier and backing rules; no payout is promised."})),...["setAutoAdd","setProtocolBacking","setOthersBacking"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256,bool)`,[o,Q],{note:"Change this V5 book setting under the contract ownership/holder rules. Auto-add can compound rewards into stake at risk."})),e("backing_reconsent","backing",`reconsent(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8762n,args:["agentId","$consent","$signature"],note:"Owner only. Renew the pool consent for V5 backing."}),e("backing_release","backing","release(uint256,uint32,uint32,uint256,uint256)",[o,_,D,["minUsdgOut","uint"],["deadline","uint"]],{note:"Release caller day bucket after its release rule. Zero minUsdgOut returns PRIORS; positive requests a guarded sale. Stake stays burnable until release. Read generation/day from chain events."}),e("backing_release_for","backing","releaseFor(uint256,uint32,address,uint32)",[o,_,["holder","address"],D],{note:"Return eligible PRIORS to its holder under generation/day release rules, never redirect proceeds."}),e("backing_finish_close","backing","finishClose(uint256,uint32)",[o,_],{note:"Finish an eligible generation close; pays the bound owner under its release rules."}),e("backing_claim_settled","backing","claimSettled(uint256,uint32,address)",[o,_,["holder","address"]],{note:"Pay settled generation stake to the named holder, after any default burn."}),e("backing_claim_record","backing","claimSettled(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Pay settled day record to its holder after any default burn."}),e("backing_queue_exit","backing","queueExit(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Holder/keeper queues ready USDG-mode stake; minimum and queue window apply. A queue entry is not a fill or payout."}),e("backing_settle","backing","settle(uint256,uint32,uint256)",[o,_,["loanId","id"]],{note:"Reconcile V5 generation with a pool loan/default after a missed hook."}),e("backing_record_loan","backing","recordLoan(uint256)",[["loanId","id"]],{note:"Record current pool loan in V5 book."}),e("backing_record_default","backing","recordDefault(uint256)",[["loanId","id"]],{note:"Reconcile a marked pool default and its stake burn."}),e("backing_collect","backing","collect(uint256[],uint32[]) returns (uint256)",[["agentIds","ids"],["generations","gens"]],{note:"Collect caller fees for explicitly selected generations; auto-add settings may retain stake."}),e("backing_fund","backing","fund(uint256)",[v],{approval:"usdg",note:"Donate USDG to V5 root backing; donor receives no withdrawable claim."}),e("backing_book","backing","getGen(uint256,uint32) view returns ((address owner,uint64 openedAt,uint8 status,bool ownerChanged,bool optOut,bool othersOff,bool pointsVoid,bool openRoomCharged,bool closedByOwner,bool movePending,bool splitPending,uint64 movePendingAt,uint8 tier,uint8 countedAtTier,uint8 listLen,uint32 tierStep,uint64 tierSince,uint64 lastLateAt,uint64 closedMark,uint64 lastRaiseAt,uint64 promoEpoch,uint64 stakeEpoch,uint64 placeEpoch,uint160 movePendingSqrt,uint256 roomLine,uint256 openLine,uint256 promoCredit,uint256 stakeRaised,uint256 placed,uint256 index,uint256 divisor,uint256 defaultProof,uint256 cLive,uint256 cUnits,uint256[3] list,uint256[3] counted,uint256[3] pendingTok,uint256[3] leavingLive,uint256[3] tokens,uint64[3] layerEnd,uint160[3] endSqrt,uint8[3] ownerEndMode,uint32[2][3] liveDay,uint32[3] leaveHead,(uint64 epoch,uint192 points)[5] points))",[o,_],s),e("backing_generation","backing","latestGen(uint256) view returns (uint32)",[o],s),e("backing_line","backing","lineOf(uint256) view returns (uint256)",[o],s),e("backing_quote","backing","needed(uint256,uint256,bool) view returns ((uint256 minA,uint256 fullLine,uint256 capA,uint160 sqrtP,uint8 k,uint8 kCached,bool depthGuard,uint256 line,uint256 ownerA,uint256 ownBacking,uint256 roomB,uint256 lineIfAdded,uint256 weekAfter))",[o,["tokens","uint"],["asOwner","bool"]],s),e("backing_position","backing","position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))",[o,_,P,["holder","address"]],s),e("backing_record","backing","record(uint256,uint32,uint8,uint32,address) view returns ((uint256 counted,uint256 uncounted,uint256 creditedTo,uint160 sqrtLeave,uint8 mode,uint64 entry))",[o,_,P,D,["holder","address"]],s),e("backing_bucket","backing","leavingBucket(uint256,uint32,uint8,uint32) view returns ((bool exists,bool retired,uint64 latestLeave,uint64 releasableAt,uint256 loanCount,uint256 counted,uint256 uncounted,uint256 retireIndex))",[o,_,P,D],s),e("backing_settings","backing","settings() view returns (bool openBacking,uint256 premiumCap,uint256 maxSwapUsdg,uint256 openRoom,uint256 raiseRoom,uint256 vouchCap,uint8 minDrawK,bool premiumCheck,uint64 pausedUntil)",[],s),e("backing_reopen_at","backing","reopenAt(uint256) view returns (uint64)",[o],s),e("backing_sync_prices","backing","sync()",[],{note:"Update global V5 price/guard observations."}),e("backing_exit_service_open","backing","exitServiceOpen() view returns (bool)",[],s),e("backing_usdg_path","backing","usdgPathOpen(uint256) view returns (bool,uint8)",[["usdgIn","uint"]],s),e("backing_entry_rule","backing","entryRule() view returns (uint8 minEntryLoans,uint32 minEntryDays)",[],s),e("backing_target_premium","backing","targetPremiumBps(uint256) view returns (uint256)",[o],s),e("backing_price_cache","backing","priceCache() view returns (uint160 sqrtMedian,uint64 obsAt,uint160 sqrtWeekLow,uint160 sqrtObservation)",[],s),e("backing_pending_bucket","backing","pendingBucket(uint256,uint32,uint8,uint32) view returns ((uint128 amount,uint64 lastDeposit,bool merged,bool dead,uint256 mergeIndex))",[o,_,P,D],s),e("backing_exit_head","backing","exitHead() view returns (uint256 entryId,address holder,uint256 rest,uint160 sqrtPLeave,uint64 joinedAt)",[],s),e("backing_exit_entry","backing","entry(uint256) view returns ((uint256 id,uint32 gen,uint8 layer,uint32 day,address holder,uint64 joinedAt,uint64 prev,uint64 next))",[["entryId","uint"]],s),e("backing_flush","backing","flush()",[],{note:"Reconcile V5 fees and backing buffers; no payout to caller is promised."}),e("backing_claimable","backing","claimable(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("autopay_hold","autopay","hold(bool)",[Q],{note:"Hold/resume future autopay attempts for this wallet; allowances remain until explicitly revoked."}),e("autopay_max_cap","autopay","MAX_CAP() view returns (uint256)",[],s),e("autopay_window","autopay","WINDOW() view returns (uint64)",[],s),e("autopay_paused_until","autopay","pausedUntil() view returns (uint64)",[],s),e("autopay_plan","autopay","planOf(address,uint256) view returns (uint32 cap,address owner,bool on,bool useSavings,bool late,uint32 epoch)",[o],{...s,args:["$wallet","agentId"]}),e("autopay_check","autopay","check(uint256) view returns ((uint8 status,uint256 agentId,uint256 due,uint64 opens,uint64 closes,address wallet,uint256 fromWallet,uint256 fromWalletSavings,address owner,uint256 fromOwner,uint256 fromOwnerSavings))",[["loanId","id"]],s),e("autopay_epoch","autopay","epochOf(uint256) view returns (uint32 epoch,bool stale)",[o],s),e("autopay_held","autopay","held(address) view returns (bool)",[],{...s,args:["$wallet"]}),e("savings_deposit","savings","deposit(uint256,address) returns (uint256)",[v],{approval:"usdg",args:["amount","$wallet"],note:"Deposit own USDG into Priors default external Morpho savings vault; vault/allocator risk and withdrawal liquidity apply."}),e("savings_withdraw","savings","withdraw(uint256,address,address) returns (uint256)",[v],{args:["amount","$wallet","$wallet"],note:"Withdraw exact USDG amount from own savings. Insufficient liquidity fails the preview; no immediate exit is promised."}),e("savings_redeem","savings","redeem(uint256,address,address) returns (uint256)",[["shares","uint"]],{args:["shares","$wallet","$wallet"],note:"Redeem exact own savings shares to this wallet; liquidity and rounding apply."}),e("savings_balance","savings","balanceOf(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("savings_value","savings","previewRedeem(uint256) view returns (uint256)",[["shares","uint"]],s),...["market","market1"].flatMap((t,i)=>[e(`market_v${i===0?2:1}_listing`,t,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[o],s),e(`market_v${i===0?2:1}_record_hash`,t,"recordHash(uint256) view returns (bytes32)",[o],s),e(`market_v${i===0?2:1}_list`,t,"list(uint256,uint256,uint64)",[o,["price","uint"],["expiry","uint"]],{owner:"agentId",approval:"nft",note:"Owner sells this ERC-8004 NFT, its record and any followed treasury line. This does not transfer code, keys or servers. Approves only this NFT; confirm the sale terms and contract-enforced hold/line rules."}),e(`market_v${i===0?2:1}_cancel`,t,"cancel(uint256)",[o],{note:"Cancel the standing listing; NFT approval can remain until explicitly cleared."}),e(`market_v${i===0?2:1}_buy`,t,"buy(uint256,uint256,uint256,bytes32,bytes32)",[o,["maxPrice","uint"],["nonce","uint"],["uriHash","bytes32"],["recordHash","bytes32"]],{approval:"market",note:"Buy an ERC-8004 NFT to this wallet with exact live asking-price approval and pinned listing nonce, tokenURI and current credit record. A followed line still needs the new owner bond before borrowing. No keys/code/servers are included."})]),e("market_bid","market","bid(uint256,uint256,uint64,bytes32,uint256,uint256) returns (uint256)",[o,["price","uint"],["expiry","uint"],["uriHash","bytes32"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["agentId","price","expiry","uriHash","minRepaid","minLine"],approval:"bid",note:"Standing future purchase authority: another owner can fill this bid later without a new click. Exact reserveBudget USDG allowance is shared by all this wallet bids and replaces the old allowance. Cancel bid and clear unused budget deliberately."}),e("market_bid_any","market","bidAny(bytes32,uint256,uint256,uint64,uint256,uint256) returns (uint256)",[["root","bytes32"],["count","uint"],["price","uint"],["expiry","uint"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["root","count","price","expiry","minRepaid","minLine"],approval:"bid",note:"Standing future authority to buy count identities committed by the explicit Merkle root; shared exact reserveBudget USDG allowance. Inspect the committed ID list before authorizing. No code, keys or servers transfer."}),e("market_cancel_bid","market","cancelBid(uint256)",[["bidId","id"]],{note:"Cancel this bid; shared USDG allowance is unchanged so other bids can still fill."}),e("market_accept_bid","market","acceptBid(uint256,uint256,bytes32[],uint256)",[["bidId","id"],o,["proof","proof"],["minNet","uint"]],{owner:"agentId",approval:"nft",note:"Sell only this NFT into a currently valid bid; minNet pins seller USDG proceeds. Merkle proof and current bid rules are checked on chain during preview."}),e("market_bid_state","market","bidOf(uint256) view returns ((address maker,uint64 expiry,uint16 left,bool any,uint96 price,uint96 minLine,uint64 minRepaid,bytes32 target,bytes32 uriHash))",[["bidId","id"]],s),e("market_builder","market","builderOf(uint256) view returns ((address to,uint16 bps))",[o],s),e("market_set_builder","market","setBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{owner:"agentId",note:"Owner-only attribution before first sale; assigns future sale revenue share to to. Contract enforces enabled switch, no listing, and maximum 500 bps."}),e("market_change_builder","market","changeBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{note:"Current builder only; may lower or redirect own revenue share, never increase it."}),e("market_sale_split","market","saleSplit(uint256) view returns (uint256 fee,uint256 share,uint256 net)",[o],s),...["seats3","seats4"].flatMap((t,i)=>[e(`legacy_v${i+3}_close`,t,"close(uint256)",[o],{note:"Existing seat only. Close/freeze and return stake to original staker after final loan; default burn still applies. No new seats are opened."}),e(`legacy_v${i+3}_withdraw_offer`,t,"withdrawOffer(uint256,address)",[o],{args:["agentId","$wallet"],note:"Withdraw caller unaccepted offer; PRIORS returns to the staker."}),e(`legacy_v${i+3}_expire`,t,"expire(uint256)",[o],{note:"Expire idle seat under current contract rules."}),e(`legacy_v${i+3}_settle`,t,"settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile existing seat against pool loan/default after a missed hook."}),e(`legacy_v${i+3}_claim`,t,"claim(address) returns (uint256)",[],{args:["$wallet"],note:"Claim caller legacy seat USDG fees to this wallet."}),e(`legacy_v${i+3}_seat`,t,"getSeat(uint256) view returns ((address staker,uint64 openedAt,bool closing,uint8 status,uint128 line,uint128 burnBps,uint256 amount,uint256 feeMark,address owner))",[o],s),e(`legacy_v${i+3}_pending_fees`,t,"pendingFees(uint256) view returns (uint256)",[o],s),e(`legacy_v${i+3}_fees`,t,"feesOwed(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e(`legacy_v${i+3}_offer`,t,"offers(uint256,address) view returns (uint256)",[o],{...s,args:["agentId","$wallet"]})])];function Y(t){return JSON.parse(JSON.stringify(t,(i,n)=>typeof n=="bigint"?n.toString():n))}function l(t,i,n=256){if(typeof t!="string"||!/^[0-9]+$/.test(t)||BigInt(t)>=1n<<BigInt(n))throw new u(`${i} must be a decimal base-unit string fitting uint${n}.`);return BigInt(t)}function se(t,[i,n]){let r=t[i];if(n==="address"){if(typeof r!="string"||!K.test(r))throw new u(`${i} must be a token or wallet address.`);return b(r)}if(n==="bool"){if(typeof r!="boolean")throw new u(`${i} must be true or false.`);return r}if(n==="bytes32"){if(typeof r!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r))throw new u(`${i} must be bytes32.`);return r}if(n==="proof"){if(!Array.isArray(r)||r.length>32||!r.every(d=>typeof d=="string"&&/^0x[0-9a-fA-F]{64}$/.test(d)))throw new u("proof needs at most 32 bytes32 hashes.");return r}if(n==="bytes"){if(typeof r!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(r)||r.length>32770)throw new u(`${i} must be bounded hexadecimal bytes.`);return r}if(n==="ids"||n==="gens"){if(!Array.isArray(r)||r.length===0||r.length>100)throw new u(`${i} needs 1 to 100 decimal strings.`);return r.map(d=>l(d,i,n==="gens"?32:256))}let a=l(r,i,n==="uint8"?8:n==="uint32"?32:256);if(n==="id"&&a===0n)throw new u(`${i} must be positive.`);if(i==="exitMode"&&a>2n)throw new u("exitMode must be 0 (hold), 1 (PRIORS), or 2 (USDG queue).");if(i==="layer"&&a>2n)throw new u("layer must be 0, 1, or 2.");return a}var R=x.amount("USDG",6,"1000000"),L=x.amount("PRIORS",18,"1000000000000000000"),H='Amount of the stock token in base units (read its decimals with priors_stock_asset_state). Example: "1000000000000000000" = 1 token at 18 decimals.',ue={priors_root_enroll:R,priors_root_add_stake:R,priors_root_vouch:R,priors_root_unvouch:R,priors_root_offer:R,priors_fund_reserve:R,priors_backing_fund:R,priors_savings_deposit:R,priors_savings_withdraw:R,priors_stock_open:H,priors_stock_add:H,priors_stock_value:H,priors_backing_open:L,priors_backing_add:L,priors_backing_leave:L},B={agentId:'ERC-8004 agent ID, as a decimal string. Example: "437".',sponsorId:'ERC-8004 ID of the sponsor root, as a decimal string. Example: "6228".',loanId:x.id("Priors pool loan"),bidId:x.id("AgentMarket V2 bid"),entryId:x.id("V5 exit-queue entry"),delegate:"Address to appoint as pool delegate (borrow and repay only, never identity transfer); the zero address clears it.",frozen:"true freezes the agent line; false unfreezes it.",premiumBps:"Loan premium in basis points (50 = 0.5%); at most the owner-consented cap.",maxPremiumBps:'Owner-consented maximum sponsor premium in basis points (50 = 0.5%), at most 200. Default "0".',hook:"Address of the root lending-policy hook contract (0x followed by 40 hex digits).",expiry:"Expiry in Unix seconds. Market listings and bids allow at most 30 days ahead; a V5 invite uses its issued expiry.",invite:"Treasury V5 inviter signature bytes as 0x hex, exactly as issued.",token:"Address of the stock token (0x followed by 40 hex digits); it must be an accepted Priors stock collateral.",maxLoans:"Loan count bound passed to reconcile, as a decimal string; this contract version ignores it.",feed:"Address of the public oracle price feed to record (0x followed by 40 hex digits).",maxRounds:"Maximum oracle rounds to record in this call, as a decimal string.",autoAdd:"true compounds rewards into the stake at risk; false leaves them out.",priorsIn:x.amount("PRIORS",18,"1000000000000000000"),usdgIn:x.amount("USDG",6,"1000000"),minOut:"Minimum PRIORS received from the USDG conversion, in base units (PRIORS has 18 decimals); must be positive when usdgIn is.",deadline:"Deadline in Unix seconds, within the next hour. Example: 1800000000.",exitMode:x.enumValues({0:"hold",1:"return PRIORS",2:"request USDG through the guarded exit queue"}),generation:"V5 book generation number, as a decimal string; read it from priors_backing_generation or chain events.",day:"Day bucket number, as a decimal string, read from chain events; never guess it.",layer:'Backing layer "0", "1" or "2", as recorded in chain events.',holder:"Address of the stake holder; any payout goes only to this holder.",minUsdgOut:'"0" returns PRIORS; a positive value requests a guarded USDG sale with this minimum, in USDG base units (6 decimals).',agentIds:"ERC-8004 agent IDs as decimal strings, paired by position with generations (1 to 100).",generations:"Generation numbers as decimal strings, paired by position with agentIds.",tokens:'PRIORS amount in base units (PRIORS has 18 decimals) passed to the contract needed() quote. Example: "0".',asOwner:"true quotes as the agent owner; false as another backer.",price:'Price per identity in USDG base units (6 decimals); minimum "5000000" = 5 USDG.',maxPrice:"Highest asking price you accept, in USDG base units (6 decimals); read the listing first.",nonce:"Listing nonce from the listing read, as a decimal string; it pins the exact listing.",uriHash:"bytes32 hash of the agent tokenURI (0x followed by 64 hex digits), from the listing or priors_market_pins.",recordHash:"bytes32 hash of the agent credit record (0x followed by 64 hex digits), from priors_market_v1/v2_record_hash.",minRepaid:"Minimum repaid-loan count in the agent record for the bid to fill, as a decimal string.",minLine:"Minimum credit line the agent must carry for the bid to fill, in USDG base units (6 decimals).",reserveBudget:"Exact USDG allowance shared by all bids of this wallet, in base units (6 decimals); must cover price times count.",root:"Merkle root (bytes32) committing the agent ID list; rebuild it with priors_market_origin.",count:"Number of identities to buy from the committed list, 1 to 20, as a decimal string.",proof:"Merkle proof for this agent in the bid root: at most 32 bytes32 hashes.",minNet:"Minimum seller USDG proceeds, in base units (USDG has 6 decimals).",to:x.recipient("builder sale share recipient"),bps:"Builder sale share in basis points (50 = 0.5%); at most 500.",on:"true turns this setting on; false turns it off.",cap:'Per-loan repayment cap in USDG base units (USDG has 6 decimals), at most the contract MAX_CAP. Example: "5000000" = 5 USDG.',budget:"Total USDG allowance for AutoRepay in base units (6 decimals); at least cap, and shared by all plans of this wallet.",savingsShares:'Savings vault share allowance in base units (read the vault decimals); "0" disables savings use.',late:"AutoRepay late flag stored in the plan (true or false); read priors_autopay_plan to confirm it.",continuation:"Opaque state from the previous step; pass it back unchanged. Never build it by hand.",signature:"Local signature for the confirmed step, as 0x hex; the bridge supplies it. Never a key."},de={priors_root_unlock:"Root pool shares to withdraw, in pool share base units (read root_shares); not USDG.",priors_savings_redeem:"Savings vault shares to redeem, in base units (read the vault decimals); not USDG.",priors_savings_value:"Savings vault shares to value, in base units (read the vault decimals); not USDG."};function le(t,i){return i==="amount"?ue[t]:i==="shares"?de[t]:t==="priors_autopay_hold"&&i==="on"?"true holds future autopay attempts; false resumes them.":B[i]}function ce(t,i,n){let r=le(t,i);return r===void 0?n:{...n,description:r}}function F(t,i,n={}){return{type:"object",additionalProperties:!1,required:i.map(([r])=>r),properties:Object.fromEntries([...i.map(([r,a])=>[r,ce(t,r,a==="bool"?{type:"boolean"}:a==="address"?X:a==="proof"?{type:"array",maxItems:32,items:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}}:a==="ids"||a==="gens"?{type:"array",maxItems:100,items:V()}:{type:"string",...a==="bytes32"?{pattern:"^0x[0-9a-fA-F]{64}$"}:a!=="bytes"?{pattern:"^[0-9]+$"}:{}})]),...Object.entries(n)])}}async function I(t,i,n,r=[]){let a=[`function ${n}`],d=A(a);return t.clientFor(f).readContract({address:i,abi:d,functionName:d[0].name,args:r})}async function U(t,i){return b(await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"ownerOf",args:[i]}))}function E(t){if(t.network==="testnet")throw new u("Priors ecosystem features are configured only on chain 4663.")}function M(t,i,n,r,a,d="0"){return{domain:Z(),types:{Consent:[...J.Consent]},primaryType:"Consent",message:{agentId:t,sponsorId:i,owner:b(n),nonce:r,deadline:a,maxPremiumBps:d}}}async function j(t,i,n){if(!i||!i.request||T(i.request)!==T(n)||typeof i.signature!="string"||!/^0x(?:[a-fA-F0-9]{2}){1,4096}$/.test(i.signature))throw new u("Consent differs from this agent, sponsor, owner, premium cap, nonce or deadline.");let r=n.message.owner,a=await t.clientFor(f).getCode({address:r});if(a&&a!=="0x"){if(await t.clientFor(f).readContract({address:r,abi:re,functionName:"isValidSignature",args:[T(n),i.signature]})!=="0x1626ba7e")throw new u("The owner contract rejected the consent signature.")}else if(!C(await ie({...n,signature:i.signature}),r))throw new u("The consent signature is not from the current agent owner.")}function pe(t,i,n,r,a,d){let g=te.find(k=>k.name===t),p=t==="priors_sign_consent"?l(i.sponsorId,"sponsorId"):g?.consentRoot;if(!p||a.stage!=="priors_consent"||a.tool!==t||a.wallet!==b(n)||a.chainId!==f||a.agentId!==i.agentId||r.length!==1||r[0]?.kind!=="typedData")throw new u("Unexpected Priors consent continuation.");let w=l(a.nonce,"nonce").toString(),h=l(a.deadline,"deadline");if(h<=BigInt(d)||h>BigInt(d+3600))throw new u("Priors consent expired or exceeds its one-hour window.");let y=M(String(i.agentId),p.toString(),n,w,h.toString(),String(i.maxPremiumBps??"0"));if(!r[0].request||T(r[0].request)!==T(y))throw new u("Priors consent differs from the requested agent, root, owner or premium.")}async function ee(t,i,n,r,a){let d=l(n.agentId,"agentId");if(!C(await U(t,d),r))throw new u("This operation requires the current identity owner wallet; a delegate cannot consent. Use the owner wallet.");let g=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),p=n.continuation,w=p?l(p.deadline,"deadline"):BigInt(Math.floor(Date.now()/1e3)+1800),h=l(n.maxPremiumBps??"0","maxPremiumBps");if(n.signature!==void 0&&!n.continuation)throw new u("A signature needs its locally confirmed Priors consent continuation.");if(h>200n)throw new u("maxPremiumBps exceeds the pool maximum of 200.");let y=M(d.toString(),a.toString(),r,g.toString(),w.toString(),h.toString());if(!p)return{steps:[{kind:"typedData",request:y}],continuation:{stage:"priors_consent",tool:i,wallet:r,chainId:f,agentId:d.toString(),nonce:g.toString(),deadline:w.toString()},summary:`Owner consent to sponsor #${a} for agent #${d}, premium cap ${h} bps; expires ${w}. No funds move from this signature. The local bridge must confirm the exact EIP-712 fields.`};if(pe(i,n,r,[{kind:"typedData",request:y}],p,Math.floor(Date.now()/1e3)),String(p.nonce)!==g.toString())throw new u("Priors consent nonce changed. Start the action again.");let k={request:y,signature:n.signature};return await j(t,k,y),{signedConsent:k}}async function ge(t,i,n,r){let a=c[i.contract],d=(p,w)=>w>0n?[t.approval(p,a,w.toString(),f)]:[];if(i.approval==="nft"){let p=l(n.agentId,"agentId"),w=await Promise.all([c.market,c.market1].map(h=>I(t,h,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[p])));for(let h of w){if(!h||typeof h!="object"||!("seller"in h)||typeof h.seller!="string")throw new u("Could not verify standing listings on both Priors markets; no NFT approval was built.");if(C(h.seller,r))throw new u("A standing listing in Priors market V1 or V2 could reactivate when NFT approval mines. Cancel it with priors_market_v1_cancel or priors_market_v2_cancel, verify both listings are cleared, then retry. No approval was built.")}return[t.approval(c.registry,a,p.toString(),f)]}if(i.approval==="market"){let p=await I(t,a,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[l(n.agentId,"agentId")]);if(p.price<=0n||p.price>l(n.maxPrice,"maxPrice")||p.nonce!==l(n.nonce,"nonce")||!C(p.uriHash,String(n.uriHash)))throw new u("Listing price, nonce or URI changed; read the listing again.");return d(c.usdg,p.price)}if(i.approval==="bid"){let p=l(n.reserveBudget,"reserveBudget");if(p>=1n<<128n||p<l(n.price,"price")*l(n.count??"1","count"))throw new u("Provide a finite exact bid reserve covering price times count.");return[t.approval(c.usdg,c.bidSpender,p.toString(),f)]}if(i.approval==="bond")return d(c.usdg,BigInt(await I(t,c.bond,"amount() view returns (uint256)")));if(i.approval==="mixed"){let p=l(n.priorsIn,"priorsIn"),w=l(n.usdgIn,"usdgIn");if(p+w===0n)throw new u("Provide a positive PRIORS or USDG input.");if(w>0n&&l(n.minOut,"minOut")===0n)throw new u("USDG conversion requires a positive minimum PRIORS output.");return[...d(c.priors,p),...d(c.usdg,w)]}if(!i.approval)return[];let g=l(n.amount,"amount");if(g===0n)throw new u("amount must be positive.");if(i.approval==="stock"){let p=i.name==="priors_stock_open"?b(String(n.token)):b((await I(t,c.stock,"getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[l(n.agentId,"agentId")])).token);if(p===ae)throw new u("No stock collateral position exists.");return d(p,g)}return d(c[i.approval],g)}function _e(t){let i=te.map(n=>({name:n.name,inputSchema:{...F(n.name,n.fields,n.consentRoot?{maxPremiumBps:V(B.maxPremiumBps),continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature},...n.externalConsent?{signedConsent:{type:"object",description:"Optional public owner signature from priors_sign_consent; controller may supply collateral. Never pass a key."}}:{}}:{}),description:n.note||"Read current Priors contract state. All amounts are token base-unit decimal strings."},async execute(r,a){E(t),a=b(a);let d=Object.fromEntries(n.fields.map(m=>[m[0],se(r,m)]));if(n.owner&&!(n.externalConsent&&r.signedConsent)&&!C(await U(t,d[n.owner]),a))throw new u("Owner-only feature: call from the current identity owner wallet. Nothing was signed.");if(n.contract==="savings"&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("The savings vault asset is not USDG. Nothing was signed.");if(n.contract==="autopay"&&await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2. Nothing was signed.");if(n.contract==="market"||n.contract==="market1"){if(r.expiry!==void 0){let m=l(r.expiry,"expiry",64),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+2592000n)throw new u("Market expiry must be within 30 days.")}if(r.price!==void 0&&l(r.price,"price")<5000000n)throw new u("Market price minimum is 5 USDG.");if(r.count!==void 0&&(l(r.count,"count")<1n||l(r.count,"count")>20n))throw new u("Bid count must be 1 to 20.")}if(n.name==="priors_treasury_first_line"&&l(r.expiry,"expiry",64)<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Treasury V5 invite expired.");if(r.deadline!==void 0){let m=l(r.deadline,"deadline"),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+3600n)throw new u("deadline must be in the next hour.")}if(r.agentIds&&r.agentIds.length!==r.generations.length)throw new u("agentIds and generations must have equal length.");let g;if(n.consentRoot)if(n.externalConsent&&r.signedConsent){if(g=r.signedConsent,!g.request?.message)throw new u("Provide the public signedConsent from the current identity owner.");let m=l(r.agentId,"agentId"),S=await U(t,m),q=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[m]}),N=l(g.request.message.deadline,"consent deadline");if(N<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired.");let W=l(r.maxPremiumBps??"0","maxPremiumBps");if(W>200n)throw new u("maxPremiumBps exceeds the pool cap.");await j(t,g,M(m.toString(),n.consentRoot.toString(),S,q.toString(),N.toString(),W.toString()))}else{let m=await ee(t,n.name,r,a,n.consentRoot);if("steps"in m)return m;g=m.signedConsent}let p=(n.args??n.fields.map(([m])=>m)).map(m=>m==="$wallet"?a:m==="$consent"?g.request.message:m==="$signature"?g.signature:d[m]),w=A([n.signature]),h=w[0].name;if(n.read)return{chainId:f,contract:c[n.contract],units:"Base units; USDG 6 decimals, PRIORS 18 decimals; stock/savings scales come from token metadata.",value:Y(await t.clientFor(f).readContract({address:c[n.contract],abi:w,functionName:h,args:p}))};let y=[...await ge(t,n,r,a),t.unsignedTx({to:c[n.contract],data:G({abi:w,functionName:h,args:p}),value:"0",chainId:f,description:`${n.name}: ${n.note}`})],k=await t.preview(y,a);return{txs:y,summary:`${n.note} Inputs (base units): ${JSON.stringify(Y(d))}. ${k.summary}`}}}));return i.push({name:"priors_sign_consent",inputSchema:F("priors_sign_consent",[o,["sponsorId","id"],["maxPremiumBps","uint"]],{continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature}}),async execute(n,r){return E(t),ee(t,"priors_sign_consent",n,b(r),l(n.sponsorId,"sponsorId"))}}),i.push({name:"priors_root_offer",inputSchema:F("priors_root_offer",[["sponsorId","id"],o,v,["premiumBps","uint"]],{signedConsent:{type:"object",description:"The current agent owner output of priors_sign_consent. This is public signed authorization, never a private key."}}),async execute(n,r){E(t),r=b(r);let a=l(n.sponsorId,"sponsorId"),d=l(n.agentId,"agentId");if(!C(await U(t,a),r))throw new u("Only the sponsor root owner can send this offer.");let g=n.signedConsent;if(!g?.request?.message)throw new u("Ask the current agent owner to run priors_sign_consent from their wallet first.");let p=g.request.message,w=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),h=l(p.deadline,"consent deadline");if(h<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired; request a fresh consent.");let y=l(n.premiumBps,"premiumBps"),k=l(p.maxPremiumBps,"maxPremiumBps");if(y>k||k>200n)throw new u("premiumBps exceeds the owner consent or pool cap.");let m=M(d.toString(),a.toString(),await U(t,d),w.toString(),h.toString(),k.toString());await j(t,g,m);let S=A([`function vouchWithConsent(uint256,uint256,uint256,uint256,${$},bytes)`]),q=[t.unsignedTx({to:c.pool,data:G({abi:S,functionName:"vouchWithConsent",args:[a,d,l(n.amount,"amount"),y,m.message,g.signature]}),value:"0",chainId:f,description:"Sponsor-owned backing handoff with exact current-owner consent."})],N=await t.preview(q,r);return{txs:q,summary:`Vouch ${n.amount} USDG base units from sponsor #${a} to agent #${d}; ${y} bps premium (cap ${k}). Replaces its old sponsor only with no loan open. ${N.summary}`}}}),i.push(...me(t)),{tools:i}}function me(t){return[{name:"priors_autopay_on",inputSchema:F("priors_autopay_on",[o,["cap","uint"],["budget","uint"],["savingsShares","uint"],["late","bool"]]),async execute(i,n){E(t),n=b(n);let r=l(i.agentId,"agentId"),a=l(i.cap,"cap"),d=l(i.budget,"budget"),g=l(i.savingsShares,"savingsShares");if(typeof i.late!="boolean")throw new u("late must be true or false.");if(await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2.");let p=await I(t,c.autopay,"MAX_CAP() view returns (uint256)");if(a===0n||a>p||a>=1n<<32n||d<a||d===(1n<<256n)-1n||g===(1n<<256n)-1n)throw new u("Provide a positive supported per-loan cap and explicit finite budget at least cap; unlimited approvals are refused.");let w=await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"getAgentWallet",args:[r]});if(b(w)!==n)throw new u("Autopay enrollment requires the ERC-8004 declared agent wallet, not just its owner or pool delegate.");if(g>0n&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("Savings asset is not USDG.");let h=g>0n?await I(t,c.savings,"previewRedeem(uint256) view returns (uint256)",[g]):0n,y=A(["function enroll(uint256,uint256,bool,bool)"]),k=[t.approval(c.usdg,c.autopay,d.toString(),f),t.approval(c.savings,c.autopay,g.toString(),f),t.unsignedTx({to:c.autopay,data:G({abi:y,functionName:"enroll",args:[r,a,g>0n,i.late]}),value:"0",chainId:f,description:"Enroll future autopay with explicit finite USDG and savings share budgets."})],m=await t.preview(k,n);return{txs:k,summary:`Persistent future spending authorization: AutoRepay v2 can repay agent #${r} loans without a confirmation per loan, at most ${a} USDG base units per loan; exact total wallet allowance ${d} USDG base units and ${g} savings shares (currently ${h} USDG base units). These two allowances replace the budgets shared by ALL this wallet autopay plans, including setting savings allowance to zero when disabled. late=${i.late}; savings=${g>0n}. Revoke with priors_autopay_off, which also clears both allowances. ${m.summary}`}}},{name:"priors_autopay_off",inputSchema:F("priors_autopay_off",[o]),async execute(i,n){E(t),n=b(n);let r=A(["function revoke(uint256)"]),a=[t.unsignedTx({to:c.autopay,data:G({abi:r,functionName:"revoke",args:[l(i.agentId,"agentId")]}),value:"0",chainId:f,description:"Revoke own autopay plan."}),t.approval(c.usdg,c.autopay,"0",f),t.approval(c.savings,c.autopay,"0",f)],d=await t.preview(a,n);return{txs:a,summary:`Revoke this wallet autopay plan and zero both shared AutoRepay allowances. This also stops funding other plans using this wallet. ${d.summary}`}}}]}export{oe as a,O as b,te as c,Y as d,l as e,M as f,pe as g,_e as h};
@@ -1 +1 @@
1
- import{a as f}from"./GRSXWQWD.js";import{a as k}from"./G2LAO23N.js";import{c as l}from"./NWNYJ26T.js";import{a as p}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{getAddress as g}from"viem";var v={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},b=[["hookr_release",{},[],"Read verified release contracts, block and recapture lane."],["hookr_blocks",{},[],"Read all Hook Blocks and their current availability."],["hookr_kings",{poolId:v},[],"Read King of the Pool rounds, leaders, pots and endings."],["hookr_claims",{poolId:v},[],"Read the signing wallet's prizes, royalties, recapture and PoolManager claims."],["hookr_revenue_tokens",{limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of revenue tokens to return, 1 to 50."},cursor:{type:"string",pattern:"^(v1|v1:[1-9][0-9]{0,19}|v2:[1-9][0-9]{0,19})$",description:"Paging cursor: the nextCursor string from the previous page (v1, v1:N or v2:N); omit for the first page."}},[],"Read revenue tokens, tokenizer provenance, streams and income, page by page."],["hookr_revenue_token",{token:{...l,description:k.address("revenue token")}},["token"],"Read a revenue token, stream endings, income, drops and the signing wallet's claims."],["hookr_hook",{address:{...l,description:k.address("Hookr hook contract")}},["address"],"Read shared or owned hook provenance, ownership, allowed blocks, opening and pools."]],M=[...b.map(d=>d[0]),"hookr_contracts","hookr_read","hookr_revenue_read","hookr_addon_read","hookr_api_read"];function P(d){return[...b.map(([t,c,a,o])=>({name:t,inputSchema:{type:"object",description:o,properties:c,required:a,additionalProperties:!1},execute:async(r,w)=>{if(Object.keys(r).some(n=>!Object.hasOwn(c,n))||a.some(n=>r[n]===void 0))throw new s(`Provide the documented arguments for ${t}.`);let m={};for(let[n,i]of Object.entries(r)){let u=c[n];if(u.type==="integer"){if(typeof i!="number"||!Number.isInteger(i)||i<Number(u.minimum)||i>Number(u.maximum))throw new s("Hookr revenue page limit must be an integer from 1 to 50.")}else if(typeof i!="string"||!new RegExp(String(u.pattern)).test(i))throw new s(`Provide a valid Hookr ${n}.`);m[n]=n==="token"||n==="address"?g(String(i)):i}return(t==="hookr_claims"||t==="hookr_revenue_token")&&(m.account=w),{...await f(d,t,m),chainId:p,source:"https://hookr.fun/api/mcp"}}})),y(d)]}var h={catalog:"/api/hooks/catalog",stats:"/api/protocol-stats",poolApr:"/api/pool-apr",revenueTokens:"/api/revenue-tokens",revenueIncome:"/api/revenue-tokens/income"};function y(d){return{name:"hookr_api_read",inputSchema:{type:"object",description:"Read Hookr public catalog, protocol stats, pool APR, revenue directory/income, or one token's doors/mark. Marks are project metadata, not investment or security endorsements.",properties:{resource:{type:"string",enum:[...Object.keys(h),"revenueDoors","revenueMark"],description:"Public feed to read: catalog, stats, poolApr, revenueTokens, revenueIncome; revenueDoors and revenueMark also need token (that token's doors, or its mark image URL)."},token:{...l,description:k.address("revenue token, only for revenueDoors and revenueMark")}},required:["resource"],additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(o=>!["resource","token"].includes(o))||typeof e.resource!="string")throw new s("Choose a documented Hookr public resource.");let t=["revenueDoors","revenueMark"].includes(e.resource);if(!t&&e.token!==void 0||t&&typeof e.token!="string")throw new s("Only the revenueDoors and revenueMark resources take a token address.");let c;if(t){let o;try{o=g(String(e.token))}catch{throw new s("Provide a valid revenue token address.")}c=`/api/revenue-tokens/${o}/${e.resource==="revenueDoors"?"doors":"mark"}`}else{if(!Object.hasOwn(h,e.resource))throw new s("Choose a documented Hookr public resource.");c=h[e.resource]}let a=`https://hookr.fun${c}`;try{let o=await d.http(a,{method:"GET",redirect:"error",signal:AbortSignal.timeout(15e3)});if(!o.ok)throw new Error("Unavailable");if(e.resource==="revenueMark"){if(!o.headers.get("content-type")?.includes("image/svg+xml"))throw new Error("Invalid mark");return{chainId:p,source:a,imageUrl:a,pngUrl:`${a}.png`,note:"Official SVG mark URL; SVG code is not executed or returned. The PNG URL has not been fetched."}}let r=await o.json();if(!r||typeof r!="object"||"error"in r||"status"in r&&r.status==="unavailable")throw new Error("Unavailable");return{chainId:p,source:a,data:r}}catch{throw new s("Hookr public resource is unavailable. Retry later; no empty or zero result is implied.")}}}}export{M as a,P as b,y as c};
1
+ import{a as f}from"./CD2JQ32C.js";import{a as k}from"./G2LAO23N.js";import{c as l}from"./NWNYJ26T.js";import{b as p}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{getAddress as g}from"viem";var v={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},b=[["hookr_release",{},[],"Read verified release contracts, block and recapture lane."],["hookr_blocks",{},[],"Read all Hook Blocks and their current availability."],["hookr_kings",{poolId:v},[],"Read King of the Pool rounds, leaders, pots and endings."],["hookr_claims",{poolId:v},[],"Read the signing wallet's prizes, royalties, recapture and PoolManager claims."],["hookr_revenue_tokens",{limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of revenue tokens to return, 1 to 50."},cursor:{type:"string",pattern:"^(v1|v1:[1-9][0-9]{0,19}|v2:[1-9][0-9]{0,19})$",description:"Paging cursor: the nextCursor string from the previous page (v1, v1:N or v2:N); omit for the first page."}},[],"Read revenue tokens, tokenizer provenance, streams and income, page by page."],["hookr_revenue_token",{token:{...l,description:k.address("revenue token")}},["token"],"Read a revenue token, stream endings, income, drops and the signing wallet's claims."],["hookr_hook",{address:{...l,description:k.address("Hookr hook contract")}},["address"],"Read shared or owned hook provenance, ownership, allowed blocks, opening and pools."]],M=[...b.map(d=>d[0]),"hookr_contracts","hookr_read","hookr_revenue_read","hookr_addon_read","hookr_api_read"];function P(d){return[...b.map(([t,c,a,o])=>({name:t,inputSchema:{type:"object",description:o,properties:c,required:a,additionalProperties:!1},execute:async(r,w)=>{if(Object.keys(r).some(n=>!Object.hasOwn(c,n))||a.some(n=>r[n]===void 0))throw new s(`Provide the documented arguments for ${t}.`);let m={};for(let[n,i]of Object.entries(r)){let u=c[n];if(u.type==="integer"){if(typeof i!="number"||!Number.isInteger(i)||i<Number(u.minimum)||i>Number(u.maximum))throw new s("Hookr revenue page limit must be an integer from 1 to 50.")}else if(typeof i!="string"||!new RegExp(String(u.pattern)).test(i))throw new s(`Provide a valid Hookr ${n}.`);m[n]=n==="token"||n==="address"?g(String(i)):i}return(t==="hookr_claims"||t==="hookr_revenue_token")&&(m.account=w),{...await f(d,t,m),chainId:p,source:"https://hookr.fun/api/mcp"}}})),y(d)]}var h={catalog:"/api/hooks/catalog",stats:"/api/protocol-stats",poolApr:"/api/pool-apr",revenueTokens:"/api/revenue-tokens",revenueIncome:"/api/revenue-tokens/income"};function y(d){return{name:"hookr_api_read",inputSchema:{type:"object",description:"Read Hookr public catalog, protocol stats, pool APR, revenue directory/income, or one token's doors/mark. Marks are project metadata, not investment or security endorsements.",properties:{resource:{type:"string",enum:[...Object.keys(h),"revenueDoors","revenueMark"],description:"Public feed to read: catalog, stats, poolApr, revenueTokens, revenueIncome; revenueDoors and revenueMark also need token (that token's doors, or its mark image URL)."},token:{...l,description:k.address("revenue token, only for revenueDoors and revenueMark")}},required:["resource"],additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(o=>!["resource","token"].includes(o))||typeof e.resource!="string")throw new s("Choose a documented Hookr public resource.");let t=["revenueDoors","revenueMark"].includes(e.resource);if(!t&&e.token!==void 0||t&&typeof e.token!="string")throw new s("Only the revenueDoors and revenueMark resources take a token address.");let c;if(t){let o;try{o=g(String(e.token))}catch{throw new s("Provide a valid revenue token address.")}c=`/api/revenue-tokens/${o}/${e.resource==="revenueDoors"?"doors":"mark"}`}else{if(!Object.hasOwn(h,e.resource))throw new s("Choose a documented Hookr public resource.");c=h[e.resource]}let a=`https://hookr.fun${c}`;try{let o=await d.http(a,{method:"GET",redirect:"error",signal:AbortSignal.timeout(15e3)});if(!o.ok)throw new Error("Unavailable");if(e.resource==="revenueMark"){if(!o.headers.get("content-type")?.includes("image/svg+xml"))throw new Error("Invalid mark");return{chainId:p,source:a,imageUrl:a,pngUrl:`${a}.png`,note:"Official SVG mark URL; SVG code is not executed or returned. The PNG URL has not been fetched."}}let r=await o.json();if(!r||typeof r!="object"||"error"in r||"status"in r&&r.status==="unavailable")throw new Error("Unavailable");return{chainId:p,source:a,data:r}}catch{throw new s("Hookr public resource is unavailable. Retry later; no empty or zero result is implied.")}}}}export{M as a,P as b,y as c};
@@ -1 +1 @@
1
- import{a as q}from"./LT5P6PZW.js";import{a as R,b as K}from"./G2LAO23N.js";import{a as W}from"./H5DY7CNB.js";import{c as U,f as z,g as T,i as L}from"./NWNYJ26T.js";import{a as k}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as J,erc20Abi as re,erc721Abi as V,getAddress as ie,parseAbi as ae,zeroAddress as B}from"viem";var A=q,G=ae(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),g=(t,e)=>t.name==="seed"?"marketSeed":t.name||`arg${e}`,X=t=>"components"in t?t.components:[],se=t=>{if(typeof t!="string"||!/^(0|[1-9][0-9]*)$/.test(t)||t.length>78||BigInt(t)>=1n<<256n)throw new d("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(t)},p=t=>z(t,"Provide the documented Hookr parameter object."),b=t=>L(t,"Provide a valid Hookr address."),Y=t=>t.stateMutability==="view"||t.stateMutability==="pure";function _(t){return t.abi}var ce=`Base units of the token it counts; read that token's decimals (18 decimals: "1000000000000000000" = 1 token).`,de={type:"string",pattern:"^(0|[1-9][0-9]*)$"};function ue(t,e,i){let o=`${t} ${e} ${i}.`,r=t.replace(/\[[0-9]*\]$/,"");return/^u?int/.test(r)?/divisor|numerator|denominator/i.test(e)?`${o} Plain integer ${/divisor/i.test(e)?"divisor":"ratio component"}; do not scale by token decimals.`:/liquidity/i.test(e)?`${o} Uniswap v4 liquidity units, not a token amount; do not scale by token decimals.`:/gas/i.test(e)?`${o} Integer gas units; do not scale by token decimals.`:/point/i.test(e)&&!/decimals/i.test(e)?`${o} Integer points; do not scale by token decimals.`:/pips$/i.test(e)?`${o} ${R.pips()}`:K(e,de)||e==="walletFeeCap"?`${o} ${ce}`:/bps$/i.test(e)?`${o} ${R.bps()}`:/(deadline|expir|timestamp|time|At)$/.test(e)?`${o} Unix seconds, as a decimal string.`:`${o} Decimal string${r.startsWith("uint")?"":", may be negative"}.`:r==="address"?`${o} 0x followed by 40 hex digits${/^(to|recipient|receiver|owner|spender|wallet|beneficiary)$/i.test(e)?"; use the intended address, never an example address":""}.`:r==="bool"?`${o} true or false.`:r.startsWith("bytes")?`${o} 0x-prefixed hex bytes.`:r==="tuple"?`${o} Object with the listed fields.`:`${o} Plain text.`}function Z(t,e,i,o){let r=ue(t.type,o,e),c=/^(.*)\[([0-9]*)\]$/.exec(t.type);return c?{type:"array",description:r,items:Z({...t,type:c[1]},e,i,o),minItems:c[2]?Number(c[2]):0,maxItems:c[2]?Number(c[2]):128}:t.type==="tuple"?{...E(X(t),i,o),description:r}:t.type==="bool"?{type:"boolean",description:r}:t.type==="address"?{...U,description:r}:/^u?int/.test(t.type)?{type:"string",pattern:t.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:r}:t.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770,description:r}:{type:"string",maxLength:4096,description:r}}function E(t,e,i){let o=i===void 0?`argument of ${e}`:`field of ${i} in ${e}`;return{type:"object",properties:Object.fromEntries(t.map((r,c)=>[g(r,c),Z(r,o,e,g(r,c))])),required:t.map(g),additionalProperties:!1}}function N(t,e){let i=/^(.*)\[([0-9]*)\]$/.exec(t.type);if(i){if(!Array.isArray(e)||e.length>128||i[2]&&e.length!==Number(i[2]))throw new d("Hookr parameter array has an invalid length.");return e.map(r=>N({...t,type:i[1]},r))}if(t.type==="tuple"){let r=p(e),c=X(t);return O(r,c.map(g)),Object.fromEntries(c.map((s,u)=>[s.name||`arg${u}`,N(s,r[g(s,u)])]))}if(t.type==="address")return b(e);if(t.type==="bool"){if(typeof e!="boolean")throw new d("Provide a Hookr boolean.");return e}let o=/^(u?)int([0-9]*)$/.exec(t.type);if(o){if(typeof e!="string"||!/^(0|-?[1-9][0-9]*)$/.test(e)||e.length>79)throw new d("Provide Hookr integers as decimal base-unit strings.");let r=BigInt(e),c=BigInt(o[2]||256),s=!o[1];if(r<(s?-(1n<<c-1n):0n)||r>=1n<<(s?c-1n:c))throw new d("Hookr integer exceeds its ABI range.");return c<=32n?Number(r):r}if(t.type.startsWith("bytes")){let r=Number(t.type.slice(5));if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(e)||e.length>32770||r&&e.length!==2+r*2)throw new d("Provide a valid Hookr hex byte string of the ABI length.");return e}if(t.type!=="string"||typeof e!="string"||new TextEncoder().encode(e).length>4096)throw new d("Provide a valid Hookr string.");return e}function O(t,e){if(Object.keys(t).some(i=>!e.includes(i))||e.some(i=>!Object.hasOwn(t,i)))throw new d("Provide exactly the documented Hookr parameters.")}function ye(t,e){O(e,t.inputs.map(g));let i=t.inputs.map((o,r)=>N(o,e[g(o,r)]));return{values:i,params:Object.fromEntries(t.inputs.map((o,r)=>[g(o,r),i[r]]))}}function ee(t,e){if(O(t,["contract","function","params"]),typeof t.contract!="string"||!Object.hasOwn(A,t.contract))throw new d("Choose a contract from hookr_contracts.");let i=A[t.contract];if(!e&&i.address.toLowerCase()===q.launcherV1.address.toLowerCase())throw new d("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let o=_(i).find(u=>u.name===t.function&&(e?Y(u):i.actions.includes(u.name)));if(!o)throw new d("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let r=p(t.params);O(r,o.inputs.map(g));let c=o.inputs.map((u,f)=>N(u,r[g(u,f)])),s=Object.fromEntries(o.inputs.map((u,f)=>[g(u,f),c[f]]));return{pin:i,fn:o,values:c,params:s,target:b(i.address)}}var te={type:"string",enum:Object.keys(A),description:'Pinned Hookr contract role, as listed by hookr_contracts (for example "launcherV1").'},Q={type:"object",properties:{contract:te,function:{type:"string",description:"Function name on that contract, exactly as hookr_contracts lists it."},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function ne(t){return JSON.parse(JSON.stringify(t,(e,i)=>typeof i=="bigint"?i.toString():i))}async function me(t,e,i){if(t.network==="testnet")throw new d("Hookr actions are configured only on mainnet, chain 4663.");let{pin:o,fn:r,values:c,params:s,target:u}=ee(e,!1),f=e.contract,l=r.name,H=t.clientFor(k),v=[],P=[],w=0n,C=new Map,h=(n,a)=>{let m=b(n),x=typeof a=="bigint"?a:se(a);if(x<0n||x>=(1n<<256n)-1n)throw new d("Hookr funding must be an exact bounded amount.");x&&(m===B?w+=x:C.set(m,(C.get(m)??0n)+x))},$=(n,a,m=[])=>H.readContract({address:b(A[n].address),abi:A[n].abi,functionName:a,args:m});if(f==="router"&&["swap","swapGated"].includes(l)){let n=p(s.params),a=p(n.key),m=n.amountSpecified;if(m===0n||n.amountBound===0n)throw new d("Hookr swaps require a nonzero amount and bound.");h(n.zeroForOne?a.currency0:a.currency1,m<0n?-m:n.amountBound)}else if(f==="vault"&&l==="deposit"){let n=p(s.params),a=p(n.key);if(h(a.currency0,n.amount0Desired),h(a.currency1,n.amount1Desired),n.amount0Min>n.amount0Desired||n.amount1Min>n.amount1Desired)throw new d("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&l==="transfer")P.push({token:u,id:s.id,amount:s.amount,to:b(s.receiver)});else if(f==="launcher"&&l.startsWith("launch")){let n=l==="launchFamily"?p(s.p):s,a=p(n.token),m=n.members;if(m.length<1||m.length>8)throw new d("Hookr launch needs one to eight members.");if(T(String(a.salt),String(await $("launcher","SKIP_TAKEN"))))throw new d("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=a.existing===B?b(await $("launcher","predictToken",[i,a])):b(a.existing),M=0n;for(let y of m){let I=BigInt(x)<BigInt(String(y.quote)),D=I?y.amount0Max:y.amount1Max;a.existing===B?M+=D:h(x,D),h(y.quote,I?y.amount1Max:y.amount0Max)}if(M>a.supply)throw new d("Hookr launch seeds more new tokens than its supply.");let oe=l==="launchFamily"?n.buys:l==="launchWithBuy"?[p(s.buy)]:[];for(let y of oe){let I=m[Number(y.member)];if(!I)throw new d("Hookr dev buy references an unavailable member.");h(I.quote,y.quoteIn)}let F=await H.readContract({address:u,abi:G,functionName:"launchFee"});if(!Array.isArray(F)||typeof F[0]!="bigint"||F[0]<0n)throw new d("Hookr launch fee is unavailable.");w+=F[0]}else if(f==="launcher"&&l==="addLiquidity"){let n=p(await $("launcher","position",[s.familyId,s.member])),a=p(n.key);h(a.currency0,s.max0),h(a.currency1,s.max1)}else if(f==="ownedFactory"&&l==="deploy"){let n=await $("ownedFactory","deployFee");if(typeof n!="bigint"||n<0n)throw new d("Hookr own-hook deployment fee is unavailable.");w=n}else if(f==="programs"&&l==="createProgram"){let n=p(s.t);if(h(n.rewardToken,n.cashBudget),w)throw new d("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&l==="createCampaign"){let n=p(s.t),a=n.end-n.start;if(a<=0n||a%86400n!==0n||a/86400n>366n)throw new d("Hookr referral campaigns must cover one to 366 whole days.");h(n.currency,n.dailyBudget*(a/86400n))}else if(f==="reserve"&&l==="fundReserve")h(s.token,s.amount);else if(f==="tokenizer"){let n=p(s.arg1);if(n.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(a=>n[a].length>0))throw new d("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let a of n.revenueTokens)h(a.token,a.amount);if(l==="tokenize"&&p(s.arg2).open){let a=await H.readContract({address:b(A.launcher.address),abi:G,functionName:"launchFee"});if(!Array.isArray(a)||typeof a[0]!="bigint"||a[0]<0n)throw new d("Hookr revenue market launch fee is unavailable.");w+=a[0]}}else if(f==="boost"&&["fund","notify"].includes(l)){let n=p(await $("boost","gauge",[s.id]));if(h(p(n.terms).rewardToken,s.amount),w)throw new d("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&l==="stake"){let n=b(await $("boost","positionManager"));if(n!==ie("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new d("Hookr boost position manager disagrees with the published deployment.");let a=await H.readContract({address:n,abi:V,functionName:"ownerOf",args:[s.tokenId]});if(!T(a,i))throw new d("The signing wallet must own the position NFT it stakes.");v.push(t.unsignedTx({to:n,data:J({abi:V,functionName:"approve",args:[u,s.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${s.tokenId} to ${u}.`})),P.push({token:n,id:s.tokenId,amount:1n,to:u})}let j=await H.getBlock();if(typeof j.timestamp!="bigint"||j.timestamp<=0n)throw new d("Hookr chain time is unavailable.");let S=n=>{if(Array.isArray(n)){n.forEach(S);return}if(!(!n||typeof n!="object"))for(let[a,m]of Object.entries(n)){if(a==="deadline"&&typeof m=="bigint"&&m<j.timestamp)throw new d("Hookr deadline expired. Refresh the action terms.");S(m)}};S(s);for(let[n,a]of C){if(a>=(1n<<256n)-1n)throw new d("Hookr aggregate funding exceeds its exact approval bound.");let m=await H.readContract({address:n,abi:re,functionName:"allowance",args:[i,u]});m>0n&&m!==a&&v.push(t.approval(n,u,"0",k)),v.push(t.approval(n,u,a.toString(),k)),P.push({token:n,amount:a})}return w&&P.push({token:W,amount:w,to:u}),v.push(t.unsignedTx({to:u,data:J({abi:[r],functionName:r.name,args:c}),value:w.toString(),chainId:k,description:`Hookr ${f}.${l}: ${JSON.stringify(ne(s))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:v,inputs:P}}function ke(t,e){if(t.length!==e.length||t.some((i,o)=>i.chainId!==e[o].chainId||!T(i.to,e[o].to)||i.value!==e[o].value||!T(i.data,e[o].data)))throw new d("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function xe(t){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{...te,description:"Only this pinned contract role; omit for every contract."},function:{type:"string",description:"Only this function name; omit for every function of the selected contracts."}},additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(o=>!["contract","function"].includes(o))||e.contract!==void 0&&(typeof e.contract!="string"||!Object.hasOwn(A,e.contract))||e.function!==void 0&&typeof e.function!="string")throw new d("Choose a documented Hookr contract and function filter.");let i=o=>e.function===void 0||o.name===e.function;return{chainId:k,contracts:Object.entries(A).filter(([o])=>e.contract===void 0||o===e.contract).map(([o,r])=>({role:o,address:b(r.address),source:r.source,match:r.match,reads:_(r).filter(c=>Y(c)&&i(c)).map(c=>({function:c.name,params:E(c.inputs,c.name)})),actions:r.actions.filter(c=>e.function===void 0||c===e.function).map(c=>({function:c,params:E(_(r).find(s=>s.name===c).inputs,c)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...Q,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async e=>{let{pin:i,fn:o,values:r,target:c}=ee(e,!0),s=await t.clientFor(k).readContract({address:c,abi:[o],functionName:o.name,args:r});return{chainId:k,contract:c,function:o.name,result:ne(s),source:i.source}}},{name:"hookr_action",inputSchema:{...Q,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(e,i)=>{let o=await me(t,e,i),r=await t.preview(o.txs,i);return{txs:o.txs,preview:r,summary:`Hookr ${e.contract}.${e.function}; review the preview and human confirmation.`}}}]}export{ue as a,E as b,ye as c,me as d,ke as e,xe as f};
1
+ import{a as q}from"./LT5P6PZW.js";import{a as R,b as K}from"./G2LAO23N.js";import{a as W}from"./Z7FGEWO2.js";import{c as U,f as z,g as T,i as L}from"./NWNYJ26T.js";import{b as k}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as J,erc20Abi as re,erc721Abi as V,getAddress as ie,parseAbi as ae,zeroAddress as B}from"viem";var A=q,G=ae(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),g=(t,e)=>t.name==="seed"?"marketSeed":t.name||`arg${e}`,X=t=>"components"in t?t.components:[],se=t=>{if(typeof t!="string"||!/^(0|[1-9][0-9]*)$/.test(t)||t.length>78||BigInt(t)>=1n<<256n)throw new d("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(t)},p=t=>z(t,"Provide the documented Hookr parameter object."),b=t=>L(t,"Provide a valid Hookr address."),Y=t=>t.stateMutability==="view"||t.stateMutability==="pure";function _(t){return t.abi}var ce=`Base units of the token it counts; read that token's decimals (18 decimals: "1000000000000000000" = 1 token).`,de={type:"string",pattern:"^(0|[1-9][0-9]*)$"};function ue(t,e,i){let o=`${t} ${e} ${i}.`,r=t.replace(/\[[0-9]*\]$/,"");return/^u?int/.test(r)?/divisor|numerator|denominator/i.test(e)?`${o} Plain integer ${/divisor/i.test(e)?"divisor":"ratio component"}; do not scale by token decimals.`:/liquidity/i.test(e)?`${o} Uniswap v4 liquidity units, not a token amount; do not scale by token decimals.`:/gas/i.test(e)?`${o} Integer gas units; do not scale by token decimals.`:/point/i.test(e)&&!/decimals/i.test(e)?`${o} Integer points; do not scale by token decimals.`:/pips$/i.test(e)?`${o} ${R.pips()}`:K(e,de)||e==="walletFeeCap"?`${o} ${ce}`:/bps$/i.test(e)?`${o} ${R.bps()}`:/(deadline|expir|timestamp|time|At)$/.test(e)?`${o} Unix seconds, as a decimal string.`:`${o} Decimal string${r.startsWith("uint")?"":", may be negative"}.`:r==="address"?`${o} 0x followed by 40 hex digits${/^(to|recipient|receiver|owner|spender|wallet|beneficiary)$/i.test(e)?"; use the intended address, never an example address":""}.`:r==="bool"?`${o} true or false.`:r.startsWith("bytes")?`${o} 0x-prefixed hex bytes.`:r==="tuple"?`${o} Object with the listed fields.`:`${o} Plain text.`}function Z(t,e,i,o){let r=ue(t.type,o,e),c=/^(.*)\[([0-9]*)\]$/.exec(t.type);return c?{type:"array",description:r,items:Z({...t,type:c[1]},e,i,o),minItems:c[2]?Number(c[2]):0,maxItems:c[2]?Number(c[2]):128}:t.type==="tuple"?{...E(X(t),i,o),description:r}:t.type==="bool"?{type:"boolean",description:r}:t.type==="address"?{...U,description:r}:/^u?int/.test(t.type)?{type:"string",pattern:t.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:r}:t.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770,description:r}:{type:"string",maxLength:4096,description:r}}function E(t,e,i){let o=i===void 0?`argument of ${e}`:`field of ${i} in ${e}`;return{type:"object",properties:Object.fromEntries(t.map((r,c)=>[g(r,c),Z(r,o,e,g(r,c))])),required:t.map(g),additionalProperties:!1}}function N(t,e){let i=/^(.*)\[([0-9]*)\]$/.exec(t.type);if(i){if(!Array.isArray(e)||e.length>128||i[2]&&e.length!==Number(i[2]))throw new d("Hookr parameter array has an invalid length.");return e.map(r=>N({...t,type:i[1]},r))}if(t.type==="tuple"){let r=p(e),c=X(t);return O(r,c.map(g)),Object.fromEntries(c.map((s,u)=>[s.name||`arg${u}`,N(s,r[g(s,u)])]))}if(t.type==="address")return b(e);if(t.type==="bool"){if(typeof e!="boolean")throw new d("Provide a Hookr boolean.");return e}let o=/^(u?)int([0-9]*)$/.exec(t.type);if(o){if(typeof e!="string"||!/^(0|-?[1-9][0-9]*)$/.test(e)||e.length>79)throw new d("Provide Hookr integers as decimal base-unit strings.");let r=BigInt(e),c=BigInt(o[2]||256),s=!o[1];if(r<(s?-(1n<<c-1n):0n)||r>=1n<<(s?c-1n:c))throw new d("Hookr integer exceeds its ABI range.");return c<=32n?Number(r):r}if(t.type.startsWith("bytes")){let r=Number(t.type.slice(5));if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(e)||e.length>32770||r&&e.length!==2+r*2)throw new d("Provide a valid Hookr hex byte string of the ABI length.");return e}if(t.type!=="string"||typeof e!="string"||new TextEncoder().encode(e).length>4096)throw new d("Provide a valid Hookr string.");return e}function O(t,e){if(Object.keys(t).some(i=>!e.includes(i))||e.some(i=>!Object.hasOwn(t,i)))throw new d("Provide exactly the documented Hookr parameters.")}function ye(t,e){O(e,t.inputs.map(g));let i=t.inputs.map((o,r)=>N(o,e[g(o,r)]));return{values:i,params:Object.fromEntries(t.inputs.map((o,r)=>[g(o,r),i[r]]))}}function ee(t,e){if(O(t,["contract","function","params"]),typeof t.contract!="string"||!Object.hasOwn(A,t.contract))throw new d("Choose a contract from hookr_contracts.");let i=A[t.contract];if(!e&&i.address.toLowerCase()===q.launcherV1.address.toLowerCase())throw new d("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let o=_(i).find(u=>u.name===t.function&&(e?Y(u):i.actions.includes(u.name)));if(!o)throw new d("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let r=p(t.params);O(r,o.inputs.map(g));let c=o.inputs.map((u,f)=>N(u,r[g(u,f)])),s=Object.fromEntries(o.inputs.map((u,f)=>[g(u,f),c[f]]));return{pin:i,fn:o,values:c,params:s,target:b(i.address)}}var te={type:"string",enum:Object.keys(A),description:'Pinned Hookr contract role, as listed by hookr_contracts (for example "launcherV1").'},Q={type:"object",properties:{contract:te,function:{type:"string",description:"Function name on that contract, exactly as hookr_contracts lists it."},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function ne(t){return JSON.parse(JSON.stringify(t,(e,i)=>typeof i=="bigint"?i.toString():i))}async function me(t,e,i){if(t.network==="testnet")throw new d("Hookr actions are configured only on mainnet, chain 4663.");let{pin:o,fn:r,values:c,params:s,target:u}=ee(e,!1),f=e.contract,l=r.name,H=t.clientFor(k),v=[],P=[],w=0n,C=new Map,h=(n,a)=>{let m=b(n),x=typeof a=="bigint"?a:se(a);if(x<0n||x>=(1n<<256n)-1n)throw new d("Hookr funding must be an exact bounded amount.");x&&(m===B?w+=x:C.set(m,(C.get(m)??0n)+x))},$=(n,a,m=[])=>H.readContract({address:b(A[n].address),abi:A[n].abi,functionName:a,args:m});if(f==="router"&&["swap","swapGated"].includes(l)){let n=p(s.params),a=p(n.key),m=n.amountSpecified;if(m===0n||n.amountBound===0n)throw new d("Hookr swaps require a nonzero amount and bound.");h(n.zeroForOne?a.currency0:a.currency1,m<0n?-m:n.amountBound)}else if(f==="vault"&&l==="deposit"){let n=p(s.params),a=p(n.key);if(h(a.currency0,n.amount0Desired),h(a.currency1,n.amount1Desired),n.amount0Min>n.amount0Desired||n.amount1Min>n.amount1Desired)throw new d("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&l==="transfer")P.push({token:u,id:s.id,amount:s.amount,to:b(s.receiver)});else if(f==="launcher"&&l.startsWith("launch")){let n=l==="launchFamily"?p(s.p):s,a=p(n.token),m=n.members;if(m.length<1||m.length>8)throw new d("Hookr launch needs one to eight members.");if(T(String(a.salt),String(await $("launcher","SKIP_TAKEN"))))throw new d("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=a.existing===B?b(await $("launcher","predictToken",[i,a])):b(a.existing),M=0n;for(let y of m){let I=BigInt(x)<BigInt(String(y.quote)),D=I?y.amount0Max:y.amount1Max;a.existing===B?M+=D:h(x,D),h(y.quote,I?y.amount1Max:y.amount0Max)}if(M>a.supply)throw new d("Hookr launch seeds more new tokens than its supply.");let oe=l==="launchFamily"?n.buys:l==="launchWithBuy"?[p(s.buy)]:[];for(let y of oe){let I=m[Number(y.member)];if(!I)throw new d("Hookr dev buy references an unavailable member.");h(I.quote,y.quoteIn)}let F=await H.readContract({address:u,abi:G,functionName:"launchFee"});if(!Array.isArray(F)||typeof F[0]!="bigint"||F[0]<0n)throw new d("Hookr launch fee is unavailable.");w+=F[0]}else if(f==="launcher"&&l==="addLiquidity"){let n=p(await $("launcher","position",[s.familyId,s.member])),a=p(n.key);h(a.currency0,s.max0),h(a.currency1,s.max1)}else if(f==="ownedFactory"&&l==="deploy"){let n=await $("ownedFactory","deployFee");if(typeof n!="bigint"||n<0n)throw new d("Hookr own-hook deployment fee is unavailable.");w=n}else if(f==="programs"&&l==="createProgram"){let n=p(s.t);if(h(n.rewardToken,n.cashBudget),w)throw new d("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&l==="createCampaign"){let n=p(s.t),a=n.end-n.start;if(a<=0n||a%86400n!==0n||a/86400n>366n)throw new d("Hookr referral campaigns must cover one to 366 whole days.");h(n.currency,n.dailyBudget*(a/86400n))}else if(f==="reserve"&&l==="fundReserve")h(s.token,s.amount);else if(f==="tokenizer"){let n=p(s.arg1);if(n.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(a=>n[a].length>0))throw new d("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let a of n.revenueTokens)h(a.token,a.amount);if(l==="tokenize"&&p(s.arg2).open){let a=await H.readContract({address:b(A.launcher.address),abi:G,functionName:"launchFee"});if(!Array.isArray(a)||typeof a[0]!="bigint"||a[0]<0n)throw new d("Hookr revenue market launch fee is unavailable.");w+=a[0]}}else if(f==="boost"&&["fund","notify"].includes(l)){let n=p(await $("boost","gauge",[s.id]));if(h(p(n.terms).rewardToken,s.amount),w)throw new d("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&l==="stake"){let n=b(await $("boost","positionManager"));if(n!==ie("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new d("Hookr boost position manager disagrees with the published deployment.");let a=await H.readContract({address:n,abi:V,functionName:"ownerOf",args:[s.tokenId]});if(!T(a,i))throw new d("The signing wallet must own the position NFT it stakes.");v.push(t.unsignedTx({to:n,data:J({abi:V,functionName:"approve",args:[u,s.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${s.tokenId} to ${u}.`})),P.push({token:n,id:s.tokenId,amount:1n,to:u})}let j=await H.getBlock();if(typeof j.timestamp!="bigint"||j.timestamp<=0n)throw new d("Hookr chain time is unavailable.");let S=n=>{if(Array.isArray(n)){n.forEach(S);return}if(!(!n||typeof n!="object"))for(let[a,m]of Object.entries(n)){if(a==="deadline"&&typeof m=="bigint"&&m<j.timestamp)throw new d("Hookr deadline expired. Refresh the action terms.");S(m)}};S(s);for(let[n,a]of C){if(a>=(1n<<256n)-1n)throw new d("Hookr aggregate funding exceeds its exact approval bound.");let m=await H.readContract({address:n,abi:re,functionName:"allowance",args:[i,u]});m>0n&&m!==a&&v.push(t.approval(n,u,"0",k)),v.push(t.approval(n,u,a.toString(),k)),P.push({token:n,amount:a})}return w&&P.push({token:W,amount:w,to:u}),v.push(t.unsignedTx({to:u,data:J({abi:[r],functionName:r.name,args:c}),value:w.toString(),chainId:k,description:`Hookr ${f}.${l}: ${JSON.stringify(ne(s))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:v,inputs:P}}function ke(t,e){if(t.length!==e.length||t.some((i,o)=>i.chainId!==e[o].chainId||!T(i.to,e[o].to)||i.value!==e[o].value||!T(i.data,e[o].data)))throw new d("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function xe(t){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{...te,description:"Only this pinned contract role; omit for every contract."},function:{type:"string",description:"Only this function name; omit for every function of the selected contracts."}},additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(o=>!["contract","function"].includes(o))||e.contract!==void 0&&(typeof e.contract!="string"||!Object.hasOwn(A,e.contract))||e.function!==void 0&&typeof e.function!="string")throw new d("Choose a documented Hookr contract and function filter.");let i=o=>e.function===void 0||o.name===e.function;return{chainId:k,contracts:Object.entries(A).filter(([o])=>e.contract===void 0||o===e.contract).map(([o,r])=>({role:o,address:b(r.address),source:r.source,match:r.match,reads:_(r).filter(c=>Y(c)&&i(c)).map(c=>({function:c.name,params:E(c.inputs,c.name)})),actions:r.actions.filter(c=>e.function===void 0||c===e.function).map(c=>({function:c,params:E(_(r).find(s=>s.name===c).inputs,c)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...Q,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async e=>{let{pin:i,fn:o,values:r,target:c}=ee(e,!0),s=await t.clientFor(k).readContract({address:c,abi:[o],functionName:o.name,args:r});return{chainId:k,contract:c,function:o.name,result:ne(s),source:i.source}}},{name:"hookr_action",inputSchema:{...Q,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(e,i)=>{let o=await me(t,e,i),r=await t.preview(o.txs,i);return{txs:o.txs,preview:r,summary:`Hookr ${e.contract}.${e.function}; review the preview and human confirmation.`}}}]}export{ue as a,E as b,ye as c,me as d,ke as e,xe as f};
@@ -1 +1 @@
1
- import{a as p,c as s}from"./WOGWLFAL.js";import{a}from"./SPJCSEKP.js";import{a as i}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";async function u(e,n,t){if(!Object.prototype.hasOwnProperty.call(p,e.name))throw new o("Local Chop guard cannot rebuild this action; nothing was signed.");if(e.chainId!==void 0&&e.chainId!==i)throw new o("Local Chop guard requires chain 4663; nothing was signed.");let r=async()=>{throw new o("Local Chop guard does not use HTTP, swaps or a preview service.")},d=a({clientFor:c=>{if(c!==i)throw new o("Local Chop guard requires chain 4663; nothing was signed.");return t.client},http:r,quoteSwap:r,buildSwap:r,preview:r});return(await s(d,e.name,e.args,n)).built}function g(e){return(n,t)=>u(n,t,e)}export{u as a,g as b};
1
+ import{a as p,c as s}from"./WOGWLFAL.js";import{a}from"./SPJCSEKP.js";import{b as i}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";async function u(e,n,t){if(!Object.prototype.hasOwnProperty.call(p,e.name))throw new o("Local Chop guard cannot rebuild this action; nothing was signed.");if(e.chainId!==void 0&&e.chainId!==i)throw new o("Local Chop guard requires chain 4663; nothing was signed.");let r=async()=>{throw new o("Local Chop guard does not use HTTP, swaps or a preview service.")},d=a({clientFor:c=>{if(c!==i)throw new o("Local Chop guard requires chain 4663; nothing was signed.");return t.client},http:r,quoteSwap:r,buildSwap:r,preview:r});return(await s(d,e.name,e.args,n)).built}function g(e){return(n,t)=>u(n,t,e)}export{u as a,g as b};
@@ -1 +1 @@
1
- import{a as e,d as t,i as r}from"./FWD4L3CJ.js";import{getAddress as s,parseAbi as a}from"viem";var n=r[e],u=s(n.layerbank.pool.address),o=s(n.layerbank.aToken.address),c={address:s(n.tokens.USDG.address),symbol:"USDG",decimals:t,chainId:e},l={address:o,symbol:"lRobUSDG",decimals:t,chainId:e},p=(1n<<256n)-1n,f=10n**27n,m=a(["function getReserveData(address asset) view returns (((uint256 data) configuration,uint128 liquidityIndex,uint128 currentLiquidityRate,uint128 variableBorrowIndex,uint128 currentVariableBorrowRate,uint128 currentStableBorrowRate,uint40 lastUpdateTimestamp,uint16 id,address aTokenAddress,address stableDebtTokenAddress,address variableDebtTokenAddress,address interestRateStrategyAddress,uint128 accruedToTreasury,uint128 unbacked,uint128 isolationModeTotalDebt) reserve)","function getConfiguration(address asset) view returns ((uint256 data) configuration)","function getReserveNormalizedIncome(address asset) view returns (uint256)","function supply(address asset,uint256 amount,address onBehalfOf,uint16 referralCode)","function withdraw(address asset,uint256 amount,address to) returns (uint256)"]),b=a(["function POOL() view returns (address)","function UNDERLYING_ASSET_ADDRESS() view returns (address)","function decimals() view returns (uint8)","function scaledTotalSupply() view returns (uint256)"]);export{u as a,o as b,c,l as d,p as e,f,m as g,b as h};
1
+ import{b as e,e as t,j as r}from"./TI727O2H.js";import{getAddress as s,parseAbi as a}from"viem";var n=r[e],u=s(n.layerbank.pool.address),o=s(n.layerbank.aToken.address),c={address:s(n.tokens.USDG.address),symbol:"USDG",decimals:t,chainId:e},l={address:o,symbol:"lRobUSDG",decimals:t,chainId:e},p=(1n<<256n)-1n,f=10n**27n,m=a(["function getReserveData(address asset) view returns (((uint256 data) configuration,uint128 liquidityIndex,uint128 currentLiquidityRate,uint128 variableBorrowIndex,uint128 currentVariableBorrowRate,uint128 currentStableBorrowRate,uint40 lastUpdateTimestamp,uint16 id,address aTokenAddress,address stableDebtTokenAddress,address variableDebtTokenAddress,address interestRateStrategyAddress,uint128 accruedToTreasury,uint128 unbacked,uint128 isolationModeTotalDebt) reserve)","function getConfiguration(address asset) view returns ((uint256 data) configuration)","function getReserveNormalizedIncome(address asset) view returns (uint256)","function supply(address asset,uint256 amount,address onBehalfOf,uint16 referralCode)","function withdraw(address asset,uint256 amount,address to) returns (uint256)"]),b=a(["function POOL() view returns (address)","function UNDERLYING_ASSET_ADDRESS() view returns (address)","function decimals() view returns (uint8)","function scaledTotalSupply() view returns (uint256)"]);export{u as a,o as b,c,l as d,p as e,f,m as g,b as h};