@oakagentkit/core 0.2.3 → 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/{ZXQMF56D.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/{GCWA4Z3W.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/{PEA32CWB.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/{ASDKY5NX.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/{LKJBMHCE.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/{O5IVZHHP.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/{TPDOUL4N.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/{CE7D6MUS.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/{XUYHMOHS.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/{VCLPOU7T.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/{VFKNXQXI.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/4GHVIBL5.js +0 -1
  498. package/build/dist/chunks/4X2JOQ2L.js +0 -1
  499. package/build/dist/chunks/5YS5V2LK.js +0 -1
  500. package/build/dist/chunks/6UPPUHCL.js +0 -1
  501. package/build/dist/chunks/AXYOJBX6.js +0 -1
  502. package/build/dist/chunks/CEIPDEXZ.js +0 -1
  503. package/build/dist/chunks/CUNQ5RG5.js +0 -1
  504. package/build/dist/chunks/EG6M6SSO.js +0 -1
  505. package/build/dist/chunks/EGUMOD3A.js +0 -1
  506. package/build/dist/chunks/G3MHDTGT.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/LLM5WDM3.js +0 -1
  515. package/build/dist/chunks/LQGPMOD2.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/R7SXC74O.js +0 -1
  522. package/build/dist/chunks/RETS2ZEK.js +0 -1
  523. package/build/dist/chunks/SJPYXNOK.js +0 -1
  524. package/build/dist/chunks/SQZRVIVF.js +0 -1
  525. package/build/dist/chunks/SXAIXD56.js +0 -1
  526. package/build/dist/chunks/SXX3VTBP.js +0 -1
  527. package/build/dist/chunks/TMGWXDCZ.js +0 -1
  528. package/build/dist/chunks/TNLHMDWL.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/XVFLT275.js +0 -1
  534. package/build/dist/chunks/YHB55C5T.js +0 -1
  535. package/build/dist/chunks/YOENHHKI.js +0 -1
@@ -1 +0,0 @@
1
- import{b as z}from"./QYYFRAWY.js";import{c as Q}from"./TQL7UDFL.js";import{b as X}from"./PTAWEHKB.js";import{b as Z}from"./ALK6NKFP.js";import{a as Y}from"./PARWLWXW.js";import{a as B,b as R,c as S,d as $,g as K,h as I,k as E,l as v,n as q,p as V,r as W,s as U,t as O,v as F,x as J,y as G}from"./TWSTOFN3.js";import{a as h}from"./X5V2Z2NM.js";import{b as j}from"./AXYOJBX6.js";import{a as N}from"./6IM6A5VA.js";import{c as L,e as k,g as w}from"./73N3TOJL.js";import{a as c}from"./5YS5V2LK.js";import{a as A}from"./JXOEJPJ4.js";import{Buffer as ee}from"node:buffer";import{decodeEventLog as ae,encodeFunctionData as P,getAddress as oe,hexToString as se,parseAbiItem as de,toEventSelector as ne}from"viem";var _e={register:"erc8004_register"},re="https://eips.ethereum.org/EIPS/eip-8004#registration-v1",ce={type:"object",required:["type","name","description","image","services","x402Support","active","registrations"],properties:{type:{const:re},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 D(e,t,a=!1){if(typeof e!="string"||!a&&!e.trim())throw new c(`Provide a valid profile ${t}.`)}function ge(e,t){D(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 fe(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!==re)throw new c("Use the ERC-8004 registration-v1 profile type.");if(D(t.name,"name"),D(t.description,"description",!0),ge(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(f=>typeof f=="string"&&f.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 f=typeof r.agentId=="number"&&Number.isSafeInteger(r.agentId)?String(r.agentId):r.agentId,p=v(f);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 g={...t,registrations:s,...i.length?{tags:i}:{}};i.length||delete g.tags;let o;try{if(o=JSON.stringify(g),ee.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,${ee.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]});N(i);let[g,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 g!="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:g,agentWallet:o,registrarMetadata:r,registryValidated:!1,summary:B}}catch(a){throw new c(e.plainError(a))}}async function $e(e,t){let a=await x(e,t);return{...a,uri:A(a.uri)}}async function ue(e,t,a,n,d,s){let{registry:i}=I(e),g=await F(e,t,a,d),o=s===void 0?"Registered":"URIUpdated",r=ne(s===void 0?"Registered(uint256,string,address)":"URIUpdated(uint256,string,address)"),f=g.logs.filter(T=>w(T.address,i)&&T.topics[0]===r&&!T.removed);if(f.length!==1)throw new c(`The receipt must contain one matching ${o} event.`);let p=f[0],u=ae({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 le(e,t,a,n){let{registry:d}=I(e),s=v(n.agentId),i=await F(e,t,a,H(e,s).data),g=ne("MetadataSet(uint256,string,string,bytes)"),o=i.logs.filter(u=>w(u.address,d)&&u.topics[0]===g&&!u.removed);if(o.length!==1)throw new c("The receipt must contain one matching MetadataSet event.");let r=o[0],{args:f}=ae({abi:h,eventName:"MetadataSet",topics:r.topics,data:r.data,strict:!0});if(f.agentId!==s||f.metadataKey!==R||f.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 pe(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}),g=new Set;for(;;){let o=i>9999999n?i-9999999n:0n,r=await d.getLogs({address:n,event:de("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:t},fromBlock:o,toBlock:i,strict:!0});for(let f of r){let p=f.args.tokenId.toString();if(f.removed||g.has(p))continue;g.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 me(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=J(a.key);if(t.has(n))throw new c(`Metadata key ${A(n)} is repeated.`);return t.add(n),{metadataKey:n,metadataValue:G(a)}})}function ie(e,t,a){let n=W(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 he(e,t,a){let n=ie(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 te(e,t,a,n){let{chainId:d,registry:s}=I(e);N(n),q(e,a.chainId);let i=t?v(a.agentId):void 0,g=!t&&a.profile===void 0,o=g?"":fe(e,a.profile,a.tag,i),r=t?[]:me(a.metadata);if(g&&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 f=a.tag!==!1;if(a.metadataTransactionHash!==void 0&&(!f||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]}):g?P({abi:h,functionName:"register"}):P({abi:h,functionName:"register",args:[o]}),u=l=>i===void 0?he(e,l,a.profile):l;if(a.transactionHash!==void 0){let l=await ue(e,a.transactionHash,n,o,p,i);if(!f)return u(l);if(a.metadataTransactionHash!==void 0)return u(await le(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 pe(e,n);if(l){let y={...l,registrationResumed:!0};if(!f||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&&f&&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.${f?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 ye(e,t){let a=await x(e,t.agentId),{chainId:n,registry:d}=I(e),s=e.clientFor(n),i=BigInt(a.agentId),g=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=>V(m,"metadata key",128,!1))})(),o=t.operator===void 0?void 0:oe(String(t.operator)),[r,f,...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),...g.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=ie(e,a.uri,i);return{...a,approved:typeof b=="string"&&E(b)?null:b??"unavailable",...o?{operator:o,operatorApproved:u(f)??"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},...g.length?{metadata:Object.fromEntries(g.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(se(M))}catch{C=void 0}return[A(m),{hex:M??"unavailable",...C?{text:C}:{}}]}))}:{}}}var we={type:"object",additionalProperties:!1,required:["key"],properties:{key:{type:"string",minLength:1,maxLength:128},value:K,text:{type:"string"}}},Ie=e=>{let t=(n,d,s)=>({name:n,inputSchema:d,execute:async(i,g)=>{try{let o=await s(i,g);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:{...ce,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:we,description:"Optional extra onchain metadata written by register(agentURI, metadata[]). The key agentWallet is reserved."}}}});return{tools:[t("erc8004_register",a(!1),(n,d)=>te(e,!1,n,d)),t("erc8004_update",a(!0),(n,d)=>te(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:{...L,description:"Also report whether this address is approved for all of the owner's agents."}}},n=>ye(e,n))]}},Ee=e=>j("erc8004",[Ie(e),Q(e),X(e),Y(e),z(e)]);export{_e as a,$e as b,ie as c,Ie as d,Ee as e};
@@ -1 +0,0 @@
1
- import{g as v}from"./73N3TOJL.js";import{a as w}from"./G6HCV67X.js";import{a as t}from"./5YS5V2LK.js";import{a as k}from"./JXOEJPJ4.js";import{getAddress as b,parseAbi as A}from"viem";var y={one_hour:3600n,six_hours:21600n,one_day:86400n,seven_days:604800n,thirty_days:2592000n,ninety_days:7776000n,one_year:31536000n},f=A(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewRedeem(uint256) view returns (uint256)"]);async function Y(u,d,s){let i=0n,o=s.number,e=await u.getBlock({blockNumber:i});if(e.timestamp>d)throw new t("Longbow has insufficient chain history for this window.");for(let n=0;i+1n<o&&n<64;n++){let a=(i+o)/2n,c=await u.getBlock({blockNumber:a});if(c.number!==a||c.timestamp<e.timestamp||c.timestamp>s.timestamp)throw new t("Longbow historical block response is inconsistent.");c.timestamp<=d?(i=a,e=c):o=a}if(i+1n<o||e.number!==i)throw new t("Longbow historical block search exceeded its bound.");return e}async function S(u,d,s,i="six_hours"){let o=y[i];if(!Object.hasOwn(y,i)||!o)throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let e=u.clientFor(w);if(await e.getChainId()!==w)throw new t("Longbow APY assessment requires chain 4663.");let n=await e.getBlock({blockTag:"latest"});if(n.number===null||n.timestamp<o)throw new t("Longbow has insufficient chain history for this window.");let a=await Y(e,n.timestamp-o,{number:n.number,timestamp:n.timestamp}),c=10n**27n,r=await Promise.all([a,n].map(async m=>{let[P,L,N,g]=await Promise.all([e.readContract({address:d,abi:f,functionName:"asset",blockNumber:m.number}),e.readContract({address:d,abi:f,functionName:"decimals",blockNumber:m.number}),e.readContract({address:s.address,abi:f,functionName:"decimals",blockNumber:m.number}),e.readContract({address:d,abi:f,functionName:"previewRedeem",args:[c],blockNumber:m.number})]);if(b(P)!==b(s.address)||L!==18||N!==s.decimals||typeof g!="bigint"||g<0n||g>=1n<<256n)throw new t("Longbow historical share price or token metadata is unavailable or invalid. No zero rate was inferred.");return g})),h=n.timestamp-a.timestamp;if(h<=0n||h>o+300n)throw new t("Longbow historical blocks do not cover the requested APY window within 300 seconds.");if(r[0]===0n)throw new t("Longbow starting share price is zero; a realized APY cannot be calculated.");let l=Number(r[1]-r[0])/Number(r[0]),p=Math.expm1(Math.log1p(l)*31536e3/Number(h));if(!Number.isFinite(p))throw new t("Longbow annualized share-price change is outside the supported numeric range.");return{chainId:w,vault:d,asset:{...s,address:b(s.address)},shareToken:{address:d,symbol:"Longbow shares",decimals:18,chainId:w},source:"Oak-computed on-chain",view:"apy",stale:!1,window:{lookback:i,requestedSeconds:o.toString(),elapsedSeconds:h.toString(),fromTimestamp:a.timestamp.toString(),toTimestamp:n.timestamp.toString(),fromBlock:a.number.toString(),toBlock:n.number.toString()},sharePrice:{shareUnits:c.toString(),startAssets:r[0].toString(),endAssets:r[1].toString(),assetDecimals:s.decimals},data:{annualYieldFraction:String(p),annualYieldPercent:String(p*100),lookback:i,basis:"Oak-computed realized APY: (end share price / start share price)^(31536000 / elapsed seconds) - 1, using ERC-4626 previewRedeem at two pinned blocks."},caveat:"Historical share-price change includes what the vault accounts for in previewRedeem, excludes external rewards and gas, and is not a promised return. Archive RPC history is required; missing history is not zero APY."}}async function z(u,d,s,i){if(Object.keys(i).some(r=>!["view","lookback"].includes(r)))throw new t("Longbow APY takes a lookback, not pagination.");let o=i.lookback??"six_hours";if(typeof o!="string"||!Object.hasOwn(y,o))throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let[e,n]=await Promise.allSettled([C(u,d,s,{view:"published_apy"}),S(u,d,s,o)]),a=e.status==="fulfilled"&&!e.value.stale?e.value:void 0;if(!a&&n.status==="rejected")throw new t(`Longbow APY is unavailable: the vendor figure is unavailable or stale, and the on-chain window could not be measured. ${u.plainError(n.reason)}`);return{...a??(n.status==="fulfilled"?n.value:void 0),view:"apy",shown:a?"Longbow vendor":"Oak-computed on-chain",realized:n.status==="fulfilled"?n.value:null,published:e.status==="fulfilled"?e.value:null,warnings:[...a?[]:["Longbow vendor APY is unavailable or stale; showing Oak-computed realized APY."],...n.status==="rejected"?["Oak-computed APY is unavailable: the archive RPC window could not be measured."]:[]]}}async function C(u,d,s,i){if(Object.keys(i).some(m=>m!=="view")||i.view!=="published_apy")throw new t("published_apy takes no historical lookback, cursor or limit.");let o=u.clientFor(w);if(await o.getChainId()!==w)throw new t("Longbow APY assessment requires chain 4663.");let[e,n]=await Promise.all([o.getBlock(),o.readContract({address:d,abi:A(["function asset() view returns (address)"]),functionName:"asset"})]);if(b(n)!==b(s.address))throw new t("Longbow vault does not use the pinned asset.");let a="https://longbow.credit/api/v2/vaults",c=await u.http(a,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(15e3)});if(!c.ok)throw new t(`Longbow published APY HTTP ${c.status}; the rate is unavailable.`);let r=await c.json();if(!r||typeof r!="object"||!Number.isSafeInteger(r.asOf)||Number(r.asOf)<0||!Array.isArray(r.vaults)||r.vaults.length>100)throw new t("Longbow published APY response has an invalid timestamp or vault inventory.");let h=r.vaults.filter(m=>m&&typeof m=="object"&&typeof m.address=="string"&&v(String(m.address),d));if(h.length!==1)throw new t("Longbow published APY omitted or duplicated this vault; no zero rate is inferred.");let l=h[0];if(l.error||typeof l.asset!="string"||b(l.asset)!==b(s.address)||l.decimals!==s.decimals||typeof l.apy!="number"||!Number.isFinite(l.apy)||l.apy<-100||typeof l.apyBasis!="string"||l.apyBasis.length>64)throw new t("Longbow published APY asset, units, basis or rate is invalid.");let p=BigInt(Number(r.asOf));return{chainId:w,vault:d,asset:{...s,address:b(s.address)},shareToken:{address:d,symbol:"Longbow shares",decimals:18,chainId:w},sourceUrl:a,view:"published_apy",asOf:p.toString(),stale:e.timestamp>p+900n||p>e.timestamp+60n,data:{annualYieldPercent:String(l.apy),annualYieldFraction:String(l.apy/100),basis:k(l.apyBasis)},caveat:"Longbow publisher quote, not a realized Morpho lookback series or a promised return. The app formats this field directly as percent (0.03 means 0.03%, not 3%). No bonus, future payout or fee inclusion is inferred. Onchain book and fees remain available through longbow_details."}}export{S as a,z as b,C as c};
@@ -1 +0,0 @@
1
- import{a as f}from"./5YS5V2LK.js";var s=10000000n;function p(n,i){let t=s;return typeof n=="bigint"&&n>0n&&n<t&&(t=n),typeof i=="bigint"&&i>0n&&i*2n<t&&(t=i*2n),t}function u(n,i,t,r){return`needs ETH for network fees: need at least ${t} wei including transaction value; held ${r} wei. Send ETH to ${n} on chain ${i}.`}function m(n,i,t,r,g,d){let o=t+21000n*r;if(i<o)throw new f(u(g,d,o,i));let e=r>0n?(i-t)/r:n;return e<n?e:n}export{s as a,p as b,u as c,m as d};
@@ -1 +0,0 @@
1
- import{a as Ie,b as fe,g as Y,h as he,i as $e,m as Z,n as _,y as be,z as qe}from"./5O5ZE3ZV.js";import{b as y,c as Se}from"./KSZMMNXK.js";import{a as le,b as z}from"./CY75R4FK.js";import{a as R}from"./6IM6A5VA.js";import{a as Pe}from"./EG6M6SSO.js";import{a as Ae}from"./UWOFA6GV.js";import{c as me,g as P}from"./73N3TOJL.js";import{a as xe}from"./RETS2ZEK.js";import{a as h,i as pe}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";import{a as ce}from"./JXOEJPJ4.js";import{randomUUID as Fe}from"node:crypto";import{encodeAbiParameters as ee,encodeFunctionData as ke,erc20Abi as Be,getAddress as D,parseAbi as K,parseAbiParameters as te,zeroAddress as L}from"viem";var Ne=pe[h].pons,Q=pe[h].ponsTrade,Ce=K(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),ne=K(["function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)","function feeBps() view returns (uint256)","function creatorTaxBps() view returns (uint256)","function currentSnipeTaxBps(address) view returns (uint256)","function sellableTokens() view returns (uint256)","function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]),Ue=K(["function quoteExactInputSingle(((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)"]),He=K(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),ze=K(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),Le=te("((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint256 minHopPriceX36,bytes hookData)"),Ke={address:le,chainId:h,decimals:18,symbol:"ETH"},Me="There is no on-chain expiry. The signed transaction is protected by its minimum output.",Xe=`Quote expiry is enforced by Oak before signing only. ${Me}`,I=10000n,we=(1n<<256n)-1n,Oe=(1n<<128n)-1n,$=(n,o)=>({token:n,amount:o.toString()}),Ee=(n,o)=>(n+o-1n)/o,je={type:"object",additionalProperties:!1,required:["token","amountIn"],properties:{token:{...me,description:"Pons launch token address on chain 4663."},amountIn:Ae("Positive base units: the launch pair token for buy (native ETH wei for ETH pairs; pons_status shows pairToken), the launch token for sell."),pairToken:{...me,description:"The launch pair from pons_status. Required to buy a custom-pair launch, so amountIn is never read in the wrong units; omit or use the zero address for native ETH."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:fe}}};function Re(n,o,i,s){if(n===void 0){if(i&&y(o)!==L)throw new d(`This Pons launch is paired with ${s}; amountIn is in that token's base units. Repeat with pairToken "${o}" to confirm the input asset.`);return}if(typeof n!="string")throw new d("pairToken must be a token address.");if(R(n),!P(y(n),y(o)))throw new Y(`This Pons launch trades only against ${s}.`)}async function _e(n,o,i,s,{quoteOnly:f=!1,curveOnly:e=!1,blockNumber:c}={}){if(R(i),Object.keys(o).some(m=>!["token","amountIn","slippageBps","pairToken"].includes(m)))throw new d("Provide only token, amountIn, optional pairToken and optional slippageBps.");if(typeof o.token!="string")throw new d("Provide a launch token address.");R(o.token);let t=D(o.token),r=xe(o.amountIn);if(r===0n||r>we)throw new d("Trade amount must be positive and within the uint256 range.");let p=o.slippageBps??fe;if(typeof p!="number"||!Number.isInteger(p)||p<0||p>=1e4)throw new d("Slippage must be an integer from 0 to 9999 basis points.");let x=m=>m*(I-BigInt(p))/I,a=n.clientFor(h),l=c===void 0?await a.getBlock():await a.getBlock({blockNumber:c});if(c!==void 0&&l.number!==c)throw new d("Pons quote snapshot is unavailable.");let u=await a.readContract({address:Ne.factory.address,abi:Ce,functionName:"getLaunchedToken",args:[t],blockNumber:l.number});if(!u.exists||!P(u.token,t))throw new d("This address is not a Pons launch token.");if(e&&u.phase!==0)throw new Y("Pons curve quotes are only available before graduation.");if(u.phase===1)throw new d("Pons graduation is pending; the curve is closed and the pool is not ready.");if(u.phase===3)throw new d("This Pons launch was rescued and has no active trade route.");if(u.phase!==0&&u.phase!==2)throw new d("This Pons launch has an unknown trade phase.");let v=y(u.pairToken)===L,E=D(u.pairToken);if(P(E,t))throw new d("This Pons launch has an invalid pair.");let X=m=>Promise.all([a.readContract({address:m,abi:Be,functionName:"symbol",blockNumber:l.number}),a.readContract({address:m,abi:Be,functionName:"decimals",blockNumber:l.number})]),[[B,F],U]=await Promise.all([X(t),v?void 0:X(E)]),w=U?{address:E,chainId:h,symbol:ce(U[0]),decimals:U[1]}:Ke,j=v?"native ETH":`${w.symbol} (${w.address})`;Re(o.pairToken,E,s,`${j}, ${w.decimals} decimals`);let G={address:t,chainId:h,symbol:ce(B),decimals:F},oe=s?w:G,se=s?G:w,q=[],re=(m,k,S,A)=>n.unsignedTx({to:m,data:k,value:S.toString(),chainId:h,description:A}),T,b,V,O=r,Te=null,ie;if(u.phase===0){let m=g=>a.readContract({address:u.curve,abi:ne,functionName:g,blockNumber:l.number}),[[k,S],A,N,C,M]=await Promise.all([a.readContract({address:u.curve,abi:ne,functionName:"getReserves",blockNumber:l.number}),m("feeBps"),m("creatorTaxBps"),s?a.readContract({address:u.curve,abi:ne,functionName:"currentSnipeTaxBps",args:[i],blockNumber:l.number}):Promise.resolve(0n),s?m("sellableTokens"):Promise.resolve(0n)]);if(k<=0n||S<=0n||A+N>I-100n)throw new d("Pons curve reserves or fee settings are unavailable.");let J=I-A-N-100n,ue=C<J?C:J,ge=g=>({base:g*A/I,creator:g*N/I,snipe:g*ue/I}),ye=g=>{let H=ge(g);return g-H.base-H.creator-H.snipe},W;if(s){if(M<=0n||M>=S)throw new d("The curve has no available sellable tokens.");let g=ye(r);if(T=g*S/(k+g),T>=M){T=M;let H=T*k/(S-T)+1n;O=Ee(H*I,I-A-N-ue),O>r&&(O=r)}W=O,b=x(T),V=Ee(b*r,O),v||q.push(n.approval(w.address,u.curve,r.toString(),h))}else W=r*k/(S+r),T=ye(W),b=x(T),q.push(n.approval(t,u.curve,r.toString(),h));let de=ge(W);Te={base:$(w,de.base),creator:$(w,de.creator),snipe:$(w,de.snipe)},ie=`Curve fees included: ${A} base, ${N} creator and ${ue} opening-tax basis points, each rounded separately.`,q.push(re(u.curve,ke({abi:ne,functionName:s?"buy":"sell",args:[r,V??b,i]}),s&&v?r:0n,s?`Buy Pons curve tokens with ${j}.`:`Sell Pons curve tokens for ${j}.`))}else{if(r>Oe)throw new d("Trade amount exceeds the router uint128 range.");let m=Se(u.pairToken,t,u.poolFee,u.tickSpacing),k=s?y(u.pairToken):t,S=s?t:y(u.pairToken),A=P(k,m.currency0);if(T=(await a.simulateContract({address:Q.quoter.address,abi:Ue,functionName:"quoteExactInputSingle",args:[{poolKey:m,zeroForOne:A,exactAmount:r,hookData:"0x"}],account:i,gas:Pe,blockNumber:l.number})).result[0],b=x(T),b>Oe)throw new d("Minimum output exceeds the router uint128 range.");let C=l.timestamp+300n;if(C>=1n<<48n)throw new d("Permit2 expiry exceeds its timestamp range.");k!==L&&(q.push(n.approval(k,Q.permit2.address,r.toString(),h)),q.push(re(Q.permit2.address,ke({abi:ze,functionName:"approve",args:[k,Q.universal_router.address,r,Number(C)]}),0n,"Approve the exact token amount to the Pons router through Permit2 for five minutes.")));let M=[ee(Le,[{poolKey:m,zeroForOne:A,amountIn:r,amountOutMinimum:b,minHopPriceX36:0n,hookData:"0x"}]),ee(te("address,uint256"),[k,r]),ee(te("address,uint256"),[S,b])],J=ee(te("bytes,bytes[]"),["0x060c0f",M]);q.push(re(Q.universal_router.address,ke({abi:He,functionName:"execute",args:["0x10",[J],C]}),k===L?r:0n,"Trade through Pons Universal Router v2.1.2.")),ie="Quoter output is net of Pons hook fees; no additional fee is subtracted."}if(T<=0n||b<=0n||b>we||(V??b)>we)throw new d("Trade output or minimum is outside the supported positive range.");let ve=f?{changes:[],summary:"Quote only; preview is required before sending."}:await n.preview(q,i),ae=r-O;return{txs:q,changes:ve.changes,summary:`${s?"Buy":"Sell"} ${G.symbol} (${G.address}) on chain ${h}${v?"":` ${s?"with":"for"} ${j}`}. ${ie} ${u.phase===0?`${Me} `:""}${ae>0n?`Expected ${v?"native refund":"refund"}: ${n.formatAmount(ae.toString(),w.decimals)} ${w.symbol}; minimum output uses the expected spend after refund. `:""}${ve.summary}`,pairToken:w,quote:{phase:u.phase,amountIn:$(oe,r),amountOut:$(se,T),minAmountOut:$(se,b),minimumKind:"absolute",calldataMinAmountOut:$(se,V??b),expectedSpend:$(oe,O),expectedRefund:$(oe,ae),fees:Te,blockNumber:l.number.toString(),blockTimestamp:l.timestamp.toString()}}}function cn(n){return Qe(n,!0)}function Qe(n,o=!1,i){let s=new Map,f=e=>{if(BigInt(Z())>=BigInt(e.expiresAt))throw new he};return{name:"pons",async quote(e,c){if(e={...e,from:z(e.from),to:z(e.to)},_(e.from)&&_(e.to))throw new Y("Pons quotes require a launch token and its pair token.");let t=_(e.from)||!_(e.to)&&await Ge(n,e.from,e.to,i),r=Z(),p=await _e(n,{token:t?e.to:e.from,amountIn:e.amountIn,slippageBps:e.slippageBps,pairToken:y(t?e.from:e.to)},c,t,{quoteOnly:!0,curveOnly:o,blockNumber:i}),x=p.txs.at(-1),a=p.quote,l=String(BigInt(i===void 0?r:a.blockTimestamp)+BigInt(Ie)),u=a.minAmountOut.amount,v=a.fees,E=_(p.pairToken.address)?"native ETH base units (18 decimals)":`${p.pairToken.symbol} (${p.pairToken.address}) base units (${p.pairToken.decimals} decimals)`,X=v?`Pons curve fees included in net output: ${v.base.amount} base, ${v.creator.amount} creator and ${v.snipe.amount} opening tax, in ${E}. Oak swap fee: 0 (venue fee is never Oak income). ${Xe}`:"Quoter output is net of Pons hook fees; no additional fee is subtracted. Oak swap fee: 0.",B=qe({...e,quoteId:`pons:${Fe()}`,provider:"pons",wallet:c,chainId:h,router:x.to,spender:a.phase===0?x.to:Q.permit2.address,expiresAt:l,data:x.data,value:x.value,amountOut:a.amountOut.amount,minAmountOut:u,blockNumber:a.blockNumber,...a.phase===0?{ponsCurveToken:t?e.to:e.from,calldataMinAmountOut:a.calldataMinAmountOut.amount}:{ponsPoolToken:t?e.to:e.from},expectedSpend:a.expectedSpend.amount,expectedRefund:a.expectedRefund.amount,feeDisclosure:X,oakFee:"0"});be(x,B),f(B);for(let[F,U]of s)BigInt(Z())>=BigInt(U.quote.expiresAt)&&s.delete(F);for(;s.size>=$e;)s.delete(s.keys().next().value);return s.set(B.quoteId,{quote:{...B},txs:p.txs.map(F=>({...F})),summary:p.summary}),B},async build(e,c){let t=s.get(e);if(!t)throw new he;if(f(t.quote),R(c),!P(c,t.quote.wallet))throw new d("Quote was issued for a different wallet.");let r=t.txs.map(a=>({...a}));be(r.at(-1),t.quote);let p=await n.preview(r,c);if(f(t.quote),p.changes.filter(a=>P(z(a.token.address),z(t.quote.to))).reduce((a,l)=>a+BigInt(l.amount),0n)<BigInt(t.quote.minAmountOut))throw new d("Preview retained output is below the accepted minimum.");return{txs:r,summary:`${t.summary} ${p.summary} ${t.quote.feeDisclosure}`}}}}async function De(n,o,i){return n.clientFor(h).readContract({address:Ne.factory.address,abi:Ce,functionName:"getLaunchedToken",args:[D(o)],...i===void 0?{}:{blockNumber:i}})}async function Ge(n,o,i,s){let f=await De(n,i,s);return f.exists&&P(f.token,i)&&P(y(f.pairToken),y(o))}async function pn(n,o,i,s,f){if(typeof i.token!="string")throw new d("Provide a launch token address.");R(i.token);let e=D(i.token),c=await De(n,e,f);if(!c.exists||!P(c.token,e))throw new d("This address is not a Pons launch token.");let t=y(c.pairToken)===L?le:D(c.pairToken);return Re(i.pairToken,D(c.pairToken),o,t),{quote:await Qe(n,!1,f).quote({from:o?t:e,to:o?e:t,amountIn:String(i.amountIn),...i.slippageBps===void 0?{}:{slippageBps:i.slippageBps}},s),input:o?t:e}}var Ve=n=>({tools:[!0,!1].map(o=>({name:o?"pons_buy":"pons_sell",inputSchema:je,async execute(i,s){try{return await _e(n,i,s,o)}catch(f){throw new d(n.plainError(f))}}}))}),mn=Ve;export{cn as a,Qe as b,pn as c,Ve as d,mn as e};
@@ -1 +0,0 @@
1
- import{a as D}from"./TNLHMDWL.js";import{a as L}from"./4X2JOQ2L.js";import{b as _}from"./AXYOJBX6.js";import{a as P}from"./6IM6A5VA.js";import{c as z}from"./MYBDO5SA.js";import{c as y,e as b,g as A,i as E,l as N}from"./73N3TOJL.js";import{a as S}from"./RETS2ZEK.js";import{a as l,i as I}from"./G6HCV67X.js";import{a as u}from"./5YS5V2LK.js";import{encodeFunctionData as C,parseAbi as X,zeroAddress as v}from"viem";import{encodeAbiParameters as H,encodeFunctionData as q,keccak256 as B,parseAbi as G}from"viem";var R=I[l].merkl.distributor.address,w="Claim rewards on Merkl (Powered by Merkl \u2014 https://app.merkl.xyz)",O=`${w}. No claimable rewards on Robinhood Chain. Pending rewards must settle into a Merkle root before they can be claimed.`,T=G(["function claimed(address user,address token) view returns (uint208 amount,uint48 timestamp,bytes32 merkleRoot)","function getMerkleRoot() view returns (bytes32)","function claim(address[] users,address[] tokens,uint256[] amounts,bytes32[][] proofs)"]);function U(o){return typeof o=="string"&&/^0x[0-9a-fA-F]{64}$/.test(o)}function p(){throw new u("Merkl returned an unexpected response. Please refetch rewards.")}function x(o){typeof o!="string"&&p();let d=S(o);if(d>=1n<<256n)throw new u("The Merkl reward amount exceeds the uint256 range.");return d.toString()}function J(o){let d=[],m=new Set;for(let c of o)if((!b(c)||!b(c.chain)||!Number.isSafeInteger(c.chain.id))&&p(),c.chain.id===l){Array.isArray(c.rewards)||p();for(let r of c.rewards){if((!b(r)||typeof r.distributionLayer!="string"||!b(r.token))&&p(),r.distributionLayer!=="TREE"||(Number.isSafeInteger(r.token.chainId)||p(),r.token.chainId!==l)||(Array.isArray(r.proofs)||p(),!r.proofs.length))continue;(!r.proofs.every(U)||typeof r.token.address!="string"||typeof r.token.symbol!="string"||!r.token.symbol.trim()||typeof r.token.decimals!="number"||!Number.isInteger(r.token.decimals)||r.token.decimals<0||r.token.decimals>255)&&p(),P(r.token.address);let t=x(r.amount),e=x(r.pending);if(BigInt(t)===0n)continue;let n=r.token.address.toLowerCase();if(m.has(n))throw new u("Merkl returned duplicate token leaves. Please refetch rewards.");m.add(n),d.push({token:{address:r.token.address,chainId:l,decimals:r.token.decimals,symbol:r.token.symbol},amount:t,pending:e,proofs:r.proofs})}}return d}function K(o,d,m){let c=B(H([{type:"address"},{type:"address"},{type:"uint256"}],[o,d.token.address,BigInt(d.amount)]));for(let r of d.proofs){let t=BigInt(c)<BigInt(r)?[c,r]:[r,c];c=B(H([{type:"bytes32"},{type:"bytes32"}],t))}if(!A(c,m))throw new u("The Merkl proof does not match the active root. Please refetch rewards.")}function j(o){if(!b(o)||Object.keys(o).length)throw new u("This Merkl tool takes no arguments and uses the connected wallet.")}async function Q(o,d){let m=await W(o,d),c=[],r=new Set;for(let t of m)if((!b(t)||!b(t.chain)||!Number.isSafeInteger(t.chain.id))&&p(),t.chain.id===l){Array.isArray(t.rewards)||p();for(let e of t.rewards){if((!b(e)||typeof e.distributionLayer!="string"||!b(e.token)||!Number.isSafeInteger(e.token.chainId))&&p(),e.token.chainId!==l)continue;(typeof e.token.address!="string"||typeof e.token.symbol!="string"||!e.token.symbol.trim()||typeof e.token.decimals!="number"||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)&&p(),P(e.token.address);let n=x(e.amount),i=x(e.pending),s=`${e.distributionLayer}:${e.token.address.toLowerCase()}`;if(r.has(s))throw new u("Merkl returned duplicate earning rows. Please refetch rewards.");r.add(s);let a={address:e.token.address,symbol:e.token.symbol,decimals:e.token.decimals,chainId:l},k="0";if(e.distributionLayer==="TREE"){let h=await o.clientFor(l).readContract({address:R,abi:T,functionName:"claimed",args:[d,a.address]});(!Array.isArray(h)||typeof h[0]!="bigint"||h[0]<0n||h[0]>=1n<<208n)&&p(),k=h[0].toString()}c.push({token:a,amount:n,pending:i,claimed:k,claimable:"0",distributionLayer:e.distributionLayer,status:e.distributionLayer!=="TREE"?"unsupported_distribution_layer":BigInt(n)>BigInt(k)?"awaiting_verified_proof":BigInt(i)>0n?"pending_settlement":"settled"})}}return{body:m,earnings:c}}async function W(o,d){return P(d),z(o.http,`https://api.merkl.xyz/v4/users/${d}/rewards/summary?chainId=${l}`,{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},m=>Array.isArray(m))}async function $(o,d,m){P(d);let c=J(m??await W(o,d)),r=o.clientFor(l),t=[];for(let n of c){let i=await r.readContract({address:R,abi:T,functionName:"claimed",args:[d,n.token.address]});if(!Array.isArray(i)||typeof i[0]!="bigint"||i[0]<0n||i[0]>=1n<<208n)throw new u("The Merkl claimed balance could not be read. Please try again.");BigInt(n.amount)<=i[0]||t.push({...n,claimed:i[0].toString(),claimable:(BigInt(n.amount)-i[0]).toString()})}if(!t.length)return[];let e=await r.readContract({address:R,abi:T,functionName:"getMerkleRoot"});if(!U(e))throw new u("The active Merkl root could not be read. Please try again.");for(let n of t)K(d,n,e);return t}var V=o=>{async function d(t){try{return await t()}catch(e){throw new u(o.plainError(e))}}function m(t){let e=t.amount.startsWith("-"),n=e?t.amount.slice(1):t.amount;return`${e?"-":""}${o.formatAmount(n,t.token.decimals)} ${t.token.symbol} (${t.token.address}, chain ${t.token.chainId}, ${t.token.decimals} decimals)`}let c=t=>$(o,t);return{tools:[{name:"merkl_rewards",description:"Read claimable rewards (Powered by Merkl \u2014 https://app.merkl.xyz).",inputSchema:{type:"object",properties:{},additionalProperties:!1,description:"Read rewards (Powered by Merkl \u2014 https://app.merkl.xyz)."},execute:(t,e)=>d(async()=>{j(t);let{body:n,earnings:i}=await Q(o,e),s=await $(o,e,n);for(let a of i){let k=s.find(h=>A(h.token.address,a.token.address)&&a.distributionLayer==="TREE");k&&(a.claimed=k.claimed,a.claimable=k.claimable,a.status="claimable")}return{earnings:i,rewards:s.map(({proofs:a,...k})=>k),summary:s.length?`${w}. Claimable reward leaves: ${s.map(a=>m({token:a.token,amount:a.claimable})).join("; ")}. Wrapped leaves may transfer underlying tokens; claim preview shows the received assets. Pending rewards appear separately in earnings and are excluded from claimable amounts.`:`${O} Earnings include pending-only and unsupported distribution layers; an unverified amount is never presented as claimable.`}})},{name:"merkl_claim",description:w,inputSchema:{type:"object",properties:{},additionalProperties:!1,description:w},execute:(t,e)=>d(async()=>{j(t);let n=await c(e);if(!n.length)return{txs:[],summary:O};let i=[o.unsignedTx({to:R,chainId:l,value:"0",description:w,data:q({abi:T,functionName:"claim",args:[n.map(()=>e),n.map(a=>a.token.address),n.map(a=>BigInt(a.amount)),n.map(a=>a.proofs)]})})],s=await o.preview(i,e);return{txs:i,summary:`${w}. Prepared unsigned claim. Expected wallet changes: ${s.changes.length?s.changes.map(m).join("; "):"no token transfers in simulation"}. ${s.summary}`}})}],positions:t=>d(async()=>(await c(t)).map(e=>({module:"merkl",id:`${l}:${e.token.address.toLowerCase()}`,chainId:l,assets:[{token:e.token,amount:e.claimable}],description:`${w}. Unclaimed reward leaf; wrapped rewards may transfer underlying assets. Pending rewards are excluded.`})))}},me=o=>_("merkl",[V(o),D(o),F(o),L(o)]);var M=I[l].merkl.distributor.address,g=X(["function operators(address,address) view returns (uint256)","function claimRecipient(address,address) view returns (address)","function toggleOperator(address,address)","function setClaimRecipient(address,address)","function claim(address[],address[],uint256[],bytes32[][])","function claimWithRecipient(address[],address[],uint256[],bytes32[][],address[],bytes[])"]),Z="Provide a valid address.";function f(o,d=!1){let m=E(o,Z);return d?m:N(m,Z)}var F=o=>{let d=()=>o.clientFor(l),m=async(r,t,e)=>{let n=[o.unsignedTx({to:M,chainId:l,value:"0",data:r,description:t})],i=await o.preview(n,e);return{txs:n,preview:i,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${t} ${i.summary}`}},c=(r,t,e,n)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:t,required:e,additionalProperties:!1},execute:async(i,s)=>{try{let a=Object.keys(i).find(k=>!Object.hasOwn(t,k));if(a)throw new u(`Unsupported Merkl input: ${a}.`);return await n(i,f(s))}catch(a){throw new u(o.plainError(a))}}});return{tools:[c("claim_config",{token:y,operator:y},[],async(r,t)=>{let e=f(r.token??v,!0),n=f(await d().readContract({address:M,abi:g,functionName:"claimRecipient",args:[t,v]}),!0),i=f(await d().readContract({address:M,abi:g,functionName:"claimRecipient",args:[t,e]}),!0),s;if(r.operator!==void 0){let a=await d().readContract({address:M,abi:g,functionName:"operators",args:[t,f(r.operator,!0)]});if(a!==0n&&a!==1n)throw new u("Merkl returned invalid operator authorization.");s=a===1n}return{chainId:l,wallet:t,token:e,defaultRecipient:n,tokenRecipient:i,effectiveRecipient:i!==v?i:n!==v?n:t,...s===void 0?{}:{operatorEnabled:s},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Zero recipient restores self-claims. Token overrides take precedence over the global recipient."}}),c("set_operator",{operator:y,enabled:{type:"boolean"}},["operator","enabled"],async(r,t)=>{let e=f(r.operator,!0);if(typeof r.enabled!="boolean")throw new u("Provide enabled as boolean.");let n=await d().readContract({address:M,abi:g,functionName:"operators",args:[t,e]});if(n!==0n&&n!==1n)throw new u("Merkl returned invalid operator authorization.");return n===1n===r.enabled?{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Operator already has the requested state; no transaction needed."}:m(C({abi:g,functionName:"toggleOperator",args:[t,e]}),`${r.enabled?"Authorize":"Revoke"} Merkl claims by ${e} for ${t}. Zero operator grants permissionless claiming; configured recipients still apply. The contract toggles the observed state; preview and confirmation must remain current.`,t)}),c("set_recipient",{recipient:y,token:y},["recipient"],async(r,t)=>{let e=f(r.recipient,!0),n=f(r.token??v,!0);return m(C({abi:g,functionName:"setClaimRecipient",args:[e,n]}),`Set Merkl reward recipient for ${n===v?"all tokens":n} to ${e===v?`self (${t})`:e}. This redirects future claims; token-specific overrides remain authoritative.`,t)}),c("claim_to",{recipient:y,token:y,data:{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:16386}},["recipient"],async(r,t)=>{let e=f(r.recipient),n=r.token===void 0?void 0:f(r.token),i=r.data??"0x";if(typeof i!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(i)||i.length>16386)throw new u("Provide callback data as at most 8192 hexadecimal bytes.");let s=(await $(o,t)).filter(a=>!n||A(a.token.address,n));return s.length?m(C({abi:g,functionName:"claimWithRecipient",args:[s.map(()=>t),s.map(a=>a.token.address),s.map(a=>BigInt(a.amount)),s.map(a=>a.proofs),s.map(()=>e),s.map(()=>i)]}),`Claim ${s.map(a=>`${a.claimable} ${a.token.symbol} base units (token ${a.token.address}, decimals ${a.token.decimals})`).join("; ")} to ${e}, overriding saved claim recipients for this claim only. Callback data for each leaf: ${i}. Inspect all callback effects in preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for the selected token."}}),c("claim_for",{user:y,token:y},["user"],async(r,t)=>{let e=f(r.user),n=r.token===void 0?void 0:f(r.token),i=(await $(o,e)).filter(s=>!n||A(s.token.address,n));return i.length?m(C({abi:g,functionName:"claim",args:[i.map(()=>e),i.map(s=>s.token.address),i.map(s=>BigInt(s.amount)),i.map(s=>s.proofs)]}),`Claim Merkl rewards for ${e}; caller ${t} pays gas. The user's saved recipients control payment. Claim authorization and actual receipts must pass preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for this user."}})]}};export{F as a,$ as b,V as c,me as d};
@@ -1 +0,0 @@
1
- import{a as r}from"./5YS5V2LK.js";var s=4663,a=46630,p=18,f=6,A=30,h="recipient",v="direct",P="totalSupply",o={4663:{pons:{factory:{address:"0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e",source:"Recorded chain and API observations",pointer:"/pons/factory",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},launchAndBuyRouter:{address:"0xe33E9E479dF8802cb0866d5d05258bEc4cF62948",source:"Recorded chain and API observations",pointer:"/pons/launchAndBuyRouter",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},memeHook:{address:"0xE5e702641Ea86F4ae6cC3cDaeD2B886f976Be044",source:"Recorded chain and API observations",pointer:"/pons/memeHook",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},feeEscrow:{address:"0xd3AFEB2a57f70eF218Aa82451c51B2fb0416Ac9e",source:"Recorded chain and API observations",pointer:"/pons/feeEscrow",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},buybackVault:{address:"0x42df2a798f82289E177311362e8f5ccC45c1219c",source:"Recorded chain and API observations",pointer:"/pons/buybackVault",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},locker:{address:"0x267444D099b10fB5Ed7c3Cc7B7c767AdcA574952",source:"Recorded chain and API observations",pointer:"/pons/locker",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},launchDeployer:{address:"0x3711ceA4feaDE896C913C68F01Eda97Cb06D1A42",source:"Recorded chain and API observations",pointer:"/pons/launchDeployer",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},graduationExecutor:{address:"0xC7819B64A1dAECD7eC19856d026cb14EfBd89046",source:"Recorded chain and API observations",pointer:"/pons/graduationExecutor",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},graduationGuard:{address:"0xf5695117b99B6f6401e67d4195BD653628176C6C",source:"Recorded chain and API observations",pointer:"/pons/graduationGuard",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},poolManager:{address:"0x8366a39CC670B4001A1121B8F6A443A643e40951",source:"Recorded chain and API observations",pointer:"/pons/poolManager",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"},positionManager:{address:"0x58daec3116aae6D93017bAAea7749052E8a04fA7",source:"Recorded chain and API observations",pointer:"/pons/positionManager",block:"100307770",blockKind:"read",blockPointer:"/pinnedBlocks/ponsReads"}},oracle:{ethUsdgPool:{address:"0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca",source:"Recorded chain and API observations",pointer:"/ethUsdgPool/address",block:"100307735",blockKind:"read",blockPointer:"/ethUsdgPool/rawReading/block"}},tokens:{USDG:{address:"0x5fc5360d0400a0fd4f2af552add042d716f1d168",source:"Recorded chain and API observations",pointer:"/usdg/address",block:null,blockKind:"latest",caveat:"Token reads around head 100305826; not individually pinned (Part B section 1.2)."},WETH:{address:"0x0bd7d308f8e1639fab988df18a8011f41eacad73",source:"Recorded chain and API observations",pointer:"/routers/wrappedNative",block:null,blockKind:"latest"}},routes:{kyberswap:{address:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",source:"Recorded chain and API observations",pointer:"/routers/kyberswap/router",block:null,blockKind:"latest",caveat:"Historical API target; validate each fresh quote/build chain and target."},velora:{address:"0x6a000f20005980200259b80c5102003040001068",source:"Recorded chain and API observations",pointer:"/routers/velora/router",block:null,blockKind:"latest",caveat:"Historical API target; validate each fresh quote/build chain and target."}},ponsClaims:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",source:"Recorded chain and API observations",pointer:"/addresses/multicall3/address",block:null,blockKind:"unanchored",caveat:"Code present in the source snapshot; exact code-read block not recorded."}},ponsTrade:{universal_router:{address:"0x204faca1764b154221e35c0d20abb3c525710498",source:"Recorded chain and API observations",pointer:"/contracts/universal_router/address",block:"100372649",blockKind:"read",blockPointer:"/limitations/0"},pool_manager:{address:"0x8366a39cc670b4001a1121b8f6a443a643e40951",source:"Recorded chain and API observations",pointer:"/contracts/pool_manager/address",block:"100372649",blockKind:"read",blockPointer:"/limitations/0"},state_view:{address:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b",source:"Recorded chain and API observations",pointer:"/contracts/state_view/address",block:"100372649",blockKind:"read",blockPointer:"/limitations/0"},quoter:{address:"0x8dc178efb8111bb0973dd9d722ebeff267c98f94",source:"Recorded chain and API observations",pointer:"/contracts/quoter/address",block:"100372649",blockKind:"read",blockPointer:"/limitations/0"},permit2:{address:"0x000000000022d473030f116ddee9f6b43ac78ba3",source:"Recorded chain and API observations",pointer:"/contracts/permit2/address",block:"100372649",blockKind:"read",blockPointer:"/limitations/0"}},uniswap:{v3_factory:{address:"0x1f7d7550b1b028f7571e69a784071f0205fd2efa",source:"Recorded chain and API observations",pointer:"/addresses/v3_factory/address",block:"100361663",blockKind:"snapshot",blockPointer:"/snapshots/v3_block/number"},v3_position_manager:{address:"0x73991a25c818bf1f1128deaab1492d45638de0d3",source:"Recorded chain and API observations",pointer:"/addresses/v3_position_manager/address",block:"100361663",blockKind:"snapshot",blockPointer:"/snapshots/v3_block/number"},v4_pool_manager:{address:"0x8366a39cc670b4001a1121b8f6a443a643e40951",source:"Recorded chain and API observations",pointer:"/addresses/v4_pool_manager/address",block:"100363029",blockKind:"snapshot",blockPointer:"/snapshots/v4_block"},v4_position_manager:{address:"0x58daec3116aae6d93017baaea7749052e8a04fa7",source:"Recorded chain and API observations",pointer:"/addresses/v4_position_manager/address",block:"100363029",blockKind:"snapshot",blockPointer:"/snapshots/v4_block"},v4_state_view:{address:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b",source:"Recorded chain and API observations",pointer:"/addresses/v4_state_view/address",block:"100363029",blockKind:"snapshot",blockPointer:"/snapshots/v4_block"},swap_router02:{address:"0xcaf681a66d020601342297493863e78c959e5cb2",source:"Recorded chain and API observations",pointer:"/addresses/swap_router02/address",block:"100361663",blockKind:"snapshot",blockPointer:"/snapshots/v3_block/number"},permit2:{address:"0x000000000022d473030f116ddee9f6b43ac78ba3",source:"Recorded chain and API observations",pointer:"/addresses/permit2/address",block:"100361663",blockKind:"snapshot",blockPointer:"/snapshots/v3_block/number"},WETH:{address:"0x0bd7d308f8e1639fab988df18a8011f41eacad73",source:"Recorded chain and API observations",pointer:"/addresses/WETH/address",block:"100361663",blockKind:"snapshot",blockPointer:"/snapshots/v3_block/number"},USDG:{address:"0x5fc5360d0400a0fd4f2af552add042d716f1d168",source:"Recorded chain and API observations",pointer:"/addresses/USDG/address",block:"100361663",blockKind:"snapshot",blockPointer:"/snapshots/v3_block/number"}},clanker:{factory:{address:"0xD3f2cC1731b7Fd17f28798835C2E02f0a1839A94",source:"Recorded chain and API observations",pointer:"/contracts/factory/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},locker:{address:"0xE4910b09709423aFafD995dD76D8A81CF9134A09",source:"Recorded chain and API observations",pointer:"/contracts/locker/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},legacy_locker_v1:{address:"0x290f735f63824bb5836cde24a35f5103a5b5bc99",source:"Recorded chain and API observations",pointer:"/contracts/legacy_locker_v1/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},fee_locker:{address:"0x88db2340bE5991B2b5Fca2Baee39B5CE048Cd70c",source:"Recorded chain and API observations",pointer:"/contracts/fee_locker/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},fee_static_hook_v2:{address:"0x48B8F6AD3A1b4aA477314c9a23035b8F84dDe8cc",source:"Recorded chain and API observations",pointer:"/contracts/fee_static_hook_v2/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},fee_dynamic_hook_v2:{address:"0x65efDF8Cce99b53C925DF878Df275Df21cB6E8Cc",source:"Recorded chain and API observations",pointer:"/contracts/fee_dynamic_hook_v2/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},mev_module:{address:"0xEA1Fe197dF140e5d88fC6B49f2d21Ea05092299e",source:"Recorded chain and API observations",pointer:"/contracts/mev_module/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},devbuy:{address:"0xa27b1986e5c7e5371Cb6507f87918fBD0302fF5a",source:"Recorded chain and API observations",pointer:"/contracts/devbuy/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},vault:{address:"0x99B2a80ed21c7af1F5cc1A97383DADeEC7DD1427",source:"Recorded chain and API observations",pointer:"/contracts/vault/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},airdrop:{address:"0x6f27372FF493A3855E6746b9a4fe6Ed2Cc3034B5",source:"Recorded chain and API observations",pointer:"/contracts/airdrop/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},paired_weth:{address:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",source:"Recorded chain and API observations",pointer:"/contracts/paired_weth/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"}},clankerDependencies:{pool_manager:{address:"0x8366a39CC670B4001A1121B8F6A443A643e40951",source:"Recorded chain and API observations",pointer:"/contracts/uniswap_v4_dependencies/pool_manager/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},position_manager:{address:"0x58daec3116aae6D93017bAAea7749052E8a04fA7",source:"Recorded chain and API observations",pointer:"/contracts/uniswap_v4_dependencies/position_manager/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},universal_router:{address:"0x53BF6B0684Ec7eF91e1387Da3D1a1769bC5A6F77",source:"Recorded chain and API observations",pointer:"/contracts/uniswap_v4_dependencies/universal_router/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"},permit2:{address:"0x000000000022D473030F116dDEE9F6B43aC78BA3",source:"Recorded chain and API observations",pointer:"/contracts/uniswap_v4_dependencies/permit2/address",block:"100375756",blockKind:"fork",blockPointer:"/chain/fork_block_number"}},hoodag:{registry:{address:"0x3E717dc89AAF4605b607324329EEeB0a8B3C8A1c",source:"Recorded chain and API observations",pointer:"/contracts/registry/address",block:null,blockKind:"range",blockPointer:"/measuredBlockRange"},universalResolver:{address:"0xa9ed3C73F522875F18DAa631429125da893D8E53",source:"Recorded chain and API observations",pointer:"/contracts/universalResolver/address",block:null,blockKind:"range",blockPointer:"/measuredBlockRange"},registrar:{address:"0x9a122C54e15B6287c164b90833bcDA6E16520D50",source:"Recorded chain and API observations",pointer:"/contracts/registrar/address",block:null,blockKind:"range",blockPointer:"/measuredBlockRange"},publicResolver:{address:"0x072C7a66a6D52B23274470b86096AFCBF816CA0B",source:"Recorded chain and API observations",pointer:"/contracts/publicResolver/address",block:null,blockKind:"range",blockPointer:"/measuredBlockRange"},registrarController:{address:"0x7900b2B8Cc3f0616B18C68AdA7E115A9022Ca04a",source:"Recorded chain and API observations",pointer:"/contracts/registrarController/address",block:null,blockKind:"range",blockPointer:"/measuredBlockRange"},reverseRegistrar:{address:"0x4be6D0379f56404B563afAe17c6b095b1dfcf479",source:"Recorded chain and API observations",pointer:"/contracts/reverseRegistrar/address",block:null,blockKind:"range",blockPointer:"/measuredBlockRange"}},hoodlock:{locker:{address:"0xd0f7d8c6e9f6d80c297bebe4f7fd1b9c8125c32f",source:"Recorded chain and API observations",pointer:"/contracts/locker/address",block:"100356379",blockKind:"read",blockPointer:"/chain/liveStateBlock"},burner:{address:"0x6bf43ca706faa8ea46803299c191484e82280652",source:"Recorded chain and API observations",pointer:"/contracts/burner/address",block:"100356379",blockKind:"read",blockPointer:"/chain/liveStateBlock"},airdrop:{address:"0x6B1fE7b821001144Ee74EEA258b0AafdE20102E8",source:"Recorded chain and API observations",pointer:"/contracts/airdrop/address",block:"100356379",blockKind:"read",blockPointer:"/chain/liveStateBlock"},liquidityLocker:{address:"0x91Aa2dA1956C77F8448E18DCaf53383bCc658e67",source:"Recorded chain and API observations",pointer:"/contracts/liquidityLocker/address",block:"100356379",blockKind:"read",blockPointer:"/chain/liveStateBlock"}},hookrLauncherV1:{launcherV1:{address:"0x70a66ADF39B5c9FfEE4A9F081C182edfbb7DBD0C",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/launcherV1",block:"104346779",blockKind:"read"},rootV1:{address:"0x89c9FB50d1f03192230FFB1c279BB6E7d3Fe6aCc",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/rootV1",block:"104346779",blockKind:"read"},rulesV1:{address:"0x342bAA22e202954593b04B7eD1663621E0565d46",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/rulesV1",block:"104346779",blockKind:"read"},agentGateV1:{address:"0x3b1aC66a6Fd9e9d8F063d145003cf29eac4Fb0C9",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/agentGateV1",block:"104346779",blockKind:"read"},familyRouterV1:{address:"0xbc56F48f873841d26a5a02575263d82f68e12864",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/familyRouterV1",block:"104346779",blockKind:"read"},familyLockV1:{address:"0x5248AF9139DaDEf0C5296342b7BE441deDf0adC2",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/familyLockV1",block:"104346779",blockKind:"read"},poolManager:{address:"0x8366a39CC670B4001A1121B8F6A443A643e40951",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/poolManager",block:"104346779",blockKind:"read"},positionManager:{address:"0x58daec3116aae6D93017bAAea7749052E8a04fA7",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/positionManager",block:"104346779",blockKind:"read"},permit2:{address:"0x000000000022D473030F116dDEE9F6B43aC78BA3",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/permit2",block:"104346779",blockKind:"read"},registry:{address:"0x463c82beA1a52F4Cc05ca0741a24F0AD24bA4602",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/registry",block:"104346779",blockKind:"read"},router:{address:"0xC2Bc9a3fe6c4Ce8C2F7EB4655b0869b01D8c93C9",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/router",block:"104346779",blockKind:"read"},identity:{address:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/identity",block:"104346779",blockKind:"read"},reputation:{address:"0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",source:"Hookr verified sources and named-block runtime reads",pointer:"ops/growth/hookr-launch-lp-2026-11/DESIGN.md#deployments-and-release-boundaries/reputation",block:"104346779",blockKind:"read"}},hookr:{HookrLimitOrders:{address:"0x0c376cc30b1AC98b8ef80a4F516212D3B99402fA",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrLimitOrders/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrRoot:{address:"0x89c9FB50d1f03192230FFB1c279BB6E7d3Fe6aCc",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrRoot/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrRouter:{address:"0xC2Bc9a3fe6c4Ce8C2F7EB4655b0869b01D8c93C9",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrRouter/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrQuoter:{address:"0x445D7891381Aa7F91F5048EdBC6a611ccBDe7865",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrQuoter/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrLauncher:{address:"0x1cf2748A6670572425eAbf9Ab9e5BC4eb2eB8Ef4",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrLauncher/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrRules:{address:"0x4a71c270b1520F94064268102AebD744b0DE7942",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrRules/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrRegistry:{address:"0x463c82beA1a52F4Cc05ca0741a24F0AD24bA4602",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrRegistry/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrTreasury:{address:"0x2242F7FC75606500503075f29ea8cDA684EfB4a9",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrTreasury/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrForwarder:{address:"0xe7863CC0E2Fb783b44c279aB159bcD812c2ceA1c",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrForwarder/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrOwnedRootFactory:{address:"0xA6c2a401597301dFf57A59bC8F70a9622499f3ec",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrOwnedRootFactory/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrRootFactory:{address:"0x21E438FaBE10770afb4407cF6b09d32369CBdCE4",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrRootFactory/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrFamilyRouter:{address:"0x854f3Fa7AC342B244DF0d9A8c8F597b051aAE559",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrFamilyRouter/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HookrFamilyLock:{address:"0xfAFEcE64099C1E791C4B46189c277f00c0c7e00b",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HookrFamilyLock/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},PoolManager:{address:"0x8366a39CC670B4001A1121B8F6A443A643e40951",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/PoolManager/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"},HOOKR_Token:{address:"0x18E674231A58c239Dc7DaeDcffE15Ec3A24cff5c",source:"Recorded chain and API observations",pointer:"/q1_liveness/contracts/HOOKR_Token/address",block:"100371423",blockKind:"fork",blockPointer:"/fork_block_number"}},merkl:{distributor:{address:"0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae",source:"Recorded chain and API observations",pointer:"/contracts/distributor/address",block:null,blockKind:"latest"},distributionCreator:{address:"0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd",source:"Recorded chain and API observations",pointer:"/contracts/distributionCreator/address",block:null,blockKind:"latest"},accessControlManager:{address:"0x5D36e13F076f34eE2Bf69fEAEa784887754465f8",source:"Recorded chain and API observations",pointer:"/contracts/accessControlManager/address",block:null,blockKind:"latest"}},poolsTrade:{liquidityLauncher:{address:"0x0000FffFBE8efE702c8703aE3477FF5dE3d319C0",source:"Recorded chain and API observations",pointer:"/contracts/liquidityLauncher/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},instantLaunchStrategyFeesOn:{address:"0x7c48DDe3B447381F4d986334679b3Afc7F2D35C2",source:"Recorded chain and API observations",pointer:"/contracts/instantLaunchStrategyFeesOn/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},instantLaunchStrategyFeesOff:{address:"0xC9566675b1Ea42861546f3c5B74Ace2c79c49572",source:"Recorded chain and API observations",pointer:"/contracts/instantLaunchStrategyFeesOff/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},feeSplitterFeesOn:{address:"0x9411fa7F956f64aa7981AA27cB3bC6eC0415449C",source:"Recorded chain and API observations",pointer:"/contracts/feeSplitterFeesOn/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},feeSplitterFeesOff:{address:"0x882Ae5e2095435A62Fd1BBDEfcb637f5CeAFc0ee",source:"Recorded chain and API observations",pointer:"/contracts/feeSplitterFeesOff/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},uerc20BeneficiaryVault:{address:"0x26d2F7AcB07707034406a0dC458351Bb63C02553",source:"Recorded chain and API observations",pointer:"/contracts/uerc20BeneficiaryVault/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},compoundingClaimRecipient:{address:"0xf585b5D728A8fdE743027307BF5F3556E3B9C58D",source:"Recorded chain and API observations",pointer:"/contracts/compoundingClaimRecipient/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},universalRouterStrategyApp:{address:"0x1242c9439d589cAE85E121B1f79f2aF51e91DCEE",source:"Recorded chain and API observations",pointer:"/contracts/universalRouterStrategyApp/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},uerc20Factory:{address:"0x000000e200088D55C39a11F609E5F667729ad49b",source:"Recorded chain and API observations",pointer:"/contracts/uerc20Factory/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},universalRouter:{address:"0x8876789976dEcBfCbBbe364623C63652db8C0904",source:"Recorded chain and API observations",pointer:"/contracts/universalRouter/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},v4PoolManager:{address:"0x8366a39CC670B4001A1121B8F6A443A643e40951",source:"Recorded chain and API observations",pointer:"/contracts/v4PoolManager/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},v4PositionManager:{address:"0x58daec3116aae6D93017bAAea7749052E8a04fA7",source:"Recorded chain and API observations",pointer:"/contracts/v4PositionManager/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},permit2:{address:"0x000000000022D473030F116dDEE9F6B43aC78BA3",source:"Recorded chain and API observations",pointer:"/contracts/permit2/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},v4Quoter:{address:"0x8Dc178eFB8111BB0973Dd9d722ebeFF267c98F94",source:"Recorded chain and API observations",pointer:"/contracts/v4Quoter/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"},protocolFeeController:{address:"0x6d0009504D129CF5002Dba61D9Ae8575AA79314c",source:"Recorded chain and API observations",pointer:"/contracts/protocolFeeController/address",block:"100369897",blockKind:"census",blockPointer:"/chain/headAtFirstCensus"}},priors:{pool:{address:"0x281210097f0de7A8FB6F87310AF0f089c9C8DE21",source:"Recorded chain and API observations",pointer:"/contracts/pool/address",block:null,blockKind:"latest",blockPointer:"/recorded-calls/8"},lens:{address:"0x9d7035722bd42C551f82FEB9FDDd17453AEF3D9B",source:"Recorded chain and API observations",pointer:"/contracts/lens/address",block:null,blockKind:"latest",blockPointer:"/recorded-calls/8"},usdg:{address:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",source:"Recorded chain and API observations",pointer:"/contracts/usdg/address",block:null,blockKind:"latest",blockPointer:"/recorded-calls/8"},registry:{address:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",source:"Recorded chain and API observations",pointer:"/contracts/registry/address",block:null,blockKind:"latest",blockPointer:"/recorded-calls/8"},stockVault:{address:"0xbEcd07EC689988e16b870C121756C4c2C8cb02B6",source:"Recorded chain and API observations",pointer:"/contracts/stockVault/address",block:null,blockKind:"latest",blockPointer:"/recorded-calls/8"}},morpho:{morpho_blue:{address:"0x9D53d5E3bd5E8d4Cbfa6DB1ca238AEA02E651010",source:"Recorded chain and API observations",pointer:"/addresses/morpho_blue/address",block:"100362239",blockKind:"read",blockPointer:"/chain/read_block"},adaptive_curve_irm:{address:"0x2BD3d5965B26B51814AC95127B2b80dD6CcC0fa1",source:"Recorded chain and API observations",pointer:"/addresses/adaptive_curve_irm/address",block:"100362239",blockKind:"read",blockPointer:"/chain/read_block"},USDG:{address:"0x5fc5360d0400a0fd4f2af552add042d716f1d168",source:"Recorded chain and API observations",pointer:"/addresses/USDG/address",block:"100362239",blockKind:"read",blockPointer:"/chain/read_block"},WETH:{address:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",source:"Recorded chain and API observations",pointer:"/addresses/WETH/address",block:"100362239",blockKind:"read",blockPointer:"/chain/read_block"}},tickerSpring:{limitOrderHook:{address:"0xa31729621a2280C0Ff9Aaff5B3F357cFF1bEC040",source:"Recorded chain and API observations",pointer:"/liveness/contracts/limitOrderHook/address",block:null,blockKind:"range",blockPointer:"/chain/verifiedAtBlockRange"},gridStrategy:{address:"0xd597785134307B5324f469A9506066fAd4827730",source:"Recorded chain and API observations",pointer:"/liveness/contracts/gridStrategy/address",block:null,blockKind:"range",blockPointer:"/chain/verifiedAtBlockRange"},ladderStrategy:{address:"0x23c7906D8fa3ede698A00AbE66D28605A41b4177",source:"Recorded chain and API observations",pointer:"/liveness/contracts/ladderStrategy/address",block:null,blockKind:"range",blockPointer:"/chain/verifiedAtBlockRange"},basketZap:{address:"0xFca65c50325b83F8f1E07cD103c00De0cEa4Fb39",source:"Recorded chain and API observations",pointer:"/liveness/contracts/basketZap/address",block:null,blockKind:"range",blockPointer:"/chain/verifiedAtBlockRange"},usdg:{address:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",source:"Recorded chain and API observations",pointer:"/liveness/contracts/usdg/address",block:null,blockKind:"range",blockPointer:"/chain/verifiedAtBlockRange"}},orbio:{credit:{address:"0xe33322da1380e61e5ae5dfb21e7f62924c73004c",source:"Recorded chain and API observations",pointer:"/orbio/credit/address",block:"100313751",blockKind:"fork",caveat:"Fork anchor block recorded from chain observations; individual code reads were latest."},exchange:{address:"0x6951ffd32630b05e06f50062aea801625a58ebc0",source:"Recorded chain and API observations",pointer:"/orbio/exchange/address",block:"100313751",blockKind:"fork",caveat:"Fork anchor block recorded from chain observations; individual code reads were latest."}},vaults:{steakhouse:{address:"0xBeEff033F34C046626B8D0A041844C5d1A5409dd",source:"Recorded chain and API observations",pointer:"/vaults/eligible/0/address",block:"100320900",blockKind:"read",blockPointer:"/vaults/verifiedAtBlock",caveat:"Historical eligibility only; recheck asset and >=1e12 USDG totalAssets on every listing."},spark:{address:"0xde770c84fe66e063336b31737cfe9790f18c4087",source:"Recorded chain and API observations",pointer:"/vaults/eligible/1/address",block:"100320900",blockKind:"read",blockPointer:"/vaults/verifiedAtBlock",caveat:"Historical eligibility only; recheck asset and >=1e12 USDG totalAssets on every listing."},netnet:{address:"0x99347d5F70D3838763f6Bddcf80304C8aa953B57",source:"Recorded chain and API observations",pointer:"/vaults/eligible/2/address",block:"100320900",blockKind:"read",blockPointer:"/vaults/verifiedAtBlock",caveat:"Historical eligibility only; recheck asset and >=1e12 USDG totalAssets on every listing."},morphoV2Factory:{address:"0x0fbad98595b0186da120e41f77c102beb49f803c",source:"Recorded chain and API observations",pointer:"/vaults/morphoVaultV2Factory",block:null,blockKind:"latest"},longbowCore:{address:"0x026df18fbd2A7639089D0a16293383ec687A5Ca1",source:"Recorded chain and API observations",pointer:"/projects/0/deployments/0/address",block:"100355967",blockKind:"read",blockPointer:"/projects/0/deployments/0/read_block",caveat:"Below USDG threshold or wrong asset at measurement; deployment context only."},longbowFrontier:{address:"0x65dC90cd3a0BCDE967c8AE6019d6790b616E78F7",source:"Recorded chain and API observations",pointer:"/projects/0/deployments/1/address",block:"100355967",blockKind:"read",blockPointer:"/projects/0/deployments/1/read_block",caveat:"Below USDG threshold or wrong asset at measurement; deployment context only."},longbowEth:{address:"0xe129D4Cb2d454C4ACFAc909d1576453A9b835f61",source:"Recorded chain and API observations",pointer:"/projects/0/deployments/2/address",block:"100355967",blockKind:"read",blockPointer:"/projects/0/deployments/2/read_block",caveat:"Below USDG threshold or wrong asset at measurement; deployment context only."},beefyTestedLpVault:{address:"0xC447184BF75a84Ace3087515CCFFb54937838FC8",source:"Recorded chain and API observations",pointer:"/projects/1/tested_lp_vault",block:"100357163",blockKind:"fork",blockPointer:"/fork_environment/fork_block",caveat:"LP adapter only; not an eligible USDG ERC-4626 vault. Other per-vault/strategy addresses remain dynamic."},groveAlm:{address:"0xBEEff039907422219Fb367e525954DDC092854d9",source:"Recorded chain and API observations",pointer:"/projects/2/address",block:"100355967",blockKind:"read",blockPointer:"/raw_reads/longbow_grove_control/4/block",caveat:"Public Grove x Steakhouse USDG ERC-4626 vault; below $1M USDG threshold at measurement."}},identity:{identityRegistry:{address:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",source:"Recorded chain and API observations",pointer:"/erc8004/identityRegistry",block:null,blockKind:"latest"},reputationRegistry:{address:"0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",source:"Recorded chain and API observations",pointer:"/erc8004/reputationRegistry",block:null,blockKind:"latest"},validationRegistry:{address:"0x8004Cc8439f36fd5F9F049D9fF86523Df6dAAB58",source:"Recorded chain and API observations",pointer:"/erc8004/validationRegistry",block:null,blockKind:"latest"}},meridian:{PredictionMarketEscrow:{address:"0xE4cea507b19796362A5a28Fa7cb705A3F1866213",source:"Recorded chain and API observations",pointer:"/addresses/PredictionMarketEscrow/address",block:null,blockKind:"latest",caveat:"Code census not individually block-pinned; fork execution at 100370553 is separate."},SecondaryMarketEscrow:{address:"0x7E318ef37c3bC3d0cBA205Af2D1Fc9F9CeFEB5df",source:"Recorded chain and API observations",pointer:"/addresses/SecondaryMarketEscrow/address",block:null,blockKind:"latest",caveat:"Code census not individually block-pinned; fork execution at 100370553 is separate."},MeridianRobinhoodVault:{address:"0x79cB914f3F336426E89FaB55A9488AB25770552D",source:"Recorded chain and API observations",pointer:"/addresses/MeridianRobinhoodVault/address",block:null,blockKind:"latest",caveat:"Code census not individually block-pinned; fork execution at 100370553 is separate."},CollateralToken_USDe:{address:"0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",source:"Recorded chain and API observations",pointer:"/addresses/CollateralToken_USDe/address",block:null,blockKind:"latest",caveat:"Code census not individually block-pinned; fork execution at 100370553 is separate."}},relay:{depository:{address:"0x4cd00e387622c35bddb9b4c962c136462338bc31",source:"Recorded chain and API observations",pointer:"/addresses/depository_4663",block:"100355691",blockKind:"fork",blockPointer:"/fork/fork_block",caveat:"Only quoted depositNative path fork-tested; bridge settlement is external and unmeasured."}},lighter:{settlement:{address:"0x94bAB9693Ba2f6358507eFfcbd372b0660AFfF9d",source:"Recorded chain and API observations",pointer:"/contracts_on_4663/lighter_rh_settlement_proxy/address",block:"100355574",blockKind:"read",blockPointer:"/block_number",caveat:"Settlement/custody metadata only; funding tool uses HTTP, not this contract."}},heyResearch:{heyToken:{address:"0xB33eb16782776b4D738c0Fd643577cb0284Db610",source:"Recorded chain and API observations",pointer:"/addresses/heyToken/address",block:null,blockKind:"unanchored",caveat:"API-only tools; source has time range but no block anchor."}}},46630:{deployments:{test_USDG:{address:"0x7E955252E15c84f5768B83c41a71F9eba181802F",source:"Recorded chain and API observations",pointer:"/code_probes/0/address",block:"144387817",blockKind:"read",blockPointer:"/code_probes/0/block",caveat:"Code presence alone does not establish a complete testnet integration."},test_WETH:{address:"0x7943e237c7F95DA44E0301572D358911207852Fa",source:"Recorded chain and API observations",pointer:"/code_probes/1/address",block:"144387817",blockKind:"read",blockPointer:"/code_probes/1/block",caveat:"Code presence alone does not establish a complete testnet integration."},test_gateway:{address:"0x77bF00A6A90c600f214b34BAFBB7918c0cF113A8",source:"Recorded chain and API observations",pointer:"/code_probes/2/address",block:"144387817",blockKind:"read",blockPointer:"/code_probes/2/block",caveat:"Code presence alone does not establish a complete testnet integration."},test_identity:{address:"0x8004A818BFB912233c491871b3d84c89A494BD9e",source:"Recorded chain and API observations",pointer:"/code_probes/3/address",block:"144387817",blockKind:"read",blockPointer:"/code_probes/3/block",caveat:"Code presence alone does not establish a complete testnet integration."},test_USDG_implementation:{address:"0xf0863d7a29a55d0c4263c11bfac754312ff078df",source:"Recorded chain and API observations",pointer:"/code_probes/15/address",block:"latest",blockKind:"latest",blockPointer:"/code_probes/15/block",caveat:"Code presence alone does not establish a complete testnet integration."},facet_0xef55bec6:{address:"0x08f560a85db40a7d4ac49b4F44f1D38e5B8aB811",source:"Recorded chain and API observations",pointer:"/code_probes/17/address",block:"latest",blockKind:"latest",blockPointer:"/code_probes/17/block",caveat:"Code presence alone does not establish a complete testnet integration."},Uniswap_v4_production_poolmanager:{address:"0x8366a39CC670B4001A1121B8F6A443A643e40951",source:"Recorded chain and API observations",pointer:"/code_probes/22/address",block:"144389821",blockKind:"read",blockPointer:"/code_probes/22/block",caveat:"Code presence alone does not establish a complete testnet integration."},Uniswap_v3_community_test_candidate:{address:"0xFECCB63CD759d768538458Ea56F47eA8004323c1",source:"Recorded chain and API observations",pointer:"/code_probes/50/address",block:"144389821",blockKind:"read",blockPointer:"/code_probes/50/block",caveat:"Community v3 is not canonically endorsed; v4 native stack is incomplete."},Uniswap_v4_PositionManager:{address:"0x58daec3116aae6D93017bAAea7749052E8a04fA7",source:"Recorded chain and API observations",pointer:"/code_probes/52/address",block:"144390120",blockKind:"read",blockPointer:"/code_probes/52/block",caveat:"Code presence alone does not establish a complete testnet integration."},Uniswap_v4_Quoter:{address:"0x8Dc178eFB8111BB0973Dd9d722ebeFF267c98F94",source:"Recorded chain and API observations",pointer:"/code_probes/54/address",block:"144390120",blockKind:"read",blockPointer:"/code_probes/54/block",caveat:"Code presence alone does not establish a complete testnet integration."},Uniswap_v4_StateView:{address:"0xF3334192D15450CdD385c8B70e03f9A6bD9E673b",source:"Recorded chain and API observations",pointer:"/code_probes/56/address",block:"144390120",blockKind:"read",blockPointer:"/code_probes/56/block",caveat:"Code presence alone does not establish a complete testnet integration."},test_Permit2:{address:"0x000000000022D473030F116dDEE9F6B43aC78BA3",source:"Recorded chain and API observations",pointer:"/code_probes/77/address",block:"latest",blockKind:"latest",blockPointer:"/code_probes/77/block",caveat:"Code presence alone does not establish a complete testnet integration."},v3_test_WETH9:{address:"0x37E402B8081eFcE1D82A09a066512278006e4691",source:"Recorded chain and API observations",pointer:"/code_probes/78/address",block:"latest",blockKind:"latest",blockPointer:"/code_probes/78/block",caveat:"Community v3 is not canonically endorsed; v4 native stack is incomplete."}}}},t=o[4663].tokens.USDG.address,i=o[46630].deployments.test_USDG.address,_=o[4663].pons.factory.address,m=o[4663].pons.memeHook.address,R=o[4663].pons.poolManager.address,F=o[4663].pons.feeEscrow.address,E=o[4663].oracle.ethUsdgPool.address,l={name:"Global Dollar",version:"1",chainId:s,verifyingContract:t},b={name:"Global Dollar",version:"1",chainId:a,verifyingContract:i},d={mainnet:{chainId:s,usdg:t,usdgDomain:l,weth:o[s].tokens.WETH.address,identityRegistry:o[s].identity.identityRegistry.address},testnet:{chainId:a,usdg:i,usdgDomain:b,weth:o[a].deployments.test_WETH.address,identityRegistry:o[a].deployments.test_identity.address}};function x(e="mainnet"){if(e!=="mainnet"&&e!=="testnet")throw new r("Set OAK_NETWORK to mainnet or testnet.");return e}function C(e,c){if(c.toLowerCase()!==d[e].usdg.toLowerCase())throw new r(`USDG does not match the pinned ${e} deployment on chain ${d[e].chainId}.`)}async function B(e,c){let n=await c.getChainId();if(n!==d[e].chainId)throw new r(`RPC chain ${n} does not match OAK_NETWORK ${e} (chain ${d[e].chainId}).`)}var g={4663:{kyberswap:"0xe21fd0e9",velora:"0xe3ead59e"}},k={4663:{kyberswap:{address:"0x8F10B468b06c6FD214B65F87778827F7D113f996",source:"https://raw.githubusercontent.com/KyberNetwork/kyberswap-documentation/main/developer-guide/aggregator-api/contracts.md",pointer:"Robinhood / AggregationExecutorProxy",block:"100861304",blockKind:"read",caveat:"Corroborated by successful transaction 0x4a2474960f846f412d4d1cbdebb86727c81f92a0859ad743425fdc544d8973e8; approveTarget is zero."},velora:{address:"0x006d0e0d006109f0020f3050000a713780b7b000",source:"https://rpc.mainnet.chain.robinhood.com",pointer:"eth_getTransactionByHash / 0x70bc411f8427d622798ff82e6088d6cf3c011ae04b063c731664215f982ecfba / input / executor",block:"100861280",blockKind:"read",caveat:"Observed v6.2 executor, corroborated by six fresh Velora builds on 2026-10-29; no vendor executor list for 4663. Inner route targets vary; this pin does not authenticate them."}}},D=BigInt("0x45a6e007c874ffc6321d6fb90eac272dd6864bfa")<<96n|1n<<92n|1n,I=[k[4663].velora.address,"0x082738d007001080a00099a000004f3006152085"];export{s as a,a as b,p as c,f as d,A as e,h as f,v as g,P as h,o as i,t as j,i as k,_ as l,m,R as n,F as o,E as p,l as q,b as r,d as s,x as t,C as u,B as v,g as w,k as x,D as y,I as z};
@@ -1 +0,0 @@
1
- import{a as E}from"./YHB55C5T.js";import{b as q,c as _,d as O,e as R}from"./PWBL4WKB.js";import{a as N}from"./VVEUJ36E.js";import{a as I}from"./6UPPUHCL.js";import{c as M}from"./AMICUXS6.js";import{b as G}from"./AXYOJBX6.js";import{a as b}from"./6IM6A5VA.js";import{a as x}from"./RETS2ZEK.js";import{a as o,d as P,i as U,j as y}from"./G6HCV67X.js";import{a as r}from"./5YS5V2LK.js";import{encodeFunctionData as g,erc20Abi as k,parseAbi as L}from"viem";var i=U[o].vaults.steakhouse.address,j=(1n<<256n)-1n,l=L(["function asset() view returns (address)","function totalAssets() view returns (uint256)","function convertToAssets(uint256 shares) view returns (uint256 assets)","function previewWithdraw(uint256 assets) view returns (uint256 shares)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]);function A(e){if(typeof e!="bigint"||e<0n||e>j)throw new r("The vault returned an invalid base-unit amount.");return e}function T(e){if(typeof e!="string")throw new r("Amount must be an integer string in base units.");let c=x(e);if(c===0n)throw new r("Amount must be positive.");if(c>j)throw new r("Amount exceeds the uint256 range.");return c}function D(e,c,h=!1){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(w=>!c||!["amount",...h?["force","maxPenaltyAssets","minAmountOut"]:[]].includes(w)))throw new r("Unexpected Steakhouse argument.")}var W=e=>{async function c(t){try{return await t()}catch(s){throw new r(e.plainError(s))}}async function h(){let t=e.clientFor(o);if(await t.getChainId()!==o)throw new r("Steakhouse requires chain 4663.");let s=await t.readContract({address:i,abi:l,functionName:"asset"});if(typeof s!="string"||s.toLowerCase()!==y.toLowerCase())throw new r("The Steakhouse vault asset does not match USDG on chain 4663.");let[a,n]=await Promise.all([t.readContract({address:y,abi:k,functionName:"decimals"}),t.readContract({address:i,abi:k,functionName:"decimals"})]);if(a!==P||!Number.isInteger(n)||n<0||n>255)throw new r("The vault returned invalid asset or share decimals.");return{client:t,asset:{address:y,symbol:"USDG",decimals:a,chainId:o},shares:{address:i,symbol:"steakUSDG",decimals:n,chainId:o}}}async function w(t,s){return A(await t.readContract({address:i,abi:k,functionName:"balanceOf",args:[s]}))}async function C(t,s,a){let n=await e.preview(t,s);if(n.changes.length===0)throw new r("The Steakhouse simulation returned no token balance changes.");let u=n.changes.map(({token:m,amount:d})=>{let f=d.startsWith("-"),p=e.formatAmount(f?d.slice(1):d,m.decimals);return`${f?"-":""}${p} ${m.symbol} (${m.address}, chain ${m.chainId}, decimals ${m.decimals})`});return{txs:t,summary:`${a} ${n.summary} Changes: ${u.join("; ")}.`}}return{tools:[_(e,"steakhouse_details",i),I(e,"steakhouse_analytics",i),E(e,"steakhouse_manage",i),...N(e,"steakhouse",i),{name:"steakhouse_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>c(async()=>{D(t,!1);let{client:s,asset:a,shares:n}=await h(),u=A(await s.readContract({address:i,abi:l,functionName:"totalAssets"}));return[{name:"Steakhouse USDG",vault:n,asset:a,totalAssets:{token:a,amount:u.toString()}}]})},{name:"steakhouse_deposit",inputSchema:$(!1),execute:async(t,s)=>c(async()=>{D(t,!0);let a=T(t.amount);b(s);let{asset:n}=await h(),u=[e.approval(n.address,i,a.toString(),o),e.unsignedTx({to:i,data:g({abi:l,functionName:"deposit",args:[a,s]}),value:"0",chainId:o,description:`Deposit ${e.formatAmount(a.toString(),n.decimals)} USDG into Steakhouse.`})];return C(u,s,"Approve the exact USDG amount, then deposit into Steakhouse.")})},{name:"steakhouse_withdraw",inputSchema:{...$(!0),properties:{...$(!0).properties,force:{type:"boolean",description:"Explicitly plan a full Morpho V2 force exit with penalty disclosure."},maxPenaltyAssets:{type:"string",pattern:"^[0-9]+$"},minAmountOut:{type:"string",pattern:"^[0-9]+$"}}},execute:async(t,s)=>c(async()=>{D(t,!0,!0);let a=t.amount==="max"?null:T(t.amount);b(s);let{client:n,asset:u,shares:m}=await h(),d=await w(n,s);if(d===0n)throw new r("The wallet has no Steakhouse shares to withdraw.");if(t.force!==void 0&&typeof t.force!="boolean")throw new r("force must be a boolean.");if(t.force===!0){if(a!==null)throw new r("Force exit currently requires amount max.");let p=M(t.maxPenaltyAssets),F=T(t.minAmountOut),v=await q(e,n,i,s,d,p),S=await e.preview([v.tx],s);return R(S.changes,i,d,F),{txs:[v.tx],preview:S,summary:`${O(v.plan)} ${S.summary}`}}if(t.maxPenaltyAssets!==void 0||t.minAmountOut!==void 0)throw new r("Penalty and output limits require force true.");let f;if(a===null)f=e.unsignedTx({to:i,data:g({abi:l,functionName:"redeem",args:[d,s,s]}),value:"0",chainId:o,description:`Redeem all ${e.formatAmount(d.toString(),m.decimals)} steakUSDG shares.`});else{let p=A(await n.readContract({address:i,abi:l,functionName:"previewWithdraw",args:[a]}));if(p===0n||p>d)throw new r("The withdrawal exceeds the available share balance or has an invalid share quote.");f=e.unsignedTx({to:i,data:g({abi:l,functionName:"withdraw",args:[a,s,s]}),value:"0",chainId:o,description:`Withdraw ${e.formatAmount(a.toString(),u.decimals)} USDG from Steakhouse.`})}return C([f],s,a===null?"Redeem the current full share balance from Steakhouse.":"Withdraw the requested USDG amount from Steakhouse.")})}],positions:t=>c(async()=>{b(t);let{client:s,asset:a,shares:n}=await h(),u=await w(s,t);if(u===0n)return[];let m=A(await s.readContract({address:i,abi:l,functionName:"convertToAssets",args:[u]}));return[{module:"steakhouse",id:`${o}:${i.toLowerCase()}`,chainId:o,assets:[{token:a,amount:m.toString()}],description:`${e.formatAmount(u.toString(),n.decimals)} steakUSDG shares (${i}, chain ${o}, decimals ${n.decimals}); USDG conversion is indicative, not guaranteed exit liquidity.`}]})}};function $(e){return{type:"object",additionalProperties:!1,required:["amount"],properties:{amount:{type:"string",pattern:e?"^(?:[0-9]+|max)$":"^[0-9]+$",description:`USDG base-unit integer string (6 decimals)${e?", or max to redeem every share":""}.`}}}}var te=e=>G("steakhouse",[W(e)]);export{W as a,te as b};
@@ -1 +0,0 @@
1
- import{a as d}from"./5YS5V2LK.js";var i=class extends d{constructor(r,n){super(`${r} is busy; retry in ${Math.max(1,Math.ceil(n))} seconds.`);this.vendor=r;this.retryAfterSeconds=n}vendor;retryAfterSeconds},y=new WeakMap,b={"aggregator-api.kyberswap.com":{label:"KyberSwap",spacing:350},"api.velora.xyz":{label:"Velora",spacing:1050,daily:5e3},"api.relay.link":{label:"Relay",spacing:1250}};function f(a,c){let r=new URL(c).hostname,n=b[r];if(!n)return;let s=y.get(a);s||(s=new Map,y.set(a,s));let e=s.get(r);return e||(e={next:0,blockedUntil:0,lastSent:-1/0,daily:[]},s.set(r,e)),{label:n.label,reserve(){let t=Date.now();if(e.daily=e.daily.filter(o=>o>t-864e5),n.daily&&e.daily.length>=n.daily)throw new i(n.label,(e.daily[0]+864e5-t)/1e3);let l=Math.max(t,e.next,e.blockedUntil,e.lastSent+n.spacing);if(l-t>2e3)throw new i(n.label,(l-t)/1e3);return e.next=l+n.spacing,l-t},dispatchDelay(){let t=Date.now();if(e.daily=e.daily.filter(o=>o>t-864e5),n.daily&&e.daily.length>=n.daily)throw new i(n.label,(e.daily[0]+864e5-t)/1e3);if(e.blockedUntil>t)throw new i(n.label,(e.blockedUntil-t)/1e3);let l=Math.max(0,e.lastSent+n.spacing-t);return l===0&&(e.lastSent=t,n.daily&&e.daily.push(t)),l},backoff(t){e.blockedUntil=Math.max(e.blockedUntil,Date.now()+t)}}}function p(a){return a instanceof d&&/^(KyberSwap|Velora|Relay|The service) is busy; retry in [1-9]\d* seconds\.$/.test(a.message)?a:void 0}export{i as a,f as b,p as c};
@@ -1 +0,0 @@
1
- import{c as Ce,d as Me,e as we,f as ie,i as be,j as Ne}from"./6ZYLNB2B.js";import{b as ne,o as ge}from"./5O5ZE3ZV.js";import{a as O,b as pe}from"./6IM6A5VA.js";import{a as Te}from"./EG6M6SSO.js";import{a as F,c as Ue}from"./RETS2ZEK.js";import{a as k,i as _}from"./G6HCV67X.js";import{a as c,b as te,d as U}from"./5YS5V2LK.js";import{decodeFunctionResult as he,encodeFunctionData as R,getAddress as l,parseAbi as Z,zeroAddress as C}from"viem";var re=-887272,se=887272,z=(1n<<128n)-1n,Fe="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ze="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",Ge="0x3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f",oe=2000n,je=5,Ke=1800n,f=Object.freeze({factory:l(_[4663].uniswap.v3_factory.address),positionManager:l(_[4663].uniswap.v3_position_manager.address),swapRouter02:l(_[4663].uniswap.swap_router02.address),permit2:l(_[4663].uniswap.permit2.address),weth:l(_[4663].uniswap.WETH.address),usdg:l(_[4663].uniswap.USDG.address),ethUsdgPool:l(_[4663].oracle.ethUsdgPool.address)}),xe=Object.freeze({100:1,500:10,3e3:60,1e4:200}),yt=Object.freeze([{fee:100,tickSpacing:1,address:l("0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"),token0:f.weth,token1:f.usdg,recordedLiquidity:"1957537485734736219",recordedSqrtPriceX96:"3839219776288481168641554",recordedTick:-198707,feeProtocol:68},{fee:500,tickSpacing:10,address:l("0x69bfaf19c9f377bb306a89aed9f6b07e2c1a8d9a"),token0:f.weth,token1:f.usdg,recordedLiquidity:"714542894544667104",recordedSqrtPriceX96:"3839644024453020182443671",recordedTick:-198705,feeProtocol:68},{fee:3e3,tickSpacing:60,address:l("0xa9188730fe85be88ad499d7d52b099e800fb0334"),token0:f.weth,token1:f.usdg,recordedLiquidity:"310559629687003603",recordedSqrtPriceX96:"3843235825752878635548672",recordedTick:-198686,feeProtocol:102},{fee:1e4,tickSpacing:200,address:l("0x5f009e071f07e92b6c624e83f52f17bbda34680d"),token0:f.weth,token1:f.usdg,recordedLiquidity:"5822966536584155",recordedSqrtPriceX96:"3853297838190389678059735",recordedTick:-198634,feeProtocol:102}]),x=Z(["function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)","function ownerOf(uint256 tokenId) view returns (address)","function balanceOf(address owner) view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)","function mint((address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, address recipient, uint256 deadline) params) payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)","function increaseLiquidity((uint256 tokenId, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) payable returns (uint128 liquidity, uint256 amount0, uint256 amount1)","function decreaseLiquidity((uint256 tokenId, uint128 liquidity, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) payable returns (uint256 amount0, uint256 amount1)","function collect((uint256 tokenId, address recipient, uint128 amount0Max, uint128 amount1Max) params) payable returns (uint256 amount0, uint256 amount1)","function burn(uint256 tokenId) payable","function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96) payable returns (address pool)"]),Q=Z(["function getPool(address tokenA, address tokenB, uint24 fee) view returns (address pool)","function feeAmountTickSpacing(uint24 fee) view returns (int24)"]),ke=Z(["function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)","function liquidity() view returns (uint128)","function tickSpacing() view returns (int24)","function fee() view returns (uint24)","function token0() view returns (address)","function token1() view returns (address)"]),Qe=Z(["function exactInputSingle((address tokenIn, address tokenOut, uint24 fee, address recipient, uint256 amountIn, uint256 amountOutMinimum, uint160 sqrtPriceLimitX96) params) payable returns (uint256 amountOut)"]),ye=Z(["function decimals() view returns (uint8)","function symbol() view returns (string)","function allowance(address owner, address spender) view returns (uint256)"]),Ye="0xd0e30db0";function Ze(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();return e===C||e===Fe||e==="eth"||e==="native"}function E(t,e){if(Ze(t))throw new c(`Uniswap v3 requires wrapped ERC-20 WETH (${f.weth}) rather than native ETH in ${e}.`);if(typeof t!="string")throw new c(`${e} must be a valid 20-byte hex address.`);return O(t),l(t)}function Je(t,e,n){let a=Number(t),o=Number(e),i=Number(n);if(!Number.isInteger(i)||i<=0)throw new c("Uniswap v3 tickSpacing must be a positive integer.");if(!Number.isInteger(a)||!Number.isInteger(o))throw new c("Uniswap v3 tickLower and tickUpper must be integers.");if(a<re||o>se||a>se||o<re)throw new c(`Uniswap v3 ticks are out of bounds [${re}, ${se}].`);if(a>=o)throw new c("Uniswap v3 tickLower must be strictly less than tickUpper.");if(a%i!==0||o%i!==0)throw new c(`Uniswap v3 tickLower (${a}) and tickUpper (${o}) must be divisible by tickSpacing (${i}).`);return{tickLower:a,tickUpper:o,tickSpacing:i}}function et(t,e){let n=t.trim(),a=n.startsWith("-"),o=a||n.startsWith("+")?n.slice(1):n,i=Ue(F(o).toString(),e);return a&&i!=="0"?`-${i}`:i}function tt(t){let e=typeof t=="string"?he({abi:x,functionName:"positions",data:t}):t;return{nonce:BigInt(e[0]),operator:l(String(e[1])),token0:l(String(e[2])),token1:l(String(e[3])),fee:Number(e[4]),tickLower:Number(e[5]),tickUpper:Number(e[6]),liquidity:BigInt(e[7]),feeGrowthInside0LastX128:BigInt(e[8]),feeGrowthInside1LastX128:BigInt(e[9]),tokensOwed0:BigInt(e[10]),tokensOwed1:BigInt(e[11])}}function $e(t,e){if(!t||!Array.isArray(t.logs))return[];let n=e?l(e).toLowerCase():void 0,a=f.positionManager.toLowerCase(),o=new Set;for(let i of t.logs){if(!i||typeof i.address!="string"||i.address.toLowerCase()!==a)continue;let r=Array.isArray(i.topics)?i.topics.map(u=>String(u).toLowerCase()):[],s=r[0];if(s===ze&&r.length>=4){let d=`0x${r[2].slice(-40)}`;if(!n||d===n){let m=BigInt(r[3]).toString();m!=="0"&&o.add(m)}}else if(s===Ge&&r.length>=2&&!n){let u=BigInt(r[1]).toString();u!=="0"&&o.add(u)}}return[...o]}function ht(t){let e=n=>typeof n=="bigint"?n:F(n);return R({abi:Qe,functionName:"exactInputSingle",args:[{tokenIn:l(t.tokenIn),tokenOut:l(t.tokenOut),fee:t.fee,recipient:l(t.recipient),amountIn:e(t.amountIn),amountOutMinimum:e(t.amountOutMinimum),sqrtPriceLimitX96:t.sqrtPriceLimitX96!==void 0?e(t.sqrtPriceLimitX96):0n}]})}var Le=1n<<96n;function Re(t){let e=Math.abs(t),n=(e&1)!==0?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&2)!==0&&(n=n*0xfff97272373d413259a46990580e213an>>128n),(e&4)!==0&&(n=n*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&8)!==0&&(n=n*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&16)!==0&&(n=n*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&32)!==0&&(n=n*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&64)!==0&&(n=n*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&128)!==0&&(n=n*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&256)!==0&&(n=n*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&512)!==0&&(n=n*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&1024)!==0&&(n=n*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&2048)!==0&&(n=n*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&4096)!==0&&(n=n*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&8192)!==0&&(n=n*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&16384)!==0&&(n=n*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&32768)!==0&&(n=n*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&65536)!==0&&(n=n*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&131072)!==0&&(n=n*0x5d6af8dedb81196699c329225ee604n>>128n),(e&262144)!==0&&(n=n*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&524288)!==0&&(n=n*0x48a170391f7dc42444e8fa2n>>128n),t>0&&(n=((1n<<256n)-1n)/n),(n>>32n)+(n%(1n<<32n)===0n?0n:1n)}function nt(t,e,n,a){if(a<=0n)return{amount0:0n,amount1:0n};let[o,i]=e<n?[e,n]:[n,e];if(t<=o)return{amount0:(a<<96n)*(i-o)/i/o,amount1:0n};if(t<i){let s=(a<<96n)*(i-t)/i/t,u=a*(t-o)/Le;return{amount0:s,amount1:u}}return{amount0:0n,amount1:a*(i-o)/Le}}async function M(t,e,n,a){let o=l(e),i,r;if(n===k&&o===f.weth?(i=18,r="WETH"):n===k&&o===f.usdg&&(i=6,r="USDG"),i===void 0){let s=await t.readContract({address:o,abi:ye,functionName:"decimals"});i=Number(s)}if(r===void 0)try{let s=await t.readContract({address:o,abi:ye,functionName:"symbol"});if(typeof s!="string"||!s.trim())throw new c("Token symbol is unavailable.");r=Ne(s.trim(),o)}catch(s){throw new c(`Could not read token metadata. ${U(s)}`)}if(!Number.isInteger(i)||i<0||i>255)throw new c("Token decimals are invalid.");if(a!=null){let s=Number(a);if(!Number.isInteger(s)||s!==i)throw new c(`Token ${o} on chain ${n} has ${i} decimals, not ${String(a)}.`)}return{address:o,symbol:r,decimals:i,chainId:n}}async function it(t){try{if(!t.getBlock)throw new c("Block timestamps are unavailable.");let e=await t.getBlock();if(typeof e.timestamp!="bigint")throw new c("Invalid block timestamp.");return e.timestamp}catch(e){throw new c(`Could not read the current block timestamp. ${U(e)}`)}}function J(t,e){if(typeof t=="bigint"){if(t<0n)throw new c(`${e} must be a non-negative integer.`);return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<0)throw new c(`${e} must be a non-negative integer.`);return BigInt(t)}if(typeof t=="string")return F(t);throw new c(`${e} must be a non-negative integer.`)}async function _e(t,e){let n=await it(t);if(e==null)return n+Ke;let a=J(e,"deadline");if(a<=n)throw new c(`Uniswap v3 deadline (${a.toString()}) has expired at timestamp ${n.toString()}.`);return a}function V(t,e){if(typeof t!="string"||!/^\d+$/.test(t))throw new c(`${e} must be a non-negative integer string in base units.`);return F(t)}function Ee(t){let e=t.slippageBps??ne;if(typeof e!="number")throw new c("Slippage must be an integer from 0 to 9999 bps.");return ge("0",e),e}function ae(t,e,n,a){let o=t===void 0?F(ge(e.toString(),n)):V(t,a);if(o<=1n)throw new c(`${a} must exceed 1 base unit; the simulated amount may be too small.`);return o}function X(t,e){return pe({to:f.positionManager,data:t,value:"0",chainId:k,description:e})}async function Y(t,e,n){try{if(!t.request)throw new c("Sequential transaction simulation is unavailable.");let o=await t.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:n,gas:`0x${Te.toString(16)}`,to:i.to,data:i.data,value:`0x${BigInt(i.value).toString(16)}`}))}],validation:!1,traceTransfers:!0},"latest"]},{retryCount:0});if(!Array.isArray(o)||o.length!==1||!Array.isArray(o[0]?.calls)||o[0].calls.length!==e.length)throw new c("Unexpected batch simulation response.");return o[0].calls.map((i,r)=>{if(i.status!=="0x1"||i.error||typeof i.returnData!="string"||!/^0x([a-fA-F0-9]{2})*$/.test(i.returnData))throw new c(`Simulation call ${r+1} failed. ${U(i.error)}`);return i.returnData})}catch(a){throw new c(`Uniswap v3 simulation failed. ${U(a)}`)}}function ce(t,e){try{return he({abi:x,functionName:t,data:e})}catch{throw new c(`Uniswap v3 ${t} simulation returned invalid amounts.`)}}function Be(t,e,n){if(t.initialPrice!==void 0&&t.sqrtPriceX96!==void 0)throw new c("Provide initialPrice or sqrtPriceX96, not both.");if(t.sqrtPriceX96!==void 0){if(typeof t.sqrtPriceX96!="string"||!/^\d+$/.test(t.sqrtPriceX96))throw new c("sqrtPriceX96 must be a non-negative integer string.");return Me(BigInt(t.sqrtPriceX96))}if(t.initialPrice===void 0)throw new c("A new pool needs initialPrice (token1 per 1 token0, human units) or sqrtPriceX96.");return Ce(t.initialPrice,e,n)}async function De(t,e,n,a){let o=[];for(let i of Object.keys(xe).map(Number)){if(i===a)continue;let r=l(String(await t.readContract({address:f.factory,abi:Q,functionName:"getPool",args:[e,n,i]})));if(r===C||BigInt(await t.readContract({address:r,abi:ke,functionName:"liquidity"}))===0n)continue;let u=await t.readContract({address:r,abi:ke,functionName:"slot0"});o.push({label:`v3 fee ${i} pool ${r}`,sqrtPriceX96:BigInt(u[0])})}return o}function G(t,e={}){if(e.chainId!==void 0&&Number(e.chainId)!==k)throw new c(`Uniswap v3 is only supported on Robinhood Chain (${k}).`);if(e.version!==void 0&&e.version!=="v3")throw new c(`Uniswap v3 handler received unsupported version "${String(e.version)}".`);let n=t.clientFor(k);return{...n,readContract:async a=>{try{return await n.readContract(a)}catch(o){throw new c(`Could not read Uniswap v3 ${a.functionName}. ${U(o)}`,{cause:o})}}}}async function ve(t,e,n){let a;try{a=await t.readContract({address:f.positionManager,abi:x,functionName:"ownerOf",args:[e]})}catch(r){throw new c(`Could not verify owner of Uniswap v3 position #${e}. ${U(r)}`)}let o=l(String(a)),i=l(n);if(o!==i)throw new c(`Wallet ${i} is not the owner of Uniswap v3 position #${e.toString()} (owned by ${o}).`);return o}async function de(t,e){let n=await t.readContract({address:f.positionManager,abi:x,functionName:"positions",args:[e]});return tt(n)}function Ie(t,e){if(!Array.isArray(e.changes)||!e.changes.length)return t;let n=e.changes.map(a=>`${et(a.amount,a.token.decimals)} ${a.token.symbol}`);return`${t} (${n.join(", ")})`}async function ot(t,e,n){O(n);let a=l(n),o=G(t,e),i=await _e(o,e.deadline),r=Ee(e),s=e.tokenId===void 0?void 0:J(e.tokenId,"tokenId"),u;if(s!==void 0){if(s<=0n)throw new c("Uniswap v3 tokenId must be a positive integer.");await ve(o,s,a),u=await de(o,s)}let d=u?.token0??E(e.token0,"token0"),m=u?.token1??E(e.token1,"token1");if(BigInt(d)>=BigInt(m))throw new c("Uniswap v3 requires distinct sorted token addresses.");let p=u?.fee??Number(e.fee??100),g=xe[p];if(!g)throw new c("Unsupported Uniswap v3 fee tier.");let y=l(String(await o.readContract({address:f.factory,abi:Q,functionName:"getPool",args:[d,m,p]}))),h=e.initialPrice!==void 0||e.sqrtPriceX96!==void 0;if(y===C&&!h)throw new c("No Uniswap v3 pool exists for these tokens and fee tier. To create it and add the first liquidity in one tool call with separately confirmed transactions, add initialPrice (token1 per 1 token0, human units) to this call; to create it without liquidity use uniswap_create_pool.");if(y!==C&&h)throw new c(`The Uniswap v3 pool already exists at ${y}; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);if(s!==void 0&&h)throw new c("initialPrice cannot be combined with tokenId.");if(e.fullRange!==void 0&&typeof e.fullRange!="boolean")throw new c("fullRange must be a boolean.");if(e.fullRange===!0&&(e.tickLower!==void 0||e.tickUpper!==void 0||u))throw new c("Use fullRange only for a new position, without explicit ticks. Existing position ticks cannot change.");let{tickLower:S,tickUpper:N,tickSpacing:T}=Je(u?.tickLower??(e.fullRange===!0?Math.ceil(re/g)*g:e.tickLower),u?.tickUpper??(e.fullRange===!0?Math.floor(se/g)*g:e.tickUpper),g),w=await M(o,d,k,e.token0Decimals),b=await M(o,m,k,e.token1Decimals),P;if(y===C){let q=Be(e,w.decimals,b.decimals),L=be(q,await De(o,d,m,p),e.acceptPriceDeviation===!0,w.decimals,b.decimals);P={sqrtPriceX96:q,note:L}}let v=V(e.amount0Desired,"amount0Desired"),I=V(e.amount1Desired,"amount1Desired");if(v===0n&&I===0n)throw new c("Liquidity addition requires a positive desired amount.");let $=e.recipient===void 0?a:E(e.recipient,"recipient");if($!==a)throw new c("Uniswap recipient must be the signing wallet.");if(e.wrapNative===!0&&d!==f.weth&&m!==f.weth)throw new c("Wrapping requires a positive WETH desired amount.");let H=await Promise.all([d,m].map(async q=>BigInt(await o.readContract({address:q,abi:ye,functionName:"allowance",args:[a,f.positionManager]})))),j=(q,L)=>{let fe=[];if(e.wrapNative===!0){let K=d===f.weth?q:L;K>0n&&fe.push(pe({to:f.weth,data:Ye,value:K.toString(),chainId:k,description:"Wrap ETH into WETH."}))}for(let[K,We]of[d,m].entries()){let me=K===0?q:L;me>0n&&H[K]<me&&fe.push(t.approval(We,f.positionManager,me.toString(),k))}return fe},W=s===void 0?"mint":"increaseLiquidity",B=(q,L)=>X(s===void 0?R({abi:x,functionName:"mint",args:[{token0:d,token1:m,fee:p,tickLower:S,tickUpper:N,amount0Desired:v,amount1Desired:I,amount0Min:q,amount1Min:L,recipient:$,deadline:i}]}):R({abi:x,functionName:"increaseLiquidity",args:[{tokenId:s,amount0Desired:v,amount1Desired:I,amount0Min:q,amount1Min:L,deadline:i}]}),`${W==="mint"?"Mint":"Increase"} Uniswap v3 ${w.symbol}/${b.symbol} liquidity.`),D=P&&X(R({abi:x,functionName:"createAndInitializePoolIfNecessary",args:[d,m,p,P.sqrtPriceX96]}),`Create and initialize the Uniswap v3 ${w.symbol}/${b.symbol} fee ${p} pool at ${ie(P.sqrtPriceX96,w.decimals,b.decimals)} ${b.symbol} per ${w.symbol}.`),Pe=D?[D]:[],Se=await Y(o,[...Pe,...j(v,I),B(0n,0n)],a),A=ce(W,Se[Se.length-1]),Ve=A[A.length-2],He=A[A.length-1];if(Ve>v||He>I)throw new c("Simulated liquidity spend exceeds the desired amounts.");let ee=[...Pe,...j(v,I)],ue=ae(e.amount0Min,A[A.length-2],r,"amount0Min"),le=ae(e.amount1Min,A[A.length-1],r,"amount1Min");if(ue>v||le>I)throw new c("Uniswap v3 minimum amount cannot exceed desired amount.");let Ae=B(ue,le);ee.push(Ae);for(let[q,L]of[d,m].entries())(q===0?v:I)>0n&&ee.push(t.approval(L,f.positionManager,"0",k));let qe=await t.preview(ee,a);return{txs:ee,preview:qe,summary:Ie(Ae.description,qe),details:{version:"v3",action:W,...s===void 0?{}:{tokenId:s.toString()},pool:y===C?null:y,fee:p,tickSpacing:T,tickLower:S,tickUpper:N,token0:w,token1:b,amount0Desired:v.toString(),amount1Desired:I.toString(),amount0Min:ue.toString(),amount1Min:le.toString(),deadline:i.toString(),recipient:$,expectedAmount0:A[A.length-2].toString(),expectedAmount1:A[A.length-1].toString(),...P?{poolCreated:!0,sqrtPriceX96:P.sqrtPriceX96.toString(),initialPrice:ie(P.sqrtPriceX96,w.decimals,b.decimals),initialTick:we(P.sqrtPriceX96),priceCheck:P.note}:{}}}}async function rt(t,e,n){O(n);let a=l(n),o=G(t,e),i=E(e.token0,"token0"),r=E(e.token1,"token1");if(BigInt(i)>=BigInt(r))throw new c(`Uniswap v3 requires sorted token addresses (token0 < token1). Use token0=${BigInt(i)<BigInt(r)?i:r}, token1=${BigInt(i)<BigInt(r)?r:i}; initialPrice is token1 per 1 token0 in that order.`);let s=Number(e.fee),u=xe[s];if(!u){let b=Number(await o.readContract({address:f.factory,abi:Q,functionName:"feeAmountTickSpacing",args:[s]}));if(!Number.isInteger(s)||b<=0)throw new c("Unsupported Uniswap v3 fee tier. Enabled tiers: 100, 500, 3000, 10000.");u=b}let d=l(String(await o.readContract({address:f.factory,abi:Q,functionName:"getPool",args:[i,r,s]})));if(d!==C)throw new c(`The Uniswap v3 pool already exists at ${d}. Use uniswap_add to provide liquidity.`);let m=await M(o,i,k,e.token0Decimals),p=await M(o,r,k,e.token1Decimals),g=Be(e,m.decimals,p.decimals),y=be(g,await De(o,i,r,s),e.acceptPriceDeviation===!0,m.decimals,p.decimals),h=ie(g,m.decimals,p.decimals),S=[X(R({abi:x,functionName:"createAndInitializePoolIfNecessary",args:[i,r,s,g]}),`Create and initialize the Uniswap v3 ${m.symbol}/${p.symbol} fee ${s} pool at ${h} ${p.symbol} per ${m.symbol}.`)],N=await Y(o,S,a),T;try{T=l(String(he({abi:x,functionName:"createAndInitializePoolIfNecessary",data:N[0]})))}catch{throw new c("Uniswap v3 pool creation simulation returned an invalid pool address.")}if(T===C)throw new c("Uniswap v3 pool creation simulation returned no pool.");let w=await t.preview(S,a);return{txs:S,preview:w,summary:`${S[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add.`,details:{version:"v3",action:"createPool",pool:T,fee:s,tickSpacing:u,token0:m,token1:p,sqrtPriceX96:g.toString(),initialPrice:h,initialTick:we(g),priceCheck:y}}}async function st(t,e,n){O(n);let a=l(n),o=G(t,e),i=J(e.tokenId,"tokenId");if(i<=0n)throw new c("Uniswap v3 tokenId must be a positive integer.");await ve(o,i,a);let r=await de(o,i),s=await M(o,r.token0,k),u=await M(o,r.token1,k),d=e.recipient===void 0?a:E(e.recipient,"recipient");if(d!==a)throw new c("Uniswap recipient must be the signing wallet.");let m=e.amount0Max===void 0?z:V(e.amount0Max,"amount0Max"),p=e.amount1Max===void 0?z:V(e.amount1Max,"amount1Max");if(m===0n&&p===0n||m>z||p>z)throw new c("Collect requires a positive amountMax within uint128.");let g=[X(R({abi:x,functionName:"collect",args:[{tokenId:i,recipient:d,amount0Max:m,amount1Max:p}]}),`Collect Uniswap v3 fees from position #${i}.`)],y=ce("collect",(await Y(o,g,a))[0]),h=await t.preview(g,a);return{txs:g,preview:h,summary:Ie(g[0].description,h),details:{version:"v3",action:"collect",tokenId:i.toString(),recipient:d,token0:s,token1:u,amount0Max:m.toString(),amount1Max:p.toString(),expectedAmount0:y[0].toString(),expectedAmount1:y[1].toString()}}}async function at(t,e,n){O(n);let a=l(n),o=G(t,e),i=J(e.tokenId,"tokenId");if(i<=0n)throw new c("Uniswap v3 tokenId must be a positive integer.");await ve(o,i,a);let r=await de(o,i),s=r.liquidity===0n&&e.burn===!0;if(r.liquidity<=0n&&!s)throw new c("Position has zero active liquidity to remove.");if(e.liquidity===void 0&&!s)throw new c('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let u=e.liquidity==="all"||e.liquidity===void 0?r.liquidity:V(e.liquidity,"liquidity");if(u<=0n&&!s)throw new c("Liquidity to remove must be positive.");if(u>r.liquidity)throw new c("Requested liquidity exceeds position liquidity.");let d=await _e(o,e.deadline),m=Ee(e),p=await M(o,r.token0,k),g=await M(o,r.token1,k),y=e.recipient===void 0?a:E(e.recipient,"recipient");if(y!==a)throw new c("Uniswap recipient must be the signing wallet.");let h=(B,D)=>X(R({abi:x,functionName:"decreaseLiquidity",args:[{tokenId:i,liquidity:u,amount0Min:B,amount1Min:D,deadline:d}]}),`Decrease ${u} liquidity on Uniswap v3 position #${i}.`),S=s?[0n,0n]:ce("decreaseLiquidity",(await Y(o,[h(0n,0n)],a))[0]),N=(B,D)=>{if(B!==void 0&&V(B,D)!==0n)throw new c(`${D} must be zero for an empty position burn.`);return 0n},T=s?N(e.amount0Min,"amount0Min"):ae(e.amount0Min,S[0],m,"amount0Min"),w=s?N(e.amount1Min,"amount1Min"):ae(e.amount1Min,S[1],m,"amount1Min"),b=s?[]:[h(T,w)],P=b.length,v=!s||r.tokensOwed0>0n||r.tokensOwed1>0n;v&&b.push(X(R({abi:x,functionName:"collect",args:[{tokenId:i,recipient:y,amount0Max:z,amount1Max:z}]}),`Collect principal and fees from Uniswap v3 position #${i}.`));let I=u===r.liquidity,$=I&&e.burn===!0;$&&b.push(X(R({abi:x,functionName:"burn",args:[i]}),`Burn empty Uniswap v3 position #${i}.`));let H=await Y(o,b,a),j=v?ce("collect",H[P]):[0n,0n],W=await t.preview(b,a);return{txs:b,preview:W,summary:Ie(`Remove Uniswap v3 liquidity from position #${i}${$?`; burns position #${i} at ${f.positionManager}`:""}`,W),details:{version:"v3",action:"remove",tokenId:i.toString(),recipient:y,token0:p,token1:g,liquidityRemoved:u.toString(),amount0Min:T.toString(),amount1Min:w.toString(),deadline:d.toString(),expectedAmount0:j[0].toString(),expectedAmount1:j[1].toString(),fullExit:I,burned:$}}}async function ct(t,e,n={}){let a=l(e),o=new Set;if(Array.isArray(n.tokenIds))for(let r of n.tokenIds){let s=J(r,"tokenId");s>0n&&o.add(s.toString())}if(Array.isArray(n.receipts))for(let r of n.receipts)for(let s of $e(r,a))o.add(s);let i=!1;try{let r=BigInt(await t.readContract({address:f.positionManager,abi:x,functionName:"balanceOf",args:[a]})),s=r>64n?64n:r;for(let u=0n;u<s;u++){try{let d=BigInt(await t.readContract({address:f.positionManager,abi:x,functionName:"tokenOfOwnerByIndex",args:[a,u]}));d>0n&&o.add(d.toString())}catch(d){if(!te(d,3,-32601,-32004))throw d;break}u+1n===r&&(i=!0)}r===0n&&(i=!0)}catch(r){if(!te(r,3,-32601,-32004))throw r}if(typeof t.getLogs=="function"&&typeof t.getBlockNumber=="function")try{let r=n.toBlock??await t.getBlockNumber(),s=n.maxChunks??je,u=n.fromBlock??(r>oe*BigInt(s)?r-oe*BigInt(s)+1n:0n),d=r,m=0;for(;d>=u&&m<s;){let p=d>=oe-1n?d-(oe-1n):0n,g=p<u?u:p,y=await t.getLogs({address:f.positionManager,fromBlock:g,toBlock:d});for(let h of $e({logs:y},a))o.add(h);if(m+=1,g===0n||g<=u)break;d=g-1n}}catch(r){throw new c(`Could not discover Uniswap v3 positions from logs. ${U(r)}`)}else if(!i&&n.tokenIds===void 0&&n.receipts===void 0)throw new c("Uniswap v3 position discovery is unavailable; supply candidate token IDs or receipts.");return[...o].map(r=>BigInt(r)).sort((r,s)=>r<s?-1:r>s?1:0)}async function Oe(t,e,n={}){O(e);let a=l(e),o=G(t),i=await ct(o,a,n),r=[];for(let s of i){let u;try{let w=await o.readContract({address:f.positionManager,abi:x,functionName:"ownerOf",args:[s]});u=l(String(w))}catch(w){if(te(w,3))continue;throw new c(`Could not verify owner of position #${s}. ${U(w)}`)}if(u!==a)continue;let d;try{d=await de(o,s)}catch(w){throw new c(`Could not read position #${s}. ${U(w)}`)}if(d.liquidity===0n&&d.tokensOwed0===0n&&d.tokensOwed1===0n&&!n.includeEmpty)continue;let p=await M(o,d.token0,k),g=await M(o,d.token1,k),y=0n,h=0n;if(d.liquidity>0n)try{let w=await o.readContract({address:f.factory,abi:Q,functionName:"getPool",args:[d.token0,d.token1,d.fee]}),b=l(String(w));if(b===C)throw new c("Position pool was not found.");if(b!==C){let P=await o.readContract({address:b,abi:ke,functionName:"slot0"}),v=BigInt(P[0]);if(v<=0n)throw new c("Position pool has no initialized price.");let I=Re(d.tickLower),$=Re(d.tickUpper),H=nt(v,I,$,d.liquidity);y=H.amount0,h=H.amount1}}catch(w){throw new c(`Could not value Uniswap v3 position #${s}. ${U(w)}`)}let S=y+d.tokensOwed0,N=h+d.tokensOwed1,T=[{token:p,amount:S.toString()},{token:g,amount:N.toString()}];r.push({module:"uniswap",id:`uniswap:v3:${s.toString()}`,chainId:k,assets:T,description:`Uniswap v3 LP position #${s.toString()} (${p.symbol}/${g.symbol} fee ${d.fee} ticks [${d.tickLower}, ${d.tickUpper}] liquidity ${d.liquidity.toString()})`})}return r}async function dt(t,e,n){G(t,e);let a=e.wallet!==void 0?E(e.wallet,"wallet"):l(n),o=Array.isArray(e.tokenIds)?e.tokenIds:void 0,i=Array.isArray(e.receipts)?e.receipts:void 0,r=e.includeZero===!0||e.includeEmpty===!0,s=await Oe(t,a,{tokenIds:o,receipts:i,includeEmpty:r});return{positions:s,details:{version:"v3",wallet:a,count:s.length,positionManager:f.positionManager}}}function ut(t){return[{name:"uniswap_add",inputSchema:{type:"object",description:"Mint a new Uniswap v3 concentrated liquidity position or increase liquidity on an existing v3 NFT position on Robinhood Chain (4663).",properties:{version:{type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:"Optional existing v3 NFT tokenId for increaseLiquidity."},token0:{type:"string",description:"Sorted ERC-20 token0 address (e.g. WETH)."},token1:{type:"string",description:"Sorted ERC-20 token1 address (e.g. USDG)."},fee:{type:"integer",enum:[100,500,3e3,1e4],default:100},fullRange:{type:"boolean",description:"For a new v3 position, use the widest ticks aligned to the pool fee tier; omit explicit ticks."},tickLower:{type:"integer",description:"Lower tick boundary divisible by tickSpacing."},tickUpper:{type:"integer",description:"Upper tick boundary divisible by tickSpacing."},amount0Desired:{type:"string",description:"Desired token0 amount in decimal base units."},amount1Desired:{type:"string",description:"Desired token1 amount in decimal base units."},amount0Min:{type:"string",description:"Minimum token0 amount in decimal base units."},amount1Min:{type:"string",description:"Minimum token1 amount in decimal base units."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:ne},deadline:{type:"integer",description:"Unix timestamp deadline (> current block timestamp)."},wrapNative:{type:"boolean",description:"Optional: wrap native ETH into WETH before minting."},initialPrice:{type:"string",description:"Only when the pool does not exist: starting price as token1 per 1 token0 in human units. The pool is created then liquidity is minted in separately confirmed transactions."},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},execute:(r,s)=>ot(t,r,s)},{name:"uniswap_collect",inputSchema:{type:"object",description:"Collect accrued Uniswap v3 LP fees for an owned NonfungiblePositionManager NFT.",properties:{version:{type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:"Uniswap v3 NFT tokenId."},recipient:{type:"string",description:"Optional fee recipient; must be the signing wallet."},amount0Max:{type:"string",description:"Max token0 to collect (defaults to uint128 max)."},amount1Max:{type:"string",description:"Max token1 to collect (defaults to uint128 max)."}},required:["tokenId"]},execute:(r,s)=>st(t,r,s)},{name:"uniswap_remove",inputSchema:{type:"object",description:"Decrease liquidity on an owned Uniswap v3 NFT position, collect principal and fees, and optionally burn the empty NFT.",properties:{version:{type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:"Uniswap v3 NFT tokenId."},liquidity:{type:"string",description:"Positive base-unit liquidity amount, or all for a full exit."},amount0Min:{type:"string",description:"Minimum token0 principal in decimal base units."},amount1Min:{type:"string",description:"Minimum token1 principal in decimal base units."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:ne},deadline:{type:"integer",description:"Unix timestamp deadline (> current block timestamp)."},burn:{type:"boolean",description:"Whether to burn the NFT after removing 100% of liquidity, or burn an already-empty position."}},required:["tokenId"]},execute:(r,s)=>at(t,r,s)},{name:"uniswap_list_positions",inputSchema:{type:"object",description:"List active Uniswap v3 LP positions owned by the wallet from NFT receipts and Transfer logs.",properties:{version:{type:"string",enum:["v3"],default:"v3"},wallet:{type:"string",description:"Optional wallet address override."},tokenIds:{type:"array",items:{type:"string"},description:"Optional candidate v3 NFT tokenIds to inspect."}}},execute:(r,s)=>dt(t,r,s)},{name:"uniswap_create_pool",inputSchema:{type:"object",description:"Create and initialize an empty Uniswap v3 pool on Robinhood Chain (4663). Add liquidity afterwards with uniswap_add.",properties:{version:{type:"string",enum:["v3"],default:"v3"},token0:{type:"string",description:"Sorted ERC-20 token0 address (WETH, not native ETH)."},token1:{type:"string",description:"Sorted ERC-20 token1 address."},fee:{type:"integer",enum:[100,500,3e3,1e4]},initialPrice:{type:"string",description:'Starting price as token1 per 1 token0 in human units, e.g. "3000" for 1 WETH = 3000 USDG.'},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}},required:["token0","token1","fee"]},execute:(r,s)=>rt(t,r,s)}]}var Xe=t=>({tools:ut(t),positions:e=>Oe(t,e)}),xt=Xe,vt=Xe;export{re as a,se as b,z as c,f as d,xe as e,yt as f,x as g,Q as h,ke as i,Qe as j,Je as k,et as l,tt as m,$e as n,ht as o,Be as p,ot as q,rt as r,st as s,at as t,Oe as u,dt as v,ut as w,Xe as x,xt as y,vt as z};
@@ -1 +0,0 @@
1
- import{a as H}from"./UWOFA6GV.js";import{c as B,f as z,g as I,k as F,n as G}from"./73N3TOJL.js";import{a as g,i as j}from"./G6HCV67X.js";import{a}from"./5YS5V2LK.js";import{encodeFunctionData as Q,erc20Abi as O,parseAbi as oe,zeroHash as J}from"viem";var ne=j[g].meridian,S=ne.PredictionMarketEscrow.address,v={address:ne.CollateralToken_USDe.address,chainId:g,symbol:"USDe",decimals:18},se="https://api.predict.meridian.xyz/graphql",ae="query GetOpenConditions($now: Int!, $first: Int!, $after: String, $search: String, $conditionIds: [Bytes!], $resolvers: [Address!]) { conditions(first: $first, after: $after, filter: { chainId: 4663, settled: false, public: true, endTime: { gte: $now }, search: $search, conditionIds: $conditionIds, resolvers: $resolvers }) { totalCount pageInfo { hasNextPage endCursor } nodes { conditionId resolver question shortName optionName endTime estimatedPrice openInterest similarMarketVolume24h marketType } } }",de="query GetHolderPositions($holder: Address!, $first: Int!, $after: String) { positions(first: $first, after: $after, filter: { holder: $holder, chainId: 4663 }, orderBy: { field: CREATED_AT, direction: DESC }) { totalCount pageInfo { hasNextPage endCursor } nodes { id chainId holder side balance tokenAddress: token pickConfigId userCollateral totalPayout prediction { predictionId } pickConfig { pickConfigId marketAddress: escrow resolved result } } } }",U=oe(["function getClaimableAmount(bytes32 pickConfigId, address positionToken, uint256 tokenAmount) view returns (uint256)","function settle(bytes32 predictionId, bytes32 refCode)","function redeem(address positionToken, uint256 amount, bytes32 refCode) returns (uint256)"]),K={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},V={type:"string",minLength:1,maxLength:4096,description:"Opaque nextCursor returned by the previous page."},E=25,W={type:"integer",minimum:1,maximum:E},ce=1e3;function Y(n,y){if(n===void 0)return y;if(!Number.isSafeInteger(n)||n<1||n>E)throw new a("Provide a Meridian page limit from 1 to 25.");return n}function X(n){if(n!==void 0){if(typeof n!="string"||!n.trim()||n.length>4096)throw new a("Provide the opaque Meridian nextCursor returned by the previous page.");return n}}function Z(n,y,u,w=!1){let l=C(n),m=C(l.pageInfo),P=Array.isArray(l.nodes)?l.nodes.filter(q=>!w||N(C(q).balance)!=="0").length:0;if(!Array.isArray(l.nodes)||l.nodes.length>y||!Number.isSafeInteger(l.totalCount)||l.totalCount<P||typeof m.hasNextPage!="boolean"||u===void 0&&!m.hasNextPage&&l.totalCount>l.nodes.length||m.endCursor!==null&&(typeof m.endCursor!="string"||!m.endCursor.trim()||m.endCursor.length>4096)||m.hasNextPage&&(l.nodes.length===0||m.endCursor===null||m.endCursor===u))throw new a("Meridian returned invalid pagination; retry the scan from the first page.");return{nodes:l.nodes,totalCount:l.totalCount,nextCursor:m.hasNextPage?m.endCursor:null,complete:!m.hasNextPage&&u===void 0}}function C(n){return z(n,"Meridian returned an unexpected response.")}function A(n){if(typeof n!="string"||!n.trim())throw new a("Meridian returned an invalid text field.");return n}function b(n){return F(n,"Provide a valid Meridian contract or wallet address.")}function M(n){if(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))throw new a("Provide a valid Meridian prediction or pick configuration ID.");return n}function R(n){return G(n,"Meridian amount exceeds the uint256 range.",{notString:"Meridian amounts must be integer strings in base units."}).toString()}function N(n){return n===0?"0":R(n)}function D(n){if(typeof n!="bigint"||n<0n)throw new a("Meridian returned an invalid on-chain amount.");return R(n.toString())}function ue(n,y){return n.chainId===y.chainId&&I(n.address,y.address)}function ee(n,y){let u=C(n),w=C(u.pickConfig),l=b(u.holder),m=b(w.marketAddress);if(u.chainId!==g||!I(l,y))throw new a("Meridian returned a position for a different wallet or chain.");if(!I(m,S))throw new a("This Meridian position uses an unsupported escrow contract.");if(typeof w.resolved!="boolean"||w.result!==null&&typeof w.result!="string")throw new a("Meridian returned an invalid resolution.");let P=M(u.pickConfigId);if(!I(M(w.pickConfigId),P))throw new a("Meridian returned mismatched pick configuration IDs.");if(u.side!=="PREDICTOR"&&u.side!=="COUNTERPARTY")throw new a("Meridian returned an invalid position side.");return{id:A(u.id),chainId:g,holder:l,side:u.side,balance:N(u.balance),tokenAddress:b(u.tokenAddress),pickConfigId:P,userCollateral:N(u.userCollateral),totalPayout:N(u.totalPayout),prediction:{predictionId:M(C(u.prediction).predictionId)},pickConfig:{pickConfigId:P,marketAddress:m,resolved:w.resolved,result:w.result}}}var le=n=>{async function y(t){try{return await t()}catch(o){throw new a(n.plainError(o))}}async function u(){let t=n.clientFor(g);if(await t.getChainId()!==g)throw new a("Meridian requires an RPC on chain 4663.");return t}async function w(t,o,r){let s=new URL(se);s.searchParams.set("op",t),s.searchParams.set("query",o),s.searchParams.set("variables",JSON.stringify(r));let e=await n.http(s.toString(),{method:"GET",headers:{Accept:"application/json"}});if(!e.ok)throw new a(`Meridian returned HTTP ${e.status}. Please try again.`);let c;try{c=await e.json()}catch{throw new a("Meridian returned malformed JSON.")}let d=C(c);if(d.errors!==void 0&&(!Array.isArray(d.errors)||d.errors.length>0))throw new a("Meridian could not complete the GraphQL query. Please try again.");return C(d.data)}async function l(t,o=10,r){b(t);let s=await w("GetHolderPositions",de,{holder:t,first:o,...r===void 0?{}:{after:r}});return Z(s.positions,o,r,!0)}async function m(t,o){let r=[],s=new Set,e=new Set,c,d,f=0;for(let p=0;p<ce;p++){let h=await l(t,E,c);if(d!==void 0&&d!==h.totalCount)throw new a("Meridian positions changed during pagination; retry from the first page.");d=h.totalCount;for(let x of h.nodes){let i=C(x),k=A(i.id);if(e.has(k))throw new a("Meridian repeated a position during pagination; retry from the first page.");e.add(k),N(i.balance)!=="0"&&f++,(o===void 0||I(b(i.tokenAddress),o))&&r.push(ee(x,t))}if(h.nextCursor===null){if(f>d||e.size<d)throw new a("Meridian returned an incomplete positions scan; retry from the first page.");return r}if(s.has(h.nextCursor))throw new a("Meridian repeated a cursor; retry from the first page.");s.add(h.nextCursor),c=h.nextCursor}throw new a("Meridian positions scan exceeded 1000 pages. Use meridian_positions with limit and cursor to inspect pages; redeem a known settled positionToken directly.")}async function P(t,o){if(t.length===0)return[];let r=await u();return(await Promise.all(t.map(async e=>{let[c,d,f]=await Promise.all([r.readContract({address:e.tokenAddress,abi:O,functionName:"balanceOf",args:[o]}),r.readContract({address:e.tokenAddress,abi:O,functionName:"decimals"}),r.readContract({address:e.tokenAddress,abi:O,functionName:"symbol"})]);if(!Number.isInteger(d)||d<0||d>255)throw new a("Meridian returned invalid position token decimals.");let p={address:e.tokenAddress,chainId:g,decimals:d,symbol:A(f)},h=D(c),x=e.pickConfig.resolved?{token:{...v},amount:D(await r.readContract({address:S,abi:U,functionName:"getClaimableAmount",args:[e.pickConfigId,e.tokenAddress,BigInt(h)]}))}:null;return{module:"meridian",id:e.id,chainId:g,assets:[{token:p,amount:h}],description:`Meridian ${e.side.toLowerCase()} position; ${e.pickConfig.resolved?e.pickConfig.result??"resolved":"unresolved"}.`,holder:e.holder,side:e.side,pickConfigId:e.pickConfigId,prediction:e.prediction,pickConfig:e.pickConfig,userCollateral:{token:{...v},amount:e.userCollateral},totalPayout:{token:{...v},amount:e.totalPayout},claimable:x}}))).filter(e=>BigInt(e.assets[0].amount)>0n)}async function q(t){return P(await m(t),t)}function L(t){return n.unsignedTx({to:S,chainId:g,value:"0",data:Q({abi:U,functionName:"settle",args:[t,J]}),description:`Settle Meridian prediction ${t}.`})}function _(t,o,r){let s=o.changes.map(e=>{let c=e.amount.startsWith("-"),d=n.formatAmount(c?e.amount.slice(1):e.amount,e.token.decimals);return`${c?"-":"+"}${d} ${e.token.symbol} (${e.token.address}, chain ${e.token.chainId})`});return{txs:t,preview:o,summary:`${r} ${o.summary}${s.length?` Changes: ${s.join("; ")}.`:""}`}}async function te(t){let o=Y(t.limit,20),r=X(t.cursor);if(r!==void 0&&t.asOf===void 0)throw new a("Pass the previous Meridian browse asOf with cursor to keep the same time filter.");let s=t.asOf===void 0?Math.floor(Date.now()/1e3):Number(R(t.asOf));if(!Number.isSafeInteger(s)||s<0||s>2147483647)throw new a("Provide Meridian asOf as Unix seconds within the GraphQL Int range.");let e;if(t.search!==void 0&&(e=A(t.search).trim(),e.length>500))throw new a("Keep the Meridian market search to 500 characters.");let c=t.conditionId===void 0?void 0:M(t.conditionId),d=t.resolver===void 0?void 0:b(t.resolver),f=await w("GetOpenConditions",ae,{now:s,first:o,...r===void 0?{}:{after:r},...e===void 0?{}:{search:e},...c===void 0?{}:{conditionIds:[c]},...d===void 0?{}:{resolvers:[d]}}),p=Z(f.conditions,o,r),h=p.nodes.map(x=>{let i=C(x);if(!Number.isSafeInteger(i.endTime)||i.endTime<0||i.estimatedPrice!==null&&(typeof i.estimatedPrice!="number"||!Number.isFinite(i.estimatedPrice)||i.estimatedPrice<0||i.estimatedPrice>1))throw new a("Meridian returned invalid market pricing or time.");let k=M(i.conditionId),T=b(i.resolver);if(c!==void 0&&!I(k,c)||d!==void 0&&!I(T,d))throw new a("Meridian returned a different condition or resolver than requested.");return{conditionId:k,resolver:T,question:A(i.question),shortName:i.shortName===null?null:A(i.shortName),optionName:i.optionName===null?null:A(i.optionName),endTime:String(i.endTime),estimatedPrice:i.estimatedPrice===null?null:String(i.estimatedPrice),marketType:i.marketType===null?null:A(i.marketType)}});return{chainId:g,collateral:{...v},totalCount:p.totalCount,markets:h,limit:o,nextCursor:p.nextCursor,complete:p.complete,asOf:String(s)}}async function ie(t,o){let r=b(t.positionToken),s=R(t.amount);if(BigInt(s)===0n)throw new a("Provide a positive Meridian redemption amount.");let e=await u(),c=D(await e.readContract({address:r,abi:O,functionName:"balanceOf",args:[o]}));if(BigInt(s)>BigInt(c))throw new a("The redemption amount exceeds the wallet position balance.");let d=n.unsignedTx({to:S,chainId:g,value:"0",data:Q({abi:U,functionName:"redeem",args:[r,BigInt(s),J]}),description:`Redeem ${s} Meridian position base units for USDe.`}),f=[d],p;try{p=await n.preview(f,o)}catch(i){if(!/\breverted\b/i.test(n.plainError(i)))throw i;let k=await m(o,r);if(k.length!==1)throw new a("Direct Meridian redemption reverted and no unique indexed prediction was found for this token. Retry indexing or use meridian_settle with the known predictionId first.");let T=k[0];if(T.pickConfig.resolved){let re=D(await e.readContract({address:S,abi:U,functionName:"getClaimableAmount",args:[T.pickConfigId,r,BigInt(s)]}));if(BigInt(re)===0n)throw i}f=[L(T.prediction.predictionId),d],p=await n.preview(f,o)}let h=p.changes.filter(i=>ue(i.token,v)&&i.token.decimals===v.decimals).reduce((i,k)=>i+BigInt(k.amount),0n),x=p.changes.filter(i=>i.token.chainId===g&&I(i.token.address,r)).reduce((i,k)=>i+BigInt(k.amount),0n);if(h<=0n||x!==-BigInt(s))throw new a("Meridian preview did not show the requested position burn and a positive USDe payout.");return _(f,p,f.length===2?"Settle the prediction, then redeem for USDe. Unsigned transactions only.":"Redeem the position for USDe. Unsigned transaction only.")}function $(t,o,r,s,e){return{name:t,inputSchema:{type:"object",properties:o,required:r,additionalProperties:!1,description:s},execute:(c,d)=>y(async()=>{if(C(c),b(d),Object.keys(c).some(f=>!Object.hasOwn(o,f))||r.some(f=>c[f]===void 0))throw new a("Provide only the required Meridian tool inputs.");return e(c,d)})}}return{tools:[$("meridian_browse",{search:{type:"string",minLength:1,maxLength:500},cursor:V,limit:W,conditionId:K,resolver:B,asOf:H("Reuse the returned Unix seconds with cursor.")},[],"Search open Meridian conditions or look up a conditionId/resolver. Follow nextCursor with the same filters and asOf.",te),$("meridian_positions",{cursor:V,limit:W},[],"Page through indexed Meridian positions with on-chain balances and claimability. Follow nextCursor until null; indexing can lag transfers.",async(t,o)=>{let r=Y(t.limit,10),s=X(t.cursor),e=await l(o,r,s);return{positions:await P(e.nodes.map(c=>ee(c,o)),o),totalCount:e.totalCount,limit:r,nextCursor:e.nextCursor,complete:e.complete,scope:"Indexed positions with current on-chain balances. Index totalCount may exclude zero-balance rows. Indexing can lag transfers; redeem known settled tokens directly."}}),$("meridian_settle",{predictionId:K},["predictionId"],"Preview an unsigned unilateral settlement; unresolved or already settled predictions may revert.",async(t,o)=>{let r=L(M(t.predictionId));await u();let s=[r];return _(s,await n.preview(s,o),"Settle the Meridian prediction. Unsigned transaction only.")}),$("meridian_redeem",{positionToken:B,amount:H("Position token amount in base units.")},["positionToken","amount"],"Preview redemption of a known position token directly; scan all indexed pages for settlement first if required. No approval or typed signature.",ie)],positions:t=>y(()=>q(t))}},we=le;export{le as a,we as b};
@@ -1 +0,0 @@
1
- import{a as r,e as x}from"./GGUEKSR4.js";import{n as F}from"./JPOYTTTW.js";import{a as k}from"./UWOFA6GV.js";import{a as p}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";import{encodeFunctionData as C,getAddress as b,parseAbi as E}from"viem";var s={chainId:4663,usdg:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",v4:{poolManager:"0x8366a39CC670B4001A1121B8F6A443A643e40951",swapper:"0x7Cd4E04E433E69e588728c86A3832753B5F846d4",quoter:"0x8dc178efb8111bb0973dd9d722ebeff267c98f94",stateView:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"},v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},tokens:[{symbol:"AAPL",token:"0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",pools:[{v:3,fee:500,pool:"0xAae0d815EE56e4092a5E5C2911E676Fea50B2d6D"},{v:4,fee:3e3,tickSpacing:60,id:"0xc748f4671a867db48b552f6b7650bf3255e05f80f00e3f7aad1b17ccb7898fdb"},{v:3,fee:3e3,pool:"0x783C9bbB765047CFdD2b84b92b2Ca9F11D34b7Ed"}]},{symbol:"AMD",token:"0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",pools:[{v:3,fee:3e3,pool:"0x48D284A2A4d3DC1b3Da08231Fe44317e7e7Aa51f"}]},{symbol:"AMZN",token:"0x12f190a9F9d7D37a250758b26824B97CE941bF54",pools:[{v:3,fee:3e3,pool:"0x8AC92DA74AB5F3b1d024Dc1943Ad7e15Dc4179Ef"},{v:4,fee:2400,tickSpacing:24,id:"0xefc94885c96b02696b9b45de43eeeb8ac53c0199cab42b4daae4911b96fb8825"}]},{symbol:"ASML",token:"0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",pools:[{v:3,fee:1e4,pool:"0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1"}]},{symbol:"BABA",token:"0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x1791fc651cc794a282e5dbcb56d0b2b38eff8754b677c8876e86901521ecc439"},{v:3,fee:3e3,pool:"0xa57ab582b310dd6f9e934EA1EEEa152741545E6A"}]},{symbol:"COIN",token:"0x6330D8C3178a418788dF01a47479c0ce7CCF450b",pools:[{v:4,fee:2500,tickSpacing:25,id:"0xe2e1a0e32205e854525e0fb1d3667a53bd3b4919f032b9bcd2a038b6b6dac314"},{v:4,fee:1e4,tickSpacing:200,id:"0x007a13fa152f6dc383cad20a8eaab4e1e2538b606936eae2a424f8aa47d6db31"}]},{symbol:"CRCL",token:"0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",pools:[{v:3,fee:3e3,pool:"0x654E4143e82a5824445Ade0824351C2A9ACD95a8"},{v:4,fee:3e3,tickSpacing:30,id:"0x628c98ab436ee34a6a7decd606242890582591bdf7c9a35d90e0d08021c31ea0"},{v:4,fee:1500,tickSpacing:15,id:"0x5177eac8c2176468bbf15e44081e151d35c2e7d068e96d3db94f496a4dc944b2"}]},{symbol:"CRWV",token:"0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x237014478f7ef98afbe7412ac35b6a3f96b8fb111de48b7c4dbf49dba4bd9c4b"}]},{symbol:"DELL",token:"0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",pools:[{v:3,fee:1e4,pool:"0xc30c89cB7815A1488b7998D15eEC73961707Fc5a"}]},{symbol:"GME",token:"0x1b0E319c6A659F002271B69dB8A7df2F911c153E",pools:[{v:3,fee:500,pool:"0xE2b46c905E12Ab8E2f864e4821a4325884C1B126"}]},{symbol:"GOOGL",token:"0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",pools:[{v:3,fee:500,pool:"0x34D0dC122CF9A8Eb296fC5e0D3A233625D7d19b7"},{v:4,fee:300,tickSpacing:3,id:"0x43fe16b75cabbf38f5b185d16142b02d1d9200d8f1ba17cb6cf899f562c6197f"},{v:4,fee:3e3,tickSpacing:60,id:"0xd4ecb79fdc521d7725d22b33ed43cb4e47aa96bfad76aa29577e3151f723ac5e"}]},{symbol:"INTC",token:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",pools:[{v:3,fee:3e3,pool:"0x2e5a92f5013a64661A49312111be2e8aBd33F56a"}]},{symbol:"META",token:"0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",pools:[{v:4,fee:310,tickSpacing:3,id:"0xc58bb68060bcb7b3ea0f6d4a4afef1e57f628722e808db12afb6d1733552872f"},{v:3,fee:3e3,pool:"0x107a7Cb40d8665360ba10E59471Af06150A50922"},{v:4,fee:3e3,tickSpacing:60,id:"0x5875d407a42965b0e768c8925cea290e06fa50603ef34fc99eb92a1050e6ae36"}]},{symbol:"MSFT",token:"0xe93237C50D904957Cf27E7B1133b510C669c2e74",pools:[{v:3,fee:3e3,pool:"0xeb60bCD1D920ad6E102690CCFC6fB488899E1510"},{v:4,fee:3e3,tickSpacing:60,id:"0x9194a557b6a6bb2236b49ea7e2bbccec5d3eeb705aef00903be4b3de1d949579"}]},{symbol:"MSTR",token:"0xec262a75e413fAfD0dF80480274532C79D42da09",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x319bac87e616a89e241c10aeb8afd4892a852cdd8b373cd9765ecddc40b87cfe"},{v:4,fee:2400,tickSpacing:24,id:"0xc105b8300ff65d750a0e4e63c7a879e20504069b770713464a5315e797735326"}]},{symbol:"MU",token:"0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",pools:[{v:3,fee:3e3,pool:"0xd057B1Bc54917855BBee58eAd58647f47caB35E5"}]},{symbol:"NBIS",token:"0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",pools:[{v:4,fee:9900,tickSpacing:99,id:"0x7c2f9ce1214ba9baf56d1b6a1fc640c1b63e9a711172c0c7d10e5a9c4a3d4f0c"}]},{symbol:"NVDA",token:"0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",pools:[{v:3,fee:500,pool:"0xd4EB21209C4D6093f80B5b84f5C45cc093EA14a3"},{v:4,fee:100,tickSpacing:1,id:"0x6444a8e0b267406a15db74ca00c4a24bdfa81ed3180f5b6d0851f8ed6f4f29c5"},{v:4,fee:3e3,tickSpacing:60,id:"0x3bb34a44f1b2b5f32c034c38a53065a521a47b199700fa9bd19d60985ff24bf1"}]},{symbol:"ORCL",token:"0xb0992820E760d836549ba69BC7598b4af75dEE03",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0xc2ce4784e1e72cf0221b51b30c8aaadf6c0b12863cf03ab3687854fb7b1d850a"}]},{symbol:"PLTR",token:"0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",pools:[{v:4,fee:1500,tickSpacing:15,id:"0xc59eaeda6d1a6f031bc7e1d039772f2d675e7b4de2c8668610f4471bd60b3802"},{v:3,fee:3e3,pool:"0x851680416A4f4E1c463d45171d61ACDdBc8554c0"}]},{symbol:"QQQ",token:"0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",pools:[{v:3,fee:500,pool:"0xD60A5d14dB690B7Afad71F76B108071D7175597d"}]},{symbol:"SGOV",token:"0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",pools:[{v:3,fee:500,pool:"0x6Ba50150B17Ffd0972915Aaf04fFd5E8f4Fa49b4"},{v:3,fee:3e3,pool:"0xfAb520051f96F4D2a32c22B6a3dD7fFfdf231bFe"}]},{symbol:"SLV",token:"0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",pools:[{v:3,fee:3e3,pool:"0x8cB787e6c315D464775289BaD00FDD67d53Ecb3D"},{v:3,fee:1e4,pool:"0x0Fa7BC480885DCf58Ad2ef63eC7289cF2481D51c"}]},{symbol:"SNDK",token:"0xB90A19fF0Af67f7779afF50A882A9CfF42446400",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0x2707cb88a6a40fa0f948f58958051ba097d6f6a3cf7f87929bd68ccc5becea24"}]},{symbol:"SPCX",token:"0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",pools:[{v:3,fee:500,pool:"0xc61284332117c3FB23A2A56cceFFD07F7aF60029"},{v:3,fee:3e3,pool:"0xEb07d9587eFD1778dFb9c385Ec43EF6d5F9fE401"}]},{symbol:"SPY",token:"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",pools:[{v:4,fee:100,tickSpacing:1,id:"0xe1ae6a4c6ccc9f037389a8d50a4f577bde1a9fe01d85d88ecbbd39955ce53288"},{v:3,fee:500,pool:"0xa7Bb1AC63BBaB0C44316E6c8C455213441689167"},{v:4,fee:500,tickSpacing:5,id:"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"}]},{symbol:"TSLA",token:"0x322F0929c4625eD5bAd873c95208D54E1c003b2d",pools:[{v:3,fee:3e3,pool:"0xf4ACdAEEB7022862A763C9B1B885e11191c889E3"},{v:4,fee:3e3,tickSpacing:60,id:"0x8517f8071ae5b831b738052f12125e8e3d6c158b78728aa44ce3b25e5104d32e"}]},{symbol:"TSM",token:"0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",pools:[{v:4,fee:7500,tickSpacing:75,id:"0x0ba5d53d2f6255f334b7c8ead4f56b6aef5af3402c5e4d11180afd38c6b85fb1"},{v:3,fee:1e4,pool:"0x07e8Ea83D4C1340774c8965125e26e12bf943bf1"}]},{symbol:"USAR",token:"0xd917B029C761D264c6A312BBbcDA868658eF86a6",pools:[{v:3,fee:3e3,pool:"0x04391780F519B7d3ba59c9590459D76e23d225C4"}]},{symbol:"USO",token:"0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",pools:[{v:4,fee:1200,tickSpacing:15,id:"0x1f2ad5a274a776d8e1408292bde1d92d8fa7b6444acf14ad60b9c3e4e5b66420"},{v:3,fee:3e3,pool:"0x02175608F1b5E6b5ed221cCFdC7Be197D111D915"}]}],notOffered:{CLSK:"thin",EWY:"thin",IONQ:"thin",RGTI:"thin",RKLB:"thin"},sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309"};var S="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",w="(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)",D=E([`function swapExactIn(${S} key,bool zeroForOne,uint128 amountIn,uint256 minOut,uint160 sqrtPriceLimitX96,address to,uint256 deadline) returns (uint256 paid,uint256 out)`,`function exactInputSingle(${w} params) payable returns (uint256 amountOut)`,"function multicall(uint256 deadline,bytes[] data) payable returns (bytes[] results)"]),O=E(["function quoteExactInputSingle((address tokenIn,address tokenOut,uint256 amountIn,uint24 fee,uint160 sqrtPriceLimitX96) params) returns (uint256 amountOut,uint160 sqrtPriceX96After,uint32 initializedTicksCrossed,uint256 gasEstimate)"]),P=E([`function quoteExactInputSingle((${S} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)`]),q="0x0000000000000000000000000000000000000000",A={symbol:{type:"string",enum:s.tokens.map(o=>o.symbol)},side:{type:"string",enum:["buy","sell"]},amountIn:k()};async function v(o,i){let t=s.tokens.find(c=>c.symbol===o.symbol);if(!t||o.side!=="buy"&&o.side!=="sell")throw new d("Choose a published stock symbol and buy or sell.");let e=await F(String(o.symbol),{context:i});if(e.kind!=="official_stock"||e.address!==b(t.token))throw new d("Published Priors stock pool does not match the official stock contract address. Retry after the pool mapping is updated.");let n=x(o.amountIn,"amountIn",128);if(n===0n)throw new d("amountIn must be positive base units.");return{token:t,identity:e,amount:n,input:o.side==="buy"?r.usdg:b(t.token),output:o.side==="buy"?b(t.token):r.usdg}}function B(o,i,t){let[e,n]=BigInt(r.usdg)<BigInt(o)?[r.usdg,o]:[o,r.usdg];return{currency0:e,currency1:n,fee:i,tickSpacing:t,hooks:q}}function j(o){return{tools:[{name:"priors_stock_quote",inputSchema:{type:"object",properties:A,required:Object.keys(A),additionalProperties:!1},async execute(i,t){if(o.network==="testnet")throw new d("Priors stock swaps require mainnet chain 4663.");let e=await v(i,o),n=o.clientFor(p),c=await n.getBlockNumber({cacheTime:0}),l=await Promise.all(e.token.pools.map(async(a,u)=>{try{let f=B(b(e.token.token),a.fee,"tickSpacing"in a?a.tickSpacing:0),m=a.v===3?await n.simulateContract({address:b(s.v3.quoter),abi:O,functionName:"quoteExactInputSingle",args:[{tokenIn:e.input,tokenOut:e.output,amountIn:e.amount,fee:a.fee,sqrtPriceLimitX96:0n}],account:t,blockNumber:c}):await n.simulateContract({address:b(s.v4.quoter),abi:P,functionName:"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:e.input===f.currency0,exactAmount:e.amount,hookData:"0x"}],account:t,blockNumber:c});return{poolIndex:u,version:a.v,amountOut:m.result[0].toString()}}catch(f){return{poolIndex:u,version:a.v,error:o.plainError(f)}}}));return{chainId:p,blockNumber:c.toString(),token:e.identity,quotes:l,warning:"Use explicit minimum output with priors_stock_swap and inspect its preview. Issuer restrictions can prevent sale. Quote is no promise of an exit; local regional eligibility remains required."}}},{name:"priors_stock_swap",inputSchema:{type:"object",properties:{...A,poolIndex:{type:"integer",minimum:0,maximum:2},minOut:k(),deadline:k(),eligible:{type:"boolean",description:"Operator/user affirms eligibility for this stock-token trade in their jurisdiction."}},required:[...Object.keys(A),"poolIndex","minOut","deadline","eligible"],additionalProperties:!1},async execute(i,t){if(o.network==="testnet")throw new d("Priors stock swaps require mainnet chain 4663.");if(t=b(t),i.eligible!==!0)throw new d("Confirm local eligibility for Robinhood stock tokens before trading.");let e=await v(i,o),n=x(i.minOut,"minOut"),c=x(i.deadline,"deadline"),l=BigInt(Math.floor(Date.now()/1e3));if(n===0n||c<=l||c>l+1800n||!Number.isSafeInteger(i.poolIndex))throw new d("Provide positive minOut, poolIndex and a deadline within 30 minutes.");let a=e.token.pools[i.poolIndex];if(!a)throw new d("No published pool at that index. Read priors_stock_quote.");let u=B(b(e.token.token),a.fee,"tickSpacing"in a?a.tickSpacing:0),f=e.input===u.currency0,m=b(a.v===3?s.v3.router:s.v4.swapper),g=a.v===3?C({abi:D,functionName:"multicall",args:[c,[C({abi:D,functionName:"exactInputSingle",args:[{tokenIn:e.input,tokenOut:e.output,fee:a.fee,recipient:t,amountIn:e.amount,amountOutMinimum:n,sqrtPriceLimitX96:0n}]})]]}):C({abi:D,functionName:"swapExactIn",args:[u,f,e.amount,n,f?4295128740n:1461446703485210103287273052203988822378723970341n,t,c]}),y=[o.approval(e.input,m,e.amount.toString(),p),o.unsignedTx({to:m,data:g,value:"0",chainId:p,description:`Priors stock ${i.side}: ${e.amount} input base units; minimum ${n}; pinned V${a.v} pool.`})],h=await o.preview(y,t);return{txs:y,expiresAt:c.toString(),summary:`Stock ${i.side} ${i.symbol}: input ${e.amount} base units (${e.input}), minimum output ${n} (${e.output}), receiver ${t}, deadline ${c}. Issuer transfer/sale restrictions apply. Price impact is not measured by this builder; inspect minOut and the preview. ${h.summary}`}}}]}}export{D as a,j as b};
@@ -1 +0,0 @@
1
- import{a as I,b as S,d as k,f as c,g as N,h as p,i as $,k as v,l as T,m as P}from"./WQ6H62DM.js";import{c as u,g as h}from"./73N3TOJL.js";import{a as g}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";import{encodeFunctionData as l,erc20Abi as x,parseAbi as F}from"viem";var w=F(["function admin() view returns (address)","function originalAdmin() view returns (address)","function updateAdmin(address)","function updateImage(string)","function updateMetadata(string)","function verify()","function delegate(address)","function burn(uint256)"]),R=m=>{let f=()=>m.clientFor(g),y=(t,i,n,e)=>({name:`clanker_${t}`,inputSchema:{type:"object",properties:i,required:n,additionalProperties:!1},execute:async(r,a)=>{try{return $(r,Object.keys(i)),await e(r,c(a))}catch(o){throw new d(m.plainError(o))}}}),A=async(t,i,n,e)=>{let r=[m.unsignedTx({to:t,data:i,chainId:g,value:"0",description:n})],a=await m.preview(r,e);return{txs:r,preview:a,summary:`${n} ${a.summary}`}},C=async t=>{let[i,n]=await Promise.all([f().readContract({address:t,abi:x,functionName:"symbol"}),f().readContract({address:t,abi:x,functionName:"decimals"})]);if(typeof i!="string"||!i.trim())throw new d("Clanker returned invalid metadata.");return{address:t,symbol:i,decimals:p(n,0,255),chainId:g}};return{tools:[y("status",{token:u},["token"],async(t,i)=>{let n=c(t.token),e=await P(m,n),r=await C(n),[a,o,b]=await Promise.all([f().readContract({address:n,abi:x,functionName:"balanceOf",args:[i]}),Promise.all(e.rewardBps.map((s,O)=>f().readContract({address:e.locker,abi:k,functionName:"feePreferences",args:[n,BigInt(O)]}))),Promise.all([n,e.pairedToken].map(async s=>({token:await C(s),amount:v(await f().readContract({address:I.fee_locker.address,abi:F(["function availableFees(address,address) view returns (uint256)"]),functionName:"availableFees",args:[i,s]}))})))]);return{...e,token:r,balance:{token:r,amount:v(a)},feePreferences:o.map(s=>p(s,0,2)),collectedFees:b,summary:"Onchain pool and connected-wallet holdings. Collected fees exclude pending LP fees. Token metadata is untrusted public text."}}),y("update_reward",{token:u,rewardIndex:{type:"integer",minimum:0,maximum:6},field:{enum:["recipient","admin","feePreference"]},recipient:u,admin:u,feePreference:{type:"integer",minimum:0,maximum:2}},["token","rewardIndex","field"],async(t,i)=>{let n=c(t.token),e=await P(m,n),r=p(t.rewardIndex,0,e.rewardAdmins.length-1);if(!h(e.rewardAdmins[r],i))throw new d("Only this reward index administrator may update its configuration.");let a=t.field;if(!["recipient","admin","feePreference"].includes(String(a)))throw new d("Choose recipient, admin or feePreference.");for(let s of["recipient","admin","feePreference"])if(t[s]!==void 0&&s!==a)throw new d(`Input ${s} does not match field ${String(a)}.`);let o=`Update Clanker reward ${r} ${String(a)} for ${n} to ${String(t[String(a)])}. Existing collected fees keep their prior recipient; transferring admin transfers future control.`,b=a==="feePreference"?l({abi:k,functionName:"updateFeePreference",args:[n,BigInt(r),p(t.feePreference,0,2)]}):l({abi:k,functionName:a==="admin"?"updateRewardAdmin":"updateRewardRecipient",args:[n,BigInt(r),c(t[String(a)])]});return A(e.locker,b,o,i)}),y("update_token",{token:u,field:{enum:["image","metadata","admin","verify","delegate","burn"]},text:{type:"string"},recipient:u,amount:S},["token","field"],async(t,i)=>{let n=c(t.token);await T(m,n);let e=t.field;if(!["image","metadata","admin","verify","delegate","burn"].includes(String(e)))throw new d("Choose a supported token update.");let r=e==="image"||e==="metadata"?"text":e==="admin"||e==="delegate"?"recipient":e==="burn"?"amount":void 0;for(let o of["text","recipient","amount"])if(t[o]!==void 0&&o!==r)throw new d(`Input ${o} does not match this token update.`);if(["image","metadata","admin","verify"].includes(String(e))){let o=await f().readContract({address:n,abi:w,functionName:e==="verify"?"originalAdmin":"admin"});if(!h(c(o),i))throw new d("The connected wallet is not the required token administrator.")}let a;if(e==="image"||e==="metadata"){if(typeof t.text!="string")throw new d("Provide public metadata text.");a=l({abi:w,functionName:e==="image"?"updateImage":"updateMetadata",args:[t.text]})}else if(e==="admin"||e==="delegate")a=l({abi:w,functionName:e==="admin"?"updateAdmin":"delegate",args:[c(t.recipient,e==="delegate")]});else if(e==="verify")a=l({abi:w,functionName:"verify"});else{let o=N(t.amount);if(!o)throw new d("Provide a positive burn amount.");a=l({abi:w,functionName:"burn",args:[o]})}return A(n,a,`Clanker token ${n}: ${String(e)} ${String(t.text??t.recipient??t.amount??"")}. Burns are irreversible; verification records original-admin approval, not an Oak safety review.`,i)})]}};export{R as a};
@@ -1 +0,0 @@
1
- import{d as _,e as oe,f as M,h as te,i as N}from"./IBXYIN7Q.js";import{E as P,a as Z,b as J,c as v,f as C,h as b,m as A,q as x,s as Q,u as ee}from"./YOENHHKI.js";import{f as D,g as Y}from"./6ZYLNB2B.js";import{a as $}from"./CY75R4FK.js";import{a as G}from"./6IM6A5VA.js";import{g as S}from"./73N3TOJL.js";import{a as w}from"./G6HCV67X.js";import{a as k,b as X,d as j}from"./5YS5V2LK.js";import{decodeAbiParameters as fe,getAddress as y,pad as se,parseAbi as ae,parseAbiParameters as me,toEventSelector as he,toHex as ne,zeroAddress as de}from"viem";var ge=he("Initialize(bytes32,address,address,uint24,int24,address,uint160,int24)"),ke=me("uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick"),V=10000000n,ce=25,H=200,L=16,we=3e3,Pe=500,ye=500n,E=100,B=ae(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),be=ae(["function poolKeys(bytes25 poolId) view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)"]);function Ae(o){let e=o.trim().toLowerCase();return e==="eth"||e==="native"||e===de||e===$.toLowerCase()}function ie(o,e){if(o!=null){if(typeof o!="string")throw new k(`${e} must be a token address, or "eth" for native ETH.`);return Ae(o)?{eth:!0}:(G(o),{eth:!1,address:y(o)})}}var le=(o,e)=>BigInt(o)<BigInt(e)?-1:BigInt(o)>BigInt(e)?1:0;function T(o){return{address:o.address,symbol:o.symbol,decimals:o.decimals}}async function ue(o,e,r,i,d){let[t,n,u]=await Promise.all([o.readContract({address:e,abi:N,functionName:"slot0"}),o.readContract({address:e,abi:N,functionName:"liquidity"}),o.readContract({address:e,abi:N,functionName:"tickSpacing"})]),s=BigInt(t[0]);return{version:"v3",id:e,token0:T(r),token1:T(i),fee:d,tickSpacing:Number(u),initialized:s>0n,liquidity:BigInt(n).toString(),sqrtPriceX96:s.toString(),tick:Number(t[1]),price:s>0n?D(s,r.decimals,i.decimals):"0",addSupported:!0}}async function q(o,e,r){let i=r??Q(e),[d,t]=await Promise.all([P(o,e.currency0,w),P(o,e.currency1,w)]),[n,u]=await Promise.all([o.readContract({address:v,abi:B,functionName:"getSlot0",args:[i]}),o.readContract({address:v,abi:B,functionName:"getLiquidity",args:[i]})]),s=BigInt(n[0]),m=ee(e,Number(n[3]));return{version:"v4",id:i,token0:T(d),token1:T(t),fee:e.fee,tickSpacing:e.tickSpacing,hooks:y(e.hooks),initialized:s>0n,liquidity:BigInt(u).toString(),sqrtPriceX96:s.toString(),tick:Number(n[1]),price:s>0n?D(s,d.decimals,t.decimals):"0",addSupported:x.has(e.hooks.toLowerCase()),feeNote:m.feeNote,...x.has(e.hooks.toLowerCase())?{}:{note:`Hook ${y(e.hooks)} is not one Oak has measured, so uniswap_add will refuse this pool.`}}}async function Ie(o,e,r){let i=await o.getBlockNumber(),d=new Map;for(let t=0n;t<=i;t+=V){let n=t+V-1n<i?t+V-1n:i,u=await o.request({method:"eth_getLogs",params:[{address:Z.toLowerCase(),topics:[ge,null,e?se(e):null,r?se(r):null],fromBlock:ne(t),toBlock:ne(n)}]});if(!Array.isArray(u))throw new k("Invalid v4 Initialize log response.");for(let s of u){if(!Array.isArray(s.topics)||s.topics.length!==4||typeof s.data!="string")throw new k("Invalid v4 Initialize log.");let[m,a,p]=fe(ke,s.data),h={currency0:y(`0x${s.topics[2].slice(-40)}`),currency1:y(`0x${s.topics[3].slice(-40)}`),fee:Number(m),tickSpacing:Number(a),hooks:y(p)};d.set(s.topics[1].toLowerCase(),{key:h,id:s.topics[1]})}}return[...d.values()]}async function ve(o,e,r){let i=e.eth?_.weth:e.address,d=r.eth?_.weth:r.address;if(i===d)return[];let[t,n]=le(i,d)<0?[i,d]:[d,i],[u,s]=await Promise.all([P(o,t,w),P(o,n,w)]),m=[];for(let a of Object.keys(oe).map(Number)){let p=y(String(await o.readContract({address:_.factory,abi:te,functionName:"getPool",args:[t,n,a]})));p!==de&&m.push(await ue(o,p,u,s,a))}return m}function re(o){return o?o.eth?[b,C]:o.address===C?[C,b]:[o.address]:null}async function Ce(o,e){let r=new Map;if(e.length===0)return r;if(typeof o.multicall=="function"&&o.chain?.contracts?.multicall3)try{return(await o.multicall({allowFailure:!0,contracts:e.map(d=>({address:v,abi:B,functionName:"getLiquidity",args:[d]}))})).forEach((d,t)=>r.set(e[t].toLowerCase(),d.status==="success"?BigInt(d.result):0n)),r}catch{}for(let i=0;i<e.length;i+=L)(await Promise.allSettled(e.slice(i,i+L).map(async t=>BigInt(await o.readContract({address:v,abi:B,functionName:"getLiquidity",args:[t]}))))).forEach((t,n)=>r.set(e[i+n].toLowerCase(),t.status==="fulfilled"?t.value:0n));return r}async function Se(o,e,r,i){let d=re(e),t=re(r),n=new Map,u=(c,f)=>{if(c&&f){if(c===f)return;let[l,g]=le(c,f)<0?[c,f]:[f,c];n.set(`${l}/${g}`,[l,g])}else if(c||f){let l=c??f;n.set(`${l}/*0`,[l,null]),n.set(`${l}/*1`,[null,l])}};for(let c of d??[null])for(let f of t??[null])u(c,f);let s=new Map;for(let c of A)[...n.values()].some(([l,g])=>(!l||S(c.key.currency0,l))&&(!g||S(c.key.currency1,g)))&&s.set(c.poolId.toLowerCase(),{key:c.key,id:c.poolId});for(let[c,f]of n.values())for(let l of await Ie(o,c,f))s.set(l.id.toLowerCase(),l);let m=new Set(A.map(c=>c.poolId.toLowerCase())),a=[...s.values()],p=a.filter(c=>m.has(c.id.toLowerCase())),h=a.filter(c=>!m.has(c.id.toLowerCase())).reverse(),I=typeof o.multicall=="function"&&!!o.chain?.contracts?.multicall3?we:Pe;h.length>I&&i.push(`${h.length} v4 pools match; only the newest ${I} non-measured ones were considered. Pass both tokens, or a poolId, to narrow.`);let U=h.slice(0,I),z=await Ce(o,U.map(c=>c.id)),pe=U.sort((c,f)=>{let l=z.get(c.id.toLowerCase())??0n,g=z.get(f.id.toLowerCase())??0n;return l===g?0:l<g?1:-1}),R=[...p,...pe];R.length>H&&i.push(`${R.length} v4 pools match; full state was read for Oak's measured pools plus the deepest of the rest (${H} total). Pass both tokens, or a poolId, to narrow.`);let K=[],O=0,W=R.slice(0,H);for(let c=0;c<W.length;c+=L){let f=await Promise.allSettled(W.slice(c,c+L).map(({key:l,id:g})=>q(o,l,g)));for(let l of f)l.status==="fulfilled"?K.push(l.value):O++}return O>0&&i.push(`${O} pool(s) were skipped because a token or pool state could not be read.`),K}async function _e(o,e){let r=A.find(s=>S(s.poolId,e));if(r)return q(o,r.key,r.poolId);let[i,d,t,n,u]=await o.readContract({address:J,abi:be,functionName:"poolKeys",args:[e.slice(0,52)]});if(i===b&&d===b&&Number(n)===0)throw new k(`No Uniswap v4 pool ${e} is known to the PositionManager (no position was ever minted in it, or it is not initialized). Search by token pair instead.`);return q(o,{currency0:i,currency1:d,fee:Number(t),tickSpacing:Number(n),hooks:u},e)}function Ne(o){let e=new Set([...A.map(t=>t.poolId.toLowerCase()),...M.map(t=>t.address.toLowerCase())]),r=new Set([b,$.toLowerCase(),C.toLowerCase()]),i=t=>r.has(t.address.toLowerCase())?"ETH":t.address.toLowerCase(),d=new Map;for(let t of o.filter(n=>n.initialized&&BigInt(n.liquidity)>0n)){let n=`${i(t.token0)}/${i(t.token1)}`;d.set(n,[...d.get(n)??[],t])}for(let t of d.values()){let n=t.filter(a=>e.has(a.id.toLowerCase()));if(n.length===0&&t.length<3)continue;let s=(n.length>0?n:t).map(a=>BigInt(a.sqrtPriceX96)).sort((a,p)=>a<p?-1:a>p?1:0),m=s[Math.floor(s.length/2)];for(let a of t){if(e.has(a.id.toLowerCase()))continue;let p=Y(BigInt(a.sqrtPriceX96),m);p>ye&&(a.priceOutlierBps=Number(p),a.note=`${a.note?`${a.note} `:""}Price differs ${p} bps from the ${n.length>0?"Oak-measured":"median"} price for this pair; do not treat this pool as the market price.`)}}}async function Ee(o,e){let r=e.version;if(r!==void 0&&r!=="v3"&&r!=="v4")throw new k('version must be "v3" or "v4"; omit it to search both.');let i=e.limit===void 0?ce:Number(e.limit);if(!Number.isInteger(i)||i<1||i>E)throw new k(`limit must be an integer from 1 to ${E}.`);let d=ie(e.tokenA,"tokenA"),t=ie(e.tokenB,"tokenB");if(!d&&t)throw new k("Provide tokenA when searching by token; tokenB narrows the search to a pair.");let n=o.clientFor(w),u=[],s=[];if(e.poolId!==void 0){if(typeof e.poolId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.poolId))throw new k("poolId must be a 32-byte hex v4 poolId. For v3 search by tokenA/tokenB.");s=[await _e(n,e.poolId)]}else if(d){if(r!=="v4"&&(t?s.push(...await ve(n,d,t)):u.push("v3 pools are looked up per pair; pass tokenB to include them.")),r!=="v3")try{s.push(...await Se(n,d,t,u))}catch(a){throw X(a,-32601)?a:new k(`Could not search v4 pools. ${j(a)}`)}}else{u.push("No token filter given: showing the pools Oak has measured. Pass tokenA (and tokenB) to search the chain for every pool of a pair.");let a=await Promise.all(M.map(async h=>{let[F,I]=await Promise.all([P(n,h.token0,w),P(n,h.token1,w)]);return ue(n,h.address,F,I,h.fee)})),p=await Promise.all(A.map(h=>q(n,h.key,h.poolId)));s=[...r==="v4"?[]:a,...r==="v3"?[]:p]}Ne(s),s.sort((a,p)=>BigInt(p.liquidity)>BigInt(a.liquidity)?1:BigInt(p.liquidity)<BigInt(a.liquidity)?-1:0),s.length>i&&u.push(`Showing the ${i} deepest of ${s.length} pools found; raise limit (max ${E}) to see more.`),s=s.slice(0,i);let m=s.filter(a=>a.initialized&&BigInt(a.liquidity)>0n).length;return s.length===0&&u.push("No pool exists for this pair. Create one with uniswap_create_pool, or create it and add the first liquidity together with uniswap_add plus initialPrice."),{pools:s,notes:u,summary:`Found ${s.length} Uniswap pool(s), ${m} with active liquidity. price is token1 per 1 token0.`}}function Me(o){return{tools:[{name:"uniswap_pools",inputSchema:{type:"object",description:"Read-only pool discovery on Robinhood Chain (4663): every Uniswap v3 and v4 pool for a token pair with fee, tick spacing, hook, liquidity and price, or one v4 pool by poolId. No tokens given: the measured pools.",properties:{version:{type:"string",enum:["v3","v4"],description:"Limit to one version; omit to search both."},tokenA:{type:"string",description:'Token address, or "eth" for native ETH (searches v3 WETH and v4 native/WETH pools).'},tokenB:{type:"string",description:"Second token of the pair. Required for v3 lookups."},poolId:{type:"string",description:"32-byte v4 poolId to inspect."},limit:{type:"integer",minimum:1,maximum:E,default:ce}}},execute:async r=>Ee(o,r)}]}}export{Ee as a,Me as b};
@@ -1 +0,0 @@
1
- import{b as xe,o as ae}from"./5O5ZE3ZV.js";import{a as re}from"./CY75R4FK.js";import{b as Ie}from"./AXYOJBX6.js";import{a as Te}from"./EG6M6SSO.js";import{a as ke}from"./UWOFA6GV.js";import{e as W,g as p,i as ye,n as be}from"./73N3TOJL.js";import{a as x,i as we}from"./G6HCV67X.js";import{a}from"./5YS5V2LK.js";import{decodeErrorResult as Oe,decodeEventLog as ie,encodeAbiParameters as D,encodeFunctionData as N,erc20Abi as Q,parseAbi as Ne,parseAbiParameters as M,toHex as Ae,zeroAddress as C}from"viem";var h=we[x].poolsTrade,J=h.liquidityLauncher.address,S=h.uerc20BeneficiaryVault.address,ce=h.universalRouter.address,ne=10n**27n,q=(1n<<128n)-1n,ve=`0x${"00".repeat(32)}`,H=63127652n,de=100000n,oe=10000000n,Le=2000n,ue={address:re,symbol:"ETH",decimals:18,chainId:x},m=Ne(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),U=Ne(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),_=[h.instantLaunchStrategyFeesOn.address,h.instantLaunchStrategyFeesOff.address];function se(l){if(l.status!=="success")throw new a("The launch receipt did not succeed.");let c=[];for(let y of l.logs){let F=_.findIndex(O=>p(O,y.address));if(F===-1||y.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let j=ie({abi:U,eventName:"TokenLaunched",data:y.data,topics:[...y.topics]}),{token:T,poolId:Y,poolKey:R,feeSplitter:Z}=j.args,ee=F===0?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address;if(!p(Z,ee)||!p(R.currency0,C)||!p(R.currency1,T)||R.fee!==2500||R.tickSpacing!==25||!p(R.hooks,C))throw new a("The launch does not match the current native ETH strategy.");let P=l.logs.filter(O=>p(O.address,h.v4PositionManager.address)).flatMap(O=>{if(O.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let G=ie({abi:U,eventName:"Transfer",data:O.data,topics:[...O.topics]}).args;return p(G.from,C)&&p(G.to,_[F])?[G.tokenId]:[]});if(P.length!==1)throw new a("The launch receipt must identify one matching position mint.");c.push({token:T,poolId:Y,positionId:P[0].toString(),creatorFees:F===0})}return c}function B(l){return ye(l,"Provide a valid wallet or token address.")}function $(l,c,y=!1){return be(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!y})}function X(l,c,y=!1){if(y&&l===void 0)return"";if(typeof l!="string"||!y&&!l.trim()||l.length>4096)throw new a(`Provide a valid ${c}.`);return l}function le(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new a("Provide a valid launch transaction hash.");return l}function fe(l,c,y="minAmountOut"){let F=c.slippageBps??xe;if(typeof F!="number")throw new a("Slippage must be an integer in basis points.");let j=ae(l.toString(),F),T=c[y]===void 0?BigInt(j):$(c[y],y,l===0n);if(T>l||l>0n&&T===0n||T>q)throw new a("The minimum output must be positive and no larger than the simulated output.");return T}var Ee=l=>{let c=l.clientFor(x),y=(e,s,o,n)=>l.unsignedTx({to:e,data:s,value:o.toString(),chainId:x,description:n}),F=e=>{throw new a(l.plainError(e))};async function j(){if(await c.getChainId()!==x)throw new a("pools.trade requires Robinhood Chain 4663.")}async function T(e,s,o){let n=await l.preview(e,s),t=n.changes.map(({token:r,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,r.decimals)} ${r.symbol} (${r.address}, chain ${r.chainId})`});return{txs:e,summary:[o,n.summary,...t].join(" ")}}async function Y(){return(await c.getBlock()).timestamp+600n}function R(e,s,o,n,t,r){let d=[C,e,2500,25,C],i=[D(M("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,s,o,n,0n,"0x"]]),D(M("address,uint256"),[s?C:e,o]),D(M("address,address,uint256"),[s?e:C,t,0n])],f=[D(M("bytes,bytes[]"),["0x060c0e",i])];return{inputs:f,encoded:D(M("bytes,bytes[],uint256"),["0x10",f,r])}}async function Z(e,s){let o=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:s,gas:Ae(Te),to:i.to,data:i.data,value:Ae(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(o)||o.length!==1||!W(o[0])||!Array.isArray(o[0].calls)||o[0].calls.length!==e.length)throw new a("The output simulation returned a malformed response.");let n=o[0].calls;if(!n.slice(0,-1).every(i=>W(i)&&i.status==="0x1"&&!i.error))throw new a("A prerequisite failed during the output simulation.");let t=n.at(-1);if(!W(t)||t.status!=="0x0")throw new a("The output simulation did not return the expected minimum-output control.");let r=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:W(t.error)?t.error.data:void 0;if(typeof r!="string"||!/^0x[0-9a-fA-F]+$/.test(r))throw new a("The output simulation did not report an expected amount.");let d=Oe({abi:m,data:r});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==q||d.args[1]<=0n||d.args[1]>=q)throw new a("The output simulation did not report a valid amount.");return d.args[1]}async function ee(e,s,o,n=()=>!0){let t=await c.getBlockNumber(),r=t<H?0n:(t-H)/oe+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Le)throw new a("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(r*BigInt(_.length+(e&&!o?1:0)));let f=new Map,w=new Set;for(let u=H;u<=t&&n();u+=oe){let b=u+oe-1n>t?t:u+oe-1n,v=(await Promise.all(_.map(k=>c.getLogs({address:k,event:U[0],...s?{args:{token:s}}:{},fromBlock:u,toBlock:b,strict:!0})))).flat(),L=[...new Set(v.map(k=>k.transactionHash))].filter(k=>!k||!f.has(k));for(let k=0;k<L.length&&n();k+=8)await Promise.all(L.slice(k,k+8).map(async E=>{if(!E)throw new a("A launch log is missing its transaction hash.");i();let V=await c.getTransactionReceipt({hash:E});f.set(E,V),n()&&await o?.(V)}));if(!n())break;if(e&&!o){let k=await c.getLogs({address:S,event:U[1],args:{to:e},fromBlock:u,toBlock:b,strict:!0});for(let E of k){let V=ie({abi:U,eventName:"Transfer",data:E.data,topics:E.topics}).args;w.add(V.tokenId.toString())}}}return{receipts:[...f.values()],feeIds:w}}async function P(e){let o=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:le(e.launchTx)})]:(await ee(void 0,e.token===void 0?void 0:B(e.token))).receipts).flatMap(se).filter(n=>e.positionId!==void 0?n.positionId===$(e.positionId,"positionId").toString():p(n.token,B(e.token)));if(o.length!==1)throw new a("No unique current-strategy launch was found. Older strategy generations are unsupported.");return o[0]}async function O(e,s){if(typeof e.creatorFees!="boolean")throw new a("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(B(e.pair),C)&&!p(B(e.pair),re))throw new a("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new a("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&$(e.supply,"supply")!==ne)throw new a("Instant Launch requires a supply of one billion tokens.");let o=B(e.feeBeneficiary);if(p(o,C)||p(o,J))throw new a("The fee beneficiary must be a wallet other than the launcher or zero address.");let n=X(e.name,"name"),t=X(e.symbol,"symbol"),r=e.initialBuy===void 0?0n:$(e.initialBuy,"initialBuy",!0);if(r>q)throw new a("The initial buy exceeds uint128.");if(r===0n&&e.minAmountOut!==void 0)throw new a("A minimum output requires an initial buy.");let d=await c.readContract({address:J,abi:m,functionName:"getGraffiti",args:[s]}),i=B(await c.readContract({address:h.uerc20Factory.address,abi:m,functionName:"getUERC20Address",args:[n,t,18,J,d]})),f=await c.getCode({address:i});if(f&&f!=="0x")throw new a("This wallet already launched that name and symbol.");let w=D(M("(string,string,string,bytes)"),[[X(e.description,"description",!0),X(e.website,"website",!0),X(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?_[0]:_[1],b=[N({abi:m,functionName:"createToken",args:[h.uerc20Factory.address,n,t,18,ne,J,w]}),N({abi:m,functionName:"distributeToken",args:[i,{strategy:u,amount:ne,configData:D(M("address"),[o])},ve]})],v=await Y(),z=k=>{let E=[...b];if(r>0n){let V=D(M("(address,address,bytes)"),[[ce,s,R(i,!0,r,k,s,v).encoded]]);E.push(N({abi:m,functionName:"distributeWithNative",args:[h.universalRouterStrategyApp.address,V,ve,r]}))}return y(J,N({abi:m,functionName:"multicall",args:[E]}),r,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${o}.`)},L=r>0n?fe(await Z([z(q)],s),e):0n;return T([z(L)],s,`Launch ${n} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${o}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${L} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function G(e,s,o){let n=$(e.amountIn,"amountIn");if(n>q)throw new a("The trade amount exceeds uint128.");let t=B(e.token);await P(e);let r=await Y(),d=[];o||(await c.readContract({address:t,abi:Q,functionName:"allowance",args:[s,h.permit2.address]})<n&&d.push(l.approval(t,h.permit2.address,n.toString(),x)),d.push(y(h.permit2.address,N({abi:m,functionName:"approve",args:[t,ce,n,Number(r)]}),0n,`Permit the exact ${n} token base units until ${r}.`)));let i=u=>[...d,y(ce,N({abi:m,functionName:"execute",args:["0x10",R(t,o,n,u,s,r).inputs,r]}),o?n:0n,`${o?"Buy":"Sell"} ${t} with minimum output ${u}.`)],f=await Z(i(q),s),w=fe(f,e);return T(i(w),s,`${o?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${n}, minimum output ${w} ${o?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function pe(e,s,o){let n=await P(e),t=BigInt(n.positionId),r=n.creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,d=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[t]});if(!p(d,r))throw new a("The position is not locked in its current-strategy splitter.");if(!o)return T([y(r,N({abi:m,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],s,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!n.creatorFees)throw new a("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:S,abi:m,functionName:"ownerOf",args:[t]});if(!p(i,s))throw new a("Only the current fee NFT holder is entitled to claim.");let f=await c.readContract({address:S,abi:m,functionName:"amounts",args:[t]}),w=fe(f[0],e,"minEth");if(f[1]!==0n)throw new a("The current buy-only creator fee configuration returned unexpected token fees.");return T([y(S,N({abi:m,functionName:"claim",args:[t,w,0n]}),0n,`Claim collected ETH fees for position ${t} to ${s}.`)],s,`Claim collected fees: ${f[0]} ETH base units (18 decimals), minimum ${w}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function Se(e,s){let o=await P(e),n=B(e.to);if(p(n,C))throw new a("The token recipient cannot be the zero address.");let t=$(e.amount,"amount"),r=await te(o.token,await c.getBlockNumber());return T([y(r.address,N({abi:Q,functionName:"transfer",args:[n,t]}),0n,`Transfer exactly ${t} ${r.symbol} base units to ${n}.`)],s,`Transfer ${t} token base units (token ${r.address}, decimals ${r.decimals}, chain ${r.chainId}) to ${n}. No approval; no transaction sent.`)}async function Be(e,s){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new a("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let o=e.positionIds.map(d=>$(d,"positionId").toString());if(new Set(o).size!==o.length)throw new a("Each position ID must appear once.");let n=e.launchTxs.map(le),t=new Map;for(let[d,i]of o.entries()){let w=(await P({positionId:i,launchTx:n[d]})).creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,u=BigInt(i),b=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[u]});if(!p(b,w))throw new a("The position is not locked in its current-strategy splitter.");t.set(w,[...t.get(w)??[],u])}let r=[...t].map(([d,i])=>y(d,N({abi:m,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return T(r,s,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let K="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function te(e,s){let[o,n]=await Promise.all([c.readContract({address:e,abi:Q,functionName:"symbol",blockNumber:s}),c.readContract({address:e,abi:Q,functionName:"decimals",blockNumber:s})]);if(typeof o!="string"||!o||o.length>256||n!==18)throw new a("The current launch token returned invalid metadata.");return{address:e,symbol:o,decimals:n,chainId:x}}async function me(e,s,o,n){let t=n??await te(e.token,o),r=await c.readContract({address:t.address,abi:Q,functionName:"balanceOf",args:[s],blockNumber:o});return{token:t,amount:r.toString(),humanAmount:l.formatAmount(r.toString(),t.decimals)}}async function Ce(e,s){let o=await P(e),n=await c.getBlockNumber();return{wallet:s,...await me(o,s,n),blockNumber:n.toString(),coverage:K}}async function $e(e,s){let o=le(e.launchTx),n=await c.getTransactionReceipt({hash:o}),t=se(n);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,B(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===$(e.positionId,"positionId").toString())),!t.length)throw new a("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let r=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let f=i.creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,w=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:r});if(!p(w,f))throw new a("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:S,abi:m,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:r}),approved:await c.readContract({address:S,abi:m,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:r}),collected:await c.readContract({address:S,abi:m,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:r})}:void 0,b=await te(i.token,r);return{...i,token:b,custodian:w,holding:await me(i,s,r,b),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:ue,amount:u.collected[0].toString()},{token:b,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:o,wallet:s,creator:n.from,blockNumber:r.toString(),launches:d,coverage:K}}async function Fe(e){let s=await c.getBlockNumber(),o=e.limit??20;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>50)throw new a("limit must be an integer from 1 to 50.");let n=e.fromBlock===void 0?s>=H+de?s-de+1n:H:$(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?s:$(e.toBlock,"toBlock",!0),r=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new a("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),b=BigInt(u[0]),v=BigInt(u[1]);if(e.fromBlock!==void 0&&n!==b||e.toBlock!==void 0&&t!==v)throw new a("The cursor does not match this block range.");n=b,t=v,r=Number(u[2])}if(s<H&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:H.toString(),toBlock:s.toString(),coverage:K,predeployment:!0};if(n<H||t<n||t>s||t-n>=de)throw new a("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:_,event:U[0],fromBlock:n,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new a("The launch feed returned an incomplete log.");if(d.sort((u,b)=>u.blockNumber===b.blockNumber?b.logIndex-u.logIndex:u.blockNumber>b.blockNumber?-1:1),r>d.length)throw new a("The browse cursor is outside the launch feed.");let i=new Map,f=[];for(let u of d.slice(r,r+o)){let b=u.transactionHash,v=i.get(b);v||(v=await c.getTransactionReceipt({hash:b}),i.set(b,v));let z=ie({abi:U,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,L=se(v).filter(k=>p(k.token,z.token)&&p(k.poolId,z.poolId));if(L.length!==1)throw new a("The launch feed log does not match one verified receipt launch.");f.push({...L[0],launchTx:b,blockNumber:u.blockNumber.toString(),token:await te(L[0].token,t),creator:v.from})}let w=r+o;return{launches:f,cursor:w<d.length?`${n}:${t}:${w}`:null,fromBlock:n.toString(),toBlock:t.toString(),coverage:K,previousToBlock:n>H?(n-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function he(e,s,o){let n=await P(e);if(!n.creatorFees)throw new a("Creator fees are permanently disabled for this position.");let t=BigInt(n.positionId),r=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[t]});if(!p(r,h.feeSplitterFeesOn.address))throw new a("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:S,abi:m,functionName:"ownerOf",args:[t]});if(!p(d,s))throw new a("Only the current fee NFT holder can change this entitlement.");let i=B(o?e.to:e.spender);if(p(i,S)||o&&p(i,C))throw new a("The fee NFT recipient cannot be the vault or zero address.");let f=o?N({abi:m,functionName:"safeTransferFrom",args:[s,i,t]}):N({abi:m,functionName:"approve",args:[i,t]});return T([y(S,f,0n,o?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],s,o?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function Pe(){return{chainId:x,instant:{supported:!0,supply:ne.toString(),decimals:18,currency:ue,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:K}}let g={type:"string"},I=ke(),ge={chainId:{type:"integer",const:x},slippageBps:{type:"integer",minimum:0,maximum:9999}};function A(e,s,o,n){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...ge,...s},required:o},execute:async(t,r)=>{try{let d=new Set([...Object.keys(ge),...Object.keys(s)]);if(Object.keys(t).some(i=>!d.has(i)))throw new a("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==x)throw new a("pools.trade requires chain 4663.");if(B(r),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new a("Slippage must be an integer in basis points.");ae("10000",t.slippageBps)}return await j(),await n(t,r)}catch(d){F(d)}}}}return{tools:[A("launch",{name:g,symbol:g,creatorFees:{type:"boolean",description:"Permanent choice; must be explicit."},feeBeneficiary:g,pair:g,decimals:{type:"integer",const:18},supply:I,initialBuy:I,minAmountOut:I,description:g,website:g,imageUri:g},["name","symbol","creatorFees","feeBeneficiary"],O),...["buy","sell"].map(e=>A(e,{token:g,amountIn:I,minAmountOut:I,launchTx:g},["token","amountIn"],(s,o)=>G(s,o,e==="buy"))),A("collect",{positionId:I,launchTx:g},["positionId"],(e,s)=>pe(e,s,!1)),A("claim",{positionId:I,launchTx:g,minEth:I},["positionId"],(e,s)=>pe(e,s,!0)),A("browse",{fromBlock:I,toBlock:I,limit:{type:"integer",minimum:1,maximum:50},cursor:g},[],Fe),A("balance",{token:g,launchTx:g},["token"],Ce),A("status",{launchTx:g,token:g,positionId:I},["launchTx"],$e),A("launch_options",{},[],Pe),A("fee_transfer",{positionId:I,launchTx:g,to:g},["positionId","to"],(e,s)=>he(e,s,!0)),A("fee_approve",{positionId:I,launchTx:g,spender:g},["positionId","spender"],(e,s)=>he(e,s,!1)),A("transfer",{token:g,amount:I,to:g,launchTx:g},["token","amount","to"],Se),A("collect_many",{positionIds:{type:"array",items:I,minItems:1,maxItems:20},launchTxs:{type:"array",items:g,minItems:1,maxItems:20}},["positionIds","launchTxs"],Be)],positions:async e=>{B(e);let s=[],o=0,n=!0,t,r=i=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:x,assets:[],incomplete:!0,description:`${i} Checked ${o} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),d=async()=>{await j(),n&&await ee(e,void 0,async i=>{o++;for(let f of se(i)){if(!n)return;let w=f.creatorFees&&p(await c.readContract({address:S,abi:m,functionName:"ownerOf",args:[BigInt(f.positionId)]}),e);if(!n)return;if(!w&&!p(i.from,e))continue;let u=w?[{token:ue,amount:(await c.readContract({address:S,abi:m,functionName:"amounts",args:[BigInt(f.positionId)]}))[0].toString()}]:[];n&&s.push({module:"poolstrade",id:f.positionId,chainId:x,assets:u,description:`Current Instant Launch ${f.token} (18 decimals, supply 1000000000), pool ${f.poolId}; creator fees ${f.creatorFees?"on":"off"} (permanent). ${w?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>n)};try{return await Promise.race([d().then(()=>!0),new Promise(f=>{t=setTimeout(()=>{n=!1,f(!1)},6e3)})])?s:[...s,r("Pools.trade global launch discovery reached its 6000 ms read budget; the historical scan is incomplete.")]}catch(i){return[...s,r(`Pools.trade discovery could not finish: ${l.plainError(i)}`)]}finally{n=!1,t!==void 0&&clearTimeout(t)}}}};function Ve(l){return Ie("poolstrade",[Ee(l)])}export{se as a,Ee as b,Ve as c};
@@ -1 +0,0 @@
1
- import{a as w,b as R}from"./HIMVOTIU.js";import{a,d as E}from"./5YS5V2LK.js";var y=class extends a{constructor(n){super(`The service returned HTTP ${n.status}. Please try again.`);this.response=n}response};function h(){return new a("The request was cancelled.")}async function x(t,s){if(s.aborted)throw h();await new Promise((n,c)=>{let o=setTimeout(()=>{s.removeEventListener("abort",m),n()},t),m=()=>{clearTimeout(o),s.removeEventListener("abort",m),c(h())};s.addEventListener("abort",m,{once:!0})})}function O(t,s){if(t===null)return s;if(/^\d+(\.\d+)?$/.test(t))return Number(t)*1e3;let n=Date.parse(t);return Number.isFinite(n)?Math.max(0,n-Date.now()):s}function H(t={}){let s=t.fetch??globalThis.fetch,n=t.timeoutMs??1e4,c=t.retries??2,u=t.retryDelayMs??250,o=t.maxRetryDelayMs??3e4;if(!Number.isInteger(c)||c<0||c>10||!Number.isFinite(n)||n<=0||n>2147483647||!Number.isFinite(u)||u<0||!Number.isFinite(o)||o<0||o>2147483647)throw new a("Provide finite timeout and retry bounds, with 0 to 10 retries.");return async(m,k)=>{let r=new Request(m,{...k,redirect:"error"}),d=R(s,r.url),q=r.method==="GET"||r.method==="HEAD";for(let b=0;;b++){if(r.signal.aborted)throw h();if(d){let e=Date.now()+2e3,f=d.reserve();for(f>0&&await x(f,r.signal);;){if(r.signal.aborted)throw h();if(Date.now()>e)throw new w(d.label,1);let i=d.dispatchDelay();if(i===0)break;if(Date.now()+i>e)throw new w(d.label,i/1e3);await x(i,r.signal)}}if(r.signal.aborted)throw h();let p=new AbortController,g=()=>p.abort();r.signal.addEventListener("abort",g,{once:!0});let D=!1,N=setTimeout(()=>{D=!0,p.abort()},n),M;try{let e=await s(r.clone(),{signal:p.signal});if(e.redirected)throw await e.body?.cancel(),new a("The request failed. Please try again.");if(e.ok){let f=await e.text();if(r.method!=="HEAD"&&e.status!==204&&e.status!==205){let i=r.headers.get("accept")?.toLowerCase(),l=e.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase(),T=l?.startsWith("text/"),P=i?.split(",").some(v=>v.trim().startsWith("text/"));if(!P&&i?.split(",").some(v=>/(?:application\/json|\+json)(?:\s*;.*)?$/.test(v.trim()))||l==="application/json"||l?.endsWith("+json")||!T&&!P)try{JSON.parse(f)}catch{throw new a("The service returned malformed JSON.")}}return new Response(f||null,{status:e.status,statusText:e.statusText,headers:e.headers})}else{let f=e.status===429||e.status>=500,i=u*2**b*(.5+Math.random()),l=Math.max(i,O(e.headers.get("Retry-After"),i));if(e.status===429&&d?.backoff(l),!q||!f||b>=c||l>o){if(e.status===429)throw await e.body?.cancel(),new w(d?.label??"The service",Math.max(1,l/1e3));let T=await e.text();throw new y(new Response(T||null,{status:e.status,statusText:e.statusText,headers:e.headers}))}await e.body?.cancel(),M=l}}catch(e){throw r.signal.aborted?h():D?new a("The request timed out. Please try again."):e instanceof y?e:new a(E(e))}finally{clearTimeout(N),r.signal.removeEventListener("abort",g)}await x(M,r.signal)}}}async function A(t,s,n,c){let u=await t(s,n);if(!u.ok)throw new a(`The service returned HTTP ${u.status}. Please try again.`);let o;try{o=await u.json()}catch{throw new a("The service returned malformed JSON.")}try{if(c(o))return o}catch{}throw new a("The service returned an unexpected response.")}export{y as a,H as b,A as c};