@oakagentkit/core 0.3.3 → 0.3.5

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 (302) hide show
  1. package/build/dist/api/canonical.js +1 -1
  2. package/build/dist/api/history.d.ts +0 -3
  3. package/build/dist/api/history.js +1 -1
  4. package/build/dist/api/merkle.d.ts +1 -27
  5. package/build/dist/api/merkle.js +1 -1
  6. package/build/dist/api/modules/borro/actions.js +1 -1
  7. package/build/dist/api/modules/borro/checks.js +1 -1
  8. package/build/dist/api/modules/borro/index.js +1 -1
  9. package/build/dist/api/modules/borro/liquidity.js +1 -1
  10. package/build/dist/api/modules/borro/positions.js +1 -1
  11. package/build/dist/api/modules/borro/reader.js +1 -1
  12. package/build/dist/api/modules/chop/actions.d.ts +13 -1
  13. package/build/dist/api/modules/chop/actions.js +1 -1
  14. package/build/dist/api/modules/chop/checks.js +1 -1
  15. package/build/dist/api/modules/chop/copy.d.ts +2 -1
  16. package/build/dist/api/modules/chop/copy.js +1 -1
  17. package/build/dist/api/modules/chop/display.d.ts +36 -0
  18. package/build/dist/api/modules/chop/display.js +1 -0
  19. package/build/dist/api/modules/chop/guard.js +1 -1
  20. package/build/dist/api/modules/chop/index.js +1 -1
  21. package/build/dist/api/modules/chop/pins.d.ts +6 -0
  22. package/build/dist/api/modules/chop/pins.js +1 -1
  23. package/build/dist/api/modules/chop/positions.js +1 -1
  24. package/build/dist/api/modules/chop/reader.d.ts +6 -1
  25. package/build/dist/api/modules/chop/reader.js +1 -1
  26. package/build/dist/api/modules/chop/types.d.ts +7 -0
  27. package/build/dist/api/modules/chop/unfarm.d.ts +16 -0
  28. package/build/dist/api/modules/chop/unfarm.js +1 -0
  29. package/build/dist/api/modules/clanker/index.js +1 -1
  30. package/build/dist/api/modules/earn/index.js +1 -1
  31. package/build/dist/api/modules/erc8004/index.js +1 -1
  32. package/build/dist/api/modules/factor/actions.js +1 -1
  33. package/build/dist/api/modules/factor/api.js +1 -1
  34. package/build/dist/api/modules/factor/checks.js +1 -1
  35. package/build/dist/api/modules/factor/copy.d.ts +11 -11
  36. package/build/dist/api/modules/factor/copy.js +1 -1
  37. package/build/dist/api/modules/factor/guard.js +1 -1
  38. package/build/dist/api/modules/factor/index.js +1 -1
  39. package/build/dist/api/modules/factor/reader.js +1 -1
  40. package/build/dist/api/modules/fobo/client.d.ts +5 -0
  41. package/build/dist/api/modules/fobo/client.js +1 -1
  42. package/build/dist/api/modules/fobo/health.d.ts +4 -0
  43. package/build/dist/api/modules/fobo/health.js +1 -0
  44. package/build/dist/api/modules/fobo/index.js +1 -1
  45. package/build/dist/api/modules/fobo/referral.d.ts +2 -0
  46. package/build/dist/api/modules/fobo/referral.js +1 -0
  47. package/build/dist/api/modules/fobo/steps.js +1 -1
  48. package/build/dist/api/modules/gloam/index.js +1 -1
  49. package/build/dist/api/modules/grove/index.js +1 -1
  50. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  51. package/build/dist/api/modules/heyresearch/index.js +1 -1
  52. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  53. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  54. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  55. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  56. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  57. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  58. package/build/dist/api/modules/hoodlock/index.js +1 -1
  59. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  60. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  61. package/build/dist/api/modules/hoodlock/public.js +1 -1
  62. package/build/dist/api/modules/hookr/actions.js +1 -1
  63. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  64. package/build/dist/api/modules/hookr/discovery.js +1 -1
  65. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  66. package/build/dist/api/modules/hookr/index.js +1 -1
  67. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  68. package/build/dist/api/modules/hookr/launch.js +1 -1
  69. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  70. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  71. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  72. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  73. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  74. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  75. package/build/dist/api/modules/hookr/relay.js +1 -1
  76. package/build/dist/api/modules/layerbank/actions.js +1 -1
  77. package/build/dist/api/modules/layerbank/index.js +1 -1
  78. package/build/dist/api/modules/layerbank/reader.js +1 -1
  79. package/build/dist/api/modules/longbow/administration.js +1 -1
  80. package/build/dist/api/modules/longbow/fixed.js +1 -1
  81. package/build/dist/api/modules/longbow/index.js +1 -1
  82. package/build/dist/api/modules/meridian/index.js +1 -1
  83. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  84. package/build/dist/api/modules/merkl/discovery.js +1 -1
  85. package/build/dist/api/modules/merkl/index.js +1 -1
  86. package/build/dist/api/modules/merkl/manage.js +1 -1
  87. package/build/dist/api/modules/morpho/bundles.js +1 -1
  88. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  89. package/build/dist/api/modules/morpho/index.js +1 -1
  90. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  91. package/build/dist/api/modules/morpho/midnight.js +1 -1
  92. package/build/dist/api/modules/morpho/protocol.js +1 -1
  93. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  94. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  95. package/build/dist/api/modules/netnet/card-read.js +1 -1
  96. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  97. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  98. package/build/dist/api/modules/netnet/financial.js +1 -1
  99. package/build/dist/api/modules/netnet/index.js +1 -1
  100. package/build/dist/api/modules/pendle/index.js +1 -1
  101. package/build/dist/api/modules/pendle/reader.js +1 -1
  102. package/build/dist/api/modules/pons/index.js +1 -1
  103. package/build/dist/api/modules/priors/coverage.js +1 -1
  104. package/build/dist/api/modules/priors/discovery.js +1 -1
  105. package/build/dist/api/modules/priors/index.js +1 -1
  106. package/build/dist/api/modules/priors/integration.js +1 -1
  107. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  108. package/build/dist/api/modules/raeto/authorization.js +1 -1
  109. package/build/dist/api/modules/raeto/copy.js +1 -1
  110. package/build/dist/api/modules/raeto/errors.js +1 -1
  111. package/build/dist/api/modules/raeto/estimate.js +1 -1
  112. package/build/dist/api/modules/raeto/index.js +1 -1
  113. package/build/dist/api/modules/raeto/terms.js +1 -1
  114. package/build/dist/api/modules/relay/index.js +1 -1
  115. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  116. package/build/dist/api/modules/spark/index.js +1 -1
  117. package/build/dist/api/modules/steakhouse/index.js +1 -1
  118. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  119. package/build/dist/api/modules/steakhouse/management.js +1 -1
  120. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  121. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  122. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  123. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  124. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  125. package/build/dist/api/modules/tickerspring/index.js +1 -1
  126. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  127. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  128. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  129. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  130. package/build/dist/api/modules/tickerspring/research.js +1 -1
  131. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  132. package/build/dist/api/modules/transfer/stocks.d.ts +18 -0
  133. package/build/dist/api/modules/transfer/stocks.js +1 -0
  134. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  135. package/build/dist/api/modules/uniswap/auction.js +1 -1
  136. package/build/dist/api/modules/uniswap/batch.js +1 -1
  137. package/build/dist/api/modules/uniswap/common.js +1 -1
  138. package/build/dist/api/modules/uniswap/fees.js +1 -1
  139. package/build/dist/api/modules/uniswap/index.js +1 -1
  140. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  141. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  142. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  143. package/build/dist/api/modules/uniswap/pools.js +1 -1
  144. package/build/dist/api/modules/uniswap/position.js +1 -1
  145. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  146. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  147. package/build/dist/api/modules/uniswap/stock-prices.d.ts +9 -0
  148. package/build/dist/api/modules/uniswap/stock-prices.js +1 -0
  149. package/build/dist/api/modules/uniswap/stocks.d.ts +17 -0
  150. package/build/dist/api/modules/uniswap/stocks.js +1 -0
  151. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  152. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  153. package/build/dist/api/modules/uniswap/trade.js +1 -1
  154. package/build/dist/api/modules/uniswap/v2.js +1 -1
  155. package/build/dist/api/modules/uniswap/v3.js +1 -1
  156. package/build/dist/api/modules/uniswap/v4.js +1 -1
  157. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  158. package/build/dist/api/modules/upoch/index.js +1 -1
  159. package/build/dist/api/modules/upoch/reads.js +1 -1
  160. package/build/dist/api/modules/wormhole/index.js +1 -1
  161. package/build/dist/api/prices.d.ts +13 -11
  162. package/build/dist/api/prices.js +1 -1
  163. package/build/dist/api/pricing.d.ts +0 -6
  164. package/build/dist/api/pricing.js +1 -1
  165. package/build/dist/api/send.js +1 -1
  166. package/build/dist/api/signing-registry.js +1 -1
  167. package/build/dist/api/stocks.d.ts +6 -0
  168. package/build/dist/api/stocks.js +1 -0
  169. package/build/dist/api/tokens.d.ts +23 -1
  170. package/build/dist/api/tokens.js +1 -1
  171. package/build/dist/api/tool-policy.js +1 -1
  172. package/build/dist/api/types.d.ts +0 -26
  173. package/build/dist/api/usd-estimate.d.ts +2 -0
  174. package/build/dist/api/usd-estimate.js +1 -1
  175. package/build/dist/chunks/{ODV3XT5U.js → 2FOI2625.js} +1 -1
  176. package/build/dist/chunks/{73BZPPRS.js → 2I7XHRTI.js} +1 -1
  177. package/build/dist/chunks/{257N7343.js → 2PS4GCOZ.js} +1 -1
  178. package/build/dist/chunks/{RA7DOR7F.js → 3BQ5XHDJ.js} +1 -1
  179. package/build/dist/chunks/{5UAXLWJ2.js → 3UC42OJX.js} +1 -1
  180. package/build/dist/chunks/{KVVBT43U.js → 3YH5B5NQ.js} +1 -1
  181. package/build/dist/chunks/{VVJO6OYK.js → 4CEV4FDG.js} +1 -1
  182. package/build/dist/chunks/{RUSXMQSJ.js → 4HQEJHCD.js} +1 -1
  183. package/build/dist/chunks/{HIG7JY3J.js → 4IOHSX3Z.js} +1 -1
  184. package/build/dist/chunks/4UOVKEV4.js +1 -0
  185. package/build/dist/chunks/5H7NVE6O.js +1 -0
  186. package/build/dist/chunks/{JJGZ7W3V.js → 6AS3TGOX.js} +1 -1
  187. package/build/dist/chunks/{AWV24X7F.js → 6CKCZJ3F.js} +1 -1
  188. package/build/dist/chunks/{35LXCSHY.js → 6LVHN33V.js} +1 -1
  189. package/build/dist/chunks/7OOCAZBE.js +1 -0
  190. package/build/dist/chunks/{75SULXNT.js → 7TRO6MBQ.js} +1 -1
  191. package/build/dist/chunks/{EHGH646D.js → A4FLWHLP.js} +1 -1
  192. package/build/dist/chunks/{XVOW6UCI.js → A4K5GXVO.js} +1 -1
  193. package/build/dist/chunks/AL6UXNGH.js +6 -0
  194. package/build/dist/chunks/BJ2U2VXJ.js +1 -0
  195. package/build/dist/chunks/{4TTDAF4B.js → C4XK764N.js} +1 -1
  196. package/build/dist/chunks/{3BMM3V4P.js → C57DITTF.js} +1 -1
  197. package/build/dist/chunks/CFPJDLTZ.js +1 -0
  198. package/build/dist/chunks/{CXH46MHJ.js → CNDIAF3P.js} +1 -1
  199. package/build/dist/chunks/{K4GUZ5QS.js → CW37EGPL.js} +1 -1
  200. package/build/dist/chunks/{22TU5PFT.js → E47UYYK4.js} +1 -1
  201. package/build/dist/chunks/EPOIAXCV.js +3 -0
  202. package/build/dist/chunks/{RXP7ZUPY.js → FCVH4FYH.js} +1 -1
  203. package/build/dist/chunks/{ZSVAGOF2.js → FHB7QYJO.js} +1 -1
  204. package/build/dist/chunks/FRT6AC6M.js +1 -0
  205. package/build/dist/chunks/{NUERUFH7.js → FRVCSDKU.js} +1 -1
  206. package/build/dist/chunks/{LEV5SNNC.js → FUP53K6G.js} +1 -1
  207. package/build/dist/chunks/{5DPJQCKJ.js → FWOGOWUM.js} +2 -2
  208. package/build/dist/chunks/{5CPB33XA.js → G5AMH4IP.js} +1 -1
  209. package/build/dist/chunks/{JDSSYT6R.js → GBPB7JIB.js} +1 -1
  210. package/build/dist/chunks/{MGVX5EUH.js → GDUKZYE2.js} +1 -1
  211. package/build/dist/chunks/{47HSRR7G.js → GKUPC4DO.js} +1 -1
  212. package/build/dist/chunks/{K7HTDKAT.js → GMMTHTCP.js} +1 -1
  213. package/build/dist/chunks/{27PVS6BU.js → HDBZZOHJ.js} +1 -1
  214. package/build/dist/chunks/{FHTNMGFR.js → HKHCN4A2.js} +1 -1
  215. package/build/dist/chunks/{VC5ZCQYZ.js → HPS4KOU4.js} +1 -1
  216. package/build/dist/chunks/IZP3EKKS.js +1 -0
  217. package/build/dist/chunks/{VFM2BICB.js → J7OZLXSG.js} +1 -1
  218. package/build/dist/chunks/{6D3XNCOX.js → JDHPMS7X.js} +1 -1
  219. package/build/dist/chunks/JFC2QCMW.js +1 -0
  220. package/build/dist/chunks/{OFWTO4N6.js → JJSCDDQO.js} +1 -1
  221. package/build/dist/chunks/{EFESPGA2.js → KCZUJ57H.js} +1 -1
  222. package/build/dist/chunks/KHOUBQJK.js +1 -0
  223. package/build/dist/chunks/{UEHN2IDF.js → KKTOBXIT.js} +1 -1
  224. package/build/dist/chunks/KNROSKUG.js +1 -0
  225. package/build/dist/chunks/{SO6O7JK2.js → KO7ANIKY.js} +1 -1
  226. package/build/dist/chunks/{DLNA5272.js → LKUZAJPZ.js} +1 -1
  227. package/build/dist/chunks/{5GQJVKVY.js → LZM3DO5Q.js} +1 -1
  228. package/build/dist/chunks/M267JEDO.js +1 -0
  229. package/build/dist/chunks/M6JNGU4E.js +1 -0
  230. package/build/dist/chunks/{SNCV6HV7.js → M7OVMIIE.js} +1 -1
  231. package/build/dist/chunks/{VDJPDIBV.js → MJGEGNDU.js} +1 -1
  232. package/build/dist/chunks/{XKLXVTSE.js → MQXSCNUL.js} +1 -1
  233. package/build/dist/chunks/N624NR7Y.js +1 -0
  234. package/build/dist/chunks/{M4AGEGWW.js → N65J3L2H.js} +1 -1
  235. package/build/dist/chunks/{3UQXTZ5R.js → N742W5KX.js} +1 -1
  236. package/build/dist/chunks/NIWAVMDR.js +1 -0
  237. package/build/dist/chunks/O2QBSINK.js +1 -0
  238. package/build/dist/chunks/{7TSIF3F4.js → O4P5IQCP.js} +1 -1
  239. package/build/dist/chunks/{HUKDISRE.js → OB3YMTDI.js} +1 -1
  240. package/build/dist/chunks/{GGMVT5A6.js → PV7FEVBD.js} +1 -1
  241. package/build/dist/chunks/{PDGYM2WG.js → Q3Q3YHEX.js} +1 -1
  242. package/build/dist/chunks/QA6Z2CYP.js +2 -0
  243. package/build/dist/chunks/{HPY2ONAS.js → QBNASL3T.js} +1 -1
  244. package/build/dist/chunks/{AHUCYDBC.js → QKIQ7ZKD.js} +1 -1
  245. package/build/dist/chunks/{O3CC5SRM.js → QMIH6HXH.js} +1 -1
  246. package/build/dist/chunks/{3FU6XP6S.js → QQD4PV64.js} +1 -1
  247. package/build/dist/chunks/{VOJULRNU.js → R66NSNNQ.js} +1 -1
  248. package/build/dist/chunks/{SMKO7GKX.js → RP5VCG54.js} +1 -1
  249. package/build/dist/chunks/{7FZXSYFD.js → RUHNLNVX.js} +1 -1
  250. package/build/dist/chunks/{QN45T4N3.js → S37D7HOK.js} +1 -1
  251. package/build/dist/chunks/S47M3IPR.js +1 -0
  252. package/build/dist/chunks/S65KXMZ7.js +3 -0
  253. package/build/dist/chunks/{UBI3HBXD.js → SX5YNFHG.js} +1 -1
  254. package/build/dist/chunks/{SOJHYMD7.js → TGXEKBLV.js} +1 -1
  255. package/build/dist/chunks/{H64QC4QR.js → TJU644I7.js} +1 -1
  256. package/build/dist/chunks/{FSYYD3OM.js → TOIKOIY6.js} +1 -1
  257. package/build/dist/chunks/{I3ZBOSSH.js → TZ7S5KRB.js} +1 -1
  258. package/build/dist/chunks/{XEPCDGN2.js → UCFVPTE2.js} +1 -1
  259. package/build/dist/chunks/UEOS6SHR.js +1 -0
  260. package/build/dist/chunks/{BZPFPQ2I.js → USGMGKAG.js} +1 -1
  261. package/build/dist/chunks/{PKYQ3XVA.js → UUF4Z6K6.js} +1 -1
  262. package/build/dist/chunks/{PMFR47H3.js → VREGY7E6.js} +1 -1
  263. package/build/dist/chunks/{Y7HBFQYG.js → W7BFM6CK.js} +1 -1
  264. package/build/dist/chunks/{72EV7TGI.js → WQ2XTDHO.js} +1 -1
  265. package/build/dist/chunks/WRA3ZC6W.js +1 -0
  266. package/build/dist/chunks/WWYAAIE2.js +1 -0
  267. package/build/dist/chunks/{WCI3FHWT.js → XADHV2DT.js} +1 -1
  268. package/build/dist/chunks/{LVFI74ST.js → XNJ6NDQQ.js} +1 -1
  269. package/build/dist/chunks/{7FIEBJOZ.js → XTXXWRN2.js} +1 -1
  270. package/build/dist/chunks/{PWJVC2FV.js → XWC6IC5E.js} +1 -1
  271. package/build/dist/chunks/{THL4TMQW.js → Y76VZQ26.js} +232 -17
  272. package/build/dist/chunks/{IJ4HZIDG.js → YWVPK3DV.js} +1 -1
  273. package/build/dist/chunks/{WNWRF4HE.js → YZHJ4BAP.js} +1 -1
  274. package/build/dist/chunks/{ZDCCFEVL.js → ZKBOPZH5.js} +1 -1
  275. package/build/dist/chunks/{UCHJYWGU.js → ZQPC54J5.js} +1 -1
  276. package/build/dist/chunks/{6GWXPQZ6.js → ZVY7GGSP.js} +1 -1
  277. package/build/dist/chunks/{LQSPWRHN.js → ZX43P4BK.js} +1 -1
  278. package/build/dist/chunks/{YAVWSW3G.js → ZXFJKW6H.js} +1 -1
  279. package/build/dist/chunks/{QPY6UTLU.js → ZXRIJG6H.js} +1 -1
  280. package/package.json +1 -1
  281. package/build/dist/abi/IOakSubscription.json +0 -1
  282. package/build/dist/api/grandfather.d.ts +0 -56
  283. package/build/dist/api/grandfather.js +0 -1
  284. package/build/dist/chunks/43BG2JRB.js +0 -1
  285. package/build/dist/chunks/5CAAFU7R.js +0 -1
  286. package/build/dist/chunks/7EACRKFV.js +0 -1
  287. package/build/dist/chunks/BGVC5NI6.js +0 -3
  288. package/build/dist/chunks/BJK75C7G.js +0 -1
  289. package/build/dist/chunks/CM4DP2EZ.js +0 -1
  290. package/build/dist/chunks/CU4PWGMJ.js +0 -6
  291. package/build/dist/chunks/DGCJZ3HO.js +0 -1
  292. package/build/dist/chunks/ETMD747Y.js +0 -2
  293. package/build/dist/chunks/KLEJ3W4T.js +0 -1
  294. package/build/dist/chunks/KOKLM63Q.js +0 -3
  295. package/build/dist/chunks/KXX7ZBFY.js +0 -1
  296. package/build/dist/chunks/L2AE32SL.js +0 -1
  297. package/build/dist/chunks/LTDF2LNP.js +0 -1
  298. package/build/dist/chunks/NV6FDIYT.js +0 -1
  299. package/build/dist/chunks/OOPMZIG7.js +0 -1
  300. package/build/dist/chunks/UNJJRQIU.js +0 -1
  301. package/build/dist/chunks/W7QNSNOH.js +0 -1
  302. package/build/dist/chunks/ZOLHVZDK.js +0 -1
@@ -1,56 +0,0 @@
1
- import { type GrandfatherProofResult, type GrandfatherTree } from './merkle.js';
2
- import type { Address, DecimalString, GrandfatherEntry, Hex } from './types.js';
3
- export { GRANDFATHER_SCHEMA, LEAF_GRANDFATHER, buildGrandfatherTree, grandfatherLeaf, type GrandfatherProofResult, type GrandfatherTree, type GrandfatherTreeEntry, } from './merkle.js';
4
- export declare const PLAN_NONE: 0;
5
- export declare const PLAN_HOLDER: 1;
6
- export declare const PLAN_NO_HOLD: 2;
7
- export declare const GRANDFATHER_WINDOW_DAYS: 120;
8
- export declare const GRANDFATHER_WINDOW_SECONDS: 10368000;
9
- export type GrandfatherPlan = 'none' | 'holder' | 'nohold' | 0 | 1 | 2 | string | number;
10
- export interface GrandfatherWalletRecord {
11
- wallet: Address | string;
12
- source?: Address | string;
13
- contract?: Address | string;
14
- ancestor?: Address | string;
15
- hasRecord?: boolean;
16
- plan?: GrandfatherPlan;
17
- count?: DecimalString | bigint;
18
- signupOakCount?: DecimalString | bigint;
19
- paidUntil?: DecimalString | number | bigint;
20
- cancelled?: boolean;
21
- grandfathered?: boolean;
22
- }
23
- export interface GrandfatherAncestorInput {
24
- name?: string;
25
- address?: Address | string;
26
- contract?: Address | string;
27
- previous?: Address | string | null;
28
- deployBlock?: DecimalString | number | bigint;
29
- retired?: boolean;
30
- retiredAt?: DecimalString | number | bigint;
31
- records?: readonly GrandfatherWalletRecord[];
32
- }
33
- export interface ResolveGrandfatherOptions {
34
- lineage?: readonly (Address | string | GrandfatherAncestorInput)[];
35
- ancestors?: readonly (Address | string | GrandfatherAncestorInput)[];
36
- newestFirst?: boolean;
37
- }
38
- export type GrandfatherRecordsInput = readonly (GrandfatherWalletRecord | GrandfatherAncestorInput)[] | {
39
- ancestors?: readonly GrandfatherAncestorInput[];
40
- records?: readonly GrandfatherWalletRecord[];
41
- lineage?: readonly (Address | string)[];
42
- newestFirst?: boolean;
43
- };
44
- export interface GrandfatherList extends GrandfatherTree {
45
- bytes: Uint8Array;
46
- canonicalJsonSha256: Hex;
47
- }
48
- export declare function normalizePlan(plan: GrandfatherPlan | undefined, cancelled?: boolean): 'none' | 'holder' | 'nohold';
49
- export declare function orderAncestorsOldestFirst(ancestors: readonly GrandfatherAncestorInput[], newestFirstDefault?: boolean): GrandfatherAncestorInput[];
50
- export declare function resolveAuthoritativeEntries(input: GrandfatherRecordsInput, options?: ResolveGrandfatherOptions): GrandfatherEntry[];
51
- export declare function resolveGrandfatherLineage(records: GrandfatherRecordsInput, options?: ResolveGrandfatherOptions): GrandfatherList;
52
- export declare const resolveGrandfatherList: typeof resolveGrandfatherLineage;
53
- export declare function grandfatherProofFor(listOrEntries: GrandfatherList | GrandfatherTree | GrandfatherRecordsInput, wallet: Address | string, options?: ResolveGrandfatherOptions): GrandfatherProofResult | null;
54
- export declare function verifyGrandfatherProof(rootOrTree: Hex | {
55
- root: Hex;
56
- }, leafOrEntry: Hex | GrandfatherEntry, proof: readonly Hex[]): boolean;
@@ -1 +0,0 @@
1
- import{a as P,b as y,c as m,e as v,f as R,h as I}from"../chunks/UNJJRQIU.js";import{b as x}from"../chunks/IX3GZMTM.js";import"../chunks/5CAAFU7R.js";import{a as i}from"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";import{createHash as H}from"node:crypto";import{getAddress as L,isAddress as k}from"viem";var E=0,T=1,N=2,V=120,X=10368e3,W="0x0000000000000000000000000000000000000000",_=(1n<<256n)-1n;function $(e,r){if(typeof e!="string"||!k(e,{strict:!1}))throw new i(`Invalid ${r} address.`);return L(e)}function h(e,r){return $(e,r).toLowerCase()}function M(e,r="count"){let s=typeof e=="bigint"?e:x(e);if(s<0n||s>_)throw new i(`${r} exceeds uint256 bounds.`);return s}function C(e,r){if(r)return"none";if(e==="holder"||e===T)return"holder";if(e==="nohold"||e===N)return"nohold";if(e==="none"||e===E)return"none";throw new i(`Invalid or missing subscription plan: ${String(e)}`)}function O(e){if(!e||typeof e!="object")return!1;let r=e;return Array.isArray(r.records)||"deployBlock"in r&&("address"in r||"contract"in r)||"previous"in r&&("address"in r||"contract"in r)&&!("wallet"in r)}function D(e,r=!0){if(e.length<=1)return[...e];let s=new Map,c=e.some(n=>n.previous!==void 0&&n.previous!==null);for(let n of e){let a=n.address??n.contract;if(!a)throw new i("Each ancestor in the lineage must specify an address.");let d=h(a,"ancestor");if(s.has(d))throw new i(`Duplicate ancestor contract in lineage: ${d}`);s.set(d,n)}if(!c)return r?[...e].reverse():[...e];let l=new Map,u=new Map;for(let[n,a]of s.entries()){let d=a.previous;if(d===void 0)throw new i(`Ancestor ${n} is missing its previous() pointer in a linked lineage.`);if(d===null||h(d,"previous")===W)l.set(n,null);else{let f=h(d,"previous");if(f===n)throw new i(`Ancestor ${n} cannot reference itself as previous.`);if(l.set(n,f),s.has(f)){if(u.has(f))throw new i(`Multiple ancestors claim ${f} as previous.`);u.set(f,n)}}}let p=[...s.keys()].filter(n=>{let a=l.get(n);return a==null||!s.has(a)});if(p.length!==1)throw new i("Lineage ancestors must form a single unbroken previous() chain.");let w=[],t=new Set,o=p[0];for(;o!==void 0;){if(t.has(o))throw new i("Cycle detected in subscription ancestor lineage.");t.add(o),w.push(s.get(o)),o=u.get(o)}if(w.length!==e.length)throw new i("Disconnected ancestor detected in subscription lineage.");return w}function F(e){if(e.hasRecord===!1||C(e.plan,e.cancelled)!=="holder")return null;let s=e.count??e.signupOakCount;if(s===void 0)throw new i(`Holder record for wallet ${e.wallet} is missing count.`);let c=M(s,"count");if(c<=0n)return null;let l=e.source??e.contract??e.ancestor;if(!l)throw new i(`Record for wallet ${e.wallet} is missing source contract address.`);let u=h(l,"source");return{count:c.toString(),source:u}}function b(e,r){if(e===null||typeof e!="object")throw new i("Grandfather records input must be an array or lineage object.");if(!Array.isArray(e)){let t=e;if(Array.isArray(t.ancestors))return b(t.ancestors,{...r,newestFirst:r?.newestFirst??t.newestFirst});if(Array.isArray(t.records))return b(t.records,{...r,lineage:r?.lineage??t.lineage,newestFirst:r?.newestFirst??t.newestFirst});throw new i("Grandfather lineage object must contain ancestors or records.")}if(e.length===0)return[];if(e.every(O)){let t=D(e,r?.newestFirst??!0),o=new Map;for(let a of t){let d=h(a.address??a.contract,"ancestor"),f=a.records??[],A=new Set;for(let g of f){let G=h(g.wallet,"wallet");if(A.has(G))throw new i(`Duplicate wallet record ${G} within ancestor ${d}.`);A.add(G),g.hasRecord!==!1&&o.set(G,{...g,wallet:G,source:d})}}let n=[];for(let[a,d]of o.entries()){let f=F(d);f&&n.push({wallet:a,count:f.count,source:f.source})}return n}let s=e,c=r?.lineage??r?.ancestors,l=r?.newestFirst??!0,u=new Map;if(c&&c.length>0)if(c.every(t=>typeof t=="string")){let t=c.map(n=>h(n,"lineage"));(l?[...t].reverse():[...t]).forEach((n,a)=>u.set(n,a))}else D(c,l).forEach((o,n)=>{let a=h(o.address??o.contract,"ancestor");u.set(a,n)});let p=new Map;for(let t=0;t<s.length;t++){let o=s[t],n=h(o.wallet,"wallet");if(o.hasRecord===!1)continue;let a=o.source??o.contract??o.ancestor;if(!a)throw new i(`Grandfather record for wallet ${n} requires a source address.`);let d=h(a,"source"),f=u.get(d);if(u.size>0&&f===void 0)throw new i(`Record source ${d} is not in the subscription lineage.`);let A=f??t,g=p.get(n);if(g){if(g.source===d)throw new i(`Duplicate wallet in grandfather entries: ${n}`);A>=g.rank&&p.set(n,{record:{...o,wallet:n,source:d},rank:A,source:d})}else p.set(n,{record:{...o,wallet:n,source:d},rank:A,source:d})}let w=[];for(let[t,{record:o}]of p.entries()){let n=F(o);n&&w.push({wallet:t,count:n.count,source:n.source})}return w}function S(e,r){let s=b(e,r),c=R(s),l=new TextEncoder().encode(c.canonicalJson),u=`0x${H("sha256").update(l).digest("hex")}`;return{...c,bytes:l,canonicalJsonSha256:u}}var Y=S;function j(e,r){return e&&typeof e=="object"&&!Array.isArray(e)&&"schema"in e&&e.schema===y&&"root"in e&&"entries"in e?e:S(e,r)}function Z(e,r,s){let c=h(r,"wallet"),l=j(e,s);return l.entries.some(p=>p.wallet.toLowerCase()===c)?I(l,c):null}function K(e,r,s){let c=typeof e=="string"?e:e.root,l=typeof r=="string"?r:m(r);return v(c,l,s)}export{y as GRANDFATHER_SCHEMA,V as GRANDFATHER_WINDOW_DAYS,X as GRANDFATHER_WINDOW_SECONDS,P as LEAF_GRANDFATHER,T as PLAN_HOLDER,E as PLAN_NONE,N as PLAN_NO_HOLD,R as buildGrandfatherTree,m as grandfatherLeaf,Z as grandfatherProofFor,C as normalizePlan,D as orderAncestorsOldestFirst,b as resolveAuthoritativeEntries,S as resolveGrandfatherLineage,Y as resolveGrandfatherList,K as verifyGrandfatherProof};
@@ -1 +0,0 @@
1
- import{c as G,d as V,g as W,l as _,m as Q}from"./NV6FDIYT.js";import{a as K}from"./Y2QADJOB.js";import{b as P}from"./L2AE32SL.js";import{b as O,j as $}from"./TI727O2H.js";import{formatUnits as oe,getAddress as j,parseAbi as Y}from"viem";var p={chainId:4663,usdg:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",v4:{poolManager:"0x8366a39CC670B4001A1121B8F6A443A643e40951",swapper:"0x7Cd4E04E433E69e588728c86A3832753B5F846d4",quoter:"0x8dc178efb8111bb0973dd9d722ebeff267c98f94",stateView:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"},v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},tokens:[{symbol:"AAPL",token:"0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",pools:[{v:3,fee:500,pool:"0xAae0d815EE56e4092a5E5C2911E676Fea50B2d6D"},{v:4,fee:3e3,tickSpacing:60,id:"0xc748f4671a867db48b552f6b7650bf3255e05f80f00e3f7aad1b17ccb7898fdb"},{v:3,fee:3e3,pool:"0x783C9bbB765047CFdD2b84b92b2Ca9F11D34b7Ed"}]},{symbol:"AMD",token:"0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",pools:[{v:3,fee:3e3,pool:"0x48D284A2A4d3DC1b3Da08231Fe44317e7e7Aa51f"}]},{symbol:"AMZN",token:"0x12f190a9F9d7D37a250758b26824B97CE941bF54",pools:[{v:3,fee:3e3,pool:"0x8AC92DA74AB5F3b1d024Dc1943Ad7e15Dc4179Ef"},{v:4,fee:2400,tickSpacing:24,id:"0xefc94885c96b02696b9b45de43eeeb8ac53c0199cab42b4daae4911b96fb8825"}]},{symbol:"ASML",token:"0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",pools:[{v:3,fee:1e4,pool:"0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1"}]},{symbol:"BABA",token:"0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x1791fc651cc794a282e5dbcb56d0b2b38eff8754b677c8876e86901521ecc439"},{v:3,fee:3e3,pool:"0xa57ab582b310dd6f9e934EA1EEEa152741545E6A"}]},{symbol:"COIN",token:"0x6330D8C3178a418788dF01a47479c0ce7CCF450b",pools:[{v:4,fee:2500,tickSpacing:25,id:"0xe2e1a0e32205e854525e0fb1d3667a53bd3b4919f032b9bcd2a038b6b6dac314"},{v:4,fee:1e4,tickSpacing:200,id:"0x007a13fa152f6dc383cad20a8eaab4e1e2538b606936eae2a424f8aa47d6db31"}]},{symbol:"CRCL",token:"0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",pools:[{v:3,fee:3e3,pool:"0x654E4143e82a5824445Ade0824351C2A9ACD95a8"},{v:4,fee:3e3,tickSpacing:30,id:"0x628c98ab436ee34a6a7decd606242890582591bdf7c9a35d90e0d08021c31ea0"},{v:4,fee:1500,tickSpacing:15,id:"0x5177eac8c2176468bbf15e44081e151d35c2e7d068e96d3db94f496a4dc944b2"}]},{symbol:"CRWV",token:"0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x237014478f7ef98afbe7412ac35b6a3f96b8fb111de48b7c4dbf49dba4bd9c4b"}]},{symbol:"DELL",token:"0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",pools:[{v:3,fee:1e4,pool:"0xc30c89cB7815A1488b7998D15eEC73961707Fc5a"}]},{symbol:"GME",token:"0x1b0E319c6A659F002271B69dB8A7df2F911c153E",pools:[{v:3,fee:500,pool:"0xE2b46c905E12Ab8E2f864e4821a4325884C1B126"}]},{symbol:"GOOGL",token:"0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",pools:[{v:3,fee:500,pool:"0x34D0dC122CF9A8Eb296fC5e0D3A233625D7d19b7"},{v:4,fee:300,tickSpacing:3,id:"0x43fe16b75cabbf38f5b185d16142b02d1d9200d8f1ba17cb6cf899f562c6197f"},{v:4,fee:3e3,tickSpacing:60,id:"0xd4ecb79fdc521d7725d22b33ed43cb4e47aa96bfad76aa29577e3151f723ac5e"}]},{symbol:"INTC",token:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",pools:[{v:3,fee:3e3,pool:"0x2e5a92f5013a64661A49312111be2e8aBd33F56a"}]},{symbol:"META",token:"0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",pools:[{v:4,fee:310,tickSpacing:3,id:"0xc58bb68060bcb7b3ea0f6d4a4afef1e57f628722e808db12afb6d1733552872f"},{v:3,fee:3e3,pool:"0x107a7Cb40d8665360ba10E59471Af06150A50922"},{v:4,fee:3e3,tickSpacing:60,id:"0x5875d407a42965b0e768c8925cea290e06fa50603ef34fc99eb92a1050e6ae36"}]},{symbol:"MSFT",token:"0xe93237C50D904957Cf27E7B1133b510C669c2e74",pools:[{v:3,fee:3e3,pool:"0xeb60bCD1D920ad6E102690CCFC6fB488899E1510"},{v:4,fee:3e3,tickSpacing:60,id:"0x9194a557b6a6bb2236b49ea7e2bbccec5d3eeb705aef00903be4b3de1d949579"}]},{symbol:"MSTR",token:"0xec262a75e413fAfD0dF80480274532C79D42da09",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x319bac87e616a89e241c10aeb8afd4892a852cdd8b373cd9765ecddc40b87cfe"},{v:4,fee:2400,tickSpacing:24,id:"0xc105b8300ff65d750a0e4e63c7a879e20504069b770713464a5315e797735326"}]},{symbol:"MU",token:"0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",pools:[{v:3,fee:3e3,pool:"0xd057B1Bc54917855BBee58eAd58647f47caB35E5"}]},{symbol:"NBIS",token:"0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",pools:[{v:4,fee:9900,tickSpacing:99,id:"0x7c2f9ce1214ba9baf56d1b6a1fc640c1b63e9a711172c0c7d10e5a9c4a3d4f0c"}]},{symbol:"NVDA",token:"0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",pools:[{v:3,fee:500,pool:"0xd4EB21209C4D6093f80B5b84f5C45cc093EA14a3"},{v:4,fee:100,tickSpacing:1,id:"0x6444a8e0b267406a15db74ca00c4a24bdfa81ed3180f5b6d0851f8ed6f4f29c5"},{v:4,fee:3e3,tickSpacing:60,id:"0x3bb34a44f1b2b5f32c034c38a53065a521a47b199700fa9bd19d60985ff24bf1"}]},{symbol:"ORCL",token:"0xb0992820E760d836549ba69BC7598b4af75dEE03",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0xc2ce4784e1e72cf0221b51b30c8aaadf6c0b12863cf03ab3687854fb7b1d850a"}]},{symbol:"PLTR",token:"0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",pools:[{v:4,fee:1500,tickSpacing:15,id:"0xc59eaeda6d1a6f031bc7e1d039772f2d675e7b4de2c8668610f4471bd60b3802"},{v:3,fee:3e3,pool:"0x851680416A4f4E1c463d45171d61ACDdBc8554c0"}]},{symbol:"QQQ",token:"0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",pools:[{v:3,fee:500,pool:"0xD60A5d14dB690B7Afad71F76B108071D7175597d"}]},{symbol:"SGOV",token:"0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",pools:[{v:3,fee:500,pool:"0x6Ba50150B17Ffd0972915Aaf04fFd5E8f4Fa49b4"},{v:3,fee:3e3,pool:"0xfAb520051f96F4D2a32c22B6a3dD7fFfdf231bFe"}]},{symbol:"SLV",token:"0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",pools:[{v:3,fee:3e3,pool:"0x8cB787e6c315D464775289BaD00FDD67d53Ecb3D"},{v:3,fee:1e4,pool:"0x0Fa7BC480885DCf58Ad2ef63eC7289cF2481D51c"}]},{symbol:"SNDK",token:"0xB90A19fF0Af67f7779afF50A882A9CfF42446400",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0x2707cb88a6a40fa0f948f58958051ba097d6f6a3cf7f87929bd68ccc5becea24"}]},{symbol:"SPCX",token:"0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",pools:[{v:3,fee:500,pool:"0xc61284332117c3FB23A2A56cceFFD07F7aF60029"},{v:3,fee:3e3,pool:"0xEb07d9587eFD1778dFb9c385Ec43EF6d5F9fE401"}]},{symbol:"SPY",token:"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",pools:[{v:4,fee:100,tickSpacing:1,id:"0xe1ae6a4c6ccc9f037389a8d50a4f577bde1a9fe01d85d88ecbbd39955ce53288"},{v:3,fee:500,pool:"0xa7Bb1AC63BBaB0C44316E6c8C455213441689167"},{v:4,fee:500,tickSpacing:5,id:"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"}]},{symbol:"TSLA",token:"0x322F0929c4625eD5bAd873c95208D54E1c003b2d",pools:[{v:3,fee:3e3,pool:"0xf4ACdAEEB7022862A763C9B1B885e11191c889E3"},{v:4,fee:3e3,tickSpacing:60,id:"0x8517f8071ae5b831b738052f12125e8e3d6c158b78728aa44ce3b25e5104d32e"}]},{symbol:"TSM",token:"0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",pools:[{v:4,fee:7500,tickSpacing:75,id:"0x0ba5d53d2f6255f334b7c8ead4f56b6aef5af3402c5e4d11180afd38c6b85fb1"},{v:3,fee:1e4,pool:"0x07e8Ea83D4C1340774c8965125e26e12bf943bf1"}]},{symbol:"USAR",token:"0xd917B029C761D264c6A312BBbcDA868658eF86a6",pools:[{v:3,fee:3e3,pool:"0x04391780F519B7d3ba59c9590459D76e23d225C4"}]},{symbol:"USO",token:"0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",pools:[{v:4,fee:1200,tickSpacing:15,id:"0x1f2ad5a274a776d8e1408292bde1d92d8fa7b6444acf14ad60b9c3e4e5b66420"},{v:3,fee:3e3,pool:"0x02175608F1b5E6b5ed221cCFdC7Be197D111D915"}]}],notOffered:{CLSK:"thin",EWY:"thin",IONQ:"thin",RGTI:"thin",RKLB:"thin"},sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309"};var u=10n**18n,T=1n<<192n,C=Y(["function slot0() view returns (uint160,int24,uint16,uint16,uint16,uint8,bool)","function liquidity() view returns (uint128)","function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]),ne=Y(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),c=r=>({usdEstimate:null,estimateLabel:"price unavailable",estimateReason:r}),g=r=>`${r.chainId}:${r.address.toLowerCase()}`;async function be(r,I,k={}){let v=Number.isFinite(k.budgetMs)?Math.min(3e3,Math.max(0,k.budgetMs)):3e3,x=`Oak stopped pricing after ${v===3e3?"3 seconds":`${v} milliseconds`}`,D=new Map,h=[...new Map(I.map(e=>[g(e.token),e.token])).values()],f=!1,F=0,y=[];async function B(e){if(f)throw new Error(x);if(F>=6?await new Promise(t=>y.push(t)):F++,f)throw new Error(x);try{return await e()}finally{let t=y.shift();t?t():F--}}let U=new Map,L=new Map,R=new Map,q;function m(e){let t=U.get(e);if(!t){let a=r.clientFor(e);t=new Proxy(a,{get(n,o,b){let s=Reflect.get(n,o,b);return o==="readContract"?(...i)=>B(async()=>Reflect.apply(s,n,i)):s}}),U.set(e,t)}return t}function S(e){let t=L.get(e);return t||(t=B(()=>m(e).getBlockNumber({cacheTime:0})),L.set(e,t)),t}function w(e,t){return q??=_(e,void 0,t).then(a=>{let n=BigInt(a);if(n<=0n)throw new Error("ETH average unavailable");return n}),q}function J(e,t){let a=`${e}:${t}`,n=R.get(a);return n||(n=B(()=>m(e).getBlock({blockNumber:t})).then(o=>{if(!(o.number!==t||typeof o.timestamp!="bigint"||o.timestamp<=0n))return o.timestamp.toString()}).catch(()=>{}),R.set(a,n)),n}async function X(e,t){let a=m(e.chainId),n=await S(e.chainId),o;for(let s of t.pools)try{let i=s.v===3,d=j(i?s.pool:p.v4.stateView),E=await a.readContract({address:d,abi:C,functionName:i?"slot0":"getSlot0",args:i?[]:[s.id],blockNumber:n}),l=await a.readContract({address:d,abi:C,functionName:i?"liquidity":"getLiquidity",args:i?[]:[s.id],blockNumber:n}),A=E[0];A>0n&&l>0n&&(!o||l>o.liquidity)&&(o={liquidity:l,sqrt:A})}catch{}if(!o)return c("Oak has no pinned pool with in-range liquidity for this token");let b=BigInt(e.address)<BigInt(p.usdg);return{numerator:b?o.sqrt**2n:T,denominator:(b?T:o.sqrt**2n)*10n**6n,source:`current price in the Uniswap USDG/${t.symbol} pool; on-chain trading can differ from the stock market`,block:n}}async function Z(e){if(V(e))return{numerator:1n,denominator:10n**6n,source:"USDG counted at $1.00"};if(e.chainId!==O)return c("Oak has no source for this token");if(k.chopShareTokens?.some(i=>i.toLowerCase()===e.address.toLowerCase()))return c("chop_logs shows this log's backing");let t=e.symbol;if(t.startsWith("untrusted "))try{let i=JSON.parse(t.slice(10));typeof i=="string"&&(t=i)}catch{}if(G(e))try{let i=m(e.chainId),d=await S(e.chainId),E=j(P.stateView),l=P.poolId,[A,te]=await Promise.all([i.readContract({address:E,abi:C,functionName:"getSlot0",args:[l],blockNumber:d}),i.readContract({address:E,abi:C,functionName:"getLiquidity",args:[l],blockNumber:d})]),H=A[0];return H<=0n||te<=0n?c("The pinned Uniswap v4 WETH/CHOP pool has no active liquidity, and the only other route is a near-empty pool. A quote is a sale for this amount only; Oak never uses it to value a balance."):{numerator:await w(i,d)*T,denominator:u*H**2n*10n**BigInt(e.decimals),source:"current price in the Uniswap v4 WETH/CHOP pool",block:d}}catch{return c("Oak could not verify the pinned Uniswap v4 WETH/CHOP pool for CHOP. A quote is a sale for this amount only; Oak never uses it to value a balance.")}if(t==="CHOP")return c("Oak has no pinned market for CHOP. A quote is a sale for this amount only; Oak never uses it to value a balance.");let a=p.tokens.find(i=>i.token.toLowerCase()===e.address.toLowerCase());if(a)return X(e,a);if(Object.hasOwn(p.notOffered,t))return c("Oak has no pinned market for this token");let n=m(e.chainId),o=await S(e.chainId);if(W(e))return{numerator:await w(n,o),denominator:u*u,source:"30-minute average of the Uniswap ETH/USDG pool",block:o};let b=(r.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS)?.toLowerCase()===e.address.toLowerCase();if(b)try{let i=r.resolvePrice?await r.resolvePrice(e,o):await Q(e,{client:n,blockNumber:o,oakTokenAddress:e.address,officialStockTokens:[]}),d=BigInt(i.usdE18);if(d<=0n)throw new Error("OAK price unavailable");return{numerator:d,denominator:u*10n**BigInt(e.decimals),source:"OAK price",block:o}}catch{}if(b&&(await n.readContract({address:$[O].pons.factory.address,abi:ne,functionName:"getLaunchedToken",args:[e.address],blockNumber:o})).phase!==2)return c("Oak has no graduated Pons pool price for OAK");let s=await K(e,n,o);return s.numerator<=0n||s.denominator<=0n?c("Oak has no source for this token"):{numerator:await w(n,o)*s.numerator,denominator:u*s.denominator*10n**BigInt(e.decimals),source:b?"OAK's current Pons pool price; fewer than enough trades in 30 minutes for a price":"current Pons pool price",block:o}}let N=0;async function z(){for(;!f&&N<h.length;){let e=h[N++],t;try{if(!Number.isInteger(e.decimals)||e.decimals<0||e.decimals>255)throw new Error("Invalid decimals");if(t=await Z(e),f||D.set(g(e),t),"numerator"in t&&t.block!==void 0){let a=await J(e.chainId,t.block);f||(t.observedAt=a)}}catch{t=c("Oak has no source for this token")}f||D.set(g(e),t)}}let M,ee=new Promise(e=>{M=setTimeout(()=>{f=!0;for(let t of y.splice(0))t();e()},v)});try{await Promise.race([Promise.all(Array.from({length:Math.min(6,h.length)},z)),ee])}finally{clearTimeout(M),f=!0}return I.map(e=>{let t;try{if(!/^\d+$/.test(e.amount)||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)throw new Error("Invalid amount");t="humanAmount"in e&&typeof e.humanAmount=="string"?e.humanAmount:oe(BigInt(e.amount),e.token.decimals);let a=D.get(g(e.token));if(a&&"numerator"in a){let o=(BigInt(e.amount)*a.numerator*100n*2n+a.denominator)/(a.denominator*2n);return{...e,humanAmount:t,usdEstimate:`${o/100n}.${(o%100n).toString().padStart(2,"0")}`,estimateLabel:"estimate, not a quote",estimateSource:a.source,unitUsdE18:(a.numerator*10n**BigInt(e.token.decimals)*u/a.denominator).toString(),...a.observedAt===void 0?{}:{observedAt:a.observedAt},...a.block===void 0?{}:{estimateAsOf:a.block.toString()}}}return{...e,humanAmount:t,...a??c(x)}}catch{return{...e,...t===void 0?{}:{humanAmount:t},...c("Oak cannot format this token amount")}}})}export{be as a};
@@ -1 +0,0 @@
1
- import{a as o}from"./XSD5NL7J.js";import{createHash as c}from"node:crypto";function f(n){if(n===null||typeof n!="object"||Array.isArray(n))return!1;let t=Object.getPrototypeOf(n);return t===Object.prototype||t===null}function s(n){if(n===null||typeof n=="boolean"||typeof n=="string")return JSON.stringify(n);if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o("Canonical JSON numbers must be safe integers; encode base-unit amounts as decimal strings.");return Object.is(n,-0)?"0":String(n)}if(typeof n=="bigint")throw new o("BigInt values must be encoded as decimal strings before JSON serialization.");if(Array.isArray(n)){let t=[];for(let r=0;r<n.length;r++){if(!Object.prototype.hasOwnProperty.call(n,r))throw new o(`Sparse arrays are not permitted in canonical JSON (missing index ${r}).`);t.push(s(n[r]))}return`[${t.join(",")}]`}if(f(n)){let t=Object.keys(n).sort((e,i)=>e<i?-1:e>i?1:0),r=[];for(let e of t){let i=n[e];if(i===void 0)throw new o(`Canonical JSON object key "${e}" must not be undefined.`);r.push(`${JSON.stringify(e)}:${s(i)}`)}return`{${r.join(",")}}`}throw new o("Unsupported value in canonical JSON.")}function p(n){return new TextEncoder().encode(s(n))}function g(n){return`0x${c("sha256").update(p(n)).digest("hex")}`}export{s as a,p as b,g as c};
@@ -1 +0,0 @@
1
- import{b as q}from"./IX3GZMTM.js";import{d as h}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";var Y="12333333",I=1800,N=9000n,O=9607n,C=150n,U=(1n<<256n)-1n,f=10000n,g=10n**18n,X=10n**30n,R=1n<<192n,D=20n*g,E=75n*g,_=100n*g,x=300n*g,P=100000n*g,S=500000n*g,w=1000000n*g,B=10000000n*g;function c(n){let t=typeof n=="bigint"?n:q(n);if(t<0n||t>U)throw new o("Amount must be within the uint256 range.");return t}function p(n){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o("Integer parameter must be a safe integer.");return BigInt(n)}if(typeof n!="string"||!/^-?\d+$/.test(n))throw new o("Value must be a signed integer decimal string.");return BigInt(n)}function A(n,t=77){let i=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):NaN;if(!Number.isInteger(i)||i<0||i>t)throw new o(`Token decimals must be an integer from 0 to ${t}.`);return i}function k(n){return 10n**BigInt(n)}function T(n,t="Result"){if(n<0n||n>U)throw new o(`${t} exceeds uint256 bounds.`);return n}function b(n,t,i="Factor"){return T(n*t,i)}function a(n,t,i,s="floor"){if(i<=0n)throw new o("The denominator must be positive.");let e=n*t;if(e===0n)return 0n;let r=s==="ceil"?e/i+(e%i===0n?0n:1n):e/i;return T(r,"Math.mulDiv result")}function $(n){let t=c(n);return t<P?D.toString():t<S?(D+a(t-P,E-D,S-P)).toString():t<w?(E+a(t-S,_-E,w-S)).toString():t<B?(_+a(t-w,x-_,B-w)).toString():x.toString()}function Q(n){let t=c(n);return T(9000000n+t/1000000000000n/6n,"noHoldPriceBase").toString()}function j(n){let t=c(n);return a(t,5n,100n,"ceil").toString()}function z(n,t){let i=c(n),s=c(t);if(s<=0n)throw new o("OAK-per-ETH price must be positive.");return a(i,g,s,"floor").toString()}function G(n,t,i=h){let s=c(n),e=c(t);if(e<=0n)throw new o("OAK USD price must be positive.");let r=k(A(i));return a(s,r,e,"ceil").toString()}function J(n,t,i=h){let s=c(n),e=c(t),r=k(A(i));return a(s,e,r,"floor").toString()}function Z(n,t){let i=c(n),s=c(t);if(i>f||s>f)throw new o("FeePolicyOutOfBounds: hook fee or creator tax exceeds 10000 bps.");let e=i+s+C;if(e>f-N)throw new o("FeePolicyOutOfBounds: fees and impact allowance exceed 1000 bps.");let r=f-e;return(r>O?O:r).toString()}function nn(n,t,i,s,e){let r=A(s,83);if(r<6)throw new o("OAK decimals must be at least 6 for burner conversion.");let u=c(e);if(u<N||u>O)throw new o("InvalidBurnerFloor: floor must be from 9000 to 9607 bps.");let m=c(n),d=c(t),l=c(i);if(l<=0n)throw new o("ETH USD price must be positive.");let v=k(r-6),y=b(m,v,"burnerMinOut usdgIn * decimalScale"),W=b(d,u,"burnerMinOut oakPerEthE18 * floorBps"),M=b(l,f,"burnerMinOut ethUsdE18 * 10000");return a(y,W,M,"floor").toString()}function tn(n,t,i=I){let s=p(n),e=p(t),r=p(i);if(r<=0n)throw new o("Observation window seconds must be positive.");let u=e-s,d=u/r-(u<0n&&u%r!==0n?1n:0n);return Number(d)}function en(n){let t=c(n);if(t<=0n)throw new o("sqrtRatioX96 must be positive.");let i=b(t,t,"sqrtRatioX96 squared");return a(i,X,R,"floor").toString()}function F(n){let t=c(n);if(t<=0n)throw new o("sqrtPriceX96 must be positive.");let i=b(t,t,"sqrtPriceX96 squared");return a(i,g,R,"floor").toString()}function L(n){let t="ethAmountWei"in n&&n.ethAmountWei!==void 0?n.ethAmountWei:"ethVolumeWei"in n?n.ethVolumeWei:void 0;if(t===void 0)throw new o("SwapTrade must provide ethAmountWei.");let i=p(t),s=i<0n?-i:i;if(s<=0n)throw new o("SwapTrade ETH volume must be positive.");let e;n.sqrtPriceX96!==void 0&&n.sqrtPriceX96!==""&&n.sqrtPriceX96!=="0"&&(e=BigInt(F(n.sqrtPriceX96)));let r;if(n.oakPerEthE18!==void 0&&n.oakPerEthE18!==""&&(r=c(n.oakPerEthE18)),e!==void 0&&r!==void 0&&e!==r)throw new o("SwapTrade oakPerEthE18 does not match post-swap sqrtPriceX96.");let u=e??r;if(u===void 0||u<=0n)throw new o("SwapTrade must provide a positive post-swap price.");let m=n.timestamp!==void 0&&n.timestamp!==""?c(n.timestamp):void 0;return{volumeWei:s,oakPerEth:u,timestamp:m}}function rn(n,t){if(!Array.isArray(n)||n.length===0)throw new o("At least one SwapTrade is required to compute the 30-minute average.");let i=t?.windowEnd!==void 0?c(BigInt(t.windowEnd)):t?.now!==void 0?c(BigInt(t.now)):void 0,s=t?.windowStart!==void 0?c(BigInt(t.windowStart)):i!==void 0?i-BigInt(I):void 0,e=0n,r=0n;for(let u of n){let{volumeWei:m,oakPerEth:d,timestamp:l}=L(u);s!==void 0&&i!==void 0&&l!==void 0&&(l<s||l>=i)||(e+=m*d,r+=m)}if(r<=0n)throw new o("No trades with positive ETH volume fell inside the 30-minute window.");return(e/r).toString()}export{Y as a,I as b,N as c,O as d,C as e,$ as f,Q as g,j as h,z as i,G as j,J as k,Z as l,nn as m,tn as n,en as o,F as p,rn as q};
@@ -1,3 +0,0 @@
1
- import{d as F,e as M}from"./KOKLM63Q.js";import{g as H,j as R}from"./ETMD747Y.js";import{a as y,b as x,c,f as $,j as L,l as S,m as O,n as U}from"./K4GUZ5QS.js";import{a as N}from"./K6D6SDIG.js";import{a as r}from"./L2AE32SL.js";import{c as q}from"./43LI5NKJ.js";import{g as _}from"./NWNYJ26T.js";import{a as h}from"./XSD5NL7J.js";import{encodeFunctionData as W}from"viem";var j={chop_wrap:["log","underlying","amount","minLogOut"],chop_unwrap:["log","amount","quotedNet"],chop_farm:["log","amount","pairedAmount","minPaired","minStakedLp","slippageBps","deadline"],chop_unfarm:["log","amount","minLogOut","minPairedOut","deadline"],chop_harvest:["log"]};function z(l,o){if(Object.keys(l).some(n=>!o.includes(n)))throw new h("Unexpected Chop argument.");if(o.some(n=>l[n]===void 0))throw new h("Provide every required Chop input.")}async function V(l,o,n){let d=c(o),p=await l.getBlock({blockNumber:BigInt(n.measuredAtBlock)});if(p.number!==BigInt(n.measuredAtBlock)||d<=x(p.timestamp)||d>p.timestamp+1200n)throw new h("Chop deadline must be in the next 20 minutes.");return d}async function D(l,o,n,d){if(z(n,j[o]),y(d),l.network==="testnet")throw new h("Chop requires chain 4663.");let p=y(n.log),u=l.clientFor(4663),i=await S(u,p,o==="chop_wrap"||o==="chop_farm"?"enter":"exit"),s=BigInt(i.measuredAtBlock),f=[],g=[],C=(e,t,a)=>{f.push(q(e.address,t,a.toString(),4663)),g.push(l.approval(e.address,t,a.toString(),4663))},P=(e,t,a)=>{let m={to:e,data:W({abi:N,functionName:t,args:a}),value:"0",chainId:4663,description:`${o} on verified log ${p}.`,...o==="chop_harvest"?{gasLimit:"1000000"}:{}};f.push(m),g.push({...l.unsignedTx(m),...m.gasLimit===void 0?{}:{gasLimit:m.gasLimit}})},A=[],v=(e,t,a=!0)=>A.push({token:e,min:-t,max:a?-t:-1n}),w=(e,t)=>A.push({token:e,min:t}),T=async(e,t)=>{if(x(await $(u,e.address,"balanceOf",[d],s))<t)throw new h("This wallet does not hold enough tokens for the Chop action.")},k;if(o==="chop_wrap"){let e=c(n.amount),t=c(n.minLogOut);if(!_(y(n.underlying),i.underlying.address))throw new h("The underlying token does not match the verified Chop log.");await T(i.underlying,e),C(i.underlying,p,e),P(p,"bond",[i.underlying.address,e,t]),v(i.underlying,e,!1),w(i.log,t),k=`Wrap at most ${e} underlying base units; on-chain minimum ${t} log base units.`}else if(o==="chop_unwrap"){let e=c(n.amount),t=c(n.quotedNet);await T(i.log,e);let a=await M(u,i,d,e);if(BigInt(a.net.amount)<t)throw new h("Chop unwrap no longer meets the quoted net amount. Request a fresh quote.");let m=F(i,e);f.push(m),g.push(l.unsignedTx(m)),v(i.log,e),w(i.underlying,t),k=`Unwrap ${e} log base units; preview must return at least quoted ${t} underlying base units.`}else if(o==="chop_farm"){await L(u,r.helper,s);let e=c(n.amount),t=c(n.pairedAmount),a=c(n.minPaired),m=c(n.minStakedLp),I=await V(u,n.deadline,i),b=n.slippageBps;if(typeof b!="number"||!Number.isInteger(b)||b<0||b>1e3||b%10!==0||a>t)throw new h("Chop LP slippage must be 0\u20131000 basis points in multiples of 10; the paired minimum cannot exceed its input.");await Promise.all([T(i.log,e),T(i.paired,t)]),C(i.log,r.helper.address,e),C(i.paired,r.helper.address,t),P(r.helper.address,"addLPAndStake",[p,e,i.paired.address,t,a,BigInt(b/10),I]),v(i.log,e,!1),A.push({token:i.paired,min:-t,max:-a}),w(i.staking,m),k=`Farm up to ${e} log + ${t} paired base units; slippage ${b} bps; deadline ${I}. Staked LP minimum ${m} is checked in simulation; two-sided token minimums from slippage are enforced on chain. Paired consumption must also meet ${a} base units in the preview. This tool does not zap; the helper's paired minimum alone has no on-chain effect for a direct pair.`}else if(o==="chop_unfarm"){await L(u,r.helper,s);let e=c(n.amount),t=c(n.minLogOut),a=c(n.minPairedOut),m=await V(u,n.deadline,i);if(x(await $(u,i.staking.address,"withdrawableStake",[d],s))<e)throw new h("Chop stake is still locked or too small. Wait at least 10 minutes after staking.");C(i.staking,r.helper.address,e),P(r.helper.address,"unstakeAndRemoveLP",[p,e,t,a,m]),v(i.staking,e),w(i.log,t),w(i.paired,a),k=`Unfarm ${e} staked LP base units; on-chain minimums ${t} log and ${a} paired base units; deadline ${m}.`}else{if(await L(u,r.whitelist,s),await $(u,r.whitelist.address,"paused",[r.chop],s)!==!1)throw new h("Chop rewards are paused or their pause state is unavailable.");let e=x(await $(u,i.rewards,"getClaimable",[r.chop,d],s));if(e===0n)throw new h("No CHOP is claimable now. Rewards may still be inside the 10-minute maturity lock.");P(i.rewards,"claimReward",[d]),w({address:y(r.chop),symbol:"CHOP",decimals:18,chainId:4663},e),k=`Harvest at least ${e} CHOP base units to ${d} in the preview. ${H} Allow at least 1,000,000 gas for this call.`}return(o==="chop_farm"||o==="chop_unfarm")&&!A.some(e=>_(e.token.address,r.chop))&&w({address:y(r.chop),symbol:"CHOP",decimals:18,chainId:4663},0n),O(g,f),{built:g,expected:f,rules:A,details:k,facts:i,log:p}}async function ie(l,o,n,d){let{built:p,expected:u,rules:B,details:i,facts:s,log:f}=await D(l,o,n,d),g=await l.preview(p,d);return O(g.txs,u,!0),U(g,B),{txs:p,preview:g,log:f,measuredAtBlock:s.measuredAtBlock,summary:`${R(s)}
2
- ${i}
3
- Underlying ${s.underlying.address} (decimals ${s.underlying.decimals}); log ${f} (decimals ${s.log.decimals}); paired ${s.paired.address} (decimals ${s.paired.decimals}).`}}export{j as a,z as b,D as c,ie as d};
@@ -1 +0,0 @@
1
- import{c as t}from"./LCH6F5HT.js";import{c as o}from"./W7QNSNOH.js";function s(e,n,a){return t(e,n,a,o)}export{s as a};
@@ -1 +0,0 @@
1
- import{a as N,b as F,e as b,f as i,k as T,m as O,o as B}from"./IZFED3R2.js";import{c as I,e as A}from"./MDLJFCT4.js";import{h as x}from"./BSX4LFYI.js";import{a as o,e as k}from"./XSD5NL7J.js";function u(e,s){if(e.version!==1||e.chainId!==4663||!Object.hasOwn(b,e.kind))throw new o("Invalid FOBO pending action. Nothing further was signed.");if(!Number.isSafeInteger(s)||!Number.isSafeInteger(e.quotedAt)||s<e.quotedAt||s-e.quotedAt>=N)throw new o("This FOBO action expired. Nothing further was signed. Ask for a fresh summary, then say yes or no.")}function w(e,s){return typeof e=="string"&&e.toLowerCase()===s.toLowerCase()}function P(e){if(typeof e!="number"&&typeof e!="string"||!/^\d+$/.test(String(e)))throw new o("FOBO returned an invalid Permit2 nonce.");let s=Number(e);if(!Number.isSafeInteger(s)||s<0||s>=2**48)throw new o("FOBO returned an invalid Permit2 nonce.");return s}function _(e,s,n){let t=i(s),m=i(t.domain),c=i(t.message),p=i(c.details);if(!["buy","sell"].includes(e.kind)||![4663,"0x1237"].includes(m.chainId)||!w(m.verifyingContract,F.permit2)||t.primaryType!=="PermitSingle"||!w(c.spender,F.router)||!w(p.token,e.request._currencyIn)||!e.terms.amountIn)throw new o("FOBO permit does not match the approved token, spender or chain. Nothing further was signed.");return I({token:e.request._currencyIn,amount:BigInt(e.terms.amountIn),nonce:P(p.nonce),now:n})}async function*q(e,s,n){let t=structuredClone(s);u(t,n.now());let m=!1,c,p;try{if(t.kind==="launch"){let a=i(await e.call("sign_in_start",{account:t.wallet}));if(u(t,n.now()),typeof a.message!="string"||typeof a.ticket!="string"||!a.ticket||a.ticket.length>2e3)throw new o("FOBO returned an invalid sign-in ticket. Nothing was signed.");A(a.message,t.wallet,n.now());let f=await n.signMessage(a.message);u(t,n.now());let l=i(await e.call("sign_in_finish",{account:t.wallet,ticket:a.ticket,signature:f}));if(l.success===!1||l.ok===!1||l.isError===!0)throw new o("FOBO sign-in was refused. Nothing further was signed.");yield{kind:"signin",status:"signed"}}for(let a=0;a<4;a++){u(t,n.now());let f={...T(t),...c?{permit:c}:{}},h=a===0&&["limitOrder","cancel","claim"].includes(t.kind)&&typeof t.request._prepared=="string"?O({status:"ready",transactions:JSON.parse(String(t.request._prepared)).map(r=>({...r,from:t.wallet,gas:r.gasLimit}))}):O(await e.call(b[t.kind],f));u(t,n.now());let y=await B(t,h,n.now(),c?.message,n.readContract);if(h.status==="needs_approval"){if(m||c)throw new o("FOBO requested a repeated approval. Nothing further was signed. Ask for a fresh summary.");for(let r of y){u(t,n.now());let d=await n.sendTransaction(r);m=!0,await n.waitForReceipt(d),yield{kind:"approval",hash:d,tx:r,status:"mined"}}continue}if(h.status==="needs_signature"){if(c)throw new o("FOBO requested a repeated permit. Nothing further was signed.");p=_(t,h.typedData,n.now()),u(t,n.now());let r=await n.signTypedData(p);c={message:i(p).message,signature:r},yield{kind:"permit",status:"signed"};continue}if(p){let r=i(i(p).message),d=i(r.details);for(let S of y){let g=x(S.data,["0x0Af57F62982D03066ef917AcAd87F771c06528Ec","0x0000000000000000000000000000000000000000"]).permit;if(!g||!w(g.token,d.token)||g.amount!==BigInt(String(d.amount))||g.nonce!==Number(d.nonce)||g.expiration!==Number(d.expiration)||!w(g.spender,r.spender)||g.sigDeadline!==BigInt(String(r.sigDeadline)))throw new o("FOBO changed the exact signed permit in the swap. Nothing further was signed.")}}for(let r of y){u(t,n.now());let d=await n.sendTransaction(r);await n.waitForReceipt(d),yield{kind:"transaction",hash:d,tx:r,status:"mined"}}return}throw new o("FOBO preparation did not finish. Nothing further was signed. Ask for a fresh summary.")}catch(a){let f=m?" An exact approval was already sent; use oak_cleanup_allowances to review any allowance left.":"";throw new o(`${k(a).replaceAll("Nothing was signed.","Nothing further was signed.")} FOBO execution stopped; nothing further was signed.${f}`)}}export{_ as a,q as b};
@@ -1,6 +0,0 @@
1
- import{e as c}from"./NWNYJ26T.js";import{a as x}from"./XSD5NL7J.js";import{a as C}from"./JXOEJPJ4.js";var E="https://mcp.fobo.fun/mcp",k="2025-03-26",A=4*1024*1024,n=d=>new x(`FOBO ${d}. Nothing was signed. Please try again.`);function z(d={}){let O=d.fetch??globalThis.fetch,y=d.endpoint??E,b=d.timeoutMs??3e4;if(!Number.isSafeInteger(b)||b<=0)throw n("timeout must be a positive number of milliseconds");let s,i=k,P=0,u=!1,o,e=new Set;async function w(r,l,m,h="POST",f=!1){let t=new AbortController;e.add(t);let v,p=++P,S=new Promise((g,a)=>{v=setTimeout(()=>{a(n("request timed out")),t.abort()},b)});try{return await Promise.race([S,(async()=>{let g={"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":i};m&&(g["Mcp-Session-Id"]=m);let a=await O(y,{method:h,headers:g,signal:t.signal,...h==="POST"?{body:JSON.stringify({jsonrpc:"2.0",...f?{}:{id:p},method:r,params:l})}:{}});if(h==="DELETE"&&(a.ok||a.status===405||a.status===404))return{};if(f){if(!a.ok)throw n("session initialization was refused");return await a.body?.cancel(),{}}let R=await M(a,p);if(!a.ok&&R.error?.code!==-32e3)throw n("service is unavailable");return{rpc:R,session:a.headers.get("Mcp-Session-Id")??void 0}})()])}catch(g){throw g instanceof x?g:n("could not be reached")}finally{clearTimeout(v),e.delete(t),t.abort()}}async function T(){if(u)throw n("client is closed");s||(o||(o=(async()=>{let r=await w("initialize",{protocolVersion:k,capabilities:{},clientInfo:{name:"oak",version:"0.3.3"}});if(r.rpc?.error||!r.session||!c(r.rpc?.result))throw n("did not provide an MCP session");let l=r.rpc.result.protocolVersion;if(typeof l=="string"){if(!["2025-03-26","2025-06-18","2025-11-25"].includes(l))throw n("MCP protocol version is unsupported");i=l}if(u)throw n("client is closed");await w("notifications/initialized",{},r.session,"POST",!0),s=r.session})().finally(()=>{o=void 0})),await o)}return{async call(r,l){await T();for(let m=0;m<2;m++){if(u)throw n("client is closed");let h=s,{rpc:f}=await w("tools/call",{name:r,arguments:l},h);if(f?.error?.code===-32e3){if(m===1)throw n("session expired");s===h&&(s=void 0),await T();continue}if(!f||f.error)throw n("request was refused");let t=f.result;if(c(t)&&t.isError===!0){let v=Array.isArray(t.content)?t.content.filter(c).filter(p=>p.type==="text"&&typeof p.text=="string").map(p=>p.text).join(" "):"";throw new x(`FOBO refused the request: ${C(v||"The tool returned an error.")}. Nothing was signed. Ask for a fresh summary.`)}if(c(t)&&c(t.structuredContent))return t.structuredContent;if(c(t)&&"content"in t){if(!Array.isArray(t.content)||t.content.length!==1||!c(t.content[0])||t.content[0].type!=="text"||typeof t.content[0].text!="string")throw n("returned an unsupported tool answer");try{return JSON.parse(t.content[0].text)}catch{throw n("returned an unreadable tool answer")}}return t}throw n("session expired")},async close(){if(u)return;u=!0;for(let l of e)l.abort();let r=s;s=void 0,r&&await w("",{},r,"DELETE")}}}async function M(d,O){let y=d.body?.getReader();if(!y)throw n("returned an empty response");let b=new TextDecoder,s=d.headers.get("Content-Type")?.includes("text/event-stream"),i="",P=0,u=o=>{let e;try{e=JSON.parse(o)}catch{throw n("returned an unreadable response")}if(!c(e)||e.jsonrpc!=="2.0")throw n("returned an invalid response");if(!(s&&!("id"in e)&&typeof e.method=="string")){if(e.id!==O||"result"in e=="error"in e||"error"in e&&(!c(e.error)||typeof e.error.code!="number"))throw n("returned an invalid response");return e}};try{for(;;){let o=await y.read();if(P+=o.value?.length??0,P>A)throw n("response is too large");if(i+=b.decode(o.value,{stream:!o.done}),s){i=i.replace(/\r\n/g,`
2
- `);let e;for(;(e=i.indexOf(`
3
-
4
- `))!==-1;){let w=i.slice(0,e);i=i.slice(e+2);let T=w.split(`
5
- `).filter(r=>r.startsWith("data:")).map(r=>r.slice(5).replace(/^ /,"")).join(`
6
- `);if(T){let r=u(T);if(r)return r}}}else if(o.done){let e=u(i);if(e)return e}if(o.done)throw n("returned an incomplete response")}}finally{await y.cancel().catch(()=>{})}}export{z as a};
@@ -1 +0,0 @@
1
- var a={partner:"Factor is an official Oak partner. Factor's own team runs its product and contracts; Oak didn't build them and doesn't run them.",trust:"Factor's desk contract has no owner, and its rules are fixed in its code. Factor's website and API are run by Factor and can lag the chain.",fees:"An advance costs a 1% fee taken from the advance, paid to Factor's burn pot contract. A settled job pays Factor's 2% job fee from the agent's payout.",half:"At most half of a job's price can be advanced before delivery.",poolBar:"If a job you drew on isn't delivered within 12 hours after its due time, anyone can refund it, and this wallet can never draw from Factor's pool again.",decline:"You can decline a job only before drawing on it. A rejected job settles at half, with no appeal.",payLink:"A signed pay link can't be revoked; anyone holding it can pay it until it expires.",names:"Names are first come, and a fixed-price application can't be withdrawn.",privateWork:"Your work text stays on this computer; only its fingerprint (a hash) goes on chain.",publicWork:"Your work text will be public on Factor's job page and can't be edited.",walletCode:"This wallet has contract code, so Factor would hold its payouts until they are collected, which Oak can't do yet. Nothing was sent.",compute:"Oak doesn't send compute advances: that ETH goes to Factor's gateway as off-chain credit Oak can't check. Nothing was sent.",lineAccount:"This wallet uses a Factor credit line, which Oak doesn't support yet. Nothing was sent.",offers:"This Factor job takes offers, which Oak can't send yet. Nothing was signed.",deskOnly:"Desk figures only; jobs and limits held through a Factor credit line are not shown.",stateMismatch:"Factor's site names a different desk than the one Oak checked on chain. Nothing was signed or sent.",stateUnavailable:"Factor's site isn't answering, so Oak can't date this message. Nothing was signed.",apiLabel:"Factor API (can lag the chain)"},e={factor_sign_up:`Register this wallet as a Factor agent on Robinhood Chain, then sign its public profile with a name and description. Gas for registration; identity, active plan and human confirmation required. ${a.partner} ${a.trust} ${a.names}`,factor_create_pay_link:`Sign a pay link for a fixed-price ETH job on Robinhood Chain. Price is a wei string; expiry is 1-30 days. No payment now; a customer pays later. Identity, active plan and human confirmation required. ${a.payLink} ${a.half} ${a.fees}`,factor_apply_to_job:`Sign an application for a fixed-price Factor open job. Identity, active plan and human confirmation required. ${a.offers} ${a.names}`,factor_draw:`Draw an early or pool advance to this wallet on Robinhood Chain, with amount in integer wei. Identity, active plan and human confirmation required. ${a.half} ${a.fees} ${a.poolBar} ${a.compute}`,factor_deliver:`Deliver a work fingerprint on Robinhood Chain. Show defaults to false; public posting follows successful delivery only when requested. Identity, active plan and human confirmation required. ${a.privateWork} With show true: ${a.publicWork}`,factor_decline:`Decline a Factor job on Robinhood Chain and return its price to the customer. Identity, active plan and human confirmation required. ${a.decline}`,factor_job:`Read a Factor job and its public details from the ${a.apiLabel}. API data does not authorize an action. No identity or plan required.`,factor_can_draw:`Read the desk's early and pool advance amounts in wei on Robinhood Chain; these amounts share the same half-price cap. No identity or plan required. ${a.deskOnly}`,factor_my_jobs:`Read at most 50 Factor jobs for this wallet as agent or customer from the ${a.apiLabel}. No identity or plan required. ${a.deskOnly}`,factor_open_jobs:`Read at most 25 Factor open-job listings from the ${a.apiLabel}. Filter by this wallet or verified owners when requested. No identity or plan required.`,factor_open_job:`Read a Factor open-job listing and public application details from the ${a.apiLabel}. No identity or plan required.`};export{a,e as b};
@@ -1,2 +0,0 @@
1
- import{a as r}from"./L2AE32SL.js";import{formatUnits as c}from"viem";var s="Oak x Chop. Chop's own team runs its product and contracts; Oak didn't build them and doesn't run them.",i="Chop's upgrade key can replace log code without a timelock.",u="Chop's unwrap has no on-chain minimum output. Oak checks the simulated net output, but the contract itself will not stop a worse result if state moves before inclusion.",p="Farming pairs tokens 50/50 with impermanent loss and pays in $CHOP, which can fall in price or be paused by Chop. Stake and newly earned rewards can be locked for 10 minutes.",y=[s,i,u,p],g="Wrapping $OAK moves it out of your wallet. If you are on Oak's Holder plan and your wallet balance drops below your signup amount, Oak's action tools pause until you unwrap or top up.",k="Oak checks that CHOP actually reached your wallet; a successful transaction alone does not prove a payout.",l=e=>(e.bond+e.debond)/100;function m(e){return`Wrap fee ${e.fees.bond/100}%; unwrap fee ${e.fees.debond/100}%. A short round trip loses about ${l(e.fees)}%. Caller exemptions and rounding can change the actual fee.`}function $(e){return[s,i,m(e),u,p,...e.underlying.address.toLowerCase()===r.oak.toLowerCase()?[g]:[],...e.drift.length?[`Warning: Chop code changed since Oak checked it (${e.drift.join(", ")}). New wraps and farms are refused; this exit uses the changed code.`]:[]].join(`
2
- `)}function f(e){let o=e.underlying.symbol;return[`A log is a wrapped version of one token. You hand in ${o} and receive a log token that stays worth a share of the ${o} the log holds.`,"You can earn two ways: the log's backing can grow from other people's trading fees, and you can farm the log for CHOP rewards. Neither is a promised rate.",`Getting in and out costs about ${l(e.fees)}% together: the wrap fee plus the unwrap fee. Other fees set by the log can also apply.`,"The biggest risk: Chop's team holds a key that can replace the log's code at any time, with no waiting period."].join(" ")}function C(e,o,n,t){let a=o.usdEstimate===null?`price unavailable: ${o.estimateReason}`:`$${o.usdEstimate}, estimate, not a quote`,d=n.usdEstimate===null?"The pool's full USD depth has price unavailable; each reserve shows its amount and available estimate.":`The pool holds about $${n.usdEstimate} (estimate, not a quote).`,h=t.pct===null?`A rough $100 price move is unavailable: ${t.reason}.`:`A rough $100 trade using ${t.inputToken.symbol} to buy the log would move its price about ${t.pct}%.`;return[f(e),`This farm's whole CHOP reward pot is about ${o.humanAmount} CHOP (${a}). Oak can't read a reward rate, so it shows no yield.`,d,h,t.assumptions].join(" ")}var x=e=>`You hold 0 ${e}, so there is nothing to unwrap. Unwrapping needs a balance of that log. Nothing was signed.`;function O(e,o,n){let t=a=>c(a,e.decimals);return`You asked to unwrap ${t(o)} ${e.symbol} but hold ${t(n)} ${e.symbol}. Ask for ${t(n)} or less ("${n}" in base units).`}export{s as a,i as b,u as c,p as d,y as e,g as f,k as g,l as h,m as i,$ as j,f as k,C as l,x as m,O as n};
@@ -1 +0,0 @@
1
- import{a as $e,b as Ee}from"./YEIM6BZQ.js";import{c as en,d as nn,e as _e,f as he,i as Ue,j as tn}from"./RA7DOR7F.js";import{k as de}from"./NV6FDIYT.js";import{b as Te,o as Me}from"./GYPMUYB5.js";import{a as ce}from"./Z7FGEWO2.js";import{a as T,b as Je}from"./43LI5NKJ.js";import{a as L}from"./66F5ZH34.js";import{b as K}from"./IX3GZMTM.js";import{b as y,e as Ze,j as Q,k as Ye,n as Qe}from"./TI727O2H.js";import{a as o,b as Ge,e as oe}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as re,erc20Abi as on,getAddress as w,isAddress as Nn,keccak256 as Kn,pad as Hn,parseAbi as Ae,parseAbiParameters as z,toEventSelector as Fn,toHex as rn}from"viem";var Vn=w(Q[4663].uniswap.v4_pool_manager.address),M=w(Q[4663].uniswap.v4_position_manager.address),le=w(Q[4663].uniswap.v4_state_view.address),He=w(Q[4663].uniswap.permit2.address),At=w(Q[4663].ponsTrade.universal_router.address),se=w(Q[4663].uniswap.WETH.address),D=w(Ye),k="0x0000000000000000000000000000000000000000",Xe=8388608,Fe=-887272,ve=887272,An=(1n<<48n)-1n,J=(1n<<128n)-1n,Bn=(1n<<160n)-1n,pe=1n<<96n,sn="V4 deposits use limits, not minimums: set amount0Max and amount1Max, and for more room for price movement set slippageBps (at most 500 = 5%).",an=1800n,me=50n,cn=(e,n=me)=>e*(10000n-n)/10000n,dn=(e,n,i=me)=>{let r=(e*(10000n+i)+9999n)/10000n;return r<n?r:n},Xn="0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",Ve=class extends o{name="PonsHookRefusal";token;constructor(n){let i=n===void 0?void 0:w(n),r=i?`To buy, use pons_buy {"token":"${i}","amountIn":"<ETH in wei>"}. To sell, use pons_sell {"token":"${i}","amountIn":"<token base units>"}.`:"For this custom pair, check the launch token and pairToken with pons_status, then use pons_buy or pons_sell with those addresses and amounts in the input token's base units.";super(`Oak's Uniswap tools don't quote this pool. Its hook is Pons's own trading hook, so Oak trades it only through Pons. ${r} Pons shows the exact fees before you approve.`),this.token=i}},Oe=[{poolId:"0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",key:{currency0:k,currency1:D,fee:8388608,tickSpacing:10,hooks:w("0x06a889870c8f83640d6816319f72e2aa579b6080")},liquidity:"5532026605872066941",sqrtPriceX96:"3839897026469220985301794",tick:-198703,protocolFee:0,lpFee:0},{poolId:"0x387bf619da4d3fb62bb276482693dba1b9b3520f573cabdfe033384a24125982",key:{currency0:k,currency1:D,fee:500,tickSpacing:10,hooks:k},liquidity:"225820987949255613",sqrtPriceX96:"3840577772610961024680304",tick:-198700,protocolFee:512125,lpFee:500},{poolId:"0x54f7883914619af9105355bf83ed678bcf9f63560218ac61c9963b9503d0ba32",key:{currency0:k,currency1:D,fee:460,tickSpacing:9,hooks:k},liquidity:"85654324417347171",sqrtPriceX96:"3840419018843648722761192",tick:-198701,protocolFee:479349,lpFee:460},{poolId:"0xc7b615a3721594f73664eb3f62d8290d0fcc8d9d1156aed1ddecbd7f32efd9f5",key:{currency0:k,currency1:D,fee:8388608,tickSpacing:10,hooks:w("0xcb787a5cdea8b3715d984d82f1203fd7bfebe0c4")},liquidity:"50517446454827887",sqrtPriceX96:"3840495145865430860317598",tick:-198700,protocolFee:0,lpFee:0},{poolId:"0x24107d152f14a76d292123265ae3f3c71f863fc2f4ef7ba49d64e78d28ea379e",key:{currency0:k,currency1:D,fee:100,tickSpacing:1,hooks:k},liquidity:"36478878201789434",sqrtPriceX96:"3840363370720475418748563",tick:-198701,protocolFee:102425,lpFee:100},{poolId:"0x84bd4e2d8be11aeb0afc1195b38f587b61e90068548f1063fdbe448fb8cad0b6",key:{currency0:se,currency1:D,fee:200,tickSpacing:4,hooks:k},liquidity:"5980655057479791",sqrtPriceX96:"3839891926195366283625355",tick:-198703,protocolFee:213044,lpFee:200},{poolId:"0x3b0cbf0603ecc67b5fc9bb4fbb6ac9e08d3b2f406b63d1662a36063a7fe5e866",key:{currency0:k,currency1:D,fee:87,tickSpacing:1,hooks:k},liquidity:"5486760264498148",sqrtPriceX96:"3840563617639470134132117",tick:-198700,protocolFee:90134,lpFee:87}],Re=w("0x987e330f00b79864a07fe81dfac344d0078abcc0"),Sn="0xa791e5169faf703c0b63fd9552c33ec1128a773a00f5dc33a640da62a022cd35",On={currency0:k,currency1:D,fee:Xe,tickSpacing:1,hooks:Re},Rn=new Set([...Oe.map(e=>e.key.hooks.toLowerCase()),Re.toLowerCase()]),zn=z("address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks"),jn=z("(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, int24 tickLower, int24 tickUpper, uint256 liquidity, uint128 amount0Max, uint128 amount1Max, address owner, bytes hookData"),Wn=z("address currency0, address currency1"),Gn=z("address currency, address recipient"),ge=z("uint256 tokenId, uint256 liquidity, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Zn=z("uint256 tokenId, uint128 amount0Min, uint128 amount1Min, bytes hookData"),De=z("address currency0, address currency1, address recipient"),ue=z("bytes actions, bytes[] params"),X=Ae(["function modifyLiquidities(bytes unlockData, uint256 deadline) payable","function poolKeys(bytes25 poolId) view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)","function getPositionLiquidity(uint256 tokenId) view returns (uint128 liquidity)","function getPoolAndPositionInfo(uint256 tokenId) view returns ((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, uint256 info)","function positionInfo(uint256 tokenId) view returns (uint256 info)","function ownerOf(uint256 tokenId) view returns (address owner)","function nextTokenId() view returns (uint256 tokenId)"]),Yn=Ae(["function initialize((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint160 sqrtPriceX96) returns (int24 tick)"]),un=z("address currency"),pn=1e6,fe=Ae(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Qn=Ae(["function approve(address token, address spender, uint160 amount, uint48 expiration)"]),Jn=Fn("Transfer(address,address,uint256)");function xe(e){if(typeof e!="string"||!Nn(e,{strict:!1}))throw new o("Provide a valid v4 currency address.");let n=e.toLowerCase();return n===k||n===ce.toLowerCase()?k:w(e)}function H(e){let n=e.toLowerCase();return n===k||n===ce.toLowerCase()}function ye(e){let n=xe(e.currency0),i=xe(e.currency1);T(e.hooks);let r=w(e.hooks);return Kn(S(zn,[n,i,e.fee,e.tickSpacing,r]))}function In(e){return((typeof e=="number"?e:e.fee)&Xe)!==0}function ln(e,n){return In(e)?{dynamicFee:!0,storedLpFee:n,swapsAreFree:!1,feeNote:Ee(e,n)}:{dynamicFee:!1,storedLpFee:n,swapsAreFree:n===0,feeNote:Ee(e,n)}}function ke(e,n){if(!e||typeof e!="object")throw new o("Provide a valid v4 PoolKey.");let i=xe(e.currency0),r=xe(e.currency1);if(BigInt(i)>=BigInt(r))throw new o("PoolKey currencies must be strictly sorted (currency0 < currency1).");if(!Number.isInteger(e.tickSpacing)||e.tickSpacing<=0||e.tickSpacing>32767)throw new o("PoolKey tickSpacing must be a positive integer.");if(!Number.isInteger(e.fee)||e.fee<0||e.fee>16777215)throw new o("PoolKey fee must be a valid uint24.");T(e.hooks);let c=w(e.hooks),s=In(e.fee);if(!s&&e.fee>pn)throw new o(`PoolKey static fee ${$e(e.fee)} exceeds the v4 maximum of ${$e(pn)}.`);if(s&&e.fee!==Xe)throw new o("Dynamic-fee PoolKey must use exact fee flag 0x800000 (8388608).");if(s&&c.toLowerCase()===k)throw new o("Dynamic-fee PoolKey requires a non-zero hook address.");if(!Rn.has(c.toLowerCase()))throw c.toLowerCase()===Qe.toLowerCase()?new Ve(i===k?r:void 0):new o(`Unsupported v4 hook ${c}: Oak does not assure arbitrary v4 hooks outside measured PoolKeys.`);let t={currency0:i,currency1:r,fee:e.fee,tickSpacing:e.tickSpacing,hooks:c},d=ye(t);if(c===Re&&d.toLowerCase()!==Sn)throw new o("Only the documented VolatilePair ETH/USDG PoolKey is supported. Pool creation requires the Uniswap Labs role.");if(n!==void 0){if(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))throw new o("Provide a 32-byte hex poolId.");if(d.toLowerCase()!==n.toLowerCase())throw new o(`PoolKey hash (${d}) does not match expected poolId (${n}).`)}return t}function et(e){if(!Number.isInteger(e)||e<=0||e>ve)throw new o("tickSpacing must be a positive integer.");let n=Math.trunc(Fe/e)*e,i=Math.trunc(ve/e)*e;return{tickLower:n===0?0:n,tickUpper:i===0?0:i}}function nt(e,n,i){if(!Number.isInteger(i)||i<=0)throw new o("tickSpacing must be a positive integer.");if(!Number.isInteger(e)||!Number.isInteger(n))throw new o("tickLower and tickUpper must be integers.");if(e<Fe||n>ve)throw new o(`Ticks [${e}, ${n}] are outside Uniswap bounds [${Fe}, ${ve}].`);if(e>=n)throw new o("tickLower must be strictly less than tickUpper.");if(e%i!==0||n%i!==0)throw new o(`Ticks [${e}, ${n}] must be divisible by tickSpacing ${i}.`)}function mn(e,n,i,r,c=y){if(T(e),T(n),H(e))throw new o("Native ETH does not use Permit2 approval.");let s=K(i);if(s<=0n||s>Bn)throw new o("Permit2 approval amount must be a positive integer within uint160.");let t=K(String(r));if(t<=0n||t>An)throw new o("Permit2 expiration must be a positive timestamp within uint48.");let d=re({abi:Qn,functionName:"approve",args:[e,n,s,Number(t)]});return Je({to:He,data:d,value:"0",chainId:c,description:`Approve Permit2 allowance of ${s} base units of ${e} for ${n} until ${t}.`})}function fn(e){let n=Number(e&0xffffffn);return(n&8388608)!==0?n-16777216:n}function tt(e){let n=(e&0xffn)!==0n,i=fn(e>>8n&0xffffffn),r=fn(e>>32n&0xffffffn);return{poolIdBytes25:`0x${(e>>56n&(1n<<200n)-1n).toString(16).padStart(50,"0")}`,tickLower:i,tickUpper:r,hasSubscriber:n}}function yn(e,n,i,r=!1){let[c,s]=e<=n?[e,n]:[n,e];if(c<=0n||s<=0n)return 0n;let t=(i<<96n)*(s-c),d=s*c;return r?(t+d-1n)/d:t/d}function wn(e,n,i,r=!1){let[c,s]=e<=n?[e,n]:[n,e],t=i*(s-c);return r?(t+pe-1n)/pe:t/pe}function Cn(e){if(e.liquidity<=0n)return{amount0:0n,amount1:0n};let n=de(e.tickLower),i=de(e.tickUpper);return e.sqrtPriceX96<=n?{amount0:yn(n,i,e.liquidity,e.roundUp),amount1:0n}:e.sqrtPriceX96<i?{amount0:yn(e.sqrtPriceX96,i,e.liquidity,e.roundUp),amount1:wn(n,e.sqrtPriceX96,e.liquidity,e.roundUp)}:{amount0:0n,amount1:wn(n,i,e.liquidity,e.roundUp)}}function it(e){let n=de(e.tickLower),i=de(e.tickUpper),r=(s,t,d)=>t<=s||d<=0n?0n:d*s*t/pe/(t-s),c=(s,t,d)=>t<=s||d<=0n?0n:d*pe/(t-s);if(e.sqrtPriceX96<=n)return r(n,i,e.amount0);if(e.sqrtPriceX96<i){let s=r(e.sqrtPriceX96,i,e.amount0),t=c(n,e.sqrtPriceX96,e.amount1);return s<t?s:t}return c(n,i,e.amount1)}function Ne(e,n){return e.map(i=>{let r=i.amount.trim(),c=r.startsWith("-"),s=c||r.startsWith("+")?r.slice(1):r,t=n(s,i.token.decimals);return`${c?"-":""}${t} ${i.token.symbol}`})}function bn(e,n=y){if(H(e))return{address:ce,symbol:"ETH",decimals:18,chainId:n};let i=w(e);return i.toLowerCase()===D.toLowerCase()?{address:D,symbol:"USDG",decimals:Ze,chainId:n}:i.toLowerCase()===se.toLowerCase()?{address:se,symbol:"WETH",decimals:18,chainId:n}:{address:i,symbol:i.slice(0,10),decimals:18,chainId:n}}async function B(e,n,i=y){if(H(n))return bn(n,i);let r=w(n);if(r.toLowerCase()===D.toLowerCase()||r.toLowerCase()===se.toLowerCase())return bn(r,i);let[c,s]=await Promise.all([e.readContract({address:r,abi:on,functionName:"symbol"}),e.readContract({address:r,abi:on,functionName:"decimals"})]);if(!Number.isInteger(Number(s))||Number(s)<0||Number(s)>77)throw new o(`Token ${r} reports invalid decimals.`);return{address:r,symbol:tn(c,r),decimals:Number(s),chainId:i}}function Z(e,n){if(typeof e!="string"||!/^\d+$/.test(e))throw new o(`${n} must be a non-negative integer string in base units.`);return K(e)}function hn(e,n,i,r){let c=e===void 0?K(Me(n.toString(),i)):Z(e,r);if(c<=1n||c>J)throw new o(`${r} must exceed 1 base unit and fit in uint128; the simulated amount may be too small.`);return c}async function qn(e,n){if(typeof n=="number"&&Number.isFinite(n)&&n>0)return BigInt(Math.floor(n>1e11?n/1e3:n));if(typeof n=="string"&&/^\d+$/.test(n.trim()))return BigInt(n.trim());try{let i=await e.request({method:"eth_getBlockByNumber",params:["latest",!1]});if(i&&typeof i.timestamp=="string")return BigInt(i.timestamp)}catch{}return BigInt(Math.floor(Date.now()/1e3))}async function Ke(e,n,i){let r=await qn(e,i);if(n==null)return r+1800n;let c=K(String(n));if(c<=r)throw new o(`Transaction deadline ${c} has expired (current timestamp ${r}).`);return c}async function Be(e,n){let i=typeof n.poolId=="string"?n.poolId.trim():void 0,r=n.poolKey&&typeof n.poolKey=="object"&&!Array.isArray(n.poolKey)?n.poolKey:void 0,c=r?{currency0:String(r.currency0??k),currency1:String(r.currency1??D),fee:Number(r.fee),tickSpacing:Number(r.tickSpacing),hooks:String(r.hooks??k)}:n.currency0!==void 0&&n.currency1!==void 0&&n.fee!==void 0&&n.tickSpacing!==void 0?{currency0:String(n.currency0),currency1:String(n.currency1),fee:Number(n.fee),tickSpacing:Number(n.tickSpacing),hooks:String(n.hooks??k)}:void 0;if(c){if(H(c.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===se.toLowerCase())throw new o("Native ETH currency0 differs from WETH; do not supply WETH for a native-ETH v4 pool.");let u=ke(c,i);return{poolId:ye(u),poolKey:u}}let s=(i??Xn).toLowerCase();if(s===Sn)return{poolId:s,poolKey:ke(On,s)};let t=Oe.find(u=>u.poolId.toLowerCase()===s);if(t){if(H(t.key.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===se.toLowerCase())throw new o("Native ETH currency0 differs from WETH; do not supply WETH for a native-ETH v4 pool.");return{poolId:t.poolId,poolKey:t.key}}let d=s.slice(0,52),a=await e.readContract({address:M,abi:X,functionName:"poolKeys",args:[d]}),[p,l,m,f,P]=a;if(p.toLowerCase()===k&&l.toLowerCase()===k&&Number(f)===0)throw new o(`Unknown or uninitialized v4 poolId ${s}.`);let b=ke({currency0:p,currency1:l,fee:Number(m),tickSpacing:Number(f),hooks:P},s);return{poolId:s,poolKey:b}}async function Pe(e,n,i){try{let[r,c]=await e.readContract({address:M,abi:X,functionName:"getPoolAndPositionInfo",args:[n]}),s=ke({currency0:r.currency0,currency1:r.currency1,fee:Number(r.fee),tickSpacing:Number(r.tickSpacing),hooks:r.hooks});if((i.poolKey||i.poolId)&&(await Be(e,i)).poolId.toLowerCase()!==ye(s).toLowerCase())throw new o("The supplied PoolKey does not match this v4 position.");let t=tt(BigInt(c));return{poolKey:s,poolId:ye(s),tickLower:t.tickLower,tickUpper:t.tickUpper}}catch(r){throw new o(`Could not read v4 position #${n}. ${oe(r)}`)}}function ot(e){if(typeof e!="string")throw new o("wallet must be a valid 20-byte hex address.");return T(e),w(e)}async function gn(e,n,i={}){T(n);let r=w(n),c=e.clientFor(y),s=new Set;if(i.tokenIds)for(let d of i.tokenIds)s.add(K(String(d)).toString());if(!i.tokenIds?.length)try{let d=await c.getBlockNumber(),a=10000000n;for(let p=0n;p<=d;p+=a){let l=p+a-1n<d?p+a-1n:d,m=await c.request({method:"eth_getLogs",params:[{address:M.toLowerCase(),topics:[Jn,null,Hn(r)],fromBlock:rn(p),toBlock:rn(l)}]});if(!Array.isArray(m))throw new o("Invalid v4 position log response.");for(let f of m){if(!Array.isArray(f.topics)||f.topics.length!==4||!/^0x[0-9a-fA-F]{64}$/.test(f.topics[3]??""))throw new o("Invalid v4 position transfer log.");s.add(BigInt(f.topics[3]).toString())}}}catch(d){if(!i.tokenIds)throw new o(`Could not discover v4 positions. ${oe(d)}`)}let t=[];for(let d of s){let a=BigInt(d);try{let p;try{p=await c.readContract({address:M,abi:X,functionName:"ownerOf",args:[a]})}catch(F){if(Ge(F,3))continue;throw F}if(p.toLowerCase()!==r.toLowerCase())continue;let l=await c.readContract({address:M,abi:X,functionName:"getPositionLiquidity",args:[a]}),m=BigInt(l);if(m===0n&&!i.includeZero)continue;let{poolKey:f,poolId:P,tickLower:b,tickUpper:u}=await Pe(c,a,{}),v=await c.readContract({address:le,abi:fe,functionName:"getSlot0",args:[P]}),x=BigInt(v[0]),{amount0:h,amount1:g}=Cn({liquidity:m,tickLower:b,tickUpper:u,sqrtPriceX96:x}),[A,I]=await Promise.all([B(c,f.currency0,y),B(c,f.currency1,y)]);t.push({module:"uniswap",id:`uniswap:v4:${a.toString()}`,chainId:y,assets:[{token:A,amount:h.toString()},{token:I,amount:g.toString()}],description:`Uniswap v4 LP position #${a.toString()} (${A.symbol}/${I.symbol}, liquidity=${m.toString()}, ticks=[${b},${u}], poolId=${P})`})}catch(p){throw new o(`Could not read v4 position #${a}. ${oe(p)}`)}}return t}var rt={type:"object",properties:{version:{description:"Uniswap v4 PoolManager version.",type:"string",enum:["v4"]},poolId:{type:"string",description:"32-byte Uniswap v4 poolId hex string."},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object",properties:{currency0:{description:"Lower sorted currency address; the zero address means native ETH.",type:"string"},currency1:{description:"Higher sorted currency address.",type:"string"},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"number"},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"number"},hooks:{description:"Hook contract address; the zero address means no hook.",type:"string"}}},currency0:{description:"Lower sorted currency address; the zero address means native ETH.",type:"string"},currency1:{description:"Higher sorted currency address.",type:"string"},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"number"},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"number"},hooks:{description:"Hook contract address; the zero address means no hook.",type:"string"},tickLower:{description:"Lower tick boundary, divisible by the pool tick spacing.",type:"number"},tickUpper:{description:"Upper tick boundary, divisible by the pool tick spacing.",type:"number"},fullRange:{description:"Use the widest tick range aligned to the pool tick spacing; omit explicit ticks.",type:"boolean"},liquidity:L('Position liquidity in protocol base units. Example: "1000" = 1000 liquidity units.'),amount0Max:L('Maximum amount of currency0 in base units; use currency0 decimals. Example: "1000000" = 1 currency0 at 6 decimals.'),amount1Max:L('Maximum amount of currency1 in base units; use currency1 decimals. Example: "1000000" = 1 currency1 at 6 decimals.'),recipient:{description:"Recipient address; must be the signing wallet.",type:"string"},deadline:L("Transaction deadline in Unix seconds, after the current block timestamp. Example: 1800000000."),permit2Expiration:{description:'Permit2 allowance expiry in Unix seconds, as a decimal string. Example: "1800000000".',type:"string"},exactCaps:{description:"Use both caller caps exactly for a new v4 mint; omit tokenId, initialPrice and sqrtPriceX96.",type:"boolean"},slippageBps:{description:"Mint cap headroom in basis points (50 = 0.5%), up to 500 (5%); unavailable when increasing an existing NFT.",type:"integer",minimum:0,maximum:500,default:Number(me)},hookData:{description:"Hex-encoded hook call data; only data supported by the measured hook is accepted.",type:"string"},tokenId:L('Existing v4 position NFT identifier to increase, as a decimal string; keeps its tick range. Omit to mint a new position. Example: "1".'),initialPrice:{type:"string",description:"Starting price as token1 per one token0 in human units; used only for a new pool. Pool creation and the first liquidity add require separate confirmations."},sqrtPriceX96:{type:"string",description:"Alternative starting price: square root of the token1/token0 base-unit price ratio, multiplied by 2^96, as a decimal string."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 basis points (5%) from other live pools of the pair."}}},st={type:"object",description:"Create and initialize an empty Uniswap v4 pool (permissionless PoolManager.initialize). Add liquidity afterwards with uniswap_add.",properties:{version:{description:"Uniswap v4 PoolManager version.",type:"string",enum:["v4"]},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object",properties:{currency0:{description:"Lower sorted currency address; the zero address means native ETH.",type:"string"},currency1:{description:"Higher sorted currency address.",type:"string"},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"number"},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"number"},hooks:{description:"Hook contract address; the zero address means no hook.",type:"string"}}},currency0:{type:"string",description:"Lower sorted currency; the zero address is native ETH."},currency1:{description:"Higher sorted currency address.",type:"string"},fee:{type:"number",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"number"},hooks:{type:"string",description:"Hook address; only hooks Oak has measured are accepted. Defaults to none."},initialPrice:{type:"string",description:"Starting pool price as token1 per one token0 in human units. Add liquidity separately after initialization."},sqrtPriceX96:{type:"string",description:"Alternative starting price: square root of the token1/token0 base-unit price ratio, multiplied by 2^96, as a decimal string."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 basis points (5%) from other live pools of the pair."}}},at={type:"object",properties:{version:{description:"Uniswap v4 PoolManager version.",type:"string",enum:["v4"]},tokenId:L('Identifier of the position NFT, as a decimal string. Example: "1".'),poolId:{description:"Identifier of the v4 pool, as a 32-byte hex string.",type:"string"},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object"},amount0Min:L('Minimum amount of currency0 in base units; use currency0 decimals. Example: "1000000" = 1 currency0 at 6 decimals.'),amount1Min:L('Minimum amount of currency1 in base units; use currency1 decimals. Example: "1000000" = 1 currency1 at 6 decimals.'),recipient:{description:"Recipient address; must be the signing wallet.",type:"string"},deadline:L("Transaction deadline in Unix seconds, after the current block timestamp. Example: 1800000000."),hookData:{description:"Hex-encoded hook call data; only data supported by the measured hook is accepted.",type:"string"}},required:["tokenId"]},ct={type:"object",properties:{version:{description:"Uniswap v4 PoolManager version.",type:"string",enum:["v4"]},tokenId:L('Identifier of the position NFT, as a decimal string. Example: "1".'),liquidity:{type:"string",pattern:"^(?:[0-9]+|all)$",description:'Liquidity in protocol base units, or "all" for a full exit where supported; not a token amount. Example: "1000" = 1000 liquidity units.'},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999,default:Te},fullExit:{description:"Remove all position liquidity and collect the proceeds.",type:"boolean"},burn:{description:"Burn the position NFT after all liquidity and owed tokens have been removed.",type:"boolean"},amount0Min:L('Minimum amount of currency0 in base units; use currency0 decimals. Example: "1000000" = 1 currency0 at 6 decimals.'),amount1Min:L('Minimum amount of currency1 in base units; use currency1 decimals. Example: "1000000" = 1 currency1 at 6 decimals.'),poolId:{description:"Identifier of the v4 pool, as a 32-byte hex string.",type:"string"},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object"},recipient:{description:"Recipient address; must be the signing wallet.",type:"string"},deadline:L("Transaction deadline in Unix seconds, after the current block timestamp. Example: 1800000000."),hookData:{description:"Hex-encoded hook call data; only data supported by the measured hook is accepted.",type:"string"}},required:["tokenId"]},dt={type:"object",properties:{version:{description:"Uniswap v4 PoolManager version.",type:"string",enum:["v4"]},tokenIds:{description:'Position NFT identifiers as decimal strings. Example: ["1", "2"].',type:"array",items:L()},includeZero:{description:"Include positions whose current liquidity is zero.",type:"boolean"}}};function kn(e){let n=e.poolKey&&typeof e.poolKey=="object"&&!Array.isArray(e.poolKey)?e.poolKey:e;for(let i of["currency0","currency1","fee","tickSpacing"])if(n[i]===void 0)throw new o(`Creating a pool needs the full poolKey (currency0, currency1, fee, tickSpacing, hooks); ${i} is missing. A poolId alone cannot describe a pool that does not exist yet.`)}function Pn(e,n,i){if(e.initialPrice!==void 0&&e.sqrtPriceX96!==void 0)throw new o("Provide initialPrice or sqrtPriceX96, not both.");if(e.sqrtPriceX96!==void 0){if(typeof e.sqrtPriceX96!="string"||!/^\d+$/.test(e.sqrtPriceX96))throw new o("sqrtPriceX96 must be a non-negative integer string.");return nn(BigInt(e.sqrtPriceX96))}return en(e.initialPrice,n,i)}async function ut(e,n,i){let r;try{r=await e.readContract({address:M,abi:X,functionName:"ownerOf",args:[n]})}catch(c){throw new o(`Could not verify owner of Uniswap v4 position #${n}. ${oe(c)}`)}if(w(r)!==w(i))throw new o(`Wallet ${w(i)} is not the owner of Uniswap v4 position #${n} (owned by ${w(r)}).`)}async function vn(e,n){let i=ye(n).toLowerCase(),r=new Map;for(let s of Oe)s.key.currency0.toLowerCase()===n.currency0.toLowerCase()&&s.key.currency1.toLowerCase()===n.currency1.toLowerCase()&&r.set(s.poolId.toLowerCase(),s.key);let c=[];for(let[s,t]of r){if(s===i||BigInt(await e.readContract({address:le,abi:fe,functionName:"getLiquidity",args:[s]}))===0n)continue;let a=await e.readContract({address:le,abi:fe,functionName:"getSlot0",args:[s]});BigInt(a[0])>0n&&c.push({label:`v4 fee ${t.fee} spacing ${t.tickSpacing} pool ${s}`,sqrtPriceX96:BigInt(a[0])})}return c}function xn(e,n,i,r,c,s){return e.unsignedTx({to:Vn.toLowerCase(),data:re({abi:Yn,functionName:"initialize",args:[{currency0:n.currency0.toLowerCase(),currency1:n.currency1.toLowerCase(),fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks.toLowerCase()},r]}),value:"0",chainId:y,description:`Create and initialize Uniswap v4 pool ${i} (${c.symbol}/${s.symbol}, fee ${n.fee}, tickSpacing ${n.tickSpacing}) at ${he(r,c.decimals,s.decimals)} ${s.symbol} per ${c.symbol}.`})}var pt=e=>({tools:[{name:"uniswap_add",inputSchema:rt,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=t.tokenId===void 0?void 0:K(String(t.tokenId));if(a!==void 0&&a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=t.initialPrice!==void 0||t.sqrtPriceX96!==void 0;if(t.exactCaps!==void 0&&typeof t.exactCaps!="boolean")throw new o("exactCaps must be a boolean.");let l=t.exactCaps===!0;if(l&&(a!==void 0||p||t.amount0Max===void 0||t.amount1Max===void 0))throw new o("exactCaps is for v4 mints only: provide both amount0Max and amount1Max, without tokenId, initialPrice or sqrtPriceX96.");if(a!==void 0&&p)throw new o("initialPrice cannot be combined with tokenId.");if(a!==void 0&&(t.amount0Min!==void 0||t.amount1Min!==void 0||t.slippageBps!==void 0))throw new o("V4 mint encodes fixed liquidity and amount0Max/amount1Max; amount minima and slippageBps are not supported for minting.");if(t.amount0Min!==void 0||t.amount1Min!==void 0)throw new o(sn);let m=t.slippageBps===void 0?Number(me):t.slippageBps;if(typeof m!="number"||!Number.isInteger(m)||m<0||m>500)throw new o(sn);let f=BigInt(m),P=e.clientFor(y);p&&kn(t);let b,u,v,x;if(a!==void 0){if(t.tickLower!==void 0||t.tickUpper!==void 0||t.fullRange!==void 0)throw new o("An existing v4 position keeps its tick range; omit tickLower, tickUpper and fullRange when increasing.");await ut(P,a,d),{poolId:b,poolKey:u,tickLower:v,tickUpper:x}=await Pe(P,a,t)}else{({poolId:b,poolKey:u}=await Be(P,t));let q=et(u.tickSpacing);v=t.fullRange===!0&&t.tickLower===void 0?q.tickLower:Number(t.tickLower),x=t.fullRange===!0&&t.tickUpper===void 0?q.tickUpper:Number(t.tickUpper),nt(v,x,u.tickSpacing)}let[h,g]=await Promise.all([B(P,u.currency0,y),B(P,u.currency1,y)]),A=Z(t.amount0Max??t.amount0Desired,"amount0Max"),I=Z(t.amount1Max??t.amount1Desired,"amount1Max");if(A<=0n&&I<=0n||A>J||I>J)throw new o("Provide positive amount0Max/amount1Max within uint128.");let F=await P.readContract({address:le,abi:fe,functionName:"getSlot0",args:[b]}),_=BigInt(F[0]),j=Number(F[3]),C;if(p){if(_>0n)throw new o(`Pool ${b} already exists; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);let q=Pn(t,h.decimals,g.decimals),V=Ue(q,await vn(P,u),t.acceptPriceDeviation===!0,h.decimals,g.decimals);C={sqrtPriceX96:q,note:V},_=q}else if(_<=0n)throw new o(`Pool ${b} is not initialized on StateView. To create it and add the first liquidity in one tool call with separately confirmed transactions, pass the full poolKey plus initialPrice (token1 per 1 token0, human units); to create it without liquidity use uniswap_create_pool.`);let E=t.liquidity!==void 0&&!l?Z(t.liquidity,"liquidity"):it({amount0:cn(A,f),amount1:cn(I,f),tickLower:v,tickUpper:x,sqrtPriceX96:_});if(E<=0n||E>J)throw new o("Position liquidity must be a positive integer within uint128.");let{amount0:ee,amount1:ne}=Cn({liquidity:E,tickLower:v,tickUpper:x,sqrtPriceX96:_,roundUp:!0});if(ee>A||ne>I)throw new o("Liquidity requires more tokens than amount0Max or amount1Max.");let W=l?A:dn(ee,A,f),Y=l?I:dn(ne,I,f),$=t.recipient!==void 0?String(t.recipient):d;if(T($),w($)!==w(d))throw new o("Uniswap recipient must be the signing wallet.");let U=await qn(P),O=await Ke(P,t.deadline,U.toString()),te=O<U+an?O:U+an,N=t.permit2Expiration===void 0?te:K(String(t.permit2Expiration));if(N<=U||N>te||N>An)throw new o("Permit2 expiration must be in the next 30 minutes and no later than the transaction deadline.");let ie=typeof t.hookData=="string"?t.hookData:"0x",Se=((q,V)=>{let G=C?[xn(e,u,b,C.sqrtPriceX96,h,g)]:[];if(!H(u.currency0)&&q>0n){let ae=u.currency0.toLowerCase();G.push(e.approval(ae,He.toLowerCase(),q.toString(),y)),G.push(mn(ae,M.toLowerCase(),q.toString(),N.toString(),y))}if(!H(u.currency1)&&V>0n){let ae=u.currency1.toLowerCase();G.push(e.approval(ae,He.toLowerCase(),V.toString(),y)),G.push(mn(ae,M.toLowerCase(),V.toString(),N.toString(),y))}let R={currency0:u.currency0.toLowerCase(),currency1:u.currency1.toLowerCase(),fee:u.fee,tickSpacing:u.tickSpacing,hooks:u.hooks.toLowerCase()},Le=S(jn,[R,v,x,E,q,V,$.toLowerCase(),ie]),$n=S(Wn,[R.currency0,R.currency1]),We=S(Gn,[k,$.toLowerCase()]),En=S(ge,[a??0n,E,q,V,ie]),_n=a===void 0?S(ue,["0x020d14",[Le,$n,We]]):S(ue,["0x00121214",[En,S(un,[R.currency0]),S(un,[R.currency1]),We]]),Un=re({abi:X,functionName:"modifyLiquidities",args:[_n,O]}),Dn=H(u.currency0)?q.toString():"0";return G.push(e.unsignedTx({to:M.toLowerCase(),data:Un,value:Dn,chainId:y,description:a!==void 0?`Increase Uniswap v4 position #${a} on pool ${b} (liquidity +${E}).`:`Mint Uniswap v4 position on pool ${b} (ticks [${v}, ${x}], liquidity ${E}).`})),G})(W,Y),we=await e.preview(Se,d),ze=(q,V)=>{let G=H(V)?ce:V.toLowerCase();return-q.changes.filter(R=>R.token.address.toLowerCase()===G).reduce((R,Le)=>R+BigInt(Le.amount),0n)},Ie=ze(we,u.currency0),Ce=ze(we,u.currency1);if(Ie<0n||Ce<0n||Ie>W||Ce>Y||Ie===0n&&Ce===0n&&a===void 0)throw new o("Invalid simulated v4 mint spend. Refresh the liquidity preview.");let Ln=Ne(we.changes,e.formatAmount),qe=ln(u,j),je=[...!H(u.currency0)&&W>0n?[h.symbol]:[],...!H(u.currency1)&&Y>0n?[g.symbol]:[]],Tn=Se.length,Mn=a===void 0?`This deposit takes ${Tn} approvals in a row: ${je.length?`let Permit2 use your ${je.join(" and ")}, let the Uniswap position manager use it through Permit2, then the deposit`:"the deposit"}. `:"",be=m>Number(me)?`You chose ${m/100}% room for price movement. Oak will approve up to ${e.formatAmount(W.toString(),h.decimals)} ${h.symbol} and ${e.formatAmount(Y.toString(),g.decimals)} ${g.symbol}, more than the expected ${e.formatAmount(ee.toString(),h.decimals)} and ${e.formatAmount(ne.toString(),g.decimals)}. Anything not used stays in your wallet, and any leftover permission is cancelled after the deposit.`:void 0;return{txs:Se,preview:we,poolId:b,poolKey:u,tickLower:v,tickUpper:x,liquidity:E.toString(),amount0Max:{token:h,amount:A.toString()},amount1Max:{token:g,amount:I.toString()},dynamicFee:qe.dynamicFee,swapsAreFree:qe.swapsAreFree,...a===void 0?{mintTerms:{amount0Max:W.toString(),amount1Max:Y.toString(),deadline:O.toString(),permit2Expiration:N.toString(),slippageBps:m.toString(),liquidity:E.toString()}}:{},...be?{warnings:[be]}:{},action:a!==void 0?"increase":C?"createAndMint":"mint",...a!==void 0?{tokenId:a.toString()}:{},...C?{poolCreated:!0,sqrtPriceX96:C.sqrtPriceX96.toString(),initialPrice:he(C.sqrtPriceX96,h.decimals,g.decimals),initialTick:_e(C.sqrtPriceX96),priceCheck:C.note}:{},summary:`${Mn}${a!==void 0?`Increase Uniswap v4 position #${a}`:C?"Create Uniswap v4 pool and add first liquidity":"Add Uniswap v4 liquidity"} (${E} L, ticks [${v}, ${x}]) on pool ${b}. Preview deltas: ${Ln.join(", ")||"none"}. A partial spend can leave ERC-20 and Permit2 allowances equal to grant minus spent, bounded by your caps. Use oak_cleanup_allowances to revoke remaining allowances. ${qe.feeNote}${be?` ${be}`:""}${C?` ${C.note}`:""}`}}},{name:"uniswap_collect",inputSchema:at,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=K(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(y),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),w(l)!==w(d))throw new o("Uniswap recipient must be the signing wallet.");let m=await Ke(p,t.deadline,t.now),f=t.amount0Min!==void 0?Z(t.amount0Min,"amount0Min"):0n,P=t.amount1Min!==void 0?Z(t.amount1Min,"amount1Min"):0n;if(f>J||P>J)throw new o("amount0Min and amount1Min must fit in uint128.");let b=typeof t.hookData=="string"?t.hookData:"0x",{poolKey:u,poolId:v}=await Pe(p,a,t),[x,h]=await Promise.all([B(p,u.currency0,y),B(p,u.currency1,y)]),g=S(ge,[a,0n,f,P,b]),A=S(De,[u.currency0.toLowerCase(),u.currency1.toLowerCase(),l.toLowerCase()]),I=S(ue,["0x0111",[g,A]]),F=re({abi:X,functionName:"modifyLiquidities",args:[I,m]}),_=[e.unsignedTx({to:M.toLowerCase(),data:F,value:"0",chainId:y,description:`Collect Uniswap v4 fees from position #${a} to ${l}.`})],j=await e.preview(_,d),C=Ne(j.changes,e.formatAmount);return{txs:_,preview:j,tokenId:a.toString(),poolId:v,recipient:l,currencies:[x,h],summary:`Collect Uniswap v4 fees for position #${a} (actions 0x0111). Preview deltas: ${C.join(", ")||"0"}.`}}},{name:"uniswap_remove",inputSchema:ct,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=K(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(y),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),w(l)!==w(d))throw new o("Uniswap recipient must be the signing wallet.");let m=await Ke(p,t.deadline,t.now),{poolKey:f,poolId:P}=await Pe(p,a,t),[b,u]=await Promise.all([B(p,f.currency0,y),B(p,f.currency1,y)]),v=t.slippageBps??Te;if(typeof v!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");Me("0",v);let x=typeof t.hookData=="string"?t.hookData:"0x",h=t.fullExit===!0||t.burn===!0||t.liquidity==="all";if(!h&&t.liquidity===void 0)throw new o('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let g=t.liquidity===void 0||t.liquidity==="all"?void 0:Z(t.liquidity,"liquidity");if(g!==void 0&&(g<0n||g===0n&&!h||g>J))throw new o("Provide positive liquidity within uint128 for v4 removal.");let A;try{A=BigInt(await p.readContract({address:M,abi:X,functionName:"getPositionLiquidity",args:[a]}))}catch($){throw new o(`Could not read v4 position liquidity. ${oe($)}`)}if(A<0n||A===0n&&!h||g!==void 0&&g>A)throw new o("Removal requires a nonempty position and cannot exceed its liquidity.");if(h&&g!==void 0&&g!==A)throw new o("A full burn must match the position liquidity; omit the amount when explicitly choosing all.");let I=h?"0x0311":"0x0111",F=($,U,O)=>{let te=h?S(Zn,[a,$,U,x]):S(ge,[a,g,$,U,x]),N=S(De,[f.currency0,f.currency1,O]);return e.unsignedTx({to:M.toLowerCase(),data:re({abi:X,functionName:"modifyLiquidities",args:[S(ue,[I,[te,N]]),m]}),value:"0",chainId:y,description:`${h?"Burn and exit":"Decrease"} Uniswap v4 position #${a} (${I}).`})},_=0n,j=0n;if(A>0n&&(t.amount0Min===void 0||t.amount1Min===void 0)){let $=e.unsignedTx({to:M.toLowerCase(),data:re({abi:X,functionName:"modifyLiquidities",args:[S(ue,["0x0111",[S(ge,[a,0n,0n,0n,x]),S(De,[f.currency0,f.currency1,M])]]),m]}),value:"0",chainId:y,description:"Simulation only: separate fees from removal principal."}),U=await e.preview([$,F(2n,2n,d)],d),O=te=>U.changes.reduce((N,ie)=>ie.token.chainId===y&&ie.token.address.toLowerCase()===te.address.toLowerCase()?N+BigInt(ie.amount):N,0n);if(_=O(b),j=O(u),_<0n||j<0n)throw new o("Removal simulation did not return the expected currencies.")}let C=($,U)=>{if($!==void 0&&Z($,U)!==0n)throw new o(`${U} must be zero for an empty position burn.`);return 0n},E=A===0n?C(t.amount0Min,"amount0Min"):hn(t.amount0Min,_,v,"amount0Min"),ee=A===0n?C(t.amount1Min,"amount1Min"):hn(t.amount1Min,j,v,"amount1Min"),ne=[F(E,ee,l)],W=await e.preview(ne,d),Y=Ne(W.changes,e.formatAmount);return{txs:ne,preview:W,action:I,tokenId:a.toString(),poolId:P,amount0Min:{token:b,amount:E.toString()},amount1Min:{token:u,amount:ee.toString()},summary:`${h?"Full exit":"Partial remove"} Uniswap v4 position #${a} (${I})${h?`; burns position #${a} at ${M}`:""}. Preview deltas: ${Y.join(", ")||"none"}.`}}},{name:"uniswap_list_positions",inputSchema:dt,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=Array.isArray(t.tokenIds)?t.tokenIds:void 0,p=t.includeZero===!0,l=t.wallet===void 0?w(d):ot(t.wallet),m=await gn(e,l,{tokenIds:a,includeZero:p});return{version:"v4",positions:m,summary:`Found ${m.length} active Uniswap v4 position(s) for ${l}.`}}},{name:"uniswap_create_pool",inputSchema:st,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');kn(t);let a=e.clientFor(y),{poolId:p,poolKey:l}=await Be(a,t),[m,f]=await Promise.all([B(a,l.currency0,y),B(a,l.currency1,y)]),P=await a.readContract({address:le,abi:fe,functionName:"getSlot0",args:[p]});if(BigInt(P[0])>0n)throw new o(`Uniswap v4 pool ${p} already exists. Use uniswap_add to provide liquidity.`);let b=Pn(t,m.decimals,f.decimals),u=Ue(b,await vn(a,l),t.acceptPriceDeviation===!0,m.decimals,f.decimals),v=he(b,m.decimals,f.decimals),x=[xn(e,l,p,b,m,f)],h=await e.preview(x,d),g=ln(l,l.fee);return{txs:x,preview:h,poolId:p,poolKey:l,sqrtPriceX96:b.toString(),initialPrice:v,initialTick:_e(b),priceCheck:u,action:"createPool",summary:`${x[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add. ${g.feeNote} ${u}`}}}],positions:t=>gn(e,t)}),St=pt;export{Vn as a,M as b,le as c,He as d,At as e,se as f,D as g,k as h,Xe as i,Fe as j,ve as k,Xn as l,Ve as m,Oe as n,Re as o,Sn as p,On as q,Rn as r,H as s,ye as t,In as u,ln as v,ke as w,et as x,nt as y,mn as z,tt as A,Cn as B,it as C,Ne as D,bn as E,B as F,Pe as G,gn as H,rt as I,st as J,at as K,ct as L,dt as M,vn as N,pt as O,St as P};
@@ -1,3 +0,0 @@
1
- import{c as O,e as T,i as M,j as x,k as V,m as D,n as N}from"./ETMD747Y.js";import{a as b,b as h,c as R,e as f,f as A,g as k,h as P,i as I,j as v,l as S,m as B,n as $}from"./K4GUZ5QS.js";import{a as E}from"./K6D6SDIG.js";import{a as y}from"./L2AE32SL.js";import{a as c}from"./XSD5NL7J.js";import{encodeFunctionData as j,formatUnits as z}from"viem";var m=(o,e)=>({token:o,amount:e.toString()}),J=6e4;function ie(){let o=new WeakMap;return{entry(e){let r=o.get(e);return(!r||Date.now()>=r.expiresAt)&&(r={logs:new Map,expiresAt:Date.now()+J},o.set(e,r)),r}}}function K(o,e){return{to:o.log.address,data:j({abi:E,functionName:"debond",args:[e,[],[]]}),value:"0",chainId:4663,description:`Unwrap ${e} log base units from ${o.log.address}.`}}async function _(o,e,r,a,t=BigInt(e.measuredAtBlock),s){if(a>BigInt(e.totalSupply))throw new c("Unwrap amount exceeds the issued Chop log supply.");let i=h(await A(o,e.log.address,"convertToAssets",[a],t,r,s)),p=1n<<96n,d=BigInt(e.managedUnderlying)*(a*p/BigInt(e.totalSupply))/p;if(i>d)throw new c("Chop redemption exceeds the measured backing.");return{gross:m(e.underlying,d),fee:m(e.underlying,d-i),net:m(e.underlying,i)}}async function F(o,e){if(f(e),o.network==="testnet")throw new c("Chop requires chain 4663.");let r=o.clientFor(4663),a=await P(r,e),t=I();await v(r,y.registry,a,e,t);let s=await A(r,y.registry.address,"allIndexes",[],a,void 0,e);if(!Array.isArray(s)||s.length>1e3)throw new c("Chop registry inventory is unreadable or too large.");let i=s.filter(n=>n&&n.verified===!0).map(n=>b(n.index));if(new Set(i).size!==i.length)throw new c("Chop registry returned duplicate logs.");let p=[];for(let n=0;n<i.length;n+=4)f(e),p.push(...await Promise.all(i.slice(n,n+4).map(l=>S(r,l,"read",a,e,t))));f(e);let d=p.map(n=>`${n.log.symbol} (${n.log.address}): ${M(n)}`),u=p.flatMap(n=>n.drift.length?[`Code changed for ${n.log.address}: ${n.drift.join(", ")}.`]:[]);return{logs:p.map(n=>({...n,plainSummary:V(n)})),measuredAtBlock:a.toString(),warnings:[...T,...d,...u]}}async function se(o,e,r){if(f(r),!e)return F(o,r);let a=o.clientFor(4663),t=e.entry(a);if(t.inventory)return structuredClone(t.inventory);let s=t.pending;if(!s){let n=new AbortController,l={controller:n,waiters:0,promise:F(o,n.signal)};l.promise=l.promise.then(g=>{f(n.signal),t.inventory=structuredClone(g);for(let w of g.logs)t.logs.set(w.log.address.toLowerCase(),structuredClone(w));return g}).finally(()=>{n.abort(),t.pending===l&&(t.pending=void 0)}),t.pending=s=l}let i=s;i.waiters++;let p,d=!1,u=()=>{d||(d=!0,--i.waiters===0&&t.pending===i&&(i.controller.abort(),t.pending=void 0))};try{let n=await new Promise((l,g)=>{p=()=>{u(),g(new c("Chop read was cancelled."))},r?.addEventListener("abort",p,{once:!0}),i.promise.then(l,g)});return f(r),structuredClone(n)}finally{p&&r?.removeEventListener("abort",p),u()}}async function ae(o,e,r){let{limit:a,offset:t}=r,s=new Set(e.logs.map(l=>`${l.log.symbol} (${l.log.address}): ${M(l)}`)),i=e.warnings.filter(l=>!s.has(l)),p=Object.entries(e).map(([l,g])=>({name:l,chars:JSON.stringify(g).length,...Array.isArray(g)?{items:g.length}:{}})),d=o.clientFor(4663),u=e.logs.slice(t,t+a),n=[];for(let l=0;l<u.length;l+=4)n.push(...await Promise.all(u.slice(l,l+4).map(async g=>{let w=await k(d,[{target:g.pool,fn:"balanceOf",args:[g.staking.address]},{target:g.pool,fn:"totalSupply"}],BigInt(g.measuredAtBlock)),L=h(w[0]),C=h(w[1]);if(L>C)throw new c("Chop staked LP balance exceeds the pool supply.");return{log:g.log.address,symbol:g.log.symbol,backingPerLog:g.backingPerLog,fees:g.fees,pool:g.pool,stakedShare:{stakedLp:L.toString(),totalLp:C.toString(),bps:C===0n?null:Number(L*10000n/C)},riskLines:x(g).split(`
2
- `).filter(W=>!T.includes(W)).join(`
3
- `)}})));for(;;){let l=t+n.length,g=`Use detail: "full" for every complete row, or fields: ["logs"] or ["warnings"] for whole sections. ${l<e.logs.length?`Continue with offset: ${l}, limit: ${a}.`:"End of this list; use offset: 0 to start again."} Summary rows omit financial measurements and full contract metadata.`,w={warnings:i,summary:{logs:n,offset:t,total:e.logs.length,omitted:e.logs.length-n.length,measuredAtBlock:e.measuredAtBlock},sections:p,more:g};if(JSON.stringify(w).length<=8e3)return w;if(n.length<=1)throw new c('Chop risk lines exceed the summary budget. Request fields or detail: "full" to read them whole.');n.pop()}}async function de(o,e){let r=o.clientFor(4663),a=[];for(let t=0;t<e.length;t+=4)a.push(...await Promise.all(e.slice(t,t+4).map(async s=>{let[i,p,d,u]=await k(r,[{target:b(y.chop),fn:"balanceOf",args:[s.rewards]},{target:s.pool,fn:"token0"},{target:s.pool,fn:"token1"},{target:s.pool,fn:"getReserves"}],BigInt(s.measuredAtBlock)),n=[b(p),b(d)].map(g=>[s.log,s.paired].find(w=>w.address.toLowerCase()===g.toLowerCase()));if(!n[0]||!n[1]||n[0]===n[1])throw new c("Chop pool tokens disagree with the verified log.");if(!Array.isArray(u)||u.length!==3)throw new c("Chop pool reserves are unavailable.");let l=m(s.underlying,BigInt(s.managedUnderlying));return{...s,backingNow:{...l,humanAmount:z(BigInt(l.amount),s.underlying.decimals)},rewardPot:m({address:b(y.chop),symbol:"CHOP",decimals:18,chainId:4663},h(i)),reserves:[m(n[0],h(u[0])),m(n[1],h(u[1]))]}})));return a}var U=o=>BigInt(o.replace(".","")),H=o=>`${o/100n}.${(o%100n).toString().padStart(2,"0")}`;function le(o){return o.some(e=>e.usdEstimate===null)?{reserves:o,usdEstimate:null,estimateLabel:"price unavailable",estimateReason:"A pool reserve has no USD estimate"}:{reserves:o,usdEstimate:H(o.reduce((e,r)=>e+U(r.usdEstimate),0n)),estimateLabel:"estimate, not a quote",estimateSource:"sum of the two reserve estimates"}}function pe(o,e){let r={label:"rough",pct:null,inputToken:e,assumptions:"Constant-product marginal price move for buying the log with $100 of the paired token; excludes pool and token fees, gas and other trades."};if(o.some(d=>BigInt(d.amount)===0n))return{...r,reason:"The pool is empty on at least one side"};let a=o.find(d=>d.token.address.toLowerCase()===e.address.toLowerCase());if(!a?.usdEstimate||U(a.usdEstimate)===0n)return{...r,reason:"Paired reserve price unavailable or below one cent"};let t=U(a.usdEstimate),i=((t+10000n)**2n-t**2n)*10000n,p=t**2n;return{...r,pct:H((2n*i+p)/(2n*p))}}var q=new WeakMap,Y=10;async function Z(o,e,r,a,t,s){if(f(t),e.length>Y)throw new c("Chop holdings probes support at most ten logs per call.");if(e.length===0)return[];let i=t?q.get(t):void 0;t&&!i&&(i=I(),q.set(t,i)),await v(o,y.whitelist,a,t,i);let p=await k(o,e.flatMap(d=>[{target:d.log.address,fn:"balanceOf",args:[r]},{target:d.staking.address,fn:"balanceOf",args:[r]},{target:d.staking.address,fn:"withdrawableStake",args:[r]},{target:d.rewards,fn:"getUnpaid",args:[y.chop,r]},{target:d.rewards,fn:"getClaimable",args:[y.chop,r]},{target:y.whitelist.address,fn:"paused",args:[y.chop]},{target:d.log.address,fn:"totalSupply"},{target:d.log.address,fn:"totalAssets",args:[d.underlying.address]}]),a,t);return f(t),Promise.all(e.map(async(d,u)=>{let n=await Q(o,d,r,a,t,p.slice(u*8,(u+1)*8));return f(t),s?.(n,u),n}))}async function G(o,e,r,a=BigInt(e.measuredAtBlock),t){return(await Z(o,[e],r,a,t))[0]}async function Q(o,e,r,a,t,s){if(f(t),typeof s[5]!="boolean")throw new c("Chop reward pause state is unavailable.");let i=h(s[0]),p=h(s[6]),d=h(s[7]);if(p===0n)throw new c("This Chop log has no issued supply.");let u={...e,totalSupply:p.toString(),managedUnderlying:d.toString()},n=i===0n?{gross:m(e.underlying,0n),fee:m(e.underlying,0n),net:m(e.underlying,0n)}:await _(o,u,r,i,a,t),l={address:b(y.chop),symbol:"CHOP",decimals:18,chainId:4663};return{log:e.log.address,logTokens:m(e.log,i),...n,stakedLp:m(e.staking,h(s[1])),withdrawableLp:m(e.staking,h(s[2])),pendingChop:m(l,h(s[3])),claimableChop:m(l,h(s[4])),rewardsPaused:s[5],measuredAtBlock:a.toString(),warnings:x(e)}}async function ge(o,e,r,a){let t=o.clientFor(4663);b(r);let s=a?.entry(t),i=b(e).toLowerCase(),p=s?.logs.get(i)??await S(t,e,"read");return s&&!s.logs.has(i)&&s.logs.set(i,structuredClone(p)),G(t,p,r,await P(t))}async function ue(o,e,r,a){let t=R(a),s=o.clientFor(4663);b(r);let i=await S(s,e,"exit"),p=h(await A(s,i.log.address,"balanceOf",[r],BigInt(i.measuredAtBlock)));if(p===0n)throw new c(D(i.log.symbol));if(t>p)throw new c(N(i.log,t,p));let d=await _(s,i,r,t),u=BigInt(d.net.amount);if(u===0n)throw new c("This Chop unwrap would return no underlying.");let n=K(i,t),l=o.unsignedTx(n);B([l],[n]);let g=await o.preview([l],r);B(g.txs,[n]);let w=$(g,[{token:i.log,min:-t,max:-t},{token:i.underlying,min:u}]);return{log:i.log.address,amount:t.toString(),...d,simulatedNet:m(i.underlying,w.get(i.underlying.address.toLowerCase())),quotedNet:d.net.amount,preview:g,measuredAtBlock:i.measuredAtBlock,warning:O,summary:x(i)}}export{m as a,J as b,ie as c,K as d,_ as e,se as f,ae as g,de as h,le as i,pe as j,Y as k,Z as l,G as m,ge as n,ue as o};
@@ -1 +0,0 @@
1
- import{a as p,f as u,g as c}from"./QPY6UTLU.js";import{f as a}from"./KLEJ3W4T.js";import{a as r}from"./66F5ZH34.js";import{b as i}from"./TI727O2H.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as d,parseAbi as f}from"viem";var m=f(["function deposit() payable","function withdraw(uint256)"]);function W(n){return{tools:[{name:"uniswap_wrap",inputSchema:{type:"object",additionalProperties:!1,required:["direction","amount"],properties:{direction:{description:'Choose "wrap" to exchange ETH for WETH, or "unwrap" to exchange WETH for ETH.',type:"string",enum:["wrap","unwrap"]},amount:r('Amount of ETH or WETH in base units (18 decimals). Example: "1000000000000000000" = 1 ETH or WETH.')}},async execute(t,s){if(c(t,["direction","amount"]),t.direction!=="wrap"&&t.direction!=="unwrap")throw new e("Choose direction wrap or unwrap.");let o=p(t.amount,"amount"),w=t.direction==="wrap"?d({abi:m,functionName:"deposit"}):d({abi:m,functionName:"withdraw",args:[o]});return u(n,[n.unsignedTx({to:a,data:w,value:t.direction==="wrap"?o.toString():"0",chainId:i,description:`${t.direction} ${o} ETH/WETH base units to the signing wallet.`})],s,"Wrap or unwrap native ETH at the pinned WETH contract. Ratio 1:1; network gas is additional.")}}]}}export{m as a,W as b};
@@ -1 +0,0 @@
1
- var a={registry:{address:"0xF2A26110396b4162d48A16eE8683372a6A2c3b76",codeHash:"0xb08c7571b87c9a5d1d0d32b2a9accb4e4e923f191127a733072d99b00f463479"},helper:{address:"0x88BfFDf0ce9EB8889577924Cf802B2237bf8aD79",codeHash:"0xa33bd7460219439ad0e659548b6f08a71b3aab40ac02109ab69b364a00a5f036"},whitelist:{address:"0xab74612eB2ef5642fa804A52529fEDC6D98f6Cbd",codeHash:"0x335b0b4210eaa3c3d8956b16e2326851b54918bf85266b1fbf9c04461ea2a512"},beacon:{address:"0x5413041ebddd006f8b50a03a05236eade8fa884e",codeHash:"0xa0693b5efe62447f561c327fb56d7d1ab0930a5bb147a0f8844461a6b976b7f7"},implementation:{address:"0x1570a79aa494043DC01Ecc96405d5A8b45d24bDa",codeHash:"0xd3a1db41d5c42de3d2b6ff176e8603b9b825ff5603de555ed8f41cb270d71985"},staking:{codeHash:"0x533bcf9a4518b33b2bb541af1c1daa06f69ab6092cfd84944c1d57ebec825a69"},rewards:{codeHash:"0x6a482e5367e1aced7f5448e31e40140e4b899959376d040e0be502c37ce739b1"},proxy:{codeHash:"0x813f4e3ccc34b924559faf1f81706763c9649bad4c4f6c07547acd5713f481b9"},stakingBeacon:{address:"0x9df506ae33dad46c83d226be462849c3071f63ac",codeHash:"0xa0693b5efe62447f561c327fb56d7d1ab0930a5bb147a0f8844461a6b976b7f7"},stakingImplementation:{address:"0x4c6b1D5377e353C6959C65d389aAe3127a84EC4e",codeHash:"0x30c917d96f73c2075d7d0cca801cd34c459060567ec90dfdb30b361bf29dd2ed"},rewardsBeacon:{address:"0x4768574074cf48b025457b14d109983079952134",codeHash:"0xa0693b5efe62447f561c327fb56d7d1ab0930a5bb147a0f8844461a6b976b7f7"},rewardsImplementation:{address:"0x15a8Ef0EA82c5D087BD8D89b5D10BA85FfD3BefE",codeHash:"0x2cdf99c071739c5bbde722901ab43a9085674c99647372d6d66ad2bec10ee3db"},oak:"0x6511c233790Ec10f7d673c64DC82C3F941D57828",dormantOak:"0x38fE199550E677Fa9caC196495460dfF97BCe28F",chop:"0x100765a16f42636Bd84EE1e86Bc5107b84bCdBA3",chainId:4663,measuredAtBlock:"106718816",source:"https://rpc.mainnet.chain.robinhood.com"},d={poolId:"0x8111082d181841cbd123e82bced032b1331140332b6ce3da37f53a6b24ed736c",stateView:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b",poolManager:"0x8366a39cc670b4001a1121b8f6a443a643e40951",key:{currency0:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",currency1:"0x100765a16f42636Bd84EE1e86Bc5107b84bCdBA3",fee:8388608,tickSpacing:200,hooks:"0x4e3468951D49f2EEa976eD0D6e75fFCb44a9a544"},dustV2Pool:"0x32c9b1748b914fd740054518d9322240a14b8aec"};export{a,d as b};
@@ -1 +0,0 @@
1
- import{f as L,k as r,l as $}from"./KOKLM63Q.js";import{a as I,e as c,h as v}from"./K4GUZ5QS.js";import{j as h,k as p}from"./2GXHYI23.js";async function M(k,b,d={},O){I(b);let o=new AbortController,C=()=>o.abort(),l=()=>c(o.signal);c(d.signal),d.signal?.addEventListener("abort",C,{once:!0});let u=[];try{let f=await L(k,O,o.signal);l();let w=k.clientFor(4663),S=await v(w,o.signal),T=Array.from({length:Math.ceil(f.logs.length/r)},(t,n)=>f.logs.slice(n*r,(n+1)*r));return await Promise.all(T.map(async(t,n)=>{l(),await $(w,t,b,S,o.signal,(e,y)=>{if(l(),BigInt(e.logTokens.amount)===0n&&BigInt(e.stakedLp.amount)===0n&&BigInt(e.pendingChop.amount)===0n&&BigInt(e.claimableChop.amount)===0n)return;let a=t[y],m=BigInt(e.pendingChop.amount),B=BigInt(e.claimableChop.amount),g=B<=m,s=e.rewardsPaused?0n:B,i={principal:[],debt:[],rewards:[],backing:[],coverage:g?{complete:!0}:{complete:!1,reason:"Chop reward reads disagree."}};if(BigInt(e.logTokens.amount)>0n&&i.backing.push(p({...e.net,source:"chop.redemption.net",heldAs:e.logTokens.token.address,measuredAtBlock:e.measuredAtBlock})),BigInt(e.stakedLp.amount)>0n&&i.backing.push(p({token:a.underlying,amount:null,source:"chop.stakedLp",heldAs:e.stakedLp.token.address,measuredAtBlock:e.measuredAtBlock,unknownReason:"Staked log tokens are not redeemed in this read; unstake to see their redemption."})),g){let A={tool:"chop_harvest",args:{log:a.log.address}},P=m-s;P>0n&&i.rewards.push(h("unpaid",{token:e.pendingChop.token,amount:P.toString(),source:"chop.getUnpaid",measuredAtBlock:e.measuredAtBlock,claim:A})),s>0n&&i.rewards.push(h("claimable",{token:e.claimableChop.token,amount:s.toString(),source:"chop.getClaimable",measuredAtBlock:e.measuredAtBlock,claim:A}))}let E=g?`unpaid CHOP ${m-s} base units; claimable CHOP ${s} base units${e.rewardsPaused?"; rewards are paused":""}.`:"Chop reward reads disagree.";u[n*r+y]=[{module:"chop",id:`4663:${a.log.address}`,chainId:4663,assets:[e.logTokens,e.stakedLp,e.pendingChop],economics:i,description:`Chop log held: ${e.logTokens.amount} base units; redeemable net underlying ${e.net.amount} base units (${a.underlying.address}, decimals ${a.underlying.decimals}); staked LP ${e.stakedLp.amount} base units; ${E}`,oakNotice:e.warnings}]})}).map(t=>t.catch(n=>{throw o.abort(),n}))),[...u.flat(),{module:"chop",id:"4663:coverage",chainId:4663,assets:[],incomplete:!0,description:"Chop positions cover currently verified registry logs only. Delisted or unverified log holdings are not included."}]}catch{return o.abort(),c(d.signal),[...u.flat(),{module:"chop",id:"4663:coverage",chainId:4663,assets:[],incomplete:!0,description:"Chop positions are incomplete because a chain read is unavailable. Please try again."}]}finally{d.signal?.removeEventListener("abort",C)}}export{M as a};
@@ -1 +0,0 @@
1
- import{m as A,n as j}from"./WSILNJS2.js";import{b as U,i as O,n as z,o as Q,q as Y}from"./7EACRKFV.js";import{a as V}from"./Y2QADJOB.js";import{b as J,e as _,o as Z}from"./W7QNSNOH.js";import{a as g,b as k}from"./Z7FGEWO2.js";import{a as N}from"./LIUXNOLP.js";import{a as $,b as C}from"./L2AE32SL.js";import{a as v}from"./VVAM3EAK.js";import{a as F}from"./SPJCSEKP.js";import{b as X}from"./SCG5HWMN.js";import{b as h}from"./IX3GZMTM.js";import{t as w}from"./MQ5F2VOK.js";import{b as m,c as l,d as q,e as D,j as T,k as W,l as K,q as B}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{a as x,b as R}from"./JXOEJPJ4.js";import{getAddress as b,isAddress as te,parseAbi as ae}from"viem";var ee=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];var G=300,pe="1000000000000000000",se=b(T[m].tokens.USDG.address),oe=b(T[l].deployments.test_USDG.address),I=b(T[m].tokens.WETH.address),H=b(T[l].deployments.test_WETH.address),L=b($.chop);function de(n){return n.chainId===m&&n.address.toLowerCase()===L.toLowerCase()}function ce(n){let e=n.address.toLowerCase();return n.chainId===m?e===se.toLowerCase():n.chainId===l?e===oe.toLowerCase():!1}function ue(n){return n.chainId!==m&&n.chainId!==l?!1:k(n.address)===g}function me(n){let e=n.address.toLowerCase();return n.chainId===m?e===I.toLowerCase():n.chainId===l?e===H.toLowerCase():!1}function ye(n){return ue(n)||me(n)}var le=-887272,fe=887272,we=(1n<<256n)-1n,ge=ae(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]),ne=ae(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Ee=1n<<192n;async function Te(n,e){let t=b(C.stateView),s=C.poolId,[a,i]=await Promise.all([n.readContract({address:t,abi:ne,functionName:"getSlot0",args:[s],blockNumber:e}),n.readContract({address:t,abi:ne,functionName:"getLiquidity",args:[s],blockNumber:e})]),o=a[0],r=Number(a[1]);if(o<=0n||i<=0n||!Number.isInteger(r)||r<le||r>fe)throw new d("The pinned Uniswap v4 WETH/CHOP pool has no active liquidity, and the only other route is a near-empty pool.");return{numerator:Ee,denominator:o*o}}function M(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new d(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new d(`Invalid ${e} timestamp.`)}function We(n,e=BigInt(Math.floor(Date.now()/1e3)),t=G){try{return p(n,e,t),!0}catch{return!1}}function p(n,e=BigInt(Math.floor(Date.now()/1e3)),t=G){if(!Number.isInteger(t)||t<0)throw new d("Maximum price age must be a non-negative integer.");let s=M(n,"price"),a=M(e,"current");if(s<=0n)throw new d("Price timestamp must be positive.");if(s>a)throw new d("Price timestamp is in the future.");let i=a-s;if(i>BigInt(t))throw new d(`Price is stale: age ${i}s exceeds ${t}s.`);return s.toString()}function he(n){if(!Number.isInteger(n)||n<le||n>fe)throw new d(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=we/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function re(n,e,t,s){let a=async()=>{throw new d("Price identity resolution is read-only.")},i=F({network:e===l?"testnet":"mainnet",clientFor:r=>t.client??w(t.rpcUrl,r),http:t.http??X(),preview:a,quoteSwap:a,buildSwap:a}),o=await Z(n,{context:i,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:s,blockNumber:t.blockNumber,readMetadata:async r=>{let c=t.client??w(t.rpcUrl,e),[u,f]=await Promise.all([v(c,e,r,"symbol",t.blockNumber),v(c,e,r,"decimals",t.blockNumber)]);return{address:r,symbol:u,decimals:f,chainId:e}}});return{address:o.address,symbol:o.kind==="erc20"&&s?s.symbol:o.symbol,decimals:o.decimals,chainId:o.chainId}}async function Se(n,e,t){if(typeof n=="object"&&n!==null){let r=n.chainId??e,c=k(n.address)===g?g:b(n.address),u={address:c,symbol:n.symbol,decimals:n.decimals,chainId:r};return ce(u)?{address:c,symbol:"USDG",decimals:D,chainId:r}:ue(u)?{address:g,symbol:"ETH",decimals:18,chainId:r}:me(u)?{address:c,symbol:"WETH",decimals:18,chainId:r}:de(u)?{address:c,symbol:"CHOP",decimals:18,chainId:r}:re(u.address,r,t,u)}let s=n.trim(),a=s.toUpperCase(),i=s.toLowerCase();if(a==="ETH"||te(s,{strict:!1})&&k(s)===g)return{...J,chainId:e};if(a==="WETH"||e===m&&i===I.toLowerCase()||e===l&&i===H.toLowerCase()){if(e!==m&&e!==l)throw new d(`No canonical WETH address configured for chain ${e}.`);return{address:e===l?H:I,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===m&&i===W.toLowerCase()||e===l&&i===K.toLowerCase()){if(e!==m&&e!==l)throw new d(`No canonical USDG address configured for chain ${e}.`);return{address:e===l?oe:se,symbol:"USDG",decimals:D,chainId:e}}if(e===m&&(a==="USDE"||i===_.address.toLowerCase()))return{..._,chainId:e};if(e===m&&(a==="CHOP"||i===L.toLowerCase()))return{address:L,symbol:"CHOP",decimals:18,chainId:e};let o=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||o&&s.toLowerCase()===o.toLowerCase()){if(!o&&!te(s,{strict:!1}))throw new d("OAK token address is required to price OAK.");return{address:b(o??s),symbol:"OAK",decimals:q,chainId:e}}return re(n,e,t)}async function S(n,e,t){if(e)return(await n.readContract({address:e,abi:ee,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:b(B),abi:ge,functionName:"observe",args:[[U,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new d("ETH/USDG pool observation returned insufficient tick cumulatives.");let i=z(a[0],a[1],U),o=he(i);return Q(o)}async function P(n,e,t,s){if(n.timestamp!==void 0)return p(n.timestamp,t(),s);if(e&&typeof e.getBlock=="function"){let i=await N(e,n.blockNumber);return p(i.timestamp,t(),s)}let a=t();return p(a,a,s)}function ie(n){if(n.startsWith("untrusted "))try{let e=JSON.parse(n.slice(10));if(typeof e=="string"&&x(e)===n)return n}catch{}return x(n)}async function Ke(n,e={}){let t=e.chainId??m,s=e.maxAgeSeconds??G,a=()=>e.now!==void 0?M(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),i=await Se(n,t,e);if((R(i.symbol)||i.symbol.length>256)&&(i.symbol=ie(i.symbol)),e.signedNote||e.priceNote){let r=e.signedNote?e.signedNote.note:e.priceNote,c=p(r.timestamp,a(),s);if(e.spotOakPerEthE18!==void 0&&!A(r.oakPerEthE18,e.spotOakPerEthE18))throw new d("Price note is outside the 50% spot guard band.");let u=e.signedNote?.signature??e.signature,f=e.signedNote?.consumer??e.consumer;if(u&&f){let E=await j({note:r,signature:u,consumer:f,signer:e.signer,now:a(),spotOakPerEthE18:e.spotOakPerEthE18,chainId:t});if(!E.valid)throw new d(E.error??"Price note verification failed.")}let y=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await S(e.client??w(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:O(y,r.oakPerEthE18),timestamp:c}}if(e.trades){let r=await P(e,e.client,a,s),c=Y(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!A(c,e.spotOakPerEthE18))throw new d("30-minute average is outside the 50% spot guard band.");let u=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await S(e.client??w(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:O(u,c),timestamp:r}}if(e.usdE18!==void 0){let r=await P(e,e.client,a,s),c=h(e.usdE18.toString());if(c<=0n)throw new d("USD price must be positive.");return{token:i,usdE18:c.toString(),timestamp:r}}if(e.resolver){let r=await e.resolver(i),c=p(r.timestamp,a(),s),u=h(r.usdE18);if(u<=0n)throw new d("USD price must be positive.");return{token:i,usdE18:u.toString(),timestamp:c}}let o=e.client??w(e.rpcUrl,t);if(ce(i)){let r=await P(e,o,a,s);return{token:i,usdE18:pe,timestamp:r}}if(ye(i)){let r=await P(e,o,a,s),c=await S(o,e.oracleAddress,e.blockNumber);return{token:i,usdE18:c,timestamp:r}}if(de(i)){let r=e.timestamp===void 0&&o&&typeof o.getBlock=="function"?await N(o,e.blockNumber):void 0,c=r?p(r.timestamp,a(),s):await P(e,o,a,s);if(r&&r.number===null)throw new d("CHOP reference requires a mined block.");let u=r?.number??e.blockNumber,[f,y]=await Promise.all([Te(o,u),e.ethUsdE18!==void 0?Promise.resolve(e.ethUsdE18.toString()):S(o,e.oracleAddress,u)]),E=h(y)*f.numerator/f.denominator;if(E<=0n)throw new d("CHOP USD reference price must be positive.");return{token:i,usdE18:E.toString(),timestamp:c}}if(i.chainId===m)try{let r=await N(o,e.blockNumber),c=p(r.timestamp,a(),s);if(r.number===null)throw new d("Pons reference requires a mined block.");let[u,f]=await Promise.all([V(i,o,r.number),S(o,e.oracleAddress,r.number)]),y=h(f)*u.numerator/u.denominator;if(y<=0n)throw new d("Pons USD reference price must be positive.");return{token:i,usdE18:y.toString(),timestamp:c}}catch{}throw new d(`Oak has no fresh on-chain trade price for ${ie(i.symbol)}, so it shows no price. balances and positions show a labeled estimate where one exists; an estimate is not a quote.`)}export{G as a,pe as b,de as c,ce as d,ue as e,me as f,ye as g,Te as h,We as i,p as j,he as k,S as l,Ke as m};
@@ -1 +0,0 @@
1
- function d(r,t){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(t,"id")}var h=new Map([]),_="find_tool",l="run_tool",w=["upoch_agent","upoch_explorer"],i=["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"],p={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"],borro:["borro_deposit","borro_withdraw"],chop:["chop_wrap","chop_unwrap"],factor:["factor_sign_up","factor_open_jobs"],raeto:["raeto_status","raeto_join","raeto_ask"],gloam:["gloam_shield","gloam_pay","gloam_claim","gloam_cash_out"],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:[],upoch:[],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 k(r,t){let a=new Set(r),s=new Set;for(let[e,n]of Object.entries(p))for(let o of n){if(s.has(o))throw new Error(`Visible tool ${o} is listed twice.`);if(e!=="oak"&&!o.startsWith(`${e}_`))throw new Error(`Visible tool ${o} is filed under ${e}.`);if(i.includes(o)||a.has(o))s.add(o);else if(t==="mainnet")throw new Error(`Visible tool ${o} is not registered.`)}for(let e of[_,l,...i,"oak_playbook"])if(a.has(e))throw new Error(`Tool name ${e} is reserved for the add-on.`);return s}export{d as a,h as b,_ as c,l as d,w as e,i as f,p as g,k as h};
@@ -1 +0,0 @@
1
- import{b as A}from"./IX3GZMTM.js";import{a as g}from"./5CAAFU7R.js";import{a as d}from"./XSD5NL7J.js";import{concat as b,encodeAbiParameters as L,getAddress as G,isAddress as C,keccak256 as h,parseAbiParameters as I,toHex as v}from"viem";var B=h(v("OakGrandfather/v1")),w="oak-grandfather/v1",D=(1n<<256n)-1n,H="0x0000000000000000000000000000000000000000000000000000000000000000";function p(e,n){if(typeof e!="string"||!C(e,{strict:!1}))throw new d(`Invalid ${n} address.`);return G(e)}function x(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new d(`${n} must be a 32-byte hex string.`);return e.toLowerCase()}function E(e){let n=typeof e=="bigint"?e:A(e);if(n<0n||n>D)throw new d("Count exceeds uint256 bounds.");return n}function j(e,n,o){let i=typeof e=="object"?e.wallet:e,t=typeof e=="object"?e.count:n,c=typeof e=="object"?e.source:o;if(t===void 0||c===void 0)throw new d("Grandfather leaf requires wallet, count and source.");let u=h(L(I("bytes32, address, uint256, address"),[B,p(i,"wallet"),E(t),p(c,"source")]));return h(u)}function R(e,n){let o=x(e,"first node"),i=x(n,"second node");return BigInt(o)<=BigInt(i)?h(b([o,i])):h(b([i,o]))}function _(e,n,o){if(!Array.isArray(o))throw new d("Grandfather proof must be an array.");let i=x(e,"root"),t=x(n,"leaf");for(let c=0;c<o.length;c++){if(!Object.prototype.hasOwnProperty.call(o,c))throw new d("Grandfather proof must not be a sparse array.");t=R(t,o[c])}return t===i}function S(e){if(!Array.isArray(e))throw new d("Grandfather entries must be an array.");let n=new Set,o=[];for(let r=0;r<e.length;r++){if(!Object.prototype.hasOwnProperty.call(e,r)||!e[r])throw new d(`Grandfather entries must not be sparse (missing index ${r}).`);let s=e[r],a=p(s.wallet,"wallet").toLowerCase(),f=p(s.source,"source").toLowerCase(),l=E(s.count).toString();if(n.has(a))throw new d(`Duplicate wallet in grandfather entries: ${a}`);n.add(a),o.push({wallet:a,count:l,source:f})}if(o.sort((r,s)=>BigInt(r.wallet)<BigInt(s.wallet)?-1:BigInt(r.wallet)>BigInt(s.wallet)?1:0),o.length===0){let r=g({entries:[],root:H,schema:w});return{schema:w,root:H,entries:[],proofs:{},canonicalJson:r}}let i=o.map(r=>j(r)),t=[i];for(;t[t.length-1].length>1;){let r=t[t.length-1],s=[];for(let a=0;a<r.length;a+=2){let f=r[a],l=r[a+1];s.push(l!==void 0?R(f,l):f)}t.push(s)}let c=t[t.length-1][0],u={},P=o.map((r,s)=>{let a=[],f=s;for(let l=0;l<t.length-1;l++){let y=t[l],m=f^1;m<y.length&&a.push(y[m]),f=Math.floor(f/2)}return u[r.wallet]=a,u[G(r.wallet)]=a,{...r,leaf:i[s],proof:a}}),T=g({entries:o.map(({count:r,source:s,wallet:a})=>({count:r,source:s,wallet:a})),root:c,schema:w});return{schema:w,root:c,entries:P,proofs:u,canonicalJson:T}}var M=S;function N(e,n){let o=p(n,"wallet").toLowerCase(),i=Array.isArray(e)?S(e):e,t=i.entries.find(u=>u.wallet.toLowerCase()===o);if(!t)throw new d(`Wallet ${n} is not in the grandfather list.`);let c=[...t.proof];return Object.defineProperties(c,{proof:{value:[...t.proof],enumerable:!1},leaf:{value:t.leaf,enumerable:!1},root:{value:i.root,enumerable:!1},entry:{value:{wallet:t.wallet,count:t.count,source:t.source},enumerable:!1},count:{value:t.count,enumerable:!1},source:{value:t.source,enumerable:!1}}),c}export{B as a,w as b,j as c,R as d,_ as e,S as f,M as g,N as h};
@@ -1 +0,0 @@
1
- import{a as fe}from"./DCGNVMKG.js";import{c as me}from"./3PHJUFU2.js";import{a as Z}from"./LQSPWRHN.js";import{a as M,b as P}from"./Z7FGEWO2.js";import{a as L}from"./VVAM3EAK.js";import{a as ue}from"./P4UQGWCP.js";import{a as x}from"./43LI5NKJ.js";import{b as de,c as le}from"./SCG5HWMN.js";import{a as re,b as X,c as j}from"./5HCXZWUH.js";import{q as ie,s as F,t as ce}from"./MQ5F2VOK.js";import{b as w,c as _,d as B,e as oe,j as E,k as ae,t as N}from"./TI727O2H.js";import{a as k}from"./XSD5NL7J.js";import{a as p,b as V,c as se}from"./JXOEJPJ4.js";import{decodeFunctionResult as De,encodeFunctionData as ve,erc20Abi as Y,getAddress as b,isAddress as G,parseAbi as ne}from"viem";var z="https://api.robinhood.com/rhj/assets",Pe={address:M,symbol:"ETH",decimals:18,chainId:w},Q={address:b(ae),symbol:"USDG",decimals:oe,chainId:w},J={address:b(E[4663].tokens.WETH.address),symbol:"WETH",decimals:18,chainId:w},we={address:b(E[4663].meridian.CollateralToken_USDe.address),symbol:"USDe",decimals:18,chainId:w};function K(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function $(e,n=w,s={}){let t=Array.isArray(e)?e:K(e)&&Array.isArray(e.assets)?e.assets:void 0;if(!t)throw new k("Official stock asset list response is malformed.");let a=new Map,d=new Map;if(t.length>1e4)throw new k("Official stock asset list exceeds the lookup limit.");for(let o of t){if(!K(o))continue;let r=o;if(typeof r.tokenSymbol!="string"||!r.tokenSymbol.trim()||!Array.isArray(r.deployments))continue;if(r.deployments.length>100)throw new k("Official stock deployment list exceeds the lookup limit.");let l=r.tokenSymbol;if(!/^[A-Za-z0-9.$_-]{1,32}$/.test(l))throw new k(`Invalid official stock ticker ${p(l)}.`);if(r.tokenDecimals!==void 0&&(typeof r.tokenDecimals!="number"||!Number.isInteger(r.tokenDecimals)||r.tokenDecimals<0||r.tokenDecimals>255))throw new k("Official stock asset has invalid token decimals.");let u=typeof r.tokenDecimals=="number"&&Number.isInteger(r.tokenDecimals)&&r.tokenDecimals>=0&&r.tokenDecimals<=255?r.tokenDecimals:18;for(let m of r.deployments){if(!K(m))continue;let h=m;if(h.chainId!==n)continue;if(typeof h.contractAddress!="string"||!G(h.contractAddress,{strict:!1}))throw new k("Official stock deployment has an invalid contract address.");let y=b(h.contractAddress),f=y.toLowerCase(),g=l.toUpperCase(),i=d.get(g);if(!s.allowAmbiguousSymbols&&i&&i!==f)throw new k(`Ambiguous official stock ticker ${p(l)} across multiple addresses.`);let c=a.get(f);if(c&&(c.symbol!==l||c.decimals!==u))throw new k(`Conflicting official stock identity at ${y}.`);d.set(g,f),a.set(f,{address:y,symbol:l,decimals:u,chainId:n,...s.includeNames&&typeof r.tokenName=="string"&&r.tokenName.trim()?{name:r.tokenName.trim()}:{}})}}return[...a.values()]}function Ee(e,n){if(typeof e.address!="string"||!G(e.address,{strict:!1}))return!1;let s=e.chainId??w,t=e.address.toLowerCase();return n.some(a=>a.chainId===s&&a.address.toLowerCase()===t&&a.symbol===e.symbol)}function W(e,n){x(e.address);let s=e.chainId??w,t=b(e.address),a=t.toLowerCase(),d=O(e.symbol),o=n.find(l=>l.chainId===s&&l.address.toLowerCase()===a),r=n.find(l=>l.chainId===s&&O(l.symbol)===d);if(o){if(e.symbol!==o.symbol)throw new k(`Token at ${t} does not match official stock ticker ${p(o.symbol)} (received ${p(e.symbol)}).`);if(e.decimals!==void 0&&e.decimals!==o.decimals)throw new k(`Token ${p(o.symbol)} at ${t} does not match official decimals ${o.decimals}.`);return o}if(r)throw new k(`Token symbol ${p(e.symbol)} at ${t} does not match the official stock contract address ${r.address}.`);return{address:t,symbol:e.symbol.trim(),decimals:e.decimals??18,chainId:s}}var xe=["AAOI","AAPL","ABCL","ADBE","AEHR","AEIS","ALAB","AMAT","AMBA","AMC","AMD","AMKR","AMZN","ANET","APLD","APP","ASML","ASTS","AUR","AVAV","AVGO","AXON","AXTI","BA","BABA","BB","BE","BMNR","BND","BULL","CBRS","CCL","CEG","CELH","CIEN","CLOV","CLS","CLSK","COHR","COIN","COST","CRCL","CRDO","CRM","CRWD","CRWV","CSCO","CTSH","CVNA","DDOG","DELL","DIS","DJT","DOCN","ELF","EWT","EWY","F","FICO","FIG","FISV","FIX","FLNC","FLY","FTNT","FUTU","GDX","GE","GEV","GLD","GLW","GLXY","GME","GOOGL","HII","HIMS","HPE","HWM","IBM","IBRX","INDA","INFQ","INOD","INTC","INTU","IONQ","IREN","JBL","JNJ","JOBY","JPM","KLAC","KSS","KTOS","LHX","LITE","LLY","LMT","LRCX","LULU","LUNR","MCD","MDB","META","MOD","MPWR","MRNA","MRVL","MSFT","MSTR","MTSI","MU","MXL","NAVN","NBIS","NET","NFLX","NNE","NOW","NU","NVDA","NVTS","OKLO","ON","ONTO","ORCL","OUST","P","PANW","PATH","PENG","PFE","PL","PLTR","POET","POWL","PR","PWR","PYPL","QBTS","QCOM","QQQ","QUBT","RBLX","RCAT","RDDT","RDW","RGTI","RIVN","RKLB","RUN","SATS","SCHD","SGOV","SHOP","SHY","SIMO","SKHY","SLS","SLV","SMCI","SMH","SMR","SNAP","SNDK","SNOW","SOFI","SOUN","SOXX","SPCX","SPMO","SPY","TE","TEAM","TEM","TER","TSEM","TSLA","TSM","TTD","TTWO","UBER","UMC","UNH","UPS","USAR","USO","V","VICR","VRT","VSAT","VST","VTI","WDAY","WDC","WULF","WYFI","XLK","XNDU","XOM","ZETA","ZM","ZS"],q=new WeakMap,ke=new WeakMap,ge=3e4,he=Object.freeze([]),D;function tt(){if(!D)return he;let e=Date.now()-D.started;return e>=0&&e<ge?D.tokens:he}var ee=new WeakMap;function H(e,n){return(ee.get(e)??F)(n)}async function Ae(e){let n=e?.http??de(),s=e?.url??z,t=e?.chainId??w,a=j(n),d=ke.get(a);d||(d=new re(ge),ke.set(a,d));let{value:o,started:r}=await H(n,()=>d.read(`${t}:${s}`,async()=>{let u=await F(h=>le(a,s,{method:"GET",signal:h},y=>K(y)||Array.isArray(y))),m=$(u,t,{allowAmbiguousSymbols:!0});if(t===w&&m.length===0)throw new k("Official stock asset list has no mainnet deployments; retry when the list is available.");return u})),l=$(o,t,e);if(t===w&&s===z&&(!D||r>=D.started||Date.now()<D.started)&&(D={started:r,tokens:Object.freeze($(o,t,{allowAmbiguousSymbols:!0}).map(u=>Object.freeze(u)))}),t===w){let u=q.get(a);u||(u=new Set,q.set(a,u));for(let m of l)u.add(O(m.symbol))}return l}var Me=ne(["function aggregate3((address target, bool allowFailure, bytes callData)[] calls) payable returns ((bool success, bytes returnData)[] returnData)"]);function ye(e){let n=e,s=new Set;for(;n&&typeof n=="object"&&!s.has(n)&&s.size<10;){s.add(n);let t=n;if(t.name==="ContractFunctionZeroDataError"||t.name==="AbiDecodingZeroDataError")return!0;let a=`${typeof t.shortMessage=="string"?t.shortMessage:""} ${typeof t.message=="string"?t.message:""}`;if(/returned no data \("0x"\)|Cannot decode zero data/i.test(a))return!0;n=t.cause}return!1}function Re(e){return e instanceof k?/RPC endpoint|too many requests|malformed JSON/i.test(e.message):e instanceof Error?/fetch failed|network|ECONNREFUSED|ETIMEDOUT|HTTP \d{3}|rate limit|too many requests/i.test(e.message):!1}async function Ue(e,n,s){if(typeof e.getCode=="function")try{let t=await e.getCode({address:n});return!t||t==="0x"}catch{return ye(s)}return ye(s)}async function Te(e,n,s){if(n.length===0)return[];let t=await Promise.allSettled(n.map(a=>e.readContract({address:a.address,abi:Y,functionName:"balanceOf",args:[s]})));if(t.every(a=>a.status==="rejected")&&t[0]?.status==="rejected"&&Re(t[0].reason))throw t[0].reason;return t.map(a=>{if(a.status!=="fulfilled"||a.value===void 0||a.value===null)return{ok:!1};try{let d=typeof a.value=="bigint"?a.value:BigInt(a.value);return d>=0n?{ok:!0,amount:d}:{ok:!1}}catch{return{ok:!1}}})}async function Se(e,n,s,t){if(s.length===0)return[];let a=ie(n,e);if(!a)return Te(e,s,t);let d=s.map(r=>({target:r.address,allowFailure:!0,callData:ve({abi:Y,functionName:"balanceOf",args:[t]})})),o;try{o=await e.readContract({address:a,abi:Me,functionName:"aggregate3",args:[d]})}catch(r){if(await Ue(e,a,r))return Te(e,s,t);throw r}if(!Array.isArray(o)||o.length!==s.length)throw new k("Multicall3 aggregate3 returned an invalid result list.");return o.map(r=>{let l=r,u=Array.isArray(l)?l[0]:l?.success,m=Array.isArray(l)?l[1]:l?.returnData;if(!u||typeof m!="string"||m==="0x")return{ok:!1};try{let h=De({abi:Y,functionName:"balanceOf",data:m}),y=typeof h=="bigint"?h:BigInt(h);return y>=0n?{ok:!0,amount:y}:{ok:!1}}catch{return{ok:!1}}})}async function nt(e,n={}){x(e);let s=b(e),t=n.chainId??w,a=n.client??ce(n.rpcUrl,t),d=[];if(n.stockTokens?d=[...n.stockTokens]:n.stockAssetsPayload!==void 0?d=$(n.stockAssetsPayload,t):n.includeStockTokens!==!1&&t!==_&&(d=await Ae({http:n.http,url:n.stockAssetsUrl,chainId:t})),n.tokens)for(let i of n.tokens)W(i,d);let o=t===w?[Q,J,we,...n.oakTokenAddress||process.env.OAK_TOKEN_ADDRESS?[{address:b(n.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS),symbol:"OAK",decimals:B,chainId:t}]:[]]:t===_?[{...Q,address:b(N.testnet.usdg),chainId:t},{...J,address:b(N.testnet.weth),chainId:t},...n.oakTokenAddress?[{address:b(n.oakTokenAddress),symbol:"OAK",decimals:B,chainId:t}]:[]]:[],r=t===w&&n.includePoolTokens!==!1?ue.vaults.flatMap(i=>[{address:b(i.tokenAddress),symbol:b(i.tokenAddress),decimals:i.tokenDecimals,chainId:t},{address:b(i.earnContractAddress),symbol:b(i.earnContractAddress),decimals:18,chainId:t}]):[],l=new Set(r.map(i=>i.address.toLowerCase())),u=[],m=new Set;for(let i of[...o,...d,...n.tokens??[],...r]){if(i.chainId!==t||P(i.address)===M)continue;let c=W(i,d),T=c.address.toLowerCase();m.has(T)||(m.add(T),u.push(c))}let[h,y]=await Promise.all([a.getBalance({address:s}),Se(a,t,u,s)]),f=[],g={address:M,symbol:"ETH",decimals:18,chainId:t};(h>0n||n.includeZero)&&f.push({token:g,amount:h.toString()});for(let i=0;i<u.length;i++){let c=u[i],T=o.some(S=>C(S.address,c.address))||d.some(S=>C(S.address,c.address))?c.symbol:p(c.symbol),I=y[i]??{ok:!1};if(!I.ok){f.push({token:{address:c.address,symbol:T,decimals:c.decimals,chainId:c.chainId},amount:"unavailable"});continue}let A=I.amount;if(A>0n&&l.has(c.address.toLowerCase()))try{let[S,R]=await Promise.all([L(a,t,c.address,"symbol"),L(a,t,c.address,"decimals")]);T=p(S),c.decimals=R}catch{}(A>0n||n.includeZero)&&f.push({token:{address:c.address,symbol:T,decimals:c.decimals,chainId:c.chainId},amount:A.toString()})}return f}async function st(e,n,s){if(x(e),n.length>1e4)throw new k("Journal token discovery exceeds the balance lookup limit.");let t=[...new Set(n.map(o=>(x(o),b(o))))].filter(o=>P(o)!==M).map(o=>({address:o,symbol:o,decimals:0,chainId:s.chainId})),a=await Se(s.client,s.chainId,t,b(e)),d=t.flatMap((o,r)=>{let l=a[r];return l.ok&&l.amount===0n?[]:[{token:o,amount:l.ok?l.amount.toString():"unavailable"}]});return Promise.all(d.map(async({token:o,amount:r})=>{let[l,u]=await Promise.all([L(s.client,s.chainId,o.address,"symbol").catch(()=>o.address),L(s.client,s.chainId,o.address,"decimals").catch(()=>{throw new k(`Token decimals are unavailable for journal-received token ${o.address}; retry balances when RPC metadata is available.`)})]);return{token:{...o,symbol:p(l),decimals:u},amount:r}}))}var C=(e,n)=>e.toLowerCase()===n.toLowerCase(),O=e=>se(e.normalize("NFKC")).toLowerCase().replace(/[^\p{L}\p{N}]/gu,"");function Oe(e){let n=e.context.network??"mainnet",{chainId:s,usdg:t,weth:a}=N[n],d=(o,r,l)=>({...o,address:P(b(o.address)),name:r,kind:l,verified:!0,source:"Oak fixed addresses",warnings:[]});return[d({...Pe,chainId:s},"Ether","native"),d({...Q,address:t,chainId:s},"Global Dollar","stablecoin"),d({...J,address:a,chainId:s},"Wrapped Ether","wrapped"),...n==="mainnet"?[d(we,"USDe","stablecoin")]:[],...e.oakTokenAddress?[d({address:e.oakTokenAddress,symbol:"OAK",decimals:B,chainId:s},"Oak","oak")]:[]]}async function Ce(e){if(e.context.network==="testnet")return[];let n=e.officialStockTokens??await Ae({http:e.context.http,includeNames:!0,allowAmbiguousSymbols:!0});return n.filter(s=>Ee(s,n)).map(s=>({...s,name:s.name??s.symbol,kind:"official_stock",verified:!0,source:z,warnings:[],identityNote:"Official Robinhood stock token: this address matches Robinhood's published list. The quoted name is text from that list."}))}async function te(e,n,s=!0){let{chainId:t}=N[n.context.network??"mainnet"],a=n.context.clientFor(t);if(await a.getChainId()!==t)throw new k(`Token lookup requires Robinhood Chain ${t}.`);let[d,o,r]=await Promise.all([H(a,()=>L(a,t,e,"name",n.blockNumber)).catch(l=>{if(s)throw l;return""}),H(a,()=>L(a,t,e,"symbol",n.blockNumber)),H(a,()=>L(a,t,e,"decimals",n.blockNumber))]);if(typeof d!="string"||s&&!d.trim()||typeof o!="string"||!o.trim()||!Number.isInteger(r)||r<0||r>255)throw new k("The contract returned invalid token metadata.");return{address:b(e),name:d||o,symbol:o,decimals:r,chainId:t}}async function be(e,n){let s=await n.context.clientFor(w).readContract({address:E[w].clanker.factory.address,abi:ne(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),functionName:"tokenDeploymentInfo",args:[e]});return Array.isArray(s)&&s.length===4&&typeof s[0]=="string"&&C(s[0],e)}async function _e(e,n){let s=n.context.clientFor(w),t=E[w].poolsTrade,a=[t.instantLaunchStrategyFeesOn.address,t.instantLaunchStrategyFeesOff.address],d=ne(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)"])[0],o=await s.getBlockNumber(),r=new Set,l=0,u=0;for(let m=63127652n;m<=o;m+=10000000n){if(++l>Ie)throw new k("Token origin scan limit reached.");let h=m+9999999n>o?o:m+9999999n,y=await s.getLogs({address:a,event:d,args:{token:e},fromBlock:m,toBlock:h,strict:!0});for(let f of y){if(f.removed||!a.some(i=>C(i,f.address))||!f.args.token||!C(f.args.token,e)||!f.transactionHash||r.has(f.transactionHash))continue;if(r.add(f.transactionHash),++u>20)throw new k("Token origin receipt limit reached.");let g=await s.getTransactionReceipt({hash:f.transactionHash});if(fe(g).some(i=>C(i.token,e)))return b(g.from)}}}var Ie=5,Be=100,Fe=500,Ke=3e4;function Le(e){let n=Date.now()+Ke,s=0,t=new Map,a=o=>{let r=n-Date.now();if(r<=0)throw new k("Token lookup time budget reached; results are partial.");return F(o,Math.min(1e4,r))},d=X((o,r)=>a(async l=>{let u=await e.context.http(o,{...r,signal:l});return new Proxy(u,{get(m,h){if(h==="json")return()=>a(()=>m.json());let y=Reflect.get(m,h,m);return typeof y=="function"?y.bind(m):y}})}),e.context.http);return ee.set(d,a),{...e,context:{...e.context,http:d,clientFor:o=>{if(!t.has(o)){let r=e.context.clientFor(o),l=u=>{if(++s>Fe)throw new k("Token lookup RPC budget reached; results are partial.");return a(u)};t.set(o,X(new Proxy(r,{get(u,m){let h=Reflect.get(u,m);return typeof h!="function"?h:(...y)=>l(()=>h.apply(u,y))}}),r)),ee.set(t.get(o),l)}return t.get(o)}}}}function pe(e){return e.source==="Oak fixed addresses"?e:{...e,symbol:p(e.symbol),name:p(e.name)}}async function ot(e,n){if(n=Le(n),typeof e!="string"||e.length>256||!O(e))throw new k("Provide a token name, symbol or address to find_token.");let s=O(e),t=G(e.trim(),{strict:!1})?P(b(e.trim())):void 0,{chainId:a}=N[n.context.network??"mainnet"],d=[],o=Oe(n),r=!1;try{o.push(...await Ce(n))}catch{r=!0,d.push("The official stock list is unavailable; results are partial and stock identities and lookalikes could not be checked.")}let l=i=>t?C(i.address,t):O(i.symbol).includes(s)||O(i.name).includes(s),u=o.filter(l),m=[],h=(i,c)=>[i.symbol,i.name??""].some(T=>[c.symbol,c.name].some(I=>{let A=O(T),S=O(I);return!!A&&!!S&&(A.includes(S)||S.includes(A))})),y=(i,c={})=>{if(m.some(A=>C(A.address,i.address)))return;let T=[`Token ${p(i.symbol)} at ${i.address} is an unverified ${c.launchpad?"launchpad token":"token"}. Use its address, not its name or symbol.`];(V(i.symbol)||V(i.name)||o.some(A=>!C(A.address,i.address)&&h(i,A)))&&T.push(`Lookalike warning: ${p(i.symbol)} at ${i.address} resembles a verified token's name or symbol.`);let I={...i,...c,kind:c.launchpad?"launchpad":"erc20",verified:!1,source:c.launchpad?`${c.launchpad} origin and on-chain metadata; not a verified token`:"On-chain metadata only",warnings:T};m.push(I),d.push(...T)};if(t&&!u.length){let i=await te(t,n),c={};if(a===w){try{await be(t,n)&&(c.launchpad="clanker")}catch{d.push("Clanker origin lookup was unavailable for this address.")}if(c.launchpad==="clanker")try{let I=(await Z(n.context,{q:t,limit:20})).tokens.find(A=>C(A.contract_address,t));I&&(c.creator=b(I.msg_sender),c.creatorSource="Clanker indexer msg_sender")}catch{d.push("Clanker creator lookup is unavailable.")}else try{let T=await me(n.context,t);c.launchpad="pons",c.creator=b(T.creator),c.creatorSource="Pons factory deployer"}catch{d.push("Pons launch origin could not be confirmed for this address.")}if(!c.launchpad)try{let T=await _e(t,n);T&&(c.launchpad="pools.trade",c.creator=T,c.creatorSource="Launch transaction sender; may be a relayer")}catch{r=!0,d.push("pools.trade launch receipt lookup is unavailable; origin results are partial.")}}y(i,c)}else if(!t&&a===w){let i=new Set,c=new Set,T,I=0,A=0;try{do{if(++I>Ie)throw new k("Token search page limit reached.");let S=await Z(n.context,{q:e.trim(),limit:20,...T?{cursor:T}:{}});for(let R of S.tokens){if(++A>Be)throw new k("Token candidate limit reached.");let v=b(R.contract_address);if(!(c.has(v)||o.some(U=>C(U.address,v)))){c.add(v);try{let U=await te(v,n);if(!l(U))continue;let Ne=await be(v,n)?{launchpad:"clanker",creator:b(R.msg_sender),creatorSource:"Clanker indexer msg_sender"}:{};y(U,Ne)}catch{r=!0,d.push(`Could not read Clanker candidate ${v}; it was omitted from these partial results.`)}}}if(S.cursor&&i.has(S.cursor))throw new k("The Clanker indexer repeated a pagination cursor.");S.cursor&&i.add(S.cursor),T=S.cursor??void 0}while(T)}catch{r=!0,d.push("Clanker name search is unavailable, incomplete or reached its scan limit; results are partial.")}d.push("Pons and pools.trade require a token address; name search does not cover those launchpads.")}a===_&&d.push("Testnet lookup covers pinned tokens and explicit token addresses; stock and launchpad discovery are unavailable.");let f=i=>[...new Map(i.map(c=>[c.address.toLowerCase(),c])).values()],g=f([...u,...m]);for(let i of g)if(g.some(c=>!C(c.address,i.address)&&(O(i.symbol)===O(c.symbol)||O(i.name)===O(c.name)))){let c=`Duplicate warning: several tokens share the symbol or name of ${i.address}. Choose the intended address; do not guess from the name.`;i.warnings.push(c),d.push(c)}return u.length>1&&d.push("Several verified tokens match this search, including possible substring matches. Choose an exact address; the search does not select a quote token."),{query:p(e.trim()),chainId:a,partial:r,matches:f(u).map(pe),unverified:f(m).map(pe),warnings:d}}async function at(e,n){if(typeof e!="string"||!e.trim())throw new k("Provide a token address or verified symbol; use find_token to look it up.");if(!/^[A-Za-z0-9.$_-]{1,42}$/.test(e))throw new k("Use an exact ASCII verified symbol or token address; use find_token to look it up.");let s=e,t=G(s,{strict:!1})?P(b(s)):void 0,a=Oe(n),d=t&&a.find(y=>C(y.address,t));if(d)return d;let o=s.toUpperCase()==="$OAK"?"OAK":s.toUpperCase(),r=!t&&a.find(y=>y.symbol.toUpperCase()===o),l=[],u=!1;try{l=await Ce(n)}catch{if(r)return r;if(!t)throw new k("The official stock list is unavailable; stock symbols cannot be checked. Use find_token and try again when the list is reachable.");u=!0}if(t){let y=l.find(i=>C(i.address,t));if(y)return n.tokenMetadata&&W(n.tokenMetadata,l),{...y,name:p(y.name)};let f=n.tokenMetadata??await n.readMetadata?.(t);if(f&&(!C(f.address,t)||f.chainId!==N[n.context.network??"mainnet"].chainId))throw new k("Token metadata does not match the requested address and chain.");if(f&&(typeof f.symbol!="string"||!f.symbol.trim()||!Number.isInteger(f.decimals)||f.decimals<0||f.decimals>255))throw new k("The contract returned invalid token metadata.");let g=f?{...f,name:f.symbol}:await te(t,Le(n),!1);if(u){let i=O(g.symbol),c=q.get(j(n.context.http));if(xe.some(T=>O(T)===i)||c?.has(i))throw new k("The official stock list is unavailable; this address claims a stock ticker that cannot be checked. Try again when the list is reachable.")}return W(g,l),{...g,symbol:p(g.symbol),name:p(g.name),kind:"erc20",verified:!1,source:"On-chain metadata only",warnings:["This token address is unverified. On-chain names and symbols do not prove identity.",...u?["The official stock list is unavailable; stock identity could not be verified."]:[]]}}let m=[...a,...l].filter(y=>y.symbol.toUpperCase()===o);if(m.length!==1)throw new k(`Token symbol ${p(s)} is ${m.length?"ambiguous":"unverified"}; use find_token and choose an explicit address.`);let h=m[0];if(h.kind==="official_stock"&&s!==h.symbol)throw new k(`Use the exact official stock ticker ${p(h.symbol)}; case variants are refused.`);return h.source==="Oak fixed addresses"?h:{...h,name:p(h.name)}}export{z as a,Pe as b,Q as c,J as d,we as e,$ as f,Ee as g,W as h,tt as i,Ae as j,Me as k,nt as l,st as m,ot as n,at as o};
@@ -1 +0,0 @@
1
- import{e as T,f as re,g as B,i as ae,j as O}from"./6D3XNCOX.js";import{F as I,a as ee,b as oe,c as _,f as L,h as S,m as te,n as y,r as z,s as se,t as ne,v as ie}from"./KLEJ3W4T.js";import{a as U}from"./YEIM6BZQ.js";import{f as W,g as Q}from"./RA7DOR7F.js";import{a as K}from"./Z7FGEWO2.js";import{a as J}from"./43LI5NKJ.js";import{g as E}from"./NWNYJ26T.js";import{b as k,n as Z}from"./TI727O2H.js";import{a as b,b as F,e as Y}from"./XSD5NL7J.js";import{decodeAbiParameters as we,getAddress as v,pad as de,parseAbi as fe,parseAbiParameters as Pe,toEventSelector as be,toHex as ce,zeroAddress as pe}from"viem";var ke=be("Initialize(bytes32,address,address,uint24,int24,address,uint160,int24)"),ye=Pe("uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick"),Ae=10000000n,Ie=10000n,me=25,X=200,R=16,ve=3e3,Ce=500,Se=500n,q=100,$=fe(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),_e=fe(["function poolKeys(bytes25 poolId) view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)"]);function Le(o){let e=o.trim().toLowerCase();return e==="eth"||e==="native"||e===pe||e===K.toLowerCase()}function le(o,e){if(o!=null){if(typeof o!="string")throw new b(`${e} must be a token address, or "eth" for native ETH.`);return Le(o)?{eth:!0}:(J(o),{eth:!1,address:v(o)})}}var he=(o,e)=>BigInt(o)<BigInt(e)?-1:BigInt(o)>BigInt(e)?1:0;function x(o){return{address:o.address,symbol:o.symbol,decimals:o.decimals}}async function ge(o,e,r,i,a){let[t,s,f]=await Promise.all([o.readContract({address:e,abi:O,functionName:"slot0"}),o.readContract({address:e,abi:O,functionName:"liquidity"}),o.readContract({address:e,abi:O,functionName:"tickSpacing"})]),n=BigInt(t[0]);return{version:"v3",id:e,feePercent:U(a),highFee:a>=5e4,token0:x(r),token1:x(i),fee:a,tickSpacing:Number(f),initialized:n>0n,liquidity:BigInt(s).toString(),sqrtPriceX96:n.toString(),tick:Number(t[1]),price:n>0n?W(n,r.decimals,i.decimals):"0",addSupported:!0}}async function H(o,e,r){let i=r??ne(e),[a,t]=await Promise.all([I(o,e.currency0,k),I(o,e.currency1,k)]),[s,f]=await Promise.all([o.readContract({address:_,abi:$,functionName:"getSlot0",args:[i]}),o.readContract({address:_,abi:$,functionName:"getLiquidity",args:[i]})]),n=BigInt(s[0]),w=ie(e,Number(s[3]));return{version:"v4",id:i,feePercent:U((e.fee&8388608)!==0?Number(s[3]):e.fee),highFee:((e.fee&8388608)!==0?Number(s[3]):e.fee)>=5e4,token0:x(a),token1:x(t),fee:e.fee,tickSpacing:e.tickSpacing,hooks:v(e.hooks),initialized:n>0n,liquidity:BigInt(f).toString(),sqrtPriceX96:n.toString(),tick:Number(s[1]),price:n>0n?W(n,a.decimals,t.decimals):"0",addSupported:z.has(e.hooks.toLowerCase()),feeNote:w.feeNote,...z.has(e.hooks.toLowerCase())?{}:{note:e.hooks.toLowerCase()===Z.toLowerCase()?new te(se(e.currency0)?e.currency1:void 0).message:`Hook ${v(e.hooks)} is not one Oak has measured, so uniswap_add will refuse this pool.`}}}async function Ne(o,e,r,i){let a=await o.getBlockNumber(),t=[],s=new Set,f=!1,n=Ae;for(let d=a;;){let u=d+1n>n?d-n+1n:0n,l;try{l=await o.request({method:"eth_getLogs",params:[{address:ee.toLowerCase(),topics:[ke,null,e?de(e):null,r?de(r):null],fromBlock:ce(u),toBlock:ce(d)}]})}catch(p){if(F(p,-32601)||n<=Ie)throw p;n/=2n;continue}if(!Array.isArray(l))throw new b("Invalid v4 Initialize log response.");let P=[];for(let p of l){if(!Array.isArray(p.topics)||p.topics.length!==4||typeof p.data!="string")throw new b("Invalid v4 Initialize log.");let[A,C,N]=we(ye,p.data),D={currency0:v(`0x${p.topics[2].slice(-40)}`),currency1:v(`0x${p.topics[3].slice(-40)}`),fee:Number(A),tickSpacing:Number(C),hooks:v(N)};P.push({key:D,id:p.topics[1]}),s.add(p.topics[1].toLowerCase())}if(t.push(P),u===0n)break;if(s.size>=i){f=!0;break}d=u-1n}let w=new Map;for(let d of t.reverse())for(let u of d)w.set(u.id.toLowerCase(),u);return{pools:[...w.values()],cut:f}}async function Ee(o,e,r){let i=e.eth?T.weth:e.address,a=r.eth?T.weth:r.address;if(i===a)return[];let[t,s]=he(i,a)<0?[i,a]:[a,i],[f,n]=await Promise.all([I(o,t,k),I(o,s,k)]),w=[];for(let d of Object.keys(re).map(Number)){let u=v(String(await o.readContract({address:T.factory,abi:ae,functionName:"getPool",args:[t,s,d]})));u!==pe&&w.push(await ge(o,u,f,n,d))}return w}function ue(o){return o?o.eth?[S,L]:o.address===L?[L,S]:[o.address]:null}async function Te(o,e){let r=new Map;if(e.length===0)return r;if(typeof o.multicall=="function"&&o.chain?.contracts?.multicall3)try{return(await o.multicall({allowFailure:!0,contracts:e.map(a=>({address:_,abi:$,functionName:"getLiquidity",args:[a]}))})).forEach((a,t)=>r.set(e[t].toLowerCase(),a.status==="success"?BigInt(a.result):0n)),r}catch{}for(let i=0;i<e.length;i+=R)(await Promise.allSettled(e.slice(i,i+R).map(async t=>BigInt(await o.readContract({address:_,abi:$,functionName:"getLiquidity",args:[t]}))))).forEach((t,s)=>r.set(e[i+s].toLowerCase(),t.status==="fulfilled"?t.value:0n));return r}async function Be(o,e,r,i){let a=ue(e),t=ue(r),s=new Map,f=(c,h)=>{if(c&&h){if(c===h)return;let[m,g]=he(c,h)<0?[c,h]:[h,c];s.set(`${m}/${g}`,[m,g])}else if(c||h){let m=c??h;s.set(`${m}/*0`,[m,null]),s.set(`${m}/*1`,[null,m])}};for(let c of a??[null])for(let h of t??[null])f(c,h);let n=new Map;for(let c of y)[...s.values()].some(([m,g])=>(!m||E(c.key.currency0,m))&&(!g||E(c.key.currency1,g)))&&n.set(c.poolId.toLowerCase(),{key:c.key,id:c.poolId});let d=typeof o.multicall=="function"&&!!o.chain?.contracts?.multicall3?ve:Ce,u=!1;for(let[c,h]of s.values()){let m=await Ne(o,c,h,d+y.length);u||=m.cut;for(let g of m.pools)n.set(g.id.toLowerCase(),g)}let l=new Set(y.map(c=>c.poolId.toLowerCase())),P=[...n.values()],p=P.filter(c=>l.has(c.id.toLowerCase())),A=P.filter(c=>!l.has(c.id.toLowerCase())).reverse();(A.length>d||u)&&i.push(`${u?"At least ":""}${A.length} v4 pools match; only the newest ${d} non-measured ones were considered. Pass both tokens, or a poolId, to narrow.`);let C=A.slice(0,d),N=await Te(o,C.map(c=>c.id)),D=C.sort((c,h)=>{let m=N.get(c.id.toLowerCase())??0n,g=N.get(h.id.toLowerCase())??0n;return m===g?0:m<g?1:-1}),V=[...p,...D];V.length>X&&i.push(`${V.length} v4 pools match; full state was read for Oak's measured pools plus the deepest of the rest (${X} total). Pass both tokens, or a poolId, to narrow.`);let G=[],M=0,j=V.slice(0,X);for(let c=0;c<j.length;c+=R){let h=await Promise.allSettled(j.slice(c,c+R).map(({key:m,id:g})=>H(o,m,g)));for(let m of h)m.status==="fulfilled"?G.push(m.value):M++}return M>0&&i.push(`${M} pool(s) were skipped because a token or pool state could not be read.`),G}async function Oe(o,e){let r=y.find(n=>E(n.poolId,e));if(r)return H(o,r.key,r.poolId);let[i,a,t,s,f]=await o.readContract({address:oe,abi:_e,functionName:"poolKeys",args:[e.slice(0,52)]});if(i===S&&a===S&&Number(s)===0)throw new b(`No Uniswap v4 pool ${e} is known to the PositionManager (no position was ever minted in it, or it is not initialized). Search by token pair instead.`);return H(o,{currency0:i,currency1:a,fee:Number(t),tickSpacing:Number(s),hooks:f},e)}function qe(o){let e=new Set([...y.map(t=>t.poolId.toLowerCase()),...B.map(t=>t.address.toLowerCase())]),r=new Set([S,K.toLowerCase(),L.toLowerCase()]),i=t=>r.has(t.address.toLowerCase())?"ETH":t.address.toLowerCase(),a=new Map;for(let t of o.filter(s=>s.initialized&&BigInt(s.liquidity)>0n)){let s=`${i(t.token0)}/${i(t.token1)}`;a.set(s,[...a.get(s)??[],t])}for(let t of a.values()){let s=t.filter(d=>e.has(d.id.toLowerCase()));if(s.length===0&&t.length<3)continue;let n=(s.length>0?s:t).map(d=>BigInt(d.sqrtPriceX96)).sort((d,u)=>d<u?-1:d>u?1:0),w=n[Math.floor(n.length/2)];for(let d of t){if(e.has(d.id.toLowerCase()))continue;let u=Q(BigInt(d.sqrtPriceX96),w);u>Se&&(d.priceOutlierBps=Number(u),d.note=`${d.note?`${d.note} `:""}Price differs ${u} bps from the ${s.length>0?"Oak-measured":"median"} price for this pair; do not treat this pool as the market price.`)}}}async function Re(o,e){let r=e.version;if(r!==void 0&&r!=="v3"&&r!=="v4")throw new b('version must be "v3" or "v4"; omit it to search both.');let i=e.limit===void 0?me:Number(e.limit);if(!Number.isInteger(i)||i<1||i>q)throw new b(`limit must be an integer from 1 to ${q}.`);let a=le(e.tokenA,"tokenA"),t=le(e.tokenB,"tokenB");if(!a&&t)throw new b("Provide tokenA when searching by token; tokenB narrows the search to a pair.");let s=o.clientFor(k),f=[],n=[];if(e.poolId!==void 0){if(typeof e.poolId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.poolId))throw new b("poolId must be a 32-byte hex v4 poolId. For v3 search by tokenA/tokenB.");n=[await Oe(s,e.poolId)]}else if(a){if(r!=="v4"&&(t?n.push(...await Ee(s,a,t)):f.push("v3 pools are looked up per pair; pass tokenB to include them.")),r!=="v3")try{n.push(...await Be(s,a,t,f))}catch(l){throw F(l,-32601)?l:new b(`Could not search v4 pools. ${Y(l)}`)}}else{f.push("No token filter given: showing the pools Oak has measured. Pass tokenA (and tokenB) to search the chain for every pool of a pair.");let l=await Promise.all(B.map(async p=>{let[A,C]=await Promise.all([I(s,p.token0,k),I(s,p.token1,k)]);return ge(s,p.address,A,C,p.fee)})),P=await Promise.all(y.map(p=>H(s,p.key,p.poolId)));n=[...r==="v4"?[]:l,...r==="v3"?[]:P]}qe(n);let w=new Set([...y.map(l=>l.poolId.toLowerCase()),...B.map(l=>l.address.toLowerCase())]),d=0;n=n.filter(l=>!l.highFee||w.has(l.id.toLowerCase())?!0:e.includeHighFeePools===!0?(l.note=`Do not trade here: ${l.feePercent} fee.${l.note?` ${l.note}`:""}`,!0):(d++,!1)),d&&f.push(`${d} pools with fees of 5% or more were left out. To see them, pass includeHighFeePools: true.`),n.sort((l,P)=>BigInt(P.liquidity)>BigInt(l.liquidity)?1:BigInt(P.liquidity)<BigInt(l.liquidity)?-1:0),n.length>i&&f.push(`Showing the ${i} deepest of ${n.length} pools found; raise limit (max ${q}) to see more.`),n=n.slice(0,i);let u=n.filter(l=>l.initialized&&BigInt(l.liquidity)>0n).length;return n.length===0&&d===0&&f.push("No pool exists for this pair. Create one with uniswap_create_pool, or create it and add the first liquidity together with uniswap_add plus initialPrice."),{pools:n,notes:f,summary:`Found ${n.length} Uniswap pool(s), ${u} with active liquidity. price is token1 per 1 token0.`}}function ze(o){return{tools:[{name:"uniswap_pools",inputSchema:{type:"object",description:"Read-only pool discovery on Robinhood Chain (4663): every Uniswap v3 and v4 pool for a token pair with fee, tick spacing, hook, liquidity and price, or one v4 pool by poolId. No tokens given: the measured pools.",properties:{version:{type:"string",enum:["v3","v4"],description:"Limit to one version; omit to search both."},tokenA:{type:"string",description:'Token address, or "eth" for native ETH (searches v3 WETH and v4 native/WETH pools).'},tokenB:{type:"string",description:"Second token of the pair. Required for v3 lookups."},poolId:{type:"string",description:"32-byte v4 poolId to inspect."},includeHighFeePools:{description:"Include pools above the usual fee threshold in discovery.",type:"boolean"},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:q,default:me}}},execute:async r=>Re(o,r)}]}}export{Re as a,ze as b};