@oakagentkit/core 0.2.6 → 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 (651) 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 +15 -10
  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.js +1 -1
  22. package/build/dist/api/modules/chop/abi.d.ts +31 -0
  23. package/build/dist/api/modules/chop/abi.js +1 -1
  24. package/build/dist/api/modules/chop/actions.js +1 -1
  25. package/build/dist/api/modules/chop/checks.d.ts +13 -5
  26. package/build/dist/api/modules/chop/checks.js +1 -1
  27. package/build/dist/api/modules/chop/copy.d.ts +11 -1
  28. package/build/dist/api/modules/chop/copy.js +1 -1
  29. package/build/dist/api/modules/chop/guard.js +1 -1
  30. package/build/dist/api/modules/chop/index.js +1 -1
  31. package/build/dist/api/modules/chop/positions.js +1 -1
  32. package/build/dist/api/modules/chop/reader.d.ts +132 -7
  33. package/build/dist/api/modules/chop/reader.js +1 -1
  34. package/build/dist/api/modules/chop/types.d.ts +12 -0
  35. package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
  36. package/build/dist/api/modules/clanker/extensions.js +1 -1
  37. package/build/dist/api/modules/clanker/index.js +1 -1
  38. package/build/dist/api/modules/clanker/manage.js +1 -1
  39. package/build/dist/api/modules/clanker/pool-config.d.ts +15 -0
  40. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  41. package/build/dist/api/modules/clanker/protocol.js +1 -1
  42. package/build/dist/api/modules/earn/copy.d.ts +32 -10
  43. package/build/dist/api/modules/earn/copy.js +1 -1
  44. package/build/dist/api/modules/earn/cost.d.ts +11 -1
  45. package/build/dist/api/modules/earn/cost.js +1 -1
  46. package/build/dist/api/modules/earn/index.js +1 -1
  47. package/build/dist/api/modules/earn/lp.d.ts +14 -1
  48. package/build/dist/api/modules/earn/lp.js +1 -1
  49. package/build/dist/api/modules/earn/options.d.ts +6 -4
  50. package/build/dist/api/modules/earn/options.js +1 -1
  51. package/build/dist/api/modules/erc8004/common.d.ts +1 -1
  52. package/build/dist/api/modules/erc8004/common.js +1 -1
  53. package/build/dist/api/modules/erc8004/domain.js +1 -1
  54. package/build/dist/api/modules/erc8004/index.js +1 -1
  55. package/build/dist/api/modules/erc8004/management.js +1 -1
  56. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  57. package/build/dist/api/modules/erc8004/services.js +1 -1
  58. package/build/dist/api/modules/erc8004/validation.js +1 -1
  59. package/build/dist/api/modules/factor/abi.d.ts +642 -0
  60. package/build/dist/api/modules/factor/abi.js +1 -0
  61. package/build/dist/api/modules/factor/actions.d.ts +15 -0
  62. package/build/dist/api/modules/factor/actions.js +1 -0
  63. package/build/dist/api/modules/factor/api.d.ts +7 -0
  64. package/build/dist/api/modules/factor/api.js +1 -0
  65. package/build/dist/api/modules/factor/checks.d.ts +11 -0
  66. package/build/dist/api/modules/factor/checks.js +1 -0
  67. package/build/dist/api/modules/factor/copy.d.ts +33 -0
  68. package/build/dist/api/modules/factor/copy.js +1 -0
  69. package/build/dist/api/modules/factor/guard.d.ts +12 -0
  70. package/build/dist/api/modules/factor/guard.js +1 -0
  71. package/build/dist/api/modules/factor/index.d.ts +16 -0
  72. package/build/dist/api/modules/factor/index.js +8 -0
  73. package/build/dist/api/modules/factor/messages.d.ts +46 -0
  74. package/build/dist/api/modules/factor/messages.js +1 -0
  75. package/build/dist/api/modules/factor/pins.d.ts +64 -0
  76. package/build/dist/api/modules/factor/pins.js +1 -0
  77. package/build/dist/api/modules/factor/reader.d.ts +17 -0
  78. package/build/dist/api/modules/factor/reader.js +1 -0
  79. package/build/dist/api/modules/factor/types.d.ts +18 -0
  80. package/build/dist/api/modules/factor/types.js +0 -0
  81. package/build/dist/api/modules/gloam/copy.d.ts +4 -3
  82. package/build/dist/api/modules/gloam/copy.js +2 -2
  83. package/build/dist/api/modules/gloam/index.js +1 -1
  84. package/build/dist/api/modules/grove/index.js +1 -1
  85. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  86. package/build/dist/api/modules/heyresearch/index.js +1 -1
  87. package/build/dist/api/modules/heyresearch/public-reads.d.ts +29 -1
  88. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  89. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  90. package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
  91. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  92. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  93. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  94. package/build/dist/api/modules/hoodag/index.js +1 -1
  95. package/build/dist/api/modules/hoodag/management.js +1 -1
  96. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  97. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  98. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  99. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  100. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  101. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  102. package/build/dist/api/modules/hoodlock/index.js +1 -1
  103. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  104. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  105. package/build/dist/api/modules/hoodlock/public.js +1 -1
  106. package/build/dist/api/modules/hookr/actions.js +1 -1
  107. package/build/dist/api/modules/hookr/addons.js +1 -1
  108. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  109. package/build/dist/api/modules/hookr/contracts.d.ts +2 -1
  110. package/build/dist/api/modules/hookr/contracts.js +1 -1
  111. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  112. package/build/dist/api/modules/hookr/discovery.js +1 -1
  113. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  114. package/build/dist/api/modules/hookr/index.js +1 -1
  115. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  116. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  117. package/build/dist/api/modules/hookr/launch.js +1 -1
  118. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  119. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  120. package/build/dist/api/modules/hookr/lp-reads.d.ts +2 -0
  121. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  122. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  123. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  124. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  125. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  126. package/build/dist/api/modules/hookr/relay.js +1 -1
  127. package/build/dist/api/modules/hookr/revenue.js +1 -1
  128. package/build/dist/api/modules/kyberswap/index.js +1 -1
  129. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  130. package/build/dist/api/modules/layerbank/actions.js +1 -1
  131. package/build/dist/api/modules/layerbank/index.js +1 -1
  132. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  133. package/build/dist/api/modules/layerbank/reader.js +1 -1
  134. package/build/dist/api/modules/lighter/index.js +1 -1
  135. package/build/dist/api/modules/longbow/administration.js +1 -1
  136. package/build/dist/api/modules/longbow/fixed.js +1 -1
  137. package/build/dist/api/modules/longbow/index.js +1 -1
  138. package/build/dist/api/modules/longbow/nft.js +1 -1
  139. package/build/dist/api/modules/longbow/rebates.js +1 -1
  140. package/build/dist/api/modules/longbow/staking.js +1 -1
  141. package/build/dist/api/modules/meridian/index.js +1 -1
  142. package/build/dist/api/modules/meridian/markets.js +1 -1
  143. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  144. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  145. package/build/dist/api/modules/meridian/perps.js +1 -1
  146. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  147. package/build/dist/api/modules/meridian/rfq.js +1 -1
  148. package/build/dist/api/modules/merkl/discovery.js +1 -1
  149. package/build/dist/api/modules/merkl/index.js +1 -1
  150. package/build/dist/api/modules/merkl/manage.js +1 -1
  151. package/build/dist/api/modules/merkl/protocol.js +1 -1
  152. package/build/dist/api/modules/morpho/allocator.js +1 -1
  153. package/build/dist/api/modules/morpho/bundles.js +1 -1
  154. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  155. package/build/dist/api/modules/morpho/index.js +1 -1
  156. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  157. package/build/dist/api/modules/morpho/midnight.js +1 -1
  158. package/build/dist/api/modules/morpho/protocol.js +1 -1
  159. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  160. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  161. package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
  162. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  163. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  164. package/build/dist/api/modules/netnet/card-read.js +1 -1
  165. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  166. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  167. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  168. package/build/dist/api/modules/netnet/financial.js +1 -1
  169. package/build/dist/api/modules/netnet/index.js +1 -1
  170. package/build/dist/api/modules/netnet/staking.js +1 -1
  171. package/build/dist/api/modules/orbio/gateway.js +1 -1
  172. package/build/dist/api/modules/orbio/index.js +1 -1
  173. package/build/dist/api/modules/pendle/convert.js +1 -1
  174. package/build/dist/api/modules/pendle/costs.js +1 -1
  175. package/build/dist/api/modules/pendle/index.js +1 -1
  176. package/build/dist/api/modules/pendle/markets.js +1 -1
  177. package/build/dist/api/modules/pendle/positions.js +1 -1
  178. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  179. package/build/dist/api/modules/pendle/reader.js +1 -1
  180. package/build/dist/api/modules/pendle/redeem.js +1 -1
  181. package/build/dist/api/modules/pendle/trade.js +1 -1
  182. package/build/dist/api/modules/pendle/validate.js +1 -1
  183. package/build/dist/api/modules/pons/claim.js +1 -1
  184. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  185. package/build/dist/api/modules/pons/index.js +1 -1
  186. package/build/dist/api/modules/pons/launch-status.js +1 -1
  187. package/build/dist/api/modules/pons/reads.js +1 -1
  188. package/build/dist/api/modules/pons/trade.d.ts +3 -2
  189. package/build/dist/api/modules/pons/trade.js +1 -1
  190. package/build/dist/api/modules/poolstrade/index.js +1 -1
  191. package/build/dist/api/modules/priors/coverage.js +1 -1
  192. package/build/dist/api/modules/priors/discovery.js +1 -1
  193. package/build/dist/api/modules/priors/features.js +1 -1
  194. package/build/dist/api/modules/priors/holdings.js +1 -1
  195. package/build/dist/api/modules/priors/index.js +1 -1
  196. package/build/dist/api/modules/priors/integration.d.ts +1 -0
  197. package/build/dist/api/modules/priors/integration.js +1 -1
  198. package/build/dist/api/modules/priors/market.js +1 -1
  199. package/build/dist/api/modules/priors/pt.js +1 -1
  200. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  201. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  202. package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
  203. package/build/dist/api/modules/raeto/authorization.js +1 -0
  204. package/build/dist/api/modules/raeto/copy.d.ts +46 -0
  205. package/build/dist/api/modules/raeto/copy.js +1 -0
  206. package/build/dist/api/modules/raeto/errors.d.ts +4 -0
  207. package/build/dist/api/modules/raeto/errors.js +1 -0
  208. package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
  209. package/build/dist/api/modules/raeto/estimate.js +1 -0
  210. package/build/dist/api/modules/raeto/index.d.ts +16 -0
  211. package/build/dist/api/modules/raeto/index.js +1 -0
  212. package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
  213. package/build/dist/api/modules/raeto/pairing.js +1 -0
  214. package/build/dist/api/modules/raeto/pins.d.ts +24 -0
  215. package/build/dist/api/modules/raeto/pins.js +1 -0
  216. package/build/dist/api/modules/raeto/templates.d.ts +22 -0
  217. package/build/dist/api/modules/raeto/templates.js +1 -0
  218. package/build/dist/api/modules/raeto/terms.d.ts +8 -0
  219. package/build/dist/api/modules/raeto/terms.js +1 -0
  220. package/build/dist/api/modules/raeto/types.d.ts +64 -0
  221. package/build/dist/api/modules/raeto/types.js +0 -0
  222. package/build/dist/api/modules/relay/api.d.ts +16 -0
  223. package/build/dist/api/modules/relay/api.js +1 -1
  224. package/build/dist/api/modules/relay/discovery.js +1 -1
  225. package/build/dist/api/modules/relay/inbound.js +1 -1
  226. package/build/dist/api/modules/relay/index.d.ts +1 -0
  227. package/build/dist/api/modules/relay/index.js +1 -1
  228. package/build/dist/api/modules/relay/order.js +1 -1
  229. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  230. package/build/dist/api/modules/relay/readiness.d.ts +1 -0
  231. package/build/dist/api/modules/relay/readiness.js +1 -1
  232. package/build/dist/api/modules/relay/reads.js +1 -1
  233. package/build/dist/api/modules/relay/vaults.js +1 -1
  234. package/build/dist/api/modules/spark/actions.js +1 -1
  235. package/build/dist/api/modules/spark/index.js +1 -1
  236. package/build/dist/api/modules/spark/management.js +1 -1
  237. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  238. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  239. package/build/dist/api/modules/steakhouse/index.js +1 -1
  240. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  241. package/build/dist/api/modules/steakhouse/management.js +1 -1
  242. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  243. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  244. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.d.ts +1 -0
  249. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  250. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  251. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  252. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  253. package/build/dist/api/modules/tickerspring/research.js +1 -1
  254. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  256. package/build/dist/api/modules/uniswap/auction.js +1 -1
  257. package/build/dist/api/modules/uniswap/batch.js +1 -1
  258. package/build/dist/api/modules/uniswap/common.js +1 -1
  259. package/build/dist/api/modules/uniswap/fee-percent.d.ts +4 -0
  260. package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
  261. package/build/dist/api/modules/uniswap/fees.js +1 -1
  262. package/build/dist/api/modules/uniswap/index.js +1 -1
  263. package/build/dist/api/modules/uniswap/local-guard.d.ts +2 -0
  264. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  265. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  266. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  267. package/build/dist/api/modules/uniswap/pools.d.ts +2 -0
  268. package/build/dist/api/modules/uniswap/pools.js +1 -1
  269. package/build/dist/api/modules/uniswap/position.js +1 -1
  270. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  271. package/build/dist/api/modules/uniswap/quote-guard.d.ts +38 -0
  272. package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
  273. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  274. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  275. package/build/dist/api/modules/uniswap/trade.d.ts +10 -3
  276. package/build/dist/api/modules/uniswap/trade.js +1 -1
  277. package/build/dist/api/modules/uniswap/v2.js +1 -1
  278. package/build/dist/api/modules/uniswap/v3.js +1 -1
  279. package/build/dist/api/modules/uniswap/v4.d.ts +6 -0
  280. package/build/dist/api/modules/uniswap/v4.js +1 -1
  281. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  282. package/build/dist/api/modules/velora/claims.js +1 -1
  283. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  284. package/build/dist/api/modules/velora/index.js +1 -1
  285. package/build/dist/api/modules/wormhole/index.js +1 -1
  286. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  287. package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -1
  288. package/build/dist/api/modules/wormhole/third-party-text.d.ts +14 -3
  289. package/build/dist/api/modules/wormhole/third-party-text.js +1 -1
  290. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  291. package/build/dist/api/modules/wormhole/x402-client.js +1 -1
  292. package/build/dist/api/oak-fee.d.ts +12 -0
  293. package/build/dist/api/oak-fee.js +1 -0
  294. package/build/dist/api/param-text.d.ts +22 -0
  295. package/build/dist/api/param-text.js +1 -0
  296. package/build/dist/api/position-economics.d.ts +70 -0
  297. package/build/dist/api/position-economics.js +1 -0
  298. package/build/dist/api/positions.d.ts +8 -5
  299. package/build/dist/api/positions.js +1 -1
  300. package/build/dist/api/prices.d.ts +3 -0
  301. package/build/dist/api/prices.js +1 -1
  302. package/build/dist/api/progress.d.ts +7 -0
  303. package/build/dist/api/progress.js +1 -0
  304. package/build/dist/api/read-budgets.d.ts +4 -0
  305. package/build/dist/api/read-budgets.js +1 -0
  306. package/build/dist/api/read-shape.d.ts +45 -0
  307. package/build/dist/api/read-shape.js +1 -0
  308. package/build/dist/api/revert.d.ts +23 -0
  309. package/build/dist/api/revert.js +1 -0
  310. package/build/dist/api/routes.js +1 -1
  311. package/build/dist/api/rpc.d.ts +1 -0
  312. package/build/dist/api/rpc.js +1 -1
  313. package/build/dist/api/secret-fields.js +1 -1
  314. package/build/dist/api/send.js +1 -1
  315. package/build/dist/api/signing-registry.d.ts +8 -0
  316. package/build/dist/api/signing-registry.js +1 -1
  317. package/build/dist/api/simulate.js +1 -1
  318. package/build/dist/api/swap.d.ts +4 -0
  319. package/build/dist/api/swap.js +1 -1
  320. package/build/dist/api/tokens.d.ts +1 -0
  321. package/build/dist/api/tokens.js +1 -1
  322. package/build/dist/api/tool-policy.js +1 -1
  323. package/build/dist/api/types.d.ts +3 -0
  324. package/build/dist/api/untrusted-unwrap.d.ts +1 -0
  325. package/build/dist/api/untrusted-unwrap.js +1 -0
  326. package/build/dist/api/usd-estimate.d.ts +23 -0
  327. package/build/dist/api/usd-estimate.js +1 -0
  328. package/build/dist/api/vendor-limits.js +1 -1
  329. package/build/dist/chunks/{T7TFUH5K.js → 2E4I7CJ7.js} +1 -1
  330. package/build/dist/chunks/2FHELZ7Y.js +1 -0
  331. package/build/dist/chunks/2GXHYI23.js +1 -0
  332. package/build/dist/chunks/2LWBN35N.js +1 -0
  333. package/build/dist/chunks/{4HG6FRVH.js → 2OKYXT25.js} +1 -1
  334. package/build/dist/chunks/2SUHQWND.js +1 -0
  335. package/build/dist/chunks/2ZWKIBJT.js +1 -0
  336. package/build/dist/chunks/32RXFUOH.js +1 -0
  337. package/build/dist/chunks/3CH2IPQL.js +1 -0
  338. package/build/dist/chunks/3DNJTJ2X.js +1 -0
  339. package/build/dist/chunks/3K2N5VFH.js +1 -0
  340. package/build/dist/chunks/3VBIRLU3.js +1 -0
  341. package/build/dist/chunks/3ZABD6ZF.js +2 -0
  342. package/build/dist/chunks/44MB6SA6.js +1 -0
  343. package/build/dist/chunks/4D4ZRZUW.js +1 -0
  344. package/build/dist/chunks/{IPN6Z4JM.js → 4FPV4CRC.js} +1 -1
  345. package/build/dist/chunks/4GNUXN4K.js +1 -0
  346. package/build/dist/chunks/{K4DHHQBI.js → 4JRXEN7C.js} +2 -2
  347. package/build/dist/chunks/4JTTA3BX.js +1 -0
  348. package/build/dist/chunks/4OVIMYNH.js +2 -0
  349. package/build/dist/chunks/{7QIO77VE.js → 4Q2ZBZXM.js} +1 -1
  350. package/build/dist/chunks/4RQAOOO2.js +1 -0
  351. package/build/dist/chunks/4TTDAF4B.js +1 -0
  352. package/build/dist/chunks/523ZIR3J.js +1 -0
  353. package/build/dist/chunks/5DPJQCKJ.js +68 -0
  354. package/build/dist/chunks/5HIHUYA4.js +1 -0
  355. package/build/dist/chunks/5PI57UC2.js +1 -0
  356. package/build/dist/chunks/5RXALTDT.js +1 -0
  357. package/build/dist/chunks/5TUXSOMI.js +1 -0
  358. package/build/dist/chunks/5UAXLWJ2.js +1 -0
  359. package/build/dist/chunks/5XAXJEWM.js +5 -0
  360. package/build/dist/chunks/67BWOVET.js +1 -0
  361. package/build/dist/chunks/6NUNCD5J.js +1 -0
  362. package/build/dist/chunks/{FJ4S4GHY.js → 6PZGDVHV.js} +1 -1
  363. package/build/dist/chunks/{RTAHNWHN.js → 6UVGQYZ3.js} +1 -1
  364. package/build/dist/chunks/753HZZTY.js +1 -0
  365. package/build/dist/chunks/7D73A6KS.js +1 -0
  366. package/build/dist/chunks/7MBVTNLU.js +1 -0
  367. package/build/dist/chunks/7QKYDNF6.js +18 -0
  368. package/build/dist/chunks/7VC53B5X.js +70 -0
  369. package/build/dist/chunks/7VNO46LV.js +1 -0
  370. package/build/dist/chunks/ACH4BSME.js +3 -0
  371. package/build/dist/chunks/AHUCYDBC.js +1 -0
  372. package/build/dist/chunks/AI3VAPA3.js +1 -0
  373. package/build/dist/chunks/AMTRDPVO.js +1 -0
  374. package/build/dist/chunks/APHNOGNS.js +1 -0
  375. package/build/dist/chunks/{BND2UFVW.js → ARI72OYT.js} +1 -1
  376. package/build/dist/chunks/ARLGF5MU.js +1 -0
  377. package/build/dist/chunks/BAIY32AV.js +1 -0
  378. package/build/dist/chunks/BB765L75.js +3 -0
  379. package/build/dist/chunks/BE3A7677.js +1 -0
  380. package/build/dist/chunks/{PAY5PD4H.js → BX46C5ZP.js} +1 -1
  381. package/build/dist/chunks/{XL3LLGIR.js → BZ34ZR65.js} +1 -1
  382. package/build/dist/chunks/C3WBHFLX.js +1 -0
  383. package/build/dist/chunks/C75MT5SD.js +1 -0
  384. package/build/dist/chunks/CAWTAR5V.js +1 -0
  385. package/build/dist/chunks/CNLL4NCR.js +1 -0
  386. package/build/dist/chunks/CO4GCF4L.js +1 -0
  387. package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
  388. package/build/dist/chunks/{SJJR4ZBZ.js → CSDN4MYP.js} +1 -1
  389. package/build/dist/chunks/CSOO4SW7.js +1 -0
  390. package/build/dist/chunks/CZL6T2ZQ.js +1 -0
  391. package/build/dist/chunks/D742AYEV.js +1 -0
  392. package/build/dist/chunks/DGCJZ3HO.js +1 -0
  393. package/build/dist/chunks/DNNFKDZR.js +1 -0
  394. package/build/dist/chunks/DPE7SPW7.js +1 -0
  395. package/build/dist/chunks/DSTMEY5F.js +1 -0
  396. package/build/dist/chunks/{FUDAXV5X.js → DYYEA5HB.js} +1 -1
  397. package/build/dist/chunks/EFESPGA2.js +1 -0
  398. package/build/dist/chunks/EGZREEG2.js +1 -0
  399. package/build/dist/chunks/EH5G4O3U.js +1 -0
  400. package/build/dist/chunks/EI6GGPDS.js +20 -0
  401. package/build/dist/chunks/EVBHQQQG.js +1 -0
  402. package/build/dist/chunks/EZZM2GQT.js +2 -0
  403. package/build/dist/chunks/F3VDVTMS.js +1 -0
  404. package/build/dist/chunks/F4UQEPJT.js +1 -0
  405. package/build/dist/chunks/FHTNMGFR.js +1 -0
  406. package/build/dist/chunks/FJLJ7ZQ5.js +1 -0
  407. package/build/dist/chunks/{WP6RHXGN.js → FL5SSHUL.js} +1 -1
  408. package/build/dist/chunks/FNGIJKMZ.js +1 -0
  409. package/build/dist/chunks/{KIFZ5ZSK.js → FOD34G2H.js} +1 -1
  410. package/build/dist/chunks/{WV3A3OUU.js → FOKEFXGP.js} +1 -1
  411. package/build/dist/chunks/FV4WZOTD.js +1 -0
  412. package/build/dist/chunks/FWIFTPSE.js +2 -0
  413. package/build/dist/chunks/FZ6IJZZM.js +1 -0
  414. package/build/dist/chunks/G2LAO23N.js +1 -0
  415. package/build/dist/chunks/GDRQ2ANN.js +1 -0
  416. package/build/dist/chunks/GG24LO2R.js +1 -0
  417. package/build/dist/chunks/GLF7WEY2.js +1 -0
  418. package/build/dist/chunks/GQ3XZFRL.js +1 -0
  419. package/build/dist/chunks/{QU5XKRGK.js → GQYV4TFO.js} +1 -1
  420. package/build/dist/chunks/GRSXWQWD.js +1 -0
  421. package/build/dist/chunks/{DL6AEWEM.js → GSFHM5L3.js} +1 -1
  422. package/build/dist/chunks/{QHBS3PVU.js → H5DY7CNB.js} +1 -1
  423. package/build/dist/chunks/HCBX4NFM.js +1 -0
  424. package/build/dist/chunks/HHO5ISMM.js +1 -0
  425. package/build/dist/chunks/HIX5N25Z.js +1 -0
  426. package/build/dist/chunks/HKVQ646Q.js +1 -0
  427. package/build/dist/chunks/IEG6GLFR.js +1 -0
  428. package/build/dist/chunks/INOYMBWE.js +1 -0
  429. package/build/dist/chunks/IV4K7FMD.js +1 -0
  430. package/build/dist/chunks/{PIIHOXWF.js → J73ATSEQ.js} +1 -1
  431. package/build/dist/chunks/JBTOZ6IH.js +1 -0
  432. package/build/dist/chunks/JESMX2UC.js +1 -0
  433. package/build/dist/chunks/JJGZ7W3V.js +1 -0
  434. package/build/dist/chunks/JKRBGAX2.js +1 -0
  435. package/build/dist/chunks/JLRHM2DQ.js +1 -0
  436. package/build/dist/chunks/JOKL5L6X.js +1 -0
  437. package/build/dist/chunks/JS53DQVT.js +1 -0
  438. package/build/dist/chunks/{WIRBCS4W.js → JWR5XVP2.js} +1 -1
  439. package/build/dist/chunks/{JFYBH3DX.js → K6D6SDIG.js} +1 -1
  440. package/build/dist/chunks/K7HTDKAT.js +1 -0
  441. package/build/dist/chunks/{2VXLVXIB.js → KDGSYNOP.js} +1 -1
  442. package/build/dist/chunks/KKPMOAVI.js +1 -0
  443. package/build/dist/chunks/KREBNL2D.js +1 -0
  444. package/build/dist/chunks/L646YWDP.js +1 -0
  445. package/build/dist/chunks/{GSBIERZD.js → LR4XTZ37.js} +1 -1
  446. package/build/dist/chunks/LVFI74ST.js +1 -0
  447. package/build/dist/chunks/{QBIY6FQN.js → M7ZXDLKM.js} +1 -1
  448. package/build/dist/chunks/MVD3KWPP.js +1 -0
  449. package/build/dist/chunks/N245WC5R.js +1 -0
  450. package/build/dist/chunks/{WTXC3XKW.js → N4XNNXOJ.js} +1 -1
  451. package/build/dist/chunks/N6GIC7HJ.js +1 -0
  452. package/build/dist/chunks/{RUC7KH7A.js → NA424YAL.js} +1 -1
  453. package/build/dist/chunks/NUFZUKYS.js +1 -0
  454. package/build/dist/chunks/{XD6X3KTC.js → O3JWCJIF.js} +1 -1
  455. package/build/dist/chunks/OARVU3RC.js +1 -0
  456. package/build/dist/chunks/OEZ7FCLF.js +1 -0
  457. package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
  458. package/build/dist/chunks/{2MT3G7YZ.js → OYJFXEDU.js} +1 -1
  459. package/build/dist/chunks/OYPAVXGQ.js +1 -0
  460. package/build/dist/chunks/{SMYWWIE6.js → OZ5MDUD2.js} +1 -1
  461. package/build/dist/chunks/P6OMKZMR.js +3 -0
  462. package/build/dist/chunks/PV4AK32X.js +1 -0
  463. package/build/dist/chunks/{HKEMQBFA.js → PXVREXCS.js} +1 -1
  464. package/build/dist/chunks/PZEF5LBL.js +2 -0
  465. package/build/dist/chunks/Q2ACLVWR.js +1 -0
  466. package/build/dist/chunks/QFSBDPLN.js +1 -0
  467. package/build/dist/chunks/QJNLLI6N.js +1 -0
  468. package/build/dist/chunks/QMZEGT5B.js +1 -0
  469. package/build/dist/chunks/{PNA6UIE5.js → REWXG6X6.js} +1 -1
  470. package/build/dist/chunks/{ALLLYOUG.js → RLI4JDOL.js} +1 -1
  471. package/build/dist/chunks/{UD2XMNIT.js → RLMVA575.js} +1 -1
  472. package/build/dist/chunks/RPB46QAC.js +1 -0
  473. package/build/dist/chunks/{Q42YI3EP.js → RT7IU6TI.js} +1 -1
  474. package/build/dist/chunks/{ER47KGRM.js → SBY4RJ7I.js} +1 -1
  475. package/build/dist/chunks/SCG5HWMN.js +1 -0
  476. package/build/dist/chunks/{XQA5LCL6.js → SENOU5JR.js} +1 -1
  477. package/build/dist/chunks/SKEKXEUU.js +1 -0
  478. package/build/dist/chunks/SOTYQGPT.js +1 -0
  479. package/build/dist/chunks/SZ466I5X.js +1 -0
  480. package/build/dist/chunks/{GNC6RXLT.js → TDZTC5WR.js} +1 -1
  481. package/build/dist/chunks/TE6D3OIX.js +1 -0
  482. package/build/dist/chunks/TID4C2KC.js +1 -0
  483. package/build/dist/chunks/TK55VASJ.js +2 -0
  484. package/build/dist/chunks/TM7Z5SA4.js +1 -0
  485. package/build/dist/chunks/TNJTET4G.js +1 -0
  486. package/build/dist/chunks/TPEKCXVE.js +1 -0
  487. package/build/dist/chunks/TVIMP5CK.js +1 -0
  488. package/build/dist/chunks/U2YCQWZK.js +1 -0
  489. package/build/dist/chunks/U363GQTF.js +1 -0
  490. package/build/dist/chunks/{U4JGEMKT.js → UEDGYZOC.js} +1 -1
  491. package/build/dist/chunks/UOCRYXAB.js +1 -0
  492. package/build/dist/chunks/UQEEF5W5.js +1 -0
  493. package/build/dist/chunks/{QQECG3WP.js → UUID2E22.js} +1 -1
  494. package/build/dist/chunks/UWBKAWX3.js +7 -0
  495. package/build/dist/chunks/V37L4DU4.js +1 -0
  496. package/build/dist/chunks/VR344DAZ.js +1 -0
  497. package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
  498. package/build/dist/chunks/VTPT5544.js +1 -0
  499. package/build/dist/chunks/VVWFB53Q.js +1 -0
  500. package/build/dist/chunks/WHTRPRRD.js +1 -0
  501. package/build/dist/chunks/WHVZ372B.js +1 -0
  502. package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
  503. package/build/dist/chunks/{4DP2VPXR.js → WOGWLFAL.js} +1 -1
  504. package/build/dist/chunks/WUT7TZYM.js +1 -0
  505. package/build/dist/chunks/XCKTE4ON.js +1 -0
  506. package/build/dist/chunks/XEPCDGN2.js +1 -0
  507. package/build/dist/chunks/XHYFISVV.js +1 -0
  508. package/build/dist/chunks/XPEDQBLI.js +1 -0
  509. package/build/dist/chunks/{QFNT73OF.js → XQ24RSEI.js} +1 -1
  510. package/build/dist/chunks/XRDXFHIK.js +1 -0
  511. package/build/dist/chunks/XTFRPI4G.js +1 -0
  512. package/build/dist/chunks/XVJ7ILKK.js +1 -0
  513. package/build/dist/chunks/XWKK75TO.js +1 -0
  514. package/build/dist/chunks/{CBLMQ5UU.js → XYPGLG6A.js} +1 -1
  515. package/build/dist/chunks/Y77EVVT4.js +1 -0
  516. package/build/dist/chunks/YEIM6BZQ.js +1 -0
  517. package/build/dist/chunks/{XSKFKBDR.js → YMV5TL5C.js} +1 -1
  518. package/build/dist/chunks/YSMWCKIX.js +1 -0
  519. package/build/dist/chunks/YTLH4M4Y.js +1 -0
  520. package/build/dist/chunks/YUHNPUNK.js +1 -0
  521. package/build/dist/chunks/YWZQJJYY.js +1 -0
  522. package/build/dist/chunks/{EGYVRQUR.js → ZF2VPDRQ.js} +1 -1
  523. package/build/dist/chunks/ZFU65MB4.js +1 -0
  524. package/build/dist/chunks/ZKZUS3QU.js +1 -0
  525. package/build/dist/chunks/ZOMFHTB2.js +1 -0
  526. package/build/dist/chunks/{OLSP46ZD.js → ZP36DSOD.js} +1 -1
  527. package/build/dist/chunks/ZQ6AF3VX.js +1 -0
  528. package/package.json +1 -1
  529. package/build/dist/chunks/2THSW4QN.js +0 -1
  530. package/build/dist/chunks/2TK3ETUO.js +0 -1
  531. package/build/dist/chunks/35KR3VSS.js +0 -1
  532. package/build/dist/chunks/3GQ7A3VB.js +0 -1
  533. package/build/dist/chunks/3XNZUIRU.js +0 -1
  534. package/build/dist/chunks/46547QT3.js +0 -1
  535. package/build/dist/chunks/4EN6MQEI.js +0 -1
  536. package/build/dist/chunks/4I3OU56B.js +0 -1
  537. package/build/dist/chunks/52ELWNXJ.js +0 -2
  538. package/build/dist/chunks/5AXWBSPG.js +0 -1
  539. package/build/dist/chunks/5N3O42X6.js +0 -1
  540. package/build/dist/chunks/5SMVQCAP.js +0 -1
  541. package/build/dist/chunks/5SZPNZG4.js +0 -1
  542. package/build/dist/chunks/64GOINYS.js +0 -1
  543. package/build/dist/chunks/6I4NTKB2.js +0 -1
  544. package/build/dist/chunks/6JAXZNZ3.js +0 -1
  545. package/build/dist/chunks/6O3Q5B6M.js +0 -1
  546. package/build/dist/chunks/6OGDTEGH.js +0 -1
  547. package/build/dist/chunks/6WZX7C4T.js +0 -2
  548. package/build/dist/chunks/6YB3VOUL.js +0 -1
  549. package/build/dist/chunks/7GJ6SLEV.js +0 -1
  550. package/build/dist/chunks/7KWZ5QJU.js +0 -1
  551. package/build/dist/chunks/7QZOTRSA.js +0 -2
  552. package/build/dist/chunks/7WSHW7KW.js +0 -1
  553. package/build/dist/chunks/A7I4IWUB.js +0 -1
  554. package/build/dist/chunks/ABPL3ZZI.js +0 -1
  555. package/build/dist/chunks/ACW63WIL.js +0 -20
  556. package/build/dist/chunks/AEL62KCG.js +0 -1
  557. package/build/dist/chunks/AKYF5264.js +0 -7
  558. package/build/dist/chunks/AW7AXQCZ.js +0 -1
  559. package/build/dist/chunks/AXRL3REN.js +0 -1
  560. package/build/dist/chunks/BBTPRZ6T.js +0 -1
  561. package/build/dist/chunks/BOVMED7R.js +0 -1
  562. package/build/dist/chunks/BTPXJAUX.js +0 -1
  563. package/build/dist/chunks/C7AXJHBT.js +0 -1
  564. package/build/dist/chunks/CBG5HARQ.js +0 -2
  565. package/build/dist/chunks/CDPSMI3Z.js +0 -1
  566. package/build/dist/chunks/CHXBOXOD.js +0 -1
  567. package/build/dist/chunks/CQEJSCFQ.js +0 -1
  568. package/build/dist/chunks/DBNTZEAJ.js +0 -1
  569. package/build/dist/chunks/DHUDSOGR.js +0 -18
  570. package/build/dist/chunks/DJN3JAWB.js +0 -1
  571. package/build/dist/chunks/FEYAY6OZ.js +0 -1
  572. package/build/dist/chunks/GG6Y4OCJ.js +0 -1
  573. package/build/dist/chunks/GGHBFLRC.js +0 -1
  574. package/build/dist/chunks/GGSAKCND.js +0 -1
  575. package/build/dist/chunks/GRQYTVNT.js +0 -1
  576. package/build/dist/chunks/H6T5FXEX.js +0 -1
  577. package/build/dist/chunks/HHXBUYHO.js +0 -1
  578. package/build/dist/chunks/HQUVB7Z5.js +0 -3
  579. package/build/dist/chunks/HU7IMNBI.js +0 -1
  580. package/build/dist/chunks/HWX36XJI.js +0 -1
  581. package/build/dist/chunks/I26DMNJG.js +0 -1
  582. package/build/dist/chunks/I55MURSJ.js +0 -1
  583. package/build/dist/chunks/IMO3GDA5.js +0 -1
  584. package/build/dist/chunks/IPRVIKYC.js +0 -1
  585. package/build/dist/chunks/IVX4R5OL.js +0 -1
  586. package/build/dist/chunks/JQOQMFWD.js +0 -3
  587. package/build/dist/chunks/JUZ5JU6D.js +0 -70
  588. package/build/dist/chunks/JZS3E66E.js +0 -1
  589. package/build/dist/chunks/K3RDPI5J.js +0 -1
  590. package/build/dist/chunks/KBKK7UNY.js +0 -1
  591. package/build/dist/chunks/KVFZKPJT.js +0 -1
  592. package/build/dist/chunks/L5BLHY34.js +0 -1
  593. package/build/dist/chunks/LKXO2BQS.js +0 -1
  594. package/build/dist/chunks/LKZX4CAA.js +0 -1
  595. package/build/dist/chunks/LYMNHO5T.js +0 -1
  596. package/build/dist/chunks/M2UXYCKH.js +0 -1
  597. package/build/dist/chunks/M37654RL.js +0 -1
  598. package/build/dist/chunks/M6LC6DRE.js +0 -1
  599. package/build/dist/chunks/MOE3EVAL.js +0 -1
  600. package/build/dist/chunks/N4Q6GN65.js +0 -1
  601. package/build/dist/chunks/NAZPDRIF.js +0 -1
  602. package/build/dist/chunks/NKX3FE34.js +0 -1
  603. package/build/dist/chunks/NKZKKCK2.js +0 -1
  604. package/build/dist/chunks/NOFUKKP5.js +0 -1
  605. package/build/dist/chunks/O6ROOKY2.js +0 -1
  606. package/build/dist/chunks/OJ4WJUPP.js +0 -1
  607. package/build/dist/chunks/OOZSE2R7.js +0 -1
  608. package/build/dist/chunks/OTXSKFUD.js +0 -1
  609. package/build/dist/chunks/P5AJSLZ7.js +0 -1
  610. package/build/dist/chunks/PACN53TR.js +0 -1
  611. package/build/dist/chunks/PAHXBLCS.js +0 -1
  612. package/build/dist/chunks/PK66GCDT.js +0 -1
  613. package/build/dist/chunks/PSBQWDYI.js +0 -1
  614. package/build/dist/chunks/PXT5YTWU.js +0 -1
  615. package/build/dist/chunks/PZGGE5D3.js +0 -1
  616. package/build/dist/chunks/QA2RRIES.js +0 -1
  617. package/build/dist/chunks/QA3UHEO3.js +0 -1
  618. package/build/dist/chunks/QW2OPEYJ.js +0 -1
  619. package/build/dist/chunks/QYVREJYC.js +0 -1
  620. package/build/dist/chunks/ROFPXEQ5.js +0 -2
  621. package/build/dist/chunks/RTGS7RIO.js +0 -1
  622. package/build/dist/chunks/RUX3RY7Y.js +0 -1
  623. package/build/dist/chunks/RVDUSNWW.js +0 -1
  624. package/build/dist/chunks/S5CBVFHY.js +0 -1
  625. package/build/dist/chunks/SIYUNOLI.js +0 -1
  626. package/build/dist/chunks/TEJ7W534.js +0 -1
  627. package/build/dist/chunks/TPBAFS7K.js +0 -1
  628. package/build/dist/chunks/TVWMTMEF.js +0 -1
  629. package/build/dist/chunks/U2RMUVVY.js +0 -1
  630. package/build/dist/chunks/U5PMVP56.js +0 -1
  631. package/build/dist/chunks/V5JWGWXC.js +0 -1
  632. package/build/dist/chunks/VCOTCVKN.js +0 -1
  633. package/build/dist/chunks/VEQBHI6O.js +0 -1
  634. package/build/dist/chunks/VNV6ZISN.js +0 -1
  635. package/build/dist/chunks/VYAJXLND.js +0 -1
  636. package/build/dist/chunks/WCNHZYQQ.js +0 -1
  637. package/build/dist/chunks/X2P55AC3.js +0 -1
  638. package/build/dist/chunks/XBE3B6Y2.js +0 -1
  639. package/build/dist/chunks/XKSVTN5X.js +0 -1
  640. package/build/dist/chunks/XSRIJUFU.js +0 -1
  641. package/build/dist/chunks/YCZPSMZ5.js +0 -1
  642. package/build/dist/chunks/YN56C7PN.js +0 -1
  643. package/build/dist/chunks/YRNXGQJC.js +0 -1
  644. package/build/dist/chunks/YWRLY5EA.js +0 -1
  645. package/build/dist/chunks/YWSX6IE6.js +0 -1
  646. package/build/dist/chunks/YXTSWRV5.js +0 -1
  647. package/build/dist/chunks/Z6LZGCVW.js +0 -1
  648. package/build/dist/chunks/ZQWZGH7V.js +0 -1
  649. package/build/dist/chunks/ZSN4IRI5.js +0 -1
  650. package/build/dist/chunks/ZV5HIQXC.js +0 -1
  651. package/build/dist/chunks/ZXJ24B4L.js +0 -1
@@ -1 +0,0 @@
1
- import{b as q}from"./2MT3G7YZ.js";import{b as S}from"./AEL62KCG.js";import{b as le}from"./SPJCSEKP.js";import{a as _}from"./43LI5NKJ.js";import{g as B,i as ue}from"./NWNYJ26T.js";import{b as H}from"./IX3GZMTM.js";import{a as c,i as N}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as ce}from"./JXOEJPJ4.js";import{encodeFunctionData as z,erc20Abi as me,getAddress as m,isAddress as he,parseAbi as U,zeroAddress as ke}from"viem";var T=m(N[c].hoodlock.locker.address),C=m(N[c].hoodlock.burner.address),v=m(N[c].hoodlock.liquidityLocker.address),j=m(N[c].uniswap.v3_position_manager.address),K=m(N[c].uniswap.v4_position_manager.address),qe="0x000000000000000000000000000000000000dEaD",Ae=3153600000n,Te=1000000000000n,fe=65535,D=U(["function fee() view returns (uint256)","function lock(address token, uint256 amount, uint256 unlockTime) payable returns (uint256 lockId)","function getLock(uint256 lockId) view returns (address owner, address token, uint256 amount, uint256 unlockTime, bool withdrawn)","function locksByOwner(address owner) view returns (uint256[])","function locksByToken(address token) view returns (uint256[])"]),ee=U(["function fee() view returns (uint256)","function burn(address token, uint256 amount) payable returns (uint256 burnId)","function DEAD() view returns (address)","function getBurn(uint256 burnId) view returns (address burner, address token, uint256 amount, uint256 timestamp)","function totalBurnedOf(address token) view returns (uint256)"]),O=U(["function fixedFee() view returns (uint256)","function collectFeeBps() view returns (uint16)","function paused() view returns (bool)","function lock(address manager, uint256 tokenId, uint256 unlockTime, address feeRecipient, bool acceptUnverifiedHook, uint16 maxCollectFeeBps) payable returns (uint256 lockId)","function lockIdOf(address manager, uint256 tokenId) view returns (uint256)","function getLock(uint256 lockId) view returns (address owner, uint40 unlockTime, uint16 collectFeeBps, bool isV4, bool hookVerified, bool withdrawn, address feeRecipient, address token0, address token1, uint256 tokenId)","function locksOf(address owner) view returns (uint256[])"]),ye=U(["function approve(address to, uint256 tokenId)"]);function $e(e,o,t){let a=o.trim();if(a.startsWith("-")){let k=a.slice(1),i=e(k,t);return i==="0"?"0":`-${i}`}return e(a,t)}function pe(e,o){return o.length===0?"no ERC-20 transfer deltas":o.map(t=>`${$e(e.formatAmount,t.amount,t.token.decimals)} ${t.token.symbol}`).join(", ")}function E(e,o="token"){if(typeof e!="string"||!e.trim())throw new u(`Provide a valid ${o} contract address.`);if(!he(e,{strict:!1}))throw new u(`Identify ${o} by chain and contract address, not by symbol.`);return m(e)}async function W(e,o){try{return await o()}catch(t){throw new u(e.plainError(t))}}function we(e){let o=H(e);if(o<=0n)throw new u("Amount must be greater than zero.");return o}async function ge(e){let o=await e.getBlock();if(!o||typeof o.timestamp!="bigint")throw new u("Could not read the current chain timestamp. Please try again.");return o.timestamp}function ve(e,o){if(typeof e!="string"||!/^\d+$/.test(e.trim()))throw new u("unlockTime must be a non-negative integer string in Unix seconds.");let t=BigInt(e.trim());if(t>=Te)throw new u("unlockTime appears to be in milliseconds; provide Unix seconds at most 100 years (3153600000 seconds) in the future.");if(t<=o)throw new u(`unlockTime (${t}) must be in the future (greater than current timestamp ${o}).`);let a=o+Ae;if(t>a)throw new u(`unlockTime (${t}) exceeds the 100-year maximum lock duration (3153600000 seconds; max ${a}).`);return t}async function oe(e,o,t=c){let a=m(o),[k,i]=await Promise.all([e.readContract({address:a,abi:me,functionName:"symbol"}),e.readContract({address:a,abi:me,functionName:"decimals"})]);return{address:a,symbol:ce(String(k)),decimals:Number(i),chainId:t}}function Se(e,o){if(e==null)return o;let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/.test(e.trim())?Number(e.trim()):NaN;if(!Number.isInteger(t)||t<0||t>fe)throw new u("maxCollectFeeBps must be an integer between 0 and 65535.");if(t<o)throw new u(`Live collectFeeBps (${o}) exceeds maxCollectFeeBps (${t}): collect fee changed.`);return Math.min(t,o)}function Le(e){return e.tokenId!==void 0||e.manager!==void 0||e.feeRecipient!==void 0||e.maxCollectFeeBps!==void 0||e.acceptUnverifiedHook!==void 0||e.kind==="v3"||e.kind==="lp"||e.kind==="v4"||e.version==="v3"||e.version==="v4"}async function xe(e,o,t){_(t);let a=m(t),k=o.kind==="v4"||o.version==="v4",i=o.manager!==void 0?E(o.manager,"manager"):k?K:j,g=i===K;if(i!==j&&!g)throw new u(`Unsupported position manager ${i}; use the configured Uniswap v3 or v4 manager.`);if(k&&!g||g&&(o.kind==="v3"||o.version==="v3"))throw new u("The requested version disagrees with the position manager.");if(o.acceptUnverifiedHook!==void 0&&typeof o.acceptUnverifiedHook!="boolean")throw new u("acceptUnverifiedHook must be a boolean.");let b=o.acceptUnverifiedHook===!0;if(!g&&b)throw new u("Uniswap v3 has no hooks; omit acceptUnverifiedHook.");let s=g?"v4":"v3";if(typeof o.tokenId!="string")throw new u("Provide an NFT tokenId as a decimal string.");let f=String(o.tokenId).trim(),d=H(f),l=ue(o.feeRecipient,"Provide an explicit feeRecipient address for LP position locks."),p=e.clientFor(c),[x,I,h]=await Promise.all([ge(p),p.readContract({address:v,abi:O,functionName:"fixedFee"}),p.readContract({address:v,abi:O,functionName:"collectFeeBps"})]),y,$=!0;if(g){let P=U(["function getPoolAndPositionInfo(uint256 tokenId) view returns ((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey, uint256 info)","function getPositionLiquidity(uint256 tokenId) view returns (uint128)","function ownerOf(uint256 tokenId) view returns (address)"]),[Y,J,M]=await Promise.all([p.readContract({address:i,abi:P,functionName:"getPoolAndPositionInfo",args:[d]}),p.readContract({address:i,abi:P,functionName:"getPositionLiquidity",args:[d]}),p.readContract({address:i,abi:P,functionName:"ownerOf",args:[d]})]);if(m(M)!==a)throw new u("This wallet does not own that v4 position NFT.");if(J<=0n)throw new u("The v4 position has no liquidity to lock.");if(y=m(Y[0].hooks),$=y===ke||await p.readContract({address:v,abi:U(["function hookAllowed(address) view returns (bool)"]),functionName:"hookAllowed",args:[y]}),!$&&!b)throw new u(`Unverified v4 hook ${y}; review its risks and explicitly set acceptUnverifiedHook: true to proceed.`)}let A=ve(o.unlockTime,x),n=BigInt(I),r=Number(h);if(!Number.isInteger(r)||r<0||r>fe)throw new u(`Invalid on-chain collectFeeBps (${String(h)}).`);if(o.maxFee!==void 0){let P=H(String(o.maxFee));if(n>P)throw new u(`Live fixedFee (${n}) exceeds maxFee (${P}).`)}let w=Se(o.maxCollectFeeBps,r),L=(r/100).toString(),R=e.unsignedTx({to:i,data:z({abi:ye,functionName:"approve",args:[v,d]}),value:"0",chainId:c,description:`Approve Uniswap ${s} position NFT #${d} on ${i} for HoodLock LiquidityLocker ${v}.`}),F=e.unsignedTx({to:v,data:z({abi:O,functionName:"lock",args:[i,d,A,l,b,w]}),value:n.toString(),chainId:c,description:`Lock Uniswap ${s} NFT #${d} in HoodLock LiquidityLocker (${v}) until ${A} with feeRecipient ${l}, upfront fixedFee ${e.formatAmount(n.toString(),S.decimals)} ETH (${n} wei), and ongoing collect fee ${r} bps (${L}% of collected LP fees, frozen per lock).`}),X=[R,F],V=await e.preview(X,a),Q=`Approve and lock Uniswap ${s} NFT #${d} (manager ${i}) in HoodLock LiquidityLocker ${v} until Unix ${A}. Upfront fixedFee: ${e.formatAmount(n.toString(),S.decimals)} ETH (${n} wei). Ongoing LP fee share: ${r} bps (${L}% of collected LP fees, frozen per lock; maxCollectFeeBps=${w}) with feeRecipient ${l}. V4 hook: ${y??"none"}, reviewed: ${$}; acceptUnverifiedHook=${b}.`;return q(e,{txs:V.txs,summary:Q,preview:V,kind:s,contract:v,manager:i,tokenId:d.toString(),unlockTime:A.toString(),feeRecipient:l,acceptUnverifiedHook:b,collectFeeBps:r,maxCollectFeeBps:w,fixedFee:{token:S,amount:n.toString()}},v,n)}async function Ie(e,o,t){_(t);let a=m(t),k=E(o.token,"token"),i=e.clientFor(c),[g,b,s]=await Promise.all([ge(i),i.readContract({address:T,abi:D,functionName:"fee"}),oe(i,k,c)]),f=we(o.amount),d=ve(o.unlockTime,g),l=BigInt(b);if(o.maxFee!==void 0){let A=H(String(o.maxFee));if(l>A)throw new u(`Live lock fee (${l}) exceeds maxFee (${A}).`)}let p=e.approval(s.address,T,f.toString(),c),x=e.unsignedTx({to:T,data:z({abi:D,functionName:"lock",args:[s.address,f,d]}),value:l.toString(),chainId:c,description:`Lock ${e.formatAmount(f.toString(),s.decimals)} ${s.symbol} (${f} base units of ${s.address}) in HoodLock Locker ${T} until ${d} with exact fee ${e.formatAmount(l.toString(),S.decimals)} ETH (${l} wei).`}),I=[p,x],h=await e.preview(I,a),y=pe(e,h.changes),$=`Approve and lock ${e.formatAmount(f.toString(),s.decimals)} ${s.symbol} (${f} base units of ${s.address}) in HoodLock Locker ${T} until Unix ${d}. Exact fee: ${e.formatAmount(l.toString(),S.decimals)} ETH (${l} wei). Preview changes: ${y}.`;return q(e,{txs:h.txs,summary:$,preview:h,kind:"token",contract:T,token:s,amount:f.toString(),unlockTime:d.toString(),fee:{token:S,amount:l.toString()}},T,l)}function Pe(e){return{name:"hoodlock_lock",inputSchema:{type:"object",properties:{kind:{type:"string",enum:["token","v2","v3","v4"],description:"Lock mode: token/v2 LP via Locker, or Uniswap v3/v4 NFT via LiquidityLocker."},token:{type:"string",description:"ERC-20 token or v2 LP token contract address on chain 4663 (for token/v2 locks)."},amount:{type:"string",description:"Token amount as an integer string in base units (for token/v2 locks)."},manager:{type:"string",description:"Configured Uniswap v3 or v4 position manager; inferred from kind when omitted."},tokenId:{type:"string",description:"Uniswap NFT position tokenId as a decimal string."},feeRecipient:{type:"string",description:"Explicit recipient address for collected LP fees during a position lock."},acceptUnverifiedHook:{type:"boolean",description:"Explicit v4 unreviewed-hook consent; default false. A reviewed hook is not a safety guarantee."},maxFee:{type:"string",description:"Maximum upfront ETH fee in wei; the exact live fee is sent."},maxCollectFeeBps:{type:"number",description:"Maximum acceptable ongoing LP collect fee in bps (uint16, must be >= live collectFeeBps)."},unlockTime:{type:"string",description:"Unlock timestamp in Unix seconds (must be > now and <= now + 100 years)."}},required:["unlockTime"],additionalProperties:!1},async execute(o,t){return W(e,async()=>Le(o)?xe(e,o,t):Ie(e,o,t))}}}function Ce(e){return{name:"hoodlock_burn",inputSchema:{type:"object",properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663 to send to the dead address via HoodLock Burner."},amount:{type:"string",description:"Amount to burn as an integer string in base units."}},required:["token","amount"],additionalProperties:!1},async execute(o,t){return W(e,async()=>{_(t);let a=m(t),k=E(o.token,"token"),i=e.clientFor(c),[g,b,s]=await Promise.all([i.readContract({address:C,abi:ee,functionName:"fee"}),i.readContract({address:C,abi:ee,functionName:"DEAD"}),oe(i,k,c)]),f=we(o.amount),d=BigInt(g),l=m(b);if(o.maxFee!==void 0){let A=H(String(o.maxFee));if(d>A)throw new u(`Live burn fee (${d}) exceeds maxFee (${A}).`)}let p=e.approval(s.address,C,f.toString(),c),x=e.unsignedTx({to:C,data:z({abi:ee,functionName:"burn",args:[s.address,f]}),value:d.toString(),chainId:c,description:`Send ${e.formatAmount(f.toString(),s.decimals)} ${s.symbol} (${f} base units of ${s.address}) to the dead address (${l}) via HoodLock Burner ${C} (totalSupply is unchanged) with exact fee ${e.formatAmount(d.toString(),S.decimals)} ETH (${d} wei).`}),I=[p,x],h=await e.preview(I,a),y=pe(e,h.changes),$=`Approve and send ${e.formatAmount(f.toString(),s.decimals)} ${s.symbol} (${f} base units of ${s.address}) to the dead address (${l}) via HoodLock Burner ${C}. Note: tokens are transferred to ${l} and totalSupply is unchanged. Exact fee: ${e.formatAmount(d.toString(),S.decimals)} ETH (${d} wei). Preview changes: ${y}.`;return q(e,{txs:h.txs,summary:$,preview:h,contract:C,deadAddress:l,token:s,amount:f.toString(),fee:{token:S,amount:d.toString()},totalSupplyReduced:!1},C,d)})}}}async function be(e,o,t){_(o);let a=m(o),k=t?E(t,"token"):void 0,i=e.clientFor(c),g=[],b=new Set,s=n=>{for(let r of n){let w=r.toString();b.has(w)||(b.add(w),g.push(r))}};if(k){let[n,r]=await Promise.all([i.readContract({address:T,abi:D,functionName:"locksByToken",args:[k]}),i.readContract({address:T,abi:D,functionName:"locksByOwner",args:[a]})]);s(n),s(r)}else{let n=await i.readContract({address:T,abi:D,functionName:"locksByOwner",args:[a]});s(n)}let d=(await Promise.all(g.map(async n=>{let r=await i.readContract({address:T,abi:D,functionName:"getLock",args:[n]});return{id:n,owner:m(r[0]),token:m(r[1]),amount:BigInt(r[2]),unlockTime:BigInt(r[3]),withdrawn:!!r[4]}}))).filter(n=>!n.withdrawn&&n.amount>0n&&B(n.owner,a)&&(!k||B(n.token,k))),l=new Map,p=async n=>{let r=n.toLowerCase(),w=l.get(r);if(w)return w;let L=n===ke?S:await oe(i,n,c);return l.set(r,L),L},x=[],I=[];for(let n of d){let r=await p(n.token),w=n.amount.toString(),L=n.unlockTime.toString(),R={token:r,amount:w};x.push({lockId:n.id.toString(),kind:"token",contract:T,chainId:c,owner:n.owner,token:r,amount:w,asset:R,unlockTime:L,withdrawn:!1}),I.push({module:"hoodlock",id:`lock:${n.id.toString()}`,chainId:c,assets:[R],description:`HoodLock token lock #${n.id} of ${e.formatAmount(w,r.decimals)} ${r.symbol} (${r.address}) until Unix ${L}.`})}let h=await i.readContract({address:v,abi:O,functionName:"locksOf",args:[a]}),y=[...new Set(h.map(n=>n.toString()))].map(n=>BigInt(n)),$=[];for(let n of y){let r=await i.readContract({address:v,abi:O,functionName:"getLock",args:[n]}),[w,L,R,F,X,V,Q,P,Y,J]=r,M=m(w);if(V||!B(M,a))continue;let ne=m(P),te=m(Y);if(k&&!B(ne,k)&&!B(te,k))continue;let[ie,re]=await Promise.all([p(ne),p(te)]),se=m(Q),ae=Number(R),de=BigInt(L).toString(),Z=BigInt(J).toString();$.push({lockId:n.toString(),kind:F?"v4":"v3",contract:v,manager:F?K:j,chainId:c,owner:M,tokenId:Z,unlockTime:de,collectFeeBps:ae,feeRecipient:se,hookVerified:!!X,token0:ie,token1:re,withdrawn:!1}),I.push({module:"hoodlock",id:`lp-lock:${n.toString()}`,chainId:c,assets:[{token:{address:F?K:j,symbol:`UNI-${F?"V4":"V3"} #${Z}`,decimals:0,chainId:c},amount:"1"}],description:`HoodLock Uniswap ${F?"v4":"v3"} LP lock #${n} (NFT #${Z}, ${ie.symbol}/${re.symbol}, feeRecipient ${se}, collectFeeBps ${ae}) until Unix ${de}. One NFT held in LiquidityLocker custody for ${M}. Underlying token amounts are not valued.`})}let A=`Found ${x.length} active token lock(s) and ${$.length} active Uniswap v3/v4 LP lock(s) for ${a}.`;return{locks:x,lpLocks:$,positions:I,summary:A}}function Fe(e){return{name:"hoodlock_list_locks",inputSchema:{type:"object",properties:{owner:{type:"string",description:"Optional owner wallet address to query (defaults to the authenticated wallet)."},token:{type:"string",description:"Optional ERC-20 or LP token address to filter active locks owned by the wallet."}},additionalProperties:!1},async execute(o,t){let a=o.owner!==void 0?E(o.owner,"owner"):m(t),k=o.token!==void 0?E(o.token,"token"):void 0;return W(e,()=>be(e,a,k))}}}function Re(e){return async o=>(await W(e,()=>be(e,o))).positions}var G=e=>({tools:[Pe(e),Ce(e),Fe(e)],positions:Re(e)}),ze=G,je=G,Ke=e=>le("hoodlock",[G(e)]),We=G;export{T as a,C as b,v as c,j as d,K as e,qe as f,Ae as g,$e as h,Pe as i,Ce as j,Fe as k,Re as l,G as m,ze as n,je as o,Ke as p,We as q};
@@ -1 +0,0 @@
1
- import{a as d,d as T,e as p}from"./DJN3JAWB.js";import{a as S}from"./66F5ZH34.js";import{a as r}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as k,erc20Abi as E,getAddress as m,parseAbi as I}from"viem";var e={router:m("0x888888888889758F76e7103c6CbF23ABbF58F946"),oracle:m("0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2"),market:m("0xc2b89e6eca583e2c232201ac557e9be58af55f4c"),pt:m("0x6982e39521A070a3C40782548bfBED6Dc8F566ef"),yt:m("0xF35Ee6bd9A93fE42BC7e628BFC4DDbdc6DE1f615"),expiry:1805932800n},$="(uint8 swapType,address extRouter,bytes extCalldata,bool needScale)",C="(uint256 salt,uint256 expiry,uint256 nonce,uint8 orderType,address token,address YT,address maker,address receiver,uint256 makingAmount,uint256 lnImpliedRate,uint256 failSafeRate,bytes permit)",w=`(${C} order,bytes signature,uint256 makingAmount)`,O=`(address limitRouter,uint256 epsSkipMarket,${w}[] normalFills,${w}[] flashFills,bytes optData)`,M=`(address tokenIn,uint256 netTokenIn,address tokenMintSy,address pendleSwap,${$} swapData)`,F=`(address tokenOut,uint256 minTokenOut,address tokenRedeemSy,address pendleSwap,${$} swapData)`,_="(uint256 guessMin,uint256 guessMax,uint256 guessOffchain,uint256 maxIteration,uint256 eps)",b=I([`function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,${_} guessPtOut,${M} input,${O} limit) payable returns (uint256 netPtOut,uint256 netSyFee,uint256 netSyInterm)`,`function swapExactPtForToken(address receiver,address market,uint256 exactPtIn,${F} output,${O} limit) returns (uint256 netTokenOut,uint256 netSyFee,uint256 netSyInterm)`,`function redeemPyToToken(address receiver,address YT,uint256 netPyIn,${F} output) returns (uint256 netTokenOut,uint256 netSyInterm)`]),N=I(["function getPtToAssetRate(address market,uint32 duration) view returns (uint256)"]),h={address:e.pt,symbol:"PT-USDG",decimals:6,chainId:r},l="0x0000000000000000000000000000000000000000",D={swapType:0,extRouter:l,extCalldata:"0x",needScale:!1},A={limitRouter:l,epsSkipMarket:0n,normalFills:[],flashFills:[],optData:"0x"},B={guessMin:0n,guessMax:(1n<<256n)-1n,guessOffchain:0n,maxIteration:256n,eps:10n**14n},f=S("Exact USDG or PT base units (both 6 decimals).");function Y(i){let y=async()=>{if(i.network==="testnet")throw new u("Priors PT is configured only on chain 4663.");return i.clientFor(r).getBlock()};return{tools:[{name:"priors_pt_quote",inputSchema:{type:"object",properties:{side:{type:"string",enum:["buy","sell"]},amount:f},required:["side","amount"],additionalProperties:!1},async execute(n){let s=await y();if(s.timestamp>=e.expiry)throw new u("This PT market matured; use redemption.");let t=p(n.amount,"amount");if(t===0n||!["buy","sell"].includes(String(n.side)))throw new u("Provide buy or sell and a positive base-unit amount.");let a=await i.clientFor(r).readContract({address:e.oracle,abi:N,functionName:"getPtToAssetRate",args:[e.market,0]});if(a===0n)throw new u("PT oracle returned a zero rate.");return{chainId:r,token:h,market:e.market,blockNumber:s.number?.toString(),amountIn:t.toString(),estimatedOutput:(n.side==="buy"?t*10n**18n/a:t*a/10n**18n).toString(),rateE18:a.toString(),caveat:"Oracle spot estimate excludes own price impact and execution fees. Specify minOut explicitly and inspect the actual swap preview."}}},{name:"priors_pt_position",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(n,s){let t=await y(),a=await i.clientFor(r).readContract({address:e.pt,abi:E,functionName:"balanceOf",args:[m(s)]});return{token:h,balance:a.toString(),market:e.market,expiry:e.expiry.toString(),matured:t.timestamp>=e.expiry}}},...["buy","sell","redeem"].map(n=>({name:`priors_pt_${n}`,inputSchema:{type:"object",properties:{amount:f,minOut:f},required:["amount","minOut"],additionalProperties:!1},async execute(s,t){t=m(t);let a=await y(),x=a.timestamp>=e.expiry;if(n==="redeem"!==x)throw new u(x?"Market matured; redeem PT instead.":"PT redemption opens at maturity.");let o=p(s.amount,"amount"),c=p(s.minOut,"minOut");if(o===0n||c===0n)throw new u("amount and minOut must be positive base units.");let P={tokenOut:d.usdg,minTokenOut:c,tokenRedeemSy:d.usdg,pendleSwap:l,swapData:D},R=n==="buy"?k({abi:b,functionName:"swapExactTokenForPt",args:[t,e.market,c,B,{tokenIn:d.usdg,netTokenIn:o,tokenMintSy:d.usdg,pendleSwap:l,swapData:D},A]}):n==="sell"?k({abi:b,functionName:"swapExactPtForToken",args:[t,e.market,o,P,A]}):k({abi:b,functionName:"redeemPyToToken",args:[t,e.yt,o,P]}),g=[i.approval(n==="buy"?d.usdg:e.pt,e.router,o.toString(),r),i.unsignedTx({to:e.router,data:R,value:"0",chainId:r,description:`${n} PT-USDG, exact input ${o}, minimum output ${c} (6 decimals).`})],v=await i.preview(g,t);return{txs:g,summary:`Pendle PT ${n}: ${o} base units, minimum ${c}, receiver ${t}. No external aggregator. ${v.summary}`,terms:T({expiry:e.expiry,market:e.market})}}}))]}}export{e as a,b,Y as c};
@@ -1 +0,0 @@
1
- import{b as Y,e as Z}from"./FEYAY6OZ.js";import{a as U,b as L,c as D,d as G,e as _,f as W,g as J}from"./PIIHOXWF.js";import{d as C,e as $,v as H}from"./2THSW4QN.js";import{a as K}from"./IOYRL6AY.js";import{a as S}from"./66F5ZH34.js";import{c as h,g as Q}from"./NWNYJ26T.js";import{a as I,i as T}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as b,encodeFunctionData as ee,encodePacked as de,erc20Abi as me,getAddress as ue,parseAbi as N,parseAbiParameters as A,zeroAddress as v}from"viem";var te=ue("0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7"),ne=ue(T[4663].ponsTrade.quoter.address),fe=N(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),le=N(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),oe=N(["function factory() view returns (address)","function quoteExactInput(bytes path,uint256 amountIn) returns (uint256,uint160[],uint32[],uint256)","function quoteExactOutput(bytes path,uint256 amountOut) returns (uint256,uint160[],uint32[],uint256)"]),F="(address intermediateCurrency,uint24 fee,int24 tickSpacing,address hooks,bytes hookData)",M="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",re=N([`function quoteExactInput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactOutput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactInputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`,`function quoteExactOutputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`]),ye=A(`(address exactCurrency,${F}[] path,uint256[] minHopPriceX36,uint128 amount,uint128 limit)`);function he(u,t,r,d){let a=[],e=d?r:t,i=new Set([e]);for(let n of d?[...u].reverse():u){let s=n.currency0===e?n.currency1:n.currency1===e?n.currency0:void 0;if(!s||i.has(s))throw new o("V4 poolKeys must form a continuous route without repeated currencies.");a.push({intermediateCurrency:s,fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks,hookData:"0x"}),e=s,i.add(e)}if(e!==(d?t:r))throw new o("V4 route does not end at the requested currency.");return a}var xe=A(`(${M} poolKey,bool zeroForOne,uint128 amount,uint128 limit,uint256 minHopPriceX36,bytes hookData)`),be=A("address recipient,uint256 amount,uint256 limit,bytes path,bool payerIsUser,uint256[] minHopPriceX36"),we=A("address recipient,uint256 amount,uint256 limit,address[] path,bool payerIsUser,uint256[] minHopPriceX36"),ie=A("address,uint256"),ve=A("bytes,bytes[]");function Ae(u,t,r){let d=r?[...u].reverse():u,a=r?[...t].reverse():t,e=d[0];return a.forEach((i,n)=>{e=`${e}${de(["uint24","address"],[i,d[n+1]]).slice(2)}`}),e}var ae={version:{type:"string",enum:["v2","v3","v4"]},tokenIn:h,tokenOut:h,path:{type:"array",minItems:2,maxItems:6,items:h},fees:{type:"array",items:{type:"integer",minimum:0,maximum:1e6}},poolKeys:{type:"array",minItems:1,maxItems:5,items:{type:"object",required:["currency0","currency1","fee","tickSpacing","hooks"],properties:{currency0:h,currency1:h,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:h},additionalProperties:!1}},poolKey:{type:"object",properties:{currency0:h,currency1:h,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:h},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},amountIn:S(),amountOut:S(),minAmountOut:S(),maxAmountIn:S(),slippageBps:{type:"integer",minimum:0,maximum:9999}};async function ke(u,t,r,d=!1){J(t,Object.keys(ae));let a=t.version;if(!["v2","v3","v4"].includes(String(a)))throw new o("Provide version v2, v3 or v4.");let e=t.amountOut!==void 0;if(t.amountIn!==void 0===e)throw new o("Provide exactly one of amountIn or amountOut.");if(e&&t.minAmountOut!==void 0||!e&&t.maxAmountIn!==void 0)throw new o("Use maxAmountIn for exact output, minAmountOut for exact input.");let i=U(e?t.amountOut:t.amountIn,e?"amountOut":"amountIn",a==="v4"?128:160),n=D(t.tokenIn),s=D(t.tokenOut);if(n===s)throw new o("Swap requires different input and output currencies.");let w=u.clientFor(I),m=await w.getBlock(),z=G(t.slippageBps),g,f,q,k,x,p,R;if(a==="v4"){if(t.path!==void 0||t.fees!==void 0)throw new o("V4 uses poolKey or poolKeys; omit path and fees.");if(t.poolKey===void 0==(t.poolKeys===void 0))throw new o("Provide poolKey or poolKeys, not both.");if(t.poolKeys!==void 0){if(!Array.isArray(t.poolKeys)||t.poolKeys.length<1||t.poolKeys.length>5)throw new o("Provide 1 to 5 v4 poolKeys.");let c=t.poolKeys.map(P=>H(P));g=he(c,n,s,e),f=(await w.simulateContract({address:ne,abi:re,functionName:e?"quoteExactOutput":"quoteExactInput",args:[{exactCurrency:e?s:n,path:g,exactAmount:i}],account:r,gas:K,blockNumber:m.number})).result[0]}else{if(x=H(t.poolKey),![x.currency0,x.currency1].includes(n)||![x.currency0,x.currency1].includes(s))throw new o("PoolKey currencies differ from the requested swap.");f=(await w.simulateContract({address:ne,abi:re,functionName:e?"quoteExactOutputSingle":"quoteExactInputSingle",args:[{poolKey:x,zeroForOne:n===x.currency0,exactAmount:i,hookData:"0x"}],account:r,gas:K,blockNumber:m.number})).result[0]}k="0x10"}else{if(t.poolKey!==void 0||t.poolKeys!==void 0||n===v||s===v)throw new o("V2/v3 routes use ERC-20 tokens; wrap ETH to WETH first.");if(p=Array.isArray(t.path)?t.path.map(L):[n,s],p.length<2||p.length>6||p[0]!==n||p.at(-1)!==s||new Set(p).size!==p.length||p.includes(v))throw new o("Path must contain 2 to 6 distinct ERC-20 tokens in input-to-output order.");if(a==="v2"){if(t.fees!==void 0)throw new o("V2 fees are fixed by the pair; omit fees.");let c=await w.readContract({address:Y,abi:Z,functionName:e?"getAmountsIn":"getAmountsOut",args:[i,p],blockNumber:m.number});f=e?c[0]:c.at(-1),k=e?"0x09":"0x08"}else{let c=t.fees;if(!Array.isArray(c)||c.length!==p.length-1||c.some(P=>typeof P!="number"||!Number.isInteger(P)||P<0||P>1e6))throw new o("Provide one integer v3 fee in pips per path hop.");if(!Q(await w.readContract({address:te,abi:oe,functionName:"factory",blockNumber:m.number}),T[4663].uniswap.v3_factory.address))throw new o("V3 quoter is not configured for the pinned factory.");R=Ae(p,c,e),f=(await w.simulateContract({address:te,abi:oe,functionName:e?"quoteExactOutput":"quoteExactInput",args:[R,i],account:r,gas:K,blockNumber:m.number})).result[0],k=e?"0x01":"0x00"}}if(f<=0n)throw new o("No positive Uniswap quote is available.");let V=e?t.maxAmountIn:t.minAmountOut;if(!d&&V===void 0)throw new o(`Provide ${e?"maxAmountIn":"minAmountOut"} from uniswap_quote to confirm the trade bound.`);let l=V===void 0?e?(f*BigInt(1e4+z)+9999n)/10000n:f*BigInt(1e4-z)/10000n:U(V,e?"maxAmountIn":"minAmountOut",a==="v4"?128:160);if(l<=0n||(e?l<f:l>f))throw new o("The fresh quote does not satisfy the confirmed swap bound.");let y=e?l:i;if(y>=1n<<160n||a==="v4"&&(y>=1n<<128n||l>=1n<<128n))throw new o("Swap bounds exceed the router amount range.");let[se,ce]=await Promise.all([_(u,n,m.number),_(u,s,m.number)]),j={version:a,input:{token:se,amount:(e?f:i).toString()},output:{token:ce,amount:(e?i:f).toString()},[e?"maxAmountIn":"minAmountOut"]:l.toString(),blockNumber:m.number.toString(),expiresAt:(m.timestamp+60n).toString()};if(d)return{quote:j,summary:"Read-only on-chain quote. Repeat the same route with the returned bound in uniswap_swap; execution gets a fresh quote and preview."};let O=m.timestamp+300n,E=[],X="Native ETH input; no token approvals.";if(n!==v){let c=await w.readContract({address:n,abi:me,functionName:"allowance",args:[r,C],blockNumber:m.number});c!==y&&E.push(u.approval(n,C,y.toString(),I)),X=`${c===y?"Reuse existing exact ERC-20 allowance of":"Set ERC-20 allowance to exactly"} ${y} input base units to Permit2; exact router permit.`,E.push(u.unsignedTx({to:C,data:ee({abi:le,functionName:"approve",args:[n,$,y,Number(O)]}),value:"0",chainId:I,description:`Permit exactly ${y} input base units to Universal Router until ${O}.`}))}if(a==="v4"){let c=g?b(ye,[{exactCurrency:e?s:n,path:g,minHopPriceX36:[],amount:i,limit:l}]):b(xe,[{poolKey:x,zeroForOne:n===x.currency0,amount:i,limit:l,minHopPriceX36:0n,hookData:"0x"}]);q=b(ve,[g?e?"0x090c0f":"0x070c0f":e?"0x080c0f":"0x060c0f",[c,b(ie,[n,y]),b(ie,[s,e?i:l])]])}else a==="v2"?q=b(we,[r,i,l,p,!0,[]]):q=b(be,[r,i,l,R,!0,[]]);let B=[q];return n===v&&e&&(k=`${k}04`,B.push(b(A("address,address,uint256"),[v,r,0n]))),E.push(u.unsignedTx({to:$,data:ee({abi:fe,functionName:"execute",args:[k,B,O]}),value:n===v?y.toString():"0",chainId:I,description:`Uniswap ${a} ${e?"exact output":"exact input"} swap; recipient ${r}; deadline ${O}.`})),{...await W(u,E,r,`Swap through Universal Router 2.1.2. ${X} Fixed output/input bound and five-minute on-chain deadline. Venue fees included; gas excluded.`),quote:j}}function Ne(u){return{tools:[!0,!1].map(t=>({name:t?"uniswap_quote":"uniswap_swap",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenIn","tokenOut"],properties:ae},execute:(r,d)=>ke(u,r,d,t)}))}}export{te as a,ne as b,fe as c,le as d,oe as e,re as f,ye as g,he as h,xe as i,be as j,we as k,Ae as l,ke as m,Ne as n};
@@ -1 +0,0 @@
1
- import{b as s}from"./ZXJ24B4L.js";import{a as o,c as t}from"./DJN3JAWB.js";import{getAddress as i}from"viem";var u=new Set(["priors_status",...s,...t.filter(r=>r.read).map(r=>r.name),"priors_ethos_status","priors_request_borrow","priors_request_repay","priors_request_stock","priors_request_backing","priors_pt_quote","priors_pt_position","priors_stock_quote","priors_savings_liquidity","priors_market_origin","priors_market_pins","priors_capabilities"]),p=new Set(["priors_sign_consent",...t.filter(r=>r.consentRoot).map(r=>r.name)]),d=new Set([...p,"priors_starter_line"]),R=new Set([...t.filter(r=>!r.read).map(r=>r.name),"priors_root_offer","priors_autopay_on","priors_autopay_off","priors_pt_buy","priors_pt_sell","priors_pt_redeem","priors_savings_force_withdraw","priors_stock_swap","priors_market_clear_bid_budget","priors_market_revoke_nft","priors_x_link"]);function S(r){let _=t.find(e=>e.name===r);return _?[o[_.contract],..._.approval==="bid"?[o.bidSpender]:[]]:r==="priors_root_offer"?[o.pool]:r==="priors_autopay_on"||r==="priors_autopay_off"?[o.autopay]:r==="priors_savings_force_withdraw"?[o.savings]:r==="priors_stock_swap"?[i("0xCaf681a66D020601342297493863E78C959E5cb2"),i("0x7Cd4E04E433E69e588728c86A3832753B5F846d4")]:r==="priors_pt_buy"||r==="priors_pt_sell"||r==="priors_pt_redeem"?[i("0x888888888889758F76e7103c6CbF23ABbF58F946")]:r==="priors_market_clear_bid_budget"?[o.bidSpender]:r==="priors_market_revoke_nft"?[o.registry,"0x0000000000000000000000000000000000000000"]:r==="priors_x_link"?[o.registry]:[]}export{u as a,p as b,d as c,R as d,S as e};
@@ -1 +0,0 @@
1
- import{c as g,d as H,m as M}from"./LKXO2BQS.js";import{f as k,g as C}from"./PIIHOXWF.js";import{d,e as s,y as _}from"./2THSW4QN.js";import{g as h}from"./NWNYJ26T.js";import{a as w}from"./FWD4L3CJ.js";import{a as t}from"./XSD5NL7J.js";import{decodeFunctionData as b,encodeFunctionData as B,erc20Abi as $,getAddress as O}from"viem";function K(u){return{tools:[{name:"uniswap_swap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["routes"],properties:{routes:{type:"array",minItems:1,maxItems:20,items:{type:"object",description:"Complete uniswap_swap arguments, including an absolute minAmountOut or maxAmountIn."}}}},async execute(n,v){if(C(n,["routes"]),!Array.isArray(n.routes)||n.routes.length<1||n.routes.length>20)throw new t("Provide 1 to 20 explicit bounded Uniswap routes.");let c=new Map,i="0x",A=0n,a,m=[],y=new Set;for(let e of n.routes){if(!e||typeof e!="object"||Array.isArray(e))throw new t("Each route must contain uniswap_swap arguments.");let I=await M(u,e,v,!1);if(!("txs"in I))throw new t("Route did not build swap transactions.");let E=I.txs;for(let r of E.slice(0,-1))if(h(r.to,d)){let[o,D,N,S]=b({abi:H,data:r.data}).args;if(D!==s)throw new t("Unexpected route approval spender.");let T=o.toLowerCase(),p=c.get(T),U=(p?.amount??0n)+N;if(U>=1n<<160n)throw new t("Combined input approvals exceed uint160.");c.set(T,{token:o,amount:U,expiration:p&&p.expiration<BigInt(S)?p.expiration:BigInt(S)})}else{let o=b({abi:$,data:r.data});if(o.functionName!=="approve"||!h(o.args[0],d))throw new t("Unexpected route prerequisite.")}let f=E.at(-1);if(f.to!==s)throw new t("Route does not use the pinned Universal Router.");A+=BigInt(f.value);let[j,x,P]=b({abi:g,data:f.data}).args,R=j.slice(2).match(/../g)??[];if(R.length!==x.length)throw new t("Unexpected route command/parameter count.");R.forEach((r,o)=>{r==="04"?y.add(x[o]):(i=`${i}${r}`,m.push(x[o]))}),a=a===void 0||P<a?P:a}for(let e of y)i=`${i}04`,m.push(e);let l=[];for(let e of c.values())l.push(u.approval(O(e.token),d,e.amount.toString(),w),_(e.token,s,e.amount.toString(),e.expiration.toString()));return l.push(u.unsignedTx({to:s,data:B({abi:g,functionName:"execute",args:[i,m,a]}),value:A.toString(),chainId:w,description:`Atomically execute ${n.routes.length} caller-selected v2/v3/v4 routes, preserving each route's trade bound.`})),k(u,l,v,"Explicit mixed-version/split routes; every route must meet its own bound. No automatic best-route search or allow-revert branch. The wallet must fund each independently previewed route.")}}]}}export{K as a};
@@ -1 +0,0 @@
1
- import{n as k}from"./BOVMED7R.js";import{a as y}from"./U4JGEMKT.js";import{b as T}from"./43LI5NKJ.js";import{b as R}from"./66F5ZH34.js";import{c as _,d as I,g as v,i as $,n as V}from"./NWNYJ26T.js";import{a as u}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as D,erc20Abi as O,getAddress as C,parseAbi as S}from"viem";var N=C("0x0000000000bbf5c5fd284e657f01bd000933c96d"),b=C("0x0a0d53b6684c7b32b4cbef5fe8483bfcc8406742"),U=C("0x00700052c0608F670705380a4900e0a8080010CC"),x=S(["function getCollectedFees(address partner,address token) view returns (uint256)","function withdrawAllFees(address token,address recipient) returns (uint256 amount)","function getBalance(address token,address partner) view returns (uint256)","function withdrawAllERC20(address token,address recipient) returns (bool)","function withdrawNative(uint256 amount,address owner,address receiver)"]),H=(1n<<256n)-1n,P={type:"string",enum:["market","delta"]};function p(t){return $(t,"Provide a token or wallet address.",I)}function A(t){if(t!=="market"&&t!=="delta")throw new o("Choose market or delta fees.");return t}function B(t){return V(t,"Amount must be positive and within uint256.",{notString:"Amount must be a decimal base-unit string.",positive:!0}).toString()}function E(t,m,d){if(d=p(d),t==="velora_unwrap_deth"){for(let e of Object.keys(m))if(e!=="amount")throw new o(`Unsupported ${t} argument: ${e}.`);let a=B(m.amount);return{tx:T({to:b,chainId:u,value:"0",data:D({abi:x,functionName:"withdrawNative",args:[BigInt(a),d,d]}),description:`Unwrap ${a} dETH base units into the same amount of native ETH for ${d} on chain ${u}.`}),inputs:[{token:b,amount:a}]}}if(t!=="velora_claim_fees")throw new o("Unknown Velora claim action.");for(let a of Object.keys(m))if(!["token","kind"].includes(a))throw new o(`Unsupported ${t} argument: ${a}.`);let f=p(m.token);if(k(f))throw new o("Velora fee claims require an ERC-20 token address.");let c=A(m.kind);return{tx:T({to:c==="delta"?N:U,chainId:u,value:"0",data:D({abi:x,functionName:c==="delta"?"withdrawAllFees":"withdrawAllERC20",args:[f,d]}),description:`Claim the full accrued ${c} fee balance of ${f} to ${d} on chain ${u}. Receipt amount can change before mining; no minimum is encoded.`}),inputs:[]}}function Q(t,m,d,f){let{tx:c}=E(m,d,f),a=t[0];if(t.length!==1||!a||a.chainId!==c.chainId||!v(a.to,c.to)||!v(a.data,c.data)||a.value!==c.value)throw new o("Velora claim calldata, recipient, amount or destination differs from the request.")}function X(t){let m=async()=>{let e=t.clientFor(u);if(await e.getChainId()!==u)throw new o("Velora requires an RPC on chain 4663.");return e};async function d(e){if(e===b)return{address:e,symbol:"dETH",decimals:18,chainId:u};let n=await m(),[s,i]=await Promise.all([y(n,u,e,"symbol"),y(n,u,e,"decimals")]);if(typeof s!="string"||!s.trim()||!Number.isInteger(i)||i<0||i>255)throw new o("Velora fee token metadata is unavailable.");return{address:e,symbol:s,decimals:i,chainId:u}}async function f(e,n){let s=A(e.kind),i=p(e.token);if(k(i))throw new o("Velora fee claims require an ERC-20 token address.");let r=await(await m()).readContract({address:s==="delta"?N:U,abi:x,functionName:s==="delta"?"getCollectedFees":"getBalance",args:s==="delta"?[n,i]:[i,n]});if(typeof r!="bigint"||r<0n||r>H)throw new o("Velora fee balance is unavailable.");return r}function c(e,n,s,i){return{name:e,inputSchema:{type:"object",additionalProperties:!1,properties:n,required:s},execute:async(w,r)=>{try{r=p(r);for(let l of Object.keys(w))if(!Object.hasOwn(n,l))throw new o(`Unsupported ${e} argument: ${l}.`);return await i(w,r)}catch(l){throw new o(t.plainError(l))}}}}let a={token:_,kind:P};return[c("velora_fee_balance",a,["token","kind"],async(e,n)=>({kind:A(e.kind),token:await d(p(e.token)),amount:(await f(e,n)).toString()})),c("velora_claim_fees",a,["token","kind"],async(e,n)=>{let{tx:s}=E("velora_claim_fees",e,n),i=await f(e,n);if(i===0n)throw new o("No accrued Velora fees for this wallet and token.");let w=await d(p(e.token)),r=[s],l=await t.preview(r,n);return{txs:r,preview:l,estimatedReceipt:{token:w,amount:i.toString()},summary:`${s.description} ${l.summary}`}}),c("velora_unwrap_deth",{amount:R("Positive amount of wallet-held dETH in base units (18 decimals).")},["amount"],async(e,n)=>{let{tx:s,inputs:i}=E("velora_unwrap_deth",e,n),r=await(await m()).readContract({address:b,abi:O,functionName:"balanceOf",args:[n]});if(typeof r!="bigint"||r<0n||r>H)throw new o("Wallet dETH balance is unavailable.");if(r<BigInt(i[0].amount))throw new o("Insufficient wallet-held dETH. An active native Delta order must first settle, expire or cancel.");let l=[s],g=await t.preview(l,n);if(g.changes.filter(h=>h.token.chainId===u&&k(h.token.address)).reduce((h,F)=>h+BigInt(F.amount),0n)<BigInt(i[0].amount))throw new o("Velora dETH preview does not return the requested native ETH amount.");return{txs:l,preview:g,summary:`${s.description} ${g.summary}`}})]}export{N as a,b,U as c,x as d,E as e,Q as f,X as g};
@@ -1 +0,0 @@
1
- import{a as J,h as K}from"./QQECG3WP.js";import{a as F}from"./43LI5NKJ.js";import{a as E}from"./66F5ZH34.js";import{c as D,d as Y,g as _,i as V,m as Q,n as z}from"./NWNYJ26T.js";import{a as p,i as G,j}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{decodeFunctionData as X,encodeFunctionData as U,erc20Abi as O,getAddress as N,parseAbi as Z}from"viem";var e={router:N("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:N("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:N("0x8697bb63743678640710b1270e98772a29642b3c"),weth:N("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:N("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},L=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),W={vault:D,chainId:{const:p},slippageBps:{type:"integer",minimum:0,maximum:500}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,w){let l=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==w.length&&l();for(let S=0;S<s.length;S++){let q=s[S],v=w[S];if((q.chainId!==v.chainId||!_(q.to,v.to)||q.value!==v.value)&&l(),!_(q.data,v.data))try{let B=X({abi:L,data:q.data}),n=X({abi:L,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&l();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:l(),i=U({abi:L,functionName:B.functionName,args:t});_(i,q.data)||l();let u=t.length-1;(f(t[u])<=f(a[u])-600n||f(t[u])>f(a[u]))&&l(),t[u]=a[u];for(let o of r)f(t[o])<f(a[o])&&l(),t[o]=a[o];_(U({abi:L,functionName:B.functionName,args:t}),v.data)||l()}catch{l()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function R(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function f(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let w=s??50;if(typeof w!="number"||!Number.isInteger(w)||w<0||w>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(w)}function H(s,w){let l=s*(10000n-w)/10000n;if(l===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return l}var ce=s=>{async function w(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function l(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==N(G[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function S(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=f(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=f(a.timestamp)+600n,i=(P,g,A=[])=>n.readContract({address:P,abi:L,functionName:g,args:A,blockNumber:t}),[u,o,m,c,h,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:G[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||h!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(P,g)=>f(await n.readContract({address:P,abi:O,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(P){let[g,A]=await Promise.all([n.readContract({address:P,abi:O,functionName:"symbol",blockNumber:t}),n.readContract({address:P,abi:O,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:P,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function q(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:D,chainId:{const:p},amount:{...E(),description:"Optional CLM entry budget in the bridge token base units."},slippageBps:W.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>w(async()=>{if(J.some(b=>_(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);l(n,[]),F(t);let a=await S(),[r,i,u,o,m,c,h]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:f(o[0]).toString()},{token:i,balance:c.toString(),reserve:f(o[1]).toString()}],lp:{token:u,balance:h.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...W,from:D,to:D,amount:E()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["from","to","amount","slippageBps"]),F(t);let a=y(n.from),r=y(n.to),i=R(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,N(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await S();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let h=[];m&&h.push(v(e.weth,U({abi:L,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let I=0;I<g.length-1;I++){let C={from:g[I],to:g[I+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let x=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(x)||x.length!==g.length||f(x[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let I of x)if(f(I)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=f(x.at(-1)),T=H(k,u),h.push(s.approval(b,e.router,i.toString(),p)),h.push(v(e.router,U({abi:L,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let P=await c.token(r);return{...await q(h,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:P,amount:k.toString()},minimumOutput:{token:P,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...W,amount0:E(),amount1:E()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["amount0","amount1","slippageBps"]),F(t);let a=R(n.amount0),r=R(n.amount1),i=M(n.slippageBps),u=await S();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=f(o[0]),c=f(o[1]),h=f(o[2]);if(m>a||c>r||h===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=H(m,i),k=H(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,U({abi:L,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await q(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:h.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...W,amount:{anyOf:[E(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>w(async()=>{l(n,["amount","slippageBps"]),F(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:R(n.amount),i=await S(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,h]=await Promise.all([i.client.readContract({address:e.pair,abi:O,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(f(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=H(c*o/m,a),k=H(h*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,U({abi:L,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await q(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,L as b,ue as c,de as d,ce as e};
@@ -1 +0,0 @@
1
- import{b as bt}from"./I26DMNJG.js";import{c as ft}from"./L5BLHY34.js";import{b as mt}from"./ZSN4IRI5.js";import{b as ht}from"./QYVREJYC.js";import{b as pt}from"./Z6LZGCVW.js";import{c as ut}from"./ZXJ24B4L.js";import{b as gt}from"./WTXC3XKW.js";import{h as ct}from"./DJN3JAWB.js";import{a as C,b as x,c as Ie,d as me,e as Ge,g as rt,h as Ve,j as U,l as E,o as Fe,p as st,q as at,r as Me,s as dt,t as qe,u as lt}from"./WLMWWEP7.js";import{b as ot,o as it}from"./BOVMED7R.js";import{b as et}from"./SPJCSEKP.js";import{a as z}from"./43LI5NKJ.js";import{a as tt,c as nt}from"./VEQBHI6O.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 Rt,ContractFunctionRevertedError as Ye,decodeEventLog as jt,decodeFunctionResult as zt,encodeFunctionData as X,erc20Abi as Jt,getAddress as B,parseAbi as ke,parseAbiItem as Xt,recoverAddress as Yt,recoverMessageAddress as Zt,recoverTypedDataAddress as Kt}from"viem";var Qt="https://priors.trade/api/check",He=604800n,wt=50n,yt=10000n,We=5000000n,$t=500000000n,je=86400n,St=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).`,en="0x6982e39521a070a3c40782548bfbed6dc8f566ef",tn=["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)},re={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)"]),At=ke(["function available(uint256 agentId) view returns (uint256)","function score(uint256 id) view returns (uint256)"]),_t=ke(["function ownerOf(uint256 agentId) view returns (address)","function balanceOf(address owner) view returns (uint256)","function getAgentWallet(uint256 agentId) view returns (address)"]),vt=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 nn(e){return e.chainId===$&&e.address.toLowerCase()===c.usdg.toLowerCase()}function on(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=nn(i.token)?"USDG":i.token.address;return`${u?"-":"+"}${R} ${A}`}function te(e,i,g){if(!g.length)return i;let u=g.map(f=>on(e,f)).join(", ");return`${i} Preview changes: ${u}.`}function Pt(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:_t,functionName:"ownerOf",args:[i],blockNumber:g}))}catch(u){throw u instanceof Rt&&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 rn(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=jt({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:_t,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,L=u;for(;;){let H=L>9999999n?L-9999999n:0n,ne=await g.getLogs({address:c.registry,event:Xt("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:i},fromBlock:H,toBlock:L,strict:!0});for(let O of ne){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.");L=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]})]),L=B(R);if(!A)throw new a(`Wallet ${g} is not an on-chain controller for ERC-8004 agent ${i} (ownerOf=${f}, delegateOf=${L}). An off-chain /api/check paymentWallet match alone does not grant CreditPoolV2 control.`);return{owner:f,delegate:L}}function sn(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 an(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,L,H,ne,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:x,abi:E,functionName:"firstLined",args:[i],blockNumber:f}),u.readContract({address:x,abi:E,functionName:"agentId",blockNumber:f}),u.readContract({address:x,abi:E,functionName:"rules",blockNumber:f}),u.readContract({address:x,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:Jt,functionName:"balanceOf",args:[g],blockNumber:f})]);return{owner:R,agent:we(A),firstLined:L===!0,root:BigInt(H),firstLineAmount:BigInt(ne[1]),epochRoom:BigInt(O),bond:ye(J),bondAmount:BigInt(ge),releaseAt:BigInt(Z),unusedAfter:BigInt(se),usdg:BigInt(Te)}}function It(e,i){return e.enrolled||e.enrolledAt>0n||e.isRoot||e.defaulted||e.importedFromV1||e.loansRepaid>0n||e.sponsor!==0n||i}function Ct(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 dn(e,i){let g=i instanceof Rt?i.walk(L=>L instanceof Ye):void 0,u=g instanceof Ye?g.data:void 0,f=u?.args??[],R=L=>`${e.formatAmount(String(L),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 ln=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 base-unit integer string (e.g. "1000000" for 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=Pt(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]})}]}),[P,_]=v.results;if(P?.status!=="success"||_?.status!=="success")throw new a("Approval or deposit simulation failed.");l=zt({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),I=`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:te(e,I,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*wt/yt:0n,I=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}.`})],P=await e.preview(v,o),_=e.formatAmount(I.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:te(e,M,P.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 base-unit integer string (e.g. "5000000" for 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 ceiling on the origination fee, USDG base units; must equal the pool's current quote for this principal and term. Omit to use that quote. The fee is pro-rated by term, not flat: 1666 for 5 USDG over 1 day on the first live run (2026-10-31)."}}},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=sn(r,w),m=Pt(n,"principal","amount","USDG borrow principal");if(m<We||m>$t)throw new a(`Borrow principal must be between ${We} (5 USDG) and ${$t} (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>St)throw new a(`Loan term must be between ${je} (1 day) and ${St} (30 days) seconds.`);let I=await p.readContract({address:c.pool,abi:S,functionName:"quoteFee",args:[r,m,h]}),l=I[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 P=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 ${P}, 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(P.toString(),N),j=e.formatAmount(v.toString(),N),$e=e.formatAmount(_.toString(),N),q=I[1]+I[3],K=I[2],de=l-q-K,oe=`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 (${P} 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:te(e,oe,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=an(n);if(k.length>0){let D=rn(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}).`}),I=[m,h],l=await e.preview(I,o),v=e.formatAmount(w.toString(),N),P=e.formatAmount(d.principal.toString(),N),_=e.formatAmount(d.fee.toString(),N),F=`Approve and repay ${v} USDG (${w} base units: ${P} USDG principal + ${_} USDG fixed fee) for Priors loan ${d.loanId} (agent ${t}).`;return{txs:I,summary:te(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:vt,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*wt/yt:0n,I=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,P=!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,oe,Ot,Ut,Be,Ne,Le]=await Promise.all([t.readContract({address:c.lens,abi:At,functionName:"score",args:[l]}),t.readContract({address:x,abi:E,functionName:"firstLined",args:[l]}),t.readContract({address:x,abi:E,functionName:"agentId"}),t.readContract({address:x,abi:E,functionName:"rules"}),t.readContract({address:x,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]})]),[Et,Gt,Vt,Ft,Mt,qt]=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:At,functionName:"available",args:[l]}),t.readContract({address:c.stockVault,abi:vt,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]})]),xe=await De(e,l),Ht=B(Mt),Ke=qt,y=we(Et),Se=y.delegatedIn>y.principalOut?y.delegatedIn-y.principalOut:0n;P=y.enrolled&&!y.isRoot&&!y.defaulted&&!y.frozen&&y.sponsor>0n&&y.delegatedIn>0n,F=Vt.toString(),k=Ft.toString();let Wt=await Promise.all(Gt.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 Wt)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:re})}v={agentId:l.toString(),owner:xe,delegate:Ht,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(Ut),ie=Q.depositor!==Je,ve=ie&&V(Q.depositor,o),Qe=It(y,Oe),Ue=V(xe,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:re},W={contract:C,posted:ie,depositor:ie?Q.depositor:null,postedByWallet:ve,postedAt:ie?Q.at.toString():null,amount:(ie?Q.amount:BigInt(Be)).toString(),releasable:ie&&Le===!0,releaseAt:ie?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(oe[1]).toString(),bondAmount:BigInt(Be).toString(),treasuryRoot:Ae.toString(),treasuryRoomThisWeek:BigInt(Ot).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 ${xe}); 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)`:""}.`:P&&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${Le===!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(oe[1]))} line from Priors' treasury (each transaction and signature is confirmed).`:ve?j=Le===!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; ${Ct(e,y,Ae,Oe)}.`}let $e=null;if(n.includeApiCheck){let q=l!==null?`agent=${l.toString()}`:`address=${o}`,K=await nt(e.http,`${Qt}?${q}`,{method:"GET"},Y),de=Array.isArray(K.agents)?K.agents.find(oe=>Y(oe)&&String(oe.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:re,contracts:c,lender:{shares:r.toString(),grossAssets:b.toString(),earlyExitFeeAssets:h.toString(),netWithdrawAssets:I.toString(),lastDepositAt:p.toString(),withinMinHoldWindow:m,minHoldSeconds:He.toString()},hasFundedLine:P,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(en),zeroCapAssets:tn.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 L(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 (${x}) answers root #${o.root}, not the pinned #${Ie}. Nothing was signed; update Oak.`);if(It(o.agent,o.firstLined))throw new a(`Agent #${n} already has a Priors record, so priors_starter_line posts no bond and signs nothing: ${Ct(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 ne="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 ${ne} (${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(ne)||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 ${ne} (${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=dt(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:`${L(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:`${L(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):"",P=typeof l.reopensAt=="number"&&Number.isSafeInteger(l.reopensAt)&&l.reopensAt>0?l.reopensAt:null;return{summary:`${L(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")}${P?`, reopens ${G(P)}`:""}. ${lt({...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:P}}}}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=`${L(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, ${x}) 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:te(e,h,b.changes)}}async function kt(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 Dt(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 Zt({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:x,abi:E,functionName:"inviteDigest",args:[n,b.expiry]});if(h.toLowerCase()!==at(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 I=await Yt({hash:h,signature:b.signature}),[l,v]=await Promise.all([m.readContract({address:x,abi:E,functionName:"inviters",args:[I]}),m.readContract({address:x,abi:E,functionName:"inviteUsed",args:[h]})]);if(l!==!0)throw new a(`Priors' invite for agent #${r} was signed by ${I}, 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[P,_]=await Promise.all([m.readContract({address:c.pool,abi:S,functionName:"nonces",args:[n]}),m.getBlock()]),F=_.timestamp+BigInt(rt),k=Fe({agentId:r,owner:s,nonce:P.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:P,deadline:F}]});if(D.toLowerCase()!==st(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 ${I}, 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 ${P}, valid until ${G(F)}. A transaction redeeming the invite (TreasurySponsorV4.firstLine) follows for your confirmation. ${O(d)}`}}async function Tt(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 Kt({...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,I]=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(I.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:x,abi:E,functionName:"firstLine",args:v,account:s})}catch(k){throw new a(`TreasurySponsorV4.firstLine for agent #${r} would be refused: ${dn(e,k)} Nothing was offered. ${O(b)}`)}let P=e.unsignedTx({to:x,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([P],s),F=`Redeem agent #${r}'s Priors invite: TreasurySponsorV4.firstLine (${x}) 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:[P],summary:te(e,F,_.changes)}}let Bt={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"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"}}},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(()=>kt(r,o,t))}if(t.stage==="proof")return p(()=>Dt(r,o,t,n.signature));if(t.stage==="consent")return p(()=>Tt(r,o,t,n.signature));throw new a("Unknown Priors starter-line stage; start priors_starter_line again.")}},Nt={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:x,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),I=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),P=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 (${I?`Priors' treasury, root #${b}`:`root #${m.sponsor}`}) and the agent can no longer borrow on it. This does not reopen: ${I?`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."}${P} No USDG moves in this transaction.`;return{txs:[l],summary:te(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 P=we(b),_=P.defaulted?"the agent defaulted, so the bond is forfeited to Priors' Safe (InviteBond.slash)":P.activeLoans>0n?`the agent has ${P.activeLoans} loan(s) open: repay with priors_repay, close the line with priors_close_line, then release`:P.delegatedIn>0n?`the agent still holds a ${A(P.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 I=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([I],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:[I],summary:te(e,v,l.changes)}}};async function xt(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:re,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 I=await o.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[h]});return Ce(h,I)}));for(let h of b)if(h.agentId===d&&h.status===1){let I=h.principal+h.fee;p.push({module:"priors",id:`priors:loan:${h.loanId.toString()}`,chainId:$,assets:[{token:re,amount:I.toString()}],description:`Priors CreditPoolV2 active loan ${h.loanId} for agent ${d} (fixed due ${e.formatAmount(I.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:re,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 gt(e,s,r,re)),p}return{tools:[i,g,u,f,R,Bt,Nt,Lt],positions:xt}},cn=e=>{let i=ln(e),g=[i,ct(e),ut(e),ft(e),mt(e),ht(e),bt(e),pt()];return{...i,tools:g.flatMap(u=>u.tools)}},Dn=e=>et("priors",[cn(e)]);export{Qt as a,He as b,wt as c,yt as d,We as e,$t as f,je as g,St as h,c as i,re as j,rn as k,cn as l,Dn as m};
@@ -1 +0,0 @@
1
- import{e as g,f as T,g as k,i as E}from"./DHUDSOGR.js";import{c as _,d as S}from"./AEL62KCG.js";import{g as h}from"./NWNYJ26T.js";import{a as l}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{decodeAbiParameters as B,encodeAbiParameters as H,getAddress as d}from"viem";var D=d("0xcEF685D4796FA80F71a97e803D2c0b6719F1b4E2"),O=[{name:"items",type:"tuple[]",components:[{...k[0],name:"offer"},{name:"ratifierData",type:"bytes"}]}],G=p=>({tools:[{name:"longbow_fixed_offers",inputSchema:{type:"object",additionalProperties:!1,properties:{limit:{type:"integer",minimum:1,maximum:50},marketId:{type:"string"}}},execute:async o=>{try{let a=o.limit??20;if(Object.keys(o).some(s=>!["limit","marketId"].includes(s))||!Number.isInteger(a)||Number(a)<1||Number(a)>50||o.marketId!==void 0&&(typeof o.marketId!="string"||!/^0x[0-9a-f]{64}$/i.test(o.marketId)))throw new i("Use limit 1..50 and an optional exact bytes32 marketId.");let f=await p.http("https://longbow.credit/api/fixed/offers",{method:"GET",redirect:"error"});if(!f.ok)throw new i(`Longbow fixed order book returned HTTP ${f.status}; offers are unavailable.`);let x=await f.text();if(x.length>2e6)throw new i("Longbow fixed order book exceeds the supported response size.");let t=JSON.parse(x);if(!t||t.chainId!==l||typeof t.mempool!="string"||d(t.mempool)!==D||!Array.isArray(t.publications)||t.publications.length>1e3||!Number.isSafeInteger(t.head)||Number(t.head)<0)throw new i("Longbow fixed indexer does not match the pinned chain, mempool or publication schema.");let c=[],u=[],y=0;for(let[s,m]of t.publications.entries())try{if(!m||typeof m!="object")throw new i("Invalid publication.");let r=m,n=r.itemsAbi;if(!Number.isSafeInteger(r.blockNumber)||Number(r.blockNumber)<0||Number(r.blockNumber)>Number(t.head))throw new i("Invalid publication block.");if(typeof n!="string"||!/^0x[0-9a-f]+$/i.test(n)||n.length>1e6||n.length<130||BigInt(`0x${n.slice(2,66)}`)!==32n||BigInt(`0x${n.slice(66,130)}`)>512n)throw new i("Invalid or oversized publication encoding.");let[I]=B(O,n);if(I.length!==r.items)throw new i("Publication count mismatch.");for(let b of I){y++;let e=b.offer;if(e.market.chainId!==BigInt(l)||d(e.market.midnight)!==g||b.ratifierData.length>32770)throw new i("Publication market or proof is unqualified.");let w=E(e.market);if(o.marketId!==void 0&&!h(w,String(o.marketId)))continue;let N=[_,S].find(P=>h(P.address,e.market.loanToken));c.push({marketId:w,offer:H(k,[e]),ratifierData:b.ratifierData,maker:d(e.maker),buy:e.buy,maturity:e.market.maturity.toString(),start:e.start.toString(),expiry:e.expiry.toString(),tick:e.tick.toString(),loanToken:N??null,directBuilderSupported:!!N&&/^0x0{40}$/i.test(e.callback)&&e.callbackData==="0x"&&T.includes(d(e.ratifier)),sourceBlock:String(r.blockNumber)})}}catch(r){u.push({publication:s,reason:p.plainError(r)})}return c.sort((s,m)=>BigInt(s.expiry)>BigInt(m.expiry)?-1:BigInt(s.expiry)<BigInt(m.expiry)?1:0),{chainId:l,midnight:g,mempool:D,indexedHead:String(t.head),decodedCount:y,matchingCount:c.length,offers:c.slice(0,Number(a)),incomplete:u.length>0||t.skipped!==0,rejected:u,warning:"Historical off-chain publications, not executable quotes. Expiry, consumption, authorization, signatures and liquidity are not verified here. Use morpho_midnight_status and preview morpho_midnight_take with the returned exact offer/proof; callback offers need a separately qualified builder. This read publishes nothing and creates no signature."}}catch(a){throw new i(p.plainError(a))}}}]});export{D as a,O as b,G as c};
@@ -1 +0,0 @@
1
- import{a as g}from"./X5V2Z2NM.js";import{a as m}from"./43LI5NKJ.js";import{a as v}from"./66F5ZH34.js";import{e as A,g as u,i as b}from"./NWNYJ26T.js";import{a as l,i as x,s as y}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{b as w}from"./JXOEJPJ4.js";import{Buffer as k}from"node:buffer";import{decodeEventLog as $}from"viem";var R="Profile contents and oak.registrar are mutable, self-asserted metadata, not registry-validated claims or proof of provenance.",B="oak.registrar",D="0x6f616b",L=v("Agent ID as a decimal uint256 integer string."),j={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},q={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"32-byte hex value."},z={type:"string",pattern:"^0x([0-9a-fA-F]{2})*$"},T="0x0000000000000000000000000000000000000000";function h(t){let e=t.network??"mainnet",{chainId:n,identityRegistry:r}=y[e],s=e==="mainnet"?x[l].identity:void 0;return{network:e,chainId:n,registry:r,registryId:`eip155:${n}:${r}`,reputation:s?.reputationRegistry.address,validation:s?.validationRegistry.address}}function K(t){let{chainId:e,reputation:n}=h(t);if(!n)throw new o("Oak has no pinned ERC-8004 reputation registry for this network.");return{chainId:e,address:n}}function V(t){let{chainId:e,validation:n}=h(t);if(!n)throw new o("Oak has no pinned ERC-8004 validation registry for this network.");return{chainId:e,address:n}}function Z(t){return u(t,T)}function G(t){if(typeof t!="string"||!/^[0-9]+$/.test(t)||t.length>78||BigInt(t)>=2n**256n)throw new o("Provide an agent ID as a decimal uint256 integer string.");return BigInt(t)}function J(t,e){return b(t,`Provide a valid ${e} address.`)}function Q(t,e){let n=h(t).chainId;if(e!==void 0&&e!==n)throw new o(`ERC-8004 actions are supported only on chain ${n}.`)}function X(t,e){if(typeof t!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t))throw new o(`Provide ${e} as 32-byte hex.`);return t.toLowerCase()}function I(t,e,n,r=!0){if(t===void 0){if(r)return"";throw new o(`Provide ${e}.`)}if(typeof t!="string"||!r&&!t.trim()||t.length>n||w(t))throw new o(`${e} must be plain text of at most ${n} characters.`);return t}function Y(t,e){if(typeof t!="string"||!t.trim()||t.length>2048)throw new o(`Provide a valid ${e}.`);try{let n=new URL(t);if(!["https:","ipfs:"].includes(n.protocol)||!n.hostname||n.username||n.password||w(t))throw new Error}catch{throw new o(`${e} must be an HTTPS or IPFS URI without credentials.`)}return t}function tt(t){let e=/^data:application\/json;base64,([A-Za-z0-9+/=]+)$/.exec(t);if(e)try{let n=JSON.parse(k.from(e[1],"base64").toString("utf8"));return A(n)?n:void 0}catch{return}}async function C(t,e,n,r,s=!0){let i=await t.preview(e,n),a=i.changes.map(({amount:d,token:f})=>{let c=d.startsWith("-");return`${c?"-":""}${t.formatAmount(c?d.slice(1):d,f.decimals)} ${f.symbol} (${f.address}, chain ${f.chainId})`});return{txs:e,summary:`${i.summary} ${a.join("; ")} ${s?`${R} `:""}${r}`}}async function et(t,e,n,r="update this profile"){let{chainId:s,registry:i}=h(t),a=t.clientFor(s),d=await a.readContract({address:i,abi:g,functionName:"ownerOf",args:[e]});if(m(d),u(d,n))return d;let[f,c]=await Promise.all([a.readContract({address:i,abi:g,functionName:"getApproved",args:[e]}),a.readContract({address:i,abi:g,functionName:"isApprovedForAll",args:[d,n]})]);if(m(f),typeof c!="boolean")throw new o("The registry returned invalid operator approval data.");if(!u(f,n)&&!c)throw new o(`Only the agent owner or an approved operator can ${r}.`);return d}async function nt(t,e,n){let{chainId:r,registry:s}=h(t),i=t.clientFor(r),a=await i.readContract({address:s,abi:g,functionName:"ownerOf",args:[e]});if(m(a),u(a,n))return a;if(await i.readContract({address:s,abi:g,functionName:"isApprovedForAll",args:[a,n]})!==!0)throw new o("Only the agent owner or an operator approved for all of its agents can change the token approval.");return a}async function H(t,e,n,r,s){let{chainId:i,registry:a}=h(t),d=s??a;if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new o("Provide the mined transaction hash.");let f=t.clientFor(i),c=await f.getTransactionReceipt({hash:e});if(!c)throw new o("The transaction is not mined yet. Try again after confirmation.");if(c.status!=="success"||!c.to||!u(c.to,d)||!u(c.from,n)||!u(c.transactionHash,e))throw new o("The receipt is not a successful matching registry transaction.");let p=await f.getTransaction({hash:e});if(p.chainId!==i||p.value!==0n||!p.to||!u(p.to,d)||!u(p.from,n))throw new o("The transaction does not match this chain, registry and wallet.");if(!(typeof r=="function"?typeof p.input=="string"&&r(p.input):typeof p.input=="string"&&u(p.input,r)))throw new o("The mined transaction calldata does not match the exact operation Oak built.");return c}function rt(t,e,n,r){let s=t.logs.filter(i=>u(i.address,e)&&!i.removed).flatMap(i=>{try{let a=$({abi:n,topics:i.topics,data:i.data,strict:!0});return a.eventName===r?[a.args]:[]}catch{return[]}});if(s.length!==1)throw new o(`The receipt must contain one matching ${r} event.`);return s[0]}function ot(t){let e=I(t,"metadata key",128,!1);if(e==="agentWallet")throw new o("The key agentWallet is reserved: use erc8004_set_wallet / erc8004_unset_wallet, which prove control of the wallet.");return e}function it(t){if(t.value===void 0==(t.text===void 0))throw new o("Provide exactly one of value (0x hex bytes) or text (UTF-8).");let e;if(t.value!==void 0){if(typeof t.value!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(t.value))throw new o("Metadata value must be 0x-prefixed hex bytes.");e=t.value}else{if(typeof t.text!="string")throw new o("Metadata text must be a string.");e=`0x${k.from(t.text,"utf8").toString("hex")}`}if((e.length-2)/2>4096)throw new o("Metadata values are limited to 4096 bytes.");return e}async function at(t,e,n,r){let{chainId:s}=h(t);if(n.transactionHash!==void 0){let a=await H(t,n.transactionHash,e,r.matcher??r.data,r.to);return r.verify(a)}await r.authority();let i=t.unsignedTx({to:r.to,data:r.data,value:"0",chainId:s,description:r.description});return C(t,[i],e,r.summary,!1)}export{R as a,B as b,D as c,L as d,j as e,q as f,z as g,h,K as i,V as j,Z as k,G as l,J as m,Q as n,X as o,I as p,Y as q,tt as r,C as s,et as t,nt as u,H as v,rt as w,ot as x,it as y,at as z};
@@ -1 +0,0 @@
1
- import{d as a,e as s,f as r,i,j as f}from"./64GOINYS.js";import{a as p}from"./XSD5NL7J.js";import{hashStruct as g}from"viem";var w={Order:[{name:"version",type:"string"},{name:"solverChainId",type:"string"},{name:"solver",type:"address"},{name:"salt",type:"uint256"},{name:"inputs",type:"Input[]"},{name:"output",type:"Output"},{name:"fees",type:"Fee[]"}],Input:[{name:"payment",type:"InputPayment"},{name:"refunds",type:"InputRefund[]"}],InputPayment:[{name:"chainId",type:"string"},{name:"currency",type:"bytes"},{name:"amount",type:"uint256"},{name:"weight",type:"uint256"}],InputRefund:[{name:"chainId",type:"string"},{name:"recipient",type:"bytes"},{name:"currency",type:"bytes"},{name:"minimumAmount",type:"uint256"},{name:"deadline",type:"uint32"},{name:"extraData",type:"bytes"}],Output:[{name:"chainId",type:"string"},{name:"payments",type:"OutputPayment[]"},{name:"deadline",type:"uint32"},{name:"calls",type:"bytes[]"},{name:"extraData",type:"bytes"}],OutputPayment:[{name:"recipient",type:"bytes"},{name:"currency",type:"bytes"},{name:"minimumAmount",type:"uint256"},{name:"expectedAmount",type:"uint256"}],Fee:[{name:"recipientChainId",type:"string"},{name:"recipient",type:"bytes"},{name:"currencyChainId",type:"string"},{name:"currency",type:"bytes"},{name:"amount",type:"uint256"}]};function A(I,l){let t=a(I);if(t.version!=="v1")throw new p("Relay order ID cannot be verified for this order version. Request a supported v1 quote.");let u=n=>{if(typeof n!="string"||!l.includes(n))throw new p("Relay order ID cannot be verified for an unknown or non-EVM chain.");return n},c=n=>{if(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(n))throw new p("Relay order ID cannot be verified with malformed bytes.");return n},d=n=>{let e=f(n);if(e>4294967295)throw new p("Relay order deadline exceeds uint32. Request a new quote.");return e};if(typeof t.salt!="string"||!/^(?:0x[0-9a-fA-F]{1,64}|0|[1-9][0-9]*)$/.test(t.salt)||BigInt(t.salt)>=1n<<256n)throw new p("Relay order ID cannot be verified with an invalid salt.");let y=a(t.output);return g({types:w,primaryType:"Order",data:{version:t.version,solverChainId:u(t.solverChainId),solver:r(t.solver),salt:BigInt(t.salt),inputs:s(t.inputs).map(n=>{let e=a(n),o=a(e.payment);return{payment:{chainId:u(o.chainId),currency:r(o.currency),amount:BigInt(i(o.amount)),weight:BigInt(i(o.weight))},refunds:s(e.refunds).map(h=>{let m=a(h);return{chainId:u(m.chainId),recipient:r(m.recipient),currency:r(m.currency),minimumAmount:BigInt(i(m.minimumAmount)),deadline:d(m.deadline),extraData:c(m.extraData)}})}}),output:{chainId:u(y.chainId),payments:s(y.payments).map(n=>{let e=a(n);return{recipient:r(e.recipient),currency:r(e.currency),minimumAmount:BigInt(i(e.minimumAmount)),expectedAmount:BigInt(i(e.expectedAmount))}}),deadline:d(y.deadline),calls:s(y.calls).map(c),extraData:c(y.extraData)},fees:s(t.fees).map(n=>{let e=a(n);return{recipientChainId:u(e.recipientChainId),recipient:r(e.recipient),currencyChainId:u(e.currencyChainId),currency:r(e.currency),amount:BigInt(i(e.amount))}})}})}export{A as a};
@@ -1 +0,0 @@
1
- import{a as o}from"./XSD5NL7J.js";function p(n,i=[]){let a=[{value:n,path:""}];for(;a.length;){let e=a.pop();if(!(!e.value||typeof e.value!="object"))for(let[t,s]of Object.entries(e.value)){let r=e.path?`${e.path}.${t}`:t,c=t.replace(/[^a-z0-9]/gi,"").toLowerCase();if(/^(?:(?:private|secret|wallet)keys?|mnemonic(?:phrase|words)?|seed(?:phrase|words|hex)?|recovery(?:phrase|words)|passphrase|password|signatures?|(?:raw)?signed(?:tx|transaction)s?|raw(?:tx|transaction)s?|serialized(?:tx|transaction)s?)$/.test(c)&&!(t==="signature"&&i.includes(r)))throw new o("Wallet secrets and signed payloads are not accepted. Sign locally.");s&&typeof s=="object"&&a.push({value:s,path:r})}}}export{p as a};
@@ -1 +0,0 @@
1
- import{a as k}from"./66F5ZH34.js";import{c as l}from"./NWNYJ26T.js";import{a as p}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as H,getAddress as m,parseAbi as f,zeroAddress as w}from"viem";var x=f(["function tokenizations(address token) view returns ((address creator,address forwarder,bytes32 marketFamilyId,uint64 createdAt))"]),S=f(["function tokenizations(address token) view returns ((address creator,uint8 way,address forwarder,address adapter,address door,bytes32 familyId,bytes32 marketFamilyId,uint64 unlockBlock,uint16 legBps))"]),b=f(["function name() view returns (string)","function symbol() view returns (string)","function decimals() view returns (uint8)","function balanceOf(address account) view returns (uint256)","function totalSupply() view returns (uint256)","function assetCount() view returns (uint256)","function claimable(address account,uint256 asset) view returns (uint256)","function streamSeconds() view returns (uint32)","function tipBps() view returns (uint16)","function doorCount() view returns (uint256)","function dropBox() view returns (address)","function bridge() view returns (address)","function claim(uint256 asset,address to) returns (uint256 amount)","function claimAll(address to) returns (uint256[] amounts)","function sync() returns (uint256 tip)","function syncRange(uint256 start,uint256 count) returns (uint256 tip)","function syncSome(uint256[] doorIds) returns (uint256 tip)"]),C=f(["function dropCount() view returns (uint256)","function claimable(uint256 dropId,address holder) view returns (uint256)","function claim(uint256[] dropIds,address to) returns (uint256[] amounts)"]),y=["0x522723A7a09684515881568Ab8247f3846D66F43","0xfb3c1501c727f30883cd7B36Ec380381af7412Ef"].map(m),I={token:b,drops:C};function O(n){return{type:"object",properties:Object.fromEntries(n.inputs.map(t=>[t.name,t.type==="address"?l:t.type==="uint256[]"?{type:"array",items:k(),maxItems:128}:k()])),required:n.inputs.map(t=>t.name),additionalProperties:!1}}function h(n){return Object.entries(I).flatMap(([t,o])=>o.filter(r=>r.stateMutability==="view"===n).map(r=>({target:t,fn:r})))}function v(n){return{type:"object",oneOf:h(n).map(({target:t,fn:o})=>({type:"object",properties:{token:l,target:{const:t},function:{const:o.name},params:O(o)},required:["token","target","function","params"],additionalProperties:!1}))}}function A(n,t){if(Object.keys(n).length!==4||Object.keys(n).some(e=>!["token","target","function","params"].includes(e)))throw new s("Provide token, target, function and params for the Hookr revenue operation.");let o=h(t).find(e=>e.target===n.target&&e.fn.name===n.function);if(!o||!n.params||typeof n.params!="object"||Array.isArray(n.params))throw new s("Choose a documented Hookr revenue function and parameter object.");let r;try{r=m(String(n.token))}catch{throw new s("Provide a valid Hookr revenue token address.")}let i=n.params,a=o.fn;if(Object.keys(i).length!==a.inputs.length||Object.keys(i).some(e=>!a.inputs.some(u=>u.name===e)))throw new s("Provide exactly the documented Hookr revenue parameters.");let c=e=>{if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<256n)throw new s("Revenue token indices and amounts must be decimal base-unit strings.");return BigInt(e)},d=a.inputs.map(e=>{let u=i[e.name];if(e.type==="address")try{return m(String(u))}catch{throw new s("Provide a valid Hookr revenue address.")}if(e.type==="uint256[]"){if(!Array.isArray(u)||u.length>128)throw new s("Provide at most 128 Hookr revenue indices.");return u.map(c)}return c(u)});return{token:r,fn:a,values:d,operation:o}}async function g(n,t,o){let r=n.clientFor(p),i;for(let c of y){let d=c===y[0],e=await r.readContract({address:c,abi:d?x:S,functionName:"tokenizations",args:[t]});if(!e||typeof e.creator!="string"||d&&(!("createdAt"in e)||typeof e.createdAt!="bigint"||e.createdAt<0n||e.createdAt>=1n<<64n))throw new s("Hookr token provenance is unavailable.");if(m(e.creator)!==w&&(!d||"createdAt"in e&&e.createdAt>0n)){i=c;break}}if(!i)throw new s("This token has no record on a pinned Hookr tokenizer.");let a=o?m(await r.readContract({address:t,abi:b,functionName:"dropBox"})):t;if(a===w)throw new s("Hookr revenue drop box is unavailable.");return{to:a,tokenizer:i}}async function j(n,t,o){if(n.network==="testnet")throw new s("Hookr revenue actions require mainnet, chain 4663.");let{token:r,fn:i,values:a}=A(t,!1),{to:c}=await g(n,r,t.target==="drops"),d=i.inputs.findIndex(e=>e.name==="to");if(d>=0&&[w,r,c].includes(a[d]))throw new s("Choose a valid revenue claim recipient.");return{txs:[n.unsignedTx({chainId:p,to:c,value:"0",data:H({abi:[i],functionName:i.name,args:a}),description:`Hookr revenue ${t.target}.${i.name}: ${JSON.stringify(t.params)}. No token approval or principal deposit.`})],inputs:[]}}function T(n){return[{name:"hookr_revenue_read",inputSchema:{...v(!0),description:"Read a registered Hookr revenue token or its derived drop box: balance, claimable, terms and indices. Checks tokenizer provenance on chain."},execute:async t=>{let{token:o,fn:r,values:i}=A(t,!0),{to:a,tokenizer:c}=await g(n,o,t.target==="drops"),d=await n.clientFor(p).readContract({address:a,abi:[r],functionName:r.name,args:i});return{chainId:p,token:o,tokenizer:c,contract:a,function:r.name,result:JSON.parse(JSON.stringify(d,(e,u)=>typeof u=="bigint"?u.toString():u))}}},{name:"hookr_revenue_action",inputSchema:{...v(!1),description:"Preview holder income/drop claims or permissionless sync/syncRange/syncSome on a registered Hookr revenue token. No approvals; local human confirmation required. Claims and syncs are separate actions."},execute:async(t,o)=>{let{txs:r}=await j(n,t,o),i=await n.preview(r,o);return{txs:r,preview:i,summary:`Hookr revenue ${t.function}; verify receipt and holder balances after confirmation.`}}}]}export{y as a,j as b,T as c};
@@ -1 +0,0 @@
1
- import{e as P,h as A,n as S}from"./IPN6Z4JM.js";import{a as N,b as h,f as y,g as v}from"./PIIHOXWF.js";import{N as k,b as I}from"./2THSW4QN.js";import{a as b}from"./66F5ZH34.js";import{c as w,g}from"./NWNYJ26T.js";import{a as m}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as f,parseAbi as T,zeroAddress as _}from"viem";var i=T(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function getPositionLiquidity(uint256) view returns (uint128)","function safeTransferFrom(address from,address to,uint256 tokenId)","function approve(address spender,uint256 tokenId)","function burn(uint256 tokenId)"]),q={version:{type:"string",enum:["v3","v4"]},tokenId:b(),operation:{type:"string",enum:["transfer","approve","revoke","burn"]},target:w};function D(s){return{tools:[!1,!0].map(c=>({name:c?"uniswap_position_manage":"uniswap_position_status",inputSchema:{type:"object",additionalProperties:!1,required:c?["version","tokenId","operation"]:["version","tokenId"],properties:q},async execute(e,p){if(e.version!=="v3"&&e.version!=="v4")throw new r("Specify position version v3 or v4.");let o=N(e.tokenId,"tokenId"),a=e.version==="v3"?P.positionManager:I,d=s.clientFor(m),l=await d.readContract({address:a,abi:i,functionName:"ownerOf",args:[o]});if(!c){v(e,["version","tokenId"]);let n=await d.readContract({address:a,abi:i,functionName:"getApproved",args:[o]});return{version:e.version,tokenId:o.toString(),manager:a,owner:l,approved:n}}if(!g(l,p))throw new r("Only manage a Uniswap NFT owned by the signing wallet.");let t=e.operation;v(e,["version","tokenId","operation",...["transfer","approve"].includes(String(t))?["target"]:[]]);let u;if(t==="transfer"||t==="approve"){let n=h(e.target);if(n===_)throw new r("Choose a nonzero target, or operation revoke to clear approval.");u=t==="transfer"?f({abi:i,functionName:"safeTransferFrom",args:[p,n,o]}):f({abi:i,functionName:"approve",args:[n,o]})}else if(t==="revoke")u=f({abi:i,functionName:"approve",args:[_,o]});else if(t==="burn"){if(e.version==="v4"){if(await d.readContract({address:a,abi:i,functionName:"getPositionLiquidity",args:[o]})!==0n)throw new r("Remove all liquidity before burning an empty position.");return k(s).tools.find(O=>O.name==="uniswap_remove").execute({version:"v4",tokenId:o.toString(),liquidity:"all",amount0Min:"0",amount1Min:"0"},p)}let n=S(await d.readContract({address:a,abi:A,functionName:"positions",args:[o]}));if(n.liquidity!==0n||n.tokensOwed0!==0n||n.tokensOwed1!==0n)throw new r("Remove liquidity and collect all owed tokens before burning a v3 NFT.");u=f({abi:i,functionName:"burn",args:[o]})}else throw new r("Choose transfer, approve, revoke or burn. Operator-wide approvals are not exact approvals.");return y(s,[s.unsignedTx({to:a,data:u,value:"0",chainId:m,description:`${t} Uniswap ${e.version} NFT #${o}${e.target?` with target ${e.target}`:""}.`})],p,"Position ownership or exact per-NFT approval changes. A transferred position includes its liquidity and accrued rights; burn requires an empty NFT.")}}))}}export{i as a,D as b};
@@ -1 +0,0 @@
1
- import{a as A}from"./RTGS7RIO.js";import{a,b as g,c as b,e as w,f as x,g as h}from"./PIIHOXWF.js";import{a as r}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{a as m}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as B,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as C,parseAbiParameters as N,zeroAddress as R}from"viem";var O=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),$=N("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=C(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),Q=C(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:y,amount:r(),currency:y,startBlock:r(),endBlock:r(),claimBlock:r(),tickSpacing:r(),floorPrice:r(),requiredCurrencyRaised:r(),salt:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:r(),duration:r()}}}};function D(e,t){let s=a(e.startBlock,"startBlock",64),o=a(e.endBlock,"endBlock",64),c=a(e.claimBlock,"claimBlock",64);if(o<=s||c<o)throw new i("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new i("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new i("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let n=d,k=a(n.mps,"mps",24,!0),f=a(n.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(f)]).slice(2)}`,l+=k*f,p+=f}if(l!==10000000n||p!==o-s)throw new i("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S($,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:s,endBlock:o,claimBlock:c,tickSpacing:a(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:a(e.floorPrice,"floorPrice"),requiredCurrencyRaised:a(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function U(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,s){h(t,Object.keys(v));let o=g(t.token),c=a(t.amount,"amount",128);if(o===R||o===b(t.currency))throw new i("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=D(t,s);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new i("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(m),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new i("Choose a future auction startBlock with time for confirmation and approvals.");let n=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[o,c,u,p,s]});if((await l.getCode({address:n})??"0x")!=="0x")throw new i("This auction already exists; choose a fresh salt or configuration.");let k=await w(e,o),f=[e.unsignedTx({to:A,data:B({abi:P,functionName:"create",args:[o,c,u,p]}),value:"0",chainId:m,description:`Create CCA ${n}; proceeds and unsold tokens go to ${s}.`}),e.unsignedTx({to:o,data:B({abi:I,functionName:"transfer",args:[n,c]}),value:"0",chainId:m,description:`Fund the factory-predicted auction ${n} with exactly ${c} base units of ${o}.`}),e.unsignedTx({to:n,data:B({abi:C(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:m,description:`Activate CCA ${n} after its sale tokens arrive.`})];return{...await x(e,f,s,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:n,sale:{token:k,amount:c.toString()}}}}]}}export{O as a,$ as b,P as c,Q as d,D as e,U as f};
@@ -1 +0,0 @@
1
- import{f as l,h as x,i as h}from"./64GOINYS.js";import{g}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as y,erc20Abi as O,getAddress as f,parseAbi as R}from"viem";var P=[{chainId:1,vault:"0x57b68c4ea221ee8da6eb14ebdfccee5177567771",asset:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",gateway:"0xed8a2a23bf9d6818651527daaf3bf4ffeb53945f"},{chainId:42161,vault:"0xc7273772b87860097373d91b3880fd4cc61fba2d",asset:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",gateway:"0x67defe8d90c8cd013fd527669e76e0be420f1208"}].map(t=>({chainId:t.chainId,vault:f(t.vault),asset:f(t.asset),gateway:f(t.gateway)})),T=R(["function balanceOf(address) view returns (uint256)","function asset() view returns (address)","function yieldPool() view returns (address)","function maxWithdraw(address) view returns (uint256)","function convertToAssets(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function redeem(uint256,address,address) returns (uint256)","function withdraw(uint256,address,address) returns (uint256)"]),$=R(["function redeem(address,uint256,address,uint256) returns (uint256)","function withdraw(address,uint256,address,uint256) returns (uint256)"]),I={type:"string",pattern:"^[1-9][0-9]*$"},A={type:"integer",enum:[1,42161]};function S(t){let o=P.find(i=>i.chainId===x(t));if(!o)throw new r("Relay legacy vault exits support Ethereum (1) and Arbitrum (42161).");return o}function b(t){let o=h(t);if(o==="0")throw new r("Provide a positive Relay vault amount or limit.");return o}function E(t,o){let i=S(t.chainId),s=f(l(o));if(Object.keys(t).some(c=>!["chainId","mode","amount","native","minAssetsOut","maxSharesIn"].includes(c)))throw new r("Provide only the documented Relay vault exit arguments.");if(t.mode!=="redeem"&&t.mode!=="withdraw")throw new r("Choose redeem (shares) or withdraw (WETH amount).");if(t.native!==void 0&&typeof t.native!="boolean")throw new r("Provide native as a boolean.");let e=b(t.amount),n=t.native===!0,a=t.mode==="redeem";if(!a&&!n)throw new r("Direct WETH withdrawals cannot enforce maxSharesIn on-chain. Use native withdraw or redeem a fixed number of shares.");if(t.minAssetsOut!==void 0&&(!n||!a)||t.maxSharesIn!==void 0&&a)throw new r("minAssetsOut applies only to native redeem; maxSharesIn applies only to withdraw.");let d=n&&a?b(t.minAssetsOut):void 0,u=a?e:b(t.maxSharesIn),w=(c,v,p)=>({to:c,data:v,chainId:i.chainId,value:"0",description:p}),m=[];return n?(m.push(w(i.vault,y({abi:O,functionName:"approve",args:[i.gateway,BigInt(u)]}),`Approve exactly ${u} WETH-REL share base units for the Relay native gateway.`)),m.push(w(i.gateway,y({abi:$,functionName:t.mode,args:[i.vault,BigInt(e),s,BigInt(a?d:u)]}),`Relay legacy vault ${t.mode} to native ETH for ${s}.`))):m.push(w(i.vault,y({abi:T,functionName:t.mode,args:[BigInt(e),s,s]}),`Relay legacy vault ${t.mode} to WETH for ${s}.`)),{pin:i,txs:m,wallet:s,redeem:a,native:n,amount:e,maxSharesIn:u,minAssetsOut:d}}function C(t,o,i){let s=E(o,i).txs;if(t.length!==s.length||t.some((e,n)=>e.chainId!==s[n].chainId||l(e.to)!==l(s[n].to)||e.value!=="0"||!g(e.data,s[n].data)))throw new r("Relay vault transactions differ from the requested exit.")}var H=t=>{async function o(i,s){let e=S(i),n;try{n=t.clientFor(e.chainId)}catch(c){throw/No RPC URL configured for chain/.test(t.plainError(c))?new r(`Relay legacy vault reads and exits on chain ${e.chainId} need an RPC. Ask the operator to configure OAK_RPC_URL_${e.chainId} on the server. No vault balances were checked.`):c}if(await n.getChainId()!==e.chainId)throw new r("The RPC chain does not match the Relay vault chain.");let a=(c,v,p=[])=>n.readContract({address:c,abi:T,functionName:v,args:p});if(l(await a(e.vault,"asset"))!==l(e.asset))throw new r("Relay vault asset does not match the pinned WETH.");let d=h(String(await a(e.vault,"balanceOf",[s]))),u=f(l(await a(e.vault,"yieldPool"))),w=h(String(await a(e.vault,"convertToAssets",[BigInt(d)]))),m=h(String(await a(u,"maxWithdraw",[e.vault])));return{pin:e,shares:d,assets:w,liquidAssets:m,read:a}}return{tools:[{name:"relay_vault_status",inputSchema:{type:"object",description:"Read legacy vault shares and shared liquidity. Requires server OAK_RPC_URL_1 or OAK_RPC_URL_42161 for the selected chain; no API key. New deposits are unsupported.",additionalProperties:!1,required:["chainId"],properties:{chainId:A}},execute:async(i,s)=>{if(Object.keys(i).some(u=>u!=="chainId"))throw new r("Provide only the Relay vault chainId.");let{pin:e,shares:n,assets:a,liquidAssets:d}=await o(i.chainId,s);return{chainId:e.chainId,vault:e.vault,shares:{token:{address:e.vault,chainId:e.chainId,symbol:"WETH-REL",decimals:18},amount:n},assets:{token:{address:e.asset,chainId:e.chainId,symbol:"WETH",decimals:18},amount:a},liquidAssets:d,summary:"Relay legacy vault wind-down: new deposits are unsupported. Available yield-pool liquidity is shared by all LPs and may change. Withdraw with relay_vault_withdraw; gas is paid in ETH on the vault chain."}}},{name:"relay_vault_withdraw",inputSchema:{type:"object",additionalProperties:!1,required:["chainId","mode","amount"],properties:{chainId:A,mode:{type:"string",enum:["redeem","withdraw"]},amount:I,native:{type:"boolean"},minAssetsOut:I,maxSharesIn:I}},execute:async(i,s)=>{let e=E(i,s),n=await o(i.chainId,s),a=e.redeem?e.amount:h(String(await n.read(e.pin.vault,"previewWithdraw",[BigInt(e.amount)]))),d=e.redeem?h(String(await n.read(e.pin.vault,"previewRedeem",[BigInt(e.amount)]))):e.amount;if(BigInt(a)>BigInt(n.shares)||BigInt(a)>BigInt(e.maxSharesIn))throw new r("Relay vault exit exceeds your shares or maxSharesIn.");if(BigInt(d)>BigInt(n.liquidAssets))throw new r("Relay vault liquidity is insufficient. Withdraw less or retry when liquidity returns.");if(e.minAssetsOut!==void 0&&BigInt(d)<BigInt(e.minAssetsOut))throw new r("Relay vault output is below minAssetsOut.");let u=await t.preview(e.txs,s);return{txs:e.txs,preview:u,chainId:e.pin.chainId,expectedAssets:d,expectedShares:a,summary:`Relay legacy vault exit on chain ${e.pin.chainId}: ${a} share base units for about ${d} ${e.native?"ETH":"WETH"} base units (18 decimals), to ${e.wallet}. ${e.minAssetsOut?`Gateway minimum ${e.minAssetsOut}.`:e.redeem?"Direct ERC-4626 redeem has no calldata minimum output.":`Gateway maximum input ${e.maxSharesIn} share base units.`} Review the local preview and confirm before signing. No destination bridge or future yield is promised.`}}}]}};export{P as a,E as b,C as c,H as d};
@@ -1 +0,0 @@
1
- import{a as p,f as u,g as c}from"./PIIHOXWF.js";import{f as a}from"./2THSW4QN.js";import{a as e}from"./66F5ZH34.js";import{a as r}from"./FWD4L3CJ.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as d,parseAbi as f}from"viem";var m=f(["function deposit() payable","function withdraw(uint256)"]);function H(i){return{tools:[{name:"uniswap_wrap",inputSchema:{type:"object",additionalProperties:!1,required:["direction","amount"],properties:{direction:{type:"string",enum:["wrap","unwrap"]},amount:e()}},async execute(t,w){if(c(t,["direction","amount"]),t.direction!=="wrap"&&t.direction!=="unwrap")throw new n("Choose direction wrap or unwrap.");let o=p(t.amount,"amount"),s=t.direction==="wrap"?d({abi:m,functionName:"deposit"}):d({abi:m,functionName:"withdraw",args:[o]});return u(i,[i.unsignedTx({to:a,data:s,value:t.direction==="wrap"?o.toString():"0",chainId:r,description:`${t.direction} ${o} ETH/WETH base units to the signing wallet.`})],w,"Wrap or unwrap native ETH at the pinned WETH contract. Ratio 1:1; network gas is additional.")}}]}}export{m as a,H as b};
@@ -1 +0,0 @@
1
- import{a as d}from"./XSD5NL7J.js";var i=class extends d{constructor(r,n){super(`${r} is busy; retry in ${Math.max(1,Math.ceil(n))} seconds.`);this.vendor=r;this.retryAfterSeconds=n}vendor;retryAfterSeconds},y=new WeakMap,b={"aggregator-api.kyberswap.com":{label:"KyberSwap",spacing:350},"api.velora.xyz":{label:"Velora",spacing:1050,daily:5e3},"api.relay.link":{label:"Relay",spacing:1250},"borro.markets":{label:"Borro",spacing:2e3,daily:5e3},"api-v2.pendle.finance":{label:"Pendle",spacing:2e3,daily:5e3}};function u(t,c){let r=new URL(c).hostname,n=b[r];if(!n)return;let o=y.get(t);o||(o=new Map,y.set(t,o));let e=o.get(r);return e||(e={next:0,blockedUntil:0,lastSent:-1/0,daily:[]},o.set(r,e)),{label:n.label,reserve(){let a=Date.now();if(e.daily=e.daily.filter(s=>s>a-864e5),n.daily&&e.daily.length>=n.daily)throw new i(n.label,(e.daily[0]+864e5-a)/1e3);let l=Math.max(a,e.next,e.blockedUntil,e.lastSent+n.spacing);if(l-a>2e3)throw new i(n.label,(l-a)/1e3);return e.next=l+n.spacing,l-a},dispatchDelay(){let a=Date.now();if(e.daily=e.daily.filter(s=>s>a-864e5),n.daily&&e.daily.length>=n.daily)throw new i(n.label,(e.daily[0]+864e5-a)/1e3);if(e.blockedUntil>a)throw new i(n.label,(e.blockedUntil-a)/1e3);let l=Math.max(0,e.lastSent+n.spacing-a);return l===0&&(e.lastSent=a,n.daily&&e.daily.push(a)),l},backoff(a){e.blockedUntil=Math.max(e.blockedUntil,Date.now()+a)}}}function f(t){return t instanceof d&&/^(KyberSwap|Velora|Relay|Pendle|Borro|The service) is busy; retry in [1-9]\d* seconds\.$/.test(t.message)?t:void 0}export{i as a,u as b,f as c};
@@ -1 +0,0 @@
1
- import{a as C,b as O}from"./BND2UFVW.js";import{a as f,b as k}from"./XSRIJUFU.js";import{d as a}from"./XV6F3RET.js";import{a as g,c as w}from"./SPRVVJXI.js";import{a as d}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";var j=n=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(a)},method:{type:"string"},values:{type:"array",maxItems:16}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(a,t.program))throw new i("Choose turbo, blackjack or feed.");let o=a[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new i("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let r=u.find(e=>f(e)===t.method),m=t.values??[];if(!r||!Array.isArray(m)||m.length!==r.inputs.length)throw new i("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let p=n.clientFor(d);if(await p.getChainId()!==d)throw new i("NetNet cards require chain 4663.");let l=await p.getBlock(),c=r.inputs.map((e,s)=>k(e,m[s])),N=await p.readContract({address:o.address,abi:[r],functionName:r.name,args:c,blockNumber:l.number}),y=t.program==="turbo"&&r.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(r.name)?[c[0]]:r.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(y.length){let e=await p.readContract({address:a.turbo.address,abi:a.turbo.abi,functionName:"seriesCount",blockNumber:l.number});b=[...new Set(y)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:a.turbo.address,contract:o.address,blockNumber:String(l.number),blockHash:l.hash,method:t.method,outputs:r.outputs,...b?{seriesStatus:b}:{},data:h(N)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new i("Card capabilities takes no arguments.");return{chainId:d,collection:a.turbo.address,blackjack:a.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...g],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(n,t=0){if(t>12)throw new i("Card read result exceeds the supported nesting.");if(typeof n=="bigint")return n.toString();if(typeof n=="string"){if(n.length>8194)throw new i("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(n)?n:`untrusted ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.length>4096)throw new i("Choose a bounded card read.");return n.map(o=>h(o,t+1))}return n&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([o,u])=>[o,h(u,t+1)])):n}export{j as a};
@@ -1 +0,0 @@
1
- import{a as E}from"./CDPSMI3Z.js";import{b as _,c as q,d as O,e as R}from"./QBIY6FQN.js";import{a as N}from"./C7AXJHBT.js";import{a as I}from"./K3RDPI5J.js";import{c as M}from"./7WSHW7KW.js";import{b as G}from"./SPJCSEKP.js";import{a as y}from"./43LI5NKJ.js";import{b as x}from"./IX3GZMTM.js";import{a as o,d as U,i as P,j as b}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as g,erc20Abi as k,parseAbi as F}from"viem";var i=P[o].vaults.steakhouse.address,j=(1n<<256n)-1n,l=F(["function asset() view returns (address)","function totalAssets() view returns (uint256)","function convertToAssets(uint256 shares) view returns (uint256 assets)","function previewWithdraw(uint256 assets) view returns (uint256 shares)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]);function S(e){if(typeof e!="bigint"||e<0n||e>j)throw new r("The vault returned an invalid base-unit amount.");return e}function D(e){if(typeof e!="string")throw new r("Amount must be an integer string in base units.");let c=x(e);if(c===0n)throw new r("Amount must be positive.");if(c>j)throw new r("Amount exceeds the uint256 range.");return c}function T(e,c,h=!1){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(w=>!c||!["amount",...h?["force","maxPenaltyAssets","minAmountOut"]:[]].includes(w)))throw new r("Unexpected Steakhouse argument.")}var L=e=>{async function c(t){try{return await t()}catch(s){throw new r(e.plainError(s))}}async function h(){let t=e.clientFor(o);if(await t.getChainId()!==o)throw new r("Steakhouse requires chain 4663.");let s=await t.readContract({address:i,abi:l,functionName:"asset"});if(typeof s!="string"||s.toLowerCase()!==b.toLowerCase())throw new r("The Steakhouse vault asset does not match USDG on chain 4663.");let[a,n]=await Promise.all([t.readContract({address:b,abi:k,functionName:"decimals"}),t.readContract({address:i,abi:k,functionName:"decimals"})]);if(a!==U||!Number.isInteger(n)||n<0||n>255)throw new r("The vault returned invalid asset or share decimals.");return{client:t,asset:{address:b,symbol:"USDG",decimals:a,chainId:o},shares:{address:i,symbol:"steakUSDG",decimals:n,chainId:o}}}async function w(t,s){return S(await t.readContract({address:i,abi:k,functionName:"balanceOf",args:[s]}))}async function C(t,s,a){let n=await e.preview(t,s);if(n.changes.length===0)throw new r("The Steakhouse simulation returned no token balance changes.");let u=n.changes.map(({token:m,amount:d})=>{let f=d.startsWith("-"),p=e.formatAmount(f?d.slice(1):d,m.decimals);return`${f?"-":""}${p} ${m.symbol} (${m.address}, chain ${m.chainId}, decimals ${m.decimals})`});return{txs:t,summary:`${a} ${n.summary} Changes: ${u.join("; ")}.`}}return{tools:[q(e,"steakhouse_details",i),I(e,"steakhouse_analytics",i),E(e,"steakhouse_manage",i),...N(e,"steakhouse",i),{name:"steakhouse_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>c(async()=>{T(t,!1);let{client:s,asset:a,shares:n}=await h(),u=S(await s.readContract({address:i,abi:l,functionName:"totalAssets"}));return[{name:"Steakhouse USDG",vault:n,asset:a,totalAssets:{token:a,amount:u.toString()}}]})},{name:"steakhouse_deposit",inputSchema:{...$(!1),description:"Deposit USDG in base units (1 USDG = 1000000) for vault shares. Exit with steakhouse_withdraw; check positions after confirmation."},execute:async(t,s)=>c(async()=>{T(t,!0);let a=D(t.amount);y(s);let{asset:n}=await h(),u=[e.approval(n.address,i,a.toString(),o),e.unsignedTx({to:i,data:g({abi:l,functionName:"deposit",args:[a,s]}),value:"0",chainId:o,description:`Deposit ${e.formatAmount(a.toString(),n.decimals)} USDG into Steakhouse.`})];return C(u,s,"Approve the exact USDG amount, then deposit into Steakhouse.")})},{name:"steakhouse_withdraw",inputSchema:{...$(!0),description:"Withdraw USDG in 6-decimal base units, or amount max to redeem every share for USDG. Check positions after confirmation.",properties:{...$(!0).properties,force:{type:"boolean",description:"Explicitly plan a full Morpho V2 force exit with penalty disclosure."},maxPenaltyAssets:{type:"string",pattern:"^[0-9]+$"},minAmountOut:{type:"string",pattern:"^[0-9]+$"}}},execute:async(t,s)=>c(async()=>{T(t,!0,!0);let a=t.amount==="max"?null:D(t.amount);y(s);let{client:n,asset:u,shares:m}=await h(),d=await w(n,s);if(d===0n)throw new r("The wallet has no Steakhouse shares to withdraw.");if(t.force!==void 0&&typeof t.force!="boolean")throw new r("force must be a boolean.");if(t.force===!0){if(a!==null)throw new r("Force exit currently requires amount max.");let p=M(t.maxPenaltyAssets),W=D(t.minAmountOut),v=await _(e,n,i,s,d,p),A=await e.preview([v.tx],s);return R(A.changes,i,d,W),{txs:[v.tx],preview:A,summary:`${O(v.plan)} ${A.summary}`}}if(t.maxPenaltyAssets!==void 0||t.minAmountOut!==void 0)throw new r("Penalty and output limits require force true.");let f;if(a===null)f=e.unsignedTx({to:i,data:g({abi:l,functionName:"redeem",args:[d,s,s]}),value:"0",chainId:o,description:`Redeem all ${e.formatAmount(d.toString(),m.decimals)} steakUSDG shares.`});else{let p=S(await n.readContract({address:i,abi:l,functionName:"previewWithdraw",args:[a]}));if(p===0n||p>d)throw new r("The withdrawal exceeds the available share balance or has an invalid share quote.");f=e.unsignedTx({to:i,data:g({abi:l,functionName:"withdraw",args:[a,s,s]}),value:"0",chainId:o,description:`Withdraw ${e.formatAmount(a.toString(),u.decimals)} USDG from Steakhouse.`})}return C([f],s,a===null?"Redeem the current full share balance from Steakhouse.":"Withdraw the requested USDG amount from Steakhouse.")})}],positions:t=>c(async()=>{y(t);let{client:s,asset:a,shares:n}=await h(),u=await w(s,t);if(u===0n)return[];let m=S(await s.readContract({address:i,abi:l,functionName:"convertToAssets",args:[u]}));return[{module:"steakhouse",id:`${o}:${i.toLowerCase()}`,chainId:o,assets:[{token:a,amount:m.toString()}],description:`${e.formatAmount(u.toString(),n.decimals)} steakUSDG shares (${i}, chain ${o}, decimals ${n.decimals}); USDG conversion is indicative, not guaranteed exit liquidity.`}]})}};function $(e){return{type:"object",additionalProperties:!1,required:["amount"],properties:{amount:{type:"string",pattern:e?"^(?:[0-9]+|max)$":"^[0-9]+$",description:`USDG base-unit integer string (6 decimals)${e?", or max to redeem every share":""}.`}}}}var te=e=>G("steakhouse",[L(e)]);export{L as a,te as b};
@@ -1 +0,0 @@
1
- import{a as qe,b as fe,g as Z,h as he,i as Be,m as ee,n as D,y as be,z as Oe}from"./BOVMED7R.js";import{b as y,c as Ie}from"./ZQAFFWDK.js";import{a as le,b as z}from"./QHBS3PVU.js";import{a as Q}from"./43LI5NKJ.js";import{a as $e}from"./IOYRL6AY.js";import{a as Se}from"./66F5ZH34.js";import{c as me,g as P}from"./NWNYJ26T.js";import{b as Pe}from"./IX3GZMTM.js";import{a as b,i as pe}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as ce}from"./JXOEJPJ4.js";import{randomUUID as He}from"node:crypto";import{encodeAbiParameters as ne,encodeFunctionData as ke,erc20Abi as Te,getAddress as F,parseAbi as X,parseAbiParameters as oe,zeroAddress as K}from"viem";var Me=pe[b].pons,N=pe[b].ponsTrade,Re=X(["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))"]),te=X(["function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)","function feeBps() view returns (uint256)","function creatorTaxBps() view returns (uint256)","function currentSnipeTaxBps(address) view returns (uint256)","function sellableTokens() view returns (uint256)","function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]),Le=X(["function quoteExactInputSingle(((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)"]),ze=X(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),Ke=X(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),Xe=oe("((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint256 minHopPriceX36,bytes hookData)"),je={address:le,chainId:b,decimals:18,symbol:"ETH"},_e="There is no on-chain expiry. The signed transaction is protected by its minimum output.",Ge=`Quote expiry is enforced by Oak before signing only. ${_e}`,$=10000n,we=(1n<<256n)-1n,Ee=(1n<<128n)-1n,I=(n,t)=>({token:n,amount:t.toString()}),Ne=(n,t)=>(n+t-1n)/t,Ce="Reuse existing exact allowance";async function Ve(n,t,i,o,c){try{let e=await n.readContract({address:t,abi:Te,functionName:"allowance",args:[i,o],blockNumber:c});return typeof e=="bigint"?e:void 0}catch{return}}var We={type:"object",additionalProperties:!1,required:["token","amountIn"],properties:{token:{...me,description:"Pons launch token address on chain 4663."},amountIn:Se("Positive base units: the launch pair token for buy (native ETH wei for ETH pairs; pons_status shows pairToken), the launch token for sell."),pairToken:{...me,description:"The launch pair from pons_status. Required to buy a custom-pair launch, so amountIn is never read in the wrong units; omit or use the zero address for native ETH."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:fe}}};function Qe(n,t,i,o){if(n===void 0){if(i&&y(t)!==K)throw new d(`This Pons launch is paired with ${o}; amountIn is in that token's base units. Repeat with pairToken "${t}" to confirm the input asset.`);return}if(typeof n!="string")throw new d("pairToken must be a token address.");if(Q(n),!P(y(n),y(t)))throw new Z(`This Pons launch trades only against ${o}.`)}async function De(n,t,i,o,{quoteOnly:c=!1,curveOnly:e=!1,blockNumber:p}={}){if(Q(i),Object.keys(t).some(f=>!["token","amountIn","slippageBps","pairToken"].includes(f)))throw new d("Provide only token, amountIn, optional pairToken and optional slippageBps.");if(typeof t.token!="string")throw new d("Provide a launch token address.");Q(t.token);let s=F(t.token),r=Pe(t.amountIn);if(r===0n||r>we)throw new d("Trade amount must be positive and within the uint256 range.");let m=t.slippageBps??fe;if(typeof m!="number"||!Number.isInteger(m)||m<0||m>=1e4)throw new d("Slippage must be an integer from 0 to 9999 basis points.");let x=f=>f*($-BigInt(m))/$,a=n.clientFor(b),l=p===void 0?await a.getBlock():await a.getBlock({blockNumber:p});if(p!==void 0&&l.number!==p)throw new d("Pons quote snapshot is unavailable.");let u=await a.readContract({address:Me.factory.address,abi:Re,functionName:"getLaunchedToken",args:[s],blockNumber:l.number});if(!u.exists||!P(u.token,s))throw new d("This address is not a Pons launch token.");if(e&&u.phase!==0)throw new Z("Pons curve quotes are only available before graduation.");if(u.phase===1)throw new d("Pons graduation is pending; the curve is closed and the pool is not ready.");if(u.phase===3)throw new d("This Pons launch was rescued and has no active trade route.");if(u.phase!==0&&u.phase!==2)throw new d("This Pons launch has an unknown trade phase.");let g=y(u.pairToken)===K,C=F(u.pairToken);if(P(C,s))throw new d("This Pons launch has an invalid pair.");let j=f=>Promise.all([a.readContract({address:f,abi:Te,functionName:"symbol",blockNumber:l.number}),a.readContract({address:f,abi:Te,functionName:"decimals",blockNumber:l.number})]),[[B,U],H]=await Promise.all([j(s),g?void 0:j(C)]),w=H?{address:C,chainId:b,symbol:ce(H[0]),decimals:H[1]}:je,G=g?"native ETH":`${w.symbol} (${w.address})`;Qe(t.pairToken,C,o,`${G}, ${w.decimals} decimals`);let V={address:s,chainId:b,symbol:ce(B),decimals:U},se=o?w:V,re=o?V:w,q=[],ie=(f,h,S,A)=>n.unsignedTx({to:f,data:h,value:S.toString(),chainId:b,description:A}),T,k,W,O=r,ge=null,ae,ve="";if(u.phase===0){let f=v=>a.readContract({address:u.curve,abi:te,functionName:v,blockNumber:l.number}),[[h,S],A,M,R,_]=await Promise.all([a.readContract({address:u.curve,abi:te,functionName:"getReserves",blockNumber:l.number}),f("feeBps"),f("creatorTaxBps"),o?a.readContract({address:u.curve,abi:te,functionName:"currentSnipeTaxBps",args:[i],blockNumber:l.number}):Promise.resolve(0n),o?f("sellableTokens"):Promise.resolve(0n)]);if(h<=0n||S<=0n||A+M>$-100n)throw new d("Pons curve reserves or fee settings are unavailable.");let J=$-A-M-100n,E=R<J?R:J,xe=v=>({base:v*A/$,creator:v*M/$,snipe:v*E/$}),Ae=v=>{let L=xe(v);return v-L.base-L.creator-L.snipe},Y;if(o){if(_<=0n||_>=S)throw new d("The curve has no available sellable tokens.");let v=Ae(r);if(T=v*S/(h+v),T>=_){T=_;let L=T*h/(S-T)+1n;O=Ne(L*$,$-A-M-E),O>r&&(O=r)}Y=O,k=x(T),W=Ne(k*r,O),g||q.push(n.approval(w.address,u.curve,r.toString(),b))}else Y=r*h/(S+r),T=Ae(Y),k=x(T),q.push(n.approval(s,u.curve,r.toString(),b));let de=xe(Y);ge={base:I(w,de.base),creator:I(w,de.creator),snipe:I(w,de.snipe)},ae=`Curve fees included: ${A} base, ${M} creator and ${E} opening-tax basis points, each rounded separately.`,q.push(ie(u.curve,ke({abi:te,functionName:o?"buy":"sell",args:[r,W??k,i]}),o&&g?r:0n,o?`Buy Pons curve tokens with ${G}.`:`Sell Pons curve tokens for ${G}.`))}else{if(r>Ee)throw new d("Trade amount exceeds the router uint128 range.");let f=Ie(u.pairToken,s,u.poolFee,u.tickSpacing),h=o?y(u.pairToken):s,S=o?s:y(u.pairToken),A=P(h,f.currency0);if(T=(await a.simulateContract({address:N.quoter.address,abi:Le,functionName:"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:A,exactAmount:r,hookData:"0x"}],account:i,gas:$e,blockNumber:l.number})).result[0],k=x(T),k>Ee)throw new d("Minimum output exceeds the router uint128 range.");let R=l.timestamp+300n;if(R>=1n<<48n)throw new d("Permit2 expiry exceeds its timestamp range.");if(h!==K){let E=!c&&await Ve(a,h,i,N.permit2.address,l.number)===r;E||q.push(n.approval(h,N.permit2.address,r.toString(),b)),ve=E?`${Ce}: ${r} input base units already approved to Permit2. `:"",q.push(ie(N.permit2.address,ke({abi:Ke,functionName:"approve",args:[h,N.universal_router.address,r,Number(R)]}),0n,`${E?`${Ce}. `:""}Approve the exact token amount to the Pons router through Permit2 for five minutes.`))}let _=[ne(Xe,[{poolKey:f,zeroForOne:A,amountIn:r,amountOutMinimum:k,minHopPriceX36:0n,hookData:"0x"}]),ne(oe("address,uint256"),[h,r]),ne(oe("address,uint256"),[S,k])],J=ne(oe("bytes,bytes[]"),["0x060c0f",_]);q.push(ie(N.universal_router.address,ke({abi:ze,functionName:"execute",args:["0x10",[J],R]}),h===K?r:0n,"Trade through Pons Universal Router v2.1.2.")),ae="Quoter output is net of Pons hook fees; no additional fee is subtracted."}if(T<=0n||k<=0n||k>we||(W??k)>we)throw new d("Trade output or minimum is outside the supported positive range.");let ye=c?{changes:[],summary:"Quote only; preview is required before sending."}:await n.preview(q,i),ue=r-O;return{txs:q,changes:ye.changes,summary:`${o?"Buy":"Sell"} ${V.symbol} (${V.address}) on chain ${b}${g?"":` ${o?"with":"for"} ${G}`}. ${ae} ${ve}${u.phase===0?`${_e} `:""}${ue>0n?`Expected ${g?"native refund":"refund"}: ${n.formatAmount(ue.toString(),w.decimals)} ${w.symbol}; minimum output uses the expected spend after refund. `:""}${ye.summary}`,pairToken:w,quote:{phase:u.phase,amountIn:I(se,r),amountOut:I(re,T),minAmountOut:I(re,k),minimumKind:"absolute",calldataMinAmountOut:I(re,W??k),expectedSpend:I(se,O),expectedRefund:I(se,ue),fees:ge,blockNumber:l.number.toString(),blockTimestamp:l.timestamp.toString()}}}function ln(n){return Fe(n,!0)}function Fe(n,t=!1,i){let o=new Map,c=e=>{if(BigInt(ee())>=BigInt(e.expiresAt))throw new he};return{name:"pons",async quote(e,p){if(e={...e,from:z(e.from),to:z(e.to)},D(e.from)&&D(e.to))throw new Z("Pons quotes require a launch token and its pair token.");let s=D(e.from)||!D(e.to)&&await Je(n,e.from,e.to,i),r=ee(),m=await De(n,{token:s?e.to:e.from,amountIn:e.amountIn,slippageBps:e.slippageBps,pairToken:y(s?e.from:e.to)},p,s,{quoteOnly:!0,curveOnly:t,blockNumber:i}),x=m.txs.at(-1),a=m.quote,l=String(BigInt(i===void 0?r:a.blockTimestamp)+BigInt(qe)),u=a.minAmountOut.amount,g=a.fees,C=D(m.pairToken.address)?"native ETH base units (18 decimals)":`${m.pairToken.symbol} (${m.pairToken.address}) base units (${m.pairToken.decimals} decimals)`,j=g?`Pons curve fees included in net output: ${g.base.amount} base, ${g.creator.amount} creator and ${g.snipe.amount} opening tax, in ${C}. Oak swap fee: 0 (venue fee is never Oak income). ${Ge}`:"Quoter output is net of Pons hook fees; no additional fee is subtracted. Oak swap fee: 0.",B=Oe({...e,quoteId:`pons:${He()}`,provider:"pons",wallet:p,chainId:b,router:x.to,spender:a.phase===0?x.to:N.permit2.address,expiresAt:l,data:x.data,value:x.value,amountOut:a.amountOut.amount,minAmountOut:u,blockNumber:a.blockNumber,...a.phase===0?{ponsCurveToken:s?e.to:e.from,calldataMinAmountOut:a.calldataMinAmountOut.amount}:{ponsPoolToken:s?e.to:e.from},expectedSpend:a.expectedSpend.amount,expectedRefund:a.expectedRefund.amount,feeDisclosure:j,oakFee:"0"});be(x,B),c(B);for(let[U,H]of o)BigInt(ee())>=BigInt(H.quote.expiresAt)&&o.delete(U);for(;o.size>=Be;)o.delete(o.keys().next().value);return o.set(B.quoteId,{quote:{...B},txs:m.txs.map(U=>({...U})),summary:m.summary}),B},async build(e,p){let s=o.get(e);if(!s)throw new he;if(c(s.quote),Q(p),!P(p,s.quote.wallet))throw new d("Quote was issued for a different wallet.");let r=s.txs.map(a=>({...a}));be(r.at(-1),s.quote);let m=await n.preview(r,p);if(c(s.quote),m.changes.filter(a=>P(z(a.token.address),z(s.quote.to))).reduce((a,l)=>a+BigInt(l.amount),0n)<BigInt(s.quote.minAmountOut))throw new d("Preview retained output is below the accepted minimum.");return{txs:r,summary:`${s.summary} ${m.summary} ${s.quote.feeDisclosure}`}}}}async function Ue(n,t,i){return n.clientFor(b).readContract({address:Me.factory.address,abi:Re,functionName:"getLaunchedToken",args:[F(t)],...i===void 0?{}:{blockNumber:i}})}async function Je(n,t,i,o){let c=await Ue(n,i,o);return c.exists&&P(c.token,i)&&P(y(c.pairToken),y(t))}async function fn(n,t,i,o,c){if(typeof i.token!="string")throw new d("Provide a launch token address.");Q(i.token);let e=F(i.token),p=await Ue(n,e,c);if(!p.exists||!P(p.token,e))throw new d("This address is not a Pons launch token.");let s=y(p.pairToken)===K?le:F(p.pairToken);return Qe(i.pairToken,F(p.pairToken),t,s),{quote:await Fe(n,!1,c).quote({from:t?s:e,to:t?e:s,amountIn:String(i.amountIn),...i.slippageBps===void 0?{}:{slippageBps:i.slippageBps}},o),input:t?s:e}}var Ye=n=>({tools:[!0,!1].map(t=>({name:t?"pons_buy":"pons_sell",inputSchema:We,async execute(i,o){try{return await De(n,i,o,t)}catch(c){throw new d(n.plainError(c))}}}))}),hn=Ye;export{ln as a,Fe as b,fn as c,Ye as d,hn as e};
@@ -1 +0,0 @@
1
- import{d as p}from"./M7U3A4EH.js";import{e as a}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{createHash as x}from"node:crypto";var c=32768,g="wormhole-x402@0.11.0/603aba277a626630d9b9463f713121dc4327325c";function w(s){if(!a(s)||Object.keys(s).length!==1||typeof s.text!="string")throw new l("Provide only text as a string for the local Wormhole scan.");let n=s.text,f=n.length>c||Buffer.byteLength(n,"utf8")>c,i={local:!0,scannerVersion:g,attribution:{provider:"Agent Wormhole",source:"https://github.com/runningoffcode/agent-wormhole"},limitation:"Evadable English instruction-shape rules. Allow is not proof of safety, intent, or coverage of unknown attacks."};if(f)return{...i,decision:"abstain",codes:[],findings:[],scannedPaths:[],charsScanned:0,inputHash:null,reason:"Text exceeds the 32768-byte local scan limit; no text was scanned or hashed."};let u=x("sha256").update(n,"utf8").digest("hex"),m={maxFieldChars:c,maxDecodeDepth:3,maxDepth:12},d=t=>{try{return p(t,m)}catch{return{decision:"abstain",findings:[],scanned:[],charsScanned:0}}},e=[{path:"text",verdict:d(n)}];try{let t=JSON.parse(n);(typeof t=="string"||a(t)||Array.isArray(t))&&e.push({path:"text.json",verdict:d(t)})}catch{}let r=e.flatMap(t=>t.verdict.findings.map(o=>({code:o.code,severity:o.severity,path:t.path,offset:o.offset}))),h=e.some(t=>t.verdict.decision==="refuse")?"refuse":e.some(t=>t.verdict.decision==="abstain")?"abstain":"allow";return{...i,decision:h,codes:[...new Set(r.map(t=>t.code))],findings:r.slice(0,64),findingsTruncated:r.length>64,scannedPaths:e.filter(t=>t.verdict.scanned.length).map(t=>t.path),charsScanned:e.reduce((t,o)=>t+o.verdict.charsScanned,0),inputHash:u,...h==="abstain"?{reason:"The local scanner could not cover all supplied text. Treat the result as unknown."}:{}}}export{c as a,g as b,w as c};
@@ -1 +0,0 @@
1
- import{a as q}from"./43LI5NKJ.js";import{a as j}from"./66F5ZH34.js";import{d as ne,f as te,g as v,i as oe}from"./NWNYJ26T.js";import{a as p,i as ee}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as U}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as ue,erc20Abi as V,getAddress as y,hashMessage as fe,keccak256 as pe,parseAbi as D,recoverMessageAddress as me,toHex as we,zeroAddress as _}from"viem";var g=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),A=y("0xf08c65564eb07d880021105489552080b08e4319"),re=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),ae=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),le=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),C={address:y(ee[p].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:p},N=D(["function acceptOffer((uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address nftCollateralContract,uint32 loanDuration,uint16 loanAdminFeeInBasisPoints,address loanERC20Denomination,address referrer) offer,(uint256 nonce,uint256 expiry,address signer,bytes signature) signature,(address revenueSharePartner,uint16 referralFeeInBasisPoints) borrowerSettings) returns (uint32)","function payBackLoan(uint32 loanId)","function getPayoffAmount(uint32 loanId) view returns (uint256)","function loanIdToLoan(uint32 loanId) view returns (uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address loanERC20Denomination,uint32 loanDuration,uint16 loanInterestRateForDurationInBasisPoints,uint16 loanAdminFeeInBasisPoints,address nftCollateralWrapper,uint64 loanStartTime,address nftCollateralContract,address borrower)","function loanRepaidOrLiquidated(uint32 loanId) view returns (bool)","function getWhetherNonceHasBeenUsedForUser(address user,uint256 nonce) view returns (bool)","function hub() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)"]),J=D(["function ownerOf(uint256 tokenId) view returns (address)","function approve(address spender,uint256 tokenId)","function supportsInterface(bytes4) view returns (bool)"]),ge=D(["function getContract(bytes32) view returns (address)"]),be=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],$=n=>te(n,"Provide the documented Longbow NFT object.");function F(n,d){if(Object.keys(n).some(i=>!d.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,d=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(d))throw new o(`NFT amounts and IDs must be uint${d} decimal strings.`);return BigInt(n)}function f(n){return oe(n,"Provide an NFT contract address.",ne)}var K=n=>{if(n>8640000000000n)throw new o("NFT deadline exceeds the supported timestamp range.");return new Date(Number(n)*1e3).toISOString()};function ie(n,d,i=!0){let s=$(n),e=$(d);F(s,M),F(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:f(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:f(s.loanERC20Denomination),referrer:f(s.referrer)};if(i&&(!v(t.nftCollateralContract,A)||!v(t.loanERC20Denomination,C.address)))throw new o("NFT borrowing supports only Robinhood Punks collateral and canonical USDG.");if(i&&(t.loanPrincipalAmount===0n||t.maximumRepaymentAmount<t.loanPrincipalAmount||t.loanDuration===0||t.referrer!==_))throw new o("NFT offer principal, payoff, duration or referrer is unsupported.");if(typeof e.signature!="string"||!/^0x(?:[0-9a-f]{2}){0,4096}$/i.test(e.signature))throw new o("Provide the existing lender\u2019s bounded hexadecimal offer signature; Oak does not sign lender offers.");let r={nonce:h(e.nonce),expiry:h(e.expiry),signer:f(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function he(n){let{offer:d,signature:i}=n;return pe(ue(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[d.loanERC20Denomination,d.loanPrincipalAmount,d.maximumRepaymentAmount,d.nftCollateralContract,d.nftCollateralId,d.referrer,d.loanDuration,d.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,g,BigInt(p)]))}function se(n,d){if(n.filter(s=>s.token.chainId===p&&v(s.token.address,C.address)).reduce((s,e)=>{if(e.token.decimals!==C.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==d)throw new o("NFT preview does not match the exact principal or payoff.")}async function de(n){let d=n.clientFor(p);if(await d.getChainId()!==p)throw new o("Longbow NFT loans require chain 4663.");let i=await d.getBlock(),s=(a,w,m,u=[])=>d.readContract({address:a,abi:w,functionName:m,args:u,blockNumber:i.number}),[e,t,r,l]=await Promise.all([s(g,N,"hub"),s(re,ge,"getContract",[we("PERMITTED_NFTS",{size:32})]),s(ae,be,"getNFTWrapper",[A]),s(A,J,"supportsInterface",["0x80ac58cd"])]);if(f(e)!==re||f(t)!==ae||f(r)!==le||l!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:d,block:i,read:s}}async function G(n,d){let i=Number(h(d,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(p);if(await s.getChainId()!==p)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,E,b=[])=>s.readContract({address:T,abi:I,functionName:E,args:b,blockNumber:e.number}),[r,l,a]=await Promise.all([t(g,N,"loanIdToLoan",[i]),t(g,N,"loanRepaidOrLiquidated",[i]),t(g,N,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof l!="boolean")throw new o("Invalid NFT loan state.");let[w,m,u,c,z,,,R,S,B,O]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let L=f(c)===C.address&&f(B)===A&&f(R)===le&&f(O)!==_,x=C;if(f(c)!==C.address){let[T,I]=await Promise.all([t(f(c),V,"symbol"),t(f(c),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");x={address:f(c),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:p}}if(typeof a!="bigint"||a!==BigInt(m)||a<BigInt(w))throw new o("NFT payoff does not match the fixed loan terms.");let P=BigInt(S)+BigInt(z);return{loanId:d,loanContract:g,chainId:p,blockNumber:e.number.toString(),collection:f(B),wrapper:f(R),tokenId:String(u),borrower:f(O),currency:x,supportedForActions:L,principalAmount:String(w),payoffAmount:a.toString(),startedAt:String(S),deadline:P.toString(),deadlineUtc:K(P),status:l?"repaid_or_liquidated":e.timestamp>P?"overdue":"active",repayable:!l&&e.timestamp<=P,warning:"After the on-chain deadline repayment is rejected; the lender can permanently take this NFT. Settled state alone does not distinguish repayment from liquidation."}}async function H(n,d){let i=await n.http(`https://longbow.credit/api/nft${d}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(1e4),redirect:"error"});if(!i.ok)throw new o("Longbow NFT discovery is unavailable. Retry the read; no loan was originated.");let s=await i.json();if(!Array.isArray(s)||s.length>1e3)throw new o("Longbow NFT discovery returned an invalid or oversized list.");return s.map($)}var ve=n=>{async function d(e,t,r){if(q(t),r){if(F(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await G(n,e.loanId);if(!b.supportedForActions)throw new o("This NFT loan is read-only in Oak; its collection, currency, wrapper or obligation-receipt borrower is not qualified for repayment.");let ce=h(e.maxPayoff);if(await de(n),b.borrower!==y(t))throw new o("Only this NFT loan\u2019s borrower may repay through Oak.");if(!b.repayable)throw new o("NFT loan is settled or overdue; repayment is unavailable.");let k=BigInt(b.payoffAmount);if(k>ce)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(p).readContract({address:C.address,abi:V,functionName:"balanceOf",args:[t]})<k)throw new o(`NFT repayment needs ${k} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${k} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(C.address,g,k.toString(),p),n.unsignedTx({to:g,data:W({abi:N,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:p,description:Y})],X=await n.preview(Q,t);return se(X.changes,-k),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}F(e,["offer","lenderSignature"]);let l=ie(e.offer,e.lenderSignature),{offer:a,signature:w}=l,{client:m,block:u,read:c}=await de(n),[z,R,S,B,O]=await Promise.all([c(A,J,"ownerOf",[a.nftCollateralId]),c(g,N,"getWhetherNonceHasBeenUsedForUser",[w.signer,w.nonce]),c(g,N,"paused"),c(g,N,"maximumLoanDuration"),c(g,N,"adminFeeInBasisPoints")]);if(f(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if(R!==!1||S!==!1||w.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==O)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let L=he(l),x=!1;try{x=v(await me({message:{raw:L},signature:w.signature}),w.signer)}catch{}if(!x){let b=await m.getCode({address:w.signer,blockNumber:u.number});b&&b!=="0x"&&(x=await c(w.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[fe({raw:L}),w.signature])==="0x1626ba7e")}if(!x)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let P=u.timestamp+BigInt(a.loanDuration),T=`Borrow ${a.loanPrincipalAmount} USDG base units; total payoff ${a.maximumRepaymentAmount} USDG base units. Escrow Robinhood Punks collection ${a.nftCollateralContract}, token ID ${a.nftCollateralId}. Estimated absolute repayment deadline ${K(P)} at snapshot ${u.number}; actual deadline is the mined start plus ${a.loanDuration} seconds. Read longbow_nft_loan after mining. Late repayment is rejected and you can permanently lose this NFT. Approve only this token ID to ${g}.`,I=[n.unsignedTx({to:A,data:W({abi:J,functionName:"approve",args:[g,a.nftCollateralId]}),value:"0",chainId:p,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:g,data:W({abi:N,functionName:"acceptOffer",args:[a,w,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:p,description:T})],E=await n.preview(I,t);return se(E.changes,a.loanPrincipalAmount),{txs:I,preview:E,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(P),deadlineIsEstimate:!0}}let i=(e,t,r,l)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,w)=>{try{return await l(a,w)}catch(m){throw new o(n.plainError(m))}}});async function s(e){q(e);let t=(r,l)=>({module:"longbow",id:`4663:${g.toLowerCase()}:${r}`,chainId:p,incomplete:!0,assets:[],description:`Longbow borrower NFT loans unreadable: ${n.plainError(l)} Use longbow_nft_loans or longbow_nft_loan for a known loanId.`});try{let r=await H(n,`/loans/borrower/${y(e)}`);if(r.length>100)throw new o("NFT loan discovery exceeds 100 rows; read specific loan IDs with longbow_nft_loan.");let l=new Set,a=[];for(let[w,m]of r.entries()){let u=`unreadable-${w}`;try{if(m.loanContract!==void 0&&f(m.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(m.loanId??m.id),32).toString(),l.has(u))continue;l.add(u);let c=await G(n,u);if(c.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(c.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${g.toLowerCase()}:${u}`,chainId:p,assets:[],description:`Longbow borrower NFT loan ${u}: ${c.status}, payoff debt ${c.payoffAmount} ${c.currency.symbol} base units (token ${c.currency.address}, decimals ${c.currency.decimals}); collateral ${c.collection} token ID ${c.tokenId} is escrowed. Deadline ${c.deadlineUtc}. ${c.repayable?"Use longbow_nft_repay before the deadline.":"Repayment is unavailable; the lender can permanently take the collateral."} Indexer discovery may be incomplete; lender interests are not included.`})}catch(c){a.push(t(u,c))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{F(e,[]);let t=await H(n,"/listings");return{chainId:p,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==p)throw new o("Longbow returned a listing on another chain.");return{id:U(String(r.id)),collection:f(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:f(r.borrower??r.owner),status:U(String(r.status)),note:r.note==null?null:U(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128}},["listingId"],async e=>{if(F(e,["listingId"]),typeof e.listingId!="string"||!/^[a-zA-Z0-9_-]{1,128}$/.test(e.listingId))throw new o("Provide the listingId returned by longbow_nft_listings.");let t=await H(n,`/listings/${encodeURIComponent(e.listingId)}/offers`);return{listingId:e.listingId,offers:t.map(r=>{let l=r.raw?$(r.raw):r,a={...$(l.offer??Object.fromEntries(M.map(m=>[m,l[m]])))};for(let m of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[m];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[m]=String(u))}let w=ie(a,typeof l.signature=="object"?l.signature:{nonce:l.nonce,expiry:l.expiry,signer:l.signer??l.lender,signature:l.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...w},(m,u)=>typeof u=="bigint"||m==="loanDuration"||m==="loanAdminFeeInBasisPoints"?String(u):u))}),caveat:"These are lender-signed terms from an untrusted indexer. Accept rechecks ownership, wrapper, nonce, expiry and signature on chain. Empty offers do not imply a discovery failure."}}),i("longbow_nft_loan",{loanId:j()},["loanId"],async e=>{if(F(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return G(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"]}},[],async(e,t)=>{F(e,["role"]),q(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let l=await H(n,`/loans/${r}/${y(t)}`);if(l.length>100)throw new o("NFT loan discovery exceeds 100 rows; read a specific loanId.");return{source:"Longbow indexer IDs, freshly checked on chain. Indexer completeness is not guaranteed.",loans:await Promise.all(l.map(a=>{if(a.loanContract!==void 0&&f(a.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");return G(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",properties:Object.fromEntries(M.map(e=>[e,{type:"string"}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",properties:Object.fromEntries(Z.map(e=>[e,{type:"string"}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>d(e,t,!1)),i("longbow_nft_repay",{loanId:j(),maxPayoff:j()},["loanId","maxPayoff"],(e,t)=>d(e,t,!0))]}};async function ke(n,d,i){if(await n.getChainId()!==p||i<0n||i>=1n<<256n)throw new o("NFT cleanup requires chain 4663 and the original token ID.");let s=D(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function approve(address,uint256)"]),e=await n.readContract({address:A,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,d))return;let t=await n.readContract({address:A,abi:s,functionName:"getApproved",args:[i]});if(v(t,g))return{to:A,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:p,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{g as a,A as b,re as c,ae as d,le as e,N as f,h as g,ie as h,he as i,G as j,ve as k,ke as l};
@@ -1 +0,0 @@
1
- import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./N4Q6GN65.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./43LI5NKJ.js";import{a as U}from"./66F5ZH34.js";import{c as _,e as K,g as p,h as G}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};