@oakagentkit/core 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (535) hide show
  1. package/build/dist/api/addresses.d.ts +112 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/amounts.js +1 -1
  4. package/build/dist/api/args.js +1 -1
  5. package/build/dist/api/cache.js +1 -1
  6. package/build/dist/api/canonical.js +1 -1
  7. package/build/dist/api/chain.js +1 -1
  8. package/build/dist/api/deployments.js +1 -1
  9. package/build/dist/api/errors.d.ts +1 -0
  10. package/build/dist/api/errors.js +1 -1
  11. package/build/dist/api/gas.js +1 -1
  12. package/build/dist/api/grandfather.js +1 -1
  13. package/build/dist/api/guards.js +1 -1
  14. package/build/dist/api/history.js +1 -1
  15. package/build/dist/api/http.js +1 -1
  16. package/build/dist/api/identity-link.d.ts +1 -0
  17. package/build/dist/api/identity-link.js +1 -1
  18. package/build/dist/api/launch.js +1 -1
  19. package/build/dist/api/merkle.js +1 -1
  20. package/build/dist/api/metadata.js +1 -1
  21. package/build/dist/api/module.js +1 -1
  22. package/build/dist/api/modules/beefy/boosts.js +1 -1
  23. package/build/dist/api/modules/beefy/clm.js +1 -1
  24. package/build/dist/api/modules/beefy/guard.js +1 -1
  25. package/build/dist/api/modules/beefy/index.js +1 -1
  26. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  27. package/build/dist/api/modules/beefy/management.js +1 -1
  28. package/build/dist/api/modules/beefy/vaults.js +1 -1
  29. package/build/dist/api/modules/clanker/extensions.js +1 -1
  30. package/build/dist/api/modules/clanker/index.js +1 -1
  31. package/build/dist/api/modules/clanker/manage.js +1 -1
  32. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  33. package/build/dist/api/modules/clanker/protocol.js +1 -1
  34. package/build/dist/api/modules/clanker/state.js +1 -1
  35. package/build/dist/api/modules/earn/copy.d.ts +114 -0
  36. package/build/dist/api/modules/earn/copy.js +1 -0
  37. package/build/dist/api/modules/earn/cost.d.ts +47 -0
  38. package/build/dist/api/modules/earn/cost.js +1 -0
  39. package/build/dist/api/modules/earn/index.d.ts +8 -0
  40. package/build/dist/api/modules/earn/index.js +1 -0
  41. package/build/dist/api/modules/earn/lp.d.ts +17 -0
  42. package/build/dist/api/modules/earn/lp.js +1 -0
  43. package/build/dist/api/modules/earn/options.d.ts +36 -0
  44. package/build/dist/api/modules/earn/options.js +1 -0
  45. package/build/dist/api/modules/earn/types.d.ts +39 -0
  46. package/build/dist/api/modules/earn/types.js +0 -0
  47. package/build/dist/api/modules/erc8004/abi.js +1 -1
  48. package/build/dist/api/modules/erc8004/common.js +1 -1
  49. package/build/dist/api/modules/erc8004/domain.js +1 -1
  50. package/build/dist/api/modules/erc8004/index.js +1 -1
  51. package/build/dist/api/modules/erc8004/management.js +1 -1
  52. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  53. package/build/dist/api/modules/erc8004/services.js +1 -1
  54. package/build/dist/api/modules/erc8004/validation.js +1 -1
  55. package/build/dist/api/modules/grove/index.js +1 -1
  56. package/build/dist/api/modules/heyresearch/backoff.js +1 -1
  57. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  58. package/build/dist/api/modules/heyresearch/freshness.js +1 -1
  59. package/build/dist/api/modules/heyresearch/index.js +1 -1
  60. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  61. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  62. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  63. package/build/dist/api/modules/heyresearch/status-labels.d.ts +1 -1
  64. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  65. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  66. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  67. package/build/dist/api/modules/hoodag/index.js +1 -1
  68. package/build/dist/api/modules/hoodag/management.js +1 -1
  69. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  70. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  71. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  72. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  73. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  74. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  75. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  76. package/build/dist/api/modules/hoodlock/index.js +1 -1
  77. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  78. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  79. package/build/dist/api/modules/hoodlock/public.js +1 -1
  80. package/build/dist/api/modules/hookr/actions.js +1 -1
  81. package/build/dist/api/modules/hookr/addons.js +1 -1
  82. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  83. package/build/dist/api/modules/hookr/contracts.js +1 -1
  84. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  85. package/build/dist/api/modules/hookr/discovery.js +1 -1
  86. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  87. package/build/dist/api/modules/hookr/index.js +1 -1
  88. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  89. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  90. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  91. package/build/dist/api/modules/hookr/launch.js +1 -1
  92. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  93. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  94. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  95. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  96. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  97. package/build/dist/api/modules/hookr/pins.js +1 -1
  98. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  99. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  100. package/build/dist/api/modules/hookr/relay.js +1 -1
  101. package/build/dist/api/modules/hookr/revenue.js +1 -1
  102. package/build/dist/api/modules/kyberswap/index.js +1 -1
  103. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  104. package/build/dist/api/modules/layerbank/abi.d.ts +165 -0
  105. package/build/dist/api/modules/layerbank/abi.js +1 -0
  106. package/build/dist/api/modules/layerbank/actions.d.ts +2 -0
  107. package/build/dist/api/modules/layerbank/actions.js +1 -0
  108. package/build/dist/api/modules/layerbank/checks.d.ts +21 -0
  109. package/build/dist/api/modules/layerbank/checks.js +1 -0
  110. package/build/dist/api/modules/layerbank/index.d.ts +2 -0
  111. package/build/dist/api/modules/layerbank/index.js +1 -0
  112. package/build/dist/api/modules/layerbank/merkl.d.ts +6 -0
  113. package/build/dist/api/modules/layerbank/merkl.js +1 -0
  114. package/build/dist/api/modules/layerbank/reader.d.ts +15 -0
  115. package/build/dist/api/modules/layerbank/reader.js +1 -0
  116. package/build/dist/api/modules/layerbank/reserve.d.ts +13 -0
  117. package/build/dist/api/modules/layerbank/reserve.js +1 -0
  118. package/build/dist/api/modules/lighter/index.js +1 -1
  119. package/build/dist/api/modules/longbow/administration.js +1 -1
  120. package/build/dist/api/modules/longbow/analytics.js +1 -1
  121. package/build/dist/api/modules/longbow/fixed.js +1 -1
  122. package/build/dist/api/modules/longbow/index.js +1 -1
  123. package/build/dist/api/modules/longbow/nft.js +1 -1
  124. package/build/dist/api/modules/longbow/rebates.js +1 -1
  125. package/build/dist/api/modules/longbow/staking.js +1 -1
  126. package/build/dist/api/modules/meridian/index.js +1 -1
  127. package/build/dist/api/modules/meridian/markets.js +1 -1
  128. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  129. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  130. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  131. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  132. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  133. package/build/dist/api/modules/meridian/perps.js +1 -1
  134. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  135. package/build/dist/api/modules/meridian/rfq.js +1 -1
  136. package/build/dist/api/modules/merkl/discovery.js +1 -1
  137. package/build/dist/api/modules/merkl/index.js +1 -1
  138. package/build/dist/api/modules/merkl/manage.js +1 -1
  139. package/build/dist/api/modules/merkl/protocol.js +1 -1
  140. package/build/dist/api/modules/morpho/allocator.js +1 -1
  141. package/build/dist/api/modules/morpho/bundles-abi.js +1 -1
  142. package/build/dist/api/modules/morpho/bundles.js +1 -1
  143. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  144. package/build/dist/api/modules/morpho/index.js +1 -1
  145. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  146. package/build/dist/api/modules/morpho/midnight-abi.js +1 -1
  147. package/build/dist/api/modules/morpho/midnight.js +1 -1
  148. package/build/dist/api/modules/morpho/protocol.js +1 -1
  149. package/build/dist/api/modules/morpho/surface.js +1 -1
  150. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  151. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  152. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  153. package/build/dist/api/modules/netnet/blackjack-hashes.js +1 -1
  154. package/build/dist/api/modules/netnet/card-abi.js +1 -1
  155. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  156. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  157. package/build/dist/api/modules/netnet/card-read.js +1 -1
  158. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  159. package/build/dist/api/modules/netnet/desk-action-abi.js +1 -1
  160. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  161. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  162. package/build/dist/api/modules/netnet/desk-registry.js +1 -1
  163. package/build/dist/api/modules/netnet/financial-abi.js +1 -1
  164. package/build/dist/api/modules/netnet/financial.js +1 -1
  165. package/build/dist/api/modules/netnet/index.js +1 -1
  166. package/build/dist/api/modules/netnet/staking.js +1 -1
  167. package/build/dist/api/modules/orbio/gateway.js +1 -1
  168. package/build/dist/api/modules/orbio/index.js +1 -1
  169. package/build/dist/api/modules/orbio/pins.js +1 -1
  170. package/build/dist/api/modules/orbio/positions.d.ts +2 -0
  171. package/build/dist/api/modules/orbio/positions.js +1 -0
  172. package/build/dist/api/modules/pendle/abi.d.ts +205 -0
  173. package/build/dist/api/modules/pendle/abi.js +1 -0
  174. package/build/dist/api/modules/pendle/convert.d.ts +24 -0
  175. package/build/dist/api/modules/pendle/convert.js +1 -0
  176. package/build/dist/api/modules/pendle/costs.d.ts +3 -0
  177. package/build/dist/api/modules/pendle/costs.js +1 -0
  178. package/build/dist/api/modules/pendle/index.d.ts +11 -0
  179. package/build/dist/api/modules/pendle/index.js +1 -0
  180. package/build/dist/api/modules/pendle/markets.d.ts +37 -0
  181. package/build/dist/api/modules/pendle/markets.js +1 -0
  182. package/build/dist/api/modules/pendle/positions.d.ts +18 -0
  183. package/build/dist/api/modules/pendle/positions.js +1 -0
  184. package/build/dist/api/modules/pendle/pricecheck.d.ts +95 -0
  185. package/build/dist/api/modules/pendle/pricecheck.js +1 -0
  186. package/build/dist/api/modules/pendle/reader.d.ts +17 -0
  187. package/build/dist/api/modules/pendle/reader.js +1 -0
  188. package/build/dist/api/modules/pendle/redeem.d.ts +15 -0
  189. package/build/dist/api/modules/pendle/redeem.js +1 -0
  190. package/build/dist/api/modules/pendle/trade.d.ts +2 -0
  191. package/build/dist/api/modules/pendle/trade.js +1 -0
  192. package/build/dist/api/modules/pendle/types.d.ts +26 -0
  193. package/build/dist/api/modules/pendle/types.js +0 -0
  194. package/build/dist/api/modules/pendle/validate.d.ts +424 -0
  195. package/build/dist/api/modules/pendle/validate.js +1 -0
  196. package/build/dist/api/modules/pendle/verify.d.ts +22 -0
  197. package/build/dist/api/modules/pendle/verify.js +1 -0
  198. package/build/dist/api/modules/pons/claim.js +1 -1
  199. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  200. package/build/dist/api/modules/pons/index.js +1 -1
  201. package/build/dist/api/modules/pons/launch-status.js +1 -1
  202. package/build/dist/api/modules/pons/prices.js +1 -1
  203. package/build/dist/api/modules/pons/reads.d.ts +38 -2
  204. package/build/dist/api/modules/pons/reads.js +1 -1
  205. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  206. package/build/dist/api/modules/pons/trade.js +1 -1
  207. package/build/dist/api/modules/poolstrade/index.js +1 -1
  208. package/build/dist/api/modules/priors/coverage.js +1 -1
  209. package/build/dist/api/modules/priors/discovery.js +1 -1
  210. package/build/dist/api/modules/priors/features.js +1 -1
  211. package/build/dist/api/modules/priors/holdings.d.ts +4 -0
  212. package/build/dist/api/modules/priors/holdings.js +1 -0
  213. package/build/dist/api/modules/priors/index.js +1 -1
  214. package/build/dist/api/modules/priors/integration.js +1 -1
  215. package/build/dist/api/modules/priors/market.js +1 -1
  216. package/build/dist/api/modules/priors/pt.js +1 -1
  217. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  218. package/build/dist/api/modules/priors/starter-line.js +1 -1
  219. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  220. package/build/dist/api/modules/relay/api.js +1 -1
  221. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  222. package/build/dist/api/modules/relay/discovery.js +1 -1
  223. package/build/dist/api/modules/relay/inbound.js +1 -1
  224. package/build/dist/api/modules/relay/index.js +1 -1
  225. package/build/dist/api/modules/relay/order.js +1 -1
  226. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  227. package/build/dist/api/modules/relay/readiness.js +1 -1
  228. package/build/dist/api/modules/relay/reads.js +1 -1
  229. package/build/dist/api/modules/relay/vaults.js +1 -1
  230. package/build/dist/api/modules/spark/actions.js +1 -1
  231. package/build/dist/api/modules/spark/details.js +1 -1
  232. package/build/dist/api/modules/spark/index.js +1 -1
  233. package/build/dist/api/modules/spark/management.js +1 -1
  234. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  235. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  236. package/build/dist/api/modules/steakhouse/index.js +1 -1
  237. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  238. package/build/dist/api/modules/steakhouse/management.js +1 -1
  239. package/build/dist/api/modules/steakhouse/share-symbol.d.ts +3 -0
  240. package/build/dist/api/modules/steakhouse/share-symbol.js +1 -0
  241. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  242. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  243. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  244. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  249. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  250. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  251. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  252. package/build/dist/api/modules/tickerspring/research.js +1 -1
  253. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  254. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction.js +1 -1
  256. package/build/dist/api/modules/uniswap/batch.js +1 -1
  257. package/build/dist/api/modules/uniswap/common.js +1 -1
  258. package/build/dist/api/modules/uniswap/fees.js +1 -1
  259. package/build/dist/api/modules/uniswap/index.js +1 -1
  260. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  261. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  262. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  263. package/build/dist/api/modules/uniswap/pools.js +1 -1
  264. package/build/dist/api/modules/uniswap/position.js +1 -1
  265. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  266. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  267. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  268. package/build/dist/api/modules/uniswap/trade.js +1 -1
  269. package/build/dist/api/modules/uniswap/v2.js +1 -1
  270. package/build/dist/api/modules/uniswap/v3.d.ts +1 -0
  271. package/build/dist/api/modules/uniswap/v3.js +1 -1
  272. package/build/dist/api/modules/uniswap/v4.js +1 -1
  273. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  274. package/build/dist/api/modules/velora/claims.js +1 -1
  275. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  276. package/build/dist/api/modules/velora/index.js +1 -1
  277. package/build/dist/api/modules/wormhole/index.js +1 -1
  278. package/build/dist/api/modules/wormhole/license.js +1 -1
  279. package/build/dist/api/modules/wormhole/quotetext.js +1 -1
  280. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  281. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  282. package/build/dist/api/owner-signature.js +1 -1
  283. package/build/dist/api/positions.d.ts +5 -5
  284. package/build/dist/api/positions.js +1 -1
  285. package/build/dist/api/pricenote.js +1 -1
  286. package/build/dist/api/prices.js +1 -1
  287. package/build/dist/api/pricing.js +1 -1
  288. package/build/dist/api/reads.js +1 -1
  289. package/build/dist/api/routes.js +1 -1
  290. package/build/dist/api/rpc.js +1 -1
  291. package/build/dist/api/secret-fields.js +1 -1
  292. package/build/dist/api/send.js +1 -1
  293. package/build/dist/api/signing-registry.js +1 -1
  294. package/build/dist/api/signing.js +1 -1
  295. package/build/dist/api/simulate.js +1 -1
  296. package/build/dist/api/swap.js +1 -1
  297. package/build/dist/api/token-output.js +1 -1
  298. package/build/dist/api/tokens.js +1 -1
  299. package/build/dist/api/tool-policy.js +1 -1
  300. package/build/dist/api/tx.js +1 -1
  301. package/build/dist/api/types.d.ts +7 -2
  302. package/build/dist/api/untrusted.js +1 -1
  303. package/build/dist/api/vendor-limits.js +1 -1
  304. package/build/dist/chunks/{7YU6DELJ.js → 24CQ2SPB.js} +1 -1
  305. package/build/dist/chunks/2DUCTO5C.js +1 -0
  306. package/build/dist/chunks/2MZXTOZU.js +1 -0
  307. package/build/dist/chunks/2OJAOVMG.js +1 -0
  308. package/build/dist/chunks/2ZUP7ZEV.js +1 -0
  309. package/build/dist/chunks/{DHOBTJRD.js → 3AXVB23N.js} +1 -1
  310. package/build/dist/chunks/3ESNHZT5.js +1 -0
  311. package/build/dist/chunks/{GIV5JMTE.js → 3VAJW6TQ.js} +1 -1
  312. package/build/dist/chunks/{ALK6NKFP.js → 3WXK2FUA.js} +1 -1
  313. package/build/dist/chunks/{TQL7UDFL.js → 42DQTKEO.js} +1 -1
  314. package/build/dist/chunks/{E7R3J4H7.js → 43CSMYDO.js} +1 -1
  315. package/build/dist/chunks/46547QT3.js +1 -0
  316. package/build/dist/chunks/{XV2HQKND.js → 47YN4OUI.js} +1 -1
  317. package/build/dist/chunks/{S3HNPTXA.js → 4ALMYJJV.js} +1 -1
  318. package/build/dist/chunks/{SOYQOE5P.js → 4BVP652W.js} +1 -1
  319. package/build/dist/chunks/{JNZZLA2A.js → 4ISR2U72.js} +1 -1
  320. package/build/dist/chunks/{AAGDMH54.js → 4TQQH7N6.js} +1 -1
  321. package/build/dist/chunks/{WTSMPDT5.js → 4YFVAYKR.js} +1 -1
  322. package/build/dist/chunks/{PTAWEHKB.js → 57JFKIMK.js} +1 -1
  323. package/build/dist/chunks/{3RFSGU2Y.js → 5CAAFU7R.js} +1 -1
  324. package/build/dist/chunks/{73N3TOJL.js → 5KUWLUPM.js} +1 -1
  325. package/build/dist/chunks/{SKQGLGES.js → 5MQ5KSSV.js} +1 -1
  326. package/build/dist/chunks/{AJP5LDM2.js → 5N4A5XAW.js} +1 -1
  327. package/build/dist/chunks/{OQVZVR2S.js → 5OKJEGBH.js} +1 -1
  328. package/build/dist/chunks/5U7TCKX2.js +2 -0
  329. package/build/dist/chunks/5WUKOQIJ.js +1 -0
  330. package/build/dist/chunks/5ZLOCQA4.js +1 -0
  331. package/build/dist/chunks/63YRSLDK.js +1 -0
  332. package/build/dist/chunks/64WKYWZV.js +1 -0
  333. package/build/dist/chunks/{JPOYTTTW.js → 65EQECL3.js} +1 -1
  334. package/build/dist/chunks/{57HAXNQV.js → 6AAARNZ3.js} +1 -1
  335. package/build/dist/chunks/6FTYNYGF.js +1 -0
  336. package/build/dist/chunks/{L7YBCMZU.js → 6L5KTE6Y.js} +1 -1
  337. package/build/dist/chunks/{53N7PNJH.js → 6PY3IRDS.js} +1 -1
  338. package/build/dist/chunks/{5VHH5PW3.js → 6YYCGUCU.js} +1 -1
  339. package/build/dist/chunks/{UNZRE3YU.js → 7UOOIDR3.js} +1 -1
  340. package/build/dist/chunks/{LQUDJCAR.js → 7WQEPZJY.js} +1 -1
  341. package/build/dist/chunks/A3PN3PK3.js +1 -0
  342. package/build/dist/chunks/A6YQ5H24.js +1 -0
  343. package/build/dist/chunks/{CXLEQCP3.js → ABPL3ZZI.js} +1 -1
  344. package/build/dist/chunks/{R7FXNZRM.js → AG67Z3SC.js} +1 -1
  345. package/build/dist/chunks/{BX7XQANB.js → ALPYEM7B.js} +1 -1
  346. package/build/dist/chunks/{OE3CLZHR.js → ALRRW7SF.js} +1 -1
  347. package/build/dist/chunks/AUOXDNUO.js +7 -0
  348. package/build/dist/chunks/AWXJV2YH.js +1 -0
  349. package/build/dist/chunks/{66VBACC2.js → BAAXGB4K.js} +1 -1
  350. package/build/dist/chunks/{R53P2K3C.js → BIRMUW7Z.js} +1 -1
  351. package/build/dist/chunks/{EA6IYKIB.js → BK23XJXE.js} +1 -1
  352. package/build/dist/chunks/{NATG6YA6.js → BNG2IWZL.js} +1 -1
  353. package/build/dist/chunks/BQICZFLR.js +1 -0
  354. package/build/dist/chunks/{Y2KH6DCE.js → BXHNYCH2.js} +1 -1
  355. package/build/dist/chunks/{L62M7LOB.js → C5ZZAYXD.js} +1 -1
  356. package/build/dist/chunks/{52DHGSG4.js → CERNEJ2F.js} +1 -1
  357. package/build/dist/chunks/{EPZ7SWKM.js → CTMA4BTM.js} +1 -1
  358. package/build/dist/chunks/{QXNPPCOU.js → D6ZJPNK7.js} +1 -1
  359. package/build/dist/chunks/DFM4T6ZE.js +1 -0
  360. package/build/dist/chunks/{SJPM5ST4.js → DP2NIYBP.js} +1 -1
  361. package/build/dist/chunks/DVVFT42J.js +1 -0
  362. package/build/dist/chunks/E3UBHTJO.js +1 -0
  363. package/build/dist/chunks/E6RRXNV2.js +1 -0
  364. package/build/dist/chunks/{ZT47KN7A.js → E6UU7DL2.js} +1 -1
  365. package/build/dist/chunks/ECWGKLBW.js +1 -0
  366. package/build/dist/chunks/EKNSLLJK.js +1 -0
  367. package/build/dist/chunks/{XWEFKXKA.js → ENX72ARB.js} +1 -1
  368. package/build/dist/chunks/{DRWWPBOQ.js → EOQYLFXA.js} +1 -1
  369. package/build/dist/chunks/{ELZNT5Q3.js → ET23SES4.js} +1 -1
  370. package/build/dist/chunks/EU3OAJU2.js +1 -0
  371. package/build/dist/chunks/{2W46IRX6.js → EYFBVQ46.js} +1 -1
  372. package/build/dist/chunks/{VXLJRRKV.js → F26FK47J.js} +1 -1
  373. package/build/dist/chunks/{MFNP4KOK.js → F3BSEE52.js} +1 -1
  374. package/build/dist/chunks/FWD4L3CJ.js +1 -0
  375. package/build/dist/chunks/G7XSFUDL.js +1 -0
  376. package/build/dist/chunks/{5O5ZE3ZV.js → GHPREYQK.js} +1 -1
  377. package/build/dist/chunks/{AFHHRDPJ.js → GRIGSPD4.js} +1 -1
  378. package/build/dist/chunks/{J2XAEVKC.js → GVPX5XCL.js} +1 -1
  379. package/build/dist/chunks/{TLJPVYRJ.js → GW5IXLKU.js} +1 -1
  380. package/build/dist/chunks/H4NYYJ3Z.js +1 -0
  381. package/build/dist/chunks/{J3GFCBZZ.js → HSFOWJ3Z.js} +1 -1
  382. package/build/dist/chunks/{CY75R4FK.js → HTXKERNS.js} +1 -1
  383. package/build/dist/chunks/{6ZYLNB2B.js → HVM2EEXB.js} +1 -1
  384. package/build/dist/chunks/{U3F6DDML.js → I4TGMF2C.js} +1 -1
  385. package/build/dist/chunks/I6KUORFT.js +1 -0
  386. package/build/dist/chunks/{AMICUXS6.js → IKEJCBYU.js} +1 -1
  387. package/build/dist/chunks/IMRXZ7JB.js +1 -0
  388. package/build/dist/chunks/IQGY5FW7.js +1 -0
  389. package/build/dist/chunks/{L3ZM77SJ.js → IQIWASRD.js} +1 -1
  390. package/build/dist/chunks/JG27HM4P.js +1 -0
  391. package/build/dist/chunks/{V5LTA42G.js → JPNYUEQP.js} +1 -1
  392. package/build/dist/chunks/JZXYLHI7.js +1 -0
  393. package/build/dist/chunks/{QYYFRAWY.js → K22EXPWN.js} +1 -1
  394. package/build/dist/chunks/K72EYD6R.js +1 -0
  395. package/build/dist/chunks/KA7BPBCV.js +2 -0
  396. package/build/dist/chunks/KBKK7UNY.js +1 -0
  397. package/build/dist/chunks/{LBEMCOND.js → KBXU7U6Q.js} +1 -1
  398. package/build/dist/chunks/L6D26AMO.js +1 -0
  399. package/build/dist/chunks/{GGUEKSR4.js → L7OQUHM5.js} +1 -1
  400. package/build/dist/chunks/{F6WBPPBN.js → LDT3QTSY.js} +1 -1
  401. package/build/dist/chunks/{ZUG6MG46.js → LROVANUR.js} +1 -1
  402. package/build/dist/chunks/{WWFOYZT2.js → LVLVP5KQ.js} +1 -1
  403. package/build/dist/chunks/MBTARLZQ.js +1 -0
  404. package/build/dist/chunks/{SSTROLQM.js → MDDHG34Y.js} +1 -1
  405. package/build/dist/chunks/{OVK4EEOD.js → MDV7GECM.js} +1 -1
  406. package/build/dist/chunks/{DCTUYDWF.js → MFCPL6LF.js} +1 -1
  407. package/build/dist/chunks/MGPHD4VV.js +1 -0
  408. package/build/dist/chunks/{VC2RCYQE.js → MKAPRRKF.js} +1 -1
  409. package/build/dist/chunks/{FBSUTF3B.js → MKBNLGDD.js} +1 -1
  410. package/build/dist/chunks/{NRBIXV7V.js → MOPETB64.js} +1 -1
  411. package/build/dist/chunks/{ACN2BFMA.js → MQK6OP7S.js} +1 -1
  412. package/build/dist/chunks/{TWCSCRFS.js → MQYOG66Q.js} +1 -1
  413. package/build/dist/chunks/{2UU5TBBB.js → MXW2TP5P.js} +1 -1
  414. package/build/dist/chunks/MYFAKCQI.js +1 -0
  415. package/build/dist/chunks/{MKQVS3IO.js → NA7R6J5N.js} +1 -1
  416. package/build/dist/chunks/NB3LYS3G.js +1 -0
  417. package/build/dist/chunks/{TNSKEHPC.js → NDW5DAFL.js} +1 -1
  418. package/build/dist/chunks/{MRWCFTMS.js → NKX3FE34.js} +1 -1
  419. package/build/dist/chunks/NYNJITCM.js +1 -0
  420. package/build/dist/chunks/{YZSTP2E6.js → NZXQWDGF.js} +1 -1
  421. package/build/dist/chunks/{Z7RL4NGX.js → O6L4BJP4.js} +1 -1
  422. package/build/dist/chunks/{KSZMMNXK.js → OFI3Y55L.js} +1 -1
  423. package/build/dist/chunks/{2LM7U4S7.js → OTIXQZ3X.js} +1 -1
  424. package/build/dist/chunks/{WCKMQFGS.js → PADWZX7J.js} +1 -1
  425. package/build/dist/chunks/{6IM6A5VA.js → PBQSJSZO.js} +1 -1
  426. package/build/dist/chunks/PLZKXQ76.js +1 -0
  427. package/build/dist/chunks/{TFVWAYHY.js → PQC5635W.js} +1 -1
  428. package/build/dist/chunks/PSVOVZH7.js +70 -0
  429. package/build/dist/chunks/{PWBL4WKB.js → PWH464CJ.js} +1 -1
  430. package/build/dist/chunks/QJFXLYZG.js +1 -0
  431. package/build/dist/chunks/{4KQZTPMS.js → QRC4ZPDA.js} +1 -1
  432. package/build/dist/chunks/{4AKIXLXH.js → QSN6Y2K6.js} +1 -1
  433. package/build/dist/chunks/{C3TJLARP.js → QVYCJ6WV.js} +1 -1
  434. package/build/dist/chunks/{WVXW6VL3.js → RNC463IM.js} +1 -1
  435. package/build/dist/chunks/RPNAFUM5.js +1 -0
  436. package/build/dist/chunks/RVO3QK2B.js +1 -0
  437. package/build/dist/chunks/{FUXT7GRK.js → S2TAJHHK.js} +1 -1
  438. package/build/dist/chunks/{YHPOXAKA.js → S3FPF537.js} +1 -1
  439. package/build/dist/chunks/{H4S2ZCWK.js → S5WICHIS.js} +1 -1
  440. package/build/dist/chunks/SDHPFXRM.js +1 -0
  441. package/build/dist/chunks/{3NDVXEBR.js → SGEZIYJW.js} +1 -1
  442. package/build/dist/chunks/SK2VBNAU.js +1 -0
  443. package/build/dist/chunks/SKMPKAZI.js +1 -0
  444. package/build/dist/chunks/{5IIR3GIN.js → SQL6HD5E.js} +1 -1
  445. package/build/dist/chunks/SSIENQVU.js +1 -0
  446. package/build/dist/chunks/{EXRKBBX2.js → SUFA2GKR.js} +1 -1
  447. package/build/dist/chunks/TBCSZDAF.js +1 -0
  448. package/build/dist/chunks/{LMVB3B6T.js → TBIVTEP5.js} +1 -1
  449. package/build/dist/chunks/{2FSX7MMR.js → TJWVY4VO.js} +1 -1
  450. package/build/dist/chunks/{7XLEYOZH.js → TNKVRVTH.js} +1 -1
  451. package/build/dist/chunks/{SI6GCOAS.js → TPL4U3AQ.js} +1 -1
  452. package/build/dist/chunks/{QRDDKA4I.js → U4JGEMKT.js} +1 -1
  453. package/build/dist/chunks/{6AWTAE4Q.js → UA4O226F.js} +1 -1
  454. package/build/dist/chunks/UFVPMWPJ.js +1 -0
  455. package/build/dist/chunks/UHRCM7AG.js +1 -0
  456. package/build/dist/chunks/{XQXLFF7Y.js → UOGHQLQX.js} +1 -1
  457. package/build/dist/chunks/UP7FBDMJ.js +1 -0
  458. package/build/dist/chunks/{YQUKU2LS.js → UPMGGK34.js} +1 -1
  459. package/build/dist/chunks/VHLINDDS.js +1 -0
  460. package/build/dist/chunks/{PARWLWXW.js → VV2HEIFI.js} +1 -1
  461. package/build/dist/chunks/{YA5WWDEW.js → VVA72C6O.js} +1 -1
  462. package/build/dist/chunks/{TCPPYBGQ.js → W2OJ57ZO.js} +1 -1
  463. package/build/dist/chunks/{WQ6H62DM.js → W76QC2AW.js} +1 -1
  464. package/build/dist/chunks/{VFSRRDLY.js → WD37MEMZ.js} +1 -1
  465. package/build/dist/chunks/{R7QPJQP6.js → WGL46F3S.js} +1 -1
  466. package/build/dist/chunks/WIVYKLQM.js +2 -0
  467. package/build/dist/chunks/{XQUPZ3GU.js → WMNRP3YH.js} +1 -1
  468. package/build/dist/chunks/WOEKXQAH.js +1 -0
  469. package/build/dist/chunks/WPAF55SP.js +1 -0
  470. package/build/dist/chunks/{EVANKNJV.js → WPFAEBE7.js} +1 -1
  471. package/build/dist/chunks/WVONJOWN.js +1 -0
  472. package/build/dist/chunks/{TWSTOFN3.js → WWHCEMNB.js} +1 -1
  473. package/build/dist/chunks/{DZGEQBO7.js → XDZRO5JQ.js} +1 -1
  474. package/build/dist/chunks/XFKVU46U.js +3 -0
  475. package/build/dist/chunks/{RAKUK5VR.js → XJEOEMDS.js} +1 -1
  476. package/build/dist/chunks/XSD5NL7J.js +1 -0
  477. package/build/dist/chunks/{NU4K3TEZ.js → XSRIJUFU.js} +1 -1
  478. package/build/dist/chunks/{JVI26KQO.js → Y7PRJOIK.js} +1 -1
  479. package/build/dist/chunks/Y7RPSDD2.js +1 -0
  480. package/build/dist/chunks/YAJYDD6C.js +1 -0
  481. package/build/dist/chunks/{5OEHZJ6X.js → YEXUSRIZ.js} +1 -1
  482. package/build/dist/chunks/YHRUAQQK.js +1 -0
  483. package/build/dist/chunks/{3EFV4FQF.js → YPM2UITD.js} +1 -1
  484. package/build/dist/chunks/{3WBDHUV2.js → YRXT3HTW.js} +1 -1
  485. package/build/dist/chunks/Z4SRGAVL.js +1 -0
  486. package/build/dist/chunks/{SQ5BNSXR.js → ZBFKKUNP.js} +1 -1
  487. package/build/dist/chunks/{NWSPC3NH.js → ZCOFMGPS.js} +1 -1
  488. package/build/dist/chunks/ZCUXM52B.js +1 -0
  489. package/build/dist/chunks/ZE7EU2CS.js +1 -0
  490. package/build/dist/chunks/{CQCVFRQ5.js → ZET37EIG.js} +1 -1
  491. package/build/dist/chunks/{VVEUJ36E.js → ZGKVXFM5.js} +1 -1
  492. package/build/dist/chunks/{WQQJ7UPJ.js → ZSQOMSOC.js} +1 -1
  493. package/build/dist/chunks/{JST5JGAP.js → ZYH4B2GR.js} +1 -1
  494. package/package.json +2 -2
  495. package/build/dist/chunks/2MSQ6JII.js +0 -1
  496. package/build/dist/chunks/3SC5UI35.js +0 -1
  497. package/build/dist/chunks/4GAWMCQC.js +0 -1
  498. package/build/dist/chunks/4GHVIBL5.js +0 -1
  499. package/build/dist/chunks/4X2JOQ2L.js +0 -1
  500. package/build/dist/chunks/5YS5V2LK.js +0 -1
  501. package/build/dist/chunks/6UPPUHCL.js +0 -1
  502. package/build/dist/chunks/AXYOJBX6.js +0 -1
  503. package/build/dist/chunks/CEIPDEXZ.js +0 -1
  504. package/build/dist/chunks/CUNQ5RG5.js +0 -1
  505. package/build/dist/chunks/EG6M6SSO.js +0 -1
  506. package/build/dist/chunks/EGUMOD3A.js +0 -1
  507. package/build/dist/chunks/G6HCV67X.js +0 -1
  508. package/build/dist/chunks/GJY3P6OG.js +0 -1
  509. package/build/dist/chunks/HIMVOTIU.js +0 -1
  510. package/build/dist/chunks/IBXYIN7Q.js +0 -1
  511. package/build/dist/chunks/IUE6RASI.js +0 -1
  512. package/build/dist/chunks/JWCOXLYA.js +0 -1
  513. package/build/dist/chunks/KHJFXJBU.js +0 -1
  514. package/build/dist/chunks/LQGPMOD2.js +0 -1
  515. package/build/dist/chunks/MLPWQTBS.js +0 -1
  516. package/build/dist/chunks/MYBDO5SA.js +0 -1
  517. package/build/dist/chunks/NAYRD43N.js +0 -1
  518. package/build/dist/chunks/NMYGNJIJ.js +0 -1
  519. package/build/dist/chunks/NSOEDRBU.js +0 -3
  520. package/build/dist/chunks/PZHR4ITH.js +0 -1
  521. package/build/dist/chunks/Q356HHCL.js +0 -1
  522. package/build/dist/chunks/R7SXC74O.js +0 -1
  523. package/build/dist/chunks/RETS2ZEK.js +0 -1
  524. package/build/dist/chunks/SJPYXNOK.js +0 -1
  525. package/build/dist/chunks/SQZRVIVF.js +0 -1
  526. package/build/dist/chunks/SXAIXD56.js +0 -1
  527. package/build/dist/chunks/SXX3VTBP.js +0 -1
  528. package/build/dist/chunks/TMGWXDCZ.js +0 -1
  529. package/build/dist/chunks/UFS2RVEZ.js +0 -1
  530. package/build/dist/chunks/USSOVTD5.js +0 -1
  531. package/build/dist/chunks/UWOFA6GV.js +0 -1
  532. package/build/dist/chunks/V2OOOV6B.js +0 -1
  533. package/build/dist/chunks/XMA25DXR.js +0 -1
  534. package/build/dist/chunks/XVFLT275.js +0 -1
  535. package/build/dist/chunks/YHB55C5T.js +0 -1
@@ -0,0 +1 @@
1
+ import{d as ee}from"./MKAPRRKF.js";import{e as ie}from"./BNG2IWZL.js";import{a as ne,h as re,k as se}from"./6YYCGUCU.js";import{a as ae,b as O,c as F}from"./5OKJEGBH.js";import{e as te}from"./WMNRP3YH.js";import{b as Z}from"./Z4SRGAVL.js";import{a as B}from"./PBQSJSZO.js";import{c as _}from"./MYFAKCQI.js";import{b as X}from"./5ZLOCQA4.js";import{c as A,d as z,e as b,g as D,j as J,m as Q,n as K}from"./5KUWLUPM.js";import{a as l,i as R}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=R[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function U(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function N(a){return D(a,V.address)}function P(a){return ne.some(f=>D(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(r){try{return await r()}catch(i){throw new u(a.plainError(i))}}function S(r,i){if(r.chainId!==void 0&&r.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(r))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let r=await _(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return r.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return _(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(r,i){let d=r[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let r=a.clientFor(l);if(await r.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await r.getBlockNumber()),d=(t,s)=>r.readContract({address:t,abi:q,functionName:s,blockNumber:i}),e=async(t,s)=>T(await r.readContract({address:t,abi:M,functionName:"balanceOf",args:[s],blockNumber:i}));async function n(t){let[s,p]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof s!="string"||!s.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:s,decimals:ue(p)}}async function o(t){let s=t.earnContractAddress,p=v(await d(s,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(s),d(s,"strategy"),d(s,"balance"),d(s,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let $=v(m),G=await d($,"paused");if(typeof G!="boolean")throw new u("The strategy returned an invalid pause flag.");let x=T(w);if(x===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:$,paused:G,managed:T(c),pricePerFullShare:x}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function W(r){let i=v(r.vault),d=O(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function Y(r,i,d,e){let n=j(await H(),e),o=await a.preview(r,i),t=o.changes.map(s=>{let p=s.amount.startsWith("-"),h=p?s.amount.slice(1):s.amount;return`${p?"-":"+"}${a.formatAmount(h,s.token.decimals)} ${g(s.token.symbol)} (${s.token.address}, chain ${s.token.chainId})`}).join("; ");return{txs:r,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l}},additionalProperties:!1},execute:(r,i)=>f(async()=>{S(r,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let s=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await re(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:s.want,shares:s.shares,vaultTotalWant:{token:s.want,amount:s.managed.toString()},pricePerFullShare:{token:s.want,amount:s.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:s.paused,source:"strategy.paused()",address:s.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:N(t.earnContractAddress),qualification:N(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:O(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!s.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:A,chainId:{const:l},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"]}},required:["vault"],additionalProperties:!1},execute:r=>f(async()=>{S(r,["vault","historyBucket"]);let i=r.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(r.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await _(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},$=>$!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,s,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...s,currency:"USD"},history:p,forkQualified:N(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:A,token:A,amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999},chainId:{const:l}},required:["vault","token","amount"],additionalProperties:!1},execute:(r,i)=>f(async()=>{if(S(r,["vault","token","amount","minSharesOut","slippageBps"]),B(i),r.slippageBps!==void 0&&(!Number.isInteger(r.slippageBps)||Number(r.slippageBps)<0||Number(r.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");r.minSharesOut!==void 0&&U(r.minSharesOut);let d=U(r.amount),e=v(r.token),n=await W(r),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let s=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await Y(s,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=r.minSharesOut===void 0?h*BigInt(1e4-Number(r.slippageBps??50))/10000n:U(r.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:R[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:A,shares:{anyOf:[E,{const:"all"}]},chainId:{const:l}},required:["vault","shares"],additionalProperties:!1},execute:(r,i)=>f(async()=>{S(r,["vault","shares"]),B(i);let d=r.shares==="all"?void 0:U(r.shares),e=await W(r),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let s=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return Y(s,i,"Withdraw from",e)})}],positions:r=>f(async()=>{B(r);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,r),t===0n)continue;let s=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:s.want,amount:(t*s.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),s.shares.decimals)} ${g(s.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${s.paused}. ${N(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(s){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(s)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),se(a),ee(a),te(a)])}export{he as a,Te as b};
@@ -0,0 +1 @@
1
+ import{a as e,d as t,i as r}from"./FWD4L3CJ.js";import{getAddress as s,parseAbi as a}from"viem";var n=r[e],u=s(n.layerbank.pool.address),o=s(n.layerbank.aToken.address),c={address:s(n.tokens.USDG.address),symbol:"USDG",decimals:t,chainId:e},l={address:o,symbol:"lRobUSDG",decimals:t,chainId:e},p=(1n<<256n)-1n,f=10n**27n,m=a(["function getReserveData(address asset) view returns (((uint256 data) configuration,uint128 liquidityIndex,uint128 currentLiquidityRate,uint128 variableBorrowIndex,uint128 currentVariableBorrowRate,uint128 currentStableBorrowRate,uint40 lastUpdateTimestamp,uint16 id,address aTokenAddress,address stableDebtTokenAddress,address variableDebtTokenAddress,address interestRateStrategyAddress,uint128 accruedToTreasury,uint128 unbacked,uint128 isolationModeTotalDebt) reserve)","function getConfiguration(address asset) view returns ((uint256 data) configuration)","function getReserveNormalizedIncome(address asset) view returns (uint256)","function supply(address asset,uint256 amount,address onBehalfOf,uint16 referralCode)","function withdraw(address asset,uint256 amount,address to) returns (uint256)"]),b=a(["function POOL() view returns (address)","function UNDERLYING_ASSET_ADDRESS() view returns (address)","function decimals() view returns (uint8)","function scaledTotalSupply() view returns (uint256)"]);export{u as a,o as b,c,l as d,p as e,f,m as g,b as h};
@@ -0,0 +1 @@
1
+ function c(r,s){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(s,"id")}var h=new Map([]),_="find_tool",l="run_tool",a=["oak_setup","oak_identity_unlink","oak_subscribe","oak_renew","oak_redeem","send","hoodlock_feature_buy","hoodlock_feature_claim","hoodlock_referral_register","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_unfollow","heyresearch_position_context"],d={oak:["account","balances","find_token","price","quote","swap","positions","send","oak_setup","oak_subscribe","oak_renew","oak_identity_unlink","oak_redeem"],kyberswap:[],velora:[],steakhouse:["steakhouse_deposit","steakhouse_withdraw"],spark:["spark_deposit","spark_withdraw"],layerbank:["layerbank_deposit","layerbank_withdraw"],pendle:["pendle_buy","pendle_sell","pendle_redeem"],earn:["earn_options"],netnet:["netnet_deposit","netnet_withdraw"],longbow:["longbow_list","longbow_deposit","longbow_withdraw"],grove:["grove_deposit","grove_withdraw"],beefy:["beefy_list","beefy_deposit","beefy_withdraw"],pons:["pons_browse","pons_buy","pons_sell","pons_launch"],orbio:["orbio_credit_status","orbio_buy_credit"],hoodlock:["hoodlock_list_locks","hoodlock_lock","hoodlock_withdraw"],merkl:["merkl_rewards","merkl_claim"],relay:["relay_bridge_in","relay_bridge_out","relay_status"],lighter:["lighter_funding"],wormhole:[],erc8004:["erc8004_identity"],hoodag:["hoodag_resolve","hoodag_register"],heyresearch:["heyresearch_research_project","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_position_context"],priors:["priors_status","priors_lend","priors_withdraw","priors_borrow","priors_repay"],morpho:["morpho_status","morpho_supply","morpho_withdraw","morpho_supply_collateral","morpho_withdraw_collateral","morpho_borrow","morpho_repay"],uniswap:["uniswap_list_positions","uniswap_add","uniswap_remove","uniswap_collect"],hookr:["hookr_orders","hookr_create","hookr_cancel"],meridian:["meridian_browse","meridian_positions","meridian_sell","meridian_redeem"],tickerspring:["tickerspring_account","tickerspring_create","tickerspring_cancel","tickerspring_claim"],clanker:["clanker_browse","clanker_launch"],poolstrade:["poolstrade_status","poolstrade_buy","poolstrade_sell","poolstrade_launch"]};function w(r,s){let i=new Set(r),t=new Set;for(let[o,n]of Object.entries(d))for(let e of n){if(t.has(e))throw new Error(`Visible tool ${e} is listed twice.`);if(o!=="oak"&&!e.startsWith(`${o}_`))throw new Error(`Visible tool ${e} is filed under ${o}.`);if(a.includes(e)||i.has(e))t.add(e);else if(s==="mainnet")throw new Error(`Visible tool ${e} is not registered.`)}for(let o of[_,l,...a,"oak_playbook"])if(i.has(o))throw new Error(`Tool name ${o} is reserved for the add-on.`);return t}export{c as a,h as b,_ as c,l as d,a as e,d as f,w as g};
@@ -0,0 +1 @@
1
+ import{a as P}from"./UFVPMWPJ.js";import{a as y}from"./Y7RPSDD2.js";import{b as h,c as w,d as m}from"./2MZXTOZU.js";import{j as B}from"./S2TAJHHK.js";import{a as b}from"./PBQSJSZO.js";import{m as f,n as g}from"./5KUWLUPM.js";import{a as u}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as R}from"viem";var A=70515n,U=250202n,C=568341n;function S(a,n){return{token:{...a},amount:n.toString()}}function v(a){if(a.network!==void 0&&a.network!=="mainnet")throw new o("LayerBank requires chain 4663.")}async function k(a,n,r,e){try{return f(await a.readContract({address:n.address,abi:L,functionName:"balanceOf",args:[r],blockNumber:e}),"LayerBank returned a malformed wallet balance read.")}catch(t){throw t instanceof o?t:new o("LayerBank wallet balance could not be read. Please try again.")}}async function T(a,n,r){try{let[e,t]=await Promise.all([n.getGasPrice(),B("ETH",{client:n,http:a.http,chainId:u,blockNumber:r})]),i=g(t.usdE18,"LayerBank gas reference is unavailable.",{positive:!0}),c=f(e,"LayerBank gas reference is unavailable.");if(c===0n)throw new o("LayerBank gas reference is unavailable.");let d=p=>Number(R(p*c*i/10n**18n,18)),s=d(A+U),l=d(C);if(![s,l].every(p=>Number.isFinite(p)&&p>0))throw new o("LayerBank gas reference is unavailable.");return{gasInUsd:s,gasOutUsd:l}}catch{throw new o("LayerBank gas costs could not be checked against a fresh ETH/USD reference. Please try again.")}}async function x(a,n){v(a),b(n);let r=a.clientFor(u),e=await y(r),[t,i,c,d]=await Promise.all([k(r,w,n,e.blockNumber),k(r,m,n,e.blockNumber),P(a.http),T(a,r,e.blockNumber)]),s=[...c.checks,"Gas costs use measured USDG calls plus 20% headroom; entry includes approval and supply."];e.active||s.push("LayerBank reserve is inactive."),e.frozen&&s.push("LayerBank reserve is frozen for deposits."),e.paused&&s.push("LayerBank reserve is paused."),e.capRoomBase===0n&&s.push("LayerBank supply cap has no room left.");let l={rateBasePct:e.rateBasePct,...c.bonus==="unavailable"?{}:{bonus:c.bonus},cashUsdgBase:e.cashUsdgBase,capRoomBase:e.capRoomBase,open:e.active&&!e.frozen&&!e.paused&&e.capRoomBase>0n,walletUsdgBase:t,walletReceiptBase:i,...d,checks:s};return{reserve:e,reading:l}}function H(a){return async n=>{try{return(await x(a,n)).reading}catch(r){return{rateBasePct:0,cashUsdgBase:0n,capRoomBase:0n,open:!1,walletUsdgBase:0n,walletReceiptBase:0n,gasInUsd:0,gasOutUsd:0,checks:[r instanceof o?a.plainError(r):"LayerBank could not be checked right now. Please try again."]}}}}async function z(a,n){v(a),b(n);let r=a.clientFor(u),e=await y(r),t=await k(r,m,n,e.blockNumber);if(t===0n)return[];let i=a.formatAmount(t.toString(),6);return[{module:"layerbank",id:`${u}:${h}`,chainId:u,assets:[S(m,t)],description:`${i} lRobUSDG = ${i} USDG; base supply rate ${e.rateBasePct}% a year, read now.`}]}export{A as a,U as b,C as c,S as d,v as e,k as f,x as g,H as h,z as i};
@@ -1 +1 @@
1
- import{A as qe,s as oe,x as xe}from"./Q356HHCL.js";import{a as Be}from"./NRBIXV7V.js";import{a as y}from"./WWNAGOCD.js";import{a as w,b as re,d as ve,e as A,f as d,h as $,i as q,j as k,k as N,l as H,m as R,n as ie,o as f,p as c,q as I,r as j,s as He,t as Se}from"./5OEHZJ6X.js";import{b as K,f as Pe,g as V,h as Te,i as Le}from"./ACN2BFMA.js";import{i as ne}from"./FUXT7GRK.js";import{a as be}from"./CY75R4FK.js";import{s as ge}from"./G6HCV67X.js";import{a as o}from"./5YS5V2LK.js";import{encodeAbiParameters as _e,encodeFunctionData as Qe,erc20Abi as We,formatUnits as Ae,getAddress as ue,parseAbi as _,zeroAddress as b,zeroHash as se}from"viem";var Ge="hookr_launch",g=ue(K.launcherV1),z=ue(K.rulesV1),Je=[{type:"tuple",components:[{name:"flags",type:"uint16"},{name:"minScore",type:"uint32"},{name:"tierScore",type:"uint32"},{name:"tierPips",type:"uint24"},{name:"reviewers",type:"bytes32"}]}],X=(a,n=Object.keys(a))=>({type:"object",properties:a,required:n,additionalProperties:!1}),Re={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},ae=X({token:{oneOf:[X({kind:{const:"new",type:"string"},name:{type:"string",minLength:1,maxLength:48},symbol:{type:"string",minLength:1,maxLength:12},supply:w,salt:re}),X({kind:{const:"existing",type:"string"},address:Re})]},quote:{...Re,description:"Qualified ETH (zero address) or pinned USDG quote. Other quote funding routes await qualification."},sqrtPriceX96:{...w,description:"Integer sqrt(currency1/currency0) times 2^96 for the sorted PoolKey."},tickLower:{type:"integer",minimum:-887272,maximum:887272},tickUpper:{type:"integer",minimum:-887272,maximum:887272},liquidity:w,amount0Max:w,amount1Max:w,agentGate:X({minScore:w,tierScore:w,tierPips:w,reviewerSetId:re}),lpRewardsBps:w,arbRecapture:{type:"boolean"},deadline:w});function Ye(a){let n=A(a,Object.keys(ae.properties),ae.required),r=R(n.token);if(r.kind==="existing")throw A(r,["kind","address"],["kind","address"]),q(r.address),new o("Existing-token Hookr launches await a qualified funding route. Use token.kind new.");if(A(r,["kind","name","symbol","supply","salt"],["kind","name","symbol","supply","salt"]),r.kind!=="new")throw new o("Choose token.kind new; existing tokens are not supported yet.");let e=(P,M)=>{if(typeof P!="string"||!P.trim()||new TextEncoder().encode(P).length>M||[...P].some(Q=>Q.codePointAt(0)<32)||/[\u007f-\u009f\u2028-\u202e\u2066-\u2069\ud800-\udfff]/u.test(P))throw new o(`Use nonempty public token text within ${M} UTF-8 bytes without control characters.`);return P},i=d(r.supply,108);if(!i)throw new o("Hookr new-token supply must be positive and at most 2^108-1 base units.");let t=q(n.quote);if(![b,ue(ge.mainnet.usdg)].includes(t))throw new o("Use native ETH (zero address) or the pinned USDG quote; other quote funding routes await qualification.");let l=n.tickLower,u=n.tickUpper;if(typeof l!="number"||typeof u!="number")throw new o("Provide integer aligned Hookr ticks.");xe(l,u,y.tickSpacing);let s=d(n.sqrtPriceX96,160);if(s<=ne(l)||s>=ne(u))throw new o("Hookr opening price must be strictly inside the aligned tick range.");let p=d(n.liquidity,127);if(!p)throw new o("Hookr liquidity must be positive and at most int128 max.");let m=d(n.amount0Max,128),L=d(n.amount1Max,128),x=qe({liquidity:p,tickLower:l,tickUpper:u,sqrtPriceX96:s,roundUp:!0});if(x.amount0>=1n<<127n||x.amount1>=1n<<127n||!x.amount0||!x.amount1||x.amount0>m||x.amount1>L)throw new o("Hookr exact rounded-up debts must be positive and fit both approved funding caps. Reduce liquidity or increase the caps.");let h=A(n.agentGate,["minScore","tierScore","tierPips","reviewerSetId"],["minScore","tierScore","tierPips","reviewerSetId"]),F=Number(d(h.minScore,32)),S=Number(d(h.tierScore,32)),B=Number(d(h.tierPips,24)),O=$(h.reviewerSetId);if(B>5e4||S===0!=(B===0)||(F!==0||S!==0)!=(O!==se))throw new o("Use tierPips at most 50000, paired nonzero tier score/pips, and a registered reviewer set only for scored gates. Identity-only uses all zero values.");let U=Number(d(n.lpRewardsBps,16));if(U>1e3)throw new o("Hookr LP Rewards plus burn must not exceed 1000 bps; this profile has zero burn.");if(typeof n.arbRecapture!="boolean")throw new o("Choose arbRecapture true or false explicitly.");return{token:{existing:b,name:e(r.name,48),symbol:e(r.symbol,12),supply:i,salt:$(r.salt)},quote:t,sqrtPriceX96:s,tickLower:l,tickUpper:u,liquidity:p,amount0Max:m,amount1Max:L,debts:x,gateTerms:{flags:1,minScore:F,tierScore:S,tierPips:B,reviewers:O},lpRewardsBps:U,arbRecapture:n.arbRecapture,deadline:d(n.deadline,64)}}async function Ze(a,n,r,e){return q(await c(a,g,f("launcherV1"),"predictToken",[n,r],e))}async function et(a,n,r,e,i){let t=r.gate;if(!t.walletAgent||!(e?t.healthyForScores:t.healthyIdentityOnly))throw new o("Hookr needs a healthy on-chain agent identity. Own an ERC-8004 identity or link its current agent wallet on the Hookr gate; Oak setup linking alone is insufficient.");let l=(p,m)=>c(a,t.identity,_(["function balanceOf(address) view returns (uint256)","function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),p,m,i),u=k(await l("balanceOf",[n])),s=!1;if(t.link.linked){let p=BigInt(t.link.agentId);s=q(await l("getAgentWallet",[p]))===n,!s&&u>0n&&(s=q(await l("ownerOf",[p]))===n)}if(!u&&!s||e&&!s)throw new o("Hookr on-chain identity ownership or gate link is missing or stale. Link a current ERC-8004 agent ID on the Hookr gate before launching; scored gates require that link even for an NFT owner.")}async function tt(a,n,r){let e=Ye(n);if(a.network==="testnet")throw new o("Hookr launch requires Robinhood Chain 4663.");let i=a.clientFor(4663),t=await Te(i);if(e.deadline<=t.timestamp||e.deadline>t.timestamp+y.deadlineSeconds)throw new o("Set a fresh Hookr deadline within the next 300 seconds of chain time.");let l=e.gateTerms.reviewers!==se,u=await Be(i,r,t.number,l?[e.gateTerms.reviewers]:[]);if(!u.rootOpenForWallet||u.newMarketsPaused||!u.launcherAdmitted)throw new o("Hookr new markets or the reviewed Launcher are closed. Retry only after registry admission is restored.");await et(i,r,u,l,t.number);let s=await Ze(i,r,e.token,t.number);if(s===b||s===e.quote)throw new o("Hookr predicted token collides with its quote. Choose a fresh salt.");let p={currency0:BigInt(s)<BigInt(e.quote)?s:e.quote,currency1:BigInt(s)<BigInt(e.quote)?e.quote:s,fee:8388608,tickSpacing:y.tickSpacing,hooks:I},m=oe(p),L=p.currency0===s,x=L?e.amount0Max:e.amount1Max,h=L?e.amount1Max:e.amount0Max,F=L?e.debts.amount0:e.debts.amount1,S=L?e.debts.amount1:e.debts.amount0;if(x>e.token.supply)throw new o("Hookr new-token deposit cap exceeds its fixed supply.");let[B,O,U,P,M,Q,Ie,Fe]=await Promise.all([i.getCode({address:s,blockNumber:t.number}),i.getTransactionCount({address:s,blockNumber:t.number}),c(i,g,f("launcherV1"),"memberKey",[s,e.quote,y.tickSpacing,I],t.number),c(i,I,f("rootV1"),"knownPool",[m],t.number),c(i,g,f("launcherV1"),"SKIP_TAKEN",[],t.number),c(i,j,f("registry"),"isQuote",[e.quote],t.number),c(i,j,f("registry"),"quoteIsBraked",[e.quote],t.number),c(i,z,f("rulesV1"),"minProtocolShareBps",[],t.number)]),[Ce,$e]=H(U,2);if(e.token.salt===$(M))throw new o("SKIP_TAKEN is unsupported. Choose an ordinary new-token salt.");if(B&&B!=="0x"||O!==0||N(P)||!N($e)||oe(R(Ce))!==m)throw new o("Hookr token address or pool is already taken or its predicted key differs. Choose a fresh salt and rebuild.");if(!N(Q)||N(H(Ie,2)[0]))throw new o("The Hookr quote is not currently qualified or is braked. Choose an admitted quote.");let ce=R(u.gate.admission),Ne=R(ce.caps),pe=d(Ne.maxLpFeePips,24),Oe=BigInt(u.coreAdmission.caps.maxLpFeePips),W=BigInt(y.baseLpFeePips)+pe;if(BigInt(e.gateTerms.tierPips)>pe||W>Oe||W>600000n)throw new o("Hookr gate tier or total LP fee exceeds the live admission cap. Lower the tier or wait for compatible admission.");let de=q(await c(i,z,f("rulesV1"),"protocolRecipient",[],t.number));await V(i,t.number,[de]);let[Ue,Me,Ee]=H(await c(i,de,_(["function feeTerms(address,bool,bytes32) view returns (uint16,uint16,uint16)"]),"feeTerms",[b,e.arbRecapture,m],t.number),3),le=k(Ue,16),G=k(Ee,16);if(k(Me,16)!==0n||G>10000n)throw new o("Hookr treasury minimum or integrator terms exceed the reviewed profile.");let me=k(Fe,16),E=le>me?le:me;if(E<2000n||E>5000n)throw new o("Hookr protocol share is outside the reviewed 2000\u20135000 bps profile.");let J=BigInt(e.lpRewardsBps)*100n+(!e.arbRecapture&&e.lpRewardsBps===0?G:0n);if(J>BigInt(u.coreAdmission.caps.maxQuoteTakePips))throw new o("Hookr LP Rewards and minimum quote charge exceed the live quote-take cap. Lower LP Rewards.");let Y={on:e.arbRecapture,traderBps:0,lpBps:e.arbRecapture?1e4:0,period:0,maxPrizeBps:0,potReleaseBps:0,minBuyQuote:0n,releaseBlocks:0},he=null;if(e.arbRecapture){let[D,ye]=await Promise.all([c(i,z,_(["function recaptureDefaults() view returns ((bool on,uint16 traderBps,uint16 lpBps,uint32 period,uint16 maxPrizeBps,uint16 potReleaseBps,uint128 minBuyQuote,uint32 releaseBlocks) rc,uint16 potBps)"]),"recaptureDefaults",[],t.number),c(i,j,f("registry"),"activeLaneOf",[I],t.number)]);Y.releaseBlocks=Number(k(R(H(D,2)[0]).releaseBlocks,32));let[Ve,je,ze,Xe]=H(ye,4),te=q(Ve);if(await V(i,t.number,[te]),te===b||$(je)!==Pe(te).codeHash||k(ze,32)===0n||k(Xe,16)>10000n||!Y.releaseBlocks)throw new o("Hookr recapture lane is unavailable. Use arbRecapture false until its executor and gas floor are reviewed.");he=ie(ye)}let we={quote:e.quote,tickSpacing:y.tickSpacing,sqrtPriceX96:e.sqrtPriceX96,tickLower:e.tickLower,tickUpper:e.tickUpper,liquidity:e.liquidity,amount0Max:e.amount0Max,amount1Max:e.amount1Max,config:{subject:s,quote:e.quote,rules:z,advisory:Se,liquidityOwner:g,baseLpFeePips:y.baseLpFeePips,caps:{maxLpFeePips:Number(W),maxQuoteTakePips:Number(J),maxSubjectTakeBps:0},rulesGasLimit:Number(u.coreAdmission.gasLimit),advisoryGasLimit:Number(d(ce.gasLimit,32)),advisoryPhases:1,advisoryFailOpen:!1,policyId:se},rules:{guardEndBlock:0,maxFeePips:y.baseLpFeePips,snipeTaxPips:0,snipeFloorPips:0,snipeDecaySeconds:0,dynamicFeeSens:0,burnBps:0,lpBps:e.lpRewardsBps,potBps:0,royaltyBps:0,protocolShareBps:Number(E),potEveryNBuys:0,maxBuyQuoteAmount:0n,potMinBuyQuote:0n,royaltyTo:b,integrator:b},recapture:Y},v=BigInt(u.launchFee.amount);if(v>10000000000000000n)throw new o("Hookr launch fee exceeds the reviewed 0.01 ETH maximum.");let T=b;if(v&&(await V(i,t.number,[u.launchFee.treasury]),T=q(await c(i,u.launchFee.treasury,_(["function target() view returns (address)"]),"target",[],t.number)),T===b||T===g||T===r||T===He))throw new o("Hookr launch fee recipient is outside the reviewed payment profile.");let Z=v+(e.quote===b?h:0n),ee=[],C=[];if(e.quote!==b){let D=k(await c(i,e.quote,We,"allowance",[r,g],t.number));D!==0n&&D!==h&&C.push(a.approval(e.quote,g,"0",4663)),C.push(a.approval(e.quote,g,h.toString(),4663)),ee.push({token:e.quote,amount:h})}Z&&ee.push({token:be,amount:Z,to:g});let ke=`Launch public, permanent token ${JSON.stringify(e.token.name)} (${JSON.stringify(e.token.symbol)}), fixed supply ${Ae(e.token.supply,18)} (18 decimals). Create one agents-only pool (identity check on every buy). Price currency1/currency0 = ${e.sqrtPriceX96*e.sqrtPriceX96}/${1n<<192n}; sqrtPriceX96 ${e.sqrtPriceX96}, ticks ${e.tickLower} to ${e.tickUpper}, spacing ${y.tickSpacing}. Deposit at most ${e.amount0Max} currency0 and ${e.amount1Max} currency1 base units; exact launch debts ${e.debts.amount0} and ${e.debts.amount1}. Currency0 ${p.currency0}; currency1 ${p.currency1}. Launch fee ${v} wei to ${T} (${Ae(v,18)} ETH). Unused quote funding (${h-S} base units) and retained token supply (${e.token.supply-F} base units) return to ${r} in this transaction. Family owner ${r}; token ${s}; pool ${m}. LP base fee 3000 pips; gate flags 1, scores ${e.gateTerms.minScore}/${e.gateTerms.tierScore}, tier ${e.gateTerms.tierPips} pips; LP Rewards ${e.lpRewardsBps} bps; burn 0; quote-take cap ${J} pips (includes Hookr minimum); protocol share ${E} bps. Arb recapture ${e.arbRecapture}; deadline ${e.deadline}. No lock.`;C.push(a.unsignedTx({to:g,data:Qe({abi:f("launcherV1"),functionName:"launchAdvised",args:[e.token,I,[we],[_e(Je,[e.gateTerms])],e.deadline]}),value:Z.toString(),chainId:4663,description:ke}));let[fe,De,Ke]=await Promise.all([i.getCode({address:s}),i.getTransactionCount({address:s}),i.readContract({address:g,abi:ve,functionName:"launchFee"})]);if(fe&&fe!=="0x"||De!==0||k(H(Ke,5)[0])!==v)throw new o("Hookr collision state or launch fee changed. Request a fresh launch preview.");return await Le(i,t),{txs:C,inputs:ee,summary:ke,tokenAddress:s,poolId:m,feeTarget:T,feeTreasury:u.launchFee.treasury,terms:ie({request:n,blockNumber:t.number,blockHash:t.hash,owner:r,tokenAddress:s,poolId:m,poolKey:p,member:we,gateTerms:e.gateTerms,launchFee:v,feeTarget:T,feeTreasury:u.launchFee.treasury,hookrMinimumPips:G,exactApprovals:C.slice(0,-1),refunds:{quote:h-S,retainedSupply:e.token.supply-F},gasEstimate:null,gasEstimateReason:"The local sender estimates the ordered exact calls after funding approvals and confirms the gas limit and maximum fee.",lane:he,pins:K})}}function nt(a){if(!Array.isArray(a)||a.length<1||a.length>3)throw new o("Hookr launch requires only the locally reconstructed finite approvals and one launch transaction.");for(let n of a)A(n,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function mt(a,n){if(nt(a),a.length!==n.length||a.some((r,e)=>r.to.toLowerCase()!==n[e].to.toLowerCase()||r.data.toLowerCase()!==n[e].data.toLowerCase()||r.value!==n[e].value||r.chainId!==4663))throw new o("Hookr launch differs from the locally reconstructed exact parameters, approvals and funding.")}function ht(a){return[{name:Ge,inputSchema:ae,execute:async(n,r)=>{let e=await tt(a,n,r);return{txs:e.txs,preview:await a.preview(e.txs,r),terms:e.terms,summary:e.summary}}}]}export{Ge as a,g as b,z as c,ae as d,Ye as e,tt as f,nt as g,mt as h,ht as i};
1
+ import{A as qe,s as oe,x as xe}from"./WPAF55SP.js";import{a as Be}from"./MOPETB64.js";import{a as y}from"./WWNAGOCD.js";import{a as w,b as re,d as ve,e as A,f as d,h as $,i as q,j as k,k as N,l as H,m as R,n as ie,o as f,p as c,q as I,r as j,s as He,t as Se}from"./YEXUSRIZ.js";import{b as K,f as Pe,g as V,h as Te,i as Le}from"./MQK6OP7S.js";import{i as ne}from"./S2TAJHHK.js";import{a as be}from"./HTXKERNS.js";import{s as ge}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as _e,encodeFunctionData as Qe,erc20Abi as We,formatUnits as Ae,getAddress as ue,parseAbi as _,zeroAddress as b,zeroHash as se}from"viem";var Ge="hookr_launch",g=ue(K.launcherV1),z=ue(K.rulesV1),Je=[{type:"tuple",components:[{name:"flags",type:"uint16"},{name:"minScore",type:"uint32"},{name:"tierScore",type:"uint32"},{name:"tierPips",type:"uint24"},{name:"reviewers",type:"bytes32"}]}],X=(a,n=Object.keys(a))=>({type:"object",properties:a,required:n,additionalProperties:!1}),Re={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},ae=X({token:{oneOf:[X({kind:{const:"new",type:"string"},name:{type:"string",minLength:1,maxLength:48},symbol:{type:"string",minLength:1,maxLength:12},supply:w,salt:re}),X({kind:{const:"existing",type:"string"},address:Re})]},quote:{...Re,description:"Qualified ETH (zero address) or pinned USDG quote. Other quote funding routes await qualification."},sqrtPriceX96:{...w,description:"Integer sqrt(currency1/currency0) times 2^96 for the sorted PoolKey."},tickLower:{type:"integer",minimum:-887272,maximum:887272},tickUpper:{type:"integer",minimum:-887272,maximum:887272},liquidity:w,amount0Max:w,amount1Max:w,agentGate:X({minScore:w,tierScore:w,tierPips:w,reviewerSetId:re}),lpRewardsBps:w,arbRecapture:{type:"boolean"},deadline:w});function Ye(a){let n=A(a,Object.keys(ae.properties),ae.required),r=R(n.token);if(r.kind==="existing")throw A(r,["kind","address"],["kind","address"]),q(r.address),new o("Existing-token Hookr launches await a qualified funding route. Use token.kind new.");if(A(r,["kind","name","symbol","supply","salt"],["kind","name","symbol","supply","salt"]),r.kind!=="new")throw new o("Choose token.kind new; existing tokens are not supported yet.");let e=(P,M)=>{if(typeof P!="string"||!P.trim()||new TextEncoder().encode(P).length>M||[...P].some(Q=>Q.codePointAt(0)<32)||/[\u007f-\u009f\u2028-\u202e\u2066-\u2069\ud800-\udfff]/u.test(P))throw new o(`Use nonempty public token text within ${M} UTF-8 bytes without control characters.`);return P},i=d(r.supply,108);if(!i)throw new o("Hookr new-token supply must be positive and at most 2^108-1 base units.");let t=q(n.quote);if(![b,ue(ge.mainnet.usdg)].includes(t))throw new o("Use native ETH (zero address) or the pinned USDG quote; other quote funding routes await qualification.");let l=n.tickLower,u=n.tickUpper;if(typeof l!="number"||typeof u!="number")throw new o("Provide integer aligned Hookr ticks.");xe(l,u,y.tickSpacing);let s=d(n.sqrtPriceX96,160);if(s<=ne(l)||s>=ne(u))throw new o("Hookr opening price must be strictly inside the aligned tick range.");let p=d(n.liquidity,127);if(!p)throw new o("Hookr liquidity must be positive and at most int128 max.");let m=d(n.amount0Max,128),L=d(n.amount1Max,128),x=qe({liquidity:p,tickLower:l,tickUpper:u,sqrtPriceX96:s,roundUp:!0});if(x.amount0>=1n<<127n||x.amount1>=1n<<127n||!x.amount0||!x.amount1||x.amount0>m||x.amount1>L)throw new o("Hookr exact rounded-up debts must be positive and fit both approved funding caps. Reduce liquidity or increase the caps.");let h=A(n.agentGate,["minScore","tierScore","tierPips","reviewerSetId"],["minScore","tierScore","tierPips","reviewerSetId"]),F=Number(d(h.minScore,32)),S=Number(d(h.tierScore,32)),B=Number(d(h.tierPips,24)),O=$(h.reviewerSetId);if(B>5e4||S===0!=(B===0)||(F!==0||S!==0)!=(O!==se))throw new o("Use tierPips at most 50000, paired nonzero tier score/pips, and a registered reviewer set only for scored gates. Identity-only uses all zero values.");let U=Number(d(n.lpRewardsBps,16));if(U>1e3)throw new o("Hookr LP Rewards plus burn must not exceed 1000 bps; this profile has zero burn.");if(typeof n.arbRecapture!="boolean")throw new o("Choose arbRecapture true or false explicitly.");return{token:{existing:b,name:e(r.name,48),symbol:e(r.symbol,12),supply:i,salt:$(r.salt)},quote:t,sqrtPriceX96:s,tickLower:l,tickUpper:u,liquidity:p,amount0Max:m,amount1Max:L,debts:x,gateTerms:{flags:1,minScore:F,tierScore:S,tierPips:B,reviewers:O},lpRewardsBps:U,arbRecapture:n.arbRecapture,deadline:d(n.deadline,64)}}async function Ze(a,n,r,e){return q(await c(a,g,f("launcherV1"),"predictToken",[n,r],e))}async function et(a,n,r,e,i){let t=r.gate;if(!t.walletAgent||!(e?t.healthyForScores:t.healthyIdentityOnly))throw new o("Hookr needs a healthy on-chain agent identity. Own an ERC-8004 identity or link its current agent wallet on the Hookr gate; Oak setup linking alone is insufficient.");let l=(p,m)=>c(a,t.identity,_(["function balanceOf(address) view returns (uint256)","function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),p,m,i),u=k(await l("balanceOf",[n])),s=!1;if(t.link.linked){let p=BigInt(t.link.agentId);s=q(await l("getAgentWallet",[p]))===n,!s&&u>0n&&(s=q(await l("ownerOf",[p]))===n)}if(!u&&!s||e&&!s)throw new o("Hookr on-chain identity ownership or gate link is missing or stale. Link a current ERC-8004 agent ID on the Hookr gate before launching; scored gates require that link even for an NFT owner.")}async function tt(a,n,r){let e=Ye(n);if(a.network==="testnet")throw new o("Hookr launch requires Robinhood Chain 4663.");let i=a.clientFor(4663),t=await Te(i);if(e.deadline<=t.timestamp||e.deadline>t.timestamp+y.deadlineSeconds)throw new o("Set a fresh Hookr deadline within the next 300 seconds of chain time.");let l=e.gateTerms.reviewers!==se,u=await Be(i,r,t.number,l?[e.gateTerms.reviewers]:[]);if(!u.rootOpenForWallet||u.newMarketsPaused||!u.launcherAdmitted)throw new o("Hookr new markets or the reviewed Launcher are closed. Retry only after registry admission is restored.");await et(i,r,u,l,t.number);let s=await Ze(i,r,e.token,t.number);if(s===b||s===e.quote)throw new o("Hookr predicted token collides with its quote. Choose a fresh salt.");let p={currency0:BigInt(s)<BigInt(e.quote)?s:e.quote,currency1:BigInt(s)<BigInt(e.quote)?e.quote:s,fee:8388608,tickSpacing:y.tickSpacing,hooks:I},m=oe(p),L=p.currency0===s,x=L?e.amount0Max:e.amount1Max,h=L?e.amount1Max:e.amount0Max,F=L?e.debts.amount0:e.debts.amount1,S=L?e.debts.amount1:e.debts.amount0;if(x>e.token.supply)throw new o("Hookr new-token deposit cap exceeds its fixed supply.");let[B,O,U,P,M,Q,Ie,Fe]=await Promise.all([i.getCode({address:s,blockNumber:t.number}),i.getTransactionCount({address:s,blockNumber:t.number}),c(i,g,f("launcherV1"),"memberKey",[s,e.quote,y.tickSpacing,I],t.number),c(i,I,f("rootV1"),"knownPool",[m],t.number),c(i,g,f("launcherV1"),"SKIP_TAKEN",[],t.number),c(i,j,f("registry"),"isQuote",[e.quote],t.number),c(i,j,f("registry"),"quoteIsBraked",[e.quote],t.number),c(i,z,f("rulesV1"),"minProtocolShareBps",[],t.number)]),[Ce,$e]=H(U,2);if(e.token.salt===$(M))throw new o("SKIP_TAKEN is unsupported. Choose an ordinary new-token salt.");if(B&&B!=="0x"||O!==0||N(P)||!N($e)||oe(R(Ce))!==m)throw new o("Hookr token address or pool is already taken or its predicted key differs. Choose a fresh salt and rebuild.");if(!N(Q)||N(H(Ie,2)[0]))throw new o("The Hookr quote is not currently qualified or is braked. Choose an admitted quote.");let ce=R(u.gate.admission),Ne=R(ce.caps),pe=d(Ne.maxLpFeePips,24),Oe=BigInt(u.coreAdmission.caps.maxLpFeePips),W=BigInt(y.baseLpFeePips)+pe;if(BigInt(e.gateTerms.tierPips)>pe||W>Oe||W>600000n)throw new o("Hookr gate tier or total LP fee exceeds the live admission cap. Lower the tier or wait for compatible admission.");let de=q(await c(i,z,f("rulesV1"),"protocolRecipient",[],t.number));await V(i,t.number,[de]);let[Ue,Me,Ee]=H(await c(i,de,_(["function feeTerms(address,bool,bytes32) view returns (uint16,uint16,uint16)"]),"feeTerms",[b,e.arbRecapture,m],t.number),3),le=k(Ue,16),G=k(Ee,16);if(k(Me,16)!==0n||G>10000n)throw new o("Hookr treasury minimum or integrator terms exceed the reviewed profile.");let me=k(Fe,16),E=le>me?le:me;if(E<2000n||E>5000n)throw new o("Hookr protocol share is outside the reviewed 2000\u20135000 bps profile.");let J=BigInt(e.lpRewardsBps)*100n+(!e.arbRecapture&&e.lpRewardsBps===0?G:0n);if(J>BigInt(u.coreAdmission.caps.maxQuoteTakePips))throw new o("Hookr LP Rewards and minimum quote charge exceed the live quote-take cap. Lower LP Rewards.");let Y={on:e.arbRecapture,traderBps:0,lpBps:e.arbRecapture?1e4:0,period:0,maxPrizeBps:0,potReleaseBps:0,minBuyQuote:0n,releaseBlocks:0},he=null;if(e.arbRecapture){let[D,ye]=await Promise.all([c(i,z,_(["function recaptureDefaults() view returns ((bool on,uint16 traderBps,uint16 lpBps,uint32 period,uint16 maxPrizeBps,uint16 potReleaseBps,uint128 minBuyQuote,uint32 releaseBlocks) rc,uint16 potBps)"]),"recaptureDefaults",[],t.number),c(i,j,f("registry"),"activeLaneOf",[I],t.number)]);Y.releaseBlocks=Number(k(R(H(D,2)[0]).releaseBlocks,32));let[Ve,je,ze,Xe]=H(ye,4),te=q(Ve);if(await V(i,t.number,[te]),te===b||$(je)!==Pe(te).codeHash||k(ze,32)===0n||k(Xe,16)>10000n||!Y.releaseBlocks)throw new o("Hookr recapture lane is unavailable. Use arbRecapture false until its executor and gas floor are reviewed.");he=ie(ye)}let we={quote:e.quote,tickSpacing:y.tickSpacing,sqrtPriceX96:e.sqrtPriceX96,tickLower:e.tickLower,tickUpper:e.tickUpper,liquidity:e.liquidity,amount0Max:e.amount0Max,amount1Max:e.amount1Max,config:{subject:s,quote:e.quote,rules:z,advisory:Se,liquidityOwner:g,baseLpFeePips:y.baseLpFeePips,caps:{maxLpFeePips:Number(W),maxQuoteTakePips:Number(J),maxSubjectTakeBps:0},rulesGasLimit:Number(u.coreAdmission.gasLimit),advisoryGasLimit:Number(d(ce.gasLimit,32)),advisoryPhases:1,advisoryFailOpen:!1,policyId:se},rules:{guardEndBlock:0,maxFeePips:y.baseLpFeePips,snipeTaxPips:0,snipeFloorPips:0,snipeDecaySeconds:0,dynamicFeeSens:0,burnBps:0,lpBps:e.lpRewardsBps,potBps:0,royaltyBps:0,protocolShareBps:Number(E),potEveryNBuys:0,maxBuyQuoteAmount:0n,potMinBuyQuote:0n,royaltyTo:b,integrator:b},recapture:Y},v=BigInt(u.launchFee.amount);if(v>10000000000000000n)throw new o("Hookr launch fee exceeds the reviewed 0.01 ETH maximum.");let T=b;if(v&&(await V(i,t.number,[u.launchFee.treasury]),T=q(await c(i,u.launchFee.treasury,_(["function target() view returns (address)"]),"target",[],t.number)),T===b||T===g||T===r||T===He))throw new o("Hookr launch fee recipient is outside the reviewed payment profile.");let Z=v+(e.quote===b?h:0n),ee=[],C=[];if(e.quote!==b){let D=k(await c(i,e.quote,We,"allowance",[r,g],t.number));D!==0n&&D!==h&&C.push(a.approval(e.quote,g,"0",4663)),C.push(a.approval(e.quote,g,h.toString(),4663)),ee.push({token:e.quote,amount:h})}Z&&ee.push({token:be,amount:Z,to:g});let ke=`Launch public, permanent token ${JSON.stringify(e.token.name)} (${JSON.stringify(e.token.symbol)}), fixed supply ${Ae(e.token.supply,18)} (18 decimals). Create one agents-only pool (identity check on every buy). Price currency1/currency0 = ${e.sqrtPriceX96*e.sqrtPriceX96}/${1n<<192n}; sqrtPriceX96 ${e.sqrtPriceX96}, ticks ${e.tickLower} to ${e.tickUpper}, spacing ${y.tickSpacing}. Deposit at most ${e.amount0Max} currency0 and ${e.amount1Max} currency1 base units; exact launch debts ${e.debts.amount0} and ${e.debts.amount1}. Currency0 ${p.currency0}; currency1 ${p.currency1}. Launch fee ${v} wei to ${T} (${Ae(v,18)} ETH). Unused quote funding (${h-S} base units) and retained token supply (${e.token.supply-F} base units) return to ${r} in this transaction. Family owner ${r}; token ${s}; pool ${m}. LP base fee 3000 pips; gate flags 1, scores ${e.gateTerms.minScore}/${e.gateTerms.tierScore}, tier ${e.gateTerms.tierPips} pips; LP Rewards ${e.lpRewardsBps} bps; burn 0; quote-take cap ${J} pips (includes Hookr minimum); protocol share ${E} bps. Arb recapture ${e.arbRecapture}; deadline ${e.deadline}. No lock.`;C.push(a.unsignedTx({to:g,data:Qe({abi:f("launcherV1"),functionName:"launchAdvised",args:[e.token,I,[we],[_e(Je,[e.gateTerms])],e.deadline]}),value:Z.toString(),chainId:4663,description:ke}));let[fe,De,Ke]=await Promise.all([i.getCode({address:s}),i.getTransactionCount({address:s}),i.readContract({address:g,abi:ve,functionName:"launchFee"})]);if(fe&&fe!=="0x"||De!==0||k(H(Ke,5)[0])!==v)throw new o("Hookr collision state or launch fee changed. Request a fresh launch preview.");return await Le(i,t),{txs:C,inputs:ee,summary:ke,tokenAddress:s,poolId:m,feeTarget:T,feeTreasury:u.launchFee.treasury,terms:ie({request:n,blockNumber:t.number,blockHash:t.hash,owner:r,tokenAddress:s,poolId:m,poolKey:p,member:we,gateTerms:e.gateTerms,launchFee:v,feeTarget:T,feeTreasury:u.launchFee.treasury,hookrMinimumPips:G,exactApprovals:C.slice(0,-1),refunds:{quote:h-S,retainedSupply:e.token.supply-F},gasEstimate:null,gasEstimateReason:"The local sender estimates the ordered exact calls after funding approvals and confirms the gas limit and maximum fee.",lane:he,pins:K})}}function nt(a){if(!Array.isArray(a)||a.length<1||a.length>3)throw new o("Hookr launch requires only the locally reconstructed finite approvals and one launch transaction.");for(let n of a)A(n,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function mt(a,n){if(nt(a),a.length!==n.length||a.some((r,e)=>r.to.toLowerCase()!==n[e].to.toLowerCase()||r.data.toLowerCase()!==n[e].data.toLowerCase()||r.value!==n[e].value||r.chainId!==4663))throw new o("Hookr launch differs from the locally reconstructed exact parameters, approvals and funding.")}function ht(a){return[{name:Ge,inputSchema:ae,execute:async(n,r)=>{let e=await tt(a,n,r);return{txs:e.txs,preview:await a.preview(e.txs,r),terms:e.terms,summary:e.summary}}}]}export{Ge as a,g as b,z as c,ae as d,Ye as e,tt as f,nt as g,mt as h,ht as i};
@@ -0,0 +1 @@
1
+ import{b as q,o as U}from"./GHPREYQK.js";import{a as le,b as ue,c as me}from"./ZET37EIG.js";import{a as ce}from"./MBTARLZQ.js";import{a as fe,b as pe}from"./RNC463IM.js";import{a as ye}from"./3VAJW6TQ.js";import{e as F,h as O,m as de}from"./W76QC2AW.js";import{b as se}from"./Z4SRGAVL.js";import{a as B}from"./BQICZFLR.js";import{c as ae}from"./MYFAKCQI.js";import{c as D,e as x,g as k,k as te,l as oe,m as re,n as ie}from"./5KUWLUPM.js";import{a as h,i as ne}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{decodeFunctionResult as Ie,encodeAbiParameters as j,encodeFunctionData as M,erc20Abi as J,isAddress as Pe,parseAbi as Ae,parseAbiParameters as V,toHex as W,zeroAddress as z}from"viem";var A=ne[h].clanker,he=Ae(["function deployToken(((address tokenAdmin,string name,string symbol,bytes32 salt,string image,string metadata,string context,uint256 originatingChainId) tokenConfig,(address hook,address pairedToken,int24 tickIfToken0IsClanker,int24 tickSpacing,bytes poolData) poolConfig,(address locker,address[] rewardAdmins,address[] rewardRecipients,uint16[] rewardBps,int24[] tickLower,int24[] tickUpper,uint16[] positionBps,bytes lockerData) lockerConfig,(address mevModule,bytes mevModuleData) mevModuleConfig,(address extension,uint256 msgValue,uint16 extensionBps,bytes extensionData)[] extensionConfigs) config) payable returns (address)","function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),T=Ae(["function availableFees(address,address) view returns (uint256)","function claim(address,address)","function collectRewards(address)","function mevModuleEnabled(bytes32) view returns (bool)","function mevModuleOperational(bytes32) returns (bool)"]),C={address:A.paired_weth.address,symbol:"WETH",decimals:18,chainId:h},Se="https://www.clanker.world/api/tokens",ge={type:"string",pattern:"^\\d+$"},be={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"};function I(e){return oe(te(e,F),F)}function we(e,t){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new i(`Provide an explicit bytes32 ${t}.`);return e}function P(e,t,s=!1){if(e===void 0&&!s)return"";if(typeof e!="string"||s&&!e.trim())throw new i(`Provide ${t} as text.`);return e}function Z(e,t=256){return ie(e,`Amount exceeds the uint${t} range.`,{bits:t})}function G(e){return re(e,"The contract returned an invalid amount.").toString()}function L(e,t){let s=Object.keys(e).find(u=>!t.includes(u));if(s)throw new i(`Unsupported Clanker input: ${s}.`)}function ke(e,t){return t.changes.map(({token:s,amount:u})=>{let b=u.startsWith("-");return`${b?"-":"+"}${e.formatAmount(b?u.slice(1):u,s.decimals)} ${s.symbol} (${s.address}, chain ${s.chainId})`}).join("; ")}function ve(e){return x(e)&&Array.isArray(e.data)&&Number.isSafeInteger(e.total)&&Number(e.total)>=0&&Number.isSafeInteger(e.tokensDeployed)&&Number(e.tokensDeployed)>=0&&(e.cursor===null||e.cursor===void 0||typeof e.cursor=="string")&&e.data.every(t=>x(t)&&typeof t.name=="string"&&typeof t.symbol=="string"&&Number.isSafeInteger(t.chain_id)&&["contract_address","admin","msg_sender","factory_address"].every(s=>typeof t[s]=="string"&&Pe(t[s],{strict:!1})))}function K(e,t=0){return typeof e=="string"?N(e):e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:t>=4?null:Array.isArray(e)?e.slice(0,20).map(s=>K(s,t+1)):x(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,u])=>[s,K(u,t+1)])):null}function _e(e){return{...K(e),contract_address:e.contract_address,admin:e.admin,msg_sender:e.msg_sender,chain_id:e.chain_id,factory_address:e.factory_address,name:N(e.name),symbol:N(e.symbol)}}function $e(e){try{if(typeof e!="string"||!/^[A-Za-z0-9_-]{1,256}={0,2}$/.test(e))throw new Error;let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));if(!x(t)||typeof t.id!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z?$/.test(t.id)||!Number.isFinite(Date.parse(t.id)))throw new Error;return e}catch{throw new i("Use the cursor returned by the previous clanker_browse page.")}}async function Ne(e,t={}){L(t,["q","limit","cursor","deployer"]);let s=t.limit??10;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>20)throw new i("Choose an indexer limit from 1 to 20.");let u=new URL(Se);u.searchParams.set("chainId",String(h)),u.searchParams.set("limit",String(s)),t.q!==void 0&&u.searchParams.set("q",P(t.q,"search")),t.cursor!==void 0&&u.searchParams.set("cursor",P(t.cursor,"cursor",!0)),t.deployer!==void 0&&u.searchParams.set("msgSender",I(t.deployer));let b=await ae(e.http,u.toString(),{headers:{"User-Agent":"Oak-Clanker/1.0"}},ve);return{tokens:b.data.filter(S=>S.chain_id===h&&k(S.factory_address,A.factory.address)),total:b.total,cursor:b.cursor||null,tokensDeployed:b.tokensDeployed}}var De=e=>{let t=()=>e.clientFor(h),s=async n=>{try{return await n()}catch(o){throw new i(e.plainError(o))}},u=(n,o,a,c="0")=>e.unsignedTx({to:n,data:o,value:c,chainId:h,description:a}),b=async(n,o)=>G(await t().readContract({address:A.fee_locker.address,abi:T,functionName:"availableFees",args:[n,o]})),S=async n=>{if(k(n,C.address))return C;let[o,a]=await Promise.all([t().readContract({address:n,abi:J,functionName:"symbol"}),t().readContract({address:n,abi:J,functionName:"decimals"})]);if(typeof o!="string"||!o.trim()||!Number.isInteger(a)||a<0||a>255)throw new i("The contract returned invalid token metadata.");return{address:n,chainId:h,symbol:o,decimals:a}},Q=async n=>{n.cursor!==void 0&&$e(n.cursor);let o=await Ne(e,n);return{...o,tokens:o.tokens.map(_e)}},xe=async(n,o)=>{if(L(n,["name","symbol","salt","image","metadata","context","vanity","initialBuy","minAmountOut","slippageBps","rewards","vault","airdrop","feeBps","pool"]),n.vanity!==void 0&&n.vanity!==!1)throw new i("Clanker launches use vanity false and an explicit salt.");let a=P(n.name,"token name",!0),c=P(n.symbol,"token symbol",!0),g=we(n.salt,"salt"),y=Z(n.initialBuy??"0"),l=n.slippageBps??q;if(typeof l!="number")throw new i("Slippage must be an integer from 0 to 9999 bps.");U("0",l);let r=n.minAmountOut===void 0?void 0:Z(n.minAmountOut,128);if(r!==void 0&&r<=1n)throw new i("Initial-buy minimum must exceed one base unit.");if(!y&&r!==void 0)throw new i("A minimum requires a positive initial buy.");let m=ue(n,o);O(n.feeBps??100,0,1e3);let f=pe(n);if(y&&!k(f.poolConfig.pairedToken,C.address))throw new i("An initial ETH buy currently requires a WETH-paired pool. Launch without an initial buy and obtain a protected swap quote separately.");let d=n.rewards??[{admin:o,recipient:o,bps:1e4,feePreference:0}];if(!Array.isArray(d)||!d.length||d.length>7)throw new i("Provide one to seven reward allocations.");let w=d.map(p=>{if(!x(p))throw new i("Provide reward allocations as objects.");return L(p,["admin","recipient","bps","feePreference"]),{admin:I(p.admin),recipient:I(p.recipient),bps:O(p.bps,1,1e4),feePreference:O(p.feePreference??0,0,2)}});if(w.reduce((p,v)=>p+v.bps,0)!==1e4)throw new i("Reward allocations must total 10000 bps.");let _={tokenConfig:{tokenAdmin:o,name:a,symbol:c,salt:g,image:P(n.image,"image"),metadata:P(n.metadata,"metadata"),context:n.context===void 0?JSON.stringify({interface:"Oak",platform:"robinhood"}):P(n.context,"context"),originatingChainId:BigInt(h)},poolConfig:f.poolConfig,lockerConfig:{locker:A.locker.address,rewardAdmins:w.map(p=>p.admin),rewardRecipients:w.map(p=>p.recipient),rewardBps:w.map(p=>p.bps),tickLower:f.tickLower,tickUpper:f.tickUpper,positionBps:f.positionBps,lockerData:j(V("(uint8[])"),[[w.map(p=>p.feePreference)]])},mevModuleConfig:{mevModule:A.mev_module.address,mevModuleData:j(V("(uint24,uint24,uint256)"),[[666777,41673,15n]])},extensionConfigs:m},Ce=await t().simulateContract({address:A.factory.address,abi:he,functionName:"deployToken",args:[_],account:o,value:0n,gas:B}),E=I(Ce.result),X=p=>{let v=[...m,...y?[{extension:A.devbuy.address,msgValue:y,extensionBps:0,extensionData:j(V("(address,address,uint24,int24,address),uint128,address"),[[z,z,0,0,z],p,o])}]:[]];return u(A.factory.address,M({abi:he,functionName:"deployToken",args:[{..._,extensionConfigs:v}]}),`Launch ${a} (${c}); initial buy ${y} native ETH base units.`,y.toString())};if(y&&r===void 0){let v=(await e.preview([X(0n)],o)).changes.filter($=>$.token.chainId===h&&k($.token.address,E)&&$.token.decimals===18).reduce(($,ee)=>$+(/^-?\d+$/.test(ee.amount)?BigInt(ee.amount):(()=>{throw new i("Invalid initial-buy simulation amount.")})()),0n);if(v<=0n)throw new i("Initial-buy simulation returned no token output.");if(r=Z(U(v.toString(),l),128),r<=1n)throw new i("Initial-buy output is too small for a protected minimum.")}let Y=[X(r??0n)],H=await e.preview(Y,o);return{txs:Y,preview:H,predictedToken:E,token:{address:E,chainId:h,symbol:c,decimals:18},...r!==void 0?{minAmountOut:r.toString()}:{},summary:`Launch ${c} at ${E} (CREATE2 address predicted from simulation); vanity false; salt ${g}. Supply 100000000000000000000000000000 base units (18 decimals). ${f.feeSummary}; protocol adds 20% of LP fees. Pool and LP allocations: ${JSON.stringify(f)}. Reward allocations: ${JSON.stringify(w)}. Extensions: ${JSON.stringify({vault:n.vault,airdrop:n.airdrop})}. Sniper fees 666777 to 41673 over 15 seconds. ${H.summary} ${ke(e,H)}`}},Te=async(n,o)=>{if(L(n,["token","poolId","collect"]),n.collect!==void 0&&typeof n.collect!="boolean")throw new i("collect must be boolean.");if(n.collect===!1&&n.poolId!==void 0)throw new i("poolId requires collection.");if(n.collect===!0&&n.token===void 0)throw new i("Collection requires a Clanker token.");if(n.poolId!==void 0&&n.token===void 0)throw new i("A pool ID requires its Clanker token.");let a=[C],c=[];if(n.token!==void 0){let r=I(n.token);if(k(r,C.address))throw new i("Provide the launched Clanker token, not WETH.");if(n.collect!==!1){let m=await de(e,r),{poolId:f,hook:d,locker:w}=m;if(n.poolId!==void 0&&!k(we(n.poolId,"pool ID for fee collection"),f))throw new i("The supplied pool ID does not match the onchain Clanker pool.");k(m.pairedToken,C.address)||a.splice(0,1,await S(m.pairedToken));let _=await t().readContract({address:d,abi:T,functionName:"mevModuleEnabled",args:[f]});if(typeof _!="boolean")throw new i("The hook returned an invalid MEV guard state.");_&&c.push(u(d,M({abi:T,functionName:"mevModuleOperational",args:[f]}),"Update the Clanker pool MEV guard before collection.")),c.push(u(w,M({abi:T,functionName:"collectRewards",args:[r]}),"Collect pending LP fees into the fee locker."))}a.push(await S(r))}let g;if(c.length){if(await t().getChainId()!==h)throw new i("Fee simulation endpoint is on the wrong chain.");let r=[...c.map(d=>({from:o,gas:W(B),to:d.to,data:d.data,value:W(BigInt(d.value))})),...a.map(d=>({from:o,gas:W(B),to:A.fee_locker.address,data:M({abi:T,functionName:"availableFees",args:[o,d.address]}),value:"0x0"}))],m=await t().request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:r}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(m)||m.length!==1||!x(m[0])||!Array.isArray(m[0].calls)||m[0].calls.length!==r.length)throw new i("The endpoint returned an unexpected fee simulation response.");let f=m[0].calls;if(!f.every(d=>x(d)&&d.status==="0x1"&&!d.error))throw new i("Clanker fee collection simulation failed.");g=f.slice(c.length).map(d=>{if(!x(d)||typeof d.returnData!="string"||!/^0x[0-9a-fA-F]{64}$/.test(d.returnData))throw new i("The endpoint returned an invalid fee balance.");return G(Ie({abi:T,functionName:"availableFees",data:d.returnData}))})}else g=await Promise.all(a.map(r=>b(o,r.address)));let y=a.flatMap((r,m)=>BigInt(g[m])>0n?[{token:r,amount:g[m]}]:[]);if(!y.length)throw new i("No claimable fees for this wallet; pending LP fees may require the MEV window to end.");for(let{token:r}of y)c.push(u(A.fee_locker.address,M({abi:T,functionName:"claim",args:[o,r.address]}),`Claim ${r.symbol} fees to ${o}.`));let l=await e.preview(c,o);return{txs:c,preview:l,fees:y,summary:`Claim fees to ${o}. WETH fees aggregate across all Clanker launches for this recipient. ${l.summary} ${ke(e,l)}`}},R=(n,o,a,c)=>({name:`clanker_${n}`,inputSchema:{type:"object",properties:o,required:a,additionalProperties:!1},execute:(g,y)=>s(async()=>c(g,I(y)))});return{tools:[R("launch",{name:{type:"string"},symbol:{type:"string"},salt:be,image:{type:"string"},metadata:{type:"string"},context:{type:"string"},vanity:{const:!1},initialBuy:{...ge,description:"Native ETH base units, 18 decimals."},minAmountOut:{...ge,description:"Minimum new token base units, 18 decimals; derived from simulation when omitted."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:q},feeBps:{type:"integer",minimum:0,maximum:1e3,default:100},pool:fe,rewards:{type:"array",minItems:1,maxItems:7,items:{type:"object",properties:{admin:D,recipient:D,bps:{type:"integer",minimum:1,maximum:1e4},feePreference:{type:"integer",minimum:0,maximum:2}},required:["admin","recipient","bps"],additionalProperties:!1}},...le},["name","symbol","salt"],async(n,o)=>{let a=await xe(n,o);return{...a,summary:`${a.summary} After the launch is mined, use clanker_status to inspect ${a.predictedToken} and clanker_claim to collect creator fees.`}}),R("claim",{token:{...D,description:"Launched token; derives its onchain pool and collects pending LP fees before claiming."},poolId:{...be,description:"Optional assertion against the derived pool ID."},collect:{type:"boolean",default:!0,description:"Set false to claim only already-collected fees."}},[],Te),R("browse",{q:{type:"string"},limit:{type:"integer",minimum:1,maximum:20},cursor:{type:"string"},deployer:D},[],Q)],positions:n=>s(async()=>{I(n);let o=new Map,a=new Set,c;do{let l=await Q({deployer:n,limit:20,...c?{cursor:c}:{}});for(let r of l.tokens)k(r.msg_sender,n)&&o.set(r.contract_address.toLowerCase(),r);if(l.cursor&&a.has(l.cursor))throw new i("The Clanker indexer repeated a pagination cursor.");l.cursor&&a.add(l.cursor),c=l.cursor??void 0}while(c);let g=[],y=[C];for(let[l,r]of o){let m=await S(r.contract_address),f={...m,symbol:N(m.symbol)},d=G(await t().readContract({address:f.address,abi:J,functionName:"balanceOf",args:[n]}));g.push({module:"clanker",id:`launch:${l}`,chainId:h,assets:[{token:f,amount:d}],description:`Indexed launch ${r.name}; wallet token balance, not locked LP principal.`}),y.some(w=>k(w.address,f.address))||y.push(f)}for(let l of y){let r=await b(n,l.address);BigInt(r)>0n&&g.push({module:"clanker",id:`fees:${l.address.toLowerCase()}`,chainId:h,assets:[{token:l,amount:r}],description:"Collected fees across launches for this recipient. Pending LP fees excluded; token-side discovery covers indexed launches by this wallet."})}return g})}},ze=e=>se("clanker",[De(e),ce(e),me(e),ye(e)]);export{Ne as a,De as b,ze as c};
@@ -1 +1 @@
1
- import{a as f,b as O,f as c,g as _,i as D}from"./WQ6H62DM.js";import{c as i,g as C}from"./73N3TOJL.js";import{a as m}from"./G6HCV67X.js";import{a}from"./5YS5V2LK.js";import{encodeFunctionData as F,parseAbi as P}from"viem";var E=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],w=P(E),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},R=p=>{let h=()=>p.clientFor(m),k=async(e,n,t)=>({txs:e,preview:await p.preview(e,n),summary:t}),y=(e,n,t,r)=>p.unsignedTx({to:e,chainId:m,data:F({abi:w,functionName:n,args:t}),value:"0",description:r}),$={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"]},contract:{enum:["factory","locker","fee_locker"]},target:i,hook:i,token:i,recipient:i,enabled:{type:"boolean"}},b=(e,n,t,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:n,required:t,additionalProperties:!1},execute:async(o,s)=>{try{return D(o,Object.keys(n)),await r(o,c(s))}catch(d){throw new a(p.plainError(d))}}});return{tools:[b("protocol_admin",$,["operation"],async(e,n)=>{let t=String(e.operation),r=t==="transferOwnership"||t==="renounceOwnership";if(!r&&!Object.hasOwn(g,t))throw new a("Choose a supported Clanker protocol operation.");let o=r?void 0:g[t],s=o?.contract??e.contract;if(s!=="factory"&&s!=="locker"&&s!=="fee_locker")throw new a("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==s)throw new a("This operation targets a different pinned contract.");let d=o?.fields??(t==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new a(`Input ${l} does not match this protocol operation.`);let u=f[s].address,A=c(await h().readContract({address:u,abi:w,functionName:"owner"}),!0);if(!C(A,n)&&(o?.admin&&await h().readContract({address:u,abi:w,functionName:"admins",args:[n]}))!==!0)throw new a("The connected wallet lacks the required Clanker protocol owner/admin role.");let T=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new a("Provide enabled as boolean.");return e.enabled}),v=`Clanker protocol ${s}: ${t} ${JSON.stringify(T)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,t,T,v)],n,v)}),b("store_fees",{token:i,recipient:i,amount:O},["token","recipient","amount"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=_(e.amount);if(!o)throw new a("Provide a positive fee deposit amount.");if(await h().readContract({address:f.fee_locker.address,abi:w,functionName:"allowedDepositors",args:[n]})!==!0)throw new a("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${o} base units of token ${t} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(t,f.fee_locker.address,o.toString(),m),y(f.fee_locker.address,"storeFees",[r,t,o],d)];return k(u,n,d)}),b("claim_for",{token:i,recipient:i},["token","recipient"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=`Permissionlessly claim already-collected Clanker ${t} fees for ${r}; all receipts go to that fee owner, while ${n} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,t],o)],n,o)})]}};export{R as a};
1
+ import{a as f,b as O,f as c,g as _,i as D}from"./W76QC2AW.js";import{c as i,g as C}from"./5KUWLUPM.js";import{a as m}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{encodeFunctionData as F,parseAbi as P}from"viem";var E=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],w=P(E),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},R=p=>{let h=()=>p.clientFor(m),k=async(e,n,t)=>({txs:e,preview:await p.preview(e,n),summary:t}),y=(e,n,t,r)=>p.unsignedTx({to:e,chainId:m,data:F({abi:w,functionName:n,args:t}),value:"0",description:r}),$={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"]},contract:{enum:["factory","locker","fee_locker"]},target:i,hook:i,token:i,recipient:i,enabled:{type:"boolean"}},b=(e,n,t,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:n,required:t,additionalProperties:!1},execute:async(o,s)=>{try{return D(o,Object.keys(n)),await r(o,c(s))}catch(d){throw new a(p.plainError(d))}}});return{tools:[b("protocol_admin",$,["operation"],async(e,n)=>{let t=String(e.operation),r=t==="transferOwnership"||t==="renounceOwnership";if(!r&&!Object.hasOwn(g,t))throw new a("Choose a supported Clanker protocol operation.");let o=r?void 0:g[t],s=o?.contract??e.contract;if(s!=="factory"&&s!=="locker"&&s!=="fee_locker")throw new a("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==s)throw new a("This operation targets a different pinned contract.");let d=o?.fields??(t==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new a(`Input ${l} does not match this protocol operation.`);let u=f[s].address,A=c(await h().readContract({address:u,abi:w,functionName:"owner"}),!0);if(!C(A,n)&&(o?.admin&&await h().readContract({address:u,abi:w,functionName:"admins",args:[n]}))!==!0)throw new a("The connected wallet lacks the required Clanker protocol owner/admin role.");let T=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new a("Provide enabled as boolean.");return e.enabled}),v=`Clanker protocol ${s}: ${t} ${JSON.stringify(T)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,t,T,v)],n,v)}),b("store_fees",{token:i,recipient:i,amount:O},["token","recipient","amount"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=_(e.amount);if(!o)throw new a("Provide a positive fee deposit amount.");if(await h().readContract({address:f.fee_locker.address,abi:w,functionName:"allowedDepositors",args:[n]})!==!0)throw new a("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${o} base units of token ${t} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(t,f.fee_locker.address,o.toString(),m),y(f.fee_locker.address,"storeFees",[r,t,o],d)];return k(u,n,d)}),b("claim_for",{token:i,recipient:i},["token","recipient"],async(e,n)=>{let t=c(e.token),r=c(e.recipient),o=`Permissionlessly claim already-collected Clanker ${t} fees for ${r}; all receipts go to that fee owner, while ${n} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,t],o)],n,o)})]}};export{R as a};
@@ -1 +1 @@
1
- import{q as p}from"./TWSTOFN3.js";import{b as c,e as d}from"./73N3TOJL.js";import{a as n}from"./5YS5V2LK.js";import{b as a}from"./JXOEJPJ4.js";var f=/^(?:[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?\.)+[\p{L}]{2,}$/u,m=/^did:[a-z0-9]+:[A-Za-z0-9._%:;=@/?#-]{1,512}$/,u=/^[^\s@<>()[\]\\,;:"]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?\.[A-Za-z]{2,}$/,w=/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}:[-.%a-zA-Z0-9]{1,128}$/,l=["web","a2a","mcp","oasf"],P=["web","A2A","MCP","OASF","ENS","DID","email","agentWallet"];function s(e,r){if(typeof e!="string"||!e.trim()||e.length>2048||a(e))throw new n(`Provide a valid profile ${r}.`);return e}function h(e){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)}function z(e){if(!d(e))throw new n("Provide valid profile services.");let r=s(e.name,"service name"),t=s(e.endpoint,"service endpoint");e.version!==void 0&&s(e.version,"service version");let i=r.toLowerCase(),o=()=>{try{p(t,"Profile service endpoint")}catch{throw new n("Profile service endpoint must be an HTTPS or IPFS URI without credentials.")}};if(l.includes(i))return o();if(i==="ens"){if(!f.test(t))throw new n("An ENS service endpoint must be an ENS name such as agent.eth.");return}if(i==="did"){if(!m.test(t))throw new n("A DID service endpoint must be a DID such as did:web:agent.example.");return}if(i==="email"){if(!u.test(t))throw new n("An email service endpoint must be an email address.");return}if(i==="agentwallet"||i==="wallet"){if(!w.test(t)&&!c.test(t))throw new n("A wallet service endpoint must be a CAIP-10 account such as eip155:4663:0x\u2026 or an 0x address.");return}if(h(t)||/^(?:ipfs|https):/.test(t))return o();if(!(f.test(t)||m.test(t)||u.test(t)||w.test(t)))throw new n("Profile service endpoint must be an HTTPS or IPFS URI, an ENS name, a DID, an email address or a CAIP-10 account.")}export{P as a,z as b};
1
+ import{q as p}from"./WWHCEMNB.js";import{b as c,e as d}from"./5KUWLUPM.js";import{a as n}from"./XSD5NL7J.js";import{b as a}from"./JXOEJPJ4.js";var f=/^(?:[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?\.)+[\p{L}]{2,}$/u,m=/^did:[a-z0-9]+:[A-Za-z0-9._%:;=@/?#-]{1,512}$/,u=/^[^\s@<>()[\]\\,;:"]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?\.[A-Za-z]{2,}$/,w=/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}:[-.%a-zA-Z0-9]{1,128}$/,l=["web","a2a","mcp","oasf"],P=["web","A2A","MCP","OASF","ENS","DID","email","agentWallet"];function s(e,r){if(typeof e!="string"||!e.trim()||e.length>2048||a(e))throw new n(`Provide a valid profile ${r}.`);return e}function h(e){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)}function z(e){if(!d(e))throw new n("Provide valid profile services.");let r=s(e.name,"service name"),t=s(e.endpoint,"service endpoint");e.version!==void 0&&s(e.version,"service version");let i=r.toLowerCase(),o=()=>{try{p(t,"Profile service endpoint")}catch{throw new n("Profile service endpoint must be an HTTPS or IPFS URI without credentials.")}};if(l.includes(i))return o();if(i==="ens"){if(!f.test(t))throw new n("An ENS service endpoint must be an ENS name such as agent.eth.");return}if(i==="did"){if(!m.test(t))throw new n("A DID service endpoint must be a DID such as did:web:agent.example.");return}if(i==="email"){if(!u.test(t))throw new n("An email service endpoint must be an email address.");return}if(i==="agentwallet"||i==="wallet"){if(!w.test(t)&&!c.test(t))throw new n("A wallet service endpoint must be a CAIP-10 account such as eip155:4663:0x\u2026 or an 0x address.");return}if(h(t)||/^(?:ipfs|https):/.test(t))return o();if(!(f.test(t)||m.test(t)||u.test(t)||w.test(t)))throw new n("Profile service endpoint must be an HTTPS or IPFS URI, an ENS name, a DID, an email address or a CAIP-10 account.")}export{P as a,z as b};
@@ -1 +1 @@
1
- import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./TWSTOFN3.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./6IM6A5VA.js";import{a as U}from"./UWOFA6GV.js";import{c as _,e as K,g as p,h as G}from"./73N3TOJL.js";import{a as l}from"./5YS5V2LK.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};
1
+ import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./WWHCEMNB.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./PBQSJSZO.js";import{a as U}from"./5ZLOCQA4.js";import{c as _,e as K,g as p,h as G}from"./5KUWLUPM.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};
@@ -1 +1 @@
1
- import{g as u}from"./73N3TOJL.js";import{a as o,i as d}from"./G6HCV67X.js";import{a as s}from"./5YS5V2LK.js";import{encodeAbiParameters as g,keccak256 as b,parseAbi as f,zeroAddress as h}from"viem";var p=d[o].pons,w=f(["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))","function memeHook() view returns (address)"]),l=f(["function factory() view returns (address)","function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)"]),v=f(["function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]);async function A(t,r,n){if(t.chainId!==o||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new s("No supported Pons reference price on this chain or for these token decimals.");let e=await r.readContract({address:p.factory.address,abi:w,functionName:"getLaunchedToken",args:[t.address],blockNumber:n});if(!e.exists||!u(e.token,t.address)||e.pairToken.toLowerCase()!==h)throw new s("No supported native-ETH Pons launch reference price.");let m=10n**BigInt(t.decimals);if(e.phase===0){let[c,[a,i]]=await Promise.all([r.readContract({address:e.curve,abi:l,functionName:"factory",blockNumber:n}),r.readContract({address:e.curve,abi:l,functionName:"getReserves",blockNumber:n})]);if(!u(c,p.factory.address)||a<=0n||i<=0n)throw new s("The Pons curve reference price is unavailable.");return{numerator:a*m,denominator:i*10n**18n}}if(e.phase===2){let c=await r.readContract({address:p.factory.address,abi:w,functionName:"memeHook",blockNumber:n}),a=b(g([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[h,t.address,e.poolFee,e.tickSpacing,c])),[i,y]=await Promise.all([r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getSlot0",args:[a],blockNumber:n}),r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getLiquidity",args:[a],blockNumber:n})]);if(i[0]<=0n||y<=0n)throw new s("The graduated Pons pool reference price is unavailable.");return{numerator:(1n<<192n)*m,denominator:i[0]**2n*10n**18n}}throw new s("The Pons launch has no active reference price in this phase.")}export{A as a};
1
+ import{g as u}from"./5KUWLUPM.js";import{a as o,i as d}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as g,keccak256 as b,parseAbi as f,zeroAddress as h}from"viem";var p=d[o].pons,w=f(["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))","function memeHook() view returns (address)"]),l=f(["function factory() view returns (address)","function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)"]),v=f(["function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]);async function A(t,r,n){if(t.chainId!==o||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new s("No supported Pons reference price on this chain or for these token decimals.");let e=await r.readContract({address:p.factory.address,abi:w,functionName:"getLaunchedToken",args:[t.address],blockNumber:n});if(!e.exists||!u(e.token,t.address)||e.pairToken.toLowerCase()!==h)throw new s("No supported native-ETH Pons launch reference price.");let m=10n**BigInt(t.decimals);if(e.phase===0){let[c,[a,i]]=await Promise.all([r.readContract({address:e.curve,abi:l,functionName:"factory",blockNumber:n}),r.readContract({address:e.curve,abi:l,functionName:"getReserves",blockNumber:n})]);if(!u(c,p.factory.address)||a<=0n||i<=0n)throw new s("The Pons curve reference price is unavailable.");return{numerator:a*m,denominator:i*10n**18n}}if(e.phase===2){let c=await r.readContract({address:p.factory.address,abi:w,functionName:"memeHook",blockNumber:n}),a=b(g([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[h,t.address,e.poolFee,e.tickSpacing,c])),[i,y]=await Promise.all([r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getSlot0",args:[a],blockNumber:n}),r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getLiquidity",args:[a],blockNumber:n})]);if(i[0]<=0n||y<=0n)throw new s("The graduated Pons pool reference price is unavailable.");return{numerator:(1n<<192n)*m,denominator:i[0]**2n*10n**18n}}throw new s("The Pons launch has no active reference price in this phase.")}export{A as a};
@@ -0,0 +1 @@
1
+ var n=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u,r=/\b(?:unsafe|safe|safety|risks?|risky|recommend\w*|buy\w*)\b/i,i=/(?:[a-z][a-z0-9+.-]*:\/\/|(?:https?|ftp|file|mailto|javascript|data):|www\.|\/\/|\b[a-z0-9-]+(?:\.[a-z0-9-]+)+\b)/i,o="HEY Research Lab context unavailable",a="Project names this contract",c="Builder evidence, not a trading signal.",E="Not on HEY Research Lab yet";function e(t,s){return typeof t=="string"&&!!t.trim()&&t.length<=s&&!n.test(t)&&!/[<>[\]`]/.test(t)&&!r.test(t)&&!i.test(t)}function p(t,s){return!e(t,80)||!e(s,300)?o:`Builder status by HEY Research Lab: ${t}. ${s}`}export{a,c as b,E as c,e as d,p as e};
@@ -1 +1 @@
1
- import{a as D,b as H}from"./ELZNT5Q3.js";import{a as S}from"./LT5P6PZW.js";import{a as O}from"./CY75R4FK.js";import{a as C}from"./UWOFA6GV.js";import{c as _,f as I}from"./73N3TOJL.js";import{a as d}from"./G6HCV67X.js";import{a as r}from"./5YS5V2LK.js";import{encodeFunctionData as T,erc20Abi as L,getAddress as c,parseAbi as q,zeroAddress as M}from"viem";var k={timeShares:{factory:"timeFactory",abi:[{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ASSETS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"FOREVER",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_AMOUNT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DIVISOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"minLockAmount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"MIN_TIP_GROWTH",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ISSUE_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_CLAIM_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"currencyAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"address"}]},{name:"lockedTotal",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pendingLocks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"amount"},{type:"uint256",name:"tick"},{type:"uint256",name:"firstLock"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"heldAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},{name:"lockEpochs",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"uint256",name:"joinEpoch"},{type:"uint256",name:"leaveEpoch"}]},{name:"sweepable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"from"},{type:"uint256",name:"max"}],outputs:[{type:"uint256[]",name:"ids"},{type:"uint256",name:"next"}]},{name:"lockCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"lockAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"tuple",components:[{type:"address",name:"owner"},{type:"uint64",name:"lockedAt"},{type:"uint32",name:"firstDay"},{type:"uint128",name:"amount"},{type:"uint32",name:"lastDay"},{type:"uint64",name:"unlockedAt"}]}]},{name:"isIssued",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"}],outputs:[{type:"bool"}]},{name:"unitSupply",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"}],outputs:[{type:"uint256"}]},{name:"currentDay",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"k"}],outputs:[{type:"uint64",name:"timestamp"},{type:"uint256[]",name:"indexes"}]},{name:"index",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"carry",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"pulled",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"paid",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"held",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"dayIndex",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"holder"},{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lockClaimable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"uint32",name:"numberOfDays"}],outputs:[{type:"uint256",name:"lockId"}]},{name:"issue",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"},{type:"address",name:"to"}],outputs:[]},{name:"issueRange",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"firstDay"},{type:"uint256",name:"lastDay"},{type:"address",name:"to"}],outputs:[]},{name:"unlock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"address",name:"to"}],outputs:[]},{name:"syncAssets",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"catchUp",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"max"}],outputs:[{type:"bool",name:"done"}]},{name:"settle",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"roll",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"sweepDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"},{type:"uint256",name:"claimGas"}],outputs:[{type:"uint256[]",name:"amounts"}]},{name:"claim",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimMany",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"days_"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimLock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"receiver"},{type:"uint256",name:"id"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},dayWrapper:{factory:"wrapperFactory",abi:[{name:"shares",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"day",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"basket",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"previewRedeem",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"amount"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"deposit",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"redeemShort",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"owedTo",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimOwed",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[]},{name:"collect",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},compounder:{factory:"compoundFactory",abi:[{name:"MIN_SHARES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BANDS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BAND_TICKS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ADD_GAS_FLOOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_DRIFT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_PERIOD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_TOLERANCE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"DROP_SCAN",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DROP_CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"parked",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"dropId"}],outputs:[{type:"bool"}]},{name:"syncSides",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"count"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolManager",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolId",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{name:"poolKey",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"currency0"},{type:"address",name:"currency1"},{type:"uint24",name:"fee"},{type:"int24",name:"tickSpacing"},{type:"address",name:"hooks"}]}]},{name:"quote",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tokenIsCurrency0",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bool"}]},{name:"bandTicks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint128"}]},{name:"reserve",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"bands",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple[]",components:[{type:"int24",name:"tickLower"},{type:"int24",name:"tickUpper"},{type:"uint128",name:"liquidity"}]}]},{name:"anchor",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"int24",name:"high"},{type:"int24",name:"low"},{type:"uint40",name:"lookedAt"}]}]},{name:"creator",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"holdings",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"deposit",type:"function",stateMutability:"payable",inputs:[{type:"uint256",name:"tokensMax"},{type:"uint256",name:"quoteMax"},{type:"address",name:"to"},{type:"uint256",name:"minShares"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"shares"},{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeemUnlocked",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"poke",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"claimDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"}],outputs:[{type:"uint256",name:"tip"}]},{name:"listSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"asset"}],outputs:[{type:"uint256",name:"side"}]},{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_SIDES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"SIDE_READ_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DEAD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"sideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"fixedSideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"side"}],outputs:[{type:"tuple",components:[{type:"address",name:"currency"},{type:"uint256",name:"index"},{type:"uint256",name:"carry"},{type:"uint128",name:"recognized"},{type:"uint128",name:"paid"},{type:"uint128",name:"dropped"},{type:"uint40",name:"droppedAt"}]}]},{name:"sideOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"currency"}],outputs:[{type:"bool",name:"listed"},{type:"uint256",name:"side"}]},{name:"dropStream",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"earningSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideClaimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"side"}],outputs:[{type:"uint256"}]},{name:"claimSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"side"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]}};var $=q(["function approve(address spender,uint256 id,uint256 amount) returns (bool)"]),x=t=>I(t,"Provide the documented Hookr add-on parameters."),W=t=>["view","pure"].includes(t.stateMutability);function R(t){return Object.entries(k).flatMap(([e,i])=>i.abi.filter(n=>W(n)===t).map(n=>({role:e,fn:n})))}function N(t){return{type:"object",oneOf:R(t).map(({role:e,fn:i})=>({type:"object",properties:{addon:{const:e},token:_,...e==="dayWrapper"?{day:C()}:{},function:{const:i.name},params:D(i.inputs)},required:["addon","token",...e==="dayWrapper"?["day"]:[],"function","params"],additionalProperties:!1}))}}function E(t,e){let i=R(e).find(a=>a.role===t.addon&&a.fn.name===t.function);if(!i)throw new r("Choose a documented Hookr add-on function.");let n=["addon","token","function","params",...i.role==="dayWrapper"?["day"]:[]];if(Object.keys(t).length!==n.length||Object.keys(t).some(a=>!n.includes(a)))throw new r("Provide exactly the documented Hookr add-on arguments.");let s;try{s=c(String(t.token))}catch{throw new r("Provide a valid revenue token address.")}let p=0n;if(i.role==="dayWrapper"){if(typeof t.day!="string"||!/^(0|[1-9][0-9]*)$/.test(t.day)||t.day.length>78||BigInt(t.day)>=1n<<256n)throw new r("Provide a wrapper day as a decimal integer string.");p=BigInt(t.day)}return{...i,token:s,day:p,...H(i.fn,x(t.params))}}async function P(t,e,i,n){let s=t.clientFor(d),p=async(f,b,v=[])=>s.readContract({address:c(S[f].address),abi:S[f].abi,functionName:b,args:v}),a=x(await p("tokenizer","tokenizations",[i]));if(typeof a.createdAt!="bigint"||a.createdAt<=0n||c(String(a.creator))===M)throw new r("Current Hookr tokenizer has no matching token record; legacy add-ons need their generation-specific route.");let m=e==="compounder"?void 0:c(String(await p("timeFactory","sharesOf",[i]))),u=e==="timeShares"?m:e==="compounder"?c(String(await p("compoundFactory","vaultOf",[i]))):c(String(await p("wrapperFactory","wrapperOf",[m,n])));if(u===M||m===M)throw new r("Hookr add-on is not open yet. Open it with its pinned factory through hookr_action first.");let y=k[e].abi,l=await s.readContract({address:u,abi:y,functionName:e==="dayWrapper"?"shares":"token"});if(c(String(l))!==(e==="dayWrapper"?m:i))throw new r("Hookr add-on disagrees with its factory record.");if(e==="dayWrapper"&&await s.readContract({address:u,abi:y,functionName:"day"})!==n)throw new r("Hookr day wrapper disagrees with its factory day.");return{target:u,shares:m}}async function X(t,e,i){if(t.network==="testnet")throw new r("Hookr add-ons require mainnet, chain 4663.");let{role:n,token:s,day:p,fn:a,values:m,params:u}=E(e,!1),{target:y,shares:l}=await P(t,n,s,p),f=[],b=[],v=0n,h=t.clientFor(d),A=async(o,w)=>{if(w<0n||w>=1n<<128n)throw new r("Hookr add-on funding exceeds its bounded exact approval.");if(!w)return;if(o===M){v+=w,b.push({token:O,amount:w,to:y});return}let g=await h.readContract({address:o,abi:L,functionName:"allowance",args:[i,y]});g>0n&&g!==w&&f.push(t.approval(o,y,"0",d)),f.push(t.approval(o,y,w.toString(),d)),b.push({token:o,amount:w})};if(n==="timeShares"&&a.name==="lock"&&await A(s,u.amount),n==="dayWrapper"&&a.name==="deposit"){let o=u.amount;if(o<=0n||o>=1n<<128n)throw new r("Hookr wrapper deposit needs a positive bounded share amount.");f.push(t.unsignedTx({chainId:d,to:l,value:"0",data:T({abi:$,functionName:"approve",args:[y,p,o]}),description:`Approve exactly ${o} time shares of day ${p} to the factory-recorded wrapper ${y}.`})),b.push({token:l,id:p,amount:o,to:y})}if(n==="compounder"&&a.name==="deposit"){let o=c(String(await h.readContract({address:y,abi:k.compounder.abi,functionName:"quote"})));await A(s,u.tokensMax),await A(o,u.quoteMax)}if(["redeem","redeemShort","redeemUnlocked"].includes(a.name)&&b.push({token:y,amount:u.shares??u.amount,to:M}),a.name==="transfer"&&b.push({token:y,amount:u.amount,to:c(String(u.receiver??u.to)),...n==="timeShares"?{id:u.id}:{}}),u.deadline!==void 0){let o=await h.getBlock();if(typeof o.timestamp!="bigint"||u.deadline<o.timestamp)throw new r("Hookr add-on deadline expired or chain time is unavailable.")}return f.push(t.unsignedTx({chainId:d,to:y,value:v.toString(),data:T({abi:[a],functionName:a.name,args:m}),description:`Hookr ${n}.${a.name}: ${JSON.stringify(e.params)}. Token ${s}${n==="dayWrapper"?`; day ${p}`:""}. Review lock duration, recipients and minimum outputs.`})),{txs:f,inputs:b}}function Z(t){return[{name:"hookr_addon_read",inputSchema:{...N(!0),description:"Read factory-verified current Hookr revenue time shares, day wrappers or compounders: locks, day income, unwrap baskets, bands and side assets. Open factories via hookr_action."},execute:async e=>{let{role:i,token:n,day:s,fn:p,values:a}=E(e,!0),{target:m}=await P(t,i,n,s),u=await t.clientFor(d).readContract({address:m,abi:[p],functionName:p.name,args:a});return{chainId:d,token:n,contract:m,function:p.name,result:JSON.parse(JSON.stringify(u,(y,l)=>typeof l=="bigint"?l.toString():l))}}},{name:"hookr_addon_action",inputSchema:{...N(!1),description:"Preview current Hookr time-share lock/issue/unlock/roll/claims, day wrap/unwrap/owed claims, or compound deposit/redeem/poke/side claims. Exact approvals, factory provenance and local human confirmation required."},execute:async(e,i)=>{let{txs:n}=await X(t,e,i),s=await t.preview(n,i);return{txs:n,preview:s,summary:`Hookr ${e.addon}.${e.function}; verify the receipt and read the resulting lock or balances.`}}}]}export{X as a,Z as b};
1
+ import{a as D,b as H}from"./ET23SES4.js";import{a as S}from"./LT5P6PZW.js";import{a as O}from"./HTXKERNS.js";import{a as C}from"./5ZLOCQA4.js";import{c as _,f as I}from"./5KUWLUPM.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as T,erc20Abi as L,getAddress as c,parseAbi as q,zeroAddress as M}from"viem";var k={timeShares:{factory:"timeFactory",abi:[{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ASSETS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"FOREVER",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_AMOUNT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DIVISOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"minLockAmount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"MIN_TIP_GROWTH",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ISSUE_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_CLAIM_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"currencyAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"address"}]},{name:"lockedTotal",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pendingLocks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"amount"},{type:"uint256",name:"tick"},{type:"uint256",name:"firstLock"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"heldAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},{name:"lockEpochs",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"uint256",name:"joinEpoch"},{type:"uint256",name:"leaveEpoch"}]},{name:"sweepable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"from"},{type:"uint256",name:"max"}],outputs:[{type:"uint256[]",name:"ids"},{type:"uint256",name:"next"}]},{name:"lockCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"lockAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"tuple",components:[{type:"address",name:"owner"},{type:"uint64",name:"lockedAt"},{type:"uint32",name:"firstDay"},{type:"uint128",name:"amount"},{type:"uint32",name:"lastDay"},{type:"uint64",name:"unlockedAt"}]}]},{name:"isIssued",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"}],outputs:[{type:"bool"}]},{name:"unitSupply",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"}],outputs:[{type:"uint256"}]},{name:"currentDay",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"k"}],outputs:[{type:"uint64",name:"timestamp"},{type:"uint256[]",name:"indexes"}]},{name:"index",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"carry",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"pulled",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"paid",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"held",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"dayIndex",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"holder"},{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lockClaimable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"uint32",name:"numberOfDays"}],outputs:[{type:"uint256",name:"lockId"}]},{name:"issue",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"},{type:"address",name:"to"}],outputs:[]},{name:"issueRange",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"firstDay"},{type:"uint256",name:"lastDay"},{type:"address",name:"to"}],outputs:[]},{name:"unlock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"address",name:"to"}],outputs:[]},{name:"syncAssets",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"catchUp",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"max"}],outputs:[{type:"bool",name:"done"}]},{name:"settle",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"roll",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"sweepDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"},{type:"uint256",name:"claimGas"}],outputs:[{type:"uint256[]",name:"amounts"}]},{name:"claim",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimMany",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"days_"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimLock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"receiver"},{type:"uint256",name:"id"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},dayWrapper:{factory:"wrapperFactory",abi:[{name:"shares",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"day",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"basket",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"previewRedeem",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"amount"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"deposit",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"redeemShort",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"owedTo",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimOwed",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[]},{name:"collect",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},compounder:{factory:"compoundFactory",abi:[{name:"MIN_SHARES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BANDS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BAND_TICKS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ADD_GAS_FLOOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_DRIFT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_PERIOD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_TOLERANCE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"DROP_SCAN",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DROP_CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"parked",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"dropId"}],outputs:[{type:"bool"}]},{name:"syncSides",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"count"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolManager",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolId",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{name:"poolKey",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"currency0"},{type:"address",name:"currency1"},{type:"uint24",name:"fee"},{type:"int24",name:"tickSpacing"},{type:"address",name:"hooks"}]}]},{name:"quote",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tokenIsCurrency0",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bool"}]},{name:"bandTicks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint128"}]},{name:"reserve",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"bands",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple[]",components:[{type:"int24",name:"tickLower"},{type:"int24",name:"tickUpper"},{type:"uint128",name:"liquidity"}]}]},{name:"anchor",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"int24",name:"high"},{type:"int24",name:"low"},{type:"uint40",name:"lookedAt"}]}]},{name:"creator",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"holdings",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"deposit",type:"function",stateMutability:"payable",inputs:[{type:"uint256",name:"tokensMax"},{type:"uint256",name:"quoteMax"},{type:"address",name:"to"},{type:"uint256",name:"minShares"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"shares"},{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeemUnlocked",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"poke",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"claimDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"}],outputs:[{type:"uint256",name:"tip"}]},{name:"listSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"asset"}],outputs:[{type:"uint256",name:"side"}]},{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_SIDES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"SIDE_READ_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DEAD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"sideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"fixedSideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"side"}],outputs:[{type:"tuple",components:[{type:"address",name:"currency"},{type:"uint256",name:"index"},{type:"uint256",name:"carry"},{type:"uint128",name:"recognized"},{type:"uint128",name:"paid"},{type:"uint128",name:"dropped"},{type:"uint40",name:"droppedAt"}]}]},{name:"sideOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"currency"}],outputs:[{type:"bool",name:"listed"},{type:"uint256",name:"side"}]},{name:"dropStream",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"earningSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideClaimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"side"}],outputs:[{type:"uint256"}]},{name:"claimSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"side"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]}};var $=q(["function approve(address spender,uint256 id,uint256 amount) returns (bool)"]),x=t=>I(t,"Provide the documented Hookr add-on parameters."),W=t=>["view","pure"].includes(t.stateMutability);function R(t){return Object.entries(k).flatMap(([e,i])=>i.abi.filter(n=>W(n)===t).map(n=>({role:e,fn:n})))}function N(t){return{type:"object",oneOf:R(t).map(({role:e,fn:i})=>({type:"object",properties:{addon:{const:e},token:_,...e==="dayWrapper"?{day:C()}:{},function:{const:i.name},params:D(i.inputs)},required:["addon","token",...e==="dayWrapper"?["day"]:[],"function","params"],additionalProperties:!1}))}}function E(t,e){let i=R(e).find(a=>a.role===t.addon&&a.fn.name===t.function);if(!i)throw new r("Choose a documented Hookr add-on function.");let n=["addon","token","function","params",...i.role==="dayWrapper"?["day"]:[]];if(Object.keys(t).length!==n.length||Object.keys(t).some(a=>!n.includes(a)))throw new r("Provide exactly the documented Hookr add-on arguments.");let s;try{s=c(String(t.token))}catch{throw new r("Provide a valid revenue token address.")}let p=0n;if(i.role==="dayWrapper"){if(typeof t.day!="string"||!/^(0|[1-9][0-9]*)$/.test(t.day)||t.day.length>78||BigInt(t.day)>=1n<<256n)throw new r("Provide a wrapper day as a decimal integer string.");p=BigInt(t.day)}return{...i,token:s,day:p,...H(i.fn,x(t.params))}}async function P(t,e,i,n){let s=t.clientFor(d),p=async(f,b,v=[])=>s.readContract({address:c(S[f].address),abi:S[f].abi,functionName:b,args:v}),a=x(await p("tokenizer","tokenizations",[i]));if(typeof a.createdAt!="bigint"||a.createdAt<=0n||c(String(a.creator))===M)throw new r("Current Hookr tokenizer has no matching token record; legacy add-ons need their generation-specific route.");let m=e==="compounder"?void 0:c(String(await p("timeFactory","sharesOf",[i]))),u=e==="timeShares"?m:e==="compounder"?c(String(await p("compoundFactory","vaultOf",[i]))):c(String(await p("wrapperFactory","wrapperOf",[m,n])));if(u===M||m===M)throw new r("Hookr add-on is not open yet. Open it with its pinned factory through hookr_action first.");let y=k[e].abi,l=await s.readContract({address:u,abi:y,functionName:e==="dayWrapper"?"shares":"token"});if(c(String(l))!==(e==="dayWrapper"?m:i))throw new r("Hookr add-on disagrees with its factory record.");if(e==="dayWrapper"&&await s.readContract({address:u,abi:y,functionName:"day"})!==n)throw new r("Hookr day wrapper disagrees with its factory day.");return{target:u,shares:m}}async function X(t,e,i){if(t.network==="testnet")throw new r("Hookr add-ons require mainnet, chain 4663.");let{role:n,token:s,day:p,fn:a,values:m,params:u}=E(e,!1),{target:y,shares:l}=await P(t,n,s,p),f=[],b=[],v=0n,h=t.clientFor(d),A=async(o,w)=>{if(w<0n||w>=1n<<128n)throw new r("Hookr add-on funding exceeds its bounded exact approval.");if(!w)return;if(o===M){v+=w,b.push({token:O,amount:w,to:y});return}let g=await h.readContract({address:o,abi:L,functionName:"allowance",args:[i,y]});g>0n&&g!==w&&f.push(t.approval(o,y,"0",d)),f.push(t.approval(o,y,w.toString(),d)),b.push({token:o,amount:w})};if(n==="timeShares"&&a.name==="lock"&&await A(s,u.amount),n==="dayWrapper"&&a.name==="deposit"){let o=u.amount;if(o<=0n||o>=1n<<128n)throw new r("Hookr wrapper deposit needs a positive bounded share amount.");f.push(t.unsignedTx({chainId:d,to:l,value:"0",data:T({abi:$,functionName:"approve",args:[y,p,o]}),description:`Approve exactly ${o} time shares of day ${p} to the factory-recorded wrapper ${y}.`})),b.push({token:l,id:p,amount:o,to:y})}if(n==="compounder"&&a.name==="deposit"){let o=c(String(await h.readContract({address:y,abi:k.compounder.abi,functionName:"quote"})));await A(s,u.tokensMax),await A(o,u.quoteMax)}if(["redeem","redeemShort","redeemUnlocked"].includes(a.name)&&b.push({token:y,amount:u.shares??u.amount,to:M}),a.name==="transfer"&&b.push({token:y,amount:u.amount,to:c(String(u.receiver??u.to)),...n==="timeShares"?{id:u.id}:{}}),u.deadline!==void 0){let o=await h.getBlock();if(typeof o.timestamp!="bigint"||u.deadline<o.timestamp)throw new r("Hookr add-on deadline expired or chain time is unavailable.")}return f.push(t.unsignedTx({chainId:d,to:y,value:v.toString(),data:T({abi:[a],functionName:a.name,args:m}),description:`Hookr ${n}.${a.name}: ${JSON.stringify(e.params)}. Token ${s}${n==="dayWrapper"?`; day ${p}`:""}. Review lock duration, recipients and minimum outputs.`})),{txs:f,inputs:b}}function Z(t){return[{name:"hookr_addon_read",inputSchema:{...N(!0),description:"Read factory-verified current Hookr revenue time shares, day wrappers or compounders: locks, day income, unwrap baskets, bands and side assets. Open factories via hookr_action."},execute:async e=>{let{role:i,token:n,day:s,fn:p,values:a}=E(e,!0),{target:m}=await P(t,i,n,s),u=await t.clientFor(d).readContract({address:m,abi:[p],functionName:p.name,args:a});return{chainId:d,token:n,contract:m,function:p.name,result:JSON.parse(JSON.stringify(u,(y,l)=>typeof l=="bigint"?l.toString():l))}}},{name:"hookr_addon_action",inputSchema:{...N(!1),description:"Preview current Hookr time-share lock/issue/unlock/roll/claims, day wrap/unwrap/owed claims, or compound deposit/redeem/poke/side claims. Exact approvals, factory provenance and local human confirmation required."},execute:async(e,i)=>{let{txs:n}=await X(t,e,i),s=await t.preview(n,i);return{txs:n,preview:s,summary:`Hookr ${e.addon}.${e.function}; verify the receipt and read the resulting lock or balances.`}}}]}export{X as a,Z as b};
@@ -1 +1 @@
1
- import{b as R}from"./TCPPYBGQ.js";import{a as w}from"./6IM6A5VA.js";import{g as S}from"./73N3TOJL.js";import{a as o,i as k,j as v}from"./G6HCV67X.js";import{a as t}from"./5YS5V2LK.js";import{encodeFunctionData as x,getAddress as h,keccak256 as A,parseAbi as O,parseAbiItem as T,toHex as C,zeroHash as E}from"viem";var i=h(k[o].vaults.spark.address),g={admin:E,setter:A(C("SETTER_ROLE")),taker:A(C("TAKER_ROLE"))},D=[["drip()","any"],["setVsr(uint256 rate)","setter"],["setVsrBounds(uint256 minimum,uint256 maximum)","admin"],["setDepositCap(uint256 cap)","admin"],["take(uint256 assets)","taker"],["grantRole(bytes32 role,address account)","admin"],["revokeRole(bytes32 role,address account)","admin"],["renounceRole(bytes32 role,address account)","any"],["upgradeToAndCall(address implementation,bytes data)","admin"]],N=D.map(([r,a])=>({abi:T(`function ${r}`),authority:a})),p=O(["function asset() view returns (address)","function hasRole(bytes32,address) view returns (bool)","function getRoleMemberCount(bytes32) view returns (uint256)","function getRoleMember(bytes32,uint256) view returns (address)"]);function _(r){return[{name:"spark_roles",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(a,s)=>{try{if(w(s),Object.keys(a).length)throw new t("Spark roles takes no arguments.");let e=r.clientFor(o);if(await e.getChainId()!==o)throw new t("Spark requires chain 4663.");let u=await e.getBlockNumber({cacheTime:0}),c=await Promise.all(Object.entries(g).map(async([f,d])=>{let l=await e.readContract({address:i,abi:p,functionName:"getRoleMemberCount",args:[d],blockNumber:u});if(l>256n)throw new t("Spark role membership exceeds this reader\u2019s supported size.");let[b,n]=await Promise.all([e.readContract({address:i,abi:p,functionName:"hasRole",args:[d,s],blockNumber:u}),Promise.all(Array.from({length:Number(l)},(y,m)=>e.readContract({address:i,abi:p,functionName:"getRoleMember",args:[d,BigInt(m)],blockNumber:u})))]);return{name:f,role:d,heldByWallet:b,members:n.map(y=>h(y))}}));return{vault:i,chainId:o,blockNumber:u.toString(),roles:c}}catch(e){throw new t(r.plainError(e))}}},{name:"spark_manage",inputSchema:{type:"object",additionalProperties:!1,required:["operation","values"],properties:{operation:{type:"string",enum:N.map(a=>a.abi.name)},values:{type:"array",maxItems:2,items:{type:"string"},description:"Ordered contract inputs; all integers are decimal base-unit strings."}}},execute:async(a,s)=>{try{if(w(s),Object.keys(a).some(n=>!["operation","values"].includes(n)))throw new t("Unexpected Spark management argument.");let e=N.find(n=>n.abi.name===a.operation);if(!e||!Array.isArray(a.values)||a.values.length!==e.abi.inputs.length)throw new t("Provide a supported Spark operation and its exact ordered values.");let u=e.abi.inputs.map((n,y)=>{let m=a.values[y];if(n.type==="bytes32"){if(typeof m!="string"||!Object.values(g).includes(m))throw new t("Provide a documented Spark role identifier.");return m}return R(n.type,m)});if(e.abi.name==="renounceRole"&&!S(String(u[1]),s))throw new t("Role renunciation must name this wallet.");let c=r.clientFor(o);if(await c.getChainId()!==o)throw new t("Spark requires chain 4663.");let f=await c.readContract({address:i,abi:p,functionName:"asset"});if(h(f)!==h(v))throw new t("Spark does not use canonical USDG.");if(e.authority!=="any"&&await c.readContract({address:i,abi:p,functionName:"hasRole",args:[g[e.authority],s]})!==!0)throw new t("This wallet does not hold the required Spark role. No transaction was built.");let d=`${e.abi.name} on Spark ${i}; ordered values ${JSON.stringify(a.values)}. ${e.abi.name==="upgradeToAndCall"?"Replaces vault implementation; Oak must review and re-pin upgraded code before subsequent use.":e.abi.name==="take"?"Pulls vault liquidity to this role-authorized wallet; it mints no savings shares.":""}`,l=[r.unsignedTx({to:i,data:x({abi:[e.abi],functionName:e.abi.name,args:u}),value:"0",chainId:o,description:d})],b=await r.preview(l,s);return{txs:l,preview:b,summary:`${d} ${b.summary} Role and rate bounds are enforced again by the contract at execution.`}}catch(e){throw new t(r.plainError(e))}}}]}export{N as a,_ as b};
1
+ import{b as R}from"./W2OJ57ZO.js";import{a as w}from"./PBQSJSZO.js";import{g as S}from"./5KUWLUPM.js";import{a as o,i as k,j as v}from"./FWD4L3CJ.js";import{a as t}from"./XSD5NL7J.js";import{encodeFunctionData as x,getAddress as h,keccak256 as A,parseAbi as O,parseAbiItem as T,toHex as C,zeroHash as E}from"viem";var i=h(k[o].vaults.spark.address),g={admin:E,setter:A(C("SETTER_ROLE")),taker:A(C("TAKER_ROLE"))},D=[["drip()","any"],["setVsr(uint256 rate)","setter"],["setVsrBounds(uint256 minimum,uint256 maximum)","admin"],["setDepositCap(uint256 cap)","admin"],["take(uint256 assets)","taker"],["grantRole(bytes32 role,address account)","admin"],["revokeRole(bytes32 role,address account)","admin"],["renounceRole(bytes32 role,address account)","any"],["upgradeToAndCall(address implementation,bytes data)","admin"]],N=D.map(([r,a])=>({abi:T(`function ${r}`),authority:a})),p=O(["function asset() view returns (address)","function hasRole(bytes32,address) view returns (bool)","function getRoleMemberCount(bytes32) view returns (uint256)","function getRoleMember(bytes32,uint256) view returns (address)"]);function _(r){return[{name:"spark_roles",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(a,s)=>{try{if(w(s),Object.keys(a).length)throw new t("Spark roles takes no arguments.");let e=r.clientFor(o);if(await e.getChainId()!==o)throw new t("Spark requires chain 4663.");let u=await e.getBlockNumber({cacheTime:0}),c=await Promise.all(Object.entries(g).map(async([f,d])=>{let l=await e.readContract({address:i,abi:p,functionName:"getRoleMemberCount",args:[d],blockNumber:u});if(l>256n)throw new t("Spark role membership exceeds this reader\u2019s supported size.");let[b,n]=await Promise.all([e.readContract({address:i,abi:p,functionName:"hasRole",args:[d,s],blockNumber:u}),Promise.all(Array.from({length:Number(l)},(y,m)=>e.readContract({address:i,abi:p,functionName:"getRoleMember",args:[d,BigInt(m)],blockNumber:u})))]);return{name:f,role:d,heldByWallet:b,members:n.map(y=>h(y))}}));return{vault:i,chainId:o,blockNumber:u.toString(),roles:c}}catch(e){throw new t(r.plainError(e))}}},{name:"spark_manage",inputSchema:{type:"object",additionalProperties:!1,required:["operation","values"],properties:{operation:{type:"string",enum:N.map(a=>a.abi.name)},values:{type:"array",maxItems:2,items:{type:"string"},description:"Ordered contract inputs; all integers are decimal base-unit strings."}}},execute:async(a,s)=>{try{if(w(s),Object.keys(a).some(n=>!["operation","values"].includes(n)))throw new t("Unexpected Spark management argument.");let e=N.find(n=>n.abi.name===a.operation);if(!e||!Array.isArray(a.values)||a.values.length!==e.abi.inputs.length)throw new t("Provide a supported Spark operation and its exact ordered values.");let u=e.abi.inputs.map((n,y)=>{let m=a.values[y];if(n.type==="bytes32"){if(typeof m!="string"||!Object.values(g).includes(m))throw new t("Provide a documented Spark role identifier.");return m}return R(n.type,m)});if(e.abi.name==="renounceRole"&&!S(String(u[1]),s))throw new t("Role renunciation must name this wallet.");let c=r.clientFor(o);if(await c.getChainId()!==o)throw new t("Spark requires chain 4663.");let f=await c.readContract({address:i,abi:p,functionName:"asset"});if(h(f)!==h(v))throw new t("Spark does not use canonical USDG.");if(e.authority!=="any"&&await c.readContract({address:i,abi:p,functionName:"hasRole",args:[g[e.authority],s]})!==!0)throw new t("This wallet does not hold the required Spark role. No transaction was built.");let d=`${e.abi.name} on Spark ${i}; ordered values ${JSON.stringify(a.values)}. ${e.abi.name==="upgradeToAndCall"?"Replaces vault implementation; Oak must review and re-pin upgraded code before subsequent use.":e.abi.name==="take"?"Pulls vault liquidity to this role-authorized wallet; it mints no savings shares.":""}`,l=[r.unsignedTx({to:i,data:x({abi:[e.abi],functionName:e.abi.name,args:u}),value:"0",chainId:o,description:d})],b=await r.preview(l,s);return{txs:l,preview:b,summary:`${d} ${b.summary} Role and rate bounds are enforced again by the contract at execution.`}}catch(e){throw new t(r.plainError(e))}}}]}export{N as a,_ as b};
@@ -1 +1 @@
1
- import{a as e,i as r}from"./G6HCV67X.js";var t='Use query (token name, symbol or address) or category to narrow tickerspring_tokens. Unfiltered requests and sort:"volume" alone can return an incomplete or inconsistent provider response; retry with a query or category filter.';function i(){return{summary:"Minimums: limit orders 10 USDG; independent ladder levels 10 USDG each; grids 11 USDG; ladder planner 55 USDG. Vaults use current minDepositUnits from tickerspring_vaults (not a fixed 25 USDG). Basket creation first deposit 25 USDG; check current basket quote for trade minimums.",minimums:{denomination:{address:r[e].tokens.USDG.address,symbol:"USDG",decimals:6,chainId:e},limitOrderNotional:"10000000",independentLadderLevelNotional:"10000000",gridBudget:"11000000",ladderPlannerBudget:"55000000",vaultDeposit:{source:"tickerspring_vaults",field:"minDepositUnits",policy:"Per-vault current minimum; do not assume the 25 USDG example is a minimum."},basketCreationFirstDepositNotional:"25000000",basketTrade:{source:"tickerspring_baskets and current prepare quote",policy:"Check current provider minimum for the selected basket and payment token."}},tokenFilterGuidance:t}}export{t as a,i as b};
1
+ import{a as e,i as r}from"./FWD4L3CJ.js";var t='Use query (token name, symbol or address) or category to narrow tickerspring_tokens. Unfiltered requests and sort:"volume" alone can return an incomplete or inconsistent provider response; retry with a query or category filter.';function i(){return{summary:"Minimums: limit orders 10 USDG; independent ladder levels 10 USDG each; grids 11 USDG; ladder planner 55 USDG. Vaults use current minDepositUnits from tickerspring_vaults (not a fixed 25 USDG). Basket creation first deposit 25 USDG; check current basket quote for trade minimums.",minimums:{denomination:{address:r[e].tokens.USDG.address,symbol:"USDG",decimals:6,chainId:e},limitOrderNotional:"10000000",independentLadderLevelNotional:"10000000",gridBudget:"11000000",ladderPlannerBudget:"55000000",vaultDeposit:{source:"tickerspring_vaults",field:"minDepositUnits",policy:"Per-vault current minimum; do not assume the 25 USDG example is a minimum."},basketCreationFirstDepositNotional:"25000000",basketTrade:{source:"tickerspring_baskets and current prepare quote",policy:"Check current provider minimum for the selected basket and payment token."}},tokenFilterGuidance:t}}export{t as a,i as b};
@@ -1 +1 @@
1
- import{d as R}from"./J2XAEVKC.js";import{a as L,f as N,g as b}from"./3NDVXEBR.js";import{H,J as j,K as O,b as p,d as l,y as D}from"./Q356HHCL.js";import{g as d}from"./73N3TOJL.js";import{a as y}from"./G6HCV67X.js";import{a as e}from"./5YS5V2LK.js";import{decodeAbiParameters as J,decodeFunctionData as A,encodeAbiParameters as K,encodeFunctionData as Q,erc20Abi as W,getAddress as Y,parseAbi as Z,parseAbiParameters as ee}from"viem";var U=Z(["function modifyLiquidities(bytes unlockData,uint256 deadline) payable"]),V=ee("bytes actions,bytes[] params");function de(f,$){return{tools:[{name:"uniswap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["operations"],properties:{operations:{type:"array",minItems:1,maxItems:20,items:{type:"object",additionalProperties:!1,required:["name","arguments"],properties:{name:{type:"string",enum:["uniswap_add","uniswap_collect","uniswap_remove"]},arguments:{anyOf:[H,j,O]}}}}}},async execute(a,v){if(b(a,["operations"]),!Array.isArray(a.operations)||a.operations.length<1||a.operations.length>20)throw new e("Provide 1 to 20 v4 liquidity operations.");let s="0x",c,h=[],P=0n,g=new Map,_=new Set,E=new Set;for(let t of a.operations){if(!t||typeof t!="object"||Array.isArray(t))throw new e("Each operation needs name and arguments.");let o=t;if(b(o,["name","arguments"]),!["uniswap_add","uniswap_collect","uniswap_remove"].includes(String(o.name))||!o.arguments||typeof o.arguments!="object"||Array.isArray(o.arguments))throw new e("Batch supports v4 add, collect and remove operations only.");let r=o.arguments;if(r.version!=="v4")throw new e("Every batch operation must explicitly select version v4.");if(r.initialPrice!==void 0||r.sqrtPriceX96!==void 0)throw new e("Create a pool before batching its liquidity operations.");if(r.tokenId!==void 0){let n=L(r.tokenId,"tokenId").toString();if(E.has(n))throw new e("Batch tokenIds must be distinct decimal strings.");E.add(n)}else if(o.name!=="uniswap_add")throw new e("Existing-position operations require tokenId.");let I=await $.tools.find(n=>n.name===o.name).execute(r,v),u=I.txs.at(-1);if(!u||!d(u.to,p))throw new e("Batch operation returned an unexpected destination.");P+=BigInt(u.value);for(let n of I.txs.slice(0,-1)){if(BigInt(n.value)!==0n)throw new e("Batch prerequisite cannot send native currency.");if(d(n.to,l)){let i=A({abi:R,data:n.data}),[B,G,X,z]=i.args;if(!d(G,p))throw new e("Batch Permit2 spender must be PositionManager.");let T=B.toLowerCase(),m=g.get(T),q=BigInt(z),C=(m?.amount??0n)+X;if(C>=1n<<160n)throw new e("Batch approval exceeds uint160.");g.set(T,{token:B,amount:C,expiration:m&&m.expiration<q?m.expiration:q})}else{let i=A({abi:W,data:n.data});if(i.functionName!=="approve"||!d(i.args[0],l))throw new e("Unexpected batch prerequisite.")}}let S=A({abi:U,data:u.data}),[F,x]=J(V,S.args[0]),k=F.slice(2).match(/../g)??[];if(k.length!==x.length)throw new e("Batch action/parameter count differs.");k.forEach((n,i)=>{n==="14"?_.add(x[i]):(s=`${s}${n}`,h.push(x[i]))});let M=S.args[1];c=c===void 0||M<c?M:c}for(let t of _)s=`${s}14`,h.push(t);let w=[];for(let t of g.values())w.push(f.approval(Y(t.token),l,t.amount.toString(),y),D(t.token,p,t.amount.toString(),t.expiration.toString()));return w.push(f.unsignedTx({to:p,data:Q({abi:U,functionName:"modifyLiquidities",args:[K(V,[s,h]),c]}),value:P.toString(),chainId:y,description:`Atomically modify ${a.operations.length} v4 positions; recipients are the signing wallet.`})),N(f,w,v,"Atomic v4 batch: every operation must succeed. Each position retains its own minimums; preview covers the complete action stream.")}}]}}export{U as a,V as b,de as c};
1
+ import{d as R}from"./GVPX5XCL.js";import{a as L,f as N,g as b}from"./SGEZIYJW.js";import{H,J as j,K as O,b as p,d as l,y as D}from"./WPAF55SP.js";import{g as d}from"./5KUWLUPM.js";import{a as y}from"./FWD4L3CJ.js";import{a as e}from"./XSD5NL7J.js";import{decodeAbiParameters as J,decodeFunctionData as A,encodeAbiParameters as K,encodeFunctionData as Q,erc20Abi as W,getAddress as Y,parseAbi as Z,parseAbiParameters as ee}from"viem";var U=Z(["function modifyLiquidities(bytes unlockData,uint256 deadline) payable"]),V=ee("bytes actions,bytes[] params");function de(f,$){return{tools:[{name:"uniswap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["operations"],properties:{operations:{type:"array",minItems:1,maxItems:20,items:{type:"object",additionalProperties:!1,required:["name","arguments"],properties:{name:{type:"string",enum:["uniswap_add","uniswap_collect","uniswap_remove"]},arguments:{anyOf:[H,j,O]}}}}}},async execute(a,v){if(b(a,["operations"]),!Array.isArray(a.operations)||a.operations.length<1||a.operations.length>20)throw new e("Provide 1 to 20 v4 liquidity operations.");let s="0x",c,h=[],P=0n,g=new Map,_=new Set,E=new Set;for(let t of a.operations){if(!t||typeof t!="object"||Array.isArray(t))throw new e("Each operation needs name and arguments.");let o=t;if(b(o,["name","arguments"]),!["uniswap_add","uniswap_collect","uniswap_remove"].includes(String(o.name))||!o.arguments||typeof o.arguments!="object"||Array.isArray(o.arguments))throw new e("Batch supports v4 add, collect and remove operations only.");let r=o.arguments;if(r.version!=="v4")throw new e("Every batch operation must explicitly select version v4.");if(r.initialPrice!==void 0||r.sqrtPriceX96!==void 0)throw new e("Create a pool before batching its liquidity operations.");if(r.tokenId!==void 0){let n=L(r.tokenId,"tokenId").toString();if(E.has(n))throw new e("Batch tokenIds must be distinct decimal strings.");E.add(n)}else if(o.name!=="uniswap_add")throw new e("Existing-position operations require tokenId.");let I=await $.tools.find(n=>n.name===o.name).execute(r,v),u=I.txs.at(-1);if(!u||!d(u.to,p))throw new e("Batch operation returned an unexpected destination.");P+=BigInt(u.value);for(let n of I.txs.slice(0,-1)){if(BigInt(n.value)!==0n)throw new e("Batch prerequisite cannot send native currency.");if(d(n.to,l)){let i=A({abi:R,data:n.data}),[B,G,X,z]=i.args;if(!d(G,p))throw new e("Batch Permit2 spender must be PositionManager.");let T=B.toLowerCase(),m=g.get(T),q=BigInt(z),C=(m?.amount??0n)+X;if(C>=1n<<160n)throw new e("Batch approval exceeds uint160.");g.set(T,{token:B,amount:C,expiration:m&&m.expiration<q?m.expiration:q})}else{let i=A({abi:W,data:n.data});if(i.functionName!=="approve"||!d(i.args[0],l))throw new e("Unexpected batch prerequisite.")}}let S=A({abi:U,data:u.data}),[F,x]=J(V,S.args[0]),k=F.slice(2).match(/../g)??[];if(k.length!==x.length)throw new e("Batch action/parameter count differs.");k.forEach((n,i)=>{n==="14"?_.add(x[i]):(s=`${s}${n}`,h.push(x[i]))});let M=S.args[1];c=c===void 0||M<c?M:c}for(let t of _)s=`${s}14`,h.push(t);let w=[];for(let t of g.values())w.push(f.approval(Y(t.token),l,t.amount.toString(),y),D(t.token,p,t.amount.toString(),t.expiration.toString()));return w.push(f.unsignedTx({to:p,data:Q({abi:U,functionName:"modifyLiquidities",args:[K(V,[s,h]),c]}),value:P.toString(),chainId:y,description:`Atomically modify ${a.operations.length} v4 positions; recipients are the signing wallet.`})),N(f,w,v,"Atomic v4 batch: every operation must succeed. Each position retains its own minimums; preview covers the complete action stream.")}}]}}export{U as a,V as b,de as c};
@@ -1 +1 @@
1
- import{a as C,b as O}from"./BX7XQANB.js";import{a as f,b as k}from"./NU4K3TEZ.js";import{d as a}from"./XV6F3RET.js";import{a as g,c as w}from"./SPRVVJXI.js";import{a as d}from"./G6HCV67X.js";import{a as i}from"./5YS5V2LK.js";var j=n=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(a)},method:{type:"string"},values:{type:"array",maxItems:16}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(a,t.program))throw new i("Choose turbo, blackjack or feed.");let o=a[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new i("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let r=u.find(e=>f(e)===t.method),m=t.values??[];if(!r||!Array.isArray(m)||m.length!==r.inputs.length)throw new i("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let p=n.clientFor(d);if(await p.getChainId()!==d)throw new i("NetNet cards require chain 4663.");let l=await p.getBlock(),c=r.inputs.map((e,s)=>k(e,m[s])),N=await p.readContract({address:o.address,abi:[r],functionName:r.name,args:c,blockNumber:l.number}),y=t.program==="turbo"&&r.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(r.name)?[c[0]]:r.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(y.length){let e=await p.readContract({address:a.turbo.address,abi:a.turbo.abi,functionName:"seriesCount",blockNumber:l.number});b=[...new Set(y)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:a.turbo.address,contract:o.address,blockNumber:String(l.number),blockHash:l.hash,method:t.method,outputs:r.outputs,...b?{seriesStatus:b}:{},data:h(N)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new i("Card capabilities takes no arguments.");return{chainId:d,collection:a.turbo.address,blackjack:a.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...g],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(n,t=0){if(t>12)throw new i("Card read result exceeds the supported nesting.");if(typeof n=="bigint")return n.toString();if(typeof n=="string"){if(n.length>8194)throw new i("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(n)?n:`untrusted ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.length>4096)throw new i("Choose a bounded card read.");return n.map(o=>h(o,t+1))}return n&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([o,u])=>[o,h(u,t+1)])):n}export{j as a};
1
+ import{a as C,b as O}from"./ALPYEM7B.js";import{a as g,c as w}from"./SPRVVJXI.js";import{a as f,b as k}from"./XSRIJUFU.js";import{d as a}from"./XV6F3RET.js";import{a as d}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";var j=n=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(a)},method:{type:"string"},values:{type:"array",maxItems:16}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(a,t.program))throw new i("Choose turbo, blackjack or feed.");let o=a[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new i("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let r=u.find(e=>f(e)===t.method),m=t.values??[];if(!r||!Array.isArray(m)||m.length!==r.inputs.length)throw new i("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let p=n.clientFor(d);if(await p.getChainId()!==d)throw new i("NetNet cards require chain 4663.");let l=await p.getBlock(),c=r.inputs.map((e,s)=>k(e,m[s])),N=await p.readContract({address:o.address,abi:[r],functionName:r.name,args:c,blockNumber:l.number}),y=t.program==="turbo"&&r.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(r.name)?[c[0]]:r.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(y.length){let e=await p.readContract({address:a.turbo.address,abi:a.turbo.abi,functionName:"seriesCount",blockNumber:l.number});b=[...new Set(y)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:a.turbo.address,contract:o.address,blockNumber:String(l.number),blockHash:l.hash,method:t.method,outputs:r.outputs,...b?{seriesStatus:b}:{},data:h(N)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new i("Card capabilities takes no arguments.");return{chainId:d,collection:a.turbo.address,blackjack:a.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...g],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(n,t=0){if(t>12)throw new i("Card read result exceeds the supported nesting.");if(typeof n=="bigint")return n.toString();if(typeof n=="string"){if(n.length>8194)throw new i("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(n)?n:`untrusted ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.length>4096)throw new i("Choose a bounded card read.");return n.map(o=>h(o,t+1))}return n&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([o,u])=>[o,h(u,t+1)])):n}export{j as a};
@@ -1 +1 @@
1
- import{b as o,g as s}from"./73N3TOJL.js";import{a as i,s as r}from"./G6HCV67X.js";var d=new Set(["0x0000000000000000000000000000000000000000","0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r.mainnet.usdg.toLowerCase()]);function a(f,e,n){if(f!=="relay_bridge_in"||e.swap!==void 0||typeof n!="string"||!o.test(n)||e.destinationChainId!==void 0&&e.destinationChainId!==i||e.recipient!==void 0&&(typeof e.recipient!="string"||!s(e.recipient,n)))return!1;let t=e.destinationCurrency??"0x0000000000000000000000000000000000000000";return typeof t=="string"&&d.has(t.toLowerCase())}export{a};
1
+ import{b as o,g as s}from"./5KUWLUPM.js";import{a as i,s as r}from"./FWD4L3CJ.js";var d=new Set(["0x0000000000000000000000000000000000000000","0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r.mainnet.usdg.toLowerCase()]);function a(f,e,n){if(f!=="relay_bridge_in"||e.swap!==void 0||typeof n!="string"||!o.test(n)||e.destinationChainId!==void 0&&e.destinationChainId!==i||e.recipient!==void 0&&(typeof e.recipient!="string"||!s(e.recipient,n)))return!1;let t=e.destinationCurrency??"0x0000000000000000000000000000000000000000";return typeof t=="string"&&d.has(t.toLowerCase())}export{a};