@oakagentkit/core 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (678) hide show
  1. package/build/dist/api/abort-scope.d.ts +2 -0
  2. package/build/dist/api/abort-scope.js +1 -0
  3. package/build/dist/api/chain.js +1 -1
  4. package/build/dist/api/history.js +1 -1
  5. package/build/dist/api/http.js +1 -1
  6. package/build/dist/api/metadata.js +1 -1
  7. package/build/dist/api/modules/beefy/boosts.js +1 -1
  8. package/build/dist/api/modules/beefy/clm.js +1 -1
  9. package/build/dist/api/modules/beefy/guard.js +1 -1
  10. package/build/dist/api/modules/beefy/index.js +1 -1
  11. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  12. package/build/dist/api/modules/beefy/management.js +1 -1
  13. package/build/dist/api/modules/beefy/vaults.js +1 -1
  14. package/build/dist/api/modules/borro/actions.js +1 -1
  15. package/build/dist/api/modules/borro/checks.js +1 -1
  16. package/build/dist/api/modules/borro/copy.d.ts +17 -12
  17. package/build/dist/api/modules/borro/copy.js +1 -1
  18. package/build/dist/api/modules/borro/index.js +1 -1
  19. package/build/dist/api/modules/borro/liquidity.js +1 -1
  20. package/build/dist/api/modules/borro/positions.js +1 -1
  21. package/build/dist/api/modules/borro/reader.d.ts +6 -2
  22. package/build/dist/api/modules/borro/reader.js +1 -1
  23. package/build/dist/api/modules/borro/types.d.ts +6 -0
  24. package/build/dist/api/modules/chop/abi.d.ts +558 -0
  25. package/build/dist/api/modules/chop/abi.js +1 -0
  26. package/build/dist/api/modules/chop/actions.d.ts +24 -0
  27. package/build/dist/api/modules/chop/actions.js +1 -0
  28. package/build/dist/api/modules/chop/checks.d.ts +34 -0
  29. package/build/dist/api/modules/chop/checks.js +1 -0
  30. package/build/dist/api/modules/chop/copy.d.ts +15 -0
  31. package/build/dist/api/modules/chop/copy.js +1 -0
  32. package/build/dist/api/modules/chop/guard.d.ts +13 -0
  33. package/build/dist/api/modules/chop/guard.js +1 -0
  34. package/build/dist/api/modules/chop/index.d.ts +3 -0
  35. package/build/dist/api/modules/chop/index.js +1 -0
  36. package/build/dist/api/modules/chop/pins.d.ts +53 -0
  37. package/build/dist/api/modules/chop/pins.js +1 -0
  38. package/build/dist/api/modules/chop/positions.d.ts +3 -0
  39. package/build/dist/api/modules/chop/positions.js +1 -0
  40. package/build/dist/api/modules/chop/reader.d.ts +195 -0
  41. package/build/dist/api/modules/chop/reader.js +1 -0
  42. package/build/dist/api/modules/chop/types.d.ts +44 -0
  43. package/build/dist/api/modules/chop/types.js +0 -0
  44. package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
  45. package/build/dist/api/modules/clanker/extensions.js +1 -1
  46. package/build/dist/api/modules/clanker/index.js +1 -1
  47. package/build/dist/api/modules/clanker/manage.js +1 -1
  48. package/build/dist/api/modules/clanker/pool-config.d.ts +15 -0
  49. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  50. package/build/dist/api/modules/clanker/protocol.js +1 -1
  51. package/build/dist/api/modules/earn/copy.d.ts +32 -10
  52. package/build/dist/api/modules/earn/copy.js +1 -1
  53. package/build/dist/api/modules/earn/cost.d.ts +11 -1
  54. package/build/dist/api/modules/earn/cost.js +1 -1
  55. package/build/dist/api/modules/earn/index.js +1 -1
  56. package/build/dist/api/modules/earn/lp.d.ts +14 -1
  57. package/build/dist/api/modules/earn/lp.js +1 -1
  58. package/build/dist/api/modules/earn/options.d.ts +6 -4
  59. package/build/dist/api/modules/earn/options.js +1 -1
  60. package/build/dist/api/modules/erc8004/common.d.ts +1 -1
  61. package/build/dist/api/modules/erc8004/common.js +1 -1
  62. package/build/dist/api/modules/erc8004/domain.js +1 -1
  63. package/build/dist/api/modules/erc8004/index.js +1 -1
  64. package/build/dist/api/modules/erc8004/management.js +1 -1
  65. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  66. package/build/dist/api/modules/erc8004/services.js +1 -1
  67. package/build/dist/api/modules/erc8004/validation.js +1 -1
  68. package/build/dist/api/modules/factor/abi.d.ts +642 -0
  69. package/build/dist/api/modules/factor/abi.js +1 -0
  70. package/build/dist/api/modules/factor/actions.d.ts +15 -0
  71. package/build/dist/api/modules/factor/actions.js +1 -0
  72. package/build/dist/api/modules/factor/api.d.ts +7 -0
  73. package/build/dist/api/modules/factor/api.js +1 -0
  74. package/build/dist/api/modules/factor/checks.d.ts +11 -0
  75. package/build/dist/api/modules/factor/checks.js +1 -0
  76. package/build/dist/api/modules/factor/copy.d.ts +33 -0
  77. package/build/dist/api/modules/factor/copy.js +1 -0
  78. package/build/dist/api/modules/factor/guard.d.ts +12 -0
  79. package/build/dist/api/modules/factor/guard.js +1 -0
  80. package/build/dist/api/modules/factor/index.d.ts +16 -0
  81. package/build/dist/api/modules/factor/index.js +8 -0
  82. package/build/dist/api/modules/factor/messages.d.ts +46 -0
  83. package/build/dist/api/modules/factor/messages.js +1 -0
  84. package/build/dist/api/modules/factor/pins.d.ts +64 -0
  85. package/build/dist/api/modules/factor/pins.js +1 -0
  86. package/build/dist/api/modules/factor/reader.d.ts +17 -0
  87. package/build/dist/api/modules/factor/reader.js +1 -0
  88. package/build/dist/api/modules/factor/types.d.ts +18 -0
  89. package/build/dist/api/modules/factor/types.js +0 -0
  90. package/build/dist/api/modules/gloam/abi.d.ts +89 -0
  91. package/build/dist/api/modules/gloam/abi.js +1 -0
  92. package/build/dist/api/modules/gloam/actions.d.ts +5 -0
  93. package/build/dist/api/modules/gloam/actions.js +1 -0
  94. package/build/dist/api/modules/gloam/checks.d.ts +17 -0
  95. package/build/dist/api/modules/gloam/checks.js +1 -0
  96. package/build/dist/api/modules/gloam/copy.d.ts +23 -0
  97. package/build/dist/api/modules/gloam/copy.js +2 -0
  98. package/build/dist/api/modules/gloam/index.d.ts +6 -0
  99. package/build/dist/api/modules/gloam/index.js +1 -0
  100. package/build/dist/api/modules/gloam/pins.d.ts +41 -0
  101. package/build/dist/api/modules/gloam/pins.js +1 -0
  102. package/build/dist/api/modules/gloam/types.d.ts +308 -0
  103. package/build/dist/api/modules/gloam/types.js +1 -0
  104. package/build/dist/api/modules/grove/index.js +1 -1
  105. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  106. package/build/dist/api/modules/heyresearch/index.js +1 -1
  107. package/build/dist/api/modules/heyresearch/public-reads.d.ts +29 -1
  108. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  109. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  110. package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
  111. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  112. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  113. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  114. package/build/dist/api/modules/hoodag/index.js +1 -1
  115. package/build/dist/api/modules/hoodag/management.js +1 -1
  116. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  117. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  118. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  119. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  120. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  121. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  122. package/build/dist/api/modules/hoodlock/index.js +1 -1
  123. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  124. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  125. package/build/dist/api/modules/hoodlock/public.js +1 -1
  126. package/build/dist/api/modules/hookr/actions.js +1 -1
  127. package/build/dist/api/modules/hookr/addons.js +1 -1
  128. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  129. package/build/dist/api/modules/hookr/contracts.d.ts +2 -1
  130. package/build/dist/api/modules/hookr/contracts.js +1 -1
  131. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  132. package/build/dist/api/modules/hookr/discovery.js +1 -1
  133. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  134. package/build/dist/api/modules/hookr/index.js +1 -1
  135. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  136. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  137. package/build/dist/api/modules/hookr/launch.js +1 -1
  138. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  139. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  140. package/build/dist/api/modules/hookr/lp-reads.d.ts +2 -0
  141. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  142. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  143. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  144. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  145. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  146. package/build/dist/api/modules/hookr/relay.js +1 -1
  147. package/build/dist/api/modules/hookr/revenue.js +1 -1
  148. package/build/dist/api/modules/kyberswap/index.js +1 -1
  149. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  150. package/build/dist/api/modules/layerbank/actions.js +1 -1
  151. package/build/dist/api/modules/layerbank/index.js +1 -1
  152. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  153. package/build/dist/api/modules/layerbank/reader.js +1 -1
  154. package/build/dist/api/modules/lighter/index.js +1 -1
  155. package/build/dist/api/modules/longbow/administration.js +1 -1
  156. package/build/dist/api/modules/longbow/fixed.js +1 -1
  157. package/build/dist/api/modules/longbow/index.js +1 -1
  158. package/build/dist/api/modules/longbow/nft.js +1 -1
  159. package/build/dist/api/modules/longbow/rebates.js +1 -1
  160. package/build/dist/api/modules/longbow/staking.js +1 -1
  161. package/build/dist/api/modules/meridian/index.js +1 -1
  162. package/build/dist/api/modules/meridian/markets.js +1 -1
  163. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  164. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  165. package/build/dist/api/modules/meridian/perps.js +1 -1
  166. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  167. package/build/dist/api/modules/meridian/rfq.js +1 -1
  168. package/build/dist/api/modules/merkl/discovery.js +1 -1
  169. package/build/dist/api/modules/merkl/index.js +1 -1
  170. package/build/dist/api/modules/merkl/manage.js +1 -1
  171. package/build/dist/api/modules/merkl/protocol.js +1 -1
  172. package/build/dist/api/modules/morpho/allocator.js +1 -1
  173. package/build/dist/api/modules/morpho/bundles.js +1 -1
  174. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  175. package/build/dist/api/modules/morpho/index.js +1 -1
  176. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  177. package/build/dist/api/modules/morpho/midnight.js +1 -1
  178. package/build/dist/api/modules/morpho/protocol.js +1 -1
  179. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  180. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  181. package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
  182. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  183. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  184. package/build/dist/api/modules/netnet/card-read.js +1 -1
  185. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  186. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  187. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  188. package/build/dist/api/modules/netnet/financial.js +1 -1
  189. package/build/dist/api/modules/netnet/index.js +1 -1
  190. package/build/dist/api/modules/netnet/staking.js +1 -1
  191. package/build/dist/api/modules/orbio/gateway.js +1 -1
  192. package/build/dist/api/modules/orbio/index.js +1 -1
  193. package/build/dist/api/modules/pendle/convert.js +1 -1
  194. package/build/dist/api/modules/pendle/costs.js +1 -1
  195. package/build/dist/api/modules/pendle/index.js +1 -1
  196. package/build/dist/api/modules/pendle/markets.js +1 -1
  197. package/build/dist/api/modules/pendle/positions.js +1 -1
  198. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  199. package/build/dist/api/modules/pendle/reader.js +1 -1
  200. package/build/dist/api/modules/pendle/redeem.js +1 -1
  201. package/build/dist/api/modules/pendle/trade.js +1 -1
  202. package/build/dist/api/modules/pendle/validate.js +1 -1
  203. package/build/dist/api/modules/pons/claim.js +1 -1
  204. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  205. package/build/dist/api/modules/pons/index.js +1 -1
  206. package/build/dist/api/modules/pons/launch-status.d.ts +1 -0
  207. package/build/dist/api/modules/pons/launch-status.js +1 -1
  208. package/build/dist/api/modules/pons/reads.js +1 -1
  209. package/build/dist/api/modules/pons/trade.d.ts +3 -2
  210. package/build/dist/api/modules/pons/trade.js +1 -1
  211. package/build/dist/api/modules/poolstrade/index.js +1 -1
  212. package/build/dist/api/modules/priors/coverage.js +1 -1
  213. package/build/dist/api/modules/priors/discovery.js +1 -1
  214. package/build/dist/api/modules/priors/features.js +1 -1
  215. package/build/dist/api/modules/priors/holdings.js +1 -1
  216. package/build/dist/api/modules/priors/index.js +1 -1
  217. package/build/dist/api/modules/priors/integration.d.ts +1 -0
  218. package/build/dist/api/modules/priors/integration.js +1 -1
  219. package/build/dist/api/modules/priors/market.js +1 -1
  220. package/build/dist/api/modules/priors/pt.js +1 -1
  221. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  222. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  223. package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
  224. package/build/dist/api/modules/raeto/authorization.js +1 -0
  225. package/build/dist/api/modules/raeto/copy.d.ts +46 -0
  226. package/build/dist/api/modules/raeto/copy.js +1 -0
  227. package/build/dist/api/modules/raeto/errors.d.ts +4 -0
  228. package/build/dist/api/modules/raeto/errors.js +1 -0
  229. package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
  230. package/build/dist/api/modules/raeto/estimate.js +1 -0
  231. package/build/dist/api/modules/raeto/index.d.ts +16 -0
  232. package/build/dist/api/modules/raeto/index.js +1 -0
  233. package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
  234. package/build/dist/api/modules/raeto/pairing.js +1 -0
  235. package/build/dist/api/modules/raeto/pins.d.ts +24 -0
  236. package/build/dist/api/modules/raeto/pins.js +1 -0
  237. package/build/dist/api/modules/raeto/templates.d.ts +22 -0
  238. package/build/dist/api/modules/raeto/templates.js +1 -0
  239. package/build/dist/api/modules/raeto/terms.d.ts +8 -0
  240. package/build/dist/api/modules/raeto/terms.js +1 -0
  241. package/build/dist/api/modules/raeto/types.d.ts +64 -0
  242. package/build/dist/api/modules/raeto/types.js +0 -0
  243. package/build/dist/api/modules/relay/api.d.ts +16 -0
  244. package/build/dist/api/modules/relay/api.js +1 -1
  245. package/build/dist/api/modules/relay/discovery.js +1 -1
  246. package/build/dist/api/modules/relay/inbound.js +1 -1
  247. package/build/dist/api/modules/relay/index.d.ts +1 -0
  248. package/build/dist/api/modules/relay/index.js +1 -1
  249. package/build/dist/api/modules/relay/order.js +1 -1
  250. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  251. package/build/dist/api/modules/relay/readiness.d.ts +1 -0
  252. package/build/dist/api/modules/relay/readiness.js +1 -1
  253. package/build/dist/api/modules/relay/reads.js +1 -1
  254. package/build/dist/api/modules/relay/vaults.js +1 -1
  255. package/build/dist/api/modules/spark/actions.js +1 -1
  256. package/build/dist/api/modules/spark/index.js +1 -1
  257. package/build/dist/api/modules/spark/management.js +1 -1
  258. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  259. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  260. package/build/dist/api/modules/steakhouse/index.js +1 -1
  261. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  262. package/build/dist/api/modules/steakhouse/management.js +1 -1
  263. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  264. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  265. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  266. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  267. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  268. package/build/dist/api/modules/tickerspring/index.js +1 -1
  269. package/build/dist/api/modules/tickerspring/journeys.d.ts +1 -0
  270. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  271. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  272. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  273. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  274. package/build/dist/api/modules/tickerspring/research.js +1 -1
  275. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  276. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  277. package/build/dist/api/modules/uniswap/auction.js +1 -1
  278. package/build/dist/api/modules/uniswap/batch.js +1 -1
  279. package/build/dist/api/modules/uniswap/common.js +1 -1
  280. package/build/dist/api/modules/uniswap/fee-percent.d.ts +4 -0
  281. package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
  282. package/build/dist/api/modules/uniswap/fees.js +1 -1
  283. package/build/dist/api/modules/uniswap/index.js +1 -1
  284. package/build/dist/api/modules/uniswap/local-guard.d.ts +2 -0
  285. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  286. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  287. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  288. package/build/dist/api/modules/uniswap/pools.d.ts +2 -0
  289. package/build/dist/api/modules/uniswap/pools.js +1 -1
  290. package/build/dist/api/modules/uniswap/position.js +1 -1
  291. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  292. package/build/dist/api/modules/uniswap/quote-guard.d.ts +38 -0
  293. package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
  294. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  295. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  296. package/build/dist/api/modules/uniswap/trade.d.ts +10 -3
  297. package/build/dist/api/modules/uniswap/trade.js +1 -1
  298. package/build/dist/api/modules/uniswap/v2.js +1 -1
  299. package/build/dist/api/modules/uniswap/v3.js +1 -1
  300. package/build/dist/api/modules/uniswap/v4.d.ts +6 -0
  301. package/build/dist/api/modules/uniswap/v4.js +1 -1
  302. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  303. package/build/dist/api/modules/velora/claims.js +1 -1
  304. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  305. package/build/dist/api/modules/velora/index.js +1 -1
  306. package/build/dist/api/modules/wormhole/index.d.ts +3 -0
  307. package/build/dist/api/modules/wormhole/index.js +1 -1
  308. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  309. package/build/dist/api/modules/wormhole/swap-token-verdict.d.ts +11 -0
  310. package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -0
  311. package/build/dist/api/modules/wormhole/third-party-text.d.ts +24 -0
  312. package/build/dist/api/modules/wormhole/third-party-text.js +1 -0
  313. package/build/dist/api/modules/wormhole/token-check.d.ts +2 -0
  314. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  315. package/build/dist/api/modules/wormhole/x402-client.d.ts +36 -0
  316. package/build/dist/api/modules/wormhole/x402-client.js +1 -0
  317. package/build/dist/api/oak-fee.d.ts +12 -0
  318. package/build/dist/api/oak-fee.js +1 -0
  319. package/build/dist/api/param-text.d.ts +22 -0
  320. package/build/dist/api/param-text.js +1 -0
  321. package/build/dist/api/position-economics.d.ts +70 -0
  322. package/build/dist/api/position-economics.js +1 -0
  323. package/build/dist/api/positions.d.ts +8 -5
  324. package/build/dist/api/positions.js +1 -1
  325. package/build/dist/api/prices.d.ts +3 -0
  326. package/build/dist/api/prices.js +1 -1
  327. package/build/dist/api/progress.d.ts +7 -0
  328. package/build/dist/api/progress.js +1 -0
  329. package/build/dist/api/read-budgets.d.ts +4 -0
  330. package/build/dist/api/read-budgets.js +1 -0
  331. package/build/dist/api/read-shape.d.ts +45 -0
  332. package/build/dist/api/read-shape.js +1 -0
  333. package/build/dist/api/revert.d.ts +23 -0
  334. package/build/dist/api/revert.js +1 -0
  335. package/build/dist/api/routes.js +1 -1
  336. package/build/dist/api/rpc.d.ts +1 -0
  337. package/build/dist/api/rpc.js +1 -1
  338. package/build/dist/api/secret-fields.js +1 -1
  339. package/build/dist/api/send.js +1 -1
  340. package/build/dist/api/signing-registry.d.ts +8 -0
  341. package/build/dist/api/signing-registry.js +1 -1
  342. package/build/dist/api/simulate.js +1 -1
  343. package/build/dist/api/swap.d.ts +4 -0
  344. package/build/dist/api/swap.js +1 -1
  345. package/build/dist/api/tokens.d.ts +1 -0
  346. package/build/dist/api/tokens.js +1 -1
  347. package/build/dist/api/tool-policy.js +1 -1
  348. package/build/dist/api/types.d.ts +9 -1
  349. package/build/dist/api/untrusted-unwrap.d.ts +1 -0
  350. package/build/dist/api/untrusted-unwrap.js +1 -0
  351. package/build/dist/api/usd-estimate.d.ts +23 -0
  352. package/build/dist/api/usd-estimate.js +1 -0
  353. package/build/dist/api/vendor-limits.js +1 -1
  354. package/build/dist/chunks/{JVLLVNF2.js → 2E4I7CJ7.js} +1 -1
  355. package/build/dist/chunks/2FHELZ7Y.js +1 -0
  356. package/build/dist/chunks/2GXHYI23.js +1 -0
  357. package/build/dist/chunks/2LWBN35N.js +1 -0
  358. package/build/dist/chunks/{4HG6FRVH.js → 2OKYXT25.js} +1 -1
  359. package/build/dist/chunks/2SUHQWND.js +1 -0
  360. package/build/dist/chunks/2ZWKIBJT.js +1 -0
  361. package/build/dist/chunks/32RXFUOH.js +1 -0
  362. package/build/dist/chunks/3CH2IPQL.js +1 -0
  363. package/build/dist/chunks/3DNJTJ2X.js +1 -0
  364. package/build/dist/chunks/3K2N5VFH.js +1 -0
  365. package/build/dist/chunks/3VBIRLU3.js +1 -0
  366. package/build/dist/chunks/3VWVW7PX.js +1 -0
  367. package/build/dist/chunks/3ZABD6ZF.js +2 -0
  368. package/build/dist/chunks/44MB6SA6.js +1 -0
  369. package/build/dist/chunks/4D4ZRZUW.js +1 -0
  370. package/build/dist/chunks/{KIFSRO5K.js → 4FPV4CRC.js} +1 -1
  371. package/build/dist/chunks/4GNUXN4K.js +1 -0
  372. package/build/dist/chunks/{K4DHHQBI.js → 4JRXEN7C.js} +2 -2
  373. package/build/dist/chunks/4JTTA3BX.js +1 -0
  374. package/build/dist/chunks/4OVIMYNH.js +2 -0
  375. package/build/dist/chunks/{326QMOTR.js → 4Q2ZBZXM.js} +1 -1
  376. package/build/dist/chunks/4RQAOOO2.js +1 -0
  377. package/build/dist/chunks/4TTDAF4B.js +1 -0
  378. package/build/dist/chunks/523ZIR3J.js +1 -0
  379. package/build/dist/chunks/5DPJQCKJ.js +68 -0
  380. package/build/dist/chunks/5HIHUYA4.js +1 -0
  381. package/build/dist/chunks/5PI57UC2.js +1 -0
  382. package/build/dist/chunks/5RXALTDT.js +1 -0
  383. package/build/dist/chunks/5TUXSOMI.js +1 -0
  384. package/build/dist/chunks/5UAXLWJ2.js +1 -0
  385. package/build/dist/chunks/5XAXJEWM.js +5 -0
  386. package/build/dist/chunks/67BWOVET.js +1 -0
  387. package/build/dist/chunks/6NUNCD5J.js +1 -0
  388. package/build/dist/chunks/6PZGDVHV.js +1 -0
  389. package/build/dist/chunks/{OKUO3BVM.js → 6UVGQYZ3.js} +1 -1
  390. package/build/dist/chunks/753HZZTY.js +1 -0
  391. package/build/dist/chunks/77CLMPM7.js +1 -0
  392. package/build/dist/chunks/7D73A6KS.js +1 -0
  393. package/build/dist/chunks/7MBVTNLU.js +1 -0
  394. package/build/dist/chunks/7QKYDNF6.js +18 -0
  395. package/build/dist/chunks/7VC53B5X.js +70 -0
  396. package/build/dist/chunks/{QSHCBASA.js → 7VNO46LV.js} +1 -1
  397. package/build/dist/chunks/ACH4BSME.js +3 -0
  398. package/build/dist/chunks/AHUCYDBC.js +1 -0
  399. package/build/dist/chunks/AI3VAPA3.js +1 -0
  400. package/build/dist/chunks/AMTRDPVO.js +1 -0
  401. package/build/dist/chunks/APHNOGNS.js +1 -0
  402. package/build/dist/chunks/APQYLJGS.js +1 -0
  403. package/build/dist/chunks/{WDK6VOG4.js → ARI72OYT.js} +1 -1
  404. package/build/dist/chunks/ARLGF5MU.js +1 -0
  405. package/build/dist/chunks/BAIY32AV.js +1 -0
  406. package/build/dist/chunks/BB765L75.js +3 -0
  407. package/build/dist/chunks/BE3A7677.js +1 -0
  408. package/build/dist/chunks/BX46C5ZP.js +1 -0
  409. package/build/dist/chunks/{IY7BXLT4.js → BZ34ZR65.js} +1 -1
  410. package/build/dist/chunks/C3WBHFLX.js +1 -0
  411. package/build/dist/chunks/C75MT5SD.js +1 -0
  412. package/build/dist/chunks/CAWTAR5V.js +1 -0
  413. package/build/dist/chunks/CNLL4NCR.js +1 -0
  414. package/build/dist/chunks/CO4GCF4L.js +1 -0
  415. package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
  416. package/build/dist/chunks/{SJJR4ZBZ.js → CSDN4MYP.js} +1 -1
  417. package/build/dist/chunks/CSOO4SW7.js +1 -0
  418. package/build/dist/chunks/CZL6T2ZQ.js +1 -0
  419. package/build/dist/chunks/D742AYEV.js +1 -0
  420. package/build/dist/chunks/DGCJZ3HO.js +1 -0
  421. package/build/dist/chunks/DNNFKDZR.js +1 -0
  422. package/build/dist/chunks/DPE7SPW7.js +1 -0
  423. package/build/dist/chunks/DSTMEY5F.js +1 -0
  424. package/build/dist/chunks/{X3BYCOWS.js → DYYEA5HB.js} +1 -1
  425. package/build/dist/chunks/EFESPGA2.js +1 -0
  426. package/build/dist/chunks/EGZREEG2.js +1 -0
  427. package/build/dist/chunks/EH5G4O3U.js +1 -0
  428. package/build/dist/chunks/EI6GGPDS.js +20 -0
  429. package/build/dist/chunks/EVBHQQQG.js +1 -0
  430. package/build/dist/chunks/EZZM2GQT.js +2 -0
  431. package/build/dist/chunks/F3VDVTMS.js +1 -0
  432. package/build/dist/chunks/F4UQEPJT.js +1 -0
  433. package/build/dist/chunks/FHTNMGFR.js +1 -0
  434. package/build/dist/chunks/FIO6VC2J.js +1 -0
  435. package/build/dist/chunks/FJLJ7ZQ5.js +1 -0
  436. package/build/dist/chunks/{WP6RHXGN.js → FL5SSHUL.js} +1 -1
  437. package/build/dist/chunks/FNGIJKMZ.js +1 -0
  438. package/build/dist/chunks/{KIFZ5ZSK.js → FOD34G2H.js} +1 -1
  439. package/build/dist/chunks/{WV3A3OUU.js → FOKEFXGP.js} +1 -1
  440. package/build/dist/chunks/FV4WZOTD.js +1 -0
  441. package/build/dist/chunks/FWIFTPSE.js +2 -0
  442. package/build/dist/chunks/FZ6IJZZM.js +1 -0
  443. package/build/dist/chunks/G2LAO23N.js +1 -0
  444. package/build/dist/chunks/GDRQ2ANN.js +1 -0
  445. package/build/dist/chunks/GG24LO2R.js +1 -0
  446. package/build/dist/chunks/GLF7WEY2.js +1 -0
  447. package/build/dist/chunks/GQ3XZFRL.js +1 -0
  448. package/build/dist/chunks/{QU5XKRGK.js → GQYV4TFO.js} +1 -1
  449. package/build/dist/chunks/GRSXWQWD.js +1 -0
  450. package/build/dist/chunks/{3GOHSYHW.js → GSFHM5L3.js} +1 -1
  451. package/build/dist/chunks/H5DY7CNB.js +1 -0
  452. package/build/dist/chunks/HCBX4NFM.js +1 -0
  453. package/build/dist/chunks/HHO5ISMM.js +1 -0
  454. package/build/dist/chunks/HIX5N25Z.js +1 -0
  455. package/build/dist/chunks/HKVQ646Q.js +1 -0
  456. package/build/dist/chunks/HS4DZPYT.js +1 -0
  457. package/build/dist/chunks/I6PQW2JI.js +1 -0
  458. package/build/dist/chunks/IEG6GLFR.js +1 -0
  459. package/build/dist/chunks/INOYMBWE.js +1 -0
  460. package/build/dist/chunks/IV4K7FMD.js +1 -0
  461. package/build/dist/chunks/{T2WHOZXM.js → J73ATSEQ.js} +1 -1
  462. package/build/dist/chunks/JBTOZ6IH.js +1 -0
  463. package/build/dist/chunks/JESMX2UC.js +1 -0
  464. package/build/dist/chunks/JJGZ7W3V.js +1 -0
  465. package/build/dist/chunks/JKRBGAX2.js +1 -0
  466. package/build/dist/chunks/JLRHM2DQ.js +1 -0
  467. package/build/dist/chunks/JOKL5L6X.js +1 -0
  468. package/build/dist/chunks/JS53DQVT.js +1 -0
  469. package/build/dist/chunks/{WIRBCS4W.js → JWR5XVP2.js} +1 -1
  470. package/build/dist/chunks/K6D6SDIG.js +1 -0
  471. package/build/dist/chunks/K7HTDKAT.js +1 -0
  472. package/build/dist/chunks/{GQ5GYUEH.js → KDGSYNOP.js} +1 -1
  473. package/build/dist/chunks/KKPMOAVI.js +1 -0
  474. package/build/dist/chunks/KREBNL2D.js +1 -0
  475. package/build/dist/chunks/L646YWDP.js +1 -0
  476. package/build/dist/chunks/{2MAMJJJC.js → LR4XTZ37.js} +1 -1
  477. package/build/dist/chunks/LVFI74ST.js +1 -0
  478. package/build/dist/chunks/{Z4FZVJ5Z.js → M7ZXDLKM.js} +1 -1
  479. package/build/dist/chunks/MVD3KWPP.js +1 -0
  480. package/build/dist/chunks/N245WC5R.js +1 -0
  481. package/build/dist/chunks/{WTXC3XKW.js → N4XNNXOJ.js} +1 -1
  482. package/build/dist/chunks/N6GIC7HJ.js +1 -0
  483. package/build/dist/chunks/{RUC7KH7A.js → NA424YAL.js} +1 -1
  484. package/build/dist/chunks/NUFZUKYS.js +1 -0
  485. package/build/dist/chunks/O3JWCJIF.js +1 -0
  486. package/build/dist/chunks/OARVU3RC.js +1 -0
  487. package/build/dist/chunks/OEZ7FCLF.js +1 -0
  488. package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
  489. package/build/dist/chunks/{3FUVMSCF.js → OYJFXEDU.js} +1 -1
  490. package/build/dist/chunks/OYPAVXGQ.js +1 -0
  491. package/build/dist/chunks/{SMYWWIE6.js → OZ5MDUD2.js} +1 -1
  492. package/build/dist/chunks/P6OMKZMR.js +3 -0
  493. package/build/dist/chunks/PV4AK32X.js +1 -0
  494. package/build/dist/chunks/{HKEMQBFA.js → PXVREXCS.js} +1 -1
  495. package/build/dist/chunks/PZEF5LBL.js +2 -0
  496. package/build/dist/chunks/Q2ACLVWR.js +1 -0
  497. package/build/dist/chunks/QFSBDPLN.js +1 -0
  498. package/build/dist/chunks/QJNLLI6N.js +1 -0
  499. package/build/dist/chunks/QMZEGT5B.js +1 -0
  500. package/build/dist/chunks/{HSCQZ66A.js → REWXG6X6.js} +1 -1
  501. package/build/dist/chunks/{6B3VVISQ.js → RLI4JDOL.js} +1 -1
  502. package/build/dist/chunks/{4MXM6Q4W.js → RLMVA575.js} +1 -1
  503. package/build/dist/chunks/RPB46QAC.js +1 -0
  504. package/build/dist/chunks/{Q42YI3EP.js → RT7IU6TI.js} +1 -1
  505. package/build/dist/chunks/{ER47KGRM.js → SBY4RJ7I.js} +1 -1
  506. package/build/dist/chunks/SCG5HWMN.js +1 -0
  507. package/build/dist/chunks/SENOU5JR.js +1 -0
  508. package/build/dist/chunks/SKEKXEUU.js +1 -0
  509. package/build/dist/chunks/SOTYQGPT.js +1 -0
  510. package/build/dist/chunks/SZ466I5X.js +1 -0
  511. package/build/dist/chunks/{GNC6RXLT.js → TDZTC5WR.js} +1 -1
  512. package/build/dist/chunks/TE6D3OIX.js +1 -0
  513. package/build/dist/chunks/TID4C2KC.js +1 -0
  514. package/build/dist/chunks/TK55VASJ.js +2 -0
  515. package/build/dist/chunks/TM7Z5SA4.js +1 -0
  516. package/build/dist/chunks/TNJTET4G.js +1 -0
  517. package/build/dist/chunks/TPEKCXVE.js +1 -0
  518. package/build/dist/chunks/TVIMP5CK.js +1 -0
  519. package/build/dist/chunks/U2YCQWZK.js +1 -0
  520. package/build/dist/chunks/U363GQTF.js +1 -0
  521. package/build/dist/chunks/{U4JGEMKT.js → UEDGYZOC.js} +1 -1
  522. package/build/dist/chunks/UOCRYXAB.js +1 -0
  523. package/build/dist/chunks/UQEEF5W5.js +1 -0
  524. package/build/dist/chunks/{QQECG3WP.js → UUID2E22.js} +1 -1
  525. package/build/dist/chunks/UWBKAWX3.js +7 -0
  526. package/build/dist/chunks/V37L4DU4.js +1 -0
  527. package/build/dist/chunks/VR344DAZ.js +1 -0
  528. package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
  529. package/build/dist/chunks/VTPT5544.js +1 -0
  530. package/build/dist/chunks/VVWFB53Q.js +1 -0
  531. package/build/dist/chunks/WHTRPRRD.js +1 -0
  532. package/build/dist/chunks/WHVZ372B.js +1 -0
  533. package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
  534. package/build/dist/chunks/WOGWLFAL.js +3 -0
  535. package/build/dist/chunks/WUT7TZYM.js +1 -0
  536. package/build/dist/chunks/XCKTE4ON.js +1 -0
  537. package/build/dist/chunks/XEPCDGN2.js +1 -0
  538. package/build/dist/chunks/XHYFISVV.js +1 -0
  539. package/build/dist/chunks/XPEDQBLI.js +1 -0
  540. package/build/dist/chunks/{D3YLXQPW.js → XQ24RSEI.js} +1 -1
  541. package/build/dist/chunks/XRDXFHIK.js +1 -0
  542. package/build/dist/chunks/XTFRPI4G.js +1 -0
  543. package/build/dist/chunks/XVJ7ILKK.js +1 -0
  544. package/build/dist/chunks/XWKK75TO.js +1 -0
  545. package/build/dist/chunks/{74Y2KDNR.js → XYPGLG6A.js} +1 -1
  546. package/build/dist/chunks/Y77EVVT4.js +1 -0
  547. package/build/dist/chunks/YEIM6BZQ.js +1 -0
  548. package/build/dist/chunks/{S47VUTHM.js → YMV5TL5C.js} +1 -1
  549. package/build/dist/chunks/YSMWCKIX.js +1 -0
  550. package/build/dist/chunks/YTLH4M4Y.js +1 -0
  551. package/build/dist/chunks/YUHNPUNK.js +1 -0
  552. package/build/dist/chunks/YWZQJJYY.js +1 -0
  553. package/build/dist/chunks/{UMIZMJWW.js → ZF2VPDRQ.js} +1 -1
  554. package/build/dist/chunks/ZFU65MB4.js +1 -0
  555. package/build/dist/chunks/ZKZUS3QU.js +1 -0
  556. package/build/dist/chunks/ZOMFHTB2.js +1 -0
  557. package/build/dist/chunks/{BTD5SMOW.js → ZP36DSOD.js} +1 -1
  558. package/build/dist/chunks/ZQ6AF3VX.js +1 -0
  559. package/package.json +1 -1
  560. package/build/dist/chunks/2KYAMXTS.js +0 -1
  561. package/build/dist/chunks/2TK3ETUO.js +0 -1
  562. package/build/dist/chunks/3MLUCYCB.js +0 -1
  563. package/build/dist/chunks/3NJ5KQ3Q.js +0 -1
  564. package/build/dist/chunks/3XNZUIRU.js +0 -1
  565. package/build/dist/chunks/3XXBLNEX.js +0 -1
  566. package/build/dist/chunks/45BRW2ZF.js +0 -1
  567. package/build/dist/chunks/46547QT3.js +0 -1
  568. package/build/dist/chunks/4PY3UFNR.js +0 -1
  569. package/build/dist/chunks/52ELWNXJ.js +0 -2
  570. package/build/dist/chunks/553UE2ZQ.js +0 -1
  571. package/build/dist/chunks/57MEFFCU.js +0 -1
  572. package/build/dist/chunks/5APS4T2D.js +0 -1
  573. package/build/dist/chunks/5SMVQCAP.js +0 -1
  574. package/build/dist/chunks/64GOINYS.js +0 -1
  575. package/build/dist/chunks/6D5DJA5B.js +0 -1
  576. package/build/dist/chunks/6I4NTKB2.js +0 -1
  577. package/build/dist/chunks/6OGDTEGH.js +0 -1
  578. package/build/dist/chunks/6PBGEPUK.js +0 -20
  579. package/build/dist/chunks/6WZX7C4T.js +0 -2
  580. package/build/dist/chunks/7WSHW7KW.js +0 -1
  581. package/build/dist/chunks/ABPL3ZZI.js +0 -1
  582. package/build/dist/chunks/AKYF5264.js +0 -7
  583. package/build/dist/chunks/APGLZXIW.js +0 -1
  584. package/build/dist/chunks/AVG4W3Y7.js +0 -1
  585. package/build/dist/chunks/B3RXD5ET.js +0 -1
  586. package/build/dist/chunks/BBS3ODWZ.js +0 -1
  587. package/build/dist/chunks/BJ2VGRF4.js +0 -1
  588. package/build/dist/chunks/BTPXJAUX.js +0 -1
  589. package/build/dist/chunks/C36BFZH6.js +0 -1
  590. package/build/dist/chunks/C7AXJHBT.js +0 -1
  591. package/build/dist/chunks/CBG5HARQ.js +0 -2
  592. package/build/dist/chunks/CCTXCMH4.js +0 -1
  593. package/build/dist/chunks/CHXBOXOD.js +0 -1
  594. package/build/dist/chunks/DJN3JAWB.js +0 -1
  595. package/build/dist/chunks/E674J2MD.js +0 -1
  596. package/build/dist/chunks/EE64JSLY.js +0 -1
  597. package/build/dist/chunks/EJ7O75A7.js +0 -1
  598. package/build/dist/chunks/ELSXLZN5.js +0 -1
  599. package/build/dist/chunks/FQ6UZCM6.js +0 -1
  600. package/build/dist/chunks/GEIFITAQ.js +0 -1
  601. package/build/dist/chunks/GGSAKCND.js +0 -1
  602. package/build/dist/chunks/GL4NCUMH.js +0 -1
  603. package/build/dist/chunks/GW626GG2.js +0 -1
  604. package/build/dist/chunks/H2XDMFQQ.js +0 -1
  605. package/build/dist/chunks/HAQPIBYR.js +0 -1
  606. package/build/dist/chunks/HCUHMCBW.js +0 -1
  607. package/build/dist/chunks/I26DMNJG.js +0 -1
  608. package/build/dist/chunks/IMO3GDA5.js +0 -1
  609. package/build/dist/chunks/INOZIE55.js +0 -1
  610. package/build/dist/chunks/J2OT4KAH.js +0 -1
  611. package/build/dist/chunks/JUZ5JU6D.js +0 -70
  612. package/build/dist/chunks/K3RDPI5J.js +0 -1
  613. package/build/dist/chunks/KBKK7UNY.js +0 -1
  614. package/build/dist/chunks/KPCY5V35.js +0 -1
  615. package/build/dist/chunks/L4N2RSK2.js +0 -1
  616. package/build/dist/chunks/L5BLHY34.js +0 -1
  617. package/build/dist/chunks/LSXUAHOE.js +0 -1
  618. package/build/dist/chunks/M37654RL.js +0 -1
  619. package/build/dist/chunks/MJ6WEWMI.js +0 -3
  620. package/build/dist/chunks/MR5L7V6Z.js +0 -1
  621. package/build/dist/chunks/N4Q6GN65.js +0 -1
  622. package/build/dist/chunks/NAZPDRIF.js +0 -1
  623. package/build/dist/chunks/NDCLTVIU.js +0 -1
  624. package/build/dist/chunks/NEEZBJBC.js +0 -1
  625. package/build/dist/chunks/NKX3FE34.js +0 -1
  626. package/build/dist/chunks/NKZKKCK2.js +0 -1
  627. package/build/dist/chunks/OJ4WJUPP.js +0 -1
  628. package/build/dist/chunks/OJPG45AC.js +0 -1
  629. package/build/dist/chunks/OTXSKFUD.js +0 -1
  630. package/build/dist/chunks/P3S4BR5G.js +0 -1
  631. package/build/dist/chunks/P56RZC2M.js +0 -1
  632. package/build/dist/chunks/P7I62KFR.js +0 -1
  633. package/build/dist/chunks/PK66GCDT.js +0 -1
  634. package/build/dist/chunks/PSBQWDYI.js +0 -1
  635. package/build/dist/chunks/PXT5YTWU.js +0 -1
  636. package/build/dist/chunks/QA3UHEO3.js +0 -1
  637. package/build/dist/chunks/QC3HH5UD.js +0 -3
  638. package/build/dist/chunks/QF52OIBS.js +0 -1
  639. package/build/dist/chunks/QO3KCJMP.js +0 -1
  640. package/build/dist/chunks/QZZ4O34L.js +0 -1
  641. package/build/dist/chunks/RQ4GHJXE.js +0 -1
  642. package/build/dist/chunks/RUX3RY7Y.js +0 -1
  643. package/build/dist/chunks/RVDUSNWW.js +0 -1
  644. package/build/dist/chunks/S7IFAQPG.js +0 -1
  645. package/build/dist/chunks/SIYUNOLI.js +0 -1
  646. package/build/dist/chunks/SSHCD6RZ.js +0 -18
  647. package/build/dist/chunks/T3AJSQYT.js +0 -1
  648. package/build/dist/chunks/TEJ7W534.js +0 -1
  649. package/build/dist/chunks/TM2XCRU7.js +0 -1
  650. package/build/dist/chunks/TVWMTMEF.js +0 -1
  651. package/build/dist/chunks/U5PMVP56.js +0 -1
  652. package/build/dist/chunks/U67J4BCH.js +0 -1
  653. package/build/dist/chunks/UHTRW2R6.js +0 -1
  654. package/build/dist/chunks/UHVSINR5.js +0 -1
  655. package/build/dist/chunks/VEQBHI6O.js +0 -1
  656. package/build/dist/chunks/VJS4DHQQ.js +0 -1
  657. package/build/dist/chunks/VOMGT5SG.js +0 -1
  658. package/build/dist/chunks/VY7XRHZQ.js +0 -1
  659. package/build/dist/chunks/VYAJXLND.js +0 -1
  660. package/build/dist/chunks/VYN2NRAP.js +0 -1
  661. package/build/dist/chunks/W2BYU5JQ.js +0 -2
  662. package/build/dist/chunks/W6BS3T7S.js +0 -1
  663. package/build/dist/chunks/WCNHZYQQ.js +0 -1
  664. package/build/dist/chunks/X2KFXCVD.js +0 -1
  665. package/build/dist/chunks/X3PQMS4N.js +0 -1
  666. package/build/dist/chunks/XBE3B6Y2.js +0 -1
  667. package/build/dist/chunks/XLOYBLFI.js +0 -1
  668. package/build/dist/chunks/XR7VK24E.js +0 -1
  669. package/build/dist/chunks/XSRIJUFU.js +0 -1
  670. package/build/dist/chunks/Y25EXZCO.js +0 -1
  671. package/build/dist/chunks/YCZPSMZ5.js +0 -1
  672. package/build/dist/chunks/YN56C7PN.js +0 -1
  673. package/build/dist/chunks/YWRDZQI6.js +0 -1
  674. package/build/dist/chunks/YXTSWRV5.js +0 -1
  675. package/build/dist/chunks/Z43BTOTE.js +0 -1
  676. package/build/dist/chunks/ZMFRMWHR.js +0 -1
  677. package/build/dist/chunks/ZSN4IRI5.js +0 -1
  678. package/build/dist/chunks/ZV5HIQXC.js +0 -1
@@ -0,0 +1 @@
1
+ import{b as bt}from"./EGZREEG2.js";import{b as ft}from"./N4XNNXOJ.js";import{b as wt}from"./FNGIJKMZ.js";import{c as mt}from"./2SUHQWND.js";import{b as ht}from"./QFSBDPLN.js";import{b as gt}from"./TE6D3OIX.js";import{c as pt}from"./Q2ACLVWR.js";import{h as ut}from"./JESMX2UC.js";import{a as C,b as L,c as Ie,d as me,e as Ge,g as st,h as Ve,j as U,l as E,o as Fe,p as at,q as dt,r as Me,s as lt,t as qe,u as ct}from"./WLMWWEP7.js";import{i as rt}from"./2GXHYI23.js";import{b as ot,o as it}from"./CAWTAR5V.js";import{b as et}from"./SPJCSEKP.js";import{a as z}from"./43LI5NKJ.js";import{a as tt,c as nt}from"./SCG5HWMN.js";import{a as Pe}from"./66F5ZH34.js";import{b as ee}from"./IX3GZMTM.js";import{a as $,d as N,i as ce}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{a as Ee}from"./JXOEJPJ4.js";import{BaseError as _t,ContractFunctionRevertedError as Ye,decodeEventLog as zt,decodeFunctionResult as Jt,encodeFunctionData as X,erc20Abi as Xt,getAddress as B,parseAbi as ke,parseAbiItem as Yt,recoverAddress as Zt,recoverMessageAddress as Kt,recoverTypedDataAddress as Qt}from"viem";var en="https://priors.trade/api/check",He=604800n,yt=50n,$t=10000n,We=5000000n,St=500000000n,je=86400n,At=2592000n,Ze=`Register one with oak_setup {"mode":"register"}, then open Priors' 5 USDG starter line with priors_starter_line (a refundable 5 USDG bond, an invite from Priors' invite bot, your pool consent; each transaction and signature is confirmed).`,tn="0x6982e39521a070a3c40782548bfbed6dc8f566ef",nn=["0xcbb95bbf36099d34da091dc6fa6f49efa257cee3","0x284358abc07f9359f19f4b5b4ac91901be2597ba"],c={pool:B(ce[4663].priors.pool.address),lens:B(ce[4663].priors.lens.address),usdg:B(ce[4663].priors.usdg.address),registry:B(ce[4663].priors.registry.address),stockVault:B(ce[4663].priors.stockVault.address)},te={address:c.usdg,symbol:"USDG",decimals:N,chainId:$},S=ke(["function deposit(uint256 assets, address receiver, uint256 minShares) returns (uint256 minted)","function withdraw(uint256 shares_, address receiver) returns (uint256 out)","function quoteFee(uint256 agentId, uint256 principal, uint64 term) view returns (uint256 fee, uint256 sponsorCut, uint256 reserveCut, uint256 premium)","function borrow(uint256 agentId, uint256 amount, uint64 term, address to, uint256 maxFee) returns (uint256 loanId)","function repay(uint256 loanId, uint256 expectedAgentId, uint256 maxDue)","function shares(address lender) view returns (uint256)","function convertToAssets(uint256 shares_) view returns (uint256)","function lastDepositAt(address lender) view returns (uint64)","function isController(uint256 id, address who) view returns (bool)","function delegateOf(uint256 id) view returns (address)","function getAgent(uint256 id) view returns (bool enrolled, bool isRoot, bool defaulted, bool frozen, bool importedFromV1, uint64 enrolledAt, uint64 lastBorrowAt, uint64 lastRepayAt, uint256 sponsor, uint256 delegatedIn, uint256 delegatedOut, uint256 principalOut, uint256 activeLoans, uint256 premiumBps, uint256 premiumCap, uint256 loansRepaid, uint256 volumeRepaid, uint256 feesPaid, uint256 recourseHonored, uint256 childrenDefaulted, uint256 qualifiedRepaid, uint256 dollarSecondsRepaid)","function nonces(uint256 id) view returns (uint256)","function consentDigest((uint256 agentId, uint256 sponsorId, address owner, uint256 maxPremiumBps, uint256 nonce, uint256 deadline) c) view returns (bytes32)","function leave(uint256 agentId)","function loansOf(uint256 id) view returns (uint256[])","function getLoan(uint256 loanId) view returns (uint256 agentId, uint256 sponsorId, uint256 principal, uint256 fee, uint256 sponsorCut, uint256 reserveCut, uint256 premium, address owner, uint64 issuedAt, uint64 dueAt, uint64 defaultableAt, uint64 minScoreTerm, uint64 closedAt, uint8 status)","event Borrowed(uint256 indexed loanId, uint256 indexed agentId, uint256 indexed sponsorId, uint256 principal, uint256 fee, uint64 dueAt, address to)"]),vt=ke(["function available(uint256 agentId) view returns (uint256)","function score(uint256 id) view returns (uint256)"]),kt=ke(["function ownerOf(uint256 agentId) view returns (address)","function balanceOf(address owner) view returns (uint256)","function getAgentWallet(uint256 agentId) view returns (address)"]),Pt=ke(["function borrowRoom(uint256 agentId) view returns (uint256)","function assetList() view returns (address[])","function assets(address token) view returns (address feed, uint32 heartbeat, uint8 tokenDecimals, uint8 feedDecimals, bool enabled, uint16 ltvBps, uint256 lineCap)"]);function Y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function on(e){return e.chainId===$&&e.address.toLowerCase()===c.usdg.toLowerCase()}function rn(e,i){let g=i.amount.trim(),u=g.startsWith("-"),f=u||g.startsWith("+")?g.slice(1):g,R=e.formatAmount(f,i.token.decimals),A=on(i.token)?"USDG":i.token.address;return`${u?"-":"+"}${R} ${A}`}function ne(e,i,g){if(!g.length)return i;let u=g.map(f=>rn(e,f)).join(", ");return`${i} Preview changes: ${u}.`}function It(e,i,g,u){let f=e[i]===void 0?void 0:ee(e[i]),R=e[g]===void 0?void 0:ee(e[g]);if(f!==void 0)return f;if(R!==void 0)return R;throw new a(`Provide ${u} as an integer string in base units ("${i}" or "${g}").`)}async function De(e,i,g){try{return B(await e.clientFor($).readContract({address:c.registry,abi:kt,functionName:"ownerOf",args:[i],blockNumber:g}))}catch(u){throw u instanceof _t&&u.walk(f=>f instanceof Ye)?new a(`ERC-8004 agent ${i} does not exist in registry ${c.registry}: it has no owner. Check the agent ID.`):new a(`Could not read the owner of ERC-8004 agent ${i} from registry ${c.registry}. Check the agent ID and retry when the registry is available.`)}}function pe(e,i){if(typeof e=="bigint"&&e>0n)return e;if(typeof e=="number"&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if(typeof e=="string"&&/^\d+$/.test(e.trim())){let g=BigInt(e.trim());if(g>0n)return g}throw new a(`Provide a positive integer ${i}.`)}function sn(e,i){let g=i!==void 0?pe(i,"agentId"):void 0,u=[];for(let f of e)if(!(!f||typeof f.address!="string")&&f.address.toLowerCase()===c.pool.toLowerCase()&&!(!Array.isArray(f.topics)||f.topics.length===0))try{let R=zt({abi:S,eventName:"Borrowed",data:f.data,topics:f.topics});if(g!==void 0&&R.args.agentId!==g)continue;u.push(R.args.loanId)}catch{continue}return u.length===0?null:u[u.length-1].toString()}function we(e){return{enrolled:!!e[0],isRoot:!!e[1],defaulted:!!e[2],frozen:!!e[3],importedFromV1:!!e[4],enrolledAt:BigInt(e[5]),lastBorrowAt:BigInt(e[6]),lastRepayAt:BigInt(e[7]),sponsor:BigInt(e[8]),delegatedIn:BigInt(e[9]),delegatedOut:BigInt(e[10]),principalOut:BigInt(e[11]),activeLoans:BigInt(e[12]),premiumBps:BigInt(e[13]),premiumCap:BigInt(e[14]),loansRepaid:BigInt(e[15]),volumeRepaid:BigInt(e[16]),feesPaid:BigInt(e[17]),recourseHonored:BigInt(e[18]),childrenDefaulted:BigInt(e[19]),qualifiedRepaid:BigInt(e[20]),dollarSecondsRepaid:BigInt(e[21])}}function Ce(e,i){return{loanId:e,agentId:BigInt(i[0]),sponsorId:BigInt(i[1]),principal:BigInt(i[2]),fee:BigInt(i[3]),sponsorCut:BigInt(i[4]),reserveCut:BigInt(i[5]),premium:BigInt(i[6]),owner:B(String(i[7])),issuedAt:BigInt(i[8]),dueAt:BigInt(i[9]),defaultableAt:BigInt(i[10]),minScoreTerm:BigInt(i[11]),closedAt:BigInt(i[12]),status:Number(i[13])}}async function _e(e,i){let g=e.clientFor($),u=await g.getBlockNumber({cacheTime:0}),f=await g.readContract({address:c.registry,abi:kt,functionName:"balanceOf",args:[i],blockNumber:u});if(f===0n)return[];if(typeof f!="bigint"||f<0n)throw new a("Registry balance is unavailable. Retry or provide an explicit agentId.");let R=[],A=new Set,x=u;for(;;){let H=x>9999999n?x-9999999n:0n,oe=await g.getLogs({address:c.registry,event:Yt("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:i},fromBlock:H,toBlock:x,strict:!0});for(let O of oe){let J=O.args.tokenId;if(O.removed||A.has(J))continue;if(A.add(J),(await De(e,J,u)).toLowerCase()===i.toLowerCase()&&R.push(J),BigInt(R.length)===f)return R.sort((Z,se)=>Z<se?-1:Z>se?1:0)}if(H===0n)throw new a("Owned identities could not all be located. Retry or provide an explicit agentId.");x=H-1n}}async function Re(e,i,g){if(i.agentId!==void 0&&i.agentId!==null&&String(i.agentId).trim()!=="")return pe(i.agentId,"agentId");let u=await _e(e,g);if(u.length===0)throw new a(`Priors borrowing needs an ERC-8004 agent identity with a Priors credit line, and this wallet owns no identity. ${Ze}`);return u[0]}async function ze(e,i,g){let u=e.clientFor($),f=await De(e,i),[R,A]=await Promise.all([u.readContract({address:c.pool,abi:S,functionName:"delegateOf",args:[i]}),u.readContract({address:c.pool,abi:S,functionName:"isController",args:[i,g]})]),x=B(R);if(!A)throw new a(`Wallet ${g} is not an on-chain controller for ERC-8004 agent ${i} (ownerOf=${f}, delegateOf=${x}). An off-chain /api/check paymentWallet match alone does not grant CreditPoolV2 control.`);return{owner:f,delegate:x}}function an(e,i){if(!i.enrolled||i.isRoot||i.sponsor===0n)throw new a(`ERC-8004 agent ${e} has no sponsor-backed Priors credit line on CreditPoolV2 yet (enrolled=${i.enrolled}, sponsor=${i.sponsor}, isRoot=${i.isRoot}). For an agent with no Priors record, priors_starter_line opens Priors' 5 USDG treasury line (a refundable 5 USDG bond, an invite from Priors' invite bot, your pool consent), then borrow.`);if(i.defaulted||i.frozen)throw new a(`ERC-8004 agent ${e} is not eligible to borrow on CreditPoolV2 (defaulted=${i.defaulted}, frozen=${i.frozen}).`);let g=i.delegatedIn>i.principalOut?i.delegatedIn-i.principalOut:0n;if(g<=0n)throw new a(`ERC-8004 agent ${e} has 0 USDG remaining credit capacity (delegatedIn=${i.delegatedIn}, principalOut=${i.principalOut}).`);return g}function dn(e){let i=e.borrowReceiptLogs??(Y(e.borrowReceipt)?e.borrowReceipt.logs:void 0);if(!Array.isArray(i))return[];let g=[];for(let u of i)Y(u)&&(typeof u.address!="string"||!Array.isArray(u.topics)||typeof u.data!="string"||g.push({address:u.address,topics:u.topics,data:u.data}));return g}var Je="0x0000000000000000000000000000000000000000",ue=()=>Math.floor(Date.now()/1e3),G=e=>new Date(Number(e)*1e3).toISOString(),V=(e,i)=>e.toLowerCase()===i.toLowerCase();function ye(e){let i=(g,u)=>Array.isArray(e)?e[u]:e[g];return{depositor:B(String(i("depositor",0))),at:BigInt(i("at",1)),amount:BigInt(i("amount",2))}}async function he(e,i,g){let u=e.clientFor($),f=await u.getBlockNumber({cacheTime:0}),[R,A,x,H,oe,O,J,ge,Z,se,Te]=await Promise.all([De(e,i,f),u.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[i],blockNumber:f}),u.readContract({address:L,abi:E,functionName:"firstLined",args:[i],blockNumber:f}),u.readContract({address:L,abi:E,functionName:"agentId",blockNumber:f}),u.readContract({address:L,abi:E,functionName:"rules",blockNumber:f}),u.readContract({address:L,abi:E,functionName:"epochRoom",blockNumber:f}),u.readContract({address:C,abi:U,functionName:"bonds",args:[i],blockNumber:f}),u.readContract({address:C,abi:U,functionName:"amount",blockNumber:f}),u.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[i],blockNumber:f}),u.readContract({address:C,abi:U,functionName:"unusedAfter",blockNumber:f}),u.readContract({address:c.usdg,abi:Xt,functionName:"balanceOf",args:[g],blockNumber:f})]);return{owner:R,agent:we(A),firstLined:x===!0,root:BigInt(H),firstLineAmount:BigInt(oe[1]),epochRoom:BigInt(O),bond:ye(J),bondAmount:BigInt(ge),releaseAt:BigInt(Z),unusedAfter:BigInt(se),usdg:BigInt(Te)}}function Ct(e,i){return e.enrolled||e.enrolledAt>0n||e.isRoot||e.defaulted||e.importedFromV1||e.loansRepaid>0n||e.sponsor!==0n||i}function Rt(e,i,g,u){let f=R=>`${e.formatAmount(R.toString(),N)} USDG`;if(i.defaulted)return"it defaulted: the pool marks it, and Priors never lends to it again";if(i.isRoot)return"it is a root: it backs other agents' lines";if(i.delegatedIn>0n){let R=i.sponsor===g?`Priors' treasury (root #${g})`:`root #${i.sponsor}`;return`it has a ${f(i.delegatedIn)} line from ${R}${i.activeLoans>0n?` with ${i.activeLoans} loan(s) open`:""}`}return`it has no line now${i.enrolledAt>0n?` (it enrolled at ${G(i.enrolledAt)})`:""}${u?`; Priors' treasury opened a line for it once, and another needs a person at ${Ge}`:""}`}async function Xe(e,i){let g;try{g=await e.http(me,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(i)})}catch(f){if(!(f instanceof tt))throw new a(`Priors' invite bot (${me}) could not be reached: ${e.plainError(f)}`);g=f.response}let u;try{u=JSON.parse(await g.text())}catch{u=void 0}if(!Y(u))throw new a(`Priors' invite bot (${me}) answered HTTP ${g.status} without a readable JSON object.`);return u}var be=e=>Ee(typeof e=="string"&&e?e:"no reason given");function ln(e,i){let g=i instanceof _t?i.walk(x=>x instanceof Ye):void 0,u=g instanceof Ye?g.data:void 0,f=u?.args??[],R=x=>`${e.formatAmount(String(x),N)} USDG`,A=u?.errorName;switch(A){case"EpochCapReached":return`Priors' treasury has no room for a new line this week (wanted ${R(f[0])}, ${R(f[1])} left); the treasury caps new lines each week, so ask again next week.`;case"InsufficientBacking":return`Priors' treasury root lacks free backing for the line now (requested ${R(f[1])}, free ${R(f[2])}); try again later.`;case"InviteExpired":return"the invite expired; call priors_starter_line again for a new one.";case"InviteUsed":return"the invite was already used.";case"NotInvited":return`the invite's signer ${String(f[1])} is not an inviter TreasurySponsorV4 names.`;case"AlreadyLined":return"the agent is already on a treasury line.";case"OwnerDefaulted":return"a default on this wallet's Priors record stops new treasury lines.";case"BadConsent":return"the pool refused the consent (its owner, nonce or signature no longer matches); call priors_starter_line again.";case"ConsentExpired":return"the consent expired; call priors_starter_line again.";case"Paused":return"the Priors pool is paused for new risk; try again later.";case void 0:return e.plainError(i);default:return`${A}(${f.map(String).join(", ")}).`}}var cn=e=>{let i={name:"priors_lend",inputSchema:{type:"object",properties:{assets:{type:"string",pattern:"^[0-9]+$",description:'USDG deposit amount in 6-decimal base units (e.g. "1000000" for 1 USDG).'},amount:{type:"string",pattern:"^[0-9]+$",description:'Alias for assets: USDG amount in base units (6 decimals). Example: "1000000" = 1 USDG.'},receiver:{type:"string",description:"Optional share receiver address (must be the signing wallet)."},minShares:{type:"string",pattern:"^[0-9]+$",description:"Minimum pool shares in base units; defaults to simulated minted shares less slippage."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points for the simulated share minimum (defaults to 50)."}}},async execute(n,s){z(s);let o=B(s),t=o;if(n.receiver!==void 0&&(typeof n.receiver!="string"||n.receiver.trim().toLowerCase()!==o.toLowerCase()))throw new a("Priors receiver must be the signing wallet.");let r=It(n,"assets","amount","USDG deposit amount");if(r<=0n)throw new a("Deposit amount must be greater than zero.");let p=n.minShares===void 0?void 0:ee(n.minShares),d=e.approval(c.usdg,c.pool,r.toString(),$);if(p===void 0){let l;try{let v=await e.clientFor($).simulateCalls({account:o,calls:[{to:d.to,data:d.data},{to:c.pool,data:X({abi:S,functionName:"deposit",args:[r,t,0n]})}]}),[I,_]=v.results;if(I?.status!=="success"||_?.status!=="success")throw new a("Approval or deposit simulation failed.");l=Jt({abi:S,functionName:"deposit",data:_.data})}catch(v){throw new a(`Could not simulate Priors deposit shares: ${e.plainError(v)}`)}if(p=ee(it(l.toString(),n.slippageBps??ot)),p===0n)throw new a("The simulated deposit cannot provide a positive minimum share amount.")}let w=e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"deposit",args:[r,t,p]}),value:"0",chainId:$,description:`Deposit ${r} USDG base units into Priors CreditPoolV2 (${c.pool}) for ${t}.`}),b=[d,w],m=await e.preview(b,o),P=`Approve ${e.formatAmount(r.toString(),N)} USDG and deposit into Priors CreditPoolV2 (${c.pool}) for ${t} (minShares=${p}; 7-day MIN_HOLD applies a 0.5% early-exit fee on early withdrawals).`;return{txs:b,summary:ne(e,P,m.changes)}}},g={name:"priors_withdraw",inputSchema:{type:"object",properties:{shares:{type:"string",pattern:"^[0-9]+$",description:"Pool share count in base units to redeem (not USDG amount; omit to redeem full wallet share balance)."},receiver:{type:"string",description:"Optional USDG receiver address (must be the signing wallet)."}}},async execute(n,s){z(s);let o=B(s),t=o;if(n.receiver!==void 0&&(typeof n.receiver!="string"||n.receiver.trim().toLowerCase()!==o.toLowerCase()))throw new a("Priors receiver must be the signing wallet.");let r=e.clientFor($),p=n.shares!==void 0?ee(n.shares):await r.readContract({address:c.pool,abi:S,functionName:"shares",args:[o]});if(p<=0n)throw new a(`Wallet ${o} has no Priors CreditPoolV2 shares to withdraw.`);let[d,w,b]=await Promise.all([r.readContract({address:c.pool,abi:S,functionName:"convertToAssets",args:[p]}),r.readContract({address:c.pool,abi:S,functionName:"lastDepositAt",args:[o]}),r.getBlock()]),m=w>0n&&b.timestamp<w+He,h=m?d*yt/$t:0n,P=d-h,v=[e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"withdraw",args:[p,t]}),value:"0",chainId:$,description:`Withdraw ${p} shares from Priors CreditPoolV2 (${c.pool}) to ${t}.`})],I=await e.preview(v,o),_=e.formatAmount(P.toString(),N),F=e.formatAmount(d.toString(),N),k=e.formatAmount(h.toString(),N),D=m?`inside 7-day MIN_HOLD: ${k} USDG (0.5%) early-exit fee stays in pool, net payout ${_} USDG from ${F} USDG gross`:`outside 7-day MIN_HOLD: no early-exit fee, net payout ${_} USDG`,M=`Withdraw ${p} shares from Priors CreditPoolV2 (${c.pool}) to ${t} (${D}).`;return{txs:v,summary:ne(e,M,I.changes)}}},u={name:"priors_borrow",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"ERC-8004 agent token ID with an already-funded Priors credit line."},principal:{type:"string",pattern:"^[0-9]+$",description:'Borrow principal in 6-decimal USDG base units (min "5000000" = 5 USDG).'},amount:{type:"string",pattern:"^[0-9]+$",description:'Alias for principal: USDG amount in base units (6 decimals). Example: "5000000" = 5 USDG.'},term:{type:"string",description:'Loan term in seconds (between 86400 and 2592000; defaults to "86400"). The origination fee is pro-rated by term, so a longer term costs more.'},recipient:{type:"string",description:"Optional USDG recipient address (must be the signing wallet)."},maxFee:{type:"string",description:"Optional fee ceiling in USDG base units (6 decimals); must equal the pool quote for this principal and term. Omit to use it. The fee is pro-rated by term, not flat: 1666 for 5 USDG over 1 day."}}},async execute(n,s){z(s);let o=B(s),t=o;if(n.recipient!==void 0&&(typeof n.recipient!="string"||n.recipient.trim().toLowerCase()!==o.toLowerCase()))throw new a("Priors recipient must be the signing wallet.");let r=await Re(e,n,o);await ze(e,r,o);let p=e.clientFor($),d=await p.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[r]}),w=we(d),b=an(r,w),m=It(n,"principal","amount","USDG borrow principal");if(m<We||m>St)throw new a(`Borrow principal must be between ${We} (5 USDG) and ${St} (500 USDG) base units.`);if(m>b)throw new a(`Borrow principal ${m} exceeds available credit line capacity ${b} USDG base units for agent ${r}.`);let h=n.term!==void 0&&String(n.term).trim()!==""?pe(n.term,"term"):je;if(h<je||h>At)throw new a(`Loan term must be between ${je} (1 day) and ${At} (30 days) seconds.`);let P=await p.readContract({address:c.pool,abi:S,functionName:"quoteFee",args:[r,m,h]}),l=P[0],v=n.maxFee!==void 0?ee(n.maxFee):l;if(v<l)throw new a(`Provided maxFee ${v} is below the origination fee the pool quotes for this term, ${l} USDG base units.`);if(v>l)throw new a(`Provided maxFee ${v} is above the quoted origination fee ${l} USDG base units. Use the quoted fee or omit maxFee.`);let I=m+l,_=m+v,k=[e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"borrow",args:[r,m,h,t,v]}),value:"0",chainId:$,description:`Borrow ${m} USDG base units on Priors CreditPoolV2 for agent ${r} to ${t} (quoted fee ${l}, expected debt ${I}, maxFee ${v}, debt ceiling ${_}).`})],D=await e.preview(k,o),M=e.formatAmount(m.toString(),N),W=e.formatAmount(l.toString(),N),ae=e.formatAmount(I.toString(),N),j=e.formatAmount(v.toString(),N),$e=e.formatAmount(_.toString(),N),q=P[1]+P[3],K=P[2],de=l-q-K,ie=`Borrow ${M} USDG for ERC-8004 agent ${r} to recipient ${t} on Priors CreditPoolV2 (${c.pool}) for ${h}s: expected origination fee ${W} USDG (${l} base units; pro-rated by term, set when the loan opens, none refunded on early repayment), expected total repayment due ${ae} USDG (${I} base units); fee ceiling ${j} USDG (${v} base units), debt ceiling ${$e} USDG (${_} base units). Fee recipient on repayment: CreditPoolV2 (${c.pool}), allocating the quoted fee to sponsor ${w.sponsor} (${q} base units including premium), reserve (${K} base units), and lenders (${de} base units).`;return{txs:k,summary:ne(e,ie,D.changes)}}},f={name:"priors_repay",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"ERC-8004 agent token ID that owns the active loan."},loanId:{type:"string",description:"Optional explicit per-agent loan ID (otherwise recovered from Borrowed receipt logs or loansOf(agentId))."},borrowReceiptLogs:{type:"array",description:"Optional receipt logs array from the borrow transaction to decode the exact Borrowed(loanId, agentId, ...) event."},maxDue:{type:"string",description:"Optional maximum USDG base units to repay; must equal the exact fixed principal + fee. Omit to use that debt."}}},async execute(n,s){z(s);let o=B(s),t=await Re(e,n,o);await ze(e,t,o);let r=e.clientFor($),p;if(n.loanId!==void 0&&n.loanId!==null&&String(n.loanId).trim()!=="")p=pe(n.loanId,"loanId");else{let k=dn(n);if(k.length>0){let D=sn(k,t);D!==null&&(p=BigInt(D))}}let d;if(p!==void 0){let k=await r.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[p]}),D=Ce(p,k);if(D.agentId!==t)throw new a(`Loan ${p} belongs to agent ${D.agentId}, not agent ${t}. Recover loan IDs from the Borrowed receipt or loansOf(agentId), never global loanCount().`);if(D.status!==1)throw new a(`Loan ${p} for agent ${t} is not active (status=${D.status}).`);d=D}else{let k=await r.readContract({address:c.pool,abi:S,functionName:"loansOf",args:[t]});if(k.length===0)throw new a(`ERC-8004 agent ${t} has no recorded loans on Priors CreditPoolV2.`);let M=(await Promise.all(k.map(async W=>{let ae=await r.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[W]});return Ce(W,ae)}))).filter(W=>W.agentId===t&&W.status===1);if(M.length===0)throw new a(`ERC-8004 agent ${t} has no active loans to repay.`);d=M[M.length-1]}let w=d.principal+d.fee,b=n.maxDue!==void 0?ee(n.maxDue):w;if(b<w)throw new a(`Provided maxDue ${b} is below the exact fixed loan debt ${w} USDG base units (principal ${d.principal} + fixed fee ${d.fee}).`);if(b>w)throw new a(`Provided maxDue ${b} is above the exact fixed loan debt ${w} USDG base units. Use the fixed debt or omit maxDue.`);let m=e.approval(c.usdg,c.pool,w.toString(),$),h=e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"repay",args:[d.loanId,t,b]}),value:"0",chainId:$,description:`Repay fixed debt ${w} USDG base units (principal ${d.principal} + fee ${d.fee}) for loan ${d.loanId} (agent ${t}).`}),P=[m,h],l=await e.preview(P,o),v=e.formatAmount(w.toString(),N),I=e.formatAmount(d.principal.toString(),N),_=e.formatAmount(d.fee.toString(),N),F=`Approve and repay ${v} USDG (${w} base units: ${I} USDG principal + ${_} USDG fixed fee) for Priors loan ${d.loanId} (agent ${t}).`;return{txs:P,summary:ne(e,F,l.changes)}}},R={name:"priors_status",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"Optional ERC-8004 agent ID to inspect on CreditPoolV2, PriorsLens, and StockVault."},includeApiCheck:{type:"boolean",description:"Optional flag to query https://priors.trade/api/check for supplemental off-chain metadata."}}},async execute(n,s){z(s);let o=B(s),t=e.clientFor($),[r,p,d,w]=await Promise.all([t.readContract({address:c.pool,abi:S,functionName:"shares",args:[o]}),t.readContract({address:c.pool,abi:S,functionName:"lastDepositAt",args:[o]}),t.getBlock(),t.readContract({address:c.stockVault,abi:Pt,functionName:"assetList"})]),b=r>0n?await t.readContract({address:c.pool,abi:S,functionName:"convertToAssets",args:[r]}):0n,m=r>0n&&p>0n&&d.timestamp<p+He,h=m?b*yt/$t:0n,P=b-h,l=null;if(n.agentId!==void 0&&n.agentId!==null&&String(n.agentId).trim()!=="")l=pe(n.agentId,"agentId");else{let q=await _e(e,o);q.length>0&&(l=q[0])}let v=null,I=!1,_=[],F=null,k=null,D=null,M=null,W=null,ae=null,j=`This wallet owns no ERC-8004 agent identity. ${Ze}`;if(l!==null){let[q,K,de,ie,Ut,Et,Be,Ne,xe]=await Promise.all([t.readContract({address:c.lens,abi:vt,functionName:"score",args:[l]}),t.readContract({address:L,abi:E,functionName:"firstLined",args:[l]}),t.readContract({address:L,abi:E,functionName:"agentId"}),t.readContract({address:L,abi:E,functionName:"rules"}),t.readContract({address:L,abi:E,functionName:"epochRoom"}),t.readContract({address:C,abi:U,functionName:"bonds",args:[l]}),t.readContract({address:C,abi:U,functionName:"amount"}),t.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[l]}),t.readContract({address:C,abi:U,functionName:"releasable",args:[l]})]),[Gt,Vt,Ft,Mt,qt,Ht]=await Promise.all([t.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[l]}),t.readContract({address:c.pool,abi:S,functionName:"loansOf",args:[l]}),t.readContract({address:c.lens,abi:vt,functionName:"available",args:[l]}),t.readContract({address:c.stockVault,abi:Pt,functionName:"borrowRoom",args:[l]}),t.readContract({address:c.pool,abi:S,functionName:"delegateOf",args:[l]}),t.readContract({address:c.pool,abi:S,functionName:"isController",args:[l,o]})]),Le=await De(e,l),Wt=B(qt),Ke=Ht,y=we(Gt),Se=y.delegatedIn>y.principalOut?y.delegatedIn-y.principalOut:0n;I=y.enrolled&&!y.isRoot&&!y.defaulted&&!y.frozen&&y.sponsor>0n&&y.delegatedIn>0n,F=Ft.toString(),k=Mt.toString();let jt=await Promise.all(Vt.map(async T=>{let le=await t.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[T]});return Ce(T,le)}));for(let T of jt)if(T.agentId===l&&T.status===1){let le=T.principal+T.fee;_.push({loanId:T.loanId.toString(),agentId:T.agentId.toString(),sponsorId:T.sponsorId.toString(),principal:T.principal.toString(),fee:T.fee.toString(),due:le.toString(),dueAt:T.dueAt.toString(),issuedAt:T.issuedAt.toString(),owner:T.owner,token:te})}v={agentId:l.toString(),owner:Le,delegate:Wt,isAuthorizedController:Ke,enrolled:y.enrolled,isRoot:y.isRoot,defaulted:y.defaulted,frozen:y.frozen,sponsorId:y.sponsor.toString(),delegatedIn:y.delegatedIn.toString(),delegatedOut:y.delegatedOut.toString(),principalOut:y.principalOut.toString(),availableCapacity:Se.toString(),activeLoansCount:y.activeLoans.toString(),loansRepaid:y.loansRepaid.toString(),volumeRepaid:y.volumeRepaid.toString(),feesPaid:y.feesPaid.toString(),importedFromV1:y.importedFromV1,qualifiedRepaid:y.qualifiedRepaid.toString(),dollarSecondsRepaid:y.dollarSecondsRepaid.toString()};let Ae=BigInt(de),Oe=K===!0,Q=ye(Et),re=Q.depositor!==Je,ve=re&&V(Q.depositor,o),Qe=Ct(y,Oe),Ue=V(Le,o);D={onchain:BigInt(q).toString(),scale:"0-1000",source:`CreditLensV2.score(${l}) at ${c.lens}, the score the pool computes on chain`,scoreV2:null},M={open:y.sponsor!==0n&&y.delegatedIn>0n,amount:y.delegatedIn.toString(),drawn:y.principalOut.toString(),available:Se.toString(),sponsorId:y.sponsor.toString(),backer:y.sponsor===0n?null:y.sponsor===Ae?`Priors' treasury v4 (root #${Ae})`:`root #${y.sponsor}`,token:te},W={contract:C,posted:re,depositor:re?Q.depositor:null,postedByWallet:ve,postedAt:re?Q.at.toString():null,amount:(re?Q.amount:BigInt(Be)).toString(),releasable:re&&xe===!0,releaseAt:re?BigInt(Ne).toString():null,rule:"Back to its depositor once the agent holds no line and has no loan open, from 4 days after it was posted (close a line first with priors_close_line); a default forfeits it to Priors' Safe."},ae={eligible:Ue&&!Qe,firstLined:Oe,lineAmount:BigInt(ie[1]).toString(),bondAmount:BigInt(Be).toString(),treasuryRoot:Ae.toString(),treasuryRoomThisWeek:BigInt(Ut).toString(),note:"Not instant: Priors' invite bot decides each invite, and the treasury caps new lines each week."};let fe=_.map(T=>({id:String(T.loanId),dueAt:BigInt(String(T.dueAt))})).sort((T,le)=>T.dueAt<le.dueAt?-1:T.dueAt>le.dueAt?1:0);y.defaulted?j=`Agent #${l} defaulted; Priors never lends to it again${ve?" and its bond is forfeited":""}.`:!Ke&&!Ue?j=`This wallet does not control agent #${l} on CreditPoolV2 (owner ${Le}); act from its owner or delegate.`:fe.length?j=`Repay loan ${fe[0].id} with priors_repay before it is due at ${G(fe[0].dueAt)}${fe.length>1?` (${fe.length} loans open)`:""}.`:I&&Se>=We?j=`Borrow with priors_borrow (5 USDG minimum, up to ${A(Se)}; the fee is pro-rated by term); Priors counts loans held 7 days or more toward the score.`:!Qe&&Ue?j=ve?`Call priors_starter_line again: the ${A(Q.amount)} bond is posted, and it goes on with the invite bot's ownership proof and the invite's redemption${xe===!0?", or priors_release_bond returns the bond":""}.`:`Call priors_starter_line: a refundable ${A(BigInt(Be))} bond, an invite from Priors' invite bot and your pool consent open a ${A(BigInt(ie[1]))} line from Priors' treasury (each transaction and signature is confirmed).`:ve?j=xe===!0?`Release the ${A(Q.amount)} invite bond with priors_release_bond.`:y.delegatedIn>0n?`The line is open with nothing to draw; to take the bond back, close it with priors_close_line, then priors_release_bond from ${G(BigInt(Ne))}.`:`The ${A(Q.amount)} invite bond comes back with priors_release_bond from ${G(BigInt(Ne))}.`:j=`Agent #${l} has a Priors record but no line to draw now; ${Rt(e,y,Ae,Oe)}.`}let $e=null;if(n.includeApiCheck){let q=l!==null?`agent=${l.toString()}`:`address=${o}`,K=await nt(e.http,`${en}?${q}`,{method:"GET"},Y),de=Array.isArray(K.agents)?K.agents.find(ie=>Y(ie)&&String(ie.agentId)===String(l)):void 0;D&&Y(de)&&(D.scoreV2=de.scoreV2??null),$e={...K,grantsPoolControl:!1,controlRule:"Off-chain /api/check identity or paymentWallet match never grants CreditPoolV2 control; on-chain isController(agentId, wallet) must authorize the caller; stale delegates do not qualify."}}return{chainId:$,blockNumber:d.number?.toString()??null,blockTimestamp:d.timestamp.toString(),wallet:o,token:te,contracts:c,lender:{shares:r.toString(),grossAssets:b.toString(),earlyExitFeeAssets:h.toString(),netWithdrawAssets:P.toString(),lastDepositAt:p.toString(),withinMinHoldWindow:m,minHoldSeconds:He.toString()},hasFundedLine:I,agentId:l!==null?l.toString():null,nextStep:j,score:D,line:M,bond:W,starterLine:ae,agent:v,activeLoans:_,lens:{address:c.lens,available:F,caveat:"PriorsLens.available(agentId) is a status capacity hint for already-funded lines; backer hooks may still refuse borrows."},stockVault:{address:c.stockVault,borrowRoom:k,onchainAssetCount:w.length,hostedMcpStockCount:35,extraNonStockAsset:B(tn),zeroCapAssets:nn.map(q=>B(q)),caveat:"Use priors_stock_assets and priors_stock_asset_state for current collateral rules, then priors_stock_open. This summary is an observed asset-count snapshot, not a fixed allowlist; live caps, lending holds and prices control admission."},apiCheck:$e,limitations:["Borrowing and repayment require a sponsor-backed ERC-8004 credit line (enrolled && !isRoot && sponsor != 0) authorized on-chain by isController(agentId, wallet).","Priors line routes are exposed by priors_line_options and priors_capabilities: treasury starter, V5 move/raise, direct sponsor, stock and owner PRIORS backing. Ethos execution uses Priors own owner workflow because its worker supplies no unsigned final transaction.","score.onchain is the pool's on-chain score (CreditLensV2); score.scoreV2 is Priors Score v2 from /api/check, present only with includeApiCheck.","Loan debt is the principal plus the origination fee the pool quotes for the term. The fee is pro-rated by term, not flat (1666 base units for 5 USDG over 1 day, observed live 2026-10-31; priors_borrow shows the exact quote), and is fixed once the loan opens: variable interest is never invented, and early repayment refunds none of it.","Loan IDs are recovered from decoded Borrowed receipts or per-agent loansOf(agentId), never global loanCount().","Historical archive event queries and zero-position StockVault lines on public RPCs remain subject to archive retention and live backer state."]}}},A=n=>`${e.formatAmount(n.toString(),N)} USDG`;function x(n){let s=V(n.bond.depositor,n.owner)&&n.bond.amount>0n?n.bond.amount:n.bondAmount;return`Bond first: ${A(s)} is locked in Priors' InviteBond for at least ${n.unusedAfter} seconds (${Number(n.unusedAfter)/86400} days) after posting${n.releaseAt>0n?`; unusedReleaseAt is ${G(n.releaseAt)}`:"; the exact release time is read after posting"}. Release requires no line and no open loan; default can forfeit the bond. Invites are not guaranteed. The credit score can lag qualifying repayments. `}function H(n,s,o){if(!V(o.owner,s))throw new a(`This wallet (${s}) does not own ERC-8004 agent ${n} (its owner is ${o.owner}). The bond, the ownership proof and the pool consent are the owner's. Nothing was signed.`);if(o.root!==Ie)throw new a(`TreasurySponsorV4 (${L}) answers root #${o.root}, not the pinned #${Ie}. Nothing was signed; update Oak.`);if(Ct(o.agent,o.firstLined))throw new a(`Agent #${n} already has a Priors record, so priors_starter_line posts no bond and signs nothing: ${Rt(e,o.agent,o.root,o.firstLined)}; ${o.agent.loansRepaid} loan(s) repaid. The starter line is only for an identity with no record; priors_status shows this one.`)}let oe="stays posted in InviteBond";function O(n){let s=n.agent.delegatedIn>0n?`with a line open it comes back only after priors_close_line (no loan open), then priors_release_bond from ${G(n.releaseAt)} at the earliest`:`while the agent holds no line it comes back with priors_release_bond from ${G(n.releaseAt)} (${Number(n.unusedAfter)/86400} days after it was posted)`;return`The ${A(n.bond.amount>0n?n.bond.amount:n.bondAmount)} bond ${oe} (${C}), posted from this wallet; ${s}, and priors_starter_line never posts a second bond.`}async function J(n,s,o){try{return await o()}catch(t){let r=t instanceof a?t.message:e.plainError(t);if(r.includes(oe)||n===void 0||!/^[0-9]{1,78}$/.test(n))throw t;let p;try{let d=await he(e,BigInt(n),s);p=V(d.bond.depositor,s)?O(d):""}catch{p=`If the bond transactions mined, the invite bond ${oe} (${C}) remains locked until its on-chain release conditions are met; priors_status shows the exact amount and time (its state could not be read just now).`}throw p?new a(`${r} ${p}`):t}}async function ge(n,s,o){let t=lt(await Xe(e,{agentId:n}),{agentId:n,owner:s,now:ue()});if(!t.ok&&t.refused)throw new a(`Priors' invite bot gave no ownership proof to sign for agent #${n}: ${be(t.why)}. Nothing was signed. ${o}`.trim());if(!t.ok)throw new a(`Not signed: the invite bot's answer for agent #${n} is not one Oak signs: ${t.why}. Oak signs only the bot's own start-page text, rebuilt locally for this agent and this wallet. ${o}`.trim());if(t.exp-ue()<120)throw new a(`Not signed: the invite bot's proof for agent #${n} expires in under 2 minutes; call priors_starter_line again for a new one. ${o}`.trim());return t}function Z(n,s,o,t){return{steps:[{kind:"message",message:o.message}],continuation:{stage:"proof",wallet:s,chainId:$,agentId:n,n:o.n,exp:o.exp},summary:`${x(t)}Priors starter line for ERC-8004 agent ${n}, step 2 of 3: sign Priors' invite-bot ownership proof. It is a message signature (EIP-191) only: it sends no transaction and moves no funds. The text is the bot's own form, rebuilt locally for agent #${n} and this wallet, request ${o.n}, expiring ${G(o.exp)}. Oak then sends the signature to ${me}, and the bot decides the invite. ${O(t)}`}}function se(n,s,o){if(n.chainId!==$||typeof n.wallet!="string"||!V(n.wallet,s)||typeof n.agentId!="string"||!/^[1-9][0-9]{0,29}$/.test(n.agentId))throw new a("Priors starter-line continuation does not match this wallet or chain 4663; start priors_starter_line again.");if(o.agentId!==void 0&&String(o.agentId)!==n.agentId)throw new a("Priors starter-line continuation is for another agent; start priors_starter_line again.");return BigInt(n.agentId)}async function Te(n,s){let o;if(n.agentId!==void 0&&n.agentId!==null&&String(n.agentId).trim()!=="")o=pe(n.agentId,"agentId");else{let l=await _e(e,s);if(!l.length)throw new a(`Priors' starter line needs an ERC-8004 agent identity, and this wallet owns none. ${Ze}`);o=l[0]}let t=await he(e,o,s);H(o,s,t);let r=o.toString(),p=V(t.bond.depositor,s);if(!p){if(t.usdg<t.bondAmount)throw new a(`This wallet holds ${A(t.usdg)} on Robinhood Chain, and Priors' treasury invite asks a ${A(t.bondAmount)} bond first (InviteBond ${C}), posted from this wallet. Nothing was signed: add USDG, then call priors_starter_line again.`);if(t.epochRoom<t.firstLineAmount)return{summary:`${x(t)}Not submitted. Priors' treasury has ${A(t.epochRoom)} of room left this week and a first line is ${A(t.firstLineAmount)}, so priors_starter_line posted no bond and signed nothing. The treasury caps new lines each week: ask again next week.`,starterLine:{agentId:r,open:!1,reason:"room",epochRoom:t.epochRoom.toString()}};let l=await Xe(e,{check:!0,owner:s.toLowerCase()});if(l.check!==!0)throw new a("Priors' invite bot did not answer its check, so whether an invite is open cannot be told. Nothing was signed.");if(l.ok!==!0)throw new a(`Whether an automatic invite is open could not be told: Priors' invite bot says ${be(l.error)}. Nothing was signed; try again later.`);if(l.open!==!0){let v=typeof l.reason=="string"?l.reason.replace(/[^a-z-]/g,"").slice(0,24):"",I=typeof l.reopensAt=="number"&&Number.isSafeInteger(l.reopensAt)&&l.reopensAt>0?l.reopensAt:null;return{summary:`${x(t)}Not submitted. No automatic invite is open to this wallet right now, so priors_starter_line posted no bond and signed nothing. Priors' invite bot answers: closed, reason ${Ee(v||"none given")}${I?`, reopens ${G(I)}`:""}. ${ct({...l,reason:v})} Priors lists its other ways to a first line (the Ethos lane, a stock line, the owner's $PRIORS stake) at https://priors.trade/skill.md.`,starterLine:{agentId:r,open:!1,reason:v||null,reopensAt:I}}}}let d=await ge(r,s,p?O(t):"");if(p)return Z(r,s,d,t);let w=[e.approval(c.usdg,C,t.bondAmount.toString(),$),e.unsignedTx({to:C,data:X({abi:U,functionName:"deposit",args:[o]}),value:"0",chainId:$,description:`Post the ${t.bondAmount} USDG base-unit Priors invite bond for agent ${r} in InviteBond (${C}).`})],b=await e.preview(w,s),m=t.bond.depositor!==Je?` This deposit replaces the bond ${t.bond.depositor} posted for this agent; InviteBond returns that bond to it in the same transaction.`:"",h=`${x(t)}Priors starter line for ERC-8004 agent ${r}, step 1 of 3: approve exactly ${A(t.bondAmount)} to Priors' InviteBond (${C}) and post it as the agent's refundable invite bond (InviteBond.deposit).${m} Priors' invite bot says an automatic invite is open now and gave the ownership proof to sign next. Step 2 signs that proof (a message, no transaction); step 3 signs your pool consent and redeems the invite (TreasurySponsorV4.firstLine, ${L}) for a ${A(t.firstLineAmount)} line from Priors' treasury (root #${t.root}). The invite is the bot's decision, not a promise: if it refuses, or any later step fails, the bond stays posted and comes back with priors_release_bond after the on-chain lock and release conditions are met. With a line, the bond comes back only once the line is closed with no loan open (priors_close_line, then priors_release_bond); a default forfeits it to Priors' Safe.`;return{steps:w.map(l=>({kind:"tx",tx:l})),continuation:{stage:"bond",wallet:s,chainId:$,agentId:r,n:d.n,exp:d.exp},summary:ne(e,h,b.changes)}}async function Dt(n,s,o){let t=await he(e,n,s);H(n,s,t);let r=n.toString();if(!V(t.bond.depositor,s))throw new a(`The invite bond for agent #${r} is not on chain from this wallet, so nothing more was signed. Check the deposit transaction, then call priors_starter_line again.`);return typeof o.n=="string"&&Ve.test(o.n)&&typeof o.exp=="number"&&Number.isSafeInteger(o.exp)&&o.exp-ue()>=300?Z(r,s,{n:o.n,exp:o.exp,message:Me(r,o.n,o.exp)},t):Z(r,s,await ge(r,s,O(t)),t)}async function Tt(n,s,o,t){let r=n.toString();if(typeof o.n!="string"||!Ve.test(o.n)||typeof o.exp!="number"||!Number.isSafeInteger(o.exp))throw new a("Invalid Priors starter-line proof continuation; start priors_starter_line again.");if(typeof t!="string"||!/^0x[0-9a-fA-F]{130}$/.test(t))throw new a("Provide this wallet's signature of the invite bot's ownership proof.");if(o.exp<=ue())throw new a(`The invite bot's proof for agent #${r} expired before it reached the bot; nothing was sent to it. Call priors_starter_line again for a fresh proof (the bond is not posted again).`);let p=Me(r,o.n,o.exp);if(!V(await Kt({message:p,signature:t}),s))throw new a("The ownership-proof signature is not this wallet's; nothing was sent to the invite bot.");let d=await he(e,n,s);if(H(n,s,d),!V(d.bond.depositor,s))throw new a(`The invite bond for agent #${r} is not on chain from this wallet; nothing was sent to the invite bot. Call priors_starter_line again.`);let w=await Xe(e,{n:o.n,signature:t});if(w.ok!==!0)throw new a(`Priors' invite bot gave no invite for agent #${r}: ${be(w.error)}. ${O(d)}`);if(typeof w.code!="string")throw new a(`Priors' invite bot gave no invite for agent #${r}${w.reason?`: ${be(w.reason)}`:""}${typeof w.decided=="string"?` (its decision: ${be(w.decided)})`:""}. ${O(d)}`);let b=qe(w.code,r,ue()+60);if(!b.ok)throw new a(`Priors' invite bot's code for agent #${r} is not one Oak redeems: ${b.why}. Nothing more was signed. ${O(d)}`);let m=e.clientFor($),h=await m.readContract({address:L,abi:E,functionName:"inviteDigest",args:[n,b.expiry]});if(h.toLowerCase()!==dt(n,b.expiry).toLowerCase())throw new a("TreasurySponsorV4's invite digest differs from its pinned EIP-712 domain; nothing more was signed. Update Oak.");let P=await Zt({hash:h,signature:b.signature}),[l,v]=await Promise.all([m.readContract({address:L,abi:E,functionName:"inviters",args:[P]}),m.readContract({address:L,abi:E,functionName:"inviteUsed",args:[h]})]);if(l!==!0)throw new a(`Priors' invite for agent #${r} was signed by ${P}, which TreasurySponsorV4 does not name an inviter, so the treasury would refuse it. Nothing more was signed. ${O(d)}`);if(v===!0)throw new a(`Priors' invite for agent #${r} was already used. Nothing more was signed. ${O(d)}`);let[I,_]=await Promise.all([m.readContract({address:c.pool,abi:S,functionName:"nonces",args:[n]}),m.getBlock()]),F=_.timestamp+BigInt(st),k=Fe({agentId:r,owner:s,nonce:I.toString(),deadline:F.toString()}),D=await m.readContract({address:c.pool,abi:S,functionName:"consentDigest",args:[{agentId:n,sponsorId:d.root,owner:s,maxPremiumBps:0n,nonce:I,deadline:F}]});if(D.toLowerCase()!==at(k).toLowerCase())throw new a(`The pool's consentDigest (${D}) differs from the consent Oak builds for CreditPoolV2 (${c.pool}), so the pool would refuse it. Nothing more was signed. ${O(d)}`);return{steps:[{kind:"typedData",request:k}],continuation:{stage:"consent",wallet:s,chainId:$,agentId:r,invite:w.code,request:k},summary:`Priors starter line for ERC-8004 agent ${r}, step 3 of 3: Priors' invite bot gave an invite (signed by ${P}, an inviter TreasurySponsorV4 names; it expires ${G(b.expiry)}). Sign your pool consent (EIP-712 "Priors Credit" version 2 on CreditPoolV2 ${c.pool}): it lets Priors' treasury (root #${d.root}) back a line for agent #${r} with premium 0, nonce ${I}, valid until ${G(F)}. A transaction redeeming the invite (TreasurySponsorV4.firstLine) follows for your confirmation. ${O(d)}`}}async function Bt(n,s,o,t){let r=n.toString();if(typeof t!="string"||!/^0x[0-9a-fA-F]{130}$/.test(t))throw new a("Provide this wallet's signature of the Priors pool consent.");let p=qe(o.invite,r,ue()+60);if(!p.ok)throw new a(`The invite for agent #${r} is not one Oak redeems now: ${p.why}. Call priors_starter_line again for a new one.`);let d=Y(o.request)&&Y(o.request.message)?o.request.message:void 0;if(!d||typeof d.nonce!="string"||!/^[0-9]{1,78}$/.test(d.nonce)||typeof d.deadline!="string"||!/^[0-9]{1,20}$/.test(d.deadline))throw new a("Invalid Priors starter-line consent continuation; start priors_starter_line again.");let w=Fe({agentId:r,owner:s,nonce:d.nonce,deadline:d.deadline});if(!V(await Qt({...w,signature:t}),s))throw new a("The pool-consent signature is not this wallet's for the consent Oak built; nothing was offered.");let b=await he(e,n,s);H(n,s,b);let m=e.clientFor($),[h,P]=await Promise.all([m.readContract({address:c.pool,abi:S,functionName:"nonces",args:[n]}),m.getBlock()]);if(h.toString()!==d.nonce)throw new a(`Agent #${r}'s consent nonce moved on chain since it was signed; nothing was offered. Call priors_starter_line again.`);if(P.timestamp>=BigInt(d.deadline))throw new a(`The pool consent for agent #${r} expired at ${G(BigInt(d.deadline))}; nothing was offered. Call priors_starter_line again.`);let l={agentId:n,sponsorId:Ie,owner:s,maxPremiumBps:0n,nonce:h,deadline:BigInt(d.deadline)},v=[n,p.expiry,p.signature,l,t];try{await m.simulateContract({address:L,abi:E,functionName:"firstLine",args:v,account:s})}catch(k){throw new a(`TreasurySponsorV4.firstLine for agent #${r} would be refused: ${ln(e,k)} Nothing was offered. ${O(b)}`)}let I=e.unsignedTx({to:L,data:X({abi:E,functionName:"firstLine",args:v}),value:"0",chainId:$,description:`Redeem Priors' invite for agent ${r}: TreasurySponsorV4.firstLine opens a ${b.firstLineAmount} USDG base-unit line from root ${b.root} with the owner's consent.`}),_=await e.preview([I],s),F=`Redeem agent #${r}'s Priors invite: TreasurySponsorV4.firstLine (${L}) opens a ${A(b.firstLineAmount)} line from Priors' treasury (root #${b.root}) with your signed consent. No USDG moves in this transaction. Then priors_status shows the line and priors_borrow draws it (5 USDG minimum; the fee is pro-rated by term; Priors counts loans held 7 days or more toward the score). The ${A(b.bondAmount)} bond stays in InviteBond until the line is closed with no loan open (priors_close_line, then priors_release_bond, from ${G(b.releaseAt)} at the earliest); a default forfeits it.`;return{txs:[I],summary:ne(e,F,_.changes)}}let Nt={name:"priors_starter_line",inputSchema:{description:"Bond first: the launch bond is 5 USDG, locked at least 4 days. The first result reads amount(), unusedAfter() and unusedReleaseAt(agentId) for current terms before any approval. Invites are not guaranteed; the credit score can lag. Release needs no line or open loan; default can forfeit the bond.",type:"object",additionalProperties:!1,properties:{agentId:Pe("ERC-8004 agent ID this wallet owns, with no Priors record yet (default: the first identity this wallet owns)."),continuation:{type:"object",description:"Opaque state from the previous starter-line step; pass it back unchanged. Omit on the first call; never build it by hand."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Local signature for the confirmed starter-line step, as 0x hex; the bridge supplies it. Never a key."}}},async execute(n,s){z(s);let o=B(s);if(n.continuation===void 0){if(n.signature!==void 0)throw new a("A signature needs its Priors starter-line continuation; start priors_starter_line again.");return J(typeof n.agentId=="string"?n.agentId:void 0,o,()=>Te(n,o))}if(!Y(n.continuation))throw new a("Invalid Priors starter-line continuation; start priors_starter_line again.");let t=n.continuation,r=se(t,o,n),p=d=>J(r.toString(),o,d);if(t.stage==="bond"){if(n.signature!==void 0)throw new a("The bond stage takes no signature; start priors_starter_line again.");return p(()=>Dt(r,o,t))}if(t.stage==="proof")return p(()=>Tt(r,o,t,n.signature));if(t.stage==="consent")return p(()=>Bt(r,o,t,n.signature));throw new a("Unknown Priors starter-line stage; start priors_starter_line again.")}},xt={name:"priors_close_line",inputSchema:{type:"object",properties:{agentId:Pe("ERC-8004 agent ID whose Priors line to close (default: the first identity this wallet owns).")}},async execute(n,s){z(s);let o=B(s),t=await Re(e,n,o);await ze(e,t,o);let r=e.clientFor($),[p,d,w,b]=await Promise.all([r.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[t]}),r.readContract({address:C,abi:U,functionName:"bonds",args:[t]}),r.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[t]}),r.readContract({address:L,abi:E,functionName:"agentId"})]),m=we(p);if(m.sponsor===0n)throw new a(`Agent #${t} has no Priors line to close (no sponsor on CreditPoolV2).`);if(m.activeLoans>0n)throw new a(`Agent #${t} has ${m.activeLoans} loan(s) open; repay them with priors_repay first. The pool's leave refuses while a loan is open.`);let h=ye(d),P=m.sponsor===BigInt(b),l=e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"leave",args:[t]}),value:"0",chainId:$,description:`Close agent ${t}'s Priors line on CreditPoolV2 (leave): the ${m.delegatedIn} USDG base-unit line returns to root ${m.sponsor}.`}),v=await e.preview([l],o),I=V(h.depositor,o)?` Its ${A(h.amount)} invite bond can then come back with priors_release_bond from ${G(w)} (4 days after it was posted).`:"",_=`Close agent #${t}'s Priors line (CreditPoolV2.leave, ${c.pool}): the whole ${A(m.delegatedIn)} line goes back to its backer (${P?`Priors' treasury, root #${b}`:`root #${m.sponsor}`}) and the agent can no longer borrow on it. This does not reopen: ${P?`priors_starter_line opens no second treasury line for an agent with a Priors record; another needs a person at ${Ge}.`:"a new line needs a backer's new consent."}${I} No USDG moves in this transaction.`;return{txs:[l],summary:ne(e,_,v.changes)}}},Lt={name:"priors_release_bond",inputSchema:{type:"object",properties:{agentId:Pe("ERC-8004 agent ID whose InviteBond bond this wallet posted (default: the first identity this wallet owns).")}},async execute(n,s){z(s);let o=B(s),t=await Re(e,n,o),r=e.clientFor($),[p,d,w,b,m]=await Promise.all([r.readContract({address:C,abi:U,functionName:"bonds",args:[t]}),r.readContract({address:C,abi:U,functionName:"releasable",args:[t]}),r.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[t]}),r.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[t]}),r.getBlock()]),h=ye(p);if(h.depositor===Je)throw new a(`Agent #${t} has no bond in Priors' InviteBond (${C}).`);if(!V(h.depositor,o))throw new a(`Agent #${t}'s InviteBond bond was posted by ${h.depositor}, not this wallet, and InviteBond.release pays the depositor. Oak releases only a bond this wallet posted.`);if(d!==!0){let I=we(b),_=I.defaulted?"the agent defaulted, so the bond is forfeited to Priors' Safe (InviteBond.slash)":I.activeLoans>0n?`the agent has ${I.activeLoans} loan(s) open: repay with priors_repay, close the line with priors_close_line, then release`:I.delegatedIn>0n?`the agent still holds a ${A(I.delegatedIn)} line: close it with priors_close_line (no loan may be open), then release`:m.timestamp<w?`it comes back 4 days after it was posted, from ${G(w)}`:"InviteBond does not release it yet";throw new a(`Agent #${t}'s ${A(h.amount)} invite bond cannot be released now: ${_}. Nothing was signed.`)}let P=e.unsignedTx({to:C,data:X({abi:U,functionName:"release",args:[t]}),value:"0",chainId:$,description:`Release agent ${t}'s ${h.amount} USDG base-unit Priors invite bond from InviteBond (${C}) to its depositor ${h.depositor}.`}),l=await e.preview([P],o),v=`Release agent #${t}'s ${A(h.amount)} invite bond from Priors' InviteBond (${C}): InviteBond.release returns it to its depositor, this wallet (${o}).`;return{txs:[P],summary:ne(e,v,l.changes)}}};async function Ot(n){z(n);let s=B(n),o=e.clientFor($),[t,r]=await Promise.all([o.readContract({address:c.pool,abi:S,functionName:"shares",args:[s]}),_e(e,s)]),p=[];if(t>0n){let d=await o.readContract({address:c.pool,abi:S,functionName:"convertToAssets",args:[t]});p.push({module:"priors",id:`priors:lender:${s.toLowerCase()}`,chainId:$,assets:[{token:te,amount:d.toString()}],description:`Priors CreditPoolV2 lender position (${t} shares = ${e.formatAmount(d.toString(),N)} USDG gross).`})}for(let d of r){let w=await o.readContract({address:c.pool,abi:S,functionName:"loansOf",args:[d]}),b=await Promise.all(w.map(async h=>{let P=await o.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[h]});return Ce(h,P)}));for(let h of b)if(h.agentId===d&&h.status===1){let P=h.principal+h.fee;p.push({module:"priors",id:`priors:loan:${h.loanId.toString()}`,chainId:$,assets:[],liabilities:[{token:te,amount:P.toString()}],economics:{principal:[],debt:[rt({token:te,amount:P.toString(),source:"priors.loan.fixedDue",dueAt:h.dueAt.toString()})],rewards:[],backing:[],coverage:{complete:!0}},description:`Priors CreditPoolV2 active loan ${h.loanId} for agent ${d} (fixed due ${e.formatAmount(P.toString(),N)} USDG = ${h.principal} principal + ${h.fee} fee).`})}let m=ye(await o.readContract({address:C,abi:U,functionName:"bonds",args:[d]}));m.amount>0n&&V(m.depositor,s)&&p.push({module:"priors",id:`priors:bond:${d.toString()}`,chainId:$,assets:[{token:te,amount:m.amount.toString()}],description:`Priors invite bond for agent ${d} in InviteBond (${C}): ${A(m.amount)}, back with priors_release_bond once the agent holds no line and no loan, from 4 days after posting; a default forfeits it.`})}return p.push(...await ft(e,s,r,te)),p}return{tools:[i,g,u,f,R,Nt,xt,Lt],positions:Ot}},un=e=>{let i=cn(e),g=[i,ut(e),pt(e),mt(e),ht(e),bt(e),wt(e),gt()];return{...i,tools:g.flatMap(u=>u.tools)}},Bn=e=>et("priors",[un(e)]);export{en as a,He as b,yt as c,$t as d,We as e,St as f,je as g,At as h,c as i,te as j,sn as k,un as l,Bn as m};
@@ -0,0 +1 @@
1
+ var t=Object.freeze({recipient:"0x856bb126188bDB5e425D3ac9D59E9ffBD12e6ECf",bps:25});function i(n){return(BigInt(n)*BigInt(t.bps)/10000n).toString()}var s=BigInt(t.recipient)<<96n|1n<<92n|BigInt(t.bps);function r(n){if(!n)return"Oak fee 0.25% (USD estimate unavailable).";let e=(BigInt(n.amount)*BigInt(n.usdE18)*100n+10n**BigInt(n.decimals)*5n*10n**17n)/(10n**BigInt(n.decimals)*10n**18n);return`Oak fee 0.25% (\u2248 $${e/100n}.${(e%100n).toString().padStart(2,"0")}).`}export{t as a,i as b,s as c,r as d};
@@ -1 +1 @@
1
- import{j as p}from"./6B3VVISQ.js";import{a as d}from"./3MLUCYCB.js";import{a as f}from"./43LI5NKJ.js";import{d as a,i as c}from"./NWNYJ26T.js";import{b as m}from"./IX3GZMTM.js";import{a as i}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
1
+ import{j as p}from"./RLI4JDOL.js";import{a as d}from"./H5DY7CNB.js";import{a as f}from"./43LI5NKJ.js";import{d as a,i as c}from"./NWNYJ26T.js";import{b as m}from"./IX3GZMTM.js";import{a as i}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
@@ -0,0 +1 @@
1
+ import{d as o}from"./ARI72OYT.js";import{a as i}from"./SPRVVJXI.js";import{a}from"./FWD4L3CJ.js";var m=s=>({tools:i.map(e=>{let t=e==="netnet_blackjack_claim"?"seriesId":"sessionId";return{name:e,inputSchema:{description:"Self-only recovery on chain 4663, available without an active identity or subscription; every action requires local human confirmation. Card counts use whole units.",type:"object",additionalProperties:!1,required:[t],properties:{[t]:{type:"string",pattern:"^[1-9][0-9]{0,77}$",description:t==="seriesId"?'Card series id holding your parked blackjack chips, as a decimal string. Example: "1".':'Blackjack session id to settle, as a decimal string. Example: "1".'}}},execute:async(n,c)=>{let r=await o(e,n,c,s.clientFor(a));return{txs:r.txs,summary:r.decision}}}})});export{m as a};
@@ -0,0 +1 @@
1
+ import{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};
@@ -0,0 +1 @@
1
+ import{a as f,b as a}from"./CZL6T2ZQ.js";import{a as s,b as c}from"./ZQ6AF3VX.js";import{a as w}from"./DGCJZ3HO.js";import{a as r}from"./XSD5NL7J.js";import{getAddress as d,isAddressEqual as n,keccak256 as b}from"viem";function u(e){if(!/^[0-9]+$/.test(String(e)))throw new r("Provide a Factor job ID as a non-negative integer.");let t=BigInt(e);if(t>=2n**256n)throw new r("The Factor job ID exceeds uint256.");return t}function y(e,t){if(e.codeHash.toLowerCase()!==a.desk.codeHash)throw new r("Factor desk code hash does not match the pin.");if(!n(e.burnPot,a.burnPot.address))throw new r("Factor desk burn pot does not match the pin.");if(!n(e.gateway,a.gateway.address))throw new r("Factor desk gateway does not match the pin.");if(e.stateDesk==="unreachable"){if(t)throw new r(w.stateUnavailable)}else if(!n(e.stateDesk,a.desk.address))throw new r(w.stateMismatch)}async function P(e){if(await e.getChainId()!==f.chainId)throw new r("Factor requires Robinhood Chain 4663.");let[t,o,i,C]=await Promise.all([e.getCode({address:a.desk.address}),e.readContract({address:a.desk.address,abi:s,functionName:"burnPot"}),e.readContract({address:a.desk.address,abi:s,functionName:"gateway"}),e.readContract({address:a.line.address,abi:c,functionName:"desk"})]);if(!n(C,a.desk.address))throw new r("Factor line desk does not match the pin.");return{codeHash:b(t??"0x"),burnPot:d(o),gateway:d(i)}}async function A(e,t){return e.readContract({address:a.desk.address,abi:s,functionName:"job",args:[u(t)]})}async function D(e,t){let[o,i]=await e.readContract({address:a.desk.address,abi:s,functionName:"canDrawOn",args:[u(t)]});return{early:o.toString(),pool:i.toString()}}async function F(e,t){let o=await e.readContract({address:a.line.address,abi:c,functionName:"keyOf",args:[d(t)]});return d(o)}async function I(e,t){let o=await e.getCode({address:d(t)});return o!==void 0&&o!=="0x"}export{y as a,P as b,A as c,D as d,F as e,I as f};
@@ -0,0 +1 @@
1
+ import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as O,n as F}from"./NWNYJ26T.js";import{a as l}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as R,parseAbi as U}from"viem";var _={source:"https://github.com/beefyfinance/beefy-v2/blob/main/src/config/promos/chain/robinhood.json",observedAt:"2026-10-31",version:2,boosts:[{id:"moo_alandale-cow-robinhood-weth-shop-vault",address:"0xdC955E855148bE11621a74A5B4588846558215d1",token:"0xEBe70034de92614ebe06Cde98C12257f9397dC0e",vaultId:"alandale-cow-robinhood-weth-shop-vault"},{id:"moo_alandale-cow-robinhood-usdg-net-vault",address:"0x3bB573076462ab4E3De4542cFDAa4f36F0Ce082d",token:"0x857b3971E8038a8f8E2C0Da797145447eFbf6b86",vaultId:"alandale-cow-robinhood-usdg-net-vault"},{id:"moo_alandale-cow-robinhood-weth-usdg-vault",address:"0x13ec60CcFFD2cf989912CCBC038D618d3F56a30E",token:"0x4ED469Ac0080bE3CD192530D482E4d321823e743",vaultId:"alandale-cow-robinhood-weth-usdg-vault"},{id:"moo_alandale-cow-robinhood-weth-lute-vault",address:"0xC5ff71a8754c9A9FC0c27EE297025Ea7eEbDD19d",token:"0xd4A452bB077618b931603DbcB60ea43c05eBEa45",vaultId:"alandale-cow-robinhood-weth-lute-vault"},{id:"moo_alandale-cow-robinhood-usdg-lute-vault",address:"0x83a074A41c06c07631e284463ea2bfc3d2f674c5",token:"0xe50D89C43D0D13eE1439Bb5E94876A1163a26434",vaultId:"alandale-cow-robinhood-usdg-lute-vault"},{id:"moo_alandale-cow-robinhood-weth-spy-vault",address:"0xcdDa7830A6F034d66a46919f3D132f53A56a356d",token:"0x87673A619Fc4F3Fc08068A0BB04f60aA2D04ca62",vaultId:"alandale-cow-robinhood-weth-spy-vault"}]};var C=_.boosts.map(c=>({...c,address:R(c.address.toLowerCase()),token:R(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],P=U(["function stakedToken() view returns(address)","function owner() view returns(address)","function whitelisted(address) view returns(bool)","function earned(address) view returns(address[],uint256[])","function stake(uint256)","function withdraw(uint256)","function getReward()","function exit()","function notifyRewardAmount(address,uint256,uint256)","function removeReward(address,address)","function rescueTokens(address,address)","function setWhitelist(address,bool)","function transferOwnership(address)","function renounceOwnership()"]);function w(c){return D(c,"Provide an address.",S)}function x(c){return O(c,"Invalid Beefy reward-pool integer.")}function I(c){return F(c,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}var V=c=>{async function k(e){try{return await e()}catch(o){throw new d(c.plainError(o))}}function A(e,o){if(e.chainId!==void 0&&e.chainId!==l)throw new d("Beefy requires chain 4663.");for(let n of Object.keys(e))if(!["chainId",...o].includes(n))throw new d(`Unsupported Beefy input: ${n}.`)}function T(e){let o=C.find(n=>n.address===w(e.boost));if(!o)throw new d("Choose a pinned Robinhood Beefy v2 boost from beefy_boosts.");return o}async function y(){let e=c.clientFor(l);if(await e.getChainId()!==l)throw new d("The Beefy endpoint must report chain 4663.");let o=x(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:P,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>x(await e.readContract({address:s,abi:B,functionName:"balanceOf",args:[i],blockNumber:o}));async function a(s){let[i,r]=await Promise.all([e.readContract({address:s,abi:B,functionName:"symbol",blockNumber:o}),e.readContract({address:s,abi:B,functionName:"decimals",blockNumber:o})]);if(typeof i!="string"||!i.trim()||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)throw new d("Invalid Beefy boost token metadata.");return{address:s,symbol:i,decimals:r,chainId:l}}async function u(s,i){if(w(await n(s.address,"stakedToken"))!==s.token)throw new d("The Beefy boost staked token no longer matches its pinned configuration.");let r=await n(s.address,"earned",[i]);if(!Array.isArray(r)||r.length!==2||!Array.isArray(r[0])||!Array.isArray(r[1])||r[0].length!==r[1].length||r[0].length>100)throw new d("Invalid Beefy boost rewards.");let m=r[0].map(w);if(new Set(m).size!==m.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(m.map(async(h,g)=>({token:await a(h),amount:x(r[1][g]).toString()})));return{id:s.id,boost:s.address,vaultId:s.vaultId,staked:{token:await a(s.token),amount:(await t(s.address,i)).toString()},rewards:p,block:o.toString(),chainId:l,source:_.source}}return{read:n,balance:t,token:a,pool:u,blockNumber:o}}function f(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:P,functionName:o,args:n}),value:"0",chainId:l,description:`Beefy reward pool: ${o}.`})}async function E(e,o,n,t){return{txs:e,inputs:t,preview:await c.preview(e,o),summary:n}}return{tools:[{name:"beefy_boosts",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=w(o);let n=await y(),t=[];for(let a of C)t.push(await n.pool(a,o));return{boosts:t,summary:"Pinned Robinhood v2 reward pools. Staked moo receipts keep their underlying vault exposure. Earned amounts are estimates; inspect claim preview. Boost receipt acquisition depends on the corresponding vault adapter."}})},{name:"beefy_boost",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["stake","withdraw","claim","exit"],description:"stake: deposit moo receipts into the pool; withdraw: take staked receipts out; claim: collect rewards; exit: withdraw everything and claim."},amount:{description:'For stake and withdraw: amount of moo receipt (stake token) in base units of that token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals. "all" uses the full balance.',anyOf:[v(),{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n=String(e.action);if(!["stake","withdraw","claim","exit"].includes(n))throw new d("Choose stake, withdraw, claim or exit.");A(e,["boost","action",...["stake","withdraw"].includes(n)?["amount"]:[]]),o=w(o);let t=T(e),a=await y();await a.pool(t,o);let u,s=[];if(n==="stake"||n==="withdraw"){let i=n==="stake"?t.token:t.address,r=await a.balance(i,o),m=e.amount==="all"?r:I(e.amount);if(m===0n||m>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:m.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,m.toString(),l)]:[],f(t.address,n,[m])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[f(t.address,n==="claim"?"getReward":"exit")];return E(u,o,`${n} Beefy boost ${t.id}. Withdraw returns moo receipts; exit also claims rewards. Redeem moo receipts with the matching supported vault adapter afterward. No output amount is guaranteed by these calls.`,s)})},{name:"beefy_boost_manage",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"],description:"Owner or manager call: add a reward (notify_reward), remove a reward, rescue stuck tokens, set a manager, transfer ownership, or renounce it permanently."},token:{...b,description:"Address of the reward token for notify_reward, remove_reward or rescue_tokens."},amount:v('For notify_reward: reward amount in base units of the reward token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals.'),duration:v("For notify_reward: reward period in seconds, at least 3600 (86400 = 1 day). Decimal string."),recipient:{...b,description:"Address that receives removed or rescued tokens, or the new owner for transfer_ownership."},manager:{...b,description:"Address of the manager (reward notifier) to enable or disable with set_manager."},enabled:{type:"boolean",description:"For set_manager: true allows the manager to add rewards, false removes them."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n={notify_reward:["token","amount","duration"],remove_reward:["token","recipient"],rescue_tokens:["token","recipient"],set_manager:["manager","enabled"],transfer_ownership:["recipient"],renounce_ownership:[]},t=String(e.action);if(!Object.hasOwn(n,t))throw new d("Choose a documented Beefy reward-pool management action.");A(e,["boost","action",...n[t]]),o=w(o);let a=T(e),u=await y();if(await u.pool(a,o),!(t==="notify_reward"?await u.read(a.address,"whitelisted",[o])===!0:w(await u.read(a.address,"owner"))===o))throw new d("This wallet does not hold the required Beefy reward-pool owner or manager role.");let i=[],r=[];if(t==="notify_reward"){let p=w(e.token),h=I(e.amount),g=I(e.duration);if(p===a.token||g<3600n)throw new d("Reward token must differ from the stake token and duration must be at least 3600 seconds.");if(await u.balance(p,o)<h)throw new d("Insufficient reward token balance.");r.push({token:p,amount:h.toString()}),i.push(c.approval(p,a.address,h.toString(),l),f(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(f(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[w(e.token),w(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(f(a.address,"setWhitelist",[w(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(f(a.address,"transferOwnership",[w(e.recipient)])):i.push(f(a.address,"renounceOwnership"));let m=t==="remove_reward"?" Removing this reward discards all unclaimed entitlements for that token.":t==="renounce_ownership"?" Renouncing ownership permanently gives up owner administration.":"";return E(i,o,`Beefy owner/manager action ${t} on ${a.address}.${m} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=w(e);let o=await y(),n=[];for(let t of C){let a=await o.pool(t,e);a.staked.amount==="0"&&a.rewards.every(u=>u.amount==="0")||n.push({module:"beefy",id:t.address,chainId:l,assets:[a.staked,...a.rewards.filter(u=>u.amount!=="0")],description:`${t.id}: moo receipt stake and estimated claimable rewards at block ${o.blockNumber}. Unstake/exit before redeeming moo receipts.`})}return n})}};export{C as a,H as b,P as c,V as d};
@@ -0,0 +1 @@
1
+ import{d as R,e as z,g as V,h as k,k as I,l as S,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./V37L4DU4.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as H}from"./43LI5NKJ.js";import{a as U}from"./66F5ZH34.js";import{c as _,e as K,g as p,h as G}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function x(t,c,s,g,v){let{chainId:b,registry:O}=k(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(k(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let M=await de({...c,signature:g});if(p(M,s))return!0}catch{}let v=t.clientFor(k(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},F=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function N(t,c){let{chainId:s,registry:g}=k(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return H(v),v}async function L(t,c,s){let{chainId:g,registry:v}=k(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return H(b),b}var Re=t=>{let{chainId:c,registry:s}=k(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return H(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=S(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([N(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:x(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object",description:"Internal continuation returned by the previous local signing round."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Internal hexadecimal signature supplied by local signing; never enter manually."},...te}},async(a,r)=>{let e=S(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await L(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let D=x(t,e,n,T,w);if(!await ue(t,D,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=x(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=x(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",F({agentId:R},["agentId"]),async(a,r)=>{let e=S(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await L(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),M=g("erc8004_transfer",F({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=S(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await N(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([N(t,e),L(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",F({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=S(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await N(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await L(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",F({operator:{..._,description:"Address granted or revoked permission to manage all agents owned by this wallet."},approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",F({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=S(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25,description:"Maximum owned agent IDs to return, from 1 to 50."}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let D of[...T].reverse()){let A=D.args.tokenId.toString();if(!(D.removed||m.has(A))&&(m.add(A),p(await N(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,M,ae,ne,re,oe]}};export{we as a,x as b,Re as c};
@@ -0,0 +1 @@
1
+ import{a as b,b as k,e as w,f as N,g as S}from"./J73ATSEQ.js";import{a as h}from"./66F5ZH34.js";import{c as g,g as E}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as v,erc20Abi as O,getAddress as _,parseAbi as I,zeroAddress as T}from"viem";var x=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),n=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=I(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),M={assets:{description:"One to twenty unique asset addresses to release from the Token Jar; the zero address means native ETH.",type:"array",minItems:1,maxItems:20,items:g},nonce:h("Token Jar release nonce from uniswap_token_jar, as a decimal string."),maxResourceAmount:h('Maximum amount of resource token in base units; use resource token decimals. Example: "1000000" = 1 resource token at 6 decimals.')};function D(a){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:M},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(k);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=a.clientFor(d),e=await s.getBlockNumber(),[R,C,u,f]=await Promise.all([s.readContract({address:n,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:n,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:n,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:n,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(C),x)||R===T)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await w(a,k(R),e),J=await Promise.all(c.map(async l=>({token:await w(a,l,e),amount:(l===T?await s.getBalance({address:x,blockNumber:e}):await s.readContract({address:l,abi:O,functionName:"balanceOf",args:[x],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:J,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let P=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>P)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[a.approval(p.address,n,String(u),d),a.unsignedTx({to:n,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(a,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{x as a,n as b,o as c,D as d};
@@ -0,0 +1 @@
1
+ import{b as ne}from"./F4UQEPJT.js";import{b as ee,e as te}from"./ZOMFHTB2.js";import{a as D,b as W,c as _,d as J,e as z,f as Y,g as Z}from"./J73ATSEQ.js";import{d as V,e as $,w as U}from"./BAIY32AV.js";import{a as H}from"./IOYRL6AY.js";import{a as E}from"./66F5ZH34.js";import{c as b,g as G}from"./NWNYJ26T.js";import{a as S,i as N}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as w,encodeFunctionData as oe,encodePacked as he,erc20Abi as be,getAddress as ce,parseAbi as T,parseAbiParameters as g,zeroAddress as v}from"viem";var ie=ce("0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7"),re=ce(N[4663].ponsTrade.quoter.address),xe=T(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),we=T(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),se=T(["function factory() view returns (address)","function quoteExactInput(bytes path,uint256 amountIn) returns (uint256,uint160[],uint32[],uint256)","function quoteExactOutput(bytes path,uint256 amountOut) returns (uint256,uint160[],uint32[],uint256)"]),F="(address intermediateCurrency,uint24 fee,int24 tickSpacing,address hooks,bytes hookData)",M="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",ae=T([`function quoteExactInput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactOutput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactInputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`,`function quoteExactOutputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`]),ke=g(`(address exactCurrency,${F}[] path,uint256[] minHopPriceX36,uint128 amount,uint128 limit)`);function ve(u,t,r,l){let s=[],e=l?r:t,i=new Set([e]);for(let n of l?[...u].reverse():u){let c=n.currency0===e?n.currency1:n.currency1===e?n.currency0:void 0;if(!c||i.has(c))throw new o("V4 poolKeys must form a continuous route without repeated currencies.");s.push({intermediateCurrency:c,fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks,hookData:"0x"}),e=c,i.add(e)}if(e!==(l?t:r))throw new o("V4 route does not end at the requested currency.");return s}var ge=g(`(${M} poolKey,bool zeroForOne,uint128 amount,uint128 limit,uint256 minHopPriceX36,bytes hookData)`),Ae=g("address recipient,uint256 amount,uint256 limit,bytes path,bool payerIsUser,uint256[] minHopPriceX36"),Pe=g("address recipient,uint256 amount,uint256 limit,address[] path,bool payerIsUser,uint256[] minHopPriceX36"),ue=g("address,uint256"),Ie=g("bytes,bytes[]");function Se(u,t,r){let l=r?[...u].reverse():u,s=r?[...t].reverse():t,e=l[0];return s.forEach((i,n)=>{e=`${e}${he(["uint24","address"],[i,l[n+1]]).slice(2)}`}),e}var de={version:{description:'Uniswap version: "v2" for pairs, "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v2","v3","v4"]},tokenIn:{...b,description:"Input token address; the zero address means native ETH for v4."},tokenOut:{...b,description:"Output token address; the zero address means native ETH for v4."},path:{description:"Two to six distinct ERC-20 token addresses in input-to-output order for v2 or v3.",type:"array",minItems:2,maxItems:6,items:b},fees:{type:"array",description:"One v3 pool fee per path hop, in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",items:{type:"integer",minimum:0,maximum:1e6}},poolKeys:{description:"One to five v4 pool keys in input-to-output route order, without repeated currencies.",type:"array",minItems:1,maxItems:5,items:{type:"object",required:["currency0","currency1","fee","tickSpacing","hooks"],properties:{currency0:{...b,description:"Lower sorted currency address; the zero address means native ETH."},currency1:{...b,description:"Higher sorted currency address."},fee:{type:"integer",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},hooks:{...b,description:"Hook contract address; the zero address means no hook."}},additionalProperties:!1}},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object",properties:{currency0:{...b,description:"Lower sorted currency address; the zero address means native ETH."},currency1:{...b,description:"Higher sorted currency address."},fee:{type:"integer",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},hooks:{...b,description:"Hook contract address; the zero address means no hook."}},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},allowHighFeePools:{description:"Allow pools above Oak's usual fee threshold; review the fee warning before confirming.",type:"boolean"},acceptValueLoss:{description:"Acknowledge the quoted value-loss warning; review the measured loss before confirming.",type:"boolean"},amountIn:E('Amount of input token in base units; use input token decimals. Example: "1000000" = 1 input token at 6 decimals.'),amountOut:E('Amount of output token in base units; use output token decimals. Example: "1000000" = 1 output token at 6 decimals.'),minAmountOut:E('Minimum amount of output token in base units; use output token decimals. Example: "1000000" = 1 output token at 6 decimals.'),maxAmountIn:E('Maximum amount of input token in base units; use input token decimals. Example: "1000000" = 1 input token at 6 decimals.'),slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999}};async function Ee(u,t,r,l=!1){Z(t,Object.keys(de));let s=t.version;if(!["v2","v3","v4"].includes(String(s)))throw new o("Provide version v2, v3 or v4.");let e=t.amountOut!==void 0;if(t.amountIn!==void 0===e)throw new o("Provide exactly one of amountIn or amountOut.");if(e&&t.minAmountOut!==void 0||!e&&t.maxAmountIn!==void 0)throw new o("Use maxAmountIn for exact output, minAmountOut for exact input.");let i=D(e?t.amountOut:t.amountIn,e?"amountOut":"amountIn",s==="v4"?128:160),n=_(t.tokenIn),c=_(t.tokenOut);if(n===c)throw new o("Swap requires different input and output currencies.");let x=u.clientFor(S),p=await x.getBlock(),L=J(t.slippageBps),j,I,m,O,A,f,d,C;if(s==="v4"){if(t.path!==void 0||t.fees!==void 0)throw new o("V4 uses poolKey or poolKeys; omit path and fees.");if(t.poolKey===void 0==(t.poolKeys===void 0))throw new o("Provide poolKey or poolKeys, not both.");if(t.poolKeys!==void 0){if(!Array.isArray(t.poolKeys)||t.poolKeys.length<1||t.poolKeys.length>5)throw new o("Provide 1 to 5 v4 poolKeys.");let a=t.poolKeys.map(P=>U(P));j=a,I=ve(a,n,c,e),m=(await x.simulateContract({address:re,abi:ae,functionName:e?"quoteExactOutput":"quoteExactInput",args:[{exactCurrency:e?c:n,path:I,exactAmount:i}],account:r,gas:H,blockNumber:p.number})).result[0]}else{if(f=U(t.poolKey),![f.currency0,f.currency1].includes(n)||![f.currency0,f.currency1].includes(c))throw new o("PoolKey currencies differ from the requested swap.");m=(await x.simulateContract({address:re,abi:ae,functionName:e?"quoteExactOutputSingle":"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:n===f.currency0,exactAmount:i,hookData:"0x"}],account:r,gas:H,blockNumber:p.number})).result[0]}A="0x10"}else{if(t.poolKey!==void 0||t.poolKeys!==void 0||n===v||c===v)throw new o("V2/v3 routes use ERC-20 tokens; wrap ETH to WETH first.");if(d=Array.isArray(t.path)?t.path.map(W):[n,c],d.length<2||d.length>6||d[0]!==n||d.at(-1)!==c||new Set(d).size!==d.length||d.includes(v))throw new o("Path must contain 2 to 6 distinct ERC-20 tokens in input-to-output order.");if(s==="v2"){if(t.fees!==void 0)throw new o("V2 fees are fixed by the pair; omit fees.");let a=await x.readContract({address:ee,abi:te,functionName:e?"getAmountsIn":"getAmountsOut",args:[i,d],blockNumber:p.number});m=e?a[0]:a.at(-1),A=e?"0x09":"0x08"}else{let a=t.fees;if(!Array.isArray(a)||a.length!==d.length-1||a.some(P=>typeof P!="number"||!Number.isInteger(P)||P<0||P>1e6))throw new o("Provide one integer pool fee in hundredths of a basis point (3000 = 0.3%) per v3 path hop.");if(!G(await x.readContract({address:ie,abi:se,functionName:"factory",blockNumber:p.number}),N[4663].uniswap.v3_factory.address))throw new o("V3 quoter is not configured for the pinned factory.");C=Se(d,a,e),m=(await x.simulateContract({address:ie,abi:se,functionName:e?"quoteExactOutput":"quoteExactInput",args:[C,i],account:r,gas:H,blockNumber:p.number})).result[0],A=e?"0x01":"0x00"}}if(m<=0n)throw new o("No positive Uniswap quote is available.");let k=await ne(x,{version:s,input:n,path:d,fees:t.fees,poolKeys:f?[f]:j,exactOutput:e,amount:i,quoted:m,blockNumber:p.number,allowHighFeePools:t.allowHighFeePools===!0,acceptValueLoss:t.acceptValueLoss===!0}),{confirmationWarnings:pe,...me}=k,R=e?t.maxAmountIn:t.minAmountOut;if(!l&&R===void 0)throw new o(`Provide ${e?"maxAmountIn":"minAmountOut"} from uniswap_quote to confirm the trade bound.`);let y=R===void 0?e?(m*BigInt(1e4+L)+9999n)/10000n:m*BigInt(1e4-L)/10000n:D(R,e?"maxAmountIn":"minAmountOut",s==="v4"?128:160);if(y<=0n||(e?y<m:y>m))throw new o("The fresh quote does not satisfy the confirmed swap bound.");let h=e?y:i;if(h>=1n<<160n||s==="v4"&&(h>=1n<<128n||y>=1n<<128n))throw new o("Swap bounds exceed the router amount range.");let[le,fe]=await Promise.all([z(u,n,p.number),z(u,c,p.number)]),X={...me,version:s,input:{token:le,amount:(e?m:i).toString()},output:{token:fe,amount:(e?i:m).toString()},[e?"maxAmountIn":"minAmountOut"]:y.toString(),blockNumber:p.number.toString(),expiresAt:(p.timestamp+60n).toString()};if(l)return{quote:X,...k.warnings?{warnings:k.warnings}:{},summary:"Read-only on-chain quote. Repeat the same route with the returned bound in uniswap_swap; execution gets a fresh quote and preview."};let q=p.timestamp+300n,K=[],B="Native ETH input; no token approvals.";if(n!==v){let a=await x.readContract({address:n,abi:be,functionName:"allowance",args:[r,V],blockNumber:p.number});a!==h&&K.push(u.approval(n,V,h.toString(),S)),B=`${a===h?"Reuse existing exact ERC-20 allowance of":"Set ERC-20 allowance to exactly"} ${h} input base units to Permit2; exact router permit.`,K.push(u.unsignedTx({to:V,data:oe({abi:we,functionName:"approve",args:[n,$,h,Number(q)]}),value:"0",chainId:S,description:`Permit exactly ${h} input base units to Universal Router until ${q}.`}))}if(s==="v4"){let a=I?w(ke,[{exactCurrency:e?c:n,path:I,minHopPriceX36:[],amount:i,limit:y}]):w(ge,[{poolKey:f,zeroForOne:n===f.currency0,amount:i,limit:y,minHopPriceX36:0n,hookData:"0x"}]);O=w(Ie,[I?e?"0x090c0f":"0x070c0f":e?"0x080c0f":"0x060c0f",[a,w(ue,[n,h]),w(ue,[c,e?i:y])]])}else s==="v2"?O=w(Pe,[r,i,y,d,!0,[]]):O=w(Ae,[r,i,y,C,!0,[]]);let Q=[O];return n===v&&e&&(A=`${A}04`,Q.push(w(g("address,address,uint256"),[v,r,0n]))),K.push(u.unsignedTx({to:$,data:oe({abi:xe,functionName:"execute",args:[A,Q,q]}),value:n===v?h.toString():"0",chainId:S,description:`Uniswap ${s} ${e?"exact output":"exact input"} swap; recipient ${r}; deadline ${q}.`})),{...k.warnings?{warnings:k.warnings}:{},confirmationWarnings:pe,...await Y(u,K,r,`${(k.warnings??[]).join(" ")}${k.warnings?.length?" ":""}Swap through Universal Router 2.1.2. ${B} Fixed output/input bound and five-minute on-chain deadline. Venue fees included; gas excluded.`),quote:X}}function Ue(u){return{tools:[!0,!1].map(t=>({name:t?"uniswap_quote":"uniswap_swap",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenIn","tokenOut"],properties:de},execute:(r,l)=>Ee(u,r,l,t)}))}}export{ie as a,re as b,xe as c,we as d,se as e,ae as f,ke as g,ve as h,ge as i,Ae as j,Pe as k,Se as l,Ee as m,Ue as n};
@@ -1 +1 @@
1
- import{d as b,h as v,l as I,n as k,r as S}from"./N4Q6GN65.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};
1
+ import{d as b,h as v,l as I,n as k,r as S}from"./V37L4DU4.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};
@@ -0,0 +1 @@
1
+ import{erc20Abi as e,parseAbi as n}from"viem";var s=[...e,...n(["function convertToAssets(uint256 shares) view returns (uint256 assets)","function implementation() view returns (address)","function allIndexes() view returns ((address index,address creator,bool verified,bool selfLending,bool makePublic)[])","function getIndex(address _index) view returns ((address index,address creator,bool verified,bool selfLending,bool makePublic))","function isRegistered(address _index) view returns (bool)","function validateIndex(address index) view","function addLPAndStake(address _indexFund,uint256 _amountIdxTokens,address _pairedLpTokenProvided,uint256 _amtPairedLpTokenProvided,uint256 _amountPairedLpTokenMin,uint256 _slippage,uint256 _deadline) payable returns (uint256 _amountOut)","function unstakeAndRemoveLP(address _indexFund,uint256 _amountStakedTokens,uint256 _minLPTokens,uint256 _minPairedLpToken,uint256 _deadline)","function PAIRED_LP_TOKEN() view returns (address)","function bond(address _token,uint256 _amount,uint256 _amountMintMin)","function config() view returns ((address partner,uint256 debondCooldown,bool hasTransferTax,bool blacklistTKNpTKNPoolV2))","function debond(uint256 _amount,address[],uint8[])","function fees() view returns ((uint16 burn,uint16 bond,uint16 debond,uint16 buy,uint16 sell,uint16 partner))","function getAllAssets() view returns ((address token,uint256 weighting,uint256 basePriceUSDX96,address c1,uint256 q1)[])","function lpRewardsToken() view returns (address)","function lpStakingPool() view returns (address)","function totalAssets(address _asset) view returns (uint256 _totalManagedAssets)","function v2Pool() view returns (address)","function INDEX_FUND() view returns (address)","function POOL_REWARDS() view returns (address)","function stakingToken() view returns (address)","function withdrawableStake(address wallet) view returns (uint256)","function claimReward(address _wallet)","function getClaimable(address token,address wallet) view returns (uint256)","function getUnpaid(address _token,address _wallet) view returns (uint256)","function indexFund() view returns (address)","function rewardsToken() view returns (address)","function trackingToken() view returns (address)","function paused(address) view returns (bool)","function token0() view returns (address)","function token1() view returns (address)","function getReserves() view returns (uint112 reserve0,uint112 reserve1,uint32 blockTimestampLast)"])];export{s as a};
@@ -0,0 +1 @@
1
+ import{a as u}from"./DGCJZ3HO.js";import{a as f}from"./SCG5HWMN.js";import{a as n}from"./XSD5NL7J.js";import{a as d}from"./JXOEJPJ4.js";import{getAddress as m,isAddress as w}from"viem";var h="https://factoragents.fun/api/v1",y=/^(?:title|name|does|description|brief|pitch|work|text|needs|delivers)$/i;function s(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function p(t,e=""){return/Eth$/.test(e)&&(typeof t=="number"||typeof t=="string")?String(t):typeof t=="string"&&y.test(e)?d(t):Array.isArray(t)?t.map(r=>p(r,e)):s(t)?Object.fromEntries(Object.entries(t).map(([r,o])=>[r,p(o,r)])):t}function b(t){let e=typeof t=="number"?t:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(t)?Math.floor(Date.parse(t)/1e3):NaN;return Number.isSafeInteger(e)&&e>=0?e:void 0}async function P(t){try{let e=await t(`${h}/state`,{method:"GET",redirect:"error"});if(!e.ok)return"unreachable";let r=await e.json();if(!s(r)||!s(r.contracts)||typeof r.contracts.desk!="string"||!w(r.contracts.desk,{strict:!1}))return"unreachable";let o=b(r.asOf);return o===void 0?"unreachable":{desk:m(r.contracts.desk.toLowerCase()),asOf:o}}catch{return"unreachable"}}async function i(t,e,r){let o;try{o=await t(`${h}${e}`,{method:"GET",redirect:"error"})}catch(a){throw r&&a instanceof f&&a.response.status===404?new n(r):a}if(r&&o.status===404)throw new n(r);if(!o.ok)throw new f(o);let c;try{c=await o.json()}catch{throw new n("Factor API returned malformed JSON.")}if(!s(c))throw new n("Factor API returned an unexpected response.");return{source:u.apiLabel,data:p(c)}}function j(t,e){if(!/^[0-9]+$/.test(String(e)))throw new n("Provide a Factor job ID as a non-negative integer.");return i(t,`/jobs/${encodeURIComponent(String(e))}`,"no such job")}function S(t,e,r="agent"){if(r!=="agent"&&r!=="customer")throw new n("Choose agent or customer for Factor jobs.");let o=new URLSearchParams({[r]:m(e)});return i(t,`/jobs?${o}`)}function O(t){return i(t,"/openjobs")}function $(t,e){if(!e)throw new n("Provide a Factor open job ID.");return i(t,`/openjobs/${encodeURIComponent(e)}`,"no such open job")}export{P as a,j as b,S as c,O as d,$ as e};
@@ -1 +1 @@
1
- import{c as u,f as h}from"./C5ZZAYXD.js";import{i as g,j as k}from"./W6BS3T7S.js";import{d as p,f}from"./BTD5SMOW.js";import{q as m}from"./IY7BXLT4.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
1
+ import{i as g,j as k}from"./F3VDVTMS.js";import{d as p,f}from"./ZP36DSOD.js";import{q as m}from"./BZ34ZR65.js";import{c as u,f as h}from"./C5ZZAYXD.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
@@ -0,0 +1 @@
1
+ import{a as I,b as S,d as g,f as c,g as $,h as p,i as T,k as v,l as R,m as P}from"./PV5FDT6O.js";import{c as f,g as y}from"./NWNYJ26T.js";import{a as h}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{encodeFunctionData as l,erc20Abi as x,parseAbi as E}from"viem";var w=E(["function admin() view returns (address)","function originalAdmin() view returns (address)","function updateAdmin(address)","function updateImage(string)","function updateMetadata(string)","function verify()","function delegate(address)","function burn(uint256)"]),U=m=>{let u=()=>m.clientFor(h),k=(t,a,n,e)=>({name:`clanker_${t}`,inputSchema:{type:"object",properties:a,required:n,additionalProperties:!1},execute:async(r,i)=>{try{return T(r,Object.keys(a)),await e(r,c(i))}catch(o){throw new d(m.plainError(o))}}}),A=async(t,a,n,e)=>{let r=[m.unsignedTx({to:t,data:a,chainId:h,value:"0",description:n})],i=await m.preview(r,e);return{txs:r,preview:i,summary:`${n} ${i.summary}`}},C=async t=>{let[a,n]=await Promise.all([u().readContract({address:t,abi:x,functionName:"symbol"}),u().readContract({address:t,abi:x,functionName:"decimals"})]);if(typeof a!="string"||!a.trim())throw new d("Clanker returned invalid metadata.");return{address:t,symbol:N(a),decimals:p(n,0,255),chainId:h}};return{tools:[k("status",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(t,a)=>{let n=c(t.token),e=await P(m,n),r=await C(n),[i,o,b]=await Promise.all([u().readContract({address:n,abi:x,functionName:"balanceOf",args:[a]}),Promise.all(e.rewardBps.map((s,F)=>u().readContract({address:e.locker,abi:g,functionName:"feePreferences",args:[n,BigInt(F)]}))),Promise.all([n,e.pairedToken].map(async s=>({token:await C(s),amount:v(await u().readContract({address:I.fee_locker.address,abi:E(["function availableFees(address,address) view returns (uint256)"]),functionName:"availableFees",args:[a,s]}))})))]);return{...e,token:r,balance:{token:r,amount:v(i)},feePreferences:o.map(s=>p(s,0,2)),collectedFees:b,summary:"Onchain pool and connected-wallet holdings. Collected fees exclude pending LP fees. Token metadata is untrusted public text."}}),k("update_reward",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},rewardIndex:{type:"integer",minimum:0,maximum:6,description:"Zero-based index of the reward row to change; you must be that row's admin."},field:{enum:["recipient","admin","feePreference"],description:"Which part of the reward row to change; give the matching value in recipient, admin or feePreference."},recipient:{...f,description:"New address that receives this row's fees, for field recipient."},admin:{...f,description:"New admin address for this row, for field admin; hands over future control."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in, for field feePreference: 0 = both tokens, 1 = paired token, 2 = launched token."}},["token","rewardIndex","field"],async(t,a)=>{let n=c(t.token),e=await P(m,n),r=p(t.rewardIndex,0,e.rewardAdmins.length-1);if(!y(e.rewardAdmins[r],a))throw new d("Only this reward index administrator may update its configuration.");let i=t.field;if(!["recipient","admin","feePreference"].includes(String(i)))throw new d("Choose recipient, admin or feePreference.");for(let s of["recipient","admin","feePreference"])if(t[s]!==void 0&&s!==i)throw new d(`Input ${s} does not match field ${String(i)}.`);let o=`Update Clanker reward ${r} ${String(i)} for ${n} to ${String(t[String(i)])}. Existing collected fees keep their prior recipient; transferring admin transfers future control.`,b=i==="feePreference"?l({abi:g,functionName:"updateFeePreference",args:[n,BigInt(r),p(t.feePreference,0,2)]}):l({abi:g,functionName:i==="admin"?"updateRewardAdmin":"updateRewardRecipient",args:[n,BigInt(r),c(t[String(i)])]});return A(e.locker,b,o,a)}),k("update_token",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},field:{enum:["image","metadata","admin","verify","delegate","burn"],description:"Update to make: set image or metadata text, change admin, mark verified, delegate voting power, or burn tokens (irreversible)."},text:{type:"string",description:"New image URL or metadata text, for field image or metadata. Public."},recipient:{...f,description:"New admin address for field admin, or the delegate address for field delegate."},amount:{...S,description:'Amount of the token to burn, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. For field burn.'}},["token","field"],async(t,a)=>{let n=c(t.token);await R(m,n);let e=t.field;if(!["image","metadata","admin","verify","delegate","burn"].includes(String(e)))throw new d("Choose a supported token update.");let r=e==="image"||e==="metadata"?"text":e==="admin"||e==="delegate"?"recipient":e==="burn"?"amount":void 0;for(let o of["text","recipient","amount"])if(t[o]!==void 0&&o!==r)throw new d(`Input ${o} does not match this token update.`);if(["image","metadata","admin","verify"].includes(String(e))){let o=await u().readContract({address:n,abi:w,functionName:e==="verify"?"originalAdmin":"admin"});if(!y(c(o),a))throw new d("The connected wallet is not the required token administrator.")}let i;if(e==="image"||e==="metadata"){if(typeof t.text!="string")throw new d("Provide public metadata text.");i=l({abi:w,functionName:e==="image"?"updateImage":"updateMetadata",args:[t.text]})}else if(e==="admin"||e==="delegate")i=l({abi:w,functionName:e==="admin"?"updateAdmin":"delegate",args:[c(t.recipient,e==="delegate")]});else if(e==="verify")i=l({abi:w,functionName:"verify"});else{let o=$(t.amount);if(!o)throw new d("Provide a positive burn amount.");i=l({abi:w,functionName:"burn",args:[o]})}return A(n,i,`Clanker token ${n}: ${String(e)} ${String(t.text??t.recipient??t.amount??"")}. Burns are irreversible; verification records original-admin approval, not an Oak safety review.`,a)})]}};export{U as a};
@@ -0,0 +1 @@
1
+ import{c as N,f as q,j as $,k as K}from"./U2YCQWZK.js";import{a as M}from"./6WD4HHID.js";import{a as B,i as I}from"./FWD4L3CJ.js";import{formatUnits as Z,getAddress as z,parseAbi as H}from"viem";var l={chainId:4663,usdg:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",v4:{poolManager:"0x8366a39CC670B4001A1121B8F6A443A643e40951",swapper:"0x7Cd4E04E433E69e588728c86A3832753B5F846d4",quoter:"0x8dc178efb8111bb0973dd9d722ebeff267c98f94",stateView:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"},v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},tokens:[{symbol:"AAPL",token:"0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",pools:[{v:3,fee:500,pool:"0xAae0d815EE56e4092a5E5C2911E676Fea50B2d6D"},{v:4,fee:3e3,tickSpacing:60,id:"0xc748f4671a867db48b552f6b7650bf3255e05f80f00e3f7aad1b17ccb7898fdb"},{v:3,fee:3e3,pool:"0x783C9bbB765047CFdD2b84b92b2Ca9F11D34b7Ed"}]},{symbol:"AMD",token:"0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",pools:[{v:3,fee:3e3,pool:"0x48D284A2A4d3DC1b3Da08231Fe44317e7e7Aa51f"}]},{symbol:"AMZN",token:"0x12f190a9F9d7D37a250758b26824B97CE941bF54",pools:[{v:3,fee:3e3,pool:"0x8AC92DA74AB5F3b1d024Dc1943Ad7e15Dc4179Ef"},{v:4,fee:2400,tickSpacing:24,id:"0xefc94885c96b02696b9b45de43eeeb8ac53c0199cab42b4daae4911b96fb8825"}]},{symbol:"ASML",token:"0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",pools:[{v:3,fee:1e4,pool:"0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1"}]},{symbol:"BABA",token:"0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x1791fc651cc794a282e5dbcb56d0b2b38eff8754b677c8876e86901521ecc439"},{v:3,fee:3e3,pool:"0xa57ab582b310dd6f9e934EA1EEEa152741545E6A"}]},{symbol:"COIN",token:"0x6330D8C3178a418788dF01a47479c0ce7CCF450b",pools:[{v:4,fee:2500,tickSpacing:25,id:"0xe2e1a0e32205e854525e0fb1d3667a53bd3b4919f032b9bcd2a038b6b6dac314"},{v:4,fee:1e4,tickSpacing:200,id:"0x007a13fa152f6dc383cad20a8eaab4e1e2538b606936eae2a424f8aa47d6db31"}]},{symbol:"CRCL",token:"0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",pools:[{v:3,fee:3e3,pool:"0x654E4143e82a5824445Ade0824351C2A9ACD95a8"},{v:4,fee:3e3,tickSpacing:30,id:"0x628c98ab436ee34a6a7decd606242890582591bdf7c9a35d90e0d08021c31ea0"},{v:4,fee:1500,tickSpacing:15,id:"0x5177eac8c2176468bbf15e44081e151d35c2e7d068e96d3db94f496a4dc944b2"}]},{symbol:"CRWV",token:"0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x237014478f7ef98afbe7412ac35b6a3f96b8fb111de48b7c4dbf49dba4bd9c4b"}]},{symbol:"DELL",token:"0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",pools:[{v:3,fee:1e4,pool:"0xc30c89cB7815A1488b7998D15eEC73961707Fc5a"}]},{symbol:"GME",token:"0x1b0E319c6A659F002271B69dB8A7df2F911c153E",pools:[{v:3,fee:500,pool:"0xE2b46c905E12Ab8E2f864e4821a4325884C1B126"}]},{symbol:"GOOGL",token:"0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",pools:[{v:3,fee:500,pool:"0x34D0dC122CF9A8Eb296fC5e0D3A233625D7d19b7"},{v:4,fee:300,tickSpacing:3,id:"0x43fe16b75cabbf38f5b185d16142b02d1d9200d8f1ba17cb6cf899f562c6197f"},{v:4,fee:3e3,tickSpacing:60,id:"0xd4ecb79fdc521d7725d22b33ed43cb4e47aa96bfad76aa29577e3151f723ac5e"}]},{symbol:"INTC",token:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",pools:[{v:3,fee:3e3,pool:"0x2e5a92f5013a64661A49312111be2e8aBd33F56a"}]},{symbol:"META",token:"0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",pools:[{v:4,fee:310,tickSpacing:3,id:"0xc58bb68060bcb7b3ea0f6d4a4afef1e57f628722e808db12afb6d1733552872f"},{v:3,fee:3e3,pool:"0x107a7Cb40d8665360ba10E59471Af06150A50922"},{v:4,fee:3e3,tickSpacing:60,id:"0x5875d407a42965b0e768c8925cea290e06fa50603ef34fc99eb92a1050e6ae36"}]},{symbol:"MSFT",token:"0xe93237C50D904957Cf27E7B1133b510C669c2e74",pools:[{v:3,fee:3e3,pool:"0xeb60bCD1D920ad6E102690CCFC6fB488899E1510"},{v:4,fee:3e3,tickSpacing:60,id:"0x9194a557b6a6bb2236b49ea7e2bbccec5d3eeb705aef00903be4b3de1d949579"}]},{symbol:"MSTR",token:"0xec262a75e413fAfD0dF80480274532C79D42da09",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x319bac87e616a89e241c10aeb8afd4892a852cdd8b373cd9765ecddc40b87cfe"},{v:4,fee:2400,tickSpacing:24,id:"0xc105b8300ff65d750a0e4e63c7a879e20504069b770713464a5315e797735326"}]},{symbol:"MU",token:"0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",pools:[{v:3,fee:3e3,pool:"0xd057B1Bc54917855BBee58eAd58647f47caB35E5"}]},{symbol:"NBIS",token:"0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",pools:[{v:4,fee:9900,tickSpacing:99,id:"0x7c2f9ce1214ba9baf56d1b6a1fc640c1b63e9a711172c0c7d10e5a9c4a3d4f0c"}]},{symbol:"NVDA",token:"0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",pools:[{v:3,fee:500,pool:"0xd4EB21209C4D6093f80B5b84f5C45cc093EA14a3"},{v:4,fee:100,tickSpacing:1,id:"0x6444a8e0b267406a15db74ca00c4a24bdfa81ed3180f5b6d0851f8ed6f4f29c5"},{v:4,fee:3e3,tickSpacing:60,id:"0x3bb34a44f1b2b5f32c034c38a53065a521a47b199700fa9bd19d60985ff24bf1"}]},{symbol:"ORCL",token:"0xb0992820E760d836549ba69BC7598b4af75dEE03",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0xc2ce4784e1e72cf0221b51b30c8aaadf6c0b12863cf03ab3687854fb7b1d850a"}]},{symbol:"PLTR",token:"0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",pools:[{v:4,fee:1500,tickSpacing:15,id:"0xc59eaeda6d1a6f031bc7e1d039772f2d675e7b4de2c8668610f4471bd60b3802"},{v:3,fee:3e3,pool:"0x851680416A4f4E1c463d45171d61ACDdBc8554c0"}]},{symbol:"QQQ",token:"0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",pools:[{v:3,fee:500,pool:"0xD60A5d14dB690B7Afad71F76B108071D7175597d"}]},{symbol:"SGOV",token:"0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",pools:[{v:3,fee:500,pool:"0x6Ba50150B17Ffd0972915Aaf04fFd5E8f4Fa49b4"},{v:3,fee:3e3,pool:"0xfAb520051f96F4D2a32c22B6a3dD7fFfdf231bFe"}]},{symbol:"SLV",token:"0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",pools:[{v:3,fee:3e3,pool:"0x8cB787e6c315D464775289BaD00FDD67d53Ecb3D"},{v:3,fee:1e4,pool:"0x0Fa7BC480885DCf58Ad2ef63eC7289cF2481D51c"}]},{symbol:"SNDK",token:"0xB90A19fF0Af67f7779afF50A882A9CfF42446400",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0x2707cb88a6a40fa0f948f58958051ba097d6f6a3cf7f87929bd68ccc5becea24"}]},{symbol:"SPCX",token:"0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",pools:[{v:3,fee:500,pool:"0xc61284332117c3FB23A2A56cceFFD07F7aF60029"},{v:3,fee:3e3,pool:"0xEb07d9587eFD1778dFb9c385Ec43EF6d5F9fE401"}]},{symbol:"SPY",token:"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",pools:[{v:4,fee:100,tickSpacing:1,id:"0xe1ae6a4c6ccc9f037389a8d50a4f577bde1a9fe01d85d88ecbbd39955ce53288"},{v:3,fee:500,pool:"0xa7Bb1AC63BBaB0C44316E6c8C455213441689167"},{v:4,fee:500,tickSpacing:5,id:"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"}]},{symbol:"TSLA",token:"0x322F0929c4625eD5bAd873c95208D54E1c003b2d",pools:[{v:3,fee:3e3,pool:"0xf4ACdAEEB7022862A763C9B1B885e11191c889E3"},{v:4,fee:3e3,tickSpacing:60,id:"0x8517f8071ae5b831b738052f12125e8e3d6c158b78728aa44ce3b25e5104d32e"}]},{symbol:"TSM",token:"0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",pools:[{v:4,fee:7500,tickSpacing:75,id:"0x0ba5d53d2f6255f334b7c8ead4f56b6aef5af3402c5e4d11180afd38c6b85fb1"},{v:3,fee:1e4,pool:"0x07e8Ea83D4C1340774c8965125e26e12bf943bf1"}]},{symbol:"USAR",token:"0xd917B029C761D264c6A312BBbcDA868658eF86a6",pools:[{v:3,fee:3e3,pool:"0x04391780F519B7d3ba59c9590459D76e23d225C4"}]},{symbol:"USO",token:"0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",pools:[{v:4,fee:1200,tickSpacing:15,id:"0x1f2ad5a274a776d8e1408292bde1d92d8fa7b6444acf14ad60b9c3e4e5b66420"},{v:3,fee:3e3,pool:"0x02175608F1b5E6b5ed221cCFdC7Be197D111D915"}]}],notOffered:{CLSK:"thin",EWY:"thin",IONQ:"thin",RGTI:"thin",RKLB:"thin"},sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309"};var u=10n**18n,G=1n<<192n,V=H(["function slot0() view returns (uint160,int24,uint16,uint16,uint16,uint8,bool)","function liquidity() view returns (uint128)","function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]),ee=H(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),c=d=>({usdEstimate:null,estimateLabel:"price unavailable",estimateReason:d}),p=d=>`${d.chainId}:${d.address.toLowerCase()}`;async function se(d,h,A={}){let E=Number.isFinite(A.budgetMs)?Math.min(3e3,Math.max(0,A.budgetMs)):3e3,C=`Oak stopped pricing after ${E===3e3?"3 seconds":`${E} milliseconds`}`,g=new Map,k=[...new Map(h.map(e=>[p(e.token),e.token])).values()],r=!1,x=0,D=[];async function v(e){if(r)throw new Error(C);if(x>=6?await new Promise(t=>D.push(t)):x++,r)throw new Error(C);try{return await e()}finally{let t=D.shift();t?t():x--}}let y=new Map,S=new Map,w=new Map,T;function m(e){let t=y.get(e);if(!t){let a=d.clientFor(e);t=new Proxy(a,{get(n,o,f){let s=Reflect.get(n,o,f);return o==="readContract"?(...i)=>v(async()=>Reflect.apply(s,n,i)):s}}),y.set(e,t)}return t}function P(e){let t=S.get(e);return t||(t=v(()=>m(e).getBlockNumber({cacheTime:0})),S.set(e,t)),t}function O(e,t){return T??=$(e,void 0,t).then(a=>{let n=BigInt(a);if(n<=0n)throw new Error("ETH average unavailable");return n}),T}function Q(e,t){let a=`${e}:${t}`,n=w.get(a);return n||(n=v(()=>m(e).getBlock({blockNumber:t})).then(o=>{if(!(o.number!==t||typeof o.timestamp!="bigint"||o.timestamp<=0n))return o.timestamp.toString()}).catch(()=>{}),w.set(a,n)),n}async function W(e,t){let a=m(e.chainId),n=await P(e.chainId),o;for(let s of t.pools)try{let i=s.v===3,b=z(i?s.pool:l.v4.stateView),J=await a.readContract({address:b,abi:V,functionName:i?"slot0":"getSlot0",args:i?[]:[s.id],blockNumber:n}),F=await a.readContract({address:b,abi:V,functionName:i?"liquidity":"getLiquidity",args:i?[]:[s.id],blockNumber:n}),U=J[0];U>0n&&F>0n&&(!o||F>o.liquidity)&&(o={liquidity:F,sqrt:U})}catch{}if(!o)return c("Oak has no pinned pool with in-range liquidity for this token");let f=BigInt(e.address)<BigInt(l.usdg);return{numerator:f?o.sqrt**2n:G,denominator:(f?G:o.sqrt**2n)*10n**6n,source:`current price in the Uniswap USDG/${t.symbol} pool; on-chain trading can differ from the stock market`,block:n}}async function _(e){if(N(e))return{numerator:1n,denominator:10n**6n,source:"USDG counted at $1.00"};if(e.chainId!==B)return c("Oak has no source for this token");if(A.chopShareTokens?.some(i=>i.toLowerCase()===e.address.toLowerCase()))return c("chop_logs shows this log's backing");let t=e.symbol;if(t.startsWith("untrusted "))try{let i=JSON.parse(t.slice(10));typeof i=="string"&&(t=i)}catch{}if(t==="CHOP")return c("Oak has no pinned market for CHOP. A quote is a sale for this amount only; Oak never uses it to value a balance.");let a=l.tokens.find(i=>i.token.toLowerCase()===e.address.toLowerCase());if(a)return W(e,a);if(Object.hasOwn(l.notOffered,t))return c("Oak has no pinned market for this token");let n=m(e.chainId),o=await P(e.chainId);if(q(e))return{numerator:await O(n,o),denominator:u*u,source:"30-minute average of the Uniswap ETH/USDG pool",block:o};let f=(d.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS)?.toLowerCase()===e.address.toLowerCase();if(f)try{let i=d.resolvePrice?await d.resolvePrice(e,o):await K(e,{client:n,blockNumber:o,oakTokenAddress:e.address,officialStockTokens:[]}),b=BigInt(i.usdE18);if(b<=0n)throw new Error("OAK price unavailable");return{numerator:b,denominator:u*10n**BigInt(e.decimals),source:"OAK price",block:o}}catch{}if(f&&(await n.readContract({address:I[B].pons.factory.address,abi:ee,functionName:"getLaunchedToken",args:[e.address],blockNumber:o})).phase!==2)return c("Oak has no graduated Pons pool price for OAK");let s=await M(e,n,o);return s.numerator<=0n||s.denominator<=0n?c("Oak has no source for this token"):{numerator:await O(n,o)*s.numerator,denominator:u*s.denominator*10n**BigInt(e.decimals),source:f?"OAK's current Pons pool price; fewer than enough trades in 30 minutes for a price":"current Pons pool price",block:o}}let L=0;async function j(){for(;!r&&L<k.length;){let e=k[L++],t;try{if(!Number.isInteger(e.decimals)||e.decimals<0||e.decimals>255)throw new Error("Invalid decimals");if(t=await _(e),r||g.set(p(e),t),"numerator"in t&&t.block!==void 0){let a=await Q(e.chainId,t.block);r||(t.observedAt=a)}}catch{t=c("Oak has no source for this token")}r||g.set(p(e),t)}}let R,Y=new Promise(e=>{R=setTimeout(()=>{r=!0;for(let t of D.splice(0))t();e()},E)});try{await Promise.race([Promise.all(Array.from({length:Math.min(6,k.length)},j)),Y])}finally{clearTimeout(R),r=!0}return h.map(e=>{let t;try{if(!/^\d+$/.test(e.amount)||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)throw new Error("Invalid amount");t="humanAmount"in e&&typeof e.humanAmount=="string"?e.humanAmount:Z(BigInt(e.amount),e.token.decimals);let a=g.get(p(e.token));if(a&&"numerator"in a){let o=(BigInt(e.amount)*a.numerator*100n*2n+a.denominator)/(a.denominator*2n);return{...e,humanAmount:t,usdEstimate:`${o/100n}.${(o%100n).toString().padStart(2,"0")}`,estimateLabel:"estimate, not a quote",estimateSource:a.source,unitUsdE18:(a.numerator*10n**BigInt(e.token.decimals)*u/a.denominator).toString(),...a.observedAt===void 0?{}:{observedAt:a.observedAt},...a.block===void 0?{}:{estimateAsOf:a.block.toString()}}}return{...e,humanAmount:t,...a??c(C)}}catch{return{...e,...t===void 0?{}:{humanAmount:t},...c("Oak cannot format this token amount")}}})}export{se as a};
@@ -0,0 +1 @@
1
+ import{a as D}from"./43LI5NKJ.js";import{b as Q}from"./IX3GZMTM.js";import{a as x,i as J}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as se,encodeAbiParameters as Z,encodeFunctionData as F,erc20Abi as O,getAddress as g,keccak256 as ee,parseAbi as L,parseAbiParameters as oe,zeroAddress as te}from"viem";var I=10n**18n,$=(1n<<256n)-1n,q=g(J[x].morpho.morpho_blue.address),_=oe("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),w=L(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function forceDeallocatePenalty(address) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function owner() view returns (address)","function curator() view returns (address)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function forceDeallocate(address adapter,bytes data,uint256 assets,address onBehalf) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function multicall(bytes[] data)"]),v=L(["function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)"]),ne=L(["function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),M=(e,t)=>e<t?e:t,T=(e,t)=>(e+t-1n)/t;function p(e){if(typeof e!="bigint"||e<0n||e>$)throw new r("Invalid Morpho V2 integer read.");return e}function he(e){if(typeof e!="string")throw new r("Provide maxPenaltyAssets as a USDG base-unit integer string, including 0 for no penalty.");let t=Q(e);if(t>$)throw new r("Penalty limit exceeds uint256.");return t}function h(e){if(typeof e!="string")throw new r("Invalid Morpho V2 address read.");return D(e),g(e)}async function ae(e,t,n){if(await e.getChainId()!==x||n.chainId!==x)throw new r("Vault exit requires chain 4663.");let c=await e.getBlockNumber({cacheTime:0}),a=(m,y,k,S=[])=>e.readContract({address:m,abi:y,functionName:k,args:S,blockNumber:c}),[d,o,i,l,u]=await Promise.all([a(t,w,"adaptersLength"),a(t,w,"liquidityAdapter"),a(t,w,"liquidityData"),a(g(n.address),O,"balanceOf",[t]),a(g(n.address),O,"balanceOf",[q])]);if(p(d)!==1n)throw new r("Force exit requires exactly one verified MorphoMarketV1AdapterV2. This vault needs a separately qualified adapter plan.");let s=h(await a(t,w,"adapters",[0n])),C=h(o);if(C!==te&&C!==s)throw new r("The liquidity adapter is not the supported market adapter.");let[A,N,P,f,B]=await Promise.all([a(s,v,"parentVault"),a(s,v,"asset"),a(s,v,"morpho"),a(s,v,"marketIdsLength"),a(t,w,"forceDeallocatePenalty",[s])]);if(h(A)!==g(t)||h(N)!==g(n.address)||h(P)!==q)throw new r("The adapter does not match this vault and pinned Morpho Blue deployment.");let b=p(f);if(b>64n)throw new r("The adapter market inventory exceeds this reader\u2019s supported size.");let E=p(B);if(E>I/50n)throw new r("The force-deallocation penalty exceeds the documented 2% maximum.");let H;if(C!==te){if(typeof i!="string")throw new r("Invalid liquidity-market data.");let[m]=se(_,i);H=ee(Z(_,[m])).toLowerCase()}let V=await Promise.all(Array.from({length:Number(b)},(m,y)=>a(s,v,"marketIds",[BigInt(y)])));if(V.some(m=>typeof m!="string"||!/^0x[0-9a-f]{64}$/i.test(m))||new Set(V.map(m=>String(m).toLowerCase())).size!==V.length)throw new r("The adapter returned an invalid or duplicate market ID.");let R=await Promise.all(V.map(async m=>{let y=m,[k,S,ie]=await Promise.all([a(q,ne,"idToMarketParams",[y]),a(q,ne,"market",[y]),a(s,v,"expectedSupplyAssets",[y])]);if(!Array.isArray(k)||k.length!==5||!Array.isArray(S)||S.length!==6)throw new r("Invalid Morpho market state.");let z={loanToken:h(k[0]),collateralToken:h(k[1]),oracle:h(k[2]),irm:h(k[3]),lltv:p(k[4])},j=Z(_,[z]);if(ee(j).toLowerCase()!==y.toLowerCase()||z.loanToken!==g(n.address))throw new r("Morpho market identity or loan asset does not match the vault.");let G=p(S[0]),X=p(S[2]);if(X>G)throw new r("Invalid Morpho market liquidity.");let Y=p(ie),K=G-X;return{id:y,adapter:s,data:j,supplied:Y,liquidity:K,capacity:M(Y,K),penalty:E,normal:y.toLowerCase()===H}})),U=p(l),W=p(u),re=U+M(W,R.filter(m=>m.normal).reduce((m,y)=>m+y.capacity,0n));return{vault:t,blockNumber:c,idle:U,blueCash:W,normalCapacity:re,markets:R}}function de(e,t){if(t<=0n||t>$)throw new r("Force exit needs a positive position value.");let n=t>e.normalCapacity?t-e.normalCapacity:0n,c=[],a=e.blueCash-(e.normalCapacity-e.idle);for(let d of e.markets.filter(o=>!o.normal).sort((o,i)=>o.capacity===i.capacity?o.id.localeCompare(i.id):o.capacity>i.capacity?-1:1)){if(n===0n)break;let o=M(d.capacity,a);if(o===0n)continue;let i=s=>s+T(s*d.penalty,I),l=o;i(o)>=n&&(l=T(n*I,I+d.penalty),l>0n&&i(l-1n)>=n&&(l-=1n),l=M(o,l+(T(t,10000n)||1n)));let u=T(l*d.penalty,I);c.push({...d,amount:l,penaltyAssets:u}),a-=l,n=i(l)>=n?0n:n-i(l)}if(n>0n)throw new r("Underlying market liquidity cannot cover this force exit. Request a partial withdrawal or use a separately supported in-kind exit; force deallocation cannot create liquidity.");return{requestedAssets:t,normalCapacity:e.normalCapacity,legs:c,penaltyAssets:c.reduce((d,o)=>d+o.penaltyAssets,0n)}}async function we(e,t,n,c,a,d,o){let i=await ae(t,n,o),l=p(await t.readContract({address:n,abi:O,functionName:"balanceOf",args:[c],blockNumber:i.blockNumber}));if(a<=0n||a>l)throw new r("The fresh share balance cannot cover this exit.");let u=p(await t.readContract({address:n,abi:w,functionName:"previewRedeem",args:[a],blockNumber:i.blockNumber})),s=de(i,u);if(s.penaltyAssets>d)throw new r("The force-exit penalty exceeds maxPenaltyAssets. Inspect a fresh plan before authorizing a larger penalty.");let A=(await Promise.all(s.legs.map(b=>t.readContract({address:n,abi:w,functionName:"previewWithdraw",args:[b.penaltyAssets],blockNumber:i.blockNumber})))).reduce((b,E)=>b+p(E),0n);if(A>=a)throw new r("The penalty would consume the share balance.");let N=a-A,P=s.legs.map(b=>F({abi:w,functionName:"forceDeallocate",args:[b.adapter,b.data,b.amount,c]})),f=F({abi:w,functionName:"redeem",args:[N,c,c]});return P.push(f),{tx:e.unsignedTx({to:n,chainId:x,value:"0",data:s.legs.length?F({abi:w,functionName:"multicall",args:[P]}):f,description:`Exit this wallet\u2019s Morpho V2 shares; estimated penalty ${s.penaltyAssets} ${o.symbol} base units. No approvals.`}),plan:s,penaltyShares:A,redeemShares:N,blockNumber:i.blockNumber}}var ye="This vault lists no lending markets right now, and Morpho's index shows 0% over this window. On these numbers it earns nothing.";async function be(e,t){try{let n=p(await e.readContract({address:t,abi:w,functionName:"adaptersLength"}));if(n>8n)return;let c=await Promise.all(Array.from({length:Number(n)},(d,o)=>e.readContract({address:t,abi:w,functionName:"adapters",args:[BigInt(o)]})));return(await Promise.all(c.map(d=>e.readContract({address:h(d),abi:v,functionName:"marketIdsLength"})))).every(d=>p(d)===0n)}catch{return}}var ce="In-kind exits transfer supported market positions rather than cash; use the project in_kind_exit tool.";function ge(e,t,n,c,a=ce){return{name:t,inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(d,o)=>{try{if(D(o),Object.keys(d).length)throw new r("Vault details takes no arguments.");let i=e.clientFor(x);if(await i.getChainId()!==x)throw new r("Vault details requires chain 4663.");let l=await i.readContract({address:n,abi:L(["function asset() view returns (address)"]),functionName:"asset"});if(h(l)!==g(c.address))throw new r("The vault does not use the pinned underlying asset.");let u=await ae(i,n,c),[s,C,A,N]=await Promise.all(["performanceFee","managementFee","owner","curator"].map(f=>i.readContract({address:n,abi:w,functionName:f,blockNumber:u.blockNumber}))),P={...c,address:g(c.address)};return{vault:n,chainId:x,blockNumber:u.blockNumber.toString(),asset:P,owner:h(A),curator:h(N),idleAssets:u.idle.toString(),normalCapacityAssets:u.normalCapacity.toString(),markets:u.markets.map(f=>({marketId:f.id,adapter:f.adapter,suppliedAssets:f.supplied.toString(),marketLiquidityAssets:f.liquidity.toString(),capacityAssets:f.capacity.toString(),liquidityMarket:f.normal,penaltyWad:f.penalty.toString()})),fees:{performanceFeeWad:p(s).toString(),managementFeePerSecondWad:p(C).toString(),scale:I.toString()},apy:null,apyStatus:"This onchain snapshot does not include APY. Use the module analytics tool for indexed historical APY; maxRate is an accrual ceiling.",capacityCaveat:`Snapshot estimates; gates, price accrual, liquidity and penalties can change. Preview the exact action. Force exits may leave share rounding dust. ${a}`}}catch(i){throw new r(e.plainError(i))}}}}function ke(e,t){return`Force-exit estimate: position ${e.requestedAssets} ${t} base units; penalty ${e.penaltyAssets}; net estimate ${e.requestedAssets-e.penaltyAssets}; effective penalty ${T(e.penaltyAssets*10000n,e.requestedAssets)} bps (rounded up). Penalty limit is a local preview check, not a calldata bound. Re-preview before signing and recheck positions for rounding dust.`}function xe(e,t,n,c,a){let d=(i,l)=>e.filter(u=>u.token.chainId===x&&u.token.address.toLowerCase()===i.toLowerCase()).reduce((u,s)=>{if(s.token.decimals!==l||!/^-?\d+$/.test(s.amount))throw new r("Invalid force-exit preview metadata.");return u+BigInt(s.amount)},0n),o=-d(t,18);if(o<=0n||o>n||d(g(a.address),a.decimals)<c)throw new r("The force-exit preview exceeds the share balance or returns less than minAmountOut.")}export{w as a,p as b,he as c,ae as d,de as e,we as f,ye as g,be as h,ge as i,ke as j,xe as k};