@oakagentkit/core 0.2.2 → 0.2.4

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 (535) hide show
  1. package/build/dist/api/addresses.d.ts +112 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/amounts.js +1 -1
  4. package/build/dist/api/args.js +1 -1
  5. package/build/dist/api/cache.js +1 -1
  6. package/build/dist/api/canonical.js +1 -1
  7. package/build/dist/api/chain.js +1 -1
  8. package/build/dist/api/deployments.js +1 -1
  9. package/build/dist/api/errors.d.ts +1 -0
  10. package/build/dist/api/errors.js +1 -1
  11. package/build/dist/api/gas.js +1 -1
  12. package/build/dist/api/grandfather.js +1 -1
  13. package/build/dist/api/guards.js +1 -1
  14. package/build/dist/api/history.js +1 -1
  15. package/build/dist/api/http.js +1 -1
  16. package/build/dist/api/identity-link.d.ts +1 -0
  17. package/build/dist/api/identity-link.js +1 -1
  18. package/build/dist/api/launch.js +1 -1
  19. package/build/dist/api/merkle.js +1 -1
  20. package/build/dist/api/metadata.js +1 -1
  21. package/build/dist/api/module.js +1 -1
  22. package/build/dist/api/modules/beefy/boosts.js +1 -1
  23. package/build/dist/api/modules/beefy/clm.js +1 -1
  24. package/build/dist/api/modules/beefy/guard.js +1 -1
  25. package/build/dist/api/modules/beefy/index.js +1 -1
  26. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  27. package/build/dist/api/modules/beefy/management.js +1 -1
  28. package/build/dist/api/modules/beefy/vaults.js +1 -1
  29. package/build/dist/api/modules/clanker/extensions.js +1 -1
  30. package/build/dist/api/modules/clanker/index.js +1 -1
  31. package/build/dist/api/modules/clanker/manage.js +1 -1
  32. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  33. package/build/dist/api/modules/clanker/protocol.js +1 -1
  34. package/build/dist/api/modules/clanker/state.js +1 -1
  35. package/build/dist/api/modules/earn/copy.d.ts +114 -0
  36. package/build/dist/api/modules/earn/copy.js +1 -0
  37. package/build/dist/api/modules/earn/cost.d.ts +47 -0
  38. package/build/dist/api/modules/earn/cost.js +1 -0
  39. package/build/dist/api/modules/earn/index.d.ts +8 -0
  40. package/build/dist/api/modules/earn/index.js +1 -0
  41. package/build/dist/api/modules/earn/lp.d.ts +17 -0
  42. package/build/dist/api/modules/earn/lp.js +1 -0
  43. package/build/dist/api/modules/earn/options.d.ts +36 -0
  44. package/build/dist/api/modules/earn/options.js +1 -0
  45. package/build/dist/api/modules/earn/types.d.ts +39 -0
  46. package/build/dist/api/modules/earn/types.js +0 -0
  47. package/build/dist/api/modules/erc8004/abi.js +1 -1
  48. package/build/dist/api/modules/erc8004/common.js +1 -1
  49. package/build/dist/api/modules/erc8004/domain.js +1 -1
  50. package/build/dist/api/modules/erc8004/index.js +1 -1
  51. package/build/dist/api/modules/erc8004/management.js +1 -1
  52. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  53. package/build/dist/api/modules/erc8004/services.js +1 -1
  54. package/build/dist/api/modules/erc8004/validation.js +1 -1
  55. package/build/dist/api/modules/grove/index.js +1 -1
  56. package/build/dist/api/modules/heyresearch/backoff.js +1 -1
  57. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  58. package/build/dist/api/modules/heyresearch/freshness.js +1 -1
  59. package/build/dist/api/modules/heyresearch/index.js +1 -1
  60. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  61. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  62. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  63. package/build/dist/api/modules/heyresearch/status-labels.d.ts +1 -1
  64. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  65. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  66. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  67. package/build/dist/api/modules/hoodag/index.js +1 -1
  68. package/build/dist/api/modules/hoodag/management.js +1 -1
  69. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  70. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  71. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  72. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  73. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  74. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  75. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  76. package/build/dist/api/modules/hoodlock/index.js +1 -1
  77. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  78. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  79. package/build/dist/api/modules/hoodlock/public.js +1 -1
  80. package/build/dist/api/modules/hookr/actions.js +1 -1
  81. package/build/dist/api/modules/hookr/addons.js +1 -1
  82. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  83. package/build/dist/api/modules/hookr/contracts.js +1 -1
  84. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  85. package/build/dist/api/modules/hookr/discovery.js +1 -1
  86. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  87. package/build/dist/api/modules/hookr/index.js +1 -1
  88. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  89. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  90. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  91. package/build/dist/api/modules/hookr/launch.js +1 -1
  92. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  93. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  94. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  95. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  96. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  97. package/build/dist/api/modules/hookr/pins.js +1 -1
  98. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  99. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  100. package/build/dist/api/modules/hookr/relay.js +1 -1
  101. package/build/dist/api/modules/hookr/revenue.js +1 -1
  102. package/build/dist/api/modules/kyberswap/index.js +1 -1
  103. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  104. package/build/dist/api/modules/layerbank/abi.d.ts +165 -0
  105. package/build/dist/api/modules/layerbank/abi.js +1 -0
  106. package/build/dist/api/modules/layerbank/actions.d.ts +2 -0
  107. package/build/dist/api/modules/layerbank/actions.js +1 -0
  108. package/build/dist/api/modules/layerbank/checks.d.ts +21 -0
  109. package/build/dist/api/modules/layerbank/checks.js +1 -0
  110. package/build/dist/api/modules/layerbank/index.d.ts +2 -0
  111. package/build/dist/api/modules/layerbank/index.js +1 -0
  112. package/build/dist/api/modules/layerbank/merkl.d.ts +6 -0
  113. package/build/dist/api/modules/layerbank/merkl.js +1 -0
  114. package/build/dist/api/modules/layerbank/reader.d.ts +15 -0
  115. package/build/dist/api/modules/layerbank/reader.js +1 -0
  116. package/build/dist/api/modules/layerbank/reserve.d.ts +13 -0
  117. package/build/dist/api/modules/layerbank/reserve.js +1 -0
  118. package/build/dist/api/modules/lighter/index.js +1 -1
  119. package/build/dist/api/modules/longbow/administration.js +1 -1
  120. package/build/dist/api/modules/longbow/analytics.js +1 -1
  121. package/build/dist/api/modules/longbow/fixed.js +1 -1
  122. package/build/dist/api/modules/longbow/index.js +1 -1
  123. package/build/dist/api/modules/longbow/nft.js +1 -1
  124. package/build/dist/api/modules/longbow/rebates.js +1 -1
  125. package/build/dist/api/modules/longbow/staking.js +1 -1
  126. package/build/dist/api/modules/meridian/index.js +1 -1
  127. package/build/dist/api/modules/meridian/markets.js +1 -1
  128. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  129. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  130. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  131. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  132. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  133. package/build/dist/api/modules/meridian/perps.js +1 -1
  134. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  135. package/build/dist/api/modules/meridian/rfq.js +1 -1
  136. package/build/dist/api/modules/merkl/discovery.js +1 -1
  137. package/build/dist/api/modules/merkl/index.js +1 -1
  138. package/build/dist/api/modules/merkl/manage.js +1 -1
  139. package/build/dist/api/modules/merkl/protocol.js +1 -1
  140. package/build/dist/api/modules/morpho/allocator.js +1 -1
  141. package/build/dist/api/modules/morpho/bundles-abi.js +1 -1
  142. package/build/dist/api/modules/morpho/bundles.js +1 -1
  143. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  144. package/build/dist/api/modules/morpho/index.js +1 -1
  145. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  146. package/build/dist/api/modules/morpho/midnight-abi.js +1 -1
  147. package/build/dist/api/modules/morpho/midnight.js +1 -1
  148. package/build/dist/api/modules/morpho/protocol.js +1 -1
  149. package/build/dist/api/modules/morpho/surface.js +1 -1
  150. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  151. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  152. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  153. package/build/dist/api/modules/netnet/blackjack-hashes.js +1 -1
  154. package/build/dist/api/modules/netnet/card-abi.js +1 -1
  155. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  156. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  157. package/build/dist/api/modules/netnet/card-read.js +1 -1
  158. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  159. package/build/dist/api/modules/netnet/desk-action-abi.js +1 -1
  160. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  161. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  162. package/build/dist/api/modules/netnet/desk-registry.js +1 -1
  163. package/build/dist/api/modules/netnet/financial-abi.js +1 -1
  164. package/build/dist/api/modules/netnet/financial.js +1 -1
  165. package/build/dist/api/modules/netnet/index.js +1 -1
  166. package/build/dist/api/modules/netnet/staking.js +1 -1
  167. package/build/dist/api/modules/orbio/gateway.js +1 -1
  168. package/build/dist/api/modules/orbio/index.js +1 -1
  169. package/build/dist/api/modules/orbio/pins.js +1 -1
  170. package/build/dist/api/modules/orbio/positions.d.ts +2 -0
  171. package/build/dist/api/modules/orbio/positions.js +1 -0
  172. package/build/dist/api/modules/pendle/abi.d.ts +205 -0
  173. package/build/dist/api/modules/pendle/abi.js +1 -0
  174. package/build/dist/api/modules/pendle/convert.d.ts +24 -0
  175. package/build/dist/api/modules/pendle/convert.js +1 -0
  176. package/build/dist/api/modules/pendle/costs.d.ts +3 -0
  177. package/build/dist/api/modules/pendle/costs.js +1 -0
  178. package/build/dist/api/modules/pendle/index.d.ts +11 -0
  179. package/build/dist/api/modules/pendle/index.js +1 -0
  180. package/build/dist/api/modules/pendle/markets.d.ts +37 -0
  181. package/build/dist/api/modules/pendle/markets.js +1 -0
  182. package/build/dist/api/modules/pendle/positions.d.ts +18 -0
  183. package/build/dist/api/modules/pendle/positions.js +1 -0
  184. package/build/dist/api/modules/pendle/pricecheck.d.ts +95 -0
  185. package/build/dist/api/modules/pendle/pricecheck.js +1 -0
  186. package/build/dist/api/modules/pendle/reader.d.ts +17 -0
  187. package/build/dist/api/modules/pendle/reader.js +1 -0
  188. package/build/dist/api/modules/pendle/redeem.d.ts +15 -0
  189. package/build/dist/api/modules/pendle/redeem.js +1 -0
  190. package/build/dist/api/modules/pendle/trade.d.ts +2 -0
  191. package/build/dist/api/modules/pendle/trade.js +1 -0
  192. package/build/dist/api/modules/pendle/types.d.ts +26 -0
  193. package/build/dist/api/modules/pendle/types.js +0 -0
  194. package/build/dist/api/modules/pendle/validate.d.ts +424 -0
  195. package/build/dist/api/modules/pendle/validate.js +1 -0
  196. package/build/dist/api/modules/pendle/verify.d.ts +22 -0
  197. package/build/dist/api/modules/pendle/verify.js +1 -0
  198. package/build/dist/api/modules/pons/claim.js +1 -1
  199. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  200. package/build/dist/api/modules/pons/index.js +1 -1
  201. package/build/dist/api/modules/pons/launch-status.js +1 -1
  202. package/build/dist/api/modules/pons/prices.js +1 -1
  203. package/build/dist/api/modules/pons/reads.d.ts +38 -2
  204. package/build/dist/api/modules/pons/reads.js +1 -1
  205. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  206. package/build/dist/api/modules/pons/trade.js +1 -1
  207. package/build/dist/api/modules/poolstrade/index.js +1 -1
  208. package/build/dist/api/modules/priors/coverage.js +1 -1
  209. package/build/dist/api/modules/priors/discovery.js +1 -1
  210. package/build/dist/api/modules/priors/features.js +1 -1
  211. package/build/dist/api/modules/priors/holdings.d.ts +4 -0
  212. package/build/dist/api/modules/priors/holdings.js +1 -0
  213. package/build/dist/api/modules/priors/index.js +1 -1
  214. package/build/dist/api/modules/priors/integration.js +1 -1
  215. package/build/dist/api/modules/priors/market.js +1 -1
  216. package/build/dist/api/modules/priors/pt.js +1 -1
  217. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  218. package/build/dist/api/modules/priors/starter-line.js +1 -1
  219. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  220. package/build/dist/api/modules/relay/api.js +1 -1
  221. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  222. package/build/dist/api/modules/relay/discovery.js +1 -1
  223. package/build/dist/api/modules/relay/inbound.js +1 -1
  224. package/build/dist/api/modules/relay/index.js +1 -1
  225. package/build/dist/api/modules/relay/order.js +1 -1
  226. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  227. package/build/dist/api/modules/relay/readiness.js +1 -1
  228. package/build/dist/api/modules/relay/reads.js +1 -1
  229. package/build/dist/api/modules/relay/vaults.js +1 -1
  230. package/build/dist/api/modules/spark/actions.js +1 -1
  231. package/build/dist/api/modules/spark/details.js +1 -1
  232. package/build/dist/api/modules/spark/index.js +1 -1
  233. package/build/dist/api/modules/spark/management.js +1 -1
  234. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  235. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  236. package/build/dist/api/modules/steakhouse/index.js +1 -1
  237. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  238. package/build/dist/api/modules/steakhouse/management.js +1 -1
  239. package/build/dist/api/modules/steakhouse/share-symbol.d.ts +3 -0
  240. package/build/dist/api/modules/steakhouse/share-symbol.js +1 -0
  241. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  242. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  243. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  244. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  249. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  250. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  251. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  252. package/build/dist/api/modules/tickerspring/research.js +1 -1
  253. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  254. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction.js +1 -1
  256. package/build/dist/api/modules/uniswap/batch.js +1 -1
  257. package/build/dist/api/modules/uniswap/common.js +1 -1
  258. package/build/dist/api/modules/uniswap/fees.js +1 -1
  259. package/build/dist/api/modules/uniswap/index.js +1 -1
  260. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  261. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  262. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  263. package/build/dist/api/modules/uniswap/pools.js +1 -1
  264. package/build/dist/api/modules/uniswap/position.js +1 -1
  265. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  266. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  267. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  268. package/build/dist/api/modules/uniswap/trade.js +1 -1
  269. package/build/dist/api/modules/uniswap/v2.js +1 -1
  270. package/build/dist/api/modules/uniswap/v3.d.ts +1 -0
  271. package/build/dist/api/modules/uniswap/v3.js +1 -1
  272. package/build/dist/api/modules/uniswap/v4.js +1 -1
  273. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  274. package/build/dist/api/modules/velora/claims.js +1 -1
  275. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  276. package/build/dist/api/modules/velora/index.js +1 -1
  277. package/build/dist/api/modules/wormhole/index.js +1 -1
  278. package/build/dist/api/modules/wormhole/license.js +1 -1
  279. package/build/dist/api/modules/wormhole/quotetext.js +1 -1
  280. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  281. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  282. package/build/dist/api/owner-signature.js +1 -1
  283. package/build/dist/api/positions.d.ts +5 -5
  284. package/build/dist/api/positions.js +1 -1
  285. package/build/dist/api/pricenote.js +1 -1
  286. package/build/dist/api/prices.js +1 -1
  287. package/build/dist/api/pricing.js +1 -1
  288. package/build/dist/api/reads.js +1 -1
  289. package/build/dist/api/routes.js +1 -1
  290. package/build/dist/api/rpc.js +1 -1
  291. package/build/dist/api/secret-fields.js +1 -1
  292. package/build/dist/api/send.js +1 -1
  293. package/build/dist/api/signing-registry.js +1 -1
  294. package/build/dist/api/signing.js +1 -1
  295. package/build/dist/api/simulate.js +1 -1
  296. package/build/dist/api/swap.js +1 -1
  297. package/build/dist/api/token-output.js +1 -1
  298. package/build/dist/api/tokens.js +1 -1
  299. package/build/dist/api/tool-policy.js +1 -1
  300. package/build/dist/api/tx.js +1 -1
  301. package/build/dist/api/types.d.ts +7 -2
  302. package/build/dist/api/untrusted.js +1 -1
  303. package/build/dist/api/vendor-limits.js +1 -1
  304. package/build/dist/chunks/{7YU6DELJ.js → 24CQ2SPB.js} +1 -1
  305. package/build/dist/chunks/2DUCTO5C.js +1 -0
  306. package/build/dist/chunks/2MZXTOZU.js +1 -0
  307. package/build/dist/chunks/2OJAOVMG.js +1 -0
  308. package/build/dist/chunks/2ZUP7ZEV.js +1 -0
  309. package/build/dist/chunks/{DHOBTJRD.js → 3AXVB23N.js} +1 -1
  310. package/build/dist/chunks/3ESNHZT5.js +1 -0
  311. package/build/dist/chunks/{GIV5JMTE.js → 3VAJW6TQ.js} +1 -1
  312. package/build/dist/chunks/{ALK6NKFP.js → 3WXK2FUA.js} +1 -1
  313. package/build/dist/chunks/{TQL7UDFL.js → 42DQTKEO.js} +1 -1
  314. package/build/dist/chunks/{E7R3J4H7.js → 43CSMYDO.js} +1 -1
  315. package/build/dist/chunks/46547QT3.js +1 -0
  316. package/build/dist/chunks/{XV2HQKND.js → 47YN4OUI.js} +1 -1
  317. package/build/dist/chunks/{S3HNPTXA.js → 4ALMYJJV.js} +1 -1
  318. package/build/dist/chunks/{SOYQOE5P.js → 4BVP652W.js} +1 -1
  319. package/build/dist/chunks/{JNZZLA2A.js → 4ISR2U72.js} +1 -1
  320. package/build/dist/chunks/{AAGDMH54.js → 4TQQH7N6.js} +1 -1
  321. package/build/dist/chunks/{WTSMPDT5.js → 4YFVAYKR.js} +1 -1
  322. package/build/dist/chunks/{PTAWEHKB.js → 57JFKIMK.js} +1 -1
  323. package/build/dist/chunks/{3RFSGU2Y.js → 5CAAFU7R.js} +1 -1
  324. package/build/dist/chunks/{73N3TOJL.js → 5KUWLUPM.js} +1 -1
  325. package/build/dist/chunks/{SKQGLGES.js → 5MQ5KSSV.js} +1 -1
  326. package/build/dist/chunks/{AJP5LDM2.js → 5N4A5XAW.js} +1 -1
  327. package/build/dist/chunks/{OQVZVR2S.js → 5OKJEGBH.js} +1 -1
  328. package/build/dist/chunks/5U7TCKX2.js +2 -0
  329. package/build/dist/chunks/5WUKOQIJ.js +1 -0
  330. package/build/dist/chunks/5ZLOCQA4.js +1 -0
  331. package/build/dist/chunks/63YRSLDK.js +1 -0
  332. package/build/dist/chunks/64WKYWZV.js +1 -0
  333. package/build/dist/chunks/{JPOYTTTW.js → 65EQECL3.js} +1 -1
  334. package/build/dist/chunks/{57HAXNQV.js → 6AAARNZ3.js} +1 -1
  335. package/build/dist/chunks/6FTYNYGF.js +1 -0
  336. package/build/dist/chunks/{L7YBCMZU.js → 6L5KTE6Y.js} +1 -1
  337. package/build/dist/chunks/{53N7PNJH.js → 6PY3IRDS.js} +1 -1
  338. package/build/dist/chunks/{5VHH5PW3.js → 6YYCGUCU.js} +1 -1
  339. package/build/dist/chunks/{UNZRE3YU.js → 7UOOIDR3.js} +1 -1
  340. package/build/dist/chunks/{LQUDJCAR.js → 7WQEPZJY.js} +1 -1
  341. package/build/dist/chunks/A3PN3PK3.js +1 -0
  342. package/build/dist/chunks/A6YQ5H24.js +1 -0
  343. package/build/dist/chunks/{CXLEQCP3.js → ABPL3ZZI.js} +1 -1
  344. package/build/dist/chunks/{R7FXNZRM.js → AG67Z3SC.js} +1 -1
  345. package/build/dist/chunks/{BX7XQANB.js → ALPYEM7B.js} +1 -1
  346. package/build/dist/chunks/{OE3CLZHR.js → ALRRW7SF.js} +1 -1
  347. package/build/dist/chunks/AUOXDNUO.js +7 -0
  348. package/build/dist/chunks/AWXJV2YH.js +1 -0
  349. package/build/dist/chunks/{66VBACC2.js → BAAXGB4K.js} +1 -1
  350. package/build/dist/chunks/{R53P2K3C.js → BIRMUW7Z.js} +1 -1
  351. package/build/dist/chunks/{EA6IYKIB.js → BK23XJXE.js} +1 -1
  352. package/build/dist/chunks/{NATG6YA6.js → BNG2IWZL.js} +1 -1
  353. package/build/dist/chunks/BQICZFLR.js +1 -0
  354. package/build/dist/chunks/{Y2KH6DCE.js → BXHNYCH2.js} +1 -1
  355. package/build/dist/chunks/{L62M7LOB.js → C5ZZAYXD.js} +1 -1
  356. package/build/dist/chunks/{52DHGSG4.js → CERNEJ2F.js} +1 -1
  357. package/build/dist/chunks/{EPZ7SWKM.js → CTMA4BTM.js} +1 -1
  358. package/build/dist/chunks/{QXNPPCOU.js → D6ZJPNK7.js} +1 -1
  359. package/build/dist/chunks/DFM4T6ZE.js +1 -0
  360. package/build/dist/chunks/{SJPM5ST4.js → DP2NIYBP.js} +1 -1
  361. package/build/dist/chunks/DVVFT42J.js +1 -0
  362. package/build/dist/chunks/E3UBHTJO.js +1 -0
  363. package/build/dist/chunks/E6RRXNV2.js +1 -0
  364. package/build/dist/chunks/{ZT47KN7A.js → E6UU7DL2.js} +1 -1
  365. package/build/dist/chunks/ECWGKLBW.js +1 -0
  366. package/build/dist/chunks/EKNSLLJK.js +1 -0
  367. package/build/dist/chunks/{XWEFKXKA.js → ENX72ARB.js} +1 -1
  368. package/build/dist/chunks/{DRWWPBOQ.js → EOQYLFXA.js} +1 -1
  369. package/build/dist/chunks/{ELZNT5Q3.js → ET23SES4.js} +1 -1
  370. package/build/dist/chunks/EU3OAJU2.js +1 -0
  371. package/build/dist/chunks/{2W46IRX6.js → EYFBVQ46.js} +1 -1
  372. package/build/dist/chunks/{VXLJRRKV.js → F26FK47J.js} +1 -1
  373. package/build/dist/chunks/{MFNP4KOK.js → F3BSEE52.js} +1 -1
  374. package/build/dist/chunks/FWD4L3CJ.js +1 -0
  375. package/build/dist/chunks/G7XSFUDL.js +1 -0
  376. package/build/dist/chunks/{5O5ZE3ZV.js → GHPREYQK.js} +1 -1
  377. package/build/dist/chunks/{AFHHRDPJ.js → GRIGSPD4.js} +1 -1
  378. package/build/dist/chunks/{J2XAEVKC.js → GVPX5XCL.js} +1 -1
  379. package/build/dist/chunks/{TLJPVYRJ.js → GW5IXLKU.js} +1 -1
  380. package/build/dist/chunks/H4NYYJ3Z.js +1 -0
  381. package/build/dist/chunks/{J3GFCBZZ.js → HSFOWJ3Z.js} +1 -1
  382. package/build/dist/chunks/{CY75R4FK.js → HTXKERNS.js} +1 -1
  383. package/build/dist/chunks/{6ZYLNB2B.js → HVM2EEXB.js} +1 -1
  384. package/build/dist/chunks/{U3F6DDML.js → I4TGMF2C.js} +1 -1
  385. package/build/dist/chunks/I6KUORFT.js +1 -0
  386. package/build/dist/chunks/{AMICUXS6.js → IKEJCBYU.js} +1 -1
  387. package/build/dist/chunks/IMRXZ7JB.js +1 -0
  388. package/build/dist/chunks/IQGY5FW7.js +1 -0
  389. package/build/dist/chunks/{L3ZM77SJ.js → IQIWASRD.js} +1 -1
  390. package/build/dist/chunks/JG27HM4P.js +1 -0
  391. package/build/dist/chunks/{V5LTA42G.js → JPNYUEQP.js} +1 -1
  392. package/build/dist/chunks/JZXYLHI7.js +1 -0
  393. package/build/dist/chunks/{QYYFRAWY.js → K22EXPWN.js} +1 -1
  394. package/build/dist/chunks/K72EYD6R.js +1 -0
  395. package/build/dist/chunks/KA7BPBCV.js +2 -0
  396. package/build/dist/chunks/KBKK7UNY.js +1 -0
  397. package/build/dist/chunks/{LBEMCOND.js → KBXU7U6Q.js} +1 -1
  398. package/build/dist/chunks/L6D26AMO.js +1 -0
  399. package/build/dist/chunks/{GGUEKSR4.js → L7OQUHM5.js} +1 -1
  400. package/build/dist/chunks/{F6WBPPBN.js → LDT3QTSY.js} +1 -1
  401. package/build/dist/chunks/{ZUG6MG46.js → LROVANUR.js} +1 -1
  402. package/build/dist/chunks/{WWFOYZT2.js → LVLVP5KQ.js} +1 -1
  403. package/build/dist/chunks/MBTARLZQ.js +1 -0
  404. package/build/dist/chunks/{SSTROLQM.js → MDDHG34Y.js} +1 -1
  405. package/build/dist/chunks/{OVK4EEOD.js → MDV7GECM.js} +1 -1
  406. package/build/dist/chunks/{DCTUYDWF.js → MFCPL6LF.js} +1 -1
  407. package/build/dist/chunks/MGPHD4VV.js +1 -0
  408. package/build/dist/chunks/{VC2RCYQE.js → MKAPRRKF.js} +1 -1
  409. package/build/dist/chunks/{FBSUTF3B.js → MKBNLGDD.js} +1 -1
  410. package/build/dist/chunks/{NRBIXV7V.js → MOPETB64.js} +1 -1
  411. package/build/dist/chunks/{ACN2BFMA.js → MQK6OP7S.js} +1 -1
  412. package/build/dist/chunks/{TWCSCRFS.js → MQYOG66Q.js} +1 -1
  413. package/build/dist/chunks/{2UU5TBBB.js → MXW2TP5P.js} +1 -1
  414. package/build/dist/chunks/MYFAKCQI.js +1 -0
  415. package/build/dist/chunks/{MKQVS3IO.js → NA7R6J5N.js} +1 -1
  416. package/build/dist/chunks/NB3LYS3G.js +1 -0
  417. package/build/dist/chunks/{TNSKEHPC.js → NDW5DAFL.js} +1 -1
  418. package/build/dist/chunks/{MRWCFTMS.js → NKX3FE34.js} +1 -1
  419. package/build/dist/chunks/NYNJITCM.js +1 -0
  420. package/build/dist/chunks/{YZSTP2E6.js → NZXQWDGF.js} +1 -1
  421. package/build/dist/chunks/{Z7RL4NGX.js → O6L4BJP4.js} +1 -1
  422. package/build/dist/chunks/{KSZMMNXK.js → OFI3Y55L.js} +1 -1
  423. package/build/dist/chunks/{2LM7U4S7.js → OTIXQZ3X.js} +1 -1
  424. package/build/dist/chunks/{WCKMQFGS.js → PADWZX7J.js} +1 -1
  425. package/build/dist/chunks/{6IM6A5VA.js → PBQSJSZO.js} +1 -1
  426. package/build/dist/chunks/PLZKXQ76.js +1 -0
  427. package/build/dist/chunks/{TFVWAYHY.js → PQC5635W.js} +1 -1
  428. package/build/dist/chunks/PSVOVZH7.js +70 -0
  429. package/build/dist/chunks/{PWBL4WKB.js → PWH464CJ.js} +1 -1
  430. package/build/dist/chunks/QJFXLYZG.js +1 -0
  431. package/build/dist/chunks/{4KQZTPMS.js → QRC4ZPDA.js} +1 -1
  432. package/build/dist/chunks/{4AKIXLXH.js → QSN6Y2K6.js} +1 -1
  433. package/build/dist/chunks/{C3TJLARP.js → QVYCJ6WV.js} +1 -1
  434. package/build/dist/chunks/{WVXW6VL3.js → RNC463IM.js} +1 -1
  435. package/build/dist/chunks/RPNAFUM5.js +1 -0
  436. package/build/dist/chunks/RVO3QK2B.js +1 -0
  437. package/build/dist/chunks/{FUXT7GRK.js → S2TAJHHK.js} +1 -1
  438. package/build/dist/chunks/{YHPOXAKA.js → S3FPF537.js} +1 -1
  439. package/build/dist/chunks/{H4S2ZCWK.js → S5WICHIS.js} +1 -1
  440. package/build/dist/chunks/SDHPFXRM.js +1 -0
  441. package/build/dist/chunks/{3NDVXEBR.js → SGEZIYJW.js} +1 -1
  442. package/build/dist/chunks/SK2VBNAU.js +1 -0
  443. package/build/dist/chunks/SKMPKAZI.js +1 -0
  444. package/build/dist/chunks/{5IIR3GIN.js → SQL6HD5E.js} +1 -1
  445. package/build/dist/chunks/SSIENQVU.js +1 -0
  446. package/build/dist/chunks/{EXRKBBX2.js → SUFA2GKR.js} +1 -1
  447. package/build/dist/chunks/TBCSZDAF.js +1 -0
  448. package/build/dist/chunks/{LMVB3B6T.js → TBIVTEP5.js} +1 -1
  449. package/build/dist/chunks/{2FSX7MMR.js → TJWVY4VO.js} +1 -1
  450. package/build/dist/chunks/{7XLEYOZH.js → TNKVRVTH.js} +1 -1
  451. package/build/dist/chunks/{SI6GCOAS.js → TPL4U3AQ.js} +1 -1
  452. package/build/dist/chunks/{QRDDKA4I.js → U4JGEMKT.js} +1 -1
  453. package/build/dist/chunks/{6AWTAE4Q.js → UA4O226F.js} +1 -1
  454. package/build/dist/chunks/UFVPMWPJ.js +1 -0
  455. package/build/dist/chunks/UHRCM7AG.js +1 -0
  456. package/build/dist/chunks/{XQXLFF7Y.js → UOGHQLQX.js} +1 -1
  457. package/build/dist/chunks/UP7FBDMJ.js +1 -0
  458. package/build/dist/chunks/{YQUKU2LS.js → UPMGGK34.js} +1 -1
  459. package/build/dist/chunks/VHLINDDS.js +1 -0
  460. package/build/dist/chunks/{PARWLWXW.js → VV2HEIFI.js} +1 -1
  461. package/build/dist/chunks/{YA5WWDEW.js → VVA72C6O.js} +1 -1
  462. package/build/dist/chunks/{TCPPYBGQ.js → W2OJ57ZO.js} +1 -1
  463. package/build/dist/chunks/{WQ6H62DM.js → W76QC2AW.js} +1 -1
  464. package/build/dist/chunks/{VFSRRDLY.js → WD37MEMZ.js} +1 -1
  465. package/build/dist/chunks/{R7QPJQP6.js → WGL46F3S.js} +1 -1
  466. package/build/dist/chunks/WIVYKLQM.js +2 -0
  467. package/build/dist/chunks/{XQUPZ3GU.js → WMNRP3YH.js} +1 -1
  468. package/build/dist/chunks/WOEKXQAH.js +1 -0
  469. package/build/dist/chunks/WPAF55SP.js +1 -0
  470. package/build/dist/chunks/{EVANKNJV.js → WPFAEBE7.js} +1 -1
  471. package/build/dist/chunks/WVONJOWN.js +1 -0
  472. package/build/dist/chunks/{TWSTOFN3.js → WWHCEMNB.js} +1 -1
  473. package/build/dist/chunks/{DZGEQBO7.js → XDZRO5JQ.js} +1 -1
  474. package/build/dist/chunks/XFKVU46U.js +3 -0
  475. package/build/dist/chunks/{RAKUK5VR.js → XJEOEMDS.js} +1 -1
  476. package/build/dist/chunks/XSD5NL7J.js +1 -0
  477. package/build/dist/chunks/{NU4K3TEZ.js → XSRIJUFU.js} +1 -1
  478. package/build/dist/chunks/{JVI26KQO.js → Y7PRJOIK.js} +1 -1
  479. package/build/dist/chunks/Y7RPSDD2.js +1 -0
  480. package/build/dist/chunks/YAJYDD6C.js +1 -0
  481. package/build/dist/chunks/{5OEHZJ6X.js → YEXUSRIZ.js} +1 -1
  482. package/build/dist/chunks/YHRUAQQK.js +1 -0
  483. package/build/dist/chunks/{3EFV4FQF.js → YPM2UITD.js} +1 -1
  484. package/build/dist/chunks/{3WBDHUV2.js → YRXT3HTW.js} +1 -1
  485. package/build/dist/chunks/Z4SRGAVL.js +1 -0
  486. package/build/dist/chunks/{SQ5BNSXR.js → ZBFKKUNP.js} +1 -1
  487. package/build/dist/chunks/{NWSPC3NH.js → ZCOFMGPS.js} +1 -1
  488. package/build/dist/chunks/ZCUXM52B.js +1 -0
  489. package/build/dist/chunks/ZE7EU2CS.js +1 -0
  490. package/build/dist/chunks/{CQCVFRQ5.js → ZET37EIG.js} +1 -1
  491. package/build/dist/chunks/{VVEUJ36E.js → ZGKVXFM5.js} +1 -1
  492. package/build/dist/chunks/{WQQJ7UPJ.js → ZSQOMSOC.js} +1 -1
  493. package/build/dist/chunks/{JST5JGAP.js → ZYH4B2GR.js} +1 -1
  494. package/package.json +2 -2
  495. package/build/dist/chunks/2MSQ6JII.js +0 -1
  496. package/build/dist/chunks/3SC5UI35.js +0 -1
  497. package/build/dist/chunks/4GAWMCQC.js +0 -1
  498. package/build/dist/chunks/4GHVIBL5.js +0 -1
  499. package/build/dist/chunks/4X2JOQ2L.js +0 -1
  500. package/build/dist/chunks/5YS5V2LK.js +0 -1
  501. package/build/dist/chunks/6UPPUHCL.js +0 -1
  502. package/build/dist/chunks/AXYOJBX6.js +0 -1
  503. package/build/dist/chunks/CEIPDEXZ.js +0 -1
  504. package/build/dist/chunks/CUNQ5RG5.js +0 -1
  505. package/build/dist/chunks/EG6M6SSO.js +0 -1
  506. package/build/dist/chunks/EGUMOD3A.js +0 -1
  507. package/build/dist/chunks/G6HCV67X.js +0 -1
  508. package/build/dist/chunks/GJY3P6OG.js +0 -1
  509. package/build/dist/chunks/HIMVOTIU.js +0 -1
  510. package/build/dist/chunks/IBXYIN7Q.js +0 -1
  511. package/build/dist/chunks/IUE6RASI.js +0 -1
  512. package/build/dist/chunks/JWCOXLYA.js +0 -1
  513. package/build/dist/chunks/KHJFXJBU.js +0 -1
  514. package/build/dist/chunks/LQGPMOD2.js +0 -1
  515. package/build/dist/chunks/MLPWQTBS.js +0 -1
  516. package/build/dist/chunks/MYBDO5SA.js +0 -1
  517. package/build/dist/chunks/NAYRD43N.js +0 -1
  518. package/build/dist/chunks/NMYGNJIJ.js +0 -1
  519. package/build/dist/chunks/NSOEDRBU.js +0 -3
  520. package/build/dist/chunks/PZHR4ITH.js +0 -1
  521. package/build/dist/chunks/Q356HHCL.js +0 -1
  522. package/build/dist/chunks/R7SXC74O.js +0 -1
  523. package/build/dist/chunks/RETS2ZEK.js +0 -1
  524. package/build/dist/chunks/SJPYXNOK.js +0 -1
  525. package/build/dist/chunks/SQZRVIVF.js +0 -1
  526. package/build/dist/chunks/SXAIXD56.js +0 -1
  527. package/build/dist/chunks/SXX3VTBP.js +0 -1
  528. package/build/dist/chunks/TMGWXDCZ.js +0 -1
  529. package/build/dist/chunks/UFS2RVEZ.js +0 -1
  530. package/build/dist/chunks/USSOVTD5.js +0 -1
  531. package/build/dist/chunks/UWOFA6GV.js +0 -1
  532. package/build/dist/chunks/V2OOOV6B.js +0 -1
  533. package/build/dist/chunks/XMA25DXR.js +0 -1
  534. package/build/dist/chunks/XVFLT275.js +0 -1
  535. package/build/dist/chunks/YHB55C5T.js +0 -1
@@ -1 +1 @@
1
- import{a as y}from"./6IM6A5VA.js";import{m as b}from"./73N3TOJL.js";import{a as i,i as w,j as l}from"./G6HCV67X.js";import{a as c}from"./5YS5V2LK.js";import{erc20Abi as v,getAddress as u,parseAbi as G}from"viem";var d=10n**27n,I=1000000021979553151239153027n,a=u(w[i].vaults.spark.address),U="https://docs.spark.finance/dev/savings/spark-vaults-v2",g=G(["function asset() view returns (address)","function vsr() view returns (uint256)","function totalAssets() view returns (uint256)","function depositCap() view returns (uint256)","function minVsr() view returns (uint256)","function maxVsr() view returns (uint256)","function convertToAssets(uint256) view returns (uint256)"]);function n(e){return b(e,"Spark returned an invalid unsigned integer.")}function q(e){if(e<d||e>I)throw new c("Spark savings rate is outside the documented bounds.");let r=31536000n,s=e,t=d;for(;r>0n;)r%2n&&(t=t*s/d),r/=2n,r>0n&&(s=s*s/d);return t-d}function j(e){return{name:"spark_details",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(r,s)=>{try{if(y(s),Object.keys(r).length)throw new c("Spark details takes no arguments.");let t=e.clientFor(i);if(await t.getChainId()!==i)throw new c("Spark details requires chain 4663.");let o=await t.getBlockNumber({cacheTime:0}),h=await t.readContract({address:a,abi:g,functionName:"asset",blockNumber:o});if(typeof h!="string"||u(h)!==u(l))throw new c("Spark does not report canonical USDG.");let[k,A,C,D,x,N,R]=await Promise.all([...["vsr","totalAssets","depositCap","minVsr","maxVsr"].map(V=>t.readContract({address:a,abi:g,functionName:V,blockNumber:o})),t.readContract({address:u(l),abi:v,functionName:"balanceOf",args:[a],blockNumber:o}),t.readContract({address:a,abi:v,functionName:"balanceOf",args:[s],blockNumber:o})]),f=n(k),p=n(A),m=n(N),S=n(R),T=n(await t.readContract({address:a,abi:g,functionName:"convertToAssets",args:[S],blockNumber:o}));return{chainId:i,vault:a,blockNumber:o.toString(),asset:{address:u(l),symbol:"USDG",decimals:6,chainId:i},shareToken:{address:a,symbol:"spUSDG",decimals:6,chainId:i},rate:{vsrRay:f.toString(),scale:d.toString(),annualYieldRay:q(f).toString(),secondsPerYear:"31536000",minVsrRay:n(D).toString(),maxVsrRay:n(x).toString(),caveat:"Projection with the current per-second rate held constant; governance can change it. Not a promised return."},totalAssets:p.toString(),idleAssets:m.toString(),depositCapAssets:n(C).toString(),outstandingAssets:(p>m?p-m:0n).toString(),heldShares:S.toString(),positionAssets:T.toString(),backing:{source:U,mechanism:"The permissioned taker deploys liquidity through the Spark Liquidity Layer. totalAssets is share-implied accounting; idle USDG alone funds immediate redemptions.",composition:null,compositionStatus:"Current strategy-by-strategy backing was not measured on this chain; inspect the official Spark app."},risk:["Liquidity deployed by the taker may be unavailable for immediate withdrawal.","Vault upgrades and role-controlled rate/cap changes affect behavior.","Share value and the USDG peg can change; conversion does not prove exit liquidity."]}}catch(t){throw new c(e.plainError(t))}}}}export{q as a,j as b};
1
+ import{a as y}from"./PBQSJSZO.js";import{m as b}from"./5KUWLUPM.js";import{a as i,i as w,j as l}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{erc20Abi as v,getAddress as u,parseAbi as G}from"viem";var d=10n**27n,I=1000000021979553151239153027n,a=u(w[i].vaults.spark.address),U="https://docs.spark.finance/dev/savings/spark-vaults-v2",g=G(["function asset() view returns (address)","function vsr() view returns (uint256)","function totalAssets() view returns (uint256)","function depositCap() view returns (uint256)","function minVsr() view returns (uint256)","function maxVsr() view returns (uint256)","function convertToAssets(uint256) view returns (uint256)"]);function n(e){return b(e,"Spark returned an invalid unsigned integer.")}function q(e){if(e<d||e>I)throw new c("Spark savings rate is outside the documented bounds.");let r=31536000n,s=e,t=d;for(;r>0n;)r%2n&&(t=t*s/d),r/=2n,r>0n&&(s=s*s/d);return t-d}function j(e){return{name:"spark_details",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(r,s)=>{try{if(y(s),Object.keys(r).length)throw new c("Spark details takes no arguments.");let t=e.clientFor(i);if(await t.getChainId()!==i)throw new c("Spark details requires chain 4663.");let o=await t.getBlockNumber({cacheTime:0}),h=await t.readContract({address:a,abi:g,functionName:"asset",blockNumber:o});if(typeof h!="string"||u(h)!==u(l))throw new c("Spark does not report canonical USDG.");let[k,A,C,D,x,N,R]=await Promise.all([...["vsr","totalAssets","depositCap","minVsr","maxVsr"].map(V=>t.readContract({address:a,abi:g,functionName:V,blockNumber:o})),t.readContract({address:u(l),abi:v,functionName:"balanceOf",args:[a],blockNumber:o}),t.readContract({address:a,abi:v,functionName:"balanceOf",args:[s],blockNumber:o})]),f=n(k),p=n(A),m=n(N),S=n(R),T=n(await t.readContract({address:a,abi:g,functionName:"convertToAssets",args:[S],blockNumber:o}));return{chainId:i,vault:a,blockNumber:o.toString(),asset:{address:u(l),symbol:"USDG",decimals:6,chainId:i},shareToken:{address:a,symbol:"spUSDG",decimals:6,chainId:i},rate:{vsrRay:f.toString(),scale:d.toString(),annualYieldRay:q(f).toString(),secondsPerYear:"31536000",minVsrRay:n(D).toString(),maxVsrRay:n(x).toString(),caveat:"Projection with the current per-second rate held constant; governance can change it. Not a promised return."},totalAssets:p.toString(),idleAssets:m.toString(),depositCapAssets:n(C).toString(),outstandingAssets:(p>m?p-m:0n).toString(),heldShares:S.toString(),positionAssets:T.toString(),backing:{source:U,mechanism:"The permissioned taker deploys liquidity through the Spark Liquidity Layer. totalAssets is share-implied accounting; idle USDG alone funds immediate redemptions.",composition:null,compositionStatus:"Current strategy-by-strategy backing was not measured on this chain; inspect the official Spark app."},risk:["Liquidity deployed by the taker may be unavailable for immediate withdrawal.","Vault upgrades and role-controlled rate/cap changes affect behavior.","Share value and the USDG peg can change; conversion does not prove exit liquidity."]}}catch(t){throw new c(e.plainError(t))}}}}export{q as a,j as b};
@@ -1 +1 @@
1
- import{g as V,k as T}from"./TFVWAYHY.js";import{s as R,x as A}from"./Q356HHCL.js";import{e as O,h as D,i as M,j as S,m as U,o as _,p as q}from"./5OEHZJ6X.js";import{a as I,b as k,g as F,h as H,i as N}from"./ACN2BFMA.js";import{a as t}from"./5YS5V2LK.js";import{randomUUID as J}from"node:crypto";import{getAddress as g,parseAbiItem as E}from"viem";var Q=E("event FamilyLaunched(bytes32 indexed familyId,address indexed owner,address indexed subject,address root)"),Y=E("event FamilyTransferred(bytes32 indexed familyId,address indexed owner)"),j=100000n,Z=64,z=512,K=300*1e3;function ce(P){let l=new Map,h=[g(k.launcherLegacy),g(k.launcherV1)],L=I.launcherDeployments,W=h.reduce((r,d)=>BigInt(L[d].blockNumber)<r?BigInt(L[d].blockNumber):r,BigInt(I.blockNumber));return{name:"hookr_lp_positions",inputSchema:{type:"object",additionalProperties:!1,properties:{cursor:{type:"string",minLength:1,maxLength:64,description:"Opaque, wallet-bound cursor from the preceding page; expires after five minutes. Restart without it if expired."},limit:{type:"integer",minimum:1,maximum:20,description:"Position summaries per page; defaults to 10. A page scans at most 100000 blocks and 32 family checks."}}},execute:async(r,d)=>{if(O(r,["cursor","limit"]),P.network==="testnet")throw new t("Hookr LP reads are configured only on mainnet, chain 4663.");let u=r.limit??10;if(typeof u!="number"||!Number.isInteger(u)||u<1||u>20)throw new t("Provide a Hookr position page limit from 1 to 20.");for(let[o,s]of l)s.expires<=Date.now()&&l.delete(o);let f=P.clientFor(4663),e;if(r.cursor!==void 0){if(typeof r.cursor!="string"||!l.has(r.cursor))throw new t("Hookr position cursor is unknown or expired. Restart without cursor; completeness has not been established.");let o=l.get(r.cursor);if(o.wallet!==d)throw new t("Hookr position cursor belongs to a different wallet. Restart without cursor.");if((await H(f,o.block.number)).hash!==o.block.hash)throw new t("Hookr position snapshot changed. Restart without cursor.");e={...o,candidates:[...o.candidates],seen:new Set(o.seen)}}else{let o=await H(f);e={wallet:d,block:o,nextBlock:o.number,firstBlock:W,candidates:[],member:0,seen:new Set,expires:Date.now()+K}}await F(f,e.block.number,[...h,k.rootV1]);let b=[],y=[],w=!1;if(e.candidates.length===0&&e.nextBlock>=e.firstBlock){let o=e.nextBlock,s=o-j+1n>e.firstBlock?o-j+1n:e.firstBlock;try{let i=(await Promise.all(h.flatMap(n=>[Q,Y].map(c=>f.getLogs({address:n,event:c,args:{owner:d},fromBlock:s,toBlock:o,strict:!0}))))).flat();if(i.length>z*2)throw new t("Hookr event page exceeds the bounded discovery limit. A dedicated position index is required.");let m=new Map;for(let n of i){let c=g(n.address),p=D(n.args.familyId);if(n.removed||!n.blockNumber||n.blockNumber<s||n.blockNumber>o||!h.includes(c)||n.args.owner!==d)throw new t("Hookr event page is incomplete or inconsistent with the requested wallet and block range.");let a=`${c}:${p}`;e.seen.has(a)||m.set(a,{launcher:c,familyId:p})}if(e.seen.size+m.size>z)throw new t("Hookr wallet history exceeds the bounded discovery limit. Completeness requires a dedicated position index.");e.candidates=[...m.values()];for(let n of m.keys())e.seen.add(n);e.nextBlock=s-1n}catch(i){w=!0,b.push(i instanceof t?i.message:"Hookr event history is unavailable for this block range. Retry this cursor; an empty page does not establish no positions.")}}let X=0;for(;!w&&e.candidates.length&&y.length<u&&X++<32;){let o=e.candidates[0],s=(i,m)=>q(f,o.launcher,_(o.launcher===g(k.launcherV1)?"launcherV1":"launcher"),i,m,e.block.number);try{let[i,m]=await Promise.all([s("familyOwner",[o.familyId]),s("memberCount",[o.familyId])]),n=M(i);if(BigInt(n)===0n)throw new t("Hookr family owner is unavailable for an indexed family.");if(n!==d){e.candidates.shift(),e.member=0;continue}let c=Number(S(m,8));if(c<1||c>8)throw new t("Hookr family member count is invalid.");for(;e.member<c&&y.length<u;){let p=e.member,a=U(await s("position",[o.familyId,p])),v=T(a.key);if(typeof a.tickLower!="number"||typeof a.tickUpper!="number")throw new t("Hookr family range is incomplete.");A(a.tickLower,a.tickUpper,v.tickSpacing);let $=S(a.liquidity,128),C=R(v);if(await s("poolFamily",[C])!==o.familyId)throw new t("Hookr position does not belong to this family.");let G=V({kind:"family",...o,member:String(p)});y.push({position:G,poolId:C,owner:d,liquidity:$.toString(),range:{tickLower:a.tickLower,tickUpper:a.tickUpper},poolKey:v}),e.member++}e.member===c&&(e.candidates.shift(),e.member=0)}catch(i){w=!0,b.push(i instanceof t?i.message:"Hookr family state is unavailable. Retry this cursor; no zero position is inferred.")}}await N(f,e.block);let x=!w&&e.nextBlock<e.firstBlock&&e.candidates.length===0;x||b.push("Discovery is incomplete. Continue nextCursor, including after an empty page. Current ownership is checked at the fixed snapshot; history gaps are not evidence of no positions.");let B=null;if(!x){for(;l.size>=Z;)l.delete(l.keys().next().value);B=J(),e.expires=Date.now()+K,l.set(B,e)}return typeof r.cursor=="string"&&l.delete(r.cursor),{chainId:4663,blockNumber:e.block.number.toString(),blockHash:e.block.hash,positions:y,nextCursor:B,complete:x,warnings:b,coverage:{custody:"reviewed Launcher families only",historyStartBlock:e.firstBlock.toString(),scannedFromBlock:e.nextBlock<e.block.number?(e.nextBlock+1n).toString():null,scannedThroughBlock:e.nextBlock<e.block.number?e.block.number.toString():null,snapshotBlock:e.block.number.toString()}}}}}export{ce as a};
1
+ import{g as V,k as T}from"./PQC5635W.js";import{s as R,x as A}from"./WPAF55SP.js";import{e as O,h as D,i as M,j as S,m as U,o as _,p as q}from"./YEXUSRIZ.js";import{a as I,b as k,g as F,h as H,i as N}from"./MQK6OP7S.js";import{a as t}from"./XSD5NL7J.js";import{randomUUID as J}from"node:crypto";import{getAddress as g,parseAbiItem as E}from"viem";var Q=E("event FamilyLaunched(bytes32 indexed familyId,address indexed owner,address indexed subject,address root)"),Y=E("event FamilyTransferred(bytes32 indexed familyId,address indexed owner)"),j=100000n,Z=64,z=512,K=300*1e3;function ce(P){let l=new Map,h=[g(k.launcherLegacy),g(k.launcherV1)],L=I.launcherDeployments,W=h.reduce((r,d)=>BigInt(L[d].blockNumber)<r?BigInt(L[d].blockNumber):r,BigInt(I.blockNumber));return{name:"hookr_lp_positions",inputSchema:{type:"object",additionalProperties:!1,properties:{cursor:{type:"string",minLength:1,maxLength:64,description:"Opaque, wallet-bound cursor from the preceding page; expires after five minutes. Restart without it if expired."},limit:{type:"integer",minimum:1,maximum:20,description:"Position summaries per page; defaults to 10. A page scans at most 100000 blocks and 32 family checks."}}},execute:async(r,d)=>{if(O(r,["cursor","limit"]),P.network==="testnet")throw new t("Hookr LP reads are configured only on mainnet, chain 4663.");let u=r.limit??10;if(typeof u!="number"||!Number.isInteger(u)||u<1||u>20)throw new t("Provide a Hookr position page limit from 1 to 20.");for(let[o,s]of l)s.expires<=Date.now()&&l.delete(o);let f=P.clientFor(4663),e;if(r.cursor!==void 0){if(typeof r.cursor!="string"||!l.has(r.cursor))throw new t("Hookr position cursor is unknown or expired. Restart without cursor; completeness has not been established.");let o=l.get(r.cursor);if(o.wallet!==d)throw new t("Hookr position cursor belongs to a different wallet. Restart without cursor.");if((await H(f,o.block.number)).hash!==o.block.hash)throw new t("Hookr position snapshot changed. Restart without cursor.");e={...o,candidates:[...o.candidates],seen:new Set(o.seen)}}else{let o=await H(f);e={wallet:d,block:o,nextBlock:o.number,firstBlock:W,candidates:[],member:0,seen:new Set,expires:Date.now()+K}}await F(f,e.block.number,[...h,k.rootV1]);let b=[],y=[],w=!1;if(e.candidates.length===0&&e.nextBlock>=e.firstBlock){let o=e.nextBlock,s=o-j+1n>e.firstBlock?o-j+1n:e.firstBlock;try{let i=(await Promise.all(h.flatMap(n=>[Q,Y].map(c=>f.getLogs({address:n,event:c,args:{owner:d},fromBlock:s,toBlock:o,strict:!0}))))).flat();if(i.length>z*2)throw new t("Hookr event page exceeds the bounded discovery limit. A dedicated position index is required.");let m=new Map;for(let n of i){let c=g(n.address),p=D(n.args.familyId);if(n.removed||!n.blockNumber||n.blockNumber<s||n.blockNumber>o||!h.includes(c)||n.args.owner!==d)throw new t("Hookr event page is incomplete or inconsistent with the requested wallet and block range.");let a=`${c}:${p}`;e.seen.has(a)||m.set(a,{launcher:c,familyId:p})}if(e.seen.size+m.size>z)throw new t("Hookr wallet history exceeds the bounded discovery limit. Completeness requires a dedicated position index.");e.candidates=[...m.values()];for(let n of m.keys())e.seen.add(n);e.nextBlock=s-1n}catch(i){w=!0,b.push(i instanceof t?i.message:"Hookr event history is unavailable for this block range. Retry this cursor; an empty page does not establish no positions.")}}let X=0;for(;!w&&e.candidates.length&&y.length<u&&X++<32;){let o=e.candidates[0],s=(i,m)=>q(f,o.launcher,_(o.launcher===g(k.launcherV1)?"launcherV1":"launcher"),i,m,e.block.number);try{let[i,m]=await Promise.all([s("familyOwner",[o.familyId]),s("memberCount",[o.familyId])]),n=M(i);if(BigInt(n)===0n)throw new t("Hookr family owner is unavailable for an indexed family.");if(n!==d){e.candidates.shift(),e.member=0;continue}let c=Number(S(m,8));if(c<1||c>8)throw new t("Hookr family member count is invalid.");for(;e.member<c&&y.length<u;){let p=e.member,a=U(await s("position",[o.familyId,p])),v=T(a.key);if(typeof a.tickLower!="number"||typeof a.tickUpper!="number")throw new t("Hookr family range is incomplete.");A(a.tickLower,a.tickUpper,v.tickSpacing);let $=S(a.liquidity,128),C=R(v);if(await s("poolFamily",[C])!==o.familyId)throw new t("Hookr position does not belong to this family.");let G=V({kind:"family",...o,member:String(p)});y.push({position:G,poolId:C,owner:d,liquidity:$.toString(),range:{tickLower:a.tickLower,tickUpper:a.tickUpper},poolKey:v}),e.member++}e.member===c&&(e.candidates.shift(),e.member=0)}catch(i){w=!0,b.push(i instanceof t?i.message:"Hookr family state is unavailable. Retry this cursor; no zero position is inferred.")}}await N(f,e.block);let x=!w&&e.nextBlock<e.firstBlock&&e.candidates.length===0;x||b.push("Discovery is incomplete. Continue nextCursor, including after an empty page. Current ownership is checked at the fixed snapshot; history gaps are not evidence of no positions.");let B=null;if(!x){for(;l.size>=Z;)l.delete(l.keys().next().value);B=J(),e.expires=Date.now()+K,l.set(B,e)}return typeof r.cursor=="string"&&l.delete(r.cursor),{chainId:4663,blockNumber:e.block.number.toString(),blockHash:e.block.hash,positions:y,nextCursor:B,complete:x,warnings:b,coverage:{custody:"reviewed Launcher families only",historyStartBlock:e.firstBlock.toString(),scannedFromBlock:e.nextBlock<e.block.number?(e.nextBlock+1n).toString():null,scannedThroughBlock:e.nextBlock<e.block.number?e.block.number.toString():null,snapshotBlock:e.block.number.toString()}}}}}export{ce as a};
@@ -1 +1 @@
1
- import{a as U}from"./6AWTAE4Q.js";import{b as I}from"./52DHGSG4.js";import{b as M}from"./S3HNPTXA.js";import{b as C}from"./AXYOJBX6.js";import{a as W}from"./6IM6A5VA.js";import{a as P}from"./UWOFA6GV.js";import{g as $}from"./73N3TOJL.js";import{a as R}from"./RETS2ZEK.js";import{a as h,d as D,i as T,j as b}from"./G6HCV67X.js";import{a as p}from"./5YS5V2LK.js";import{encodeFunctionData as A,erc20Abi as O,parseAbi as E}from"viem";var f=T[h].vaults.spark.address,i={address:b,chainId:h,symbol:"USDG",decimals:D},u={address:f,chainId:h,symbol:"spUSDG",decimals:6},G=(1n<<256n)-1n,k=E(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function maxDeposit(address receiver) view returns (uint256)","function maxWithdraw(address owner) view returns (uint256)","function maxRedeem(address owner) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewWithdraw(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","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)"]),t=(s,l)=>({token:{...s},amount:l.toString()});function y(s,l,v=!1){if(!s||typeof s!="object"||Array.isArray(s)||Object.keys(s).some(S=>!l||S!=="amount"))throw new p(l?"Provide only the amount for this Spark action.":"Spark listing takes no arguments.");if(!l)return 0n;if(v&&s.amount==="max")return"max";if(typeof s.amount!="string")throw new p("Amount must be a positive integer string in base units.");let n=R(s.amount);if(n===0n||n>G)throw new p("Amount must be positive and within the uint256 range.");return n}var N=s=>{async function l(a){try{return await a()}catch(e){throw new p(s.plainError(e))}}async function v(a){W(a);let e=s.clientFor(h);if(await e.getChainId()!==h)throw new p("Spark requires an endpoint on chain 4663.");let[r,c,o]=await Promise.all([e.readContract({address:f,abi:k,functionName:"asset"}),e.readContract({address:f,abi:k,functionName:"decimals"}),e.readContract({address:b,abi:O,functionName:"decimals"})]);if(typeof r!="string"||!$(r,b))throw new p("Spark does not report the expected USDG asset on chain 4663.");if(c!==u.decimals||o!==i.decimals)throw new p("Spark shares and USDG must both have 6 decimals.");return async(d,x=[])=>{let m=await e.readContract({address:f,abi:k,functionName:d,args:x});if(typeof m!="bigint"||m<0n||m>G)throw new p(`Spark returned an invalid ${d} value.`);return m}}function n(a){let e=a.amount.startsWith("-"),r=e?a.amount.slice(1):a.amount;return`${e?"-":""}${s.formatAmount(r,a.token.decimals)} ${a.token.symbol}`}async function S(a,e,r,c){let o=await s.preview(a,e),d=o.changes.map(n).join(", ");return{txs:a,amounts:r,preview:o,summary:`${c} Preview values can change before execution. ${o.summary}${d?` Changes: ${d}.`:""}`}}return{positions:a=>l(async()=>{let e=await v(a),r=await e("balanceOf",[a]);if(r===0n)return[];let[c,o,d]=await Promise.all([e("previewRedeem",[r]),e("maxRedeem",[a]),e("maxWithdraw",[a])]);return[{module:"spark",id:`${h}:${f}`,chainId:h,assets:[t(u,r)],description:`${n(t(u,r))}; redeem preview ${n(t(i,c))} (rounded down). Current maximum redeem ${n(t(u,o))}; maximum withdrawal ${n(t(i,d))}.`}]}),tools:[I(s),...M(s),...U(s),{name:"spark_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(a,e)=>l(async()=>{y(a,!1);let r=await v(e),c=await r("totalAssets"),[o,d,x,m,w]=await Promise.all([r("balanceOf",[e]),r("maxDeposit",[e]),r("maxWithdraw",[e]),r("maxRedeem",[e]),r("previewDeposit",[1000000n])]),g=await r("previewRedeem",[o]);return[{chainId:h,address:f,name:"Spark Savings USDG",asset:{...i},shareToken:{...u},totalAssets:t(i,c),balance:t(u,o),maxDeposit:t(i,d),maxWithdraw:t(i,x),maxRedeem:t(u,m),previewDepositAssets:t(i,1000000n),previewDeposit:t(u,w),previewRedeemShares:t(u,o),previewRedeem:t(i,g),rounding:"Deposit shares and redeemed assets round down; exact-asset withdrawals round shares up. Previews can change before execution."}]})},{name:"spark_deposit",inputSchema:{type:"object",properties:{amount:P("Positive USDG base-unit integer (6 decimals).")},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=y(a,!0),c=await v(e),[o,d]=await Promise.all([c("maxDeposit",[e]),c("previewDeposit",[r])]);if(r>o)throw new p("The deposit exceeds Spark\u2019s current maximum deposit.");if(d===0n)throw new p("This deposit would return zero Spark shares.");let x=[s.approval(b,f,r.toString(),h),s.unsignedTx({to:f,data:A({abi:k,functionName:"deposit",args:[r,e]}),value:"0",chainId:h,description:`Deposit ${n(t(i,r))} into Spark for this wallet.`})];return S(x,e,{assets:t(i,r),shares:t(u,d),maxDeposit:t(i,o)},`Approve exactly ${n(t(i,r))} for Spark ${f}, then deposit. Expected ${n(t(u,d))}, rounded down; current maximum deposit ${n(t(i,o))}.`)})},{name:"spark_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"Positive USDG base-unit integer (6 decimals), or max to redeem all held shares."}},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=y(a,!0,!0),c=await v(e),[o,d,x]=await Promise.all([c("balanceOf",[e]),c("maxWithdraw",[e]),c("maxRedeem",[e])]);if(o===0n)throw new p("This wallet has no Spark shares to withdraw.");let m,w,g;if(r==="max"){if(w=o,w>x)throw new p("The full share balance exceeds Spark\u2019s current maximum redeem. Request an asset amount within the current maximum withdrawal.");m=await c("previewRedeem",[w]),g=A({abi:k,functionName:"redeem",args:[w,e,e]})}else{if(m=r,m>d)throw new p("The withdrawal exceeds Spark\u2019s current maximum withdrawal.");if(w=await c("previewWithdraw",[m]),w>o)throw new p("This wallet has insufficient Spark shares for the withdrawal.");g=A({abi:k,functionName:"withdraw",args:[m,e,e]})}if(m===0n||w===0n)throw new p("Spark returned a zero asset or share preview for this withdrawal.");let _=r==="max"?`Redeem all ${n(t(u,w))} from Spark to this wallet.`:`Withdraw ${n(t(i,m))} from Spark to this wallet.`,j=[s.unsignedTx({to:f,data:g,value:"0",chainId:h,description:_})];return S(j,e,{assets:t(i,m),shares:t(u,w),maxWithdraw:t(i,d),maxRedeem:t(u,x)},r==="max"?`Redeem all ${n(t(u,w))} for an expected ${n(t(i,m))}, rounded down. Current maximum redeem ${n(t(u,x))}.`:`Withdraw ${n(t(i,m))} using an expected ${n(t(u,w))}, rounded up. Current maximum withdrawal ${n(t(i,d))}.`)})}]}};function Z(s){return C("spark",[N(s)])}export{N as a,Z as b};
1
+ import{a as U}from"./UA4O226F.js";import{b as I}from"./CERNEJ2F.js";import{b as M}from"./4ALMYJJV.js";import{b as C}from"./Z4SRGAVL.js";import{a as W}from"./PBQSJSZO.js";import{a as P}from"./5ZLOCQA4.js";import{g as $}from"./5KUWLUPM.js";import{a as R}from"./UP7FBDMJ.js";import{a as h,d as D,i as T,j as b}from"./FWD4L3CJ.js";import{a as p}from"./XSD5NL7J.js";import{encodeFunctionData as A,erc20Abi as O,parseAbi as E}from"viem";var f=T[h].vaults.spark.address,i={address:b,chainId:h,symbol:"USDG",decimals:D},u={address:f,chainId:h,symbol:"spUSDG",decimals:6},G=(1n<<256n)-1n,k=E(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function maxDeposit(address receiver) view returns (uint256)","function maxWithdraw(address owner) view returns (uint256)","function maxRedeem(address owner) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewWithdraw(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","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)"]),t=(s,l)=>({token:{...s},amount:l.toString()});function y(s,l,v=!1){if(!s||typeof s!="object"||Array.isArray(s)||Object.keys(s).some(S=>!l||S!=="amount"))throw new p(l?"Provide only the amount for this Spark action.":"Spark listing takes no arguments.");if(!l)return 0n;if(v&&s.amount==="max")return"max";if(typeof s.amount!="string")throw new p("Amount must be a positive integer string in base units.");let n=R(s.amount);if(n===0n||n>G)throw new p("Amount must be positive and within the uint256 range.");return n}var N=s=>{async function l(a){try{return await a()}catch(e){throw new p(s.plainError(e))}}async function v(a){W(a);let e=s.clientFor(h);if(await e.getChainId()!==h)throw new p("Spark requires an endpoint on chain 4663.");let[r,c,o]=await Promise.all([e.readContract({address:f,abi:k,functionName:"asset"}),e.readContract({address:f,abi:k,functionName:"decimals"}),e.readContract({address:b,abi:O,functionName:"decimals"})]);if(typeof r!="string"||!$(r,b))throw new p("Spark does not report the expected USDG asset on chain 4663.");if(c!==u.decimals||o!==i.decimals)throw new p("Spark shares and USDG must both have 6 decimals.");return async(d,x=[])=>{let m=await e.readContract({address:f,abi:k,functionName:d,args:x});if(typeof m!="bigint"||m<0n||m>G)throw new p(`Spark returned an invalid ${d} value.`);return m}}function n(a){let e=a.amount.startsWith("-"),r=e?a.amount.slice(1):a.amount;return`${e?"-":""}${s.formatAmount(r,a.token.decimals)} ${a.token.symbol}`}async function S(a,e,r,c){let o=await s.preview(a,e),d=o.changes.map(n).join(", ");return{txs:a,amounts:r,preview:o,summary:`${c} Preview values can change before execution. ${o.summary}${d?` Changes: ${d}.`:""}`}}return{positions:a=>l(async()=>{let e=await v(a),r=await e("balanceOf",[a]);if(r===0n)return[];let[c,o,d]=await Promise.all([e("previewRedeem",[r]),e("maxRedeem",[a]),e("maxWithdraw",[a])]);return[{module:"spark",id:`${h}:${f}`,chainId:h,assets:[t(u,r)],description:`${n(t(u,r))}; redeem preview ${n(t(i,c))} (rounded down). Current maximum redeem ${n(t(u,o))}; maximum withdrawal ${n(t(i,d))}.`}]}),tools:[I(s),...M(s),...U(s),{name:"spark_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(a,e)=>l(async()=>{y(a,!1);let r=await v(e),c=await r("totalAssets"),[o,d,x,m,w]=await Promise.all([r("balanceOf",[e]),r("maxDeposit",[e]),r("maxWithdraw",[e]),r("maxRedeem",[e]),r("previewDeposit",[1000000n])]),g=await r("previewRedeem",[o]);return[{chainId:h,address:f,name:"Spark Savings USDG",asset:{...i},shareToken:{...u},totalAssets:t(i,c),balance:t(u,o),maxDeposit:t(i,d),maxWithdraw:t(i,x),maxRedeem:t(u,m),previewDepositAssets:t(i,1000000n),previewDeposit:t(u,w),previewRedeemShares:t(u,o),previewRedeem:t(i,g),rounding:"Deposit shares and redeemed assets round down; exact-asset withdrawals round shares up. Previews can change before execution."}]})},{name:"spark_deposit",inputSchema:{type:"object",properties:{amount:P("Positive USDG base-unit integer (6 decimals).")},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=y(a,!0),c=await v(e),[o,d]=await Promise.all([c("maxDeposit",[e]),c("previewDeposit",[r])]);if(r>o)throw new p("The deposit exceeds Spark\u2019s current maximum deposit.");if(d===0n)throw new p("This deposit would return zero Spark shares.");let x=[s.approval(b,f,r.toString(),h),s.unsignedTx({to:f,data:A({abi:k,functionName:"deposit",args:[r,e]}),value:"0",chainId:h,description:`Deposit ${n(t(i,r))} into Spark for this wallet.`})];return S(x,e,{assets:t(i,r),shares:t(u,d),maxDeposit:t(i,o)},`Approve exactly ${n(t(i,r))} for Spark ${f}, then deposit. Expected ${n(t(u,d))}, rounded down; current maximum deposit ${n(t(i,o))}.`)})},{name:"spark_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"Positive USDG base-unit integer (6 decimals), or max to redeem all held shares."}},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=y(a,!0,!0),c=await v(e),[o,d,x]=await Promise.all([c("balanceOf",[e]),c("maxWithdraw",[e]),c("maxRedeem",[e])]);if(o===0n)throw new p("This wallet has no Spark shares to withdraw.");let m,w,g;if(r==="max"){if(w=o,w>x)throw new p("The full share balance exceeds Spark\u2019s current maximum redeem. Request an asset amount within the current maximum withdrawal.");m=await c("previewRedeem",[w]),g=A({abi:k,functionName:"redeem",args:[w,e,e]})}else{if(m=r,m>d)throw new p("The withdrawal exceeds Spark\u2019s current maximum withdrawal.");if(w=await c("previewWithdraw",[m]),w>o)throw new p("This wallet has insufficient Spark shares for the withdrawal.");g=A({abi:k,functionName:"withdraw",args:[m,e,e]})}if(m===0n||w===0n)throw new p("Spark returned a zero asset or share preview for this withdrawal.");let _=r==="max"?`Redeem all ${n(t(u,w))} from Spark to this wallet.`:`Withdraw ${n(t(i,m))} from Spark to this wallet.`,j=[s.unsignedTx({to:f,data:g,value:"0",chainId:h,description:_})];return S(j,e,{assets:t(i,m),shares:t(u,w),maxWithdraw:t(i,d),maxRedeem:t(u,x)},r==="max"?`Redeem all ${n(t(u,w))} for an expected ${n(t(i,m))}, rounded down. Current maximum redeem ${n(t(u,x))}.`:`Withdraw ${n(t(i,m))} using an expected ${n(t(u,w))}, rounded up. Current maximum withdrawal ${n(t(i,d))}.`)})}]}};function Z(s){return C("spark",[N(s)])}export{N as a,Z as b};
@@ -0,0 +1 @@
1
+ var a={chainId:4663,usdg:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",v4:{poolManager:"0x8366a39CC670B4001A1121B8F6A443A643e40951",swapper:"0x7Cd4E04E433E69e588728c86A3832753B5F846d4",quoter:"0x8dc178efb8111bb0973dd9d722ebeff267c98f94",stateView:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"},v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},tokens:[{symbol:"AAPL",token:"0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",pools:[{v:3,fee:500,pool:"0xAae0d815EE56e4092a5E5C2911E676Fea50B2d6D"},{v:4,fee:3e3,tickSpacing:60,id:"0xc748f4671a867db48b552f6b7650bf3255e05f80f00e3f7aad1b17ccb7898fdb"},{v:3,fee:3e3,pool:"0x783C9bbB765047CFdD2b84b92b2Ca9F11D34b7Ed"}]},{symbol:"AMD",token:"0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",pools:[{v:3,fee:3e3,pool:"0x48D284A2A4d3DC1b3Da08231Fe44317e7e7Aa51f"}]},{symbol:"AMZN",token:"0x12f190a9F9d7D37a250758b26824B97CE941bF54",pools:[{v:3,fee:3e3,pool:"0x8AC92DA74AB5F3b1d024Dc1943Ad7e15Dc4179Ef"},{v:4,fee:2400,tickSpacing:24,id:"0xefc94885c96b02696b9b45de43eeeb8ac53c0199cab42b4daae4911b96fb8825"}]},{symbol:"ASML",token:"0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",pools:[{v:3,fee:1e4,pool:"0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1"}]},{symbol:"BABA",token:"0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x1791fc651cc794a282e5dbcb56d0b2b38eff8754b677c8876e86901521ecc439"},{v:3,fee:3e3,pool:"0xa57ab582b310dd6f9e934EA1EEEa152741545E6A"}]},{symbol:"COIN",token:"0x6330D8C3178a418788dF01a47479c0ce7CCF450b",pools:[{v:4,fee:2500,tickSpacing:25,id:"0xe2e1a0e32205e854525e0fb1d3667a53bd3b4919f032b9bcd2a038b6b6dac314"},{v:4,fee:1e4,tickSpacing:200,id:"0x007a13fa152f6dc383cad20a8eaab4e1e2538b606936eae2a424f8aa47d6db31"}]},{symbol:"CRCL",token:"0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",pools:[{v:3,fee:3e3,pool:"0x654E4143e82a5824445Ade0824351C2A9ACD95a8"},{v:4,fee:3e3,tickSpacing:30,id:"0x628c98ab436ee34a6a7decd606242890582591bdf7c9a35d90e0d08021c31ea0"},{v:4,fee:1500,tickSpacing:15,id:"0x5177eac8c2176468bbf15e44081e151d35c2e7d068e96d3db94f496a4dc944b2"}]},{symbol:"CRWV",token:"0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x237014478f7ef98afbe7412ac35b6a3f96b8fb111de48b7c4dbf49dba4bd9c4b"}]},{symbol:"DELL",token:"0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",pools:[{v:3,fee:1e4,pool:"0xc30c89cB7815A1488b7998D15eEC73961707Fc5a"}]},{symbol:"GME",token:"0x1b0E319c6A659F002271B69dB8A7df2F911c153E",pools:[{v:3,fee:500,pool:"0xE2b46c905E12Ab8E2f864e4821a4325884C1B126"}]},{symbol:"GOOGL",token:"0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",pools:[{v:3,fee:500,pool:"0x34D0dC122CF9A8Eb296fC5e0D3A233625D7d19b7"},{v:4,fee:300,tickSpacing:3,id:"0x43fe16b75cabbf38f5b185d16142b02d1d9200d8f1ba17cb6cf899f562c6197f"},{v:4,fee:3e3,tickSpacing:60,id:"0xd4ecb79fdc521d7725d22b33ed43cb4e47aa96bfad76aa29577e3151f723ac5e"}]},{symbol:"INTC",token:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",pools:[{v:3,fee:3e3,pool:"0x2e5a92f5013a64661A49312111be2e8aBd33F56a"}]},{symbol:"META",token:"0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",pools:[{v:4,fee:310,tickSpacing:3,id:"0xc58bb68060bcb7b3ea0f6d4a4afef1e57f628722e808db12afb6d1733552872f"},{v:3,fee:3e3,pool:"0x107a7Cb40d8665360ba10E59471Af06150A50922"},{v:4,fee:3e3,tickSpacing:60,id:"0x5875d407a42965b0e768c8925cea290e06fa50603ef34fc99eb92a1050e6ae36"}]},{symbol:"MSFT",token:"0xe93237C50D904957Cf27E7B1133b510C669c2e74",pools:[{v:3,fee:3e3,pool:"0xeb60bCD1D920ad6E102690CCFC6fB488899E1510"},{v:4,fee:3e3,tickSpacing:60,id:"0x9194a557b6a6bb2236b49ea7e2bbccec5d3eeb705aef00903be4b3de1d949579"}]},{symbol:"MSTR",token:"0xec262a75e413fAfD0dF80480274532C79D42da09",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x319bac87e616a89e241c10aeb8afd4892a852cdd8b373cd9765ecddc40b87cfe"},{v:4,fee:2400,tickSpacing:24,id:"0xc105b8300ff65d750a0e4e63c7a879e20504069b770713464a5315e797735326"}]},{symbol:"MU",token:"0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",pools:[{v:3,fee:3e3,pool:"0xd057B1Bc54917855BBee58eAd58647f47caB35E5"}]},{symbol:"NBIS",token:"0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",pools:[{v:4,fee:9900,tickSpacing:99,id:"0x7c2f9ce1214ba9baf56d1b6a1fc640c1b63e9a711172c0c7d10e5a9c4a3d4f0c"}]},{symbol:"NVDA",token:"0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",pools:[{v:3,fee:500,pool:"0xd4EB21209C4D6093f80B5b84f5C45cc093EA14a3"},{v:4,fee:100,tickSpacing:1,id:"0x6444a8e0b267406a15db74ca00c4a24bdfa81ed3180f5b6d0851f8ed6f4f29c5"},{v:4,fee:3e3,tickSpacing:60,id:"0x3bb34a44f1b2b5f32c034c38a53065a521a47b199700fa9bd19d60985ff24bf1"}]},{symbol:"ORCL",token:"0xb0992820E760d836549ba69BC7598b4af75dEE03",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0xc2ce4784e1e72cf0221b51b30c8aaadf6c0b12863cf03ab3687854fb7b1d850a"}]},{symbol:"PLTR",token:"0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",pools:[{v:4,fee:1500,tickSpacing:15,id:"0xc59eaeda6d1a6f031bc7e1d039772f2d675e7b4de2c8668610f4471bd60b3802"},{v:3,fee:3e3,pool:"0x851680416A4f4E1c463d45171d61ACDdBc8554c0"}]},{symbol:"QQQ",token:"0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",pools:[{v:3,fee:500,pool:"0xD60A5d14dB690B7Afad71F76B108071D7175597d"}]},{symbol:"SGOV",token:"0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",pools:[{v:3,fee:500,pool:"0x6Ba50150B17Ffd0972915Aaf04fFd5E8f4Fa49b4"},{v:3,fee:3e3,pool:"0xfAb520051f96F4D2a32c22B6a3dD7fFfdf231bFe"}]},{symbol:"SLV",token:"0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",pools:[{v:3,fee:3e3,pool:"0x8cB787e6c315D464775289BaD00FDD67d53Ecb3D"},{v:3,fee:1e4,pool:"0x0Fa7BC480885DCf58Ad2ef63eC7289cF2481D51c"}]},{symbol:"SNDK",token:"0xB90A19fF0Af67f7779afF50A882A9CfF42446400",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0x2707cb88a6a40fa0f948f58958051ba097d6f6a3cf7f87929bd68ccc5becea24"}]},{symbol:"SPCX",token:"0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",pools:[{v:3,fee:500,pool:"0xc61284332117c3FB23A2A56cceFFD07F7aF60029"},{v:3,fee:3e3,pool:"0xEb07d9587eFD1778dFb9c385Ec43EF6d5F9fE401"}]},{symbol:"SPY",token:"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",pools:[{v:4,fee:100,tickSpacing:1,id:"0xe1ae6a4c6ccc9f037389a8d50a4f577bde1a9fe01d85d88ecbbd39955ce53288"},{v:3,fee:500,pool:"0xa7Bb1AC63BBaB0C44316E6c8C455213441689167"},{v:4,fee:500,tickSpacing:5,id:"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"}]},{symbol:"TSLA",token:"0x322F0929c4625eD5bAd873c95208D54E1c003b2d",pools:[{v:3,fee:3e3,pool:"0xf4ACdAEEB7022862A763C9B1B885e11191c889E3"},{v:4,fee:3e3,tickSpacing:60,id:"0x8517f8071ae5b831b738052f12125e8e3d6c158b78728aa44ce3b25e5104d32e"}]},{symbol:"TSM",token:"0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",pools:[{v:4,fee:7500,tickSpacing:75,id:"0x0ba5d53d2f6255f334b7c8ead4f56b6aef5af3402c5e4d11180afd38c6b85fb1"},{v:3,fee:1e4,pool:"0x07e8Ea83D4C1340774c8965125e26e12bf943bf1"}]},{symbol:"USAR",token:"0xd917B029C761D264c6A312BBbcDA868658eF86a6",pools:[{v:3,fee:3e3,pool:"0x04391780F519B7d3ba59c9590459D76e23d225C4"}]},{symbol:"USO",token:"0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",pools:[{v:4,fee:1200,tickSpacing:15,id:"0x1f2ad5a274a776d8e1408292bde1d92d8fa7b6444acf14ad60b9c3e4e5b66420"},{v:3,fee:3e3,pool:"0x02175608F1b5E6b5ed221cCFdC7Be197D111D915"}]}],notOffered:{CLSK:"thin",EWY:"thin",IONQ:"thin",RGTI:"thin",RKLB:"thin"},sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309"};export{a};
@@ -1 +1 @@
1
- import{d as s,e as h,f as y,h as O,i as q,k as T,m as L,q as w,t as D}from"./53N7PNJH.js";import{b as E,c as I,e as x,g as S}from"./73N3TOJL.js";import{a as P}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";import{a as $}from"./JXOEJPJ4.js";import{getAddress as k}from"viem";var u={type:"integer",minimum:1},l={type:"string",minLength:1,maxLength:512},_={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},g={type:"integer",minimum:1,maximum:100},v={limit:g,cursor:l},j={relay_chain_health:"Read Relay service health. chainId is required.",relay_requests:"Page this wallet\u2019s requests. Requires server OAK_RELAY_API_KEY; the wallet filter is automatic. Optional id, chain and status filters narrow results.",relay_balance_events:"Page this wallet\u2019s balance events. Requires server OAK_RELAY_API_KEY with access to this resource.",relay_exchange_rates:"Read reference rates without a freshness guarantee. Relay may be unavailable; use relay_token_price for an individual token."};function C(n,r){if(r.type==="string"){if(typeof n!="string"||n.length<Number(r.minLength??0)||n.length>Number(r.maxLength??1024)||typeof r.pattern=="string"&&!new RegExp(r.pattern).test(n))throw new d("Provide a valid Relay search, address or cursor.")}else if(r.type==="integer"){if(typeof n!="number"||!Number.isSafeInteger(n)||n<Number(r.minimum??0)||n>Number(r.maximum??Number.MAX_SAFE_INTEGER))throw new d("Provide an integer within the Relay parameter bounds.")}else{if(r.type==="boolean"&&typeof n!="boolean")throw new d("Provide a boolean Relay filter.");if(r.type==="array"){if(!Array.isArray(n)||n.length>100)throw new d("Provide at most 100 Relay search values.");for(let a of n)C(a,s(r.items))}}if(Array.isArray(r.enum)&&!r.enum.includes(n))throw new d("Choose a supported Relay filter.")}function m(n){return new URLSearchParams(Object.entries(n).map(([r,a])=>[r==="cursor"?"continuation":r,String(a)])).toString()}function R(n){if(n!=null)return C(n,l),n}function p(n){return typeof n=="string"?E.test(n)?k(n.toLowerCase()):/^(?:0x[0-9a-fA-F]{64}|-?\d+(?:\.\d+)?)$/.test(n)?n:$(n):Array.isArray(n)?n.map(p):x(n)?Object.fromEntries(Object.entries(n).filter(([r])=>!/api.?key|signature|authorization|secret/i.test(r)).map(([r,a])=>[r,p(a)])):n}function A(n){return h(n).map(r=>{let a=s(r),e=a.decimals;if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255||typeof a.address!="string")throw new d("Relay returned invalid currency metadata.");let t=a.vmType===void 0||a.vmType==="evm";return{chainId:O(a.chainId),address:t?k(y(a.address)):$(a.address),symbol:w(a.symbol)??"unknown",decimals:e,vmType:w(a.vmType),verified:x(a.metadata)&&a.metadata.verified===!0}})}var F=["relay_vault_status","relay_currencies","relay_token_price","relay_currency_classifications","relay_liquidity","relay_swap_sources","relay_requests","relay_app_fee_balance","relay_app_fee_claims","relay_balance_events","relay_deposit_address","relay_recovery_balances","relay_withdrawal_status","relay_chain_health","relay_token_details","relay_token_chart","relay_trending","relay_exchange_rates","relay_protocol_execution"],X=n=>{let r=D(n);function a(e,t,i,o){return{name:e,inputSchema:{type:"object",...j[e]?{description:j[e]}:{},additionalProperties:!1,properties:t,required:i},execute:async(c,b)=>{for(let f of i)if(c[f]===void 0)throw new d(`Provide ${f} for ${e}.`);for(let[f,N]of Object.entries(c)){if(!Object.hasOwn(t,f))throw new d(`Unsupported ${e} parameter ${f}.`);C(N,t[f])}return o(c,y(b))}}}return{tools:[a("relay_chain_health",{chainId:u},["chainId"],async e=>{let t=s(await r(`/chains/health?${m(e)}`));if(typeof t.healthy!="boolean")throw new d("Relay returned invalid chain health.");return{healthy:t.healthy,chainId:e.chainId}}),a("relay_token_details",{chainId:u,address:I},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${y(e.address)}`));if(t.chainId!==e.chainId||y(t.address)!==y(e.address))throw new d("Relay returned another token.");return{token:A([t])[0],data:p(t)}}),a("relay_token_chart",{chainId:u,address:I,timeframe:{type:"string",enum:["5M","1H","4H","24H","7D","30D","MAX"]}},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${y(e.address)}/chart?${m(e.timeframe===void 0?{}:{timeframe:e.timeframe})}`));return{chainId:e.chainId,address:k(y(e.address)),data:p(t),summary:"Relay historical market data. Chart prices and volumes are not token base-unit balances."}}),a("relay_trending",{chainId:u,limit:{...g,maximum:20},sortBy:{type:"string",enum:["relay24hBuyTxCount","relay24hBuyUsdVolume","coingecko6hTrending"]}},[],async e=>({currencies:A(await r(`/currencies/trending?${m(e)}`))})),a("relay_exchange_rates",{},[],async()=>({rates:p(s(await r("/prices/rates"))),summary:"Relay reference rates; timestamps are not supplied. These are prices, not token base-unit amounts."})),a("relay_protocol_execution",{id:_},["id"],async e=>{let t=s(await r(`/protocol/executions/${e.id}`)),i=s(t.execution);if(!S(T(i.idempotencyKey),String(e.id)))throw new d("Relay returned another protocol execution.");return{data:p(t),summary:"Oracle execution status only; this does not prove a destination bridge fill."}}),a("relay_currencies",{chainIds:{type:"array",items:u},term:{...l,maxLength:256},address:l,currencyId:l,symbol:l,groupID:l,tokens:{type:"array",items:l},verified:{type:"boolean"},defaultList:{type:"boolean"},includeAllChains:{type:"boolean"},useExternalSearch:{type:"boolean"},depositAddressOnly:{type:"boolean"},limit:g},[],async e=>({currencies:A(await r("/currencies/v2",{chainIds:[P],...e})),summary:"Relay currency search. Provider verification is not an Oak token endorsement; obtain a quote to check route availability."})),a("relay_token_price",{chainId:u,address:I},["chainId","address"],async e=>{let t=s(await r(`/currencies/token/price/v2?${m(e)}`));if(typeof t.price!="string"||!/^\d+(?:\.\d+)?$/.test(t.price))throw new d("Relay returned an invalid USD price.");return{chainId:e.chainId,address:k(y(e.address)),priceUsd:t.price,summary:"Relay USD price; freshness is not supplied by this endpoint."}}),a("relay_currency_classifications",{},[],async()=>{let e=s(await r("/currencies/classifications"));return{major:h(e.major).map(t=>w(t)??"unknown"),stable:h(e.stable).map(t=>w(t)??"unknown")}}),a("relay_liquidity",{chainId:u},["chainId"],async e=>{let t=s(await r(`/chains/liquidity?${m(e)}`));return{liquidity:h(t.liquidity).map(i=>{let o=s(i);if(o.chainId!==e.chainId)throw new d("Relay liquidity chain does not match the request.");return{...A([o])[0],amount:q(o.balance)}}),summary:"Relay solver balances are indicative capacity, not a reserved route or user funds."}}),a("relay_swap_sources",{chainId:u},[],async e=>({sources:h(s(await r(`/swap-sources?${m(e)}`)).sources).map(t=>w(t,"name")??"unknown")})),a("relay_requests",{...v,originChainId:u,destinationChainId:u,chainId:u,id:_,orderId:_,depositTxHash:_,fillTxHash:_,refundTxHash:_,status:{type:"string",enum:["success","failure","refund","pending","depositing"]},includeChildRequests:{type:"boolean"}},[],async(e,t)=>{let i=s(await r(`/requests/v3?${m({...e,user:t,includePendingRequests:!0})}`)),o=h(i.requests).map(s);for(let c of o){let b=x(c.depositAddress)?c.depositAddress.depositor:void 0;if(![c.user,c.sender,b].some(f=>typeof f=="string"&&f.toLowerCase()===t))throw new d("Relay returned a request for another wallet.");T(c.id)}return{requests:p(o),nextCursor:R(i.continuation),summary:"One page of this wallet\u2019s Relay requests, including pending requests. Pass nextCursor as cursor to resume; provider success is not destination receipt verification."}}),a("relay_app_fee_balance",{},[],async(e,t)=>{let i=s(await r(`/app-fees/${t}/balances`));return{balances:h(i.balances).map(o=>{let c=L(o);return{...c,token:{...c.token,address:k(c.token.address),symbol:w(c.token.symbol)??"unknown"}}}),summary:"Off-chain Relay app fee credits for this wallet. Claiming requires separate local signature integration."}}),a("relay_app_fee_claims",v,[],async(e,t)=>{let i=s(await r(`/app-fees/${t}/claims?${m(e)}`)),o=h(i.claims).map(s);for(let c of o)if(y(c.wallet)!==t)throw new d("Relay returned a fee claim for another wallet.");return{claims:p(o),nextCursor:R(i.continuation)}}),a("relay_balance_events",{...v,limit:{...g,maximum:50},requestId:_,chainId:u,currency:I,startTimestamp:{type:"integer",minimum:0},endTimestamp:{type:"integer",minimum:0},type:l},[],async(e,t)=>{let i=s(await r(`/balance/${t}/events?${m(e)}`));if(y(i.wallet)!==t)throw new d("Relay returned balance events for another wallet.");let o=h(i.events).map(s);for(let c of o)if(y(c.wallet)!==t)throw new d("Relay returned a balance event for another wallet.");return{events:p(o),nextCursor:R(i.continuation)}}),a("relay_deposit_address",{address:l,depositAddressId:l,pageSize:{...g,maximum:50},pageToken:l},[],async e=>{if(e.address===void 0==(e.depositAddressId===void 0))throw new d("Provide exactly one deposit address or depositAddressId.");let t=s(await r(`/deposit-addresses/v2?${m(e)}`)),i=s(t.data),o=s(i.depositAddress);if(e.address!==void 0&&o.address!==e.address||e.depositAddressId!==void 0&&o.id!==e.depositAddressId)throw new d("Relay returned another deposit address.");return{data:p(i),nextPageToken:R(i.nextPageToken),summary:"Deposit address monitoring only. Reading an address does not create, change, fund or recover it."}}),a("relay_recovery_balances",{...v,limit:{...g,maximum:50},ownerChainId:u},["ownerChainId"],async(e,t)=>{let i=s(await r(`/withdrawals/balances?${m({...e,recoveryAddress:t})}`)),o=h(i.balances).map(c=>{let b=s(c);return q(b.amount),b});return{balances:p(o),nextCursor:R(i.continuation),summary:"Credited recovery balances only. Empty balances do not prove that an unattested deposit has no recoverable funds. Withdrawal signing remains a separate action."}}),a("relay_withdrawal_status",{id:l},["id"],async e=>{let t=s(await r(`/withdrawals/status?${m(e)}`));if(typeof t.status!="string")throw new d("Relay returned an invalid withdrawal status.");return{status:w(t.status)??"unknown",data:p(t),summary:"Relay withdrawal job status; verify any reported transaction on its chain before treating funds as received."}})]}};export{F as a,X as b};
1
+ import{d as s,e as h,f as y,h as O,i as q,k as T,m as L,q as w,t as D}from"./6PY3IRDS.js";import{b as E,c as I,e as x,g as S}from"./5KUWLUPM.js";import{a as P}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as $}from"./JXOEJPJ4.js";import{getAddress as k}from"viem";var u={type:"integer",minimum:1},l={type:"string",minLength:1,maxLength:512},_={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},g={type:"integer",minimum:1,maximum:100},v={limit:g,cursor:l},j={relay_chain_health:"Read Relay service health. chainId is required.",relay_requests:"Page this wallet\u2019s requests. Requires server OAK_RELAY_API_KEY; the wallet filter is automatic. Optional id, chain and status filters narrow results.",relay_balance_events:"Page this wallet\u2019s balance events. Requires server OAK_RELAY_API_KEY with access to this resource.",relay_exchange_rates:"Read reference rates without a freshness guarantee. Relay may be unavailable; use relay_token_price for an individual token."};function C(n,r){if(r.type==="string"){if(typeof n!="string"||n.length<Number(r.minLength??0)||n.length>Number(r.maxLength??1024)||typeof r.pattern=="string"&&!new RegExp(r.pattern).test(n))throw new d("Provide a valid Relay search, address or cursor.")}else if(r.type==="integer"){if(typeof n!="number"||!Number.isSafeInteger(n)||n<Number(r.minimum??0)||n>Number(r.maximum??Number.MAX_SAFE_INTEGER))throw new d("Provide an integer within the Relay parameter bounds.")}else{if(r.type==="boolean"&&typeof n!="boolean")throw new d("Provide a boolean Relay filter.");if(r.type==="array"){if(!Array.isArray(n)||n.length>100)throw new d("Provide at most 100 Relay search values.");for(let a of n)C(a,s(r.items))}}if(Array.isArray(r.enum)&&!r.enum.includes(n))throw new d("Choose a supported Relay filter.")}function m(n){return new URLSearchParams(Object.entries(n).map(([r,a])=>[r==="cursor"?"continuation":r,String(a)])).toString()}function R(n){if(n!=null)return C(n,l),n}function p(n){return typeof n=="string"?E.test(n)?k(n.toLowerCase()):/^(?:0x[0-9a-fA-F]{64}|-?\d+(?:\.\d+)?)$/.test(n)?n:$(n):Array.isArray(n)?n.map(p):x(n)?Object.fromEntries(Object.entries(n).filter(([r])=>!/api.?key|signature|authorization|secret/i.test(r)).map(([r,a])=>[r,p(a)])):n}function A(n){return h(n).map(r=>{let a=s(r),e=a.decimals;if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255||typeof a.address!="string")throw new d("Relay returned invalid currency metadata.");let t=a.vmType===void 0||a.vmType==="evm";return{chainId:O(a.chainId),address:t?k(y(a.address)):$(a.address),symbol:w(a.symbol)??"unknown",decimals:e,vmType:w(a.vmType),verified:x(a.metadata)&&a.metadata.verified===!0}})}var F=["relay_vault_status","relay_currencies","relay_token_price","relay_currency_classifications","relay_liquidity","relay_swap_sources","relay_requests","relay_app_fee_balance","relay_app_fee_claims","relay_balance_events","relay_deposit_address","relay_recovery_balances","relay_withdrawal_status","relay_chain_health","relay_token_details","relay_token_chart","relay_trending","relay_exchange_rates","relay_protocol_execution"],X=n=>{let r=D(n);function a(e,t,i,o){return{name:e,inputSchema:{type:"object",...j[e]?{description:j[e]}:{},additionalProperties:!1,properties:t,required:i},execute:async(c,b)=>{for(let f of i)if(c[f]===void 0)throw new d(`Provide ${f} for ${e}.`);for(let[f,N]of Object.entries(c)){if(!Object.hasOwn(t,f))throw new d(`Unsupported ${e} parameter ${f}.`);C(N,t[f])}return o(c,y(b))}}}return{tools:[a("relay_chain_health",{chainId:u},["chainId"],async e=>{let t=s(await r(`/chains/health?${m(e)}`));if(typeof t.healthy!="boolean")throw new d("Relay returned invalid chain health.");return{healthy:t.healthy,chainId:e.chainId}}),a("relay_token_details",{chainId:u,address:I},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${y(e.address)}`));if(t.chainId!==e.chainId||y(t.address)!==y(e.address))throw new d("Relay returned another token.");return{token:A([t])[0],data:p(t)}}),a("relay_token_chart",{chainId:u,address:I,timeframe:{type:"string",enum:["5M","1H","4H","24H","7D","30D","MAX"]}},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${y(e.address)}/chart?${m(e.timeframe===void 0?{}:{timeframe:e.timeframe})}`));return{chainId:e.chainId,address:k(y(e.address)),data:p(t),summary:"Relay historical market data. Chart prices and volumes are not token base-unit balances."}}),a("relay_trending",{chainId:u,limit:{...g,maximum:20},sortBy:{type:"string",enum:["relay24hBuyTxCount","relay24hBuyUsdVolume","coingecko6hTrending"]}},[],async e=>({currencies:A(await r(`/currencies/trending?${m(e)}`))})),a("relay_exchange_rates",{},[],async()=>({rates:p(s(await r("/prices/rates"))),summary:"Relay reference rates; timestamps are not supplied. These are prices, not token base-unit amounts."})),a("relay_protocol_execution",{id:_},["id"],async e=>{let t=s(await r(`/protocol/executions/${e.id}`)),i=s(t.execution);if(!S(T(i.idempotencyKey),String(e.id)))throw new d("Relay returned another protocol execution.");return{data:p(t),summary:"Oracle execution status only; this does not prove a destination bridge fill."}}),a("relay_currencies",{chainIds:{type:"array",items:u},term:{...l,maxLength:256},address:l,currencyId:l,symbol:l,groupID:l,tokens:{type:"array",items:l},verified:{type:"boolean"},defaultList:{type:"boolean"},includeAllChains:{type:"boolean"},useExternalSearch:{type:"boolean"},depositAddressOnly:{type:"boolean"},limit:g},[],async e=>({currencies:A(await r("/currencies/v2",{chainIds:[P],...e})),summary:"Relay currency search. Provider verification is not an Oak token endorsement; obtain a quote to check route availability."})),a("relay_token_price",{chainId:u,address:I},["chainId","address"],async e=>{let t=s(await r(`/currencies/token/price/v2?${m(e)}`));if(typeof t.price!="string"||!/^\d+(?:\.\d+)?$/.test(t.price))throw new d("Relay returned an invalid USD price.");return{chainId:e.chainId,address:k(y(e.address)),priceUsd:t.price,summary:"Relay USD price; freshness is not supplied by this endpoint."}}),a("relay_currency_classifications",{},[],async()=>{let e=s(await r("/currencies/classifications"));return{major:h(e.major).map(t=>w(t)??"unknown"),stable:h(e.stable).map(t=>w(t)??"unknown")}}),a("relay_liquidity",{chainId:u},["chainId"],async e=>{let t=s(await r(`/chains/liquidity?${m(e)}`));return{liquidity:h(t.liquidity).map(i=>{let o=s(i);if(o.chainId!==e.chainId)throw new d("Relay liquidity chain does not match the request.");return{...A([o])[0],amount:q(o.balance)}}),summary:"Relay solver balances are indicative capacity, not a reserved route or user funds."}}),a("relay_swap_sources",{chainId:u},[],async e=>({sources:h(s(await r(`/swap-sources?${m(e)}`)).sources).map(t=>w(t,"name")??"unknown")})),a("relay_requests",{...v,originChainId:u,destinationChainId:u,chainId:u,id:_,orderId:_,depositTxHash:_,fillTxHash:_,refundTxHash:_,status:{type:"string",enum:["success","failure","refund","pending","depositing"]},includeChildRequests:{type:"boolean"}},[],async(e,t)=>{let i=s(await r(`/requests/v3?${m({...e,user:t,includePendingRequests:!0})}`)),o=h(i.requests).map(s);for(let c of o){let b=x(c.depositAddress)?c.depositAddress.depositor:void 0;if(![c.user,c.sender,b].some(f=>typeof f=="string"&&f.toLowerCase()===t))throw new d("Relay returned a request for another wallet.");T(c.id)}return{requests:p(o),nextCursor:R(i.continuation),summary:"One page of this wallet\u2019s Relay requests, including pending requests. Pass nextCursor as cursor to resume; provider success is not destination receipt verification."}}),a("relay_app_fee_balance",{},[],async(e,t)=>{let i=s(await r(`/app-fees/${t}/balances`));return{balances:h(i.balances).map(o=>{let c=L(o);return{...c,token:{...c.token,address:k(c.token.address),symbol:w(c.token.symbol)??"unknown"}}}),summary:"Off-chain Relay app fee credits for this wallet. Claiming requires separate local signature integration."}}),a("relay_app_fee_claims",v,[],async(e,t)=>{let i=s(await r(`/app-fees/${t}/claims?${m(e)}`)),o=h(i.claims).map(s);for(let c of o)if(y(c.wallet)!==t)throw new d("Relay returned a fee claim for another wallet.");return{claims:p(o),nextCursor:R(i.continuation)}}),a("relay_balance_events",{...v,limit:{...g,maximum:50},requestId:_,chainId:u,currency:I,startTimestamp:{type:"integer",minimum:0},endTimestamp:{type:"integer",minimum:0},type:l},[],async(e,t)=>{let i=s(await r(`/balance/${t}/events?${m(e)}`));if(y(i.wallet)!==t)throw new d("Relay returned balance events for another wallet.");let o=h(i.events).map(s);for(let c of o)if(y(c.wallet)!==t)throw new d("Relay returned a balance event for another wallet.");return{events:p(o),nextCursor:R(i.continuation)}}),a("relay_deposit_address",{address:l,depositAddressId:l,pageSize:{...g,maximum:50},pageToken:l},[],async e=>{if(e.address===void 0==(e.depositAddressId===void 0))throw new d("Provide exactly one deposit address or depositAddressId.");let t=s(await r(`/deposit-addresses/v2?${m(e)}`)),i=s(t.data),o=s(i.depositAddress);if(e.address!==void 0&&o.address!==e.address||e.depositAddressId!==void 0&&o.id!==e.depositAddressId)throw new d("Relay returned another deposit address.");return{data:p(i),nextPageToken:R(i.nextPageToken),summary:"Deposit address monitoring only. Reading an address does not create, change, fund or recover it."}}),a("relay_recovery_balances",{...v,limit:{...g,maximum:50},ownerChainId:u},["ownerChainId"],async(e,t)=>{let i=s(await r(`/withdrawals/balances?${m({...e,recoveryAddress:t})}`)),o=h(i.balances).map(c=>{let b=s(c);return q(b.amount),b});return{balances:p(o),nextCursor:R(i.continuation),summary:"Credited recovery balances only. Empty balances do not prove that an unattested deposit has no recoverable funds. Withdrawal signing remains a separate action."}}),a("relay_withdrawal_status",{id:l},["id"],async e=>{let t=s(await r(`/withdrawals/status?${m(e)}`));if(typeof t.status!="string")throw new d("Relay returned an invalid withdrawal status.");return{status:w(t.status)??"unknown",data:p(t),summary:"Relay withdrawal job status; verify any reported transaction on its chain before treating funds as received."}})]}};export{F as a,X as b};
@@ -0,0 +1 @@
1
+ import{a as F,c as y,d as b,f as h,g as N}from"./SK2VBNAU.js";import{g as p}from"./5KUWLUPM.js";import{a as M,i as O,j as _}from"./FWD4L3CJ.js";import{a as A}from"./XSD5NL7J.js";import{getAddress as U,isAddress as W}from"viem";var j=O[M].pendle.marketFactory.address,q=O[M].pendle.router.address,J=600,Q=/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/,X=/^(usd.*|dai|w?eth|oak)$/i,ee=t=>X.test(t.replace(/[._-]/g,"")),te=/^PT-(.+)-\d{1,2}[A-Za-z]{3}\d{4}$/,s=t=>{throw new A(`${t} Oak won't use this market.`)},r=()=>s("Oak couldn't read this Pendle market from the chain.");function S(t){return typeof t!="number"||!Number.isInteger(t)||t<0||t>36?s("A token in this market reports unusual decimals."):t}function $(t){return!Array.isArray(t)||t.some(e=>typeof e!="string"||!W(e,{strict:!1}))?r():[...new Set(t.map(e=>U(e)))]}async function B(t,e,c={}){let g=c.now??Math.floor(Date.now()/1e3),[u,o,a,f,l,E,D,P,x,I,v]=await N(t,[{address:j,abi:F,functionName:"isValidMarket",args:[e.market]},{address:e.market,abi:y,functionName:"readTokens"},{address:e.market,abi:y,functionName:"expiry"},{address:e.market,abi:y,functionName:"isExpired"},{address:e.market,abi:y,functionName:"readState",args:[q]},{address:e.sy,abi:b,functionName:"getTokensIn"},{address:e.sy,abi:b,functionName:"getTokensOut"},{address:e.sy,abi:b,functionName:"decimals"},{address:e.sy,abi:b,functionName:"exchangeRate"},{address:e.pt,abi:h,functionName:"decimals"},{address:e.pt,abi:h,functionName:"symbol"}]);if(!u.ok)return r();if(u.value!==!0)return s("This isn't a market the Pendle factory created.");if(!o.ok||!Array.isArray(o.value)||o.value.length!==3)return r();let[z,Y,Z]=o.value;if(!p(z,e.sy)||!p(Y,e.pt)||!p(Z,e.yt))return s("The market's tokens don't match what Pendle's service listed.");if(!a.ok||typeof a.value!="bigint"||!f.ok||typeof f.value!="boolean")return r();if(a.value!==BigInt(e.expiry))return s("The market's end date doesn't match what Pendle's service listed.");let T=f.value;if(T!==g>=e.expiry&&Math.abs(g-e.expiry)>J)return s("The chain and Oak's clock disagree about whether this market has ended.");if(!l.ok||typeof l.value?.lastLnImpliedRate!="bigint"||!P.ok||!I.ok||!x.ok||typeof x.value!="bigint"||!v.ok||typeof v.value!="string"||!E.ok||!D.ok)return r();let i=$(E.value),V=$(D.value);if(i.length===0||V.length===0)return s("This market lists no token to put in or take out.");let H=S(P.value),G=S(I.value),R=i.find(n=>p(n,_)),L=await N(t,i.flatMap(n=>[{address:n,abi:h,functionName:"symbol"},{address:n,abi:h,functionName:"decimals"}])),w=new Map(i.map((n,k)=>[n,{symbol:L[k*2],decimals:L[k*2+1]}])),m;if(R)m=R;else if(i.length===1)m=i[0];else{let n=te.exec(v.value)?.[1],k=i.filter(K=>{let C=w.get(K).symbol;return C.ok&&C.value===n});k.length===1&&(m=k[0])}if(!m)return s("Oak can't tell which token this market takes as input.");let d=w.get(m);return!d.symbol.ok||typeof d.symbol.value!="string"||!d.decimals.ok?r():!Q.test(d.symbol.value)||!R&&ee(d.symbol.value)?s("The market's token name looks unusual."):{verified:{market:e.market,sy:e.sy,pt:e.pt,yt:e.yt,expiry:e.expiry,expired:T,kind:R?"stable":"stock",inputToken:m,inputSymbol:d.symbol.value,inputDecimals:S(d.decimals.value),ptDecimals:G,syDecimals:H,tokensIn:i,tokensOut:V},ptSymbol:v.value,lnImpliedRate:l.value.lastLnImpliedRate,syExchangeRate:x.value}}async function oe(t,e,c={}){return(await B(t,e,c)).verified}async function de(t,e,c={}){let g=await Promise.allSettled(e.map(a=>B(t,a,c))),u=[],o=[];return g.forEach((a,f)=>{let l=e[f];a.status==="fulfilled"?u.push({row:l,facts:a.value}):o.push(`${l.market}: ${a.reason instanceof A?a.reason.message:"Oak couldn't check this market."}`)}),{ok:u,dropped:o}}export{B as a,oe as b,de as c};
@@ -0,0 +1 @@
1
+ import{c as k,i as S,l as O,m as R,n as $}from"./5KUWLUPM.js";import{a as f,i as P}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{encodeFunctionData as x,erc20Abi as E,parseAbi as U,zeroAddress as j}from"viem";var g=P[f].merkl.distributor.address,H=["function accessControlManager() view returns (address)","function isGovernor(address) view returns (bool)","function isGovernorOrGuardian(address) view returns (bool)","function canUpdateMerkleRoot(address) view returns (uint256)","function mainOperators(address,address) view returns (uint256)","function disputeToken() view returns (address)","function disputeAmount() view returns (uint256)","function disputer() view returns (address)","function endOfDisputePeriod() view returns (uint48)","function getMerkleRoot() view returns (bytes32)","function getEpochDuration() view returns (uint32)","function disputePeriod() view returns (uint48)","function upgradeabilityDeactivated() view returns (uint256)","function disputeTree(string)","function updateTree((bytes32 merkleRoot,bytes32 ipfsHash))","function toggleTrusted(address)","function toggleMainOperatorStatus(address,address)","function revokeUpgradeability()","function setEpochDuration(uint32)","function resolveDispute(bool)","function revokeTree()","function recoverERC20(address,address,uint256)","function setDisputePeriod(uint48)","function setDisputeToken(address)","function setDisputeAmount(uint256)"],y=U(H),F={type:"string",pattern:"^\\d+$"},C={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},G="Provide a valid address.";function m(o,l=!1){let n=S(o,G);return l?n:O(n,G)}function _(o,l=256){return $(o,`Value exceeds uint${l}.`,{bits:l})}function b(o){return R(o,"Merkl returned invalid protocol state.")}function I(o){return typeof o=="number"&&Number.isSafeInteger(o)&&o>=0?String(o):b(o).toString()}var D={updateTree:["merkleRoot","ipfsHash"],toggleTrusted:["target","enabled"],toggleMainOperatorStatus:["target","token","enabled"],revokeUpgradeability:[],setEpochDuration:["amount"],resolveDispute:["valid"],revokeTree:[],recoverERC20:["token","recipient","amount"],setDisputePeriod:["amount"],setDisputeToken:["token"],setDisputeAmount:["amount"]},K=o=>{let l=()=>o.clientFor(f),n=(r,i=[],e=g)=>l().readContract({address:e,abi:y,functionName:r,args:i}),h=(r,i,e,p)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:i,required:e,additionalProperties:!1},execute:async(u,s)=>{try{let a=Object.keys(u).find(d=>!Object.hasOwn(i,d));if(a)throw new c(`Unsupported Merkl input: ${a}.`);return await p(u,m(s))}catch(a){throw new c(o.plainError(a))}}}),z=async(r,i,e,p)=>{let u=[o.unsignedTx({to:g,data:x({abi:y,functionName:r,args:i}),value:"0",chainId:f,description:e})],s=await o.preview(u,p);return{txs:u,preview:s,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${e} ${s.summary}`}};return{tools:[h("distributor_status",{},[],async(r,i)=>{let[e,p,u,s,a,d,t,w,N]=await Promise.all([n("getMerkleRoot"),n("disputeToken"),n("disputeAmount"),n("disputer"),n("endOfDisputePeriod"),n("getEpochDuration"),n("disputePeriod"),n("upgradeabilityDeactivated"),n("accessControlManager")]);if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e)||typeof d!="number"||!Number.isInteger(d)||d<0||d>4294967295)throw new c("Merkl returned invalid Distributor state.");let v=m(N),[M,T]=await Promise.all([n("isGovernor",[i],v),n("isGovernorOrGuardian",[i],v)]);if(typeof M!="boolean"||typeof T!="boolean")throw new c("Merkl returned invalid governance roles.");return{chainId:f,distributor:g,root:e,disputeToken:m(p,!0),disputeAmount:b(u).toString(),disputer:m(s,!0),endOfDisputePeriod:I(a),epochDuration:String(d),disputePeriod:I(t),upgradeabilityDeactivated:b(w).toString(),accessControlManager:v,governor:M,governorOrGuardian:T,summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Dispute amounts are token base units. Opening a dispute locks collateral until governor resolution; a rejected dispute forfeits it."}}),h("dispute",{reason:{type:"string",minLength:1,maxLength:2e3}},["reason"],async(r,i)=>{if(typeof r.reason!="string"||!r.reason.trim()||r.reason.length>2e3)throw new c("Provide a public dispute reason of 1 to 2000 characters.");let e=m(await n("disputeToken")),p=b(await n("disputeAmount")),[u,s]=await Promise.all([l().readContract({address:e,abi:E,functionName:"symbol"}),l().readContract({address:e,abi:E,functionName:"decimals"})]);if(typeof u!="string"||!u.trim()||typeof s!="number"||!Number.isInteger(s)||s<0||s>255)throw new c("Merkl dispute token metadata is invalid.");let a=`Dispute Merkl's tree: ${r.reason}. Lock ${p} ${A(u)} base units (token ${e}, decimals ${s}) until governor resolution; rejection forfeits the deposit. There is no unilateral withdrawal.`,d=[...p?[o.approval(e,g,p.toString(),f)]:[],o.unsignedTx({to:g,data:x({abi:y,functionName:"disputeTree",args:[r.reason]}),value:"0",chainId:f,description:a})],t=await o.preview(d,i);return{txs:d,preview:t,deposit:{token:{address:e,symbol:u,decimals:s,chainId:f},amount:p.toString()},summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${a} ${t.summary}`}}),h("distributor_admin",{operation:{enum:Object.keys(D)},target:k,token:k,recipient:k,amount:F,enabled:{type:"boolean"},valid:{type:"boolean"},merkleRoot:C,ipfsHash:C},["operation"],async(r,i)=>{let e=String(r.operation);if(!Object.hasOwn(D,e))throw new c("Choose a supported Distributor operation.");let p=D[e];for(let t of Object.keys(r))if(t!=="operation"&&!p.includes(t))throw new c(`Input ${t} does not match this Distributor operation.`);let u=m(await n("accessControlManager")),s=await n("isGovernor",[i],u);if(typeof s!="boolean")throw new c("Merkl returned invalid governor status.");if(!s&&!(e==="updateTree"?await n("canUpdateMerkleRoot",[i])===1n:e==="toggleMainOperatorStatus"&&r.token!==j?await n("isGovernorOrGuardian",[i],u)===!0:!1))throw new c("The connected wallet lacks the required Merkl governance role.");let a=p.map(t=>{if(t==="enabled"||t==="valid"){if(typeof r[t]!="boolean")throw new c(`Provide ${t} as boolean.`);return r[t]}if(t==="amount"){let w=_(r[t],e==="setEpochDuration"?32:e==="setDisputePeriod"?48:256);return e==="setEpochDuration"?Number(w):w}if(t==="merkleRoot"||t==="ipfsHash"){if(typeof r[t]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r[t]))throw new c("Provide a bytes32 root and IPFS hash.");return r[t]}return m(r[t],t==="token"&&e==="toggleMainOperatorStatus")}),d=a;if(e==="updateTree"&&(d=[{merkleRoot:a[0],ipfsHash:a[1]}]),e==="toggleTrusted"||e==="toggleMainOperatorStatus"){let t=await n(e==="toggleTrusted"?"canUpdateMerkleRoot":"mainOperators",e==="toggleTrusted"?[a[0]]:a.slice(0,2));if(t!==0n&&t!==1n)throw new c("Merkl returned invalid authorization state.");if(t===1n===r.enabled)return{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Authorization already has the requested state."};d=a.slice(0,-1)}return z(e,d,`Merkl Distributor ${e} ${JSON.stringify(r)}. Governance affects every claimant. Upgradeability revocation is permanent; dispute resolution returns or forfeits collateral. Authorization operations toggle the observed state; re-preview if state changes.`,i)})]}};export{K as a};
@@ -0,0 +1 @@
1
+ import{d as l,e as N,f as T}from"./2ZUP7ZEV.js";import{a as D}from"./Y7RPSDD2.js";import{a as w,c as n,d as u,e as y,g as b}from"./2MZXTOZU.js";import{a as U}from"./PBQSJSZO.js";import{b as A}from"./5ZLOCQA4.js";import{h as S,n as x}from"./5KUWLUPM.js";import{a as p}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as L}from"viem";function G(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new o("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new o("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=G(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new o("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new o("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new o("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:n,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new o("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new o("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new o("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(n,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new o("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new o("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),$=t?L({abi:b,functionName:"withdraw",args:[n.address,m==="max"?y:a,d]}):L({abi:b,functionName:"supply",args:[n.address,a,d,0]}),B=[...t?[]:[e.approval(n.address,w,a.toString(),p)],e.unsignedTx({to:w,data:$,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,n)<a:k(h,n)!==-a||k(h,u)<a-1n)throw new o("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(n,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new o(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A("Positive USDG amount in decimal base units (6 decimals).")},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"USDG decimal base units (6 decimals), or max for the full balance."}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
@@ -1 +1 @@
1
- import{K as O}from"./L3ZM77SJ.js";import{a as d}from"./NAYRD43N.js";import{a as v}from"./6IM6A5VA.js";import{a as A}from"./UWOFA6GV.js";import{d as k,i as T}from"./73N3TOJL.js";import{a as p}from"./G6HCV67X.js";import{a as r}from"./5YS5V2LK.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as C,getAddress as l,parseAbi as E,zeroAddress as N}from"viem";var w=E(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),P=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(u){return T(u,"Provide an explicit checksummed address.",k)}var S=u=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(v(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(u.plainError(a))}}});async function b(){let n=u.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string"}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:d,abi:w,functionName:s})));return{chainId:p,contract:d,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:d,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:P},value:A(),account:{type:"string"},enabled:{type:"boolean"},tokens:{type:"array",maxItems:32,items:{type:"string"}},permissions:{type:"array",maxItems:32,items:{type:"boolean"}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!P.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:d,abi:w,functionName:"owner"});if(l(o)!==l(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=O(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(f=>typeof f!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===N)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${d}, values ${JSON.stringify(t,(o,f)=>typeof f=="bigint"?String(f):f)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[u.unsignedTx({to:d,data:C({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await u.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await u.http(`https://longbow.credit/api/referral/stats/${l(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==l(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:l(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:g("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};
1
+ import{a as d}from"./6FTYNYGF.js";import{K as O}from"./IQIWASRD.js";import{a as v}from"./PBQSJSZO.js";import{a as A}from"./5ZLOCQA4.js";import{d as k,i as T}from"./5KUWLUPM.js";import{a as p}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as C,getAddress as l,parseAbi as E,zeroAddress as N}from"viem";var w=E(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),P=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(u){return T(u,"Provide an explicit checksummed address.",k)}var S=u=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(v(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(u.plainError(a))}}});async function b(){let n=u.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string"}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:d,abi:w,functionName:s})));return{chainId:p,contract:d,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:d,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:P},value:A(),account:{type:"string"},enabled:{type:"boolean"},tokens:{type:"array",maxItems:32,items:{type:"string"}},permissions:{type:"array",maxItems:32,items:{type:"boolean"}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!P.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:d,abi:w,functionName:"owner"});if(l(o)!==l(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=O(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(f=>typeof f!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===N)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${d}, values ${JSON.stringify(t,(o,f)=>typeof f=="bigint"?String(f):f)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[u.unsignedTx({to:d,data:C({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await u.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await u.http(`https://longbow.credit/api/referral/stats/${l(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==l(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:l(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:g("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};
@@ -0,0 +1 @@
1
+ import{b as U,c as G}from"./JZXYLHI7.js";import{L as K}from"./IQIWASRD.js";import{a as N}from"./SSIENQVU.js";import{c as P}from"./W2OJ57ZO.js";import{c as R,f as L,g as H,h as W,i as z}from"./IKEJCBYU.js";import{a as F}from"./PBQSJSZO.js";import{a as u}from"./5ZLOCQA4.js";import{g as I}from"./5KUWLUPM.js";import{a as _}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as S,erc20Abi as j,getAddress as T,parseAbi as k}from"viem";var w=k(["function asset() view returns (address)","function decimals() view returns (uint8)","function balanceOf(address) view returns (uint256)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256)"]);function q(t,s=!1){if(typeof t!="string"||!/^\d+$/.test(t)||t.length>78||BigInt(t)>=1n<<256n||!s&&BigInt(t)===0n)throw new o("Provide a positive uint256 decimal base-unit string.");return BigInt(t)}function le(t,s,v){return["details","analytics","manage","mint",s==="netnet"?"redeem":"withdraw_assets","force_exit","in_kind_exit"].map(e=>{let $=[...s==="longbow"?["vault"]:[],...e==="mint"?["shares","maxAssets"]:e==="redeem"?["shares"]:e==="withdraw_assets"?["amount"]:e==="force_exit"?["maxPenaltyAssets","minAmountOut"]:[]],m={...s==="longbow"?{vault:{type:"string",enum:v.map(i=>i.vault)}}:{}};e==="in_kind_exit"&&(Object.assign(m,{amount:u(),maxShares:u(),maxPenaltyAssets:u(),deadline:u()}),$.push("amount","maxShares","maxPenaltyAssets","deadline")),e==="mint"&&Object.assign(m,{shares:u(),maxAssets:u()}),e==="redeem"&&(m.shares=u()),e==="withdraw_assets"&&(m.amount=u()),e==="force_exit"&&Object.assign(m,{maxPenaltyAssets:u(),minAmountOut:u()});let J=P(t,`${s}_manage`,v[0].vault,v[0].asset),E=N(t,`${s}_analytics`,v[0].vault);if(e==="manage"||e==="analytics"){let i=e==="manage"?J.inputSchema:E.inputSchema;Object.assign(m,i.properties),e==="analytics"&&s==="longbow"&&(m.view={type:"string",enum:["apy","published_apy"]}),$.push(...i.required)}return{name:`${s}_${e}`,inputSchema:{type:"object",properties:m,required:$,additionalProperties:!1,...e==="analytics"&&s==="netnet"?{allOf:E.inputSchema.allOf}:{}},execute:async(i,r)=>{try{if(F(r),Object.keys(i).some(l=>!Object.hasOwn(m,l)))throw new o("Unsupported vault feature argument.");let A=s==="netnet"?v[0]:v.find(l=>typeof i.vault=="string"&&I(l.vault,i.vault));if(!A)throw new o("Choose a current vault returned by the project list tool.");let{vault:n,asset:a}=A,b={...i};if(delete b.vault,e==="details")return H(t,`${s}_details`,n,a).execute(b,r);if(e==="manage")return P(t,`${s}_manage`,n,a).execute(b,r);if(e==="analytics"){if(s==="longbow"&&i.view==="published_apy")return G(t,n,a,b);if(s==="longbow"&&i.view==="apy")return U(t,n,a,b);if(s==="longbow")throw new o("Choose apy or published_apy; the Longbow vault is not indexed by Morpho for other analytics views.");return{...await N(t,`${s}_analytics`,n).execute(b,r),asset:{...a,address:T(a.address)}}}if(e==="in_kind_exit")return K(t,n,a,i,r);let f=t.clientFor(_);if(await f.getChainId()!==_)throw new o("Vault actions require chain 4663.");let[Q,X,Y]=await Promise.all([f.readContract({address:n,abi:w,functionName:"asset"}),f.readContract({address:n,abi:w,functionName:"decimals"}),f.readContract({address:a.address,abi:j,functionName:"decimals"})]);if(T(Q)!==T(a.address)||X!==18||Y!==a.decimals)throw new o("Vault metadata does not match the pinned asset and shares.");let M=e==="force_exit"?await f.readContract({address:n,abi:w,functionName:"balanceOf",args:[r]}):void 0;if(e==="force_exit"){let l=await L(t,f,n,r,M,R(i.maxPenaltyAssets),a),C=q(i.minAmountOut),p=[l.tx],y=await t.preview(p,r);return z(y.changes,n,M,C,a),{txs:p,preview:y,summary:`${W(l.plan,a.symbol)} ${y.summary}`}}let d=e==="mint",g=e==="redeem",c=q(d||g?i.shares:i.amount),x=await f.readContract({address:n,abi:w,functionName:d?"previewMint":g?"previewRedeem":"previewWithdraw",args:[c]});if(x<=0n||d&&x>q(i.maxAssets))throw new o("Vault quote is zero or exceeds maxAssets.");let V=d?void 0:await f.readContract({address:n,abi:w,functionName:"balanceOf",args:[r]});if(!d&&(g?c:x)>V)throw new o("The wallet share balance cannot cover this exit.");let Z=d?S({abi:w,functionName:"mint",args:[c,r]}):g?S({abi:w,functionName:"redeem",args:[c,r,r]}):S({abi:w,functionName:"withdraw",args:[c,r,r]}),B=`${e} ${c} ${d||g?"18-decimal share":`${a.decimals}-decimal ${a.symbol}`} base units on ${n}; beneficiary ${r}.`,D=[...d?[t.approval(a.address,n,x.toString(),_)]:[],t.unsignedTx({to:n,data:Z,value:"0",chainId:_,description:B})],O=await t.preview(D,r),h=(l,C)=>O.changes.filter(p=>p.token.chainId===_&&I(p.token.address,l)).reduce((p,y)=>{if(y.token.decimals!==C||!/^-?\d+$/.test(y.amount))throw new o("Invalid vault preview metadata.");return p+BigInt(y.amount)},0n);if(d?h(a.address,a.decimals)!==-x||h(n,18)!==c:g?h(n,18)!==-c||h(a.address,a.decimals)<=0n:h(a.address,a.decimals)!==c||-h(n,18)<=0n||-h(n,18)>V)throw new o("Vault preview does not match the requested amount and beneficiary.");return{txs:D,preview:O,summary:`${B} Counterpart quote ${x} base units. Mint approval is exact; accrual may require a fresh quote. Standard ERC-4626 calls encode no minimum receipt. ${O.summary}`}}catch(A){throw new o(t.plainError(A))}}}})}export{le as a};
@@ -0,0 +1 @@
1
+ import{c as X}from"./42DQTKEO.js";import{b as Y}from"./57JFKIMK.js";import{b as z}from"./3WXK2FUA.js";import{a as ee}from"./VV2HEIFI.js";import{b as Q}from"./K22EXPWN.js";import{a as K,b as R,c as S,d as $,g as q,h as I,k as E,l as v,n as V,p as W,r as J,s as U,t as O,v as D,x as G,y as Z}from"./WWHCEMNB.js";import{a as h}from"./X5V2Z2NM.js";import{b as B}from"./Z4SRGAVL.js";import{a as N}from"./PBQSJSZO.js";import{c as j,e as k,g as w}from"./5KUWLUPM.js";import{a as c,d as L}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{Buffer as te}from"node:buffer";import{decodeEventLog as ne,encodeFunctionData as P,getAddress as se,hexToString as de,parseAbiItem as ce,toEventSelector as re}from"viem";var $e={register:"erc8004_register"},ie="https://eips.ethereum.org/EIPS/eip-8004#registration-v1",ge={type:"object",required:["type","name","description","image","services","x402Support","active","registrations"],properties:{type:{const:ie},name:{type:"string",minLength:1},description:{type:"string"},image:{type:"string"},services:{type:"array",items:{type:"object",required:["name","endpoint"]}},x402Support:{type:"boolean"},active:{type:"boolean"},registrations:{type:"array"},tags:{type:"array",items:{type:"string"}},supportedTrust:{type:"array",items:{type:"string"}}}};function F(e,t,a=!1){if(typeof e!="string"||!a&&!e.trim())throw new c(`Provide a valid profile ${t}.`)}function fe(e,t){F(e,t);try{let a=new URL(e);if(!["https:","ipfs:"].includes(a.protocol)||!a.hostname||a.username||a.password)throw new Error}catch{throw new c(`Profile ${t} must be an HTTPS or IPFS URI without credentials.`)}}function ue(e,t,a,n){let{registryId:d}=I(e);if(!k(t))throw new c("Provide a registration-v1 profile object.");if(a!==void 0&&typeof a!="boolean")throw new c("The tag option must be a boolean.");if(t.type!==ie)throw new c("Use the ERC-8004 registration-v1 profile type.");if(F(t.name,"name"),F(t.description,"description",!0),fe(t.image,"image"),typeof t.active!="boolean"||typeof t.x402Support!="boolean")throw new c("Profile active and x402Support must be booleans.");if(!Array.isArray(t.services)||!Array.isArray(t.registrations))throw new c("Profile services and registrations must be arrays.");for(let r of t.services)z(r);for(let r of["tags","supportedTrust"])if(t[r]!==void 0&&(!Array.isArray(t[r])||!t[r].every(g=>typeof g=="string"&&g.trim())))throw new c(`Profile ${r} must be an array of nonempty strings.`);let s=t.registrations.map(r=>{if(!k(r)||typeof r.agentRegistry!="string"||!/^eip155:[1-9][0-9]*:0x[0-9a-fA-F]{40}$/.test(r.agentRegistry))throw new c("Provide a valid agentRegistry for every registration.");let g=typeof r.agentId=="number"&&Number.isSafeInteger(r.agentId)?String(r.agentId):r.agentId,p=v(g);if(w(r.agentRegistry,d)){if(n===void 0)throw new c("Do not predict a registration ID; obtain it from the mined Registered receipt.");if(p!==n)throw new c("Profile registration ID does not match the agent being updated.")}return{...r}});n!==void 0&&!s.some(r=>w(r.agentRegistry,d))&&s.push({agentId:n.toString(),agentRegistry:d});let i=[...new Set((t.tags??[]).filter(r=>r!==R))];a!==!1&&i.push(R);let f={...t,registrations:s,...i.length?{tags:i}:{}};i.length||delete f.tags;let o;try{if(o=JSON.stringify(f),te.byteLength(o)>65536)throw new Error;JSON.parse(o)}catch{throw new c("Profile must be JSON data no larger than 64 KiB.")}return`data:application/json;base64,${te.from(o,"utf8").toString("base64")}`}async function x(e,t){try{let{chainId:a,registry:n}=I(e),d=v(t),s=e.clientFor(a),i=await s.readContract({address:n,abi:h,functionName:"ownerOf",args:[d]}).catch(g=>{throw L(g)?new c(`Agent ${d} does not exist in this ERC-8004 registry: the owner lookup reverted. Check the agent ID.`):g});N(i);let[f,o,r]=await Promise.all([s.readContract({address:n,abi:h,functionName:"tokenURI",args:[d]}),s.readContract({address:n,abi:h,functionName:"getAgentWallet",args:[d]}),s.readContract({address:n,abi:h,functionName:"getMetadata",args:[d,R]})]);if(N(o),typeof f!="string"||typeof r!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(r))throw new c("The registry returned invalid identity data.");return{agentId:d.toString(),chainId:a,registry:n,owner:i,uri:f,agentWallet:o,registrarMetadata:r,registryValidated:!1,summary:K}}catch(a){throw new c(e.plainError(a))}}async function Ee(e,t){let a=await x(e,t);return{...a,uri:A(a.uri)}}async function le(e,t,a,n,d,s){let{registry:i}=I(e),f=await D(e,t,a,d),o=s===void 0?"Registered":"URIUpdated",r=re(s===void 0?"Registered(uint256,string,address)":"URIUpdated(uint256,string,address)"),g=f.logs.filter(T=>w(T.address,i)&&T.topics[0]===r&&!T.removed);if(g.length!==1)throw new c(`The receipt must contain one matching ${o} event.`);let p=g[0],u=ne({abi:h,eventName:o,topics:p.topics,data:p.data,strict:!0}),b=u.args.agentId,l=u.eventName==="Registered"?u.args.agentURI:u.args.newURI,y=u.eventName==="Registered"?u.args.owner:u.args.updatedBy;if(s!==void 0&&b!==s||l!==n||!w(y,a))throw new c("The registry event does not match the expected agent, URI and wallet.");let m=await x(e,b.toString());if(m.uri!==n||s===void 0&&!w(m.owner,a))throw new c("The current agent owner or URI does not match the confirmed operation.");return m}function H(e,t){let{chainId:a,registry:n}=I(e);return e.unsignedTx({to:n,chainId:a,value:"0",data:P({abi:h,functionName:"setMetadata",args:[t,R,S]}),description:`Set mutable oak.registrar metadata to oak for agent ${t}.`})}async function pe(e,t,a,n){let{registry:d}=I(e),s=v(n.agentId),i=await D(e,t,a,H(e,s).data),f=re("MetadataSet(uint256,string,string,bytes)"),o=i.logs.filter(u=>w(u.address,d)&&u.topics[0]===f&&!u.removed);if(o.length!==1)throw new c("The receipt must contain one matching MetadataSet event.");let r=o[0],{args:g}=ne({abi:h,eventName:"MetadataSet",topics:r.topics,data:r.data,strict:!0});if(g.agentId!==s||g.metadataKey!==R||g.metadataValue!==S)throw new c("The metadata event does not match this agent and registrar marker.");let p=await x(e,n.agentId);if(p.registrarMetadata!==S||p.uri!==n.uri||!w(p.owner,n.owner))throw new c("The current agent metadata, owner or URI does not match the confirmed operation.");return p}async function me(e,t){let{chainId:a,registry:n}=I(e),d=e.clientFor(a),s=await d.readContract({address:n,abi:h,functionName:"balanceOf",args:[t]});if(s===0n)return;if(typeof s!="bigint"||s<0n)throw new c("Registry balance is unavailable; registration was not built.");let i=await d.getBlockNumber({cacheTime:0}),f=new Set;for(;;){let o=i>9999999n?i-9999999n:0n,r=await d.getLogs({address:n,event:ce("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:t},fromBlock:o,toBlock:i,strict:!0});for(let g of r){let p=g.args.tokenId.toString();if(g.removed||f.has(p))continue;f.add(p);let u=await x(e,p);if(w(u.owner,t))return u}if(o===0n)throw new c("Owned identity could not be located; registration was not built. Run oak setup link <agentId>.");i=o-1n}}function he(e){if(e===void 0)return[];if(!Array.isArray(e)||e.length>16)throw new c("Provide at most 16 metadata entries as { key, value } with value as 0x hex or text.");let t=new Set;return e.map(a=>{if(!k(a))throw new c("Provide each metadata entry as { key, value } or { key, text }.");let n=G(a.key);if(t.has(n))throw new c(`Metadata key ${A(n)} is repeated.`);return t.add(n),{metadataKey:n,metadataValue:Z(a)}})}function oe(e,t,a){let n=J(t);if(!n)return;let{registryId:d}=I(e);return Array.isArray(n.registrations)&&n.registrations.some(s=>k(s)&&typeof s.agentRegistry=="string"&&w(s.agentRegistry,d)&&String(s.agentId)===a.toString())}function ye(e,t,a){let n=oe(e,t.uri,BigInt(t.agentId));return n===!0?{...t,profileComplete:!0}:{...t,profileComplete:n===void 0?null:!1,nextStep:{tool:"erc8004_update",arguments:{agentId:t.agentId,profile:a??"a registration-v1 profile object"},why:"The minted profile does not list its own registry and agent ID yet (registrations is empty). erc8004_update appends it automatically. It is a normal action: it needs a verified identity link and an active subscription, so link with oak_setup first."}}}async function ae(e,t,a,n){let{chainId:d,registry:s}=I(e);N(n),V(e,a.chainId);let i=t?v(a.agentId):void 0,f=!t&&a.profile===void 0,o=f?"":ue(e,a.profile,a.tag,i),r=t?[]:he(a.metadata);if(f&&r.length)throw new c("Metadata entries are registered together with a profile; provide a profile, or set metadata afterwards with erc8004_set_metadata.");let g=a.tag!==!1;if(a.metadataTransactionHash!==void 0&&(!g||a.transactionHash===void 0))throw new c("A metadata transaction hash requires tagging and the profile transaction hash.");let p=i!==void 0?P({abi:h,functionName:"setAgentURI",args:[i,o]}):r.length?P({abi:h,functionName:"register",args:[o,r]}):f?P({abi:h,functionName:"register"}):P({abi:h,functionName:"register",args:[o]}),u=l=>i===void 0?ye(e,l,a.profile):l;if(a.transactionHash!==void 0){let l=await le(e,a.transactionHash,n,o,p,i);if(!g)return u(l);if(a.metadataTransactionHash!==void 0)return u(await pe(e,a.metadataTransactionHash,n,l));let y=v(l.agentId);await O(e,y,n);let m=await U(e,[H(e,y)],n,`Profile transaction confirmed for agent ${y}; onchain registrar metadata is pending. Submit this metadata transaction locally if not already submitted, then repeat the original arguments with transactionHash and metadataTransactionHash to verify both calls.`);return{...l,...m}}if(!t){let l=await me(e,n);if(l){let y={...l,registrationResumed:!0};if(!g||l.registrarMetadata===S)return u(y);let m=await U(e,[H(e,v(l.agentId))],n,`Resume registrar metadata for owned agent ${l.agentId}; no new identity will be minted.`);return{...y,...m}}}i!==void 0&&await O(e,i,n);let b=[e.unsignedTx({to:s,data:p,value:"0",chainId:d,description:i===void 0?"Register an ERC-8004 agent profile.":`Update ERC-8004 agent ${i} profile.`})];return i!==void 0&&g&&b.push(H(e,i)),U(e,b,n,`Submit locally, then repeat the original arguments with transactionHash to verify the profile receipt and URI.${g?i===void 0?" The mined Registered event supplies the actual agent ID; confirmation then builds a separate setMetadata transaction for oak.registrar. Both transactions require network gas.":" Submit the profile and metadata transactions in order, then supply metadataTransactionHash as well to verify the onchain oak.registrar marker. Both transactions require network gas.":" No registrar metadata transaction is built; --no-tag does not clear existing onchain metadata."}${i===void 0?" Update the profile registrations with the mined ID afterward.":""}`)}async function we(e,t){let a=await x(e,t.agentId),{chainId:n,registry:d}=I(e),s=e.clientFor(n),i=BigInt(a.agentId),f=t.metadataKeys===void 0?[]:(()=>{if(!Array.isArray(t.metadataKeys)||t.metadataKeys.length>16)throw new c("Provide at most 16 metadata keys.");return t.metadataKeys.map(m=>W(m,"metadata key",128,!1))})(),o=t.operator===void 0?void 0:se(String(t.operator)),[r,g,...p]=await Promise.allSettled([s.readContract({address:d,abi:h,functionName:"getApproved",args:[i]}),o?s.readContract({address:d,abi:h,functionName:"isApprovedForAll",args:[a.owner,o]}):Promise.resolve(void 0),...f.map(m=>s.readContract({address:d,abi:h,functionName:"getMetadata",args:[i,m]}))]),u=m=>m.status==="fulfilled"?m.value:void 0,b=u(r),l=E(a.agentWallet)?"unset":w(a.agentWallet,a.owner)?"owner":"verified-other",y=oe(e,a.uri,i);return{...a,approved:typeof b=="string"&&E(b)?null:b??"unavailable",...o?{operator:o,operatorApproved:u(g)??"unavailable"}:{},walletState:l,walletNote:l==="unset"?"No verified payment wallet: it starts as the minting owner, and any NFT transfer or erc8004_unset_wallet clears it. Re-verify with erc8004_wallet_proof then erc8004_set_wallet.":l==="owner"?"The payment wallet is the current owner.":"The payment wallet was proven by a signature from that wallet and is not the owner.",profile:{selfRegistered:y??null,fetched:!1,note:y===void 0?"The URI is external or not decodable; Oak does not fetch it.":void 0},...f.length?{metadata:Object.fromEntries(f.map((m,T)=>{let _=u(p[T]),M=typeof _=="string"&&/^0x([0-9a-fA-F]{2})*$/.test(_)?_:void 0,C;if(M&&M!=="0x")try{C=A(de(M))}catch{C=void 0}return[A(m),{hex:M??"unavailable",...C?{text:C}:{}}]}))}:{}}}var Ie={type:"object",additionalProperties:!1,required:["key"],properties:{key:{type:"string",minLength:1,maxLength:128},value:q,text:{type:"string"}}},be=e=>{let t=(n,d,s)=>({name:n,inputSchema:d,execute:async(i,f)=>{try{let o=await s(i,f);return k(o)&&typeof o.uri=="string"?{...o,uri:A(o.uri)}:o}catch(o){throw new c(e.plainError(o))}}}),a=n=>({type:"object",additionalProperties:!1,required:n?["agentId","profile"]:[],properties:{profile:{...ge,description:n?void 0:"Omit for the standard blank register(): the profile is attached later with erc8004_update."},tag:{type:"boolean",default:!0,description:"Set false for --no-tag; removes the profile tag and skips setMetadata, leaving existing onchain metadata unchanged."},transactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"After local submission, verify exact calldata, event and URI; if tagged, build the metadata follow-up unless metadataTransactionHash is supplied."},metadataTransactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hash of the separate setMetadata transaction; supplied with transactionHash to complete tagged confirmation."},...n?{agentId:$}:{metadata:{type:"array",maxItems:16,items:Ie,description:"Optional extra onchain metadata written by register(agentURI, metadata[]). The key agentWallet is reserved."}}}});return{tools:[t("erc8004_register",a(!1),(n,d)=>ae(e,!1,n,d)),t("erc8004_update",a(!0),(n,d)=>ae(e,!0,n,d)),t("erc8004_identity",{type:"object",additionalProperties:!1,required:["agentId"],properties:{agentId:$,metadataKeys:{type:"array",maxItems:16,items:{type:"string",minLength:1,maxLength:128},description:"Also read these onchain metadata keys."},operator:{...j,description:"Also report whether this address is approved for all of the owner's agents."}}},n=>we(e,n))]}},Oe=e=>B("erc8004",[be(e),X(e),Y(e),ee(e),Q(e)]);export{$e as a,Ee as b,oe as c,be as d,Oe as e};
@@ -1 +1 @@
1
- import{a as $}from"./Z7RL4NGX.js";import{b as S,d as A,e as j,f as T,g as O,h as I,i as P,m as k,n as M,q as f,s as B}from"./53N7PNJH.js";import{a as w,e as _}from"./73N3TOJL.js";import{a as p}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";function U(u){return{...u,token:{...u.token,symbol:f(u.token.symbol)??"unknown"}}}var J=u=>{let R=B(u);async function z(n,i){let g=T(i),r=I(n.originChainId),e=I(n.destinationChainId);if(r!==p&&e!==p)throw new d(`A Relay quote must start or end on chain ${p}.`);let h=O(n.originCurrency??S),b=O(n.destinationCurrency??S),c=T(n.recipient??g),a=P(n.amount);if(a==="0")throw new d("Provide a positive bridge amount.");let t=n.tradeType??"EXACT_INPUT";if(!["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"].includes(String(t)))throw new d("Choose EXACT_INPUT, EXACT_OUTPUT or EXPECTED_OUTPUT.");let m={};for(let E of["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"]){let y=n[E];if(y!==void 0){if(!Array.isArray(y)||y.length>100||y.some(x=>typeof x!="string"||!/^[A-Za-z0-9._ -]{1,128}$/.test(x)))throw new d("Provide valid Relay swap source names.");m[E]=y}}let N=await R("/quote/v2",{user:g,recipient:c,originChainId:r,destinationChainId:e,originCurrency:h,destinationCurrency:b,amount:a,tradeType:t,...m}),o=A(N.details),l=U(k(o.currencyIn)),s=U(k(o.currencyOut)),C=P(A(o.currencyOut).minimumAmount);M(T(o.sender)===g&&T(o.recipient)===c&&l.token.chainId===r&&l.token.address===h&&(t==="EXACT_INPUT"?l.amount===a:s.amount===a)&&s.token.chainId===e&&s.token.address===b&&BigInt(C)<=BigInt(s.amount));let F=Object.fromEntries(Object.entries(A(N.fees)).map(([E,y])=>[E,U(k(y))])),v=typeof o.timeEstimate=="number"&&Number.isFinite(o.timeEstimate)&&o.timeEstimate>=0?o.timeEstimate:void 0,X=e===p,q=X?"relay_bridge_in":"relay_bridge_out",D=t==="EXACT_INPUT"&&Object.keys(m).length===0&&r!==e&&(!X||$(r)!==void 0);return{executable:!1,nextAction:D?q:void 0,originChainId:r,destinationChainId:e,recipient:c,tradeType:t,amountIn:l,amountOut:s,minAmountOut:{token:s.token,amount:C},fees:F,slippage:{source:"provider",minimumAmount:C},...v===void 0?{}:{timeEstimateSeconds:v},summary:`Read-only Relay estimate: ${l.amount} base units of ${l.token.symbol} (${l.token.decimals} decimals) on chain ${r} for about ${s.amount}, minimum ${C}, base units of ${s.token.symbol} (${s.token.decimals} decimals) on chain ${e} for ${c}. Slippage: selected by Relay; Oak sent no slippage setting. The returned minimum above is the quote floor. Relay fees are already deducted from the output; origin gas is separate. Nothing was built or signed, and this estimate cannot be executed. ${D?`To bridge, call ${q}; it fetches a fresh quote and shows its own preview for human confirmation.`:"This estimate shape has no matching Oak execution path. No action will preserve these trade type or routing options."}`}}async function Z(n){let i=n.chainId===void 0?void 0:I(n.chainId),r=j((await R("/chains")).chains).map(A).flatMap(e=>{if(typeof e.id!="number"||!Number.isSafeInteger(e.id)||e.id<=0)return[];if(i!==void 0&&e.id!==i)return[];let h=e.disabled===!1,b=_(e.currency)?e.currency:{},c={chainId:e.id,name:f(e.displayName,"name")??f(e.name,"name")??String(e.id),vmType:f(e.vmType),nativeCurrency:{symbol:f(b.symbol),decimals:typeof b.decimals=="number"?b.decimals:void 0},bridgeIn:e.id!==p&&h&&$(e.id)!==void 0,bridgeOut:e.id!==p&&h&&e.vmType==="evm"};if(i===void 0)return[c];let a=new Map;for(let t of[...Array.isArray(e.featuredTokens)?e.featuredTokens:[],...Array.isArray(e.erc20Currencies)?e.erc20Currencies:[]]){if(!_(t)||typeof t.address!="string"||!new RegExp(w).test(t.address)||typeof t.decimals!="number"||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)continue;let m=T(t.address);a.has(m)||a.set(m,{address:m,symbol:f(t.symbol)??"unknown",decimals:t.decimals,bridgeable:t.supportsBridging===!0})}return[{...c,currencies:[...a.values()]}]});if(i!==void 0&&!r.length)throw new d(`Relay does not list chain ${i}.`);return{chains:r,summary:`${r.length} Relay chain${r.length===1?"":"s"}. bridgeIn marks origins relay_bridge_in can build from; bridgeOut marks destinations relay_bridge_out can reach. Currency lists are Relay-reported display data; bridgeable false means Relay does not bridge that token. Confirm token addresses before bridging.`}}return{tools:[{name:"relay_quote",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","destinationChainId","amount"],properties:{originChainId:{type:"integer",minimum:1},destinationChainId:{type:"integer",minimum:1},originCurrency:{type:"string",pattern:w},destinationCurrency:{type:"string",pattern:w},amount:{type:"string",pattern:"^[1-9][0-9]*$"},recipient:{type:"string",pattern:w},tradeType:{type:"string",enum:["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"]},...Object.fromEntries(["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"].map(n=>[n,{type:"array",maxItems:100,items:{type:"string",pattern:"^[A-Za-z0-9._ -]{1,128}$"}}]))}},execute:async(n,i)=>{try{return await z(n,i)}catch(g){throw new d(u.plainError(g))}}},{name:"relay_chains",inputSchema:{type:"object",additionalProperties:!1,properties:{chainId:{type:"integer",minimum:1}}},execute:async n=>{try{return await Z(n)}catch(i){throw new d(u.plainError(i))}}}]}};export{J as a};
1
+ import{a as $}from"./O6L4BJP4.js";import{b as S,d as A,e as j,f as T,g as O,h as I,i as P,m as k,n as M,q as f,s as B}from"./6PY3IRDS.js";import{a as w,e as _}from"./5KUWLUPM.js";import{a as p}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";function U(u){return{...u,token:{...u.token,symbol:f(u.token.symbol)??"unknown"}}}var J=u=>{let R=B(u);async function z(n,i){let g=T(i),r=I(n.originChainId),e=I(n.destinationChainId);if(r!==p&&e!==p)throw new d(`A Relay quote must start or end on chain ${p}.`);let h=O(n.originCurrency??S),b=O(n.destinationCurrency??S),c=T(n.recipient??g),a=P(n.amount);if(a==="0")throw new d("Provide a positive bridge amount.");let t=n.tradeType??"EXACT_INPUT";if(!["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"].includes(String(t)))throw new d("Choose EXACT_INPUT, EXACT_OUTPUT or EXPECTED_OUTPUT.");let m={};for(let E of["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"]){let y=n[E];if(y!==void 0){if(!Array.isArray(y)||y.length>100||y.some(x=>typeof x!="string"||!/^[A-Za-z0-9._ -]{1,128}$/.test(x)))throw new d("Provide valid Relay swap source names.");m[E]=y}}let N=await R("/quote/v2",{user:g,recipient:c,originChainId:r,destinationChainId:e,originCurrency:h,destinationCurrency:b,amount:a,tradeType:t,...m}),o=A(N.details),l=U(k(o.currencyIn)),s=U(k(o.currencyOut)),C=P(A(o.currencyOut).minimumAmount);M(T(o.sender)===g&&T(o.recipient)===c&&l.token.chainId===r&&l.token.address===h&&(t==="EXACT_INPUT"?l.amount===a:s.amount===a)&&s.token.chainId===e&&s.token.address===b&&BigInt(C)<=BigInt(s.amount));let F=Object.fromEntries(Object.entries(A(N.fees)).map(([E,y])=>[E,U(k(y))])),v=typeof o.timeEstimate=="number"&&Number.isFinite(o.timeEstimate)&&o.timeEstimate>=0?o.timeEstimate:void 0,X=e===p,q=X?"relay_bridge_in":"relay_bridge_out",D=t==="EXACT_INPUT"&&Object.keys(m).length===0&&r!==e&&(!X||$(r)!==void 0);return{executable:!1,nextAction:D?q:void 0,originChainId:r,destinationChainId:e,recipient:c,tradeType:t,amountIn:l,amountOut:s,minAmountOut:{token:s.token,amount:C},fees:F,slippage:{source:"provider",minimumAmount:C},...v===void 0?{}:{timeEstimateSeconds:v},summary:`Read-only Relay estimate: ${l.amount} base units of ${l.token.symbol} (${l.token.decimals} decimals) on chain ${r} for about ${s.amount}, minimum ${C}, base units of ${s.token.symbol} (${s.token.decimals} decimals) on chain ${e} for ${c}. Slippage: selected by Relay; Oak sent no slippage setting. The returned minimum above is the quote floor. Relay fees are already deducted from the output; origin gas is separate. Nothing was built or signed, and this estimate cannot be executed. ${D?`To bridge, call ${q}; it fetches a fresh quote and shows its own preview for human confirmation.`:"This estimate shape has no matching Oak execution path. No action will preserve these trade type or routing options."}`}}async function Z(n){let i=n.chainId===void 0?void 0:I(n.chainId),r=j((await R("/chains")).chains).map(A).flatMap(e=>{if(typeof e.id!="number"||!Number.isSafeInteger(e.id)||e.id<=0)return[];if(i!==void 0&&e.id!==i)return[];let h=e.disabled===!1,b=_(e.currency)?e.currency:{},c={chainId:e.id,name:f(e.displayName,"name")??f(e.name,"name")??String(e.id),vmType:f(e.vmType),nativeCurrency:{symbol:f(b.symbol),decimals:typeof b.decimals=="number"?b.decimals:void 0},bridgeIn:e.id!==p&&h&&$(e.id)!==void 0,bridgeOut:e.id!==p&&h&&e.vmType==="evm"};if(i===void 0)return[c];let a=new Map;for(let t of[...Array.isArray(e.featuredTokens)?e.featuredTokens:[],...Array.isArray(e.erc20Currencies)?e.erc20Currencies:[]]){if(!_(t)||typeof t.address!="string"||!new RegExp(w).test(t.address)||typeof t.decimals!="number"||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)continue;let m=T(t.address);a.has(m)||a.set(m,{address:m,symbol:f(t.symbol)??"unknown",decimals:t.decimals,bridgeable:t.supportsBridging===!0})}return[{...c,currencies:[...a.values()]}]});if(i!==void 0&&!r.length)throw new d(`Relay does not list chain ${i}.`);return{chains:r,summary:`${r.length} Relay chain${r.length===1?"":"s"}. bridgeIn marks origins relay_bridge_in can build from; bridgeOut marks destinations relay_bridge_out can reach. Currency lists are Relay-reported display data; bridgeable false means Relay does not bridge that token. Confirm token addresses before bridging.`}}return{tools:[{name:"relay_quote",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","destinationChainId","amount"],properties:{originChainId:{type:"integer",minimum:1},destinationChainId:{type:"integer",minimum:1},originCurrency:{type:"string",pattern:w},destinationCurrency:{type:"string",pattern:w},amount:{type:"string",pattern:"^[1-9][0-9]*$"},recipient:{type:"string",pattern:w},tradeType:{type:"string",enum:["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"]},...Object.fromEntries(["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"].map(n=>[n,{type:"array",maxItems:100,items:{type:"string",pattern:"^[A-Za-z0-9._ -]{1,128}$"}}]))}},execute:async(n,i)=>{try{return await z(n,i)}catch(g){throw new d(u.plainError(g))}}},{name:"relay_chains",inputSchema:{type:"object",additionalProperties:!1,properties:{chainId:{type:"integer",minimum:1}}},execute:async n=>{try{return await Z(n)}catch(i){throw new d(u.plainError(i))}}}]}};export{J as a};
@@ -1 +1 @@
1
- import{c as v,d as N,e as h}from"./TMGWXDCZ.js";import{a as m}from"./UWOFA6GV.js";import{c as d,f as B,g as p,i as E}from"./73N3TOJL.js";import{a as H}from"./G6HCV67X.js";import{a as o}from"./5YS5V2LK.js";import{decodeEventLog as W,encodeFunctionData as G,getAddress as V,hashStruct as Y,isHex as J,parseAbi as Q,zeroAddress as k}from"viem";var Z="struct HookrSwapIntent { PoolKey key; bool zeroForOne; int128 amountSpecified; uint128 amountBound; uint160 sqrtPriceLimitX96; address recipient; address relayer; uint256 relayerFee; address engagement; uint256[] campaigns; uint256 nonce; uint256 deadline; }",I=Q(["struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }",Z,"function execute(HookrSwapIntent intent, address owner, bytes signature) returns (uint256 amountIn, uint256 amountOut)","function hashIntent(HookrSwapIntent intent) pure returns (bytes32)","function pullOf(HookrSwapIntent intent) view returns (address token, uint256 amount, bool feeFromInput)","function isNonceUsed(address owner, uint256 intentNonce) view returns (bool)","function router() view returns (address)","function registry() view returns (address)","function permit2() view returns (address)","event IntentExecuted(bytes32 indexed intentHash,address indexed owner,address indexed relayer,bytes32 poolId,uint256 amountIn,uint256 amountOut,uint256 relayerFee,bool feeFromInput)"]),ee={PoolKey:[{name:"currency0",type:"address"},{name:"currency1",type:"address"},{name:"fee",type:"uint24"},{name:"tickSpacing",type:"int24"},{name:"hooks",type:"address"}],HookrSwapIntent:[{name:"key",type:"PoolKey"},{name:"zeroForOne",type:"bool"},{name:"amountSpecified",type:"int128"},{name:"amountBound",type:"uint128"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"recipient",type:"address"},{name:"relayer",type:"address"},{name:"relayerFee",type:"uint256"},{name:"engagement",type:"address"},{name:"campaigns",type:"uint256[]"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},ne=V("0x000000000022D473030F116dDEE9F6B43aC78BA3"),F={key:{type:"object",properties:{currency0:d,currency1:d,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:d},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},zeroForOne:{type:"boolean"},amountSpecified:{type:"string",pattern:"^-?[0-9]+$"},amountBound:m(),sqrtPriceLimitX96:m(),recipient:d,relayer:d,relayerFee:m(),engagement:d,campaigns:{type:"array",items:m(),maxItems:8},nonce:m(),deadline:m()},x={owner:d,signature:{type:"string",pattern:"^0x[0-9a-fA-F]+$"},intent:{type:"object",properties:F,required:Object.keys(F),additionalProperties:!1}};function D(t){return B(t,"Provide a complete trader-signed Hookr intent.")}function y(t,i=256,e=!1){if(typeof t!="string"||!/^-?\d+$/.test(t)||t.length>79)throw new o("Hookr intent amounts, nonce and deadline must be decimal base-unit strings.");let n=BigInt(t);if(e?n<=-(1n<<BigInt(i-1))||n>=1n<<BigInt(i-1):n<0n||n>=1n<<BigInt(i))throw new o("Hookr intent integer is outside its ABI range.");return n}function l(t){return E(t,"Provide valid Hookr intent addresses.")}function j(t,i){if(Object.keys(t).some(s=>!Object.hasOwn(x,s)))throw new o("Provide only owner, intent and the trader signature for Hookr relay.");let e=D(t.intent);if(Object.keys(e).some(s=>!Object.hasOwn(F,s)))throw new o("Hookr intent contains an undocumented field.");let n=D(e.key);if(Object.keys(n).some(s=>!["currency0","currency1","fee","tickSpacing","hooks"].includes(s))||typeof n.fee!="number"||!Number.isInteger(n.fee)||n.fee<0||n.fee>16777215||typeof n.tickSpacing!="number"||!Number.isInteger(n.tickSpacing)||n.tickSpacing<=0||n.tickSpacing>8388607||typeof e.zeroForOne!="boolean")throw new o("Provide a valid canonical v4 pool key and direction.");let a={currency0:l(n.currency0),currency1:l(n.currency1),fee:n.fee,tickSpacing:n.tickSpacing,hooks:l(n.hooks)};if(BigInt(a.currency0)>=BigInt(a.currency1))throw new o("Hookr pool currencies must sort strictly by address.");let r=l(t.owner);if(r===k||p(r,i))throw new o("Hookr relay requires another trader as owner; the relayer funds gas only.");if(!Array.isArray(e.campaigns)||e.campaigns.length>8)throw new o("Provide at most eight Hookr campaign IDs.");let c={key:a,zeroForOne:e.zeroForOne,amountSpecified:y(e.amountSpecified,128,!0),amountBound:y(e.amountBound,128),sqrtPriceLimitX96:y(e.sqrtPriceLimitX96,160),recipient:l(e.recipient),relayer:l(e.relayer),relayerFee:y(e.relayerFee),engagement:l(e.engagement),campaigns:e.campaigns.map(s=>y(s)),nonce:y(e.nonce),deadline:y(e.deadline)};if(c.amountSpecified===0n||c.amountBound===0n)throw new o("Hookr intent input/output amounts and bound must be nonzero.");if([k,h,v].some(s=>p(s,c.recipient)))throw new o("Hookr intent recipient is reserved.");if(c.relayer!==k&&!p(c.relayer,i)||c.relayer===k&&c.relayerFee!==0n)throw new o("Hookr intent names a different relayer or an open relay with a fee.");if(c.engagement===k!=(c.campaigns.length===0))throw new o("Hookr engagement and campaigns must be supplied together.");let f=c.zeroForOne?a.currency0:a.currency1;if(f===k)throw new o("Hookr Permit2 relay cannot pull native ETH input.");if(typeof t.signature!="string"||!J(t.signature,{strict:!0})||t.signature.length<4||t.signature.length%2!==0||t.signature.length>16386)throw new o("Provide the trader-signed Permit2 witness signature, never a private key.");let S=t.signature,w=Y({data:c,primaryType:"HookrSwapIntent",types:ee});return{owner:r,intent:c,signature:S,input:f,intentHash:w}}function q(t,i){let{owner:e,intent:n,signature:a}=j(t,i);return{chainId:H,to:h,value:"0",data:G({abi:I,functionName:"execute",args:[n,e,a]}),description:`Relay Hookr trader ${e} to recipient ${n.recipient}; relayer fee ${n.relayerFee} in pool quote currency. Relayer pays gas; owner supplies Permit2 funds.`}}function ce(t,i,e){let n=q(i,e);if(t.length!==1||t[0].chainId!==n.chainId||!p(t[0].to,n.to)||t[0].value!=="0"||!p(t[0].data,n.data))throw new o("Hookr relay calldata differs from the locally requested signed intent.")}function ue(t){return[{name:"hookr_relay",inputSchema:{type:"object",description:"Preview a trader-signed Permit2 swap for local human-confirmed submission. Relayer pays gas; the trader supplies input. No signature is created by this tool.",properties:x,required:Object.keys(x),additionalProperties:!1},execute:async(i,e)=>{let n=j(i,e),{owner:a,intent:r,signature:c,input:f,intentHash:S}=n,w=t.clientFor(H),s=await w.getBlock();if(typeof s.number!="bigint"||typeof s.timestamp!="bigint"||s.timestamp<=0n||s.timestamp>r.deadline)throw new o("Hookr signed intent expired or the chain timestamp is unavailable.");let g=(X,M=[])=>w.readContract({address:h,abi:I,functionName:X,args:M,blockNumber:s.number}),[_,u,z,K,$,U]=await Promise.all([g("hashIntent",[r]),g("pullOf",[r]),g("isNonceUsed",[a,r.nonce]),g("router"),g("registry"),g("permit2")]);if(_!==S||z!==!1||K!==v||$!==N||U!==ne)throw new o("Hookr intent hash, nonce or forwarder deployment is invalid. Ask the trader for a fresh signed intent.");if(!Array.isArray(u)||u.length!==3||typeof u[0]!="string"||!p(u[0],f)||typeof u[1]!="bigint"||typeof u[2]!="boolean")throw new o("Hookr Permit2 pull could not be verified.");let b=u[2],P=r.amountSpecified<0n?-r.amountSpecified:r.amountBound;if(u[1]!==P+(b?r.relayerFee:0n)||r.amountSpecified>0n&&!b&&r.relayerFee>r.amountSpecified)throw new o("Hookr Permit2 pull or output-side fee differs from the signed terms.");let C=await w.simulateContract({address:h,abi:I,functionName:"execute",args:[r,a,c],account:e,blockNumber:s.number}),[A,R]=C.result,T=r.amountSpecified<0n?r.amountBound:r.amountSpecified-(b?0n:r.relayerFee);if(A>P||R<T)throw new o("Hookr relay simulation did not satisfy the signed input/output bounds.");let O=[t.unsignedTx(q(i,e))],L=await t.preview(O,e);return{txs:O,preview:L,summary:O[0].description,intentHash:S,owner:a,recipient:r.recipient,relayer:e,inputToken:f,maximumPull:u[1].toString(),feeToken:b?f:r.zeroForOne?r.key.currency1:r.key.currency0,relayerFee:r.relayerFee.toString(),feeFromInput:b,minimumOutput:T.toString(),simulatedAmountIn:A.toString(),simulatedAmountOut:R.toString(),note:"Verify IntentExecuted in the receipt and your fee balance after submission."}}},{name:"hookr_relay_receipt",inputSchema:{type:"object",description:"Read the executed intent and fee from a mined Hookr relay receipt.",properties:{transactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}},required:["transactionHash"],additionalProperties:!1},execute:async i=>{if(Object.keys(i).some(a=>a!=="transactionHash")||typeof i.transactionHash!="string"||!/^0x[0-9a-fA-F]{64}$/.test(i.transactionHash))throw new o("Provide a Hookr relay transactionHash.");let e=await t.clientFor(H).getTransactionReceipt({hash:i.transactionHash});if(e.status!=="success")throw new o("Hookr relay reverted. No fee is proven paid.");let n=e.logs.filter(a=>p(a.address,h)).flatMap(a=>{try{let r=W({abi:I,eventName:"IntentExecuted",topics:a.topics,data:a.data});return[{...r.args,amountIn:r.args.amountIn.toString(),amountOut:r.args.amountOut.toString(),relayerFee:r.args.relayerFee.toString()}]}catch{return[]}});if(!n.length)throw new o("Receipt contains no verified Hookr IntentExecuted event.");return{chainId:H,transactionHash:e.transactionHash,blockNumber:e.blockNumber.toString(),intents:n,note:"Event evidence at this mined block; check balances and finality."}}}]}export{I as a,j as b,q as c,ce as d,ue as e};
1
+ import{c as v,d as N,e as h}from"./5WUKOQIJ.js";import{a as m}from"./5ZLOCQA4.js";import{c as d,f as B,g as p,i as E}from"./5KUWLUPM.js";import{a as H}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{decodeEventLog as W,encodeFunctionData as G,getAddress as V,hashStruct as Y,isHex as J,parseAbi as Q,zeroAddress as k}from"viem";var Z="struct HookrSwapIntent { PoolKey key; bool zeroForOne; int128 amountSpecified; uint128 amountBound; uint160 sqrtPriceLimitX96; address recipient; address relayer; uint256 relayerFee; address engagement; uint256[] campaigns; uint256 nonce; uint256 deadline; }",I=Q(["struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }",Z,"function execute(HookrSwapIntent intent, address owner, bytes signature) returns (uint256 amountIn, uint256 amountOut)","function hashIntent(HookrSwapIntent intent) pure returns (bytes32)","function pullOf(HookrSwapIntent intent) view returns (address token, uint256 amount, bool feeFromInput)","function isNonceUsed(address owner, uint256 intentNonce) view returns (bool)","function router() view returns (address)","function registry() view returns (address)","function permit2() view returns (address)","event IntentExecuted(bytes32 indexed intentHash,address indexed owner,address indexed relayer,bytes32 poolId,uint256 amountIn,uint256 amountOut,uint256 relayerFee,bool feeFromInput)"]),ee={PoolKey:[{name:"currency0",type:"address"},{name:"currency1",type:"address"},{name:"fee",type:"uint24"},{name:"tickSpacing",type:"int24"},{name:"hooks",type:"address"}],HookrSwapIntent:[{name:"key",type:"PoolKey"},{name:"zeroForOne",type:"bool"},{name:"amountSpecified",type:"int128"},{name:"amountBound",type:"uint128"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"recipient",type:"address"},{name:"relayer",type:"address"},{name:"relayerFee",type:"uint256"},{name:"engagement",type:"address"},{name:"campaigns",type:"uint256[]"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},ne=V("0x000000000022D473030F116dDEE9F6B43aC78BA3"),F={key:{type:"object",properties:{currency0:d,currency1:d,fee:{type:"integer"},tickSpacing:{type:"integer"},hooks:d},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},zeroForOne:{type:"boolean"},amountSpecified:{type:"string",pattern:"^-?[0-9]+$"},amountBound:m(),sqrtPriceLimitX96:m(),recipient:d,relayer:d,relayerFee:m(),engagement:d,campaigns:{type:"array",items:m(),maxItems:8},nonce:m(),deadline:m()},x={owner:d,signature:{type:"string",pattern:"^0x[0-9a-fA-F]+$"},intent:{type:"object",properties:F,required:Object.keys(F),additionalProperties:!1}};function D(t){return B(t,"Provide a complete trader-signed Hookr intent.")}function y(t,i=256,e=!1){if(typeof t!="string"||!/^-?\d+$/.test(t)||t.length>79)throw new o("Hookr intent amounts, nonce and deadline must be decimal base-unit strings.");let n=BigInt(t);if(e?n<=-(1n<<BigInt(i-1))||n>=1n<<BigInt(i-1):n<0n||n>=1n<<BigInt(i))throw new o("Hookr intent integer is outside its ABI range.");return n}function l(t){return E(t,"Provide valid Hookr intent addresses.")}function j(t,i){if(Object.keys(t).some(s=>!Object.hasOwn(x,s)))throw new o("Provide only owner, intent and the trader signature for Hookr relay.");let e=D(t.intent);if(Object.keys(e).some(s=>!Object.hasOwn(F,s)))throw new o("Hookr intent contains an undocumented field.");let n=D(e.key);if(Object.keys(n).some(s=>!["currency0","currency1","fee","tickSpacing","hooks"].includes(s))||typeof n.fee!="number"||!Number.isInteger(n.fee)||n.fee<0||n.fee>16777215||typeof n.tickSpacing!="number"||!Number.isInteger(n.tickSpacing)||n.tickSpacing<=0||n.tickSpacing>8388607||typeof e.zeroForOne!="boolean")throw new o("Provide a valid canonical v4 pool key and direction.");let a={currency0:l(n.currency0),currency1:l(n.currency1),fee:n.fee,tickSpacing:n.tickSpacing,hooks:l(n.hooks)};if(BigInt(a.currency0)>=BigInt(a.currency1))throw new o("Hookr pool currencies must sort strictly by address.");let r=l(t.owner);if(r===k||p(r,i))throw new o("Hookr relay requires another trader as owner; the relayer funds gas only.");if(!Array.isArray(e.campaigns)||e.campaigns.length>8)throw new o("Provide at most eight Hookr campaign IDs.");let c={key:a,zeroForOne:e.zeroForOne,amountSpecified:y(e.amountSpecified,128,!0),amountBound:y(e.amountBound,128),sqrtPriceLimitX96:y(e.sqrtPriceLimitX96,160),recipient:l(e.recipient),relayer:l(e.relayer),relayerFee:y(e.relayerFee),engagement:l(e.engagement),campaigns:e.campaigns.map(s=>y(s)),nonce:y(e.nonce),deadline:y(e.deadline)};if(c.amountSpecified===0n||c.amountBound===0n)throw new o("Hookr intent input/output amounts and bound must be nonzero.");if([k,h,v].some(s=>p(s,c.recipient)))throw new o("Hookr intent recipient is reserved.");if(c.relayer!==k&&!p(c.relayer,i)||c.relayer===k&&c.relayerFee!==0n)throw new o("Hookr intent names a different relayer or an open relay with a fee.");if(c.engagement===k!=(c.campaigns.length===0))throw new o("Hookr engagement and campaigns must be supplied together.");let f=c.zeroForOne?a.currency0:a.currency1;if(f===k)throw new o("Hookr Permit2 relay cannot pull native ETH input.");if(typeof t.signature!="string"||!J(t.signature,{strict:!0})||t.signature.length<4||t.signature.length%2!==0||t.signature.length>16386)throw new o("Provide the trader-signed Permit2 witness signature, never a private key.");let S=t.signature,w=Y({data:c,primaryType:"HookrSwapIntent",types:ee});return{owner:r,intent:c,signature:S,input:f,intentHash:w}}function q(t,i){let{owner:e,intent:n,signature:a}=j(t,i);return{chainId:H,to:h,value:"0",data:G({abi:I,functionName:"execute",args:[n,e,a]}),description:`Relay Hookr trader ${e} to recipient ${n.recipient}; relayer fee ${n.relayerFee} in pool quote currency. Relayer pays gas; owner supplies Permit2 funds.`}}function ce(t,i,e){let n=q(i,e);if(t.length!==1||t[0].chainId!==n.chainId||!p(t[0].to,n.to)||t[0].value!=="0"||!p(t[0].data,n.data))throw new o("Hookr relay calldata differs from the locally requested signed intent.")}function ue(t){return[{name:"hookr_relay",inputSchema:{type:"object",description:"Preview a trader-signed Permit2 swap for local human-confirmed submission. Relayer pays gas; the trader supplies input. No signature is created by this tool.",properties:x,required:Object.keys(x),additionalProperties:!1},execute:async(i,e)=>{let n=j(i,e),{owner:a,intent:r,signature:c,input:f,intentHash:S}=n,w=t.clientFor(H),s=await w.getBlock();if(typeof s.number!="bigint"||typeof s.timestamp!="bigint"||s.timestamp<=0n||s.timestamp>r.deadline)throw new o("Hookr signed intent expired or the chain timestamp is unavailable.");let g=(X,M=[])=>w.readContract({address:h,abi:I,functionName:X,args:M,blockNumber:s.number}),[_,u,z,K,$,U]=await Promise.all([g("hashIntent",[r]),g("pullOf",[r]),g("isNonceUsed",[a,r.nonce]),g("router"),g("registry"),g("permit2")]);if(_!==S||z!==!1||K!==v||$!==N||U!==ne)throw new o("Hookr intent hash, nonce or forwarder deployment is invalid. Ask the trader for a fresh signed intent.");if(!Array.isArray(u)||u.length!==3||typeof u[0]!="string"||!p(u[0],f)||typeof u[1]!="bigint"||typeof u[2]!="boolean")throw new o("Hookr Permit2 pull could not be verified.");let b=u[2],P=r.amountSpecified<0n?-r.amountSpecified:r.amountBound;if(u[1]!==P+(b?r.relayerFee:0n)||r.amountSpecified>0n&&!b&&r.relayerFee>r.amountSpecified)throw new o("Hookr Permit2 pull or output-side fee differs from the signed terms.");let C=await w.simulateContract({address:h,abi:I,functionName:"execute",args:[r,a,c],account:e,blockNumber:s.number}),[A,R]=C.result,T=r.amountSpecified<0n?r.amountBound:r.amountSpecified-(b?0n:r.relayerFee);if(A>P||R<T)throw new o("Hookr relay simulation did not satisfy the signed input/output bounds.");let O=[t.unsignedTx(q(i,e))],L=await t.preview(O,e);return{txs:O,preview:L,summary:O[0].description,intentHash:S,owner:a,recipient:r.recipient,relayer:e,inputToken:f,maximumPull:u[1].toString(),feeToken:b?f:r.zeroForOne?r.key.currency1:r.key.currency0,relayerFee:r.relayerFee.toString(),feeFromInput:b,minimumOutput:T.toString(),simulatedAmountIn:A.toString(),simulatedAmountOut:R.toString(),note:"Verify IntentExecuted in the receipt and your fee balance after submission."}}},{name:"hookr_relay_receipt",inputSchema:{type:"object",description:"Read the executed intent and fee from a mined Hookr relay receipt.",properties:{transactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}},required:["transactionHash"],additionalProperties:!1},execute:async i=>{if(Object.keys(i).some(a=>a!=="transactionHash")||typeof i.transactionHash!="string"||!/^0x[0-9a-fA-F]{64}$/.test(i.transactionHash))throw new o("Provide a Hookr relay transactionHash.");let e=await t.clientFor(H).getTransactionReceipt({hash:i.transactionHash});if(e.status!=="success")throw new o("Hookr relay reverted. No fee is proven paid.");let n=e.logs.filter(a=>p(a.address,h)).flatMap(a=>{try{let r=W({abi:I,eventName:"IntentExecuted",topics:a.topics,data:a.data});return[{...r.args,amountIn:r.args.amountIn.toString(),amountOut:r.args.amountOut.toString(),relayerFee:r.args.relayerFee.toString()}]}catch{return[]}});if(!n.length)throw new o("Receipt contains no verified Hookr IntentExecuted event.");return{chainId:H,transactionHash:e.transactionHash,blockNumber:e.blockNumber.toString(),intents:n,note:"Event evidence at this mined block; check balances and finality."}}}]}export{I as a,j as b,q as c,ce as d,ue as e};
@@ -1 +1 @@
1
- import{a as $}from"./LT5P6PZW.js";import{a as L}from"./CY75R4FK.js";import{c as D,f as z,g as F,i as U}from"./73N3TOJL.js";import{a as k}from"./G6HCV67X.js";import{a as c}from"./5YS5V2LK.js";import{encodeFunctionData as W,erc20Abi as ne,erc721Abi as K,getAddress as te,parseAbi as oe,zeroAddress as q}from"viem";var A=$,J=oe(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),w=(e,n)=>e.name==="seed"?"marketSeed":e.name||`arg${n}`,G=e=>"components"in e?e.components:[],re=e=>{if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<256n)throw new c("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(e)},p=e=>z(e,"Provide the documented Hookr parameter object."),g=e=>U(e,"Provide a valid Hookr address."),Q=e=>e.stateMutability==="view"||e.stateMutability==="pure";function B(e){return e.abi}function X(e){let n=/^(.*)\[([0-9]*)\]$/.exec(e.type);return n?{type:"array",items:X({...e,type:n[1]}),minItems:n[2]?Number(n[2]):0,maxItems:n[2]?Number(n[2]):128}:e.type==="tuple"?E(G(e)):e.type==="bool"?{type:"boolean"}:e.type==="address"?D:/^u?int/.test(e.type)?{type:"string",pattern:e.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:"Decimal integer; token amounts are base units, timestamps are Unix seconds."}:e.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770}:{type:"string",maxLength:4096}}function E(e){return{type:"object",properties:Object.fromEntries(e.map((n,r)=>[w(n,r),X(n)])),required:e.map(w),additionalProperties:!1}}function j(e,n){let r=/^(.*)\[([0-9]*)\]$/.exec(e.type);if(r){if(!Array.isArray(n)||n.length>128||r[2]&&n.length!==Number(r[2]))throw new c("Hookr parameter array has an invalid length.");return n.map(s=>j({...e,type:r[1]},s))}if(e.type==="tuple"){let s=p(n),u=G(e);return C(s,u.map(w)),Object.fromEntries(u.map((i,d)=>[i.name||`arg${d}`,j(i,s[w(i,d)])]))}if(e.type==="address")return g(n);if(e.type==="bool"){if(typeof n!="boolean")throw new c("Provide a Hookr boolean.");return n}let a=/^(u?)int([0-9]*)$/.exec(e.type);if(a){if(typeof n!="string"||!/^(0|-?[1-9][0-9]*)$/.test(n)||n.length>79)throw new c("Provide Hookr integers as decimal base-unit strings.");let s=BigInt(n),u=BigInt(a[2]||256),i=!a[1];if(s<(i?-(1n<<u-1n):0n)||s>=1n<<(i?u-1n:u))throw new c("Hookr integer exceeds its ABI range.");return u<=32n?Number(s):s}if(e.type.startsWith("bytes")){let s=Number(e.type.slice(5));if(typeof n!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(n)||n.length>32770||s&&n.length!==2+s*2)throw new c("Provide a valid Hookr hex byte string of the ABI length.");return n}if(e.type!=="string"||typeof n!="string"||new TextEncoder().encode(n).length>4096)throw new c("Provide a valid Hookr string.");return n}function C(e,n){if(Object.keys(e).some(r=>!n.includes(r))||n.some(r=>!Object.hasOwn(e,r)))throw new c("Provide exactly the documented Hookr parameters.")}function fe(e,n){C(n,e.inputs.map(w));let r=e.inputs.map((a,s)=>j(a,n[w(a,s)]));return{values:r,params:Object.fromEntries(e.inputs.map((a,s)=>[w(a,s),r[s]]))}}function Y(e,n){if(C(e,["contract","function","params"]),typeof e.contract!="string"||!Object.hasOwn(A,e.contract))throw new c("Choose a contract from hookr_contracts.");let r=A[e.contract];if(!n&&r.address.toLowerCase()===$.launcherV1.address.toLowerCase())throw new c("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let a=B(r).find(d=>d.name===e.function&&(n?Q(d):r.actions.includes(d.name)));if(!a)throw new c("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let s=p(e.params);C(s,a.inputs.map(w));let u=a.inputs.map((d,f)=>j(d,s[w(d,f)])),i=Object.fromEntries(a.inputs.map((d,f)=>[w(d,f),u[f]]));return{pin:r,fn:a,values:u,params:i,target:g(r.address)}}var V={type:"object",properties:{contract:{type:"string",enum:Object.keys(A)},function:{type:"string"},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function Z(e){return JSON.parse(JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r))}async function ie(e,n,r){if(e.network==="testnet")throw new c("Hookr actions are configured only on mainnet, chain 4663.");let{pin:a,fn:s,values:u,params:i,target:d}=Y(n,!1),f=n.contract,h=s.name,H=e.clientFor(k),P=[],I=[],b=0n,O=new Map,l=(t,o)=>{let m=g(t),x=typeof o=="bigint"?o:re(o);if(x<0n||x>=(1n<<256n)-1n)throw new c("Hookr funding must be an exact bounded amount.");x&&(m===q?b+=x:O.set(m,(O.get(m)??0n)+x))},v=(t,o,m=[])=>H.readContract({address:g(A[t].address),abi:A[t].abi,functionName:o,args:m});if(f==="router"&&["swap","swapGated"].includes(h)){let t=p(i.params),o=p(t.key),m=t.amountSpecified;if(m===0n||t.amountBound===0n)throw new c("Hookr swaps require a nonzero amount and bound.");l(t.zeroForOne?o.currency0:o.currency1,m<0n?-m:t.amountBound)}else if(f==="vault"&&h==="deposit"){let t=p(i.params),o=p(t.key);if(l(o.currency0,t.amount0Desired),l(o.currency1,t.amount1Desired),t.amount0Min>t.amount0Desired||t.amount1Min>t.amount1Desired)throw new c("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&h==="transfer")I.push({token:d,id:i.id,amount:i.amount,to:g(i.receiver)});else if(f==="launcher"&&h.startsWith("launch")){let t=h==="launchFamily"?p(i.p):i,o=p(t.token),m=t.members;if(m.length<1||m.length>8)throw new c("Hookr launch needs one to eight members.");if(F(String(o.salt),String(await v("launcher","SKIP_TAKEN"))))throw new c("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=o.existing===q?g(await v("launcher","predictToken",[r,o])):g(o.existing),_=0n;for(let y of m){let T=BigInt(x)<BigInt(String(y.quote)),M=T?y.amount0Max:y.amount1Max;o.existing===q?_+=M:l(x,M),l(y.quote,T?y.amount1Max:y.amount0Max)}if(_>o.supply)throw new c("Hookr launch seeds more new tokens than its supply.");let ee=h==="launchFamily"?t.buys:h==="launchWithBuy"?[p(i.buy)]:[];for(let y of ee){let T=m[Number(y.member)];if(!T)throw new c("Hookr dev buy references an unavailable member.");l(T.quote,y.quoteIn)}let N=await H.readContract({address:d,abi:J,functionName:"launchFee"});if(!Array.isArray(N)||typeof N[0]!="bigint"||N[0]<0n)throw new c("Hookr launch fee is unavailable.");b+=N[0]}else if(f==="launcher"&&h==="addLiquidity"){let t=p(await v("launcher","position",[i.familyId,i.member])),o=p(t.key);l(o.currency0,i.max0),l(o.currency1,i.max1)}else if(f==="ownedFactory"&&h==="deploy"){let t=await v("ownedFactory","deployFee");if(typeof t!="bigint"||t<0n)throw new c("Hookr own-hook deployment fee is unavailable.");b=t}else if(f==="programs"&&h==="createProgram"){let t=p(i.t);if(l(t.rewardToken,t.cashBudget),b)throw new c("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&h==="createCampaign"){let t=p(i.t),o=t.end-t.start;if(o<=0n||o%86400n!==0n||o/86400n>366n)throw new c("Hookr referral campaigns must cover one to 366 whole days.");l(t.currency,t.dailyBudget*(o/86400n))}else if(f==="reserve"&&h==="fundReserve")l(i.token,i.amount);else if(f==="tokenizer"){let t=p(i.arg1);if(t.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(o=>t[o].length>0))throw new c("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let o of t.revenueTokens)l(o.token,o.amount);if(h==="tokenize"&&p(i.arg2).open){let o=await H.readContract({address:g(A.launcher.address),abi:J,functionName:"launchFee"});if(!Array.isArray(o)||typeof o[0]!="bigint"||o[0]<0n)throw new c("Hookr revenue market launch fee is unavailable.");b+=o[0]}}else if(f==="boost"&&["fund","notify"].includes(h)){let t=p(await v("boost","gauge",[i.id]));if(l(p(t.terms).rewardToken,i.amount),b)throw new c("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&h==="stake"){let t=g(await v("boost","positionManager"));if(t!==te("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new c("Hookr boost position manager disagrees with the published deployment.");let o=await H.readContract({address:t,abi:K,functionName:"ownerOf",args:[i.tokenId]});if(!F(o,r))throw new c("The signing wallet must own the position NFT it stakes.");P.push(e.unsignedTx({to:t,data:W({abi:K,functionName:"approve",args:[d,i.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${i.tokenId} to ${d}.`})),I.push({token:t,id:i.tokenId,amount:1n,to:d})}let R=await H.getBlock();if(typeof R.timestamp!="bigint"||R.timestamp<=0n)throw new c("Hookr chain time is unavailable.");let S=t=>{if(Array.isArray(t)){t.forEach(S);return}if(!(!t||typeof t!="object"))for(let[o,m]of Object.entries(t)){if(o==="deadline"&&typeof m=="bigint"&&m<R.timestamp)throw new c("Hookr deadline expired. Refresh the action terms.");S(m)}};S(i);for(let[t,o]of O){if(o>=(1n<<256n)-1n)throw new c("Hookr aggregate funding exceeds its exact approval bound.");let m=await H.readContract({address:t,abi:ne,functionName:"allowance",args:[r,d]});m>0n&&m!==o&&P.push(e.approval(t,d,"0",k)),P.push(e.approval(t,d,o.toString(),k)),I.push({token:t,amount:o})}return b&&I.push({token:L,amount:b,to:d}),P.push(e.unsignedTx({to:d,data:W({abi:[s],functionName:s.name,args:u}),value:b.toString(),chainId:k,description:`Hookr ${f}.${h}: ${JSON.stringify(Z(i))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:P,inputs:I}}function pe(e,n){if(e.length!==n.length||e.some((r,a)=>r.chainId!==n[a].chainId||!F(r.to,n[a].to)||r.value!==n[a].value||!F(r.data,n[a].data)))throw new c("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function he(e){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{type:"string",enum:Object.keys(A)},function:{type:"string"}},additionalProperties:!1},execute:async n=>{if(Object.keys(n).some(a=>!["contract","function"].includes(a))||n.contract!==void 0&&(typeof n.contract!="string"||!Object.hasOwn(A,n.contract))||n.function!==void 0&&typeof n.function!="string")throw new c("Choose a documented Hookr contract and function filter.");let r=a=>n.function===void 0||a.name===n.function;return{chainId:k,contracts:Object.entries(A).filter(([a])=>n.contract===void 0||a===n.contract).map(([a,s])=>({role:a,address:g(s.address),source:s.source,match:s.match,reads:B(s).filter(u=>Q(u)&&r(u)).map(u=>({function:u.name,params:E(u.inputs)})),actions:s.actions.filter(u=>n.function===void 0||u===n.function).map(u=>({function:u,params:E(B(s).find(i=>i.name===u).inputs)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...V,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async n=>{let{pin:r,fn:a,values:s,target:u}=Y(n,!0),i=await e.clientFor(k).readContract({address:u,abi:[a],functionName:a.name,args:s});return{chainId:k,contract:u,function:a.name,result:Z(i),source:r.source}}},{name:"hookr_action",inputSchema:{...V,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(n,r)=>{let a=await ie(e,n,r),s=await e.preview(a.txs,r);return{txs:a.txs,preview:s,summary:`Hookr ${n.contract}.${n.function}; review the preview and human confirmation.`}}}]}export{E as a,fe as b,ie as c,pe as d,he as e};
1
+ import{a as $}from"./LT5P6PZW.js";import{a as L}from"./HTXKERNS.js";import{c as D,f as z,g as F,i as U}from"./5KUWLUPM.js";import{a as k}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{encodeFunctionData as W,erc20Abi as ne,erc721Abi as K,getAddress as te,parseAbi as oe,zeroAddress as q}from"viem";var A=$,J=oe(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),w=(e,n)=>e.name==="seed"?"marketSeed":e.name||`arg${n}`,G=e=>"components"in e?e.components:[],re=e=>{if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<256n)throw new c("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(e)},p=e=>z(e,"Provide the documented Hookr parameter object."),g=e=>U(e,"Provide a valid Hookr address."),Q=e=>e.stateMutability==="view"||e.stateMutability==="pure";function B(e){return e.abi}function X(e){let n=/^(.*)\[([0-9]*)\]$/.exec(e.type);return n?{type:"array",items:X({...e,type:n[1]}),minItems:n[2]?Number(n[2]):0,maxItems:n[2]?Number(n[2]):128}:e.type==="tuple"?E(G(e)):e.type==="bool"?{type:"boolean"}:e.type==="address"?D:/^u?int/.test(e.type)?{type:"string",pattern:e.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:"Decimal integer; token amounts are base units, timestamps are Unix seconds."}:e.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770}:{type:"string",maxLength:4096}}function E(e){return{type:"object",properties:Object.fromEntries(e.map((n,r)=>[w(n,r),X(n)])),required:e.map(w),additionalProperties:!1}}function j(e,n){let r=/^(.*)\[([0-9]*)\]$/.exec(e.type);if(r){if(!Array.isArray(n)||n.length>128||r[2]&&n.length!==Number(r[2]))throw new c("Hookr parameter array has an invalid length.");return n.map(s=>j({...e,type:r[1]},s))}if(e.type==="tuple"){let s=p(n),u=G(e);return C(s,u.map(w)),Object.fromEntries(u.map((i,d)=>[i.name||`arg${d}`,j(i,s[w(i,d)])]))}if(e.type==="address")return g(n);if(e.type==="bool"){if(typeof n!="boolean")throw new c("Provide a Hookr boolean.");return n}let a=/^(u?)int([0-9]*)$/.exec(e.type);if(a){if(typeof n!="string"||!/^(0|-?[1-9][0-9]*)$/.test(n)||n.length>79)throw new c("Provide Hookr integers as decimal base-unit strings.");let s=BigInt(n),u=BigInt(a[2]||256),i=!a[1];if(s<(i?-(1n<<u-1n):0n)||s>=1n<<(i?u-1n:u))throw new c("Hookr integer exceeds its ABI range.");return u<=32n?Number(s):s}if(e.type.startsWith("bytes")){let s=Number(e.type.slice(5));if(typeof n!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(n)||n.length>32770||s&&n.length!==2+s*2)throw new c("Provide a valid Hookr hex byte string of the ABI length.");return n}if(e.type!=="string"||typeof n!="string"||new TextEncoder().encode(n).length>4096)throw new c("Provide a valid Hookr string.");return n}function C(e,n){if(Object.keys(e).some(r=>!n.includes(r))||n.some(r=>!Object.hasOwn(e,r)))throw new c("Provide exactly the documented Hookr parameters.")}function fe(e,n){C(n,e.inputs.map(w));let r=e.inputs.map((a,s)=>j(a,n[w(a,s)]));return{values:r,params:Object.fromEntries(e.inputs.map((a,s)=>[w(a,s),r[s]]))}}function Y(e,n){if(C(e,["contract","function","params"]),typeof e.contract!="string"||!Object.hasOwn(A,e.contract))throw new c("Choose a contract from hookr_contracts.");let r=A[e.contract];if(!n&&r.address.toLowerCase()===$.launcherV1.address.toLowerCase())throw new c("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let a=B(r).find(d=>d.name===e.function&&(n?Q(d):r.actions.includes(d.name)));if(!a)throw new c("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let s=p(e.params);C(s,a.inputs.map(w));let u=a.inputs.map((d,f)=>j(d,s[w(d,f)])),i=Object.fromEntries(a.inputs.map((d,f)=>[w(d,f),u[f]]));return{pin:r,fn:a,values:u,params:i,target:g(r.address)}}var V={type:"object",properties:{contract:{type:"string",enum:Object.keys(A)},function:{type:"string"},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function Z(e){return JSON.parse(JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r))}async function ie(e,n,r){if(e.network==="testnet")throw new c("Hookr actions are configured only on mainnet, chain 4663.");let{pin:a,fn:s,values:u,params:i,target:d}=Y(n,!1),f=n.contract,h=s.name,H=e.clientFor(k),P=[],I=[],b=0n,O=new Map,l=(t,o)=>{let m=g(t),x=typeof o=="bigint"?o:re(o);if(x<0n||x>=(1n<<256n)-1n)throw new c("Hookr funding must be an exact bounded amount.");x&&(m===q?b+=x:O.set(m,(O.get(m)??0n)+x))},v=(t,o,m=[])=>H.readContract({address:g(A[t].address),abi:A[t].abi,functionName:o,args:m});if(f==="router"&&["swap","swapGated"].includes(h)){let t=p(i.params),o=p(t.key),m=t.amountSpecified;if(m===0n||t.amountBound===0n)throw new c("Hookr swaps require a nonzero amount and bound.");l(t.zeroForOne?o.currency0:o.currency1,m<0n?-m:t.amountBound)}else if(f==="vault"&&h==="deposit"){let t=p(i.params),o=p(t.key);if(l(o.currency0,t.amount0Desired),l(o.currency1,t.amount1Desired),t.amount0Min>t.amount0Desired||t.amount1Min>t.amount1Desired)throw new c("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&h==="transfer")I.push({token:d,id:i.id,amount:i.amount,to:g(i.receiver)});else if(f==="launcher"&&h.startsWith("launch")){let t=h==="launchFamily"?p(i.p):i,o=p(t.token),m=t.members;if(m.length<1||m.length>8)throw new c("Hookr launch needs one to eight members.");if(F(String(o.salt),String(await v("launcher","SKIP_TAKEN"))))throw new c("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=o.existing===q?g(await v("launcher","predictToken",[r,o])):g(o.existing),_=0n;for(let y of m){let T=BigInt(x)<BigInt(String(y.quote)),M=T?y.amount0Max:y.amount1Max;o.existing===q?_+=M:l(x,M),l(y.quote,T?y.amount1Max:y.amount0Max)}if(_>o.supply)throw new c("Hookr launch seeds more new tokens than its supply.");let ee=h==="launchFamily"?t.buys:h==="launchWithBuy"?[p(i.buy)]:[];for(let y of ee){let T=m[Number(y.member)];if(!T)throw new c("Hookr dev buy references an unavailable member.");l(T.quote,y.quoteIn)}let N=await H.readContract({address:d,abi:J,functionName:"launchFee"});if(!Array.isArray(N)||typeof N[0]!="bigint"||N[0]<0n)throw new c("Hookr launch fee is unavailable.");b+=N[0]}else if(f==="launcher"&&h==="addLiquidity"){let t=p(await v("launcher","position",[i.familyId,i.member])),o=p(t.key);l(o.currency0,i.max0),l(o.currency1,i.max1)}else if(f==="ownedFactory"&&h==="deploy"){let t=await v("ownedFactory","deployFee");if(typeof t!="bigint"||t<0n)throw new c("Hookr own-hook deployment fee is unavailable.");b=t}else if(f==="programs"&&h==="createProgram"){let t=p(i.t);if(l(t.rewardToken,t.cashBudget),b)throw new c("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&h==="createCampaign"){let t=p(i.t),o=t.end-t.start;if(o<=0n||o%86400n!==0n||o/86400n>366n)throw new c("Hookr referral campaigns must cover one to 366 whole days.");l(t.currency,t.dailyBudget*(o/86400n))}else if(f==="reserve"&&h==="fundReserve")l(i.token,i.amount);else if(f==="tokenizer"){let t=p(i.arg1);if(t.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(o=>t[o].length>0))throw new c("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let o of t.revenueTokens)l(o.token,o.amount);if(h==="tokenize"&&p(i.arg2).open){let o=await H.readContract({address:g(A.launcher.address),abi:J,functionName:"launchFee"});if(!Array.isArray(o)||typeof o[0]!="bigint"||o[0]<0n)throw new c("Hookr revenue market launch fee is unavailable.");b+=o[0]}}else if(f==="boost"&&["fund","notify"].includes(h)){let t=p(await v("boost","gauge",[i.id]));if(l(p(t.terms).rewardToken,i.amount),b)throw new c("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&h==="stake"){let t=g(await v("boost","positionManager"));if(t!==te("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new c("Hookr boost position manager disagrees with the published deployment.");let o=await H.readContract({address:t,abi:K,functionName:"ownerOf",args:[i.tokenId]});if(!F(o,r))throw new c("The signing wallet must own the position NFT it stakes.");P.push(e.unsignedTx({to:t,data:W({abi:K,functionName:"approve",args:[d,i.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${i.tokenId} to ${d}.`})),I.push({token:t,id:i.tokenId,amount:1n,to:d})}let R=await H.getBlock();if(typeof R.timestamp!="bigint"||R.timestamp<=0n)throw new c("Hookr chain time is unavailable.");let S=t=>{if(Array.isArray(t)){t.forEach(S);return}if(!(!t||typeof t!="object"))for(let[o,m]of Object.entries(t)){if(o==="deadline"&&typeof m=="bigint"&&m<R.timestamp)throw new c("Hookr deadline expired. Refresh the action terms.");S(m)}};S(i);for(let[t,o]of O){if(o>=(1n<<256n)-1n)throw new c("Hookr aggregate funding exceeds its exact approval bound.");let m=await H.readContract({address:t,abi:ne,functionName:"allowance",args:[r,d]});m>0n&&m!==o&&P.push(e.approval(t,d,"0",k)),P.push(e.approval(t,d,o.toString(),k)),I.push({token:t,amount:o})}return b&&I.push({token:L,amount:b,to:d}),P.push(e.unsignedTx({to:d,data:W({abi:[s],functionName:s.name,args:u}),value:b.toString(),chainId:k,description:`Hookr ${f}.${h}: ${JSON.stringify(Z(i))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:P,inputs:I}}function pe(e,n){if(e.length!==n.length||e.some((r,a)=>r.chainId!==n[a].chainId||!F(r.to,n[a].to)||r.value!==n[a].value||!F(r.data,n[a].data)))throw new c("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function he(e){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{type:"string",enum:Object.keys(A)},function:{type:"string"}},additionalProperties:!1},execute:async n=>{if(Object.keys(n).some(a=>!["contract","function"].includes(a))||n.contract!==void 0&&(typeof n.contract!="string"||!Object.hasOwn(A,n.contract))||n.function!==void 0&&typeof n.function!="string")throw new c("Choose a documented Hookr contract and function filter.");let r=a=>n.function===void 0||a.name===n.function;return{chainId:k,contracts:Object.entries(A).filter(([a])=>n.contract===void 0||a===n.contract).map(([a,s])=>({role:a,address:g(s.address),source:s.source,match:s.match,reads:B(s).filter(u=>Q(u)&&r(u)).map(u=>({function:u.name,params:E(u.inputs)})),actions:s.actions.filter(u=>n.function===void 0||u===n.function).map(u=>({function:u,params:E(B(s).find(i=>i.name===u).inputs)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...V,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async n=>{let{pin:r,fn:a,values:s,target:u}=Y(n,!0),i=await e.clientFor(k).readContract({address:u,abi:[a],functionName:a.name,args:s});return{chainId:k,contract:u,function:a.name,result:Z(i),source:r.source}}},{name:"hookr_action",inputSchema:{...V,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(n,r)=>{let a=await ie(e,n,r),s=await e.preview(a.txs,r);return{txs:a.txs,preview:s,summary:`Hookr ${n.contract}.${n.function}; review the preview and human confirmation.`}}}]}export{E as a,fe as b,ie as c,pe as d,he as e};
@@ -0,0 +1 @@
1
+ import{a as s}from"./XSD5NL7J.js";import{isAddress as d}from"viem";var p="https://api-v2.pendle.finance/core/v3/sdk/4663/convert",n=class extends s{constructor(o,r){super(r);this.kind=o}kind};function i(e){if(!e||typeof e!="object"||Array.isArray(e))throw new n("malformed","Pendle sent an incomplete or malformed quote. Try again.");return e}function m(e){if(typeof e!="string"||!/^[0-9]+$/.test(e)||e.length>78||BigInt(e)>=1n<<256n)throw new n("malformed","Pendle sent a malformed token amount. Try again.");return BigInt(e)}function l(e){if(typeof e!="string"||!d(e,{strict:!1}))throw new n("malformed","Pendle sent a malformed token or contract address. Try again.");return e}function c(e){let t=i(e);if(!Array.isArray(t.routes)||!t.routes.length||!Array.isArray(t.requiredApprovals))throw new n("malformed","Pendle sent an incomplete quote. Try again.");let o=i(t.routes[0]),r=i(o.tx);if(l(r.to),typeof r.data!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(r.data)||!Array.isArray(o.outputs)||!o.outputs.length)throw new n("malformed","Pendle sent incomplete transaction details. Try again.");return i(o.data),o}async function g(e,t){if(!Number.isInteger(t.slippageBps)||t.slippageBps<0||t.slippageBps>1e4||t.amount<=0n||t.amount>=1n<<256n)throw new s("Provide a positive token amount and a valid slippage limit.");let o=Date.now(),r;try{r=await e(p,{method:"POST",headers:{"User-Agent":"oak-core/pendle","Content-Type":"application/json"},body:JSON.stringify({inputs:[{token:t.inputToken,amount:t.amount.toString()}],outputs:[t.outputToken],receiver:t.wallet,slippage:t.slippageBps/1e4,enableAggregator:!1}),signal:AbortSignal.timeout(15e3)})}catch{throw new n("unavailable","Pendle's price service isn't answering. Try again later.")}let a;try{a=await r.json()}catch{throw r.status===403?new n("forbidden","Pendle's price service refused the request. Try again later."):r.ok?new n("malformed","Pendle sent a malformed quote. Try again."):new n("http","Pendle's price service isn't answering. Try again later.")}if(!r.ok)throw JSON.stringify(a).includes("INPUT_VALUATION_TOO_LOW")?new n("dust","This amount is too small for Pendle to quote. Try a larger amount."):r.status===403?new n("forbidden","Pendle's price service refused the request. Try again later."):new n("http","Pendle's price service isn't answering. Try again later.");return c(a),{body:a,receivedAt:o}}export{p as a,n as b,i as c,m as d,l as e,c as f,g};
@@ -1 +1 @@
1
- import{a as d,d as T,e as p}from"./GGUEKSR4.js";import{a as S}from"./UWOFA6GV.js";import{a as r}from"./G6HCV67X.js";import{a as u}from"./5YS5V2LK.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
+ import{a as d,d as T,e as p}from"./L7OQUHM5.js";import{a as S}from"./5ZLOCQA4.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 +1 @@
1
- import{a as A}from"./RETS2ZEK.js";import{a as g}from"./3RFSGU2Y.js";import{a as d}from"./5YS5V2LK.js";import{concat as b,encodeAbiParameters as L,getAddress as G,isAddress as C,keccak256 as h,parseAbiParameters as I,toHex as v}from"viem";var B=h(v("OakGrandfather/v1")),w="oak-grandfather/v1",D=(1n<<256n)-1n,H="0x0000000000000000000000000000000000000000000000000000000000000000";function p(e,n){if(typeof e!="string"||!C(e,{strict:!1}))throw new d(`Invalid ${n} address.`);return G(e)}function x(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new d(`${n} must be a 32-byte hex string.`);return e.toLowerCase()}function E(e){let n=typeof e=="bigint"?e:A(e);if(n<0n||n>D)throw new d("Count exceeds uint256 bounds.");return n}function j(e,n,o){let i=typeof e=="object"?e.wallet:e,t=typeof e=="object"?e.count:n,c=typeof e=="object"?e.source:o;if(t===void 0||c===void 0)throw new d("Grandfather leaf requires wallet, count and source.");let u=h(L(I("bytes32, address, uint256, address"),[B,p(i,"wallet"),E(t),p(c,"source")]));return h(u)}function R(e,n){let o=x(e,"first node"),i=x(n,"second node");return BigInt(o)<=BigInt(i)?h(b([o,i])):h(b([i,o]))}function _(e,n,o){if(!Array.isArray(o))throw new d("Grandfather proof must be an array.");let i=x(e,"root"),t=x(n,"leaf");for(let c=0;c<o.length;c++){if(!Object.prototype.hasOwnProperty.call(o,c))throw new d("Grandfather proof must not be a sparse array.");t=R(t,o[c])}return t===i}function S(e){if(!Array.isArray(e))throw new d("Grandfather entries must be an array.");let n=new Set,o=[];for(let r=0;r<e.length;r++){if(!Object.prototype.hasOwnProperty.call(e,r)||!e[r])throw new d(`Grandfather entries must not be sparse (missing index ${r}).`);let s=e[r],a=p(s.wallet,"wallet").toLowerCase(),f=p(s.source,"source").toLowerCase(),l=E(s.count).toString();if(n.has(a))throw new d(`Duplicate wallet in grandfather entries: ${a}`);n.add(a),o.push({wallet:a,count:l,source:f})}if(o.sort((r,s)=>BigInt(r.wallet)<BigInt(s.wallet)?-1:BigInt(r.wallet)>BigInt(s.wallet)?1:0),o.length===0){let r=g({entries:[],root:H,schema:w});return{schema:w,root:H,entries:[],proofs:{},canonicalJson:r}}let i=o.map(r=>j(r)),t=[i];for(;t[t.length-1].length>1;){let r=t[t.length-1],s=[];for(let a=0;a<r.length;a+=2){let f=r[a],l=r[a+1];s.push(l!==void 0?R(f,l):f)}t.push(s)}let c=t[t.length-1][0],u={},P=o.map((r,s)=>{let a=[],f=s;for(let l=0;l<t.length-1;l++){let y=t[l],m=f^1;m<y.length&&a.push(y[m]),f=Math.floor(f/2)}return u[r.wallet]=a,u[G(r.wallet)]=a,{...r,leaf:i[s],proof:a}}),T=g({entries:o.map(({count:r,source:s,wallet:a})=>({count:r,source:s,wallet:a})),root:c,schema:w});return{schema:w,root:c,entries:P,proofs:u,canonicalJson:T}}var M=S;function N(e,n){let o=p(n,"wallet").toLowerCase(),i=Array.isArray(e)?S(e):e,t=i.entries.find(u=>u.wallet.toLowerCase()===o);if(!t)throw new d(`Wallet ${n} is not in the grandfather list.`);let c=[...t.proof];return Object.defineProperties(c,{proof:{value:[...t.proof],enumerable:!1},leaf:{value:t.leaf,enumerable:!1},root:{value:i.root,enumerable:!1},entry:{value:{wallet:t.wallet,count:t.count,source:t.source},enumerable:!1},count:{value:t.count,enumerable:!1},source:{value:t.source,enumerable:!1}}),c}export{B as a,w as b,j as c,R as d,_ as e,S as f,M as g,N as h};
1
+ import{a as A}from"./UP7FBDMJ.js";import{a as g}from"./5CAAFU7R.js";import{a as d}from"./XSD5NL7J.js";import{concat as b,encodeAbiParameters as L,getAddress as G,isAddress as C,keccak256 as h,parseAbiParameters as I,toHex as v}from"viem";var B=h(v("OakGrandfather/v1")),w="oak-grandfather/v1",D=(1n<<256n)-1n,H="0x0000000000000000000000000000000000000000000000000000000000000000";function p(e,n){if(typeof e!="string"||!C(e,{strict:!1}))throw new d(`Invalid ${n} address.`);return G(e)}function x(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new d(`${n} must be a 32-byte hex string.`);return e.toLowerCase()}function E(e){let n=typeof e=="bigint"?e:A(e);if(n<0n||n>D)throw new d("Count exceeds uint256 bounds.");return n}function j(e,n,o){let i=typeof e=="object"?e.wallet:e,t=typeof e=="object"?e.count:n,c=typeof e=="object"?e.source:o;if(t===void 0||c===void 0)throw new d("Grandfather leaf requires wallet, count and source.");let u=h(L(I("bytes32, address, uint256, address"),[B,p(i,"wallet"),E(t),p(c,"source")]));return h(u)}function R(e,n){let o=x(e,"first node"),i=x(n,"second node");return BigInt(o)<=BigInt(i)?h(b([o,i])):h(b([i,o]))}function _(e,n,o){if(!Array.isArray(o))throw new d("Grandfather proof must be an array.");let i=x(e,"root"),t=x(n,"leaf");for(let c=0;c<o.length;c++){if(!Object.prototype.hasOwnProperty.call(o,c))throw new d("Grandfather proof must not be a sparse array.");t=R(t,o[c])}return t===i}function S(e){if(!Array.isArray(e))throw new d("Grandfather entries must be an array.");let n=new Set,o=[];for(let r=0;r<e.length;r++){if(!Object.prototype.hasOwnProperty.call(e,r)||!e[r])throw new d(`Grandfather entries must not be sparse (missing index ${r}).`);let s=e[r],a=p(s.wallet,"wallet").toLowerCase(),f=p(s.source,"source").toLowerCase(),l=E(s.count).toString();if(n.has(a))throw new d(`Duplicate wallet in grandfather entries: ${a}`);n.add(a),o.push({wallet:a,count:l,source:f})}if(o.sort((r,s)=>BigInt(r.wallet)<BigInt(s.wallet)?-1:BigInt(r.wallet)>BigInt(s.wallet)?1:0),o.length===0){let r=g({entries:[],root:H,schema:w});return{schema:w,root:H,entries:[],proofs:{},canonicalJson:r}}let i=o.map(r=>j(r)),t=[i];for(;t[t.length-1].length>1;){let r=t[t.length-1],s=[];for(let a=0;a<r.length;a+=2){let f=r[a],l=r[a+1];s.push(l!==void 0?R(f,l):f)}t.push(s)}let c=t[t.length-1][0],u={},P=o.map((r,s)=>{let a=[],f=s;for(let l=0;l<t.length-1;l++){let y=t[l],m=f^1;m<y.length&&a.push(y[m]),f=Math.floor(f/2)}return u[r.wallet]=a,u[G(r.wallet)]=a,{...r,leaf:i[s],proof:a}}),T=g({entries:o.map(({count:r,source:s,wallet:a})=>({count:r,source:s,wallet:a})),root:c,schema:w});return{schema:w,root:c,entries:P,proofs:u,canonicalJson:T}}var M=S;function N(e,n){let o=p(n,"wallet").toLowerCase(),i=Array.isArray(e)?S(e):e,t=i.entries.find(u=>u.wallet.toLowerCase()===o);if(!t)throw new d(`Wallet ${n} is not in the grandfather list.`);let c=[...t.proof];return Object.defineProperties(c,{proof:{value:[...t.proof],enumerable:!1},leaf:{value:t.leaf,enumerable:!1},root:{value:i.root,enumerable:!1},entry:{value:{wallet:t.wallet,count:t.count,source:t.source},enumerable:!1},count:{value:t.count,enumerable:!1},source:{value:t.source,enumerable:!1}}),c}export{B as a,w as b,j as c,R as d,_ as e,S as f,M as g,N as h};
@@ -1 +1 @@
1
- import{a as ne,b as re,d as ae,e as se,f as ce,g as de}from"./TFVWAYHY.js";import{A as J}from"./Q356HHCL.js";import{c as te,d as ie}from"./MKQVS3IO.js";import{a as m,e as T,f as q,h as _,i as E,j as n,k as oe,l as B,m as x,n as C,o as P,p as A,q as I,r as M,t as N}from"./5OEHZJ6X.js";import{f as Y,g as Z,i as ee}from"./ACN2BFMA.js";import{a as W}from"./CY75R4FK.js";import{a as s}from"./5YS5V2LK.js";import{encodeFunctionData as fe,zeroAddress as S}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],ye=t=>le.includes(t),F=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=ce.oneOf[0],ue={hookr_lp_add:F({target:F({position:j}),liquidity:m,amount0Max:m,amount1Max:m,deadline:m}),hookr_lp_remove:F({position:j,liquidity:m,amount0Min:m,amount1Min:m,deadline:m}),hookr_lp_collect:F({position:j,deadline:m})};function he(t,r){if(!ye(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=T(r,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=de(e?T(i.target,["position"],["position"]).position:i.position),a=l?0n:q(i.liquidity,127);if(!l&&!a)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),k=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:a,bound0:v,bound1:k,deadline:q(i.deadline,64)}}async function ke(t,r,d){let{block:i,poolId:e,position:l,pc:o,core:a,role:v}=r,k=(p,L=[])=>A(t,a,P(v),p,L,i.number),[$,H,O,R]=await Promise.all([k("config",[e]),A(t,M,P("registry"),"admission",[I,a],i.number),k("configSchemaHash"),k("recaptureConfig",[e])]),y=x($),u=x(H),f=x(u.caps),g=x(o.caps);if(u.implementation!==a||u.codeHash!==Y(a).codeHash||u.schemaHash!==_(O)||n(u.kind,8)!==0n||!n(u.gasLimit,32)||n(f.maxLpFeePips,24)>600000n||n(f.maxQuoteTakePips,24)>=1000000n||n(f.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let h=n(g.maxLpFeePips,24),b=n(g.maxQuoteTakePips,24),c=n(g.maxSubjectTakeBps,16),w=n(y.burnBps,16),pe=n(y.lpBps,16),D=n(y.protocolShareBps,16);if(h>600000n||h>n(f.maxLpFeePips,24)||n(o.baseLpFeePips,24)>h||n(y.maxFeePips,24)>h||b>n(f.maxQuoteTakePips,24)||c>n(f.maxSubjectTakeBps,16)||w+pe>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let U=E(o.advisory),z={gated:!1};if(U!==S){if(U!==N||o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");await Z(t,i.number,[N]);let p=await te(t,i.number,d),L=await ie(t,i.number,e,l.launcher,U);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let me=x(L.terms),X=q(me.tierPips,24);if(X>50000n||n(o.baseLpFeePips,24)+X>h||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L}let V=x(B(R,3)[0]);oe(V.on);let G=null,K=BigInt(_(await t.getStorageAt({address:I,slot:re(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(K&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let Q=(K>>200n&255n)!==0n;if(Q){let p=B(await A(t,M,P("registry"),"activeLaneOf",[I],i.number),4);if(E(p[0]),_(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");G=C({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return C({config:y,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:Q,lane:G})}async function ge(t,r,d,i){let e=he(t,d);if(r.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=r.clientFor(4663),o=await ae(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let a=J({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!a.amount0&&!a.amount1||a.amount0>=1n<<127n||a.amount1>=1n<<127n||a.amount0>e.bound0||a.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let k=e.adding?await ke(l,o,i):null,$=null,H=null;try{$=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let O=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",R=`${o.key.currency0} / ${o.key.currency1}`,y=`${O} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${R} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${a.amount0}/${a.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${a.amount0}/${a.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.`,u=[],f=[],g=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(g.push({token:c===S?W:c,amount:w,...c===S?{to:e.position.launcher}:{}}),c!==S&&(u.push(r.approval(c,e.position.launcher,"0",4663),r.approval(c,e.position.launcher,w.toString(),4663)),f.push(r.approval(c,e.position.launcher,"0",4663))))}let h=u.length;return u.push(r.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===S?e.bound0.toString():"0",description:y,data:fe({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...f),await ee(l,o.block),{txs:u,inputs:g,summary:y,state:o,request:e,actionIndex:h,terms:C({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:a,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:$,coreCreditsReason:H,locks:v,entry:k,exactApprovals:u.filter((b,c)=>c!==h),refunds:e.adding?[e.bound0-a.amount0,e.bound1-a.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function be(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let r of t)T(r,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function $e(t,r){if(be(t),t.length!==r.length||t.some((d,i)=>d.to!==r[i].to||d.data!==r[i].data||d.value!==r[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function Te(t){return le.map(r=>({name:r,inputSchema:ue[r],execute:async(d,i)=>{let e=await ge(r,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,ye as b,ue as c,he as d,ge as e,be as f,$e as g,Te as h};
1
+ import{a as ne,b as re,d as ae,e as se,f as ce,g as de}from"./PQC5635W.js";import{A as J}from"./WPAF55SP.js";import{c as te,d as ie}from"./NA7R6J5N.js";import{a as m,e as T,f as q,h as _,i as E,j as n,k as oe,l as B,m as x,n as C,o as P,p as A,q as I,r as M,t as N}from"./YEXUSRIZ.js";import{f as Y,g as Z,i as ee}from"./MQK6OP7S.js";import{a as W}from"./HTXKERNS.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as fe,zeroAddress as S}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],ye=t=>le.includes(t),F=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=ce.oneOf[0],ue={hookr_lp_add:F({target:F({position:j}),liquidity:m,amount0Max:m,amount1Max:m,deadline:m}),hookr_lp_remove:F({position:j,liquidity:m,amount0Min:m,amount1Min:m,deadline:m}),hookr_lp_collect:F({position:j,deadline:m})};function he(t,r){if(!ye(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=T(r,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=de(e?T(i.target,["position"],["position"]).position:i.position),a=l?0n:q(i.liquidity,127);if(!l&&!a)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),k=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:a,bound0:v,bound1:k,deadline:q(i.deadline,64)}}async function ke(t,r,d){let{block:i,poolId:e,position:l,pc:o,core:a,role:v}=r,k=(p,L=[])=>A(t,a,P(v),p,L,i.number),[$,H,O,R]=await Promise.all([k("config",[e]),A(t,M,P("registry"),"admission",[I,a],i.number),k("configSchemaHash"),k("recaptureConfig",[e])]),y=x($),u=x(H),f=x(u.caps),g=x(o.caps);if(u.implementation!==a||u.codeHash!==Y(a).codeHash||u.schemaHash!==_(O)||n(u.kind,8)!==0n||!n(u.gasLimit,32)||n(f.maxLpFeePips,24)>600000n||n(f.maxQuoteTakePips,24)>=1000000n||n(f.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let h=n(g.maxLpFeePips,24),b=n(g.maxQuoteTakePips,24),c=n(g.maxSubjectTakeBps,16),w=n(y.burnBps,16),pe=n(y.lpBps,16),D=n(y.protocolShareBps,16);if(h>600000n||h>n(f.maxLpFeePips,24)||n(o.baseLpFeePips,24)>h||n(y.maxFeePips,24)>h||b>n(f.maxQuoteTakePips,24)||c>n(f.maxSubjectTakeBps,16)||w+pe>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let U=E(o.advisory),z={gated:!1};if(U!==S){if(U!==N||o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");await Z(t,i.number,[N]);let p=await te(t,i.number,d),L=await ie(t,i.number,e,l.launcher,U);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let me=x(L.terms),X=q(me.tierPips,24);if(X>50000n||n(o.baseLpFeePips,24)+X>h||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L}let V=x(B(R,3)[0]);oe(V.on);let G=null,K=BigInt(_(await t.getStorageAt({address:I,slot:re(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(K&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let Q=(K>>200n&255n)!==0n;if(Q){let p=B(await A(t,M,P("registry"),"activeLaneOf",[I],i.number),4);if(E(p[0]),_(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");G=C({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return C({config:y,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:Q,lane:G})}async function ge(t,r,d,i){let e=he(t,d);if(r.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=r.clientFor(4663),o=await ae(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let a=J({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!a.amount0&&!a.amount1||a.amount0>=1n<<127n||a.amount1>=1n<<127n||a.amount0>e.bound0||a.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let k=e.adding?await ke(l,o,i):null,$=null,H=null;try{$=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let O=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",R=`${o.key.currency0} / ${o.key.currency1}`,y=`${O} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${R} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${a.amount0}/${a.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${a.amount0}/${a.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.`,u=[],f=[],g=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(g.push({token:c===S?W:c,amount:w,...c===S?{to:e.position.launcher}:{}}),c!==S&&(u.push(r.approval(c,e.position.launcher,"0",4663),r.approval(c,e.position.launcher,w.toString(),4663)),f.push(r.approval(c,e.position.launcher,"0",4663))))}let h=u.length;return u.push(r.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===S?e.bound0.toString():"0",description:y,data:fe({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...f),await ee(l,o.block),{txs:u,inputs:g,summary:y,state:o,request:e,actionIndex:h,terms:C({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:a,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:$,coreCreditsReason:H,locks:v,entry:k,exactApprovals:u.filter((b,c)=>c!==h),refunds:e.adding?[e.bound0-a.amount0,e.bound1-a.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function be(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let r of t)T(r,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function $e(t,r){if(be(t),t.length!==r.length||t.some((d,i)=>d.to!==r[i].to||d.data!==r[i].data||d.value!==r[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function Te(t){return le.map(r=>({name:r,inputSchema:ue[r],execute:async(d,i)=>{let e=await ge(r,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,ye as b,ue as c,he as d,ge as e,be as f,$e as g,Te as h};