@oakagentkit/core 0.2.5 → 0.2.6

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 (291) hide show
  1. package/build/dist/api/history.js +1 -1
  2. package/build/dist/api/modules/borro/actions.js +1 -1
  3. package/build/dist/api/modules/borro/checks.js +1 -1
  4. package/build/dist/api/modules/borro/copy.d.ts +4 -4
  5. package/build/dist/api/modules/borro/copy.js +1 -1
  6. package/build/dist/api/modules/borro/index.js +1 -1
  7. package/build/dist/api/modules/borro/liquidity.js +1 -1
  8. package/build/dist/api/modules/borro/positions.js +1 -1
  9. package/build/dist/api/modules/borro/reader.d.ts +6 -2
  10. package/build/dist/api/modules/borro/reader.js +1 -1
  11. package/build/dist/api/modules/borro/types.d.ts +6 -0
  12. package/build/dist/api/modules/chop/abi.d.ts +527 -0
  13. package/build/dist/api/modules/chop/abi.js +1 -0
  14. package/build/dist/api/modules/chop/actions.d.ts +24 -0
  15. package/build/dist/api/modules/chop/actions.js +1 -0
  16. package/build/dist/api/modules/chop/checks.d.ts +26 -0
  17. package/build/dist/api/modules/chop/checks.js +1 -0
  18. package/build/dist/api/modules/chop/copy.d.ts +5 -0
  19. package/build/dist/api/modules/chop/copy.js +1 -0
  20. package/build/dist/api/modules/chop/guard.d.ts +13 -0
  21. package/build/dist/api/modules/chop/guard.js +1 -0
  22. package/build/dist/api/modules/chop/index.d.ts +3 -0
  23. package/build/dist/api/modules/chop/index.js +1 -0
  24. package/build/dist/api/modules/chop/pins.d.ts +53 -0
  25. package/build/dist/api/modules/chop/pins.js +1 -0
  26. package/build/dist/api/modules/chop/positions.d.ts +3 -0
  27. package/build/dist/api/modules/chop/positions.js +1 -0
  28. package/build/dist/api/modules/chop/reader.d.ts +70 -0
  29. package/build/dist/api/modules/chop/reader.js +1 -0
  30. package/build/dist/api/modules/chop/types.d.ts +32 -0
  31. package/build/dist/api/modules/chop/types.js +0 -0
  32. package/build/dist/api/modules/clanker/index.js +1 -1
  33. package/build/dist/api/modules/earn/index.js +1 -1
  34. package/build/dist/api/modules/erc8004/index.js +1 -1
  35. package/build/dist/api/modules/gloam/abi.d.ts +89 -0
  36. package/build/dist/api/modules/gloam/abi.js +1 -0
  37. package/build/dist/api/modules/gloam/actions.d.ts +5 -0
  38. package/build/dist/api/modules/gloam/actions.js +1 -0
  39. package/build/dist/api/modules/gloam/checks.d.ts +17 -0
  40. package/build/dist/api/modules/gloam/checks.js +1 -0
  41. package/build/dist/api/modules/gloam/copy.d.ts +22 -0
  42. package/build/dist/api/modules/gloam/copy.js +2 -0
  43. package/build/dist/api/modules/gloam/index.d.ts +6 -0
  44. package/build/dist/api/modules/gloam/index.js +1 -0
  45. package/build/dist/api/modules/gloam/pins.d.ts +41 -0
  46. package/build/dist/api/modules/gloam/pins.js +1 -0
  47. package/build/dist/api/modules/gloam/types.d.ts +308 -0
  48. package/build/dist/api/modules/gloam/types.js +1 -0
  49. package/build/dist/api/modules/grove/index.js +1 -1
  50. package/build/dist/api/modules/heyresearch/index.js +1 -1
  51. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  52. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  53. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  54. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  55. package/build/dist/api/modules/hoodlock/index.js +1 -1
  56. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  57. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  58. package/build/dist/api/modules/hoodlock/public.js +1 -1
  59. package/build/dist/api/modules/hookr/actions.js +1 -1
  60. package/build/dist/api/modules/hookr/addons.js +1 -1
  61. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  62. package/build/dist/api/modules/hookr/contracts.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-options.js +1 -1
  68. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  69. package/build/dist/api/modules/hookr/launch.js +1 -1
  70. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  71. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  72. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  73. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  74. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  75. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  76. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  77. package/build/dist/api/modules/hookr/relay.js +1 -1
  78. package/build/dist/api/modules/kyberswap/index.js +1 -1
  79. package/build/dist/api/modules/layerbank/actions.js +1 -1
  80. package/build/dist/api/modules/layerbank/index.js +1 -1
  81. package/build/dist/api/modules/layerbank/reader.js +1 -1
  82. package/build/dist/api/modules/longbow/administration.js +1 -1
  83. package/build/dist/api/modules/longbow/fixed.js +1 -1
  84. package/build/dist/api/modules/longbow/index.js +1 -1
  85. package/build/dist/api/modules/meridian/index.js +1 -1
  86. package/build/dist/api/modules/meridian/rfq.js +1 -1
  87. package/build/dist/api/modules/merkl/discovery.js +1 -1
  88. package/build/dist/api/modules/merkl/index.js +1 -1
  89. package/build/dist/api/modules/merkl/manage.js +1 -1
  90. package/build/dist/api/modules/morpho/bundles.js +1 -1
  91. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  92. package/build/dist/api/modules/morpho/index.js +1 -1
  93. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  94. package/build/dist/api/modules/morpho/midnight.js +1 -1
  95. package/build/dist/api/modules/morpho/protocol.js +1 -1
  96. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  97. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  98. package/build/dist/api/modules/netnet/card-read.js +1 -1
  99. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  100. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  101. package/build/dist/api/modules/netnet/financial.js +1 -1
  102. package/build/dist/api/modules/netnet/index.js +1 -1
  103. package/build/dist/api/modules/orbio/index.js +1 -1
  104. package/build/dist/api/modules/pendle/index.js +1 -1
  105. package/build/dist/api/modules/pendle/reader.js +1 -1
  106. package/build/dist/api/modules/pons/claim.js +1 -1
  107. package/build/dist/api/modules/pons/index.js +1 -1
  108. package/build/dist/api/modules/pons/launch-status.d.ts +1 -0
  109. package/build/dist/api/modules/pons/launch-status.js +1 -1
  110. package/build/dist/api/modules/pons/reads.js +1 -1
  111. package/build/dist/api/modules/pons/trade.js +1 -1
  112. package/build/dist/api/modules/poolstrade/index.js +1 -1
  113. package/build/dist/api/modules/priors/coverage.js +1 -1
  114. package/build/dist/api/modules/priors/discovery.js +1 -1
  115. package/build/dist/api/modules/priors/index.js +1 -1
  116. package/build/dist/api/modules/priors/integration.js +1 -1
  117. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  118. package/build/dist/api/modules/relay/discovery.js +1 -1
  119. package/build/dist/api/modules/relay/inbound.js +1 -1
  120. package/build/dist/api/modules/relay/index.js +1 -1
  121. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  122. package/build/dist/api/modules/spark/index.js +1 -1
  123. package/build/dist/api/modules/steakhouse/index.js +1 -1
  124. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  125. package/build/dist/api/modules/steakhouse/management.js +1 -1
  126. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  127. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  128. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  129. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  130. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  131. package/build/dist/api/modules/tickerspring/index.js +1 -1
  132. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  133. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  134. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  135. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  136. package/build/dist/api/modules/tickerspring/research.js +1 -1
  137. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  138. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  139. package/build/dist/api/modules/uniswap/auction.js +1 -1
  140. package/build/dist/api/modules/uniswap/batch.js +1 -1
  141. package/build/dist/api/modules/uniswap/common.js +1 -1
  142. package/build/dist/api/modules/uniswap/fees.js +1 -1
  143. package/build/dist/api/modules/uniswap/index.js +1 -1
  144. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  145. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  146. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  147. package/build/dist/api/modules/uniswap/pools.js +1 -1
  148. package/build/dist/api/modules/uniswap/position.js +1 -1
  149. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  150. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  151. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  152. package/build/dist/api/modules/uniswap/trade.js +1 -1
  153. package/build/dist/api/modules/uniswap/v2.js +1 -1
  154. package/build/dist/api/modules/uniswap/v3.js +1 -1
  155. package/build/dist/api/modules/uniswap/v4.js +1 -1
  156. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  157. package/build/dist/api/modules/velora/claims.js +1 -1
  158. package/build/dist/api/modules/velora/index.js +1 -1
  159. package/build/dist/api/modules/wormhole/index.d.ts +3 -0
  160. package/build/dist/api/modules/wormhole/index.js +1 -1
  161. package/build/dist/api/modules/wormhole/swap-token-verdict.d.ts +11 -0
  162. package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -0
  163. package/build/dist/api/modules/wormhole/third-party-text.d.ts +13 -0
  164. package/build/dist/api/modules/wormhole/third-party-text.js +1 -0
  165. package/build/dist/api/modules/wormhole/token-check.d.ts +2 -0
  166. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  167. package/build/dist/api/modules/wormhole/x402-client.d.ts +36 -0
  168. package/build/dist/api/modules/wormhole/x402-client.js +1 -0
  169. package/build/dist/api/prices.js +1 -1
  170. package/build/dist/api/send.js +1 -1
  171. package/build/dist/api/signing-registry.js +1 -1
  172. package/build/dist/api/simulate.js +1 -1
  173. package/build/dist/api/swap.js +1 -1
  174. package/build/dist/api/tokens.js +1 -1
  175. package/build/dist/api/tool-policy.js +1 -1
  176. package/build/dist/api/types.d.ts +6 -1
  177. package/build/dist/chunks/{3FUVMSCF.js → 2MT3G7YZ.js} +1 -1
  178. package/build/dist/chunks/{GEIFITAQ.js → 2THSW4QN.js} +1 -1
  179. package/build/dist/chunks/{GQ5GYUEH.js → 2VXLVXIB.js} +1 -1
  180. package/build/dist/chunks/{HCUHMCBW.js → 35KR3VSS.js} +1 -1
  181. package/build/dist/chunks/{P7I62KFR.js → 3GQ7A3VB.js} +1 -1
  182. package/build/dist/chunks/3VWVW7PX.js +1 -0
  183. package/build/dist/chunks/4DP2VPXR.js +3 -0
  184. package/build/dist/chunks/{MR5L7V6Z.js → 4EN6MQEI.js} +1 -1
  185. package/build/dist/chunks/{LSXUAHOE.js → 4I3OU56B.js} +1 -1
  186. package/build/dist/chunks/{NEEZBJBC.js → 5AXWBSPG.js} +1 -1
  187. package/build/dist/chunks/{VY7XRHZQ.js → 5N3O42X6.js} +1 -1
  188. package/build/dist/chunks/{X3PQMS4N.js → 5SZPNZG4.js} +1 -1
  189. package/build/dist/chunks/{VYN2NRAP.js → 6JAXZNZ3.js} +1 -1
  190. package/build/dist/chunks/{APGLZXIW.js → 6O3Q5B6M.js} +1 -1
  191. package/build/dist/chunks/6YB3VOUL.js +1 -0
  192. package/build/dist/chunks/77CLMPM7.js +1 -0
  193. package/build/dist/chunks/{GL4NCUMH.js → 7GJ6SLEV.js} +1 -1
  194. package/build/dist/chunks/{57MEFFCU.js → 7KWZ5QJU.js} +1 -1
  195. package/build/dist/chunks/{326QMOTR.js → 7QIO77VE.js} +1 -1
  196. package/build/dist/chunks/7QZOTRSA.js +2 -0
  197. package/build/dist/chunks/{UHVSINR5.js → A7I4IWUB.js} +1 -1
  198. package/build/dist/chunks/{6PBGEPUK.js → ACW63WIL.js} +4 -4
  199. package/build/dist/chunks/{P56RZC2M.js → AEL62KCG.js} +1 -1
  200. package/build/dist/chunks/{6B3VVISQ.js → ALLLYOUG.js} +1 -1
  201. package/build/dist/chunks/APQYLJGS.js +1 -0
  202. package/build/dist/chunks/{FQ6UZCM6.js → AW7AXQCZ.js} +1 -1
  203. package/build/dist/chunks/{T3AJSQYT.js → AXRL3REN.js} +1 -1
  204. package/build/dist/chunks/{INOZIE55.js → BBTPRZ6T.js} +1 -1
  205. package/build/dist/chunks/{WDK6VOG4.js → BND2UFVW.js} +1 -1
  206. package/build/dist/chunks/{3NJ5KQ3Q.js → BOVMED7R.js} +1 -1
  207. package/build/dist/chunks/{74Y2KDNR.js → CBLMQ5UU.js} +1 -1
  208. package/build/dist/chunks/CDPSMI3Z.js +1 -0
  209. package/build/dist/chunks/{XR7VK24E.js → CQEJSCFQ.js} +1 -1
  210. package/build/dist/chunks/{GW626GG2.js → DBNTZEAJ.js} +1 -1
  211. package/build/dist/chunks/{SSHCD6RZ.js → DHUDSOGR.js} +1 -1
  212. package/build/dist/chunks/{3GOHSYHW.js → DL6AEWEM.js} +1 -1
  213. package/build/dist/chunks/{UMIZMJWW.js → EGYVRQUR.js} +1 -1
  214. package/build/dist/chunks/{Y25EXZCO.js → FEYAY6OZ.js} +1 -1
  215. package/build/dist/chunks/FIO6VC2J.js +1 -0
  216. package/build/dist/chunks/FJ4S4GHY.js +1 -0
  217. package/build/dist/chunks/{X3BYCOWS.js → FUDAXV5X.js} +1 -1
  218. package/build/dist/chunks/{Z43BTOTE.js → GG6Y4OCJ.js} +1 -1
  219. package/build/dist/chunks/{ELSXLZN5.js → GGHBFLRC.js} +1 -1
  220. package/build/dist/chunks/{L4N2RSK2.js → GRQYTVNT.js} +1 -1
  221. package/build/dist/chunks/{2MAMJJJC.js → GSBIERZD.js} +1 -1
  222. package/build/dist/chunks/{J2OT4KAH.js → H6T5FXEX.js} +1 -1
  223. package/build/dist/chunks/HHXBUYHO.js +1 -0
  224. package/build/dist/chunks/{MJ6WEWMI.js → HQUVB7Z5.js} +1 -1
  225. package/build/dist/chunks/HS4DZPYT.js +1 -0
  226. package/build/dist/chunks/{S7IFAQPG.js → HU7IMNBI.js} +1 -1
  227. package/build/dist/chunks/{5APS4T2D.js → HWX36XJI.js} +1 -1
  228. package/build/dist/chunks/I55MURSJ.js +1 -0
  229. package/build/dist/chunks/I6PQW2JI.js +1 -0
  230. package/build/dist/chunks/{KIFSRO5K.js → IPN6Z4JM.js} +1 -1
  231. package/build/dist/chunks/{NDCLTVIU.js → IPRVIKYC.js} +1 -1
  232. package/build/dist/chunks/{VJS4DHQQ.js → IVX4R5OL.js} +1 -1
  233. package/build/dist/chunks/JFYBH3DX.js +1 -0
  234. package/build/dist/chunks/JQOQMFWD.js +3 -0
  235. package/build/dist/chunks/{BJ2VGRF4.js → JZS3E66E.js} +1 -1
  236. package/build/dist/chunks/{W6BS3T7S.js → KVFZKPJT.js} +1 -1
  237. package/build/dist/chunks/{QZZ4O34L.js → LKXO2BQS.js} +1 -1
  238. package/build/dist/chunks/{BBS3ODWZ.js → LKZX4CAA.js} +1 -1
  239. package/build/dist/chunks/{H2XDMFQQ.js → LYMNHO5T.js} +1 -1
  240. package/build/dist/chunks/{KPCY5V35.js → M2UXYCKH.js} +1 -1
  241. package/build/dist/chunks/{ZMFRMWHR.js → M6LC6DRE.js} +1 -1
  242. package/build/dist/chunks/{VOMGT5SG.js → MOE3EVAL.js} +1 -1
  243. package/build/dist/chunks/{2KYAMXTS.js → NOFUKKP5.js} +1 -1
  244. package/build/dist/chunks/{AVG4W3Y7.js → O6ROOKY2.js} +1 -1
  245. package/build/dist/chunks/{BTD5SMOW.js → OLSP46ZD.js} +1 -1
  246. package/build/dist/chunks/{E674J2MD.js → OOZSE2R7.js} +1 -1
  247. package/build/dist/chunks/{P3S4BR5G.js → P5AJSLZ7.js} +1 -1
  248. package/build/dist/chunks/{RQ4GHJXE.js → PACN53TR.js} +1 -1
  249. package/build/dist/chunks/{U67J4BCH.js → PAHXBLCS.js} +1 -1
  250. package/build/dist/chunks/PAY5PD4H.js +1 -0
  251. package/build/dist/chunks/{T2WHOZXM.js → PIIHOXWF.js} +1 -1
  252. package/build/dist/chunks/{HSCQZ66A.js → PNA6UIE5.js} +1 -1
  253. package/build/dist/chunks/{X2KFXCVD.js → PZGGE5D3.js} +1 -1
  254. package/build/dist/chunks/{553UE2ZQ.js → QA2RRIES.js} +1 -1
  255. package/build/dist/chunks/{Z4FZVJ5Z.js → QBIY6FQN.js} +1 -1
  256. package/build/dist/chunks/{D3YLXQPW.js → QFNT73OF.js} +1 -1
  257. package/build/dist/chunks/QHBS3PVU.js +1 -0
  258. package/build/dist/chunks/QW2OPEYJ.js +1 -0
  259. package/build/dist/chunks/{YWRDZQI6.js → QYVREJYC.js} +1 -1
  260. package/build/dist/chunks/{W2BYU5JQ.js → ROFPXEQ5.js} +1 -1
  261. package/build/dist/chunks/{OKUO3BVM.js → RTAHNWHN.js} +1 -1
  262. package/build/dist/chunks/{UHTRW2R6.js → RTGS7RIO.js} +1 -1
  263. package/build/dist/chunks/{CCTXCMH4.js → S5CBVFHY.js} +1 -1
  264. package/build/dist/chunks/{JVLLVNF2.js → T7TFUH5K.js} +1 -1
  265. package/build/dist/chunks/{OJPG45AC.js → TPBAFS7K.js} +1 -1
  266. package/build/dist/chunks/{B3RXD5ET.js → U2RMUVVY.js} +1 -1
  267. package/build/dist/chunks/{4MXM6Q4W.js → UD2XMNIT.js} +1 -1
  268. package/build/dist/chunks/V5JWGWXC.js +1 -0
  269. package/build/dist/chunks/VCOTCVKN.js +1 -0
  270. package/build/dist/chunks/{QO3KCJMP.js → VNV6ZISN.js} +1 -1
  271. package/build/dist/chunks/{TM2XCRU7.js → X2P55AC3.js} +1 -1
  272. package/build/dist/chunks/XD6X3KTC.js +1 -0
  273. package/build/dist/chunks/{C36BFZH6.js → XKSVTN5X.js} +1 -1
  274. package/build/dist/chunks/{IY7BXLT4.js → XL3LLGIR.js} +1 -1
  275. package/build/dist/chunks/XQA5LCL6.js +1 -0
  276. package/build/dist/chunks/{S47VUTHM.js → XSKFKBDR.js} +1 -1
  277. package/build/dist/chunks/{6D5DJA5B.js → YRNXGQJC.js} +1 -1
  278. package/build/dist/chunks/YWRLY5EA.js +1 -0
  279. package/build/dist/chunks/YWSX6IE6.js +1 -0
  280. package/build/dist/chunks/{QF52OIBS.js → Z6LZGCVW.js} +1 -1
  281. package/build/dist/chunks/{45BRW2ZF.js → ZQWZGH7V.js} +1 -1
  282. package/build/dist/chunks/{HAQPIBYR.js → ZXJ24B4L.js} +1 -1
  283. package/package.json +1 -1
  284. package/build/dist/chunks/3MLUCYCB.js +0 -1
  285. package/build/dist/chunks/3XXBLNEX.js +0 -1
  286. package/build/dist/chunks/4PY3UFNR.js +0 -1
  287. package/build/dist/chunks/EE64JSLY.js +0 -1
  288. package/build/dist/chunks/EJ7O75A7.js +0 -1
  289. package/build/dist/chunks/QC3HH5UD.js +0 -3
  290. package/build/dist/chunks/QSHCBASA.js +0 -1
  291. package/build/dist/chunks/XLOYBLFI.js +0 -1
@@ -1 +1 @@
1
- import{d as u,g as P,i as D,j as m}from"../chunks/GW5IXLKU.js";import"../chunks/ZMFRMWHR.js";import"../chunks/I26DMNJG.js";import"../chunks/L5BLHY34.js";import"../chunks/ZSN4IRI5.js";import"../chunks/YWRDZQI6.js";import"../chunks/QF52OIBS.js";import"../chunks/WTXC3XKW.js";import"../chunks/DFM4T6ZE.js";import{b as O}from"../chunks/BBS3ODWZ.js";import"../chunks/HAQPIBYR.js";import"../chunks/DJN3JAWB.js";import{f as A,g as _,o as R}from"../chunks/WLMWWEP7.js";import{a as h}from"../chunks/PSBQWDYI.js";import{a as T,b as E}from"../chunks/OKUO3BVM.js";import{e as I}from"../chunks/O7HCEPQY.js";import{e as f}from"../chunks/46KWRAYK.js";import{e as w}from"../chunks/NEEZBJBC.js";import"../chunks/57MEFFCU.js";import"../chunks/VYYSL557.js";import"../chunks/WU7XIAXB.js";import"../chunks/6WD4HHID.js";import"../chunks/P56RZC2M.js";import"../chunks/TM2XCRU7.js";import"../chunks/MJ6WEWMI.js";import"../chunks/3GOHSYHW.js";import"../chunks/L4N2RSK2.js";import"../chunks/3NJ5KQ3Q.js";import"../chunks/P5PYFK7L.js";import"../chunks/ZQAFFWDK.js";import"../chunks/WP6RHXGN.js";import"../chunks/3MLUCYCB.js";import"../chunks/LIUXNOLP.js";import"../chunks/RVDUSNWW.js";import"../chunks/ZV5HIQXC.js";import"../chunks/RUX3RY7Y.js";import"../chunks/XBE3B6Y2.js";import"../chunks/PV5FDT6O.js";import"../chunks/U4JGEMKT.js";import"../chunks/P4UQGWCP.js";import"../chunks/SPJCSEKP.js";import"../chunks/Z25UKUJF.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/VEQBHI6O.js";import"../chunks/OTXSKFUD.js";import"../chunks/66F5ZH34.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import{a as s,i as y,s as c}from"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";import{zeroAddress as G}from"viem";var e=(r,n)=>({...n,meaning:r}),v=y[s].meridian,Y=v.CollateralToken_USDe.address,N={by:"server-continuation",reason:"Meridian Predict settles RFQ approvals over a WebSocket auction session that the Oak server holds."},q={none:"Single-use auction approval: it cannot be cancelled and lapses at its deadline.",staysExecutableUntilExpiry:!0},Q={id:"meridian.rfq.mint-approval",program:"Meridian",purpose:"prediction buy approval",tools:["meridian_buy"],class:"order",encoding:"eip712",domain:{name:"PredictionMarketEscrow",version:"1",chainId:s,verifyingContract:v.PredictionMarketEscrow.address},primaryType:"MintApproval",types:{MintApproval:T},fields:{predictionHash:e("Hash of your picks, stake, the counterparty and its collateral, rebuilt locally from your request and the winning bid",{role:"derived",rebuild:"meridian.rfq.prediction-hash",yields:["counterparty"]}),signer:e("This wallet, the approving trader",{role:"signer"}),collateral:e("Your stake: the most USDe the escrow can take",{role:"amount",side:"out",token:Y,arg:"stake"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},V={id:"meridian.rfq.trade-approval",program:"Meridian",purpose:"prediction sale approval",tools:["meridian_sell"],class:"order",encoding:"eip712",domain:{name:"SecondaryMarketEscrow",version:"1",chainId:s,verifyingContract:v.SecondaryMarketEscrow.address},primaryType:"TradeApproval",types:{TradeApproval:E},fields:{tradeHash:e("Hash of the position token and amount you sell, the buyer and the USDe price, rebuilt locally",{role:"derived",rebuild:"meridian.rfq.trade-hash",yields:["token-out","amount-out","token-in","amount-in","counterparty"]}),signer:e("This wallet, the seller",{role:"signer"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},S=R({agentId:"1",owner:G,nonce:"0",deadline:"0"}),z={id:"priors.consent",program:"Priors",purpose:"pool consent",tools:["priors_starter_line",...O],class:"consent",encoding:"eip712",domain:{...S.domain},primaryType:S.primaryType,types:S.types,fields:{agentId:e("Your agent ID the consent is for",{role:"observed",check:"equals the agentId argument"}),sponsorId:e("Sponsor root that may use this consent",{role:"observed",check:"treasury v4 root, or the feature root or sponsorId argument"}),owner:e("This wallet, the agent owner",{role:"account"}),maxPremiumBps:e("Largest premium the sponsor may charge, in basis points",{role:"observed",check:"equals the maxPremiumBps argument (starter line: 0)"}),nonce:e("Priors pool nonce for this agent",{role:"nonce",kind:"program-counter"}),deadline:e("Consent deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:_+300,submit:{by:"transaction"},requireHuman:!0},j={id:"priors.seat-proof",program:"Priors",purpose:"agent ownership proof",tools:["priors_starter_line"],class:"auth",encoding:"eip191-template",primaryType:"priors.seat-request",types:{},fields:{agentId:e("Your agent ID",{role:"observed",check:"equals the agentId argument"}),n:e("Invite bot nonce",{role:"nonce",kind:"server-observed"}),exp:e("Proof expiry (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:A+300,submit:{by:"server-continuation",reason:"The Priors invite bot receives the ownership proof through the Oak server session."},requireHuman:!1},$={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},J={agentId:e("Agent whose payment wallet becomes this wallet",{role:"observed",check:"equals the agentId argument and the continuation"}),newWallet:e("This wallet, the new payment wallet",{role:"signer"}),owner:e("Current agent owner named by the registry",{role:"observed",check:"the registry checks it on chain"}),deadline:e("Proof deadline (Unix seconds)",{role:"expiry"})},F=r=>({id:r==="mainnet"?"erc8004.agent-wallet-set":"erc8004.agent-wallet-set.testnet",program:"ERC-8004",purpose:"payment-wallet proof",tools:["erc8004_set_wallet"],class:"auth",encoding:"eip712",...r==="testnet"?{network:r}:{},domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:c[r].chainId,verifyingContract:c[r].identityRegistry},primaryType:"AgentWalletSet",types:$,fields:J,maxLifetimeSeconds:420,submit:{by:"server-continuation",reason:"The proof is an argument of the setAgentWallet transaction the Oak server builds next."},requireHuman:!1}),X=F("mainnet"),Z=F("testnet"),ee={id:"hookr.relay.swap-intent",program:"Hookr",purpose:"relayed trader swap intent",tools:["hookr_relay"],class:"relayed",encoding:"eip712",domain:{name:"Permit2",chainId:s,verifyingContract:y[s].ponsTrade.permit2.address},primaryType:"HookrSwapIntent",types:{},fields:{owner:e("The trader who signed; never this wallet",{role:"counterparty"}),intent:e("The trader-signed swap terms; every calldata byte is rebuilt from them",{role:"derived",rebuild:"hookr.relay.calldata"}),signature:e("The trader Permit2 witness signature; the forwarder verifies it in a simulation from this relayer",{role:"observed",check:"forwarder execute simulation at a pinned block"})},maxLifetimeSeconds:2592e3,contractHash:{fn:"hashIntent"},nonceRead:"isNonceUsed",submit:{by:"transaction"},relayedPaths:["signature"],requireHuman:!1},re=w,ne="Meridian perps activation requires protocol-verified signing and submission vectors. TradeOrder has unsigned expiry and execution flags; delegate authority is unbounded. These candidates remain disabled.",te={by:"server-continuation",reason:"Today the Oak server holds the perps_sign round and posts to the Meridian API; local submission is adopted with the pending patch."},M={subaccount:"primary",subaccountId:"00000000-0000-4000-8000-000000000000"},ie="0x0000000000000000000000000000000000000001";function o(r,n,t,i,H,U,W={}){let g=I(i,{...M,...H},ie,"1",1);return{id:r,program:"Meridian",purpose:n,tools:[`meridian_perps_${i}`],class:t,encoding:"eip712",domain:{...f},primaryType:g.primaryType,types:{[g.primaryType]:Object.entries(g.fields).map(([B,K])=>({name:B,type:K}))},fields:U,maxLifetimeSeconds:3600,submit:te,requireHuman:t!=="auth"&&t!=="cancel",enabled:!1,disabledReason:ne,...W}}var a=e("This wallet, the account owner",{role:"signer"}),l=e("Subaccount name (bytes32) from your request",{role:"derived",rebuild:"meridian.perps.subaccount"}),d=e("Nanosecond nonce from the add-on clock; Meridian accepts it within 25 minutes",{role:"nonce",kind:"local-time"}),p=e("Signing time; Meridian accepts the signature for at most one hour after it",{role:"derived",rebuild:"meridian.perps.signed-at",yields:["expiry"]}),L={revoke:{none:"One-shot request: it cannot be cancelled and lapses within one hour.",staysExecutableUntilExpiry:!0}},oe=[o("meridian.perps.trade-order","perps order","order","order",{type:"LIMIT",quantity:"1",price:"1",side:0,onchainId:1,timeInForce:"GTD"},{sender:a,subaccount:l,quantity:e("Order size in D9 contract units: the most this order can trade",{role:"amount",side:"out",token:"productId",arg:"quantity"}),price:e("Limit price (D9) from your request; 0 for market orders",{role:"derived",rebuild:"meridian.perps.intent"}),reduceOnly:e("Only reduces an open position",{role:"derived",rebuild:"meridian.perps.intent"}),side:e("0 buy, 1 sell",{role:"derived",rebuild:"meridian.perps.intent"}),engineType:e("Order engine",{role:"pinned",value:0}),productId:e("Meridian product traded",{role:"token",side:"out",arg:"onchainId"}),nonce:d,signedAt:e("Signing time (the resting-order expiry is the API option expiresAt)",{role:"observed",check:"within the Meridian acceptance window"})},{maxLifetimeSeconds:2592e3,expiry:{enforcedBy:"api",path:"data.expiresAt"},revoke:{offchainSpec:"meridian.perps.cancel-order",staysExecutableUntilExpiry:!0}}),o("meridian.perps.cancel-order","perps order cancel","cancel","cancel",{all:!0},{sender:a,subaccount:l,nonce:d},{expiryBinding:"cancel-only"}),o("meridian.perps.initiate-withdraw","perps withdrawal","order","withdraw",{token:"0x0000000000000000000000000000000000000002",tokenId:M.subaccountId,amount:"1"},{account:a,subaccount:l,token:e("Token withdrawn",{role:"token",side:"out",arg:"token"}),amount:e("Amount withdrawn (D9)",{role:"amount",side:"out",token:"token",arg:"amount"}),nonce:d,signedAt:p,destinationAddress:e("This wallet, padded to 32 bytes",{role:"recipient"}),destinationEndpointId:e("Same-chain withdrawal",{role:"pinned",value:0})},L),o("meridian.perps.convert-token","perps conversion","order","convert",{fromToken:"0x0000000000000000000000000000000000000002",toToken:"0x0000000000000000000000000000000000000003",amount:"1"},{sender:a,subaccount:l,fromToken:e("Quote token converted from",{role:"token",side:"out",arg:"fromToken"}),toToken:e("Quote token converted to",{role:"token",side:"in",arg:"toToken"}),amount:e("Amount converted (D9)",{role:"amount",side:"out",token:"fromToken",arg:"amount"}),nonce:d,signedAt:p},L),o("meridian.perps.revoke-linked-signer","linked-signer revocation","cancel","signer",{mode:"revoke",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer revoked",{role:"delegate"}),subaccount:l,nonce:d,signedAt:p}),o("meridian.perps.refresh-linked-signer","linked-signer refresh","link","signer",{mode:"refresh",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer refreshed",{role:"delegate"}),nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.extend-linked-signer","linked-signer extension","link","signer",{mode:"extend"},{sender:a,nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.referral-auth","referral API authentication","auth","referral",{mode:"activate"},{sender:a,intent:e("Referral action: 0 activate, 1 claim, 2 read",{role:"derived",rebuild:"meridian.perps.intent"}),signedAt:e("Signed time; the local round accepts now minus 120 through now plus 10 seconds",{role:"derived",rebuild:"meridian.perps.auth-time",yields:["expiry"]})},{expiryBinding:"auth-window",authWindow:{field:"signedAt",maxAgeSeconds:120,maxFutureSeconds:10}})],ae={id:"longbow.nft.lender-offer",program:"Longbow",purpose:"existing NFT lender offer",tools:["longbow_nft_accept_offer"],class:"relayed",encoding:"eip191-packed-hash",primaryType:"longbow.nft.fixed-offer",types:{},fields:{chainId:e("Robinhood Chain, included in the packed offer hash",{role:"pinned",value:s}),contract:e("DirectLoanFixedOffer, included in the packed offer hash",{role:"pinned",value:h}),offer:e("Exact loan, payoff, NFT, currency and fee terms rebuilt by nftOfferDigest",{role:"derived",rebuild:"longbow.nft.offer-digest"}),"lenderSignature.signer":e("Existing lender who signed the offer",{role:"counterparty"}),"lenderSignature.expiry":e("Existing lender offer expiry",{role:"expiry"}),"lenderSignature.nonce":e("Lender nonce checked against the pinned loan contract",{role:"nonce",kind:"program-counter"}),"lenderSignature.signature":e("Existing lender signature, verified by recovery or pinned-block ERC-1271 before preview",{role:"observed",check:"nftOfferDigest and lender verification in the local loan builder"})},maxLifetimeSeconds:2592e3,submit:{by:"transaction"},relayedPaths:["lenderSignature.signature"],requireHuman:!1},k=[Q,V,z,j,X,Z,ee,ae,...oe],se=[f.verifyingContract,re,h],de=D(k,P(se));if(de.length)throw u("invalid signature registry");var b=new Map;for(let r of k)for(let n of r.tools)b.set(n,[...b.get(n)??[],r]);var C=new Map(k.map(r=>[m(r),r]));function x(r){return b.get(r)??[]}function Se(r,n=x(r)){return n.some(t=>t.tools.includes(r)&&t.submit.by==="addon")}function be(r){return x(r).flatMap(n=>n.class==="relayed"&&n.enabled!==!1?n.relayedPaths??[]:[])}function ve(r,n){let t=n?.domain?.chainId===c.testnet.chainId?"testnet":"mainnet",i=C.get(m({network:t==="testnet"?"testnet":void 0,encoding:"eip712",domain:n?.domain,primaryType:n?.primaryType}));if(!i||i.enabled===!1||!i.tools.includes(r)||i.class==="relayed")throw u("Oak has no signing contract for this request");return i}function ke(r){if(!r?.domain||typeof r.primaryType!="string")return;let n=r.domain.chainId===c.testnet.chainId?"testnet":void 0,t=C.get(m({network:n,encoding:"eip712",domain:r.domain,primaryType:r.primaryType}));return t?.class==="relayed"?void 0:t}function xe(r){let n=x(r).find(t=>t.encoding==="eip191-template"&&t.enabled!==!1);if(!n)throw u("Oak has no signing contract for this request");return n}export{X as ERC8004_WALLET_SET,Z as ERC8004_WALLET_SET_TESTNET,ee as HOOKR_RELAYED_INTENT,ae as LONGBOW_RELAYED_OFFER,Q as MERIDIAN_MINT_APPROVAL,oe as MERIDIAN_PERPS_SPECS,V as MERIDIAN_TRADE_APPROVAL,se as MODULE_PINS,z as PRIORS_CONSENT,j as PRIORS_SEAT_PROOF,k as SIGNATURE_SPECS,be as relayedSignaturePaths,xe as specForMessage,ke as specForStruct,ve as specForTypedData,x as specsForTool,Se as submitsFromAddon};
1
+ import{d as u,g as P,i as D,j as m}from"../chunks/GW5IXLKU.js";import"../chunks/M6LC6DRE.js";import"../chunks/I26DMNJG.js";import"../chunks/L5BLHY34.js";import"../chunks/ZSN4IRI5.js";import"../chunks/QYVREJYC.js";import"../chunks/Z6LZGCVW.js";import{b as O}from"../chunks/LKZX4CAA.js";import"../chunks/ZXJ24B4L.js";import"../chunks/WTXC3XKW.js";import"../chunks/DFM4T6ZE.js";import"../chunks/DJN3JAWB.js";import{f as A,g as _,o as R}from"../chunks/WLMWWEP7.js";import{a as T,b as E}from"../chunks/RTAHNWHN.js";import{e as I}from"../chunks/O7HCEPQY.js";import{e as f}from"../chunks/46KWRAYK.js";import{a as h}from"../chunks/PSBQWDYI.js";import{e as w}from"../chunks/5AXWBSPG.js";import"../chunks/7KWZ5QJU.js";import"../chunks/WU7XIAXB.js";import"../chunks/VYYSL557.js";import"../chunks/6WD4HHID.js";import"../chunks/AEL62KCG.js";import"../chunks/X2P55AC3.js";import"../chunks/HQUVB7Z5.js";import"../chunks/DL6AEWEM.js";import"../chunks/GRQYTVNT.js";import"../chunks/BOVMED7R.js";import"../chunks/P5PYFK7L.js";import"../chunks/ZQAFFWDK.js";import"../chunks/WP6RHXGN.js";import"../chunks/QHBS3PVU.js";import"../chunks/LIUXNOLP.js";import"../chunks/RUX3RY7Y.js";import"../chunks/XBE3B6Y2.js";import"../chunks/RVDUSNWW.js";import"../chunks/ZV5HIQXC.js";import"../chunks/PV5FDT6O.js";import"../chunks/U4JGEMKT.js";import"../chunks/P4UQGWCP.js";import"../chunks/SPJCSEKP.js";import"../chunks/Z25UKUJF.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/VEQBHI6O.js";import"../chunks/OTXSKFUD.js";import"../chunks/66F5ZH34.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import{a as s,i as y,s as c}from"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";import{zeroAddress as G}from"viem";var e=(r,n)=>({...n,meaning:r}),v=y[s].meridian,Y=v.CollateralToken_USDe.address,N={by:"server-continuation",reason:"Meridian Predict settles RFQ approvals over a WebSocket auction session that the Oak server holds."},q={none:"Single-use auction approval: it cannot be cancelled and lapses at its deadline.",staysExecutableUntilExpiry:!0},Q={id:"meridian.rfq.mint-approval",program:"Meridian",purpose:"prediction buy approval",tools:["meridian_buy"],class:"order",encoding:"eip712",domain:{name:"PredictionMarketEscrow",version:"1",chainId:s,verifyingContract:v.PredictionMarketEscrow.address},primaryType:"MintApproval",types:{MintApproval:T},fields:{predictionHash:e("Hash of your picks, stake, the counterparty and its collateral, rebuilt locally from your request and the winning bid",{role:"derived",rebuild:"meridian.rfq.prediction-hash",yields:["counterparty"]}),signer:e("This wallet, the approving trader",{role:"signer"}),collateral:e("Your stake: the most USDe the escrow can take",{role:"amount",side:"out",token:Y,arg:"stake"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},V={id:"meridian.rfq.trade-approval",program:"Meridian",purpose:"prediction sale approval",tools:["meridian_sell"],class:"order",encoding:"eip712",domain:{name:"SecondaryMarketEscrow",version:"1",chainId:s,verifyingContract:v.SecondaryMarketEscrow.address},primaryType:"TradeApproval",types:{TradeApproval:E},fields:{tradeHash:e("Hash of the position token and amount you sell, the buyer and the USDe price, rebuilt locally",{role:"derived",rebuild:"meridian.rfq.trade-hash",yields:["token-out","amount-out","token-in","amount-in","counterparty"]}),signer:e("This wallet, the seller",{role:"signer"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},S=R({agentId:"1",owner:G,nonce:"0",deadline:"0"}),z={id:"priors.consent",program:"Priors",purpose:"pool consent",tools:["priors_starter_line",...O],class:"consent",encoding:"eip712",domain:{...S.domain},primaryType:S.primaryType,types:S.types,fields:{agentId:e("Your agent ID the consent is for",{role:"observed",check:"equals the agentId argument"}),sponsorId:e("Sponsor root that may use this consent",{role:"observed",check:"treasury v4 root, or the feature root or sponsorId argument"}),owner:e("This wallet, the agent owner",{role:"account"}),maxPremiumBps:e("Largest premium the sponsor may charge, in basis points",{role:"observed",check:"equals the maxPremiumBps argument (starter line: 0)"}),nonce:e("Priors pool nonce for this agent",{role:"nonce",kind:"program-counter"}),deadline:e("Consent deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:_+300,submit:{by:"transaction"},requireHuman:!0},j={id:"priors.seat-proof",program:"Priors",purpose:"agent ownership proof",tools:["priors_starter_line"],class:"auth",encoding:"eip191-template",primaryType:"priors.seat-request",types:{},fields:{agentId:e("Your agent ID",{role:"observed",check:"equals the agentId argument"}),n:e("Invite bot nonce",{role:"nonce",kind:"server-observed"}),exp:e("Proof expiry (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:A+300,submit:{by:"server-continuation",reason:"The Priors invite bot receives the ownership proof through the Oak server session."},requireHuman:!1},$={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},J={agentId:e("Agent whose payment wallet becomes this wallet",{role:"observed",check:"equals the agentId argument and the continuation"}),newWallet:e("This wallet, the new payment wallet",{role:"signer"}),owner:e("Current agent owner named by the registry",{role:"observed",check:"the registry checks it on chain"}),deadline:e("Proof deadline (Unix seconds)",{role:"expiry"})},F=r=>({id:r==="mainnet"?"erc8004.agent-wallet-set":"erc8004.agent-wallet-set.testnet",program:"ERC-8004",purpose:"payment-wallet proof",tools:["erc8004_set_wallet"],class:"auth",encoding:"eip712",...r==="testnet"?{network:r}:{},domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:c[r].chainId,verifyingContract:c[r].identityRegistry},primaryType:"AgentWalletSet",types:$,fields:J,maxLifetimeSeconds:420,submit:{by:"server-continuation",reason:"The proof is an argument of the setAgentWallet transaction the Oak server builds next."},requireHuman:!1}),X=F("mainnet"),Z=F("testnet"),ee={id:"hookr.relay.swap-intent",program:"Hookr",purpose:"relayed trader swap intent",tools:["hookr_relay"],class:"relayed",encoding:"eip712",domain:{name:"Permit2",chainId:s,verifyingContract:y[s].ponsTrade.permit2.address},primaryType:"HookrSwapIntent",types:{},fields:{owner:e("The trader who signed; never this wallet",{role:"counterparty"}),intent:e("The trader-signed swap terms; every calldata byte is rebuilt from them",{role:"derived",rebuild:"hookr.relay.calldata"}),signature:e("The trader Permit2 witness signature; the forwarder verifies it in a simulation from this relayer",{role:"observed",check:"forwarder execute simulation at a pinned block"})},maxLifetimeSeconds:2592e3,contractHash:{fn:"hashIntent"},nonceRead:"isNonceUsed",submit:{by:"transaction"},relayedPaths:["signature"],requireHuman:!1},re=w,ne="Meridian perps activation requires protocol-verified signing and submission vectors. TradeOrder has unsigned expiry and execution flags; delegate authority is unbounded. These candidates remain disabled.",te={by:"server-continuation",reason:"Today the Oak server holds the perps_sign round and posts to the Meridian API; local submission is adopted with the pending patch."},M={subaccount:"primary",subaccountId:"00000000-0000-4000-8000-000000000000"},ie="0x0000000000000000000000000000000000000001";function o(r,n,t,i,H,U,W={}){let g=I(i,{...M,...H},ie,"1",1);return{id:r,program:"Meridian",purpose:n,tools:[`meridian_perps_${i}`],class:t,encoding:"eip712",domain:{...f},primaryType:g.primaryType,types:{[g.primaryType]:Object.entries(g.fields).map(([B,K])=>({name:B,type:K}))},fields:U,maxLifetimeSeconds:3600,submit:te,requireHuman:t!=="auth"&&t!=="cancel",enabled:!1,disabledReason:ne,...W}}var a=e("This wallet, the account owner",{role:"signer"}),l=e("Subaccount name (bytes32) from your request",{role:"derived",rebuild:"meridian.perps.subaccount"}),d=e("Nanosecond nonce from the add-on clock; Meridian accepts it within 25 minutes",{role:"nonce",kind:"local-time"}),p=e("Signing time; Meridian accepts the signature for at most one hour after it",{role:"derived",rebuild:"meridian.perps.signed-at",yields:["expiry"]}),L={revoke:{none:"One-shot request: it cannot be cancelled and lapses within one hour.",staysExecutableUntilExpiry:!0}},oe=[o("meridian.perps.trade-order","perps order","order","order",{type:"LIMIT",quantity:"1",price:"1",side:0,onchainId:1,timeInForce:"GTD"},{sender:a,subaccount:l,quantity:e("Order size in D9 contract units: the most this order can trade",{role:"amount",side:"out",token:"productId",arg:"quantity"}),price:e("Limit price (D9) from your request; 0 for market orders",{role:"derived",rebuild:"meridian.perps.intent"}),reduceOnly:e("Only reduces an open position",{role:"derived",rebuild:"meridian.perps.intent"}),side:e("0 buy, 1 sell",{role:"derived",rebuild:"meridian.perps.intent"}),engineType:e("Order engine",{role:"pinned",value:0}),productId:e("Meridian product traded",{role:"token",side:"out",arg:"onchainId"}),nonce:d,signedAt:e("Signing time (the resting-order expiry is the API option expiresAt)",{role:"observed",check:"within the Meridian acceptance window"})},{maxLifetimeSeconds:2592e3,expiry:{enforcedBy:"api",path:"data.expiresAt"},revoke:{offchainSpec:"meridian.perps.cancel-order",staysExecutableUntilExpiry:!0}}),o("meridian.perps.cancel-order","perps order cancel","cancel","cancel",{all:!0},{sender:a,subaccount:l,nonce:d},{expiryBinding:"cancel-only"}),o("meridian.perps.initiate-withdraw","perps withdrawal","order","withdraw",{token:"0x0000000000000000000000000000000000000002",tokenId:M.subaccountId,amount:"1"},{account:a,subaccount:l,token:e("Token withdrawn",{role:"token",side:"out",arg:"token"}),amount:e("Amount withdrawn (D9)",{role:"amount",side:"out",token:"token",arg:"amount"}),nonce:d,signedAt:p,destinationAddress:e("This wallet, padded to 32 bytes",{role:"recipient"}),destinationEndpointId:e("Same-chain withdrawal",{role:"pinned",value:0})},L),o("meridian.perps.convert-token","perps conversion","order","convert",{fromToken:"0x0000000000000000000000000000000000000002",toToken:"0x0000000000000000000000000000000000000003",amount:"1"},{sender:a,subaccount:l,fromToken:e("Quote token converted from",{role:"token",side:"out",arg:"fromToken"}),toToken:e("Quote token converted to",{role:"token",side:"in",arg:"toToken"}),amount:e("Amount converted (D9)",{role:"amount",side:"out",token:"fromToken",arg:"amount"}),nonce:d,signedAt:p},L),o("meridian.perps.revoke-linked-signer","linked-signer revocation","cancel","signer",{mode:"revoke",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer revoked",{role:"delegate"}),subaccount:l,nonce:d,signedAt:p}),o("meridian.perps.refresh-linked-signer","linked-signer refresh","link","signer",{mode:"refresh",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer refreshed",{role:"delegate"}),nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.extend-linked-signer","linked-signer extension","link","signer",{mode:"extend"},{sender:a,nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.referral-auth","referral API authentication","auth","referral",{mode:"activate"},{sender:a,intent:e("Referral action: 0 activate, 1 claim, 2 read",{role:"derived",rebuild:"meridian.perps.intent"}),signedAt:e("Signed time; the local round accepts now minus 120 through now plus 10 seconds",{role:"derived",rebuild:"meridian.perps.auth-time",yields:["expiry"]})},{expiryBinding:"auth-window",authWindow:{field:"signedAt",maxAgeSeconds:120,maxFutureSeconds:10}})],ae={id:"longbow.nft.lender-offer",program:"Longbow",purpose:"existing NFT lender offer",tools:["longbow_nft_accept_offer"],class:"relayed",encoding:"eip191-packed-hash",primaryType:"longbow.nft.fixed-offer",types:{},fields:{chainId:e("Robinhood Chain, included in the packed offer hash",{role:"pinned",value:s}),contract:e("DirectLoanFixedOffer, included in the packed offer hash",{role:"pinned",value:h}),offer:e("Exact loan, payoff, NFT, currency and fee terms rebuilt by nftOfferDigest",{role:"derived",rebuild:"longbow.nft.offer-digest"}),"lenderSignature.signer":e("Existing lender who signed the offer",{role:"counterparty"}),"lenderSignature.expiry":e("Existing lender offer expiry",{role:"expiry"}),"lenderSignature.nonce":e("Lender nonce checked against the pinned loan contract",{role:"nonce",kind:"program-counter"}),"lenderSignature.signature":e("Existing lender signature, verified by recovery or pinned-block ERC-1271 before preview",{role:"observed",check:"nftOfferDigest and lender verification in the local loan builder"})},maxLifetimeSeconds:2592e3,submit:{by:"transaction"},relayedPaths:["lenderSignature.signature"],requireHuman:!1},k=[Q,V,z,j,X,Z,ee,ae,...oe],se=[f.verifyingContract,re,h],de=D(k,P(se));if(de.length)throw u("invalid signature registry");var b=new Map;for(let r of k)for(let n of r.tools)b.set(n,[...b.get(n)??[],r]);var C=new Map(k.map(r=>[m(r),r]));function x(r){return b.get(r)??[]}function Se(r,n=x(r)){return n.some(t=>t.tools.includes(r)&&t.submit.by==="addon")}function be(r){return x(r).flatMap(n=>n.class==="relayed"&&n.enabled!==!1?n.relayedPaths??[]:[])}function ve(r,n){let t=n?.domain?.chainId===c.testnet.chainId?"testnet":"mainnet",i=C.get(m({network:t==="testnet"?"testnet":void 0,encoding:"eip712",domain:n?.domain,primaryType:n?.primaryType}));if(!i||i.enabled===!1||!i.tools.includes(r)||i.class==="relayed")throw u("Oak has no signing contract for this request");return i}function ke(r){if(!r?.domain||typeof r.primaryType!="string")return;let n=r.domain.chainId===c.testnet.chainId?"testnet":void 0,t=C.get(m({network:n,encoding:"eip712",domain:r.domain,primaryType:r.primaryType}));return t?.class==="relayed"?void 0:t}function xe(r){let n=x(r).find(t=>t.encoding==="eip191-template"&&t.enabled!==!1);if(!n)throw u("Oak has no signing contract for this request");return n}export{X as ERC8004_WALLET_SET,Z as ERC8004_WALLET_SET_TESTNET,ee as HOOKR_RELAYED_INTENT,ae as LONGBOW_RELAYED_OFFER,Q as MERIDIAN_MINT_APPROVAL,oe as MERIDIAN_PERPS_SPECS,V as MERIDIAN_TRADE_APPROVAL,se as MODULE_PINS,z as PRIORS_CONSENT,j as PRIORS_SEAT_PROOF,k as SIGNATURE_SPECS,be as relayedSignaturePaths,xe as specForMessage,ke as specForStruct,ve as specForTypedData,x as specsForTool,Se as submitsFromAddon};
@@ -1 +1 @@
1
- import{a,b,c}from"../chunks/3MLUCYCB.js";import"../chunks/LIUXNOLP.js";import"../chunks/U4JGEMKT.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{a as NATIVE_TOKEN_ADDRESS,c as createPreview,b as normalizeNativeTokenAddress};
1
+ import{a,b,c}from"../chunks/QHBS3PVU.js";import"../chunks/LIUXNOLP.js";import"../chunks/U4JGEMKT.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{a as NATIVE_TOKEN_ADDRESS,c as createPreview,b as normalizeNativeTokenAddress};
@@ -1 +1 @@
1
- import{A as B,B as C,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"../chunks/3NJ5KQ3Q.js";import"../chunks/P5PYFK7L.js";import{a}from"../chunks/ZQAFFWDK.js";import"../chunks/WP6RHXGN.js";import"../chunks/3MLUCYCB.js";import"../chunks/LIUXNOLP.js";import"../chunks/U4JGEMKT.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/VEQBHI6O.js";import"../chunks/OTXSKFUD.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{c as DEFAULT_SLIPPAGE_BPS,i as ExpiredQuoteError,j as MAX_RECENT_QUOTES,q as MAX_VELORA_FEE_BPS,e as NATIVE_ETH_ADDRESS,h as NoRouteError,d as PRICE_IMPACT_WARNING_BPS,b as QUOTE_TTL_SECONDS,f as ZERO_ADDRESS,y as assertCalldataMinAmountOut,m as assertQuoteBinding,z as assertSwapTransaction,t as assertVeloraPartnerAndFee,C as buildSwapFromQuote,p as computeMinAmountOut,k as copyQuote,x as decodeSwapMinAmountOut,v as encodeKyberSwapData,w as encodeVeloraSwapData,u as formatVenueFeeDisclosure,B as getQuote,o as isNativeToken,g as kyberSwapAbi,A as normalizeQuote,a as ponsCurveSwapAbi,n as resolveNowSeconds,l as snapshotQuote,s as veloraCalldataMinimum,r as veloraVenueFeeBps};
1
+ import{A as B,B as C,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"../chunks/BOVMED7R.js";import"../chunks/P5PYFK7L.js";import{a}from"../chunks/ZQAFFWDK.js";import"../chunks/WP6RHXGN.js";import"../chunks/QHBS3PVU.js";import"../chunks/LIUXNOLP.js";import"../chunks/U4JGEMKT.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/VEQBHI6O.js";import"../chunks/OTXSKFUD.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{c as DEFAULT_SLIPPAGE_BPS,i as ExpiredQuoteError,j as MAX_RECENT_QUOTES,q as MAX_VELORA_FEE_BPS,e as NATIVE_ETH_ADDRESS,h as NoRouteError,d as PRICE_IMPACT_WARNING_BPS,b as QUOTE_TTL_SECONDS,f as ZERO_ADDRESS,y as assertCalldataMinAmountOut,m as assertQuoteBinding,z as assertSwapTransaction,t as assertVeloraPartnerAndFee,C as buildSwapFromQuote,p as computeMinAmountOut,k as copyQuote,x as decodeSwapMinAmountOut,v as encodeKyberSwapData,w as encodeVeloraSwapData,u as formatVenueFeeDisclosure,B as getQuote,o as isNativeToken,g as kyberSwapAbi,A as normalizeQuote,a as ponsCurveSwapAbi,n as resolveNowSeconds,l as snapshotQuote,s as veloraCalldataMinimum,r as veloraVenueFeeBps};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"../chunks/P56RZC2M.js";import"../chunks/TM2XCRU7.js";import"../chunks/MJ6WEWMI.js";import"../chunks/3GOHSYHW.js";import"../chunks/L4N2RSK2.js";import"../chunks/3NJ5KQ3Q.js";import"../chunks/P5PYFK7L.js";import"../chunks/ZQAFFWDK.js";import"../chunks/WP6RHXGN.js";import"../chunks/3MLUCYCB.js";import"../chunks/LIUXNOLP.js";import"../chunks/RVDUSNWW.js";import"../chunks/ZV5HIQXC.js";import"../chunks/RUX3RY7Y.js";import"../chunks/XBE3B6Y2.js";import"../chunks/PV5FDT6O.js";import"../chunks/U4JGEMKT.js";import"../chunks/P4UQGWCP.js";import"../chunks/SPJCSEKP.js";import"../chunks/Z25UKUJF.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/VEQBHI6O.js";import"../chunks/OTXSKFUD.js";import"../chunks/66F5ZH34.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{k as MULTICALL3_ABI,b as NATIVE_ETH_TOKEN,a as STOCK_ASSETS_URL,e as USDE_TOKEN,c as USDG_TOKEN,d as WETH_TOKEN,h as assertOfficialStockIdentity,j as fetchOfficialStockTokens,n as findToken,l as getBalances,i as getOfficialStockTokens,m as getReceivedTokenBalances,f as parseOfficialStockAssets,o as resolveQuoteToken,g as verifyOfficialStockToken};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"../chunks/AEL62KCG.js";import"../chunks/X2P55AC3.js";import"../chunks/HQUVB7Z5.js";import"../chunks/DL6AEWEM.js";import"../chunks/GRQYTVNT.js";import"../chunks/BOVMED7R.js";import"../chunks/P5PYFK7L.js";import"../chunks/ZQAFFWDK.js";import"../chunks/WP6RHXGN.js";import"../chunks/QHBS3PVU.js";import"../chunks/LIUXNOLP.js";import"../chunks/RUX3RY7Y.js";import"../chunks/XBE3B6Y2.js";import"../chunks/RVDUSNWW.js";import"../chunks/ZV5HIQXC.js";import"../chunks/PV5FDT6O.js";import"../chunks/U4JGEMKT.js";import"../chunks/P4UQGWCP.js";import"../chunks/SPJCSEKP.js";import"../chunks/Z25UKUJF.js";import"../chunks/43LI5NKJ.js";import"../chunks/IOYRL6AY.js";import"../chunks/VEQBHI6O.js";import"../chunks/OTXSKFUD.js";import"../chunks/66F5ZH34.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/5HCXZWUH.js";import"../chunks/ABPL3ZZI.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{k as MULTICALL3_ABI,b as NATIVE_ETH_TOKEN,a as STOCK_ASSETS_URL,e as USDE_TOKEN,c as USDG_TOKEN,d as WETH_TOKEN,h as assertOfficialStockIdentity,j as fetchOfficialStockTokens,n as findToken,l as getBalances,i as getOfficialStockTokens,m as getReceivedTokenBalances,f as parseOfficialStockAssets,o as resolveQuoteToken,g as verifyOfficialStockToken};
@@ -1 +1 @@
1
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h}from"../chunks/QSHCBASA.js";import{a}from"../chunks/HM72DH4V.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{c as COMING_SOON,d as FIND_TOOL,f as LOCAL_TOOLS,e as RUN_TOOL,g as VISIBLE_TOOLS,a as isFundingBootstrap,b as isReadDiscovery,h as visibleTools};
1
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h}from"../chunks/QW2OPEYJ.js";import{a}from"../chunks/HM72DH4V.js";import"../chunks/NWNYJ26T.js";import"../chunks/IX3GZMTM.js";import"../chunks/FWD4L3CJ.js";import"../chunks/XSD5NL7J.js";import"../chunks/JXOEJPJ4.js";import"../chunks/63YRSLDK.js";export{c as COMING_SOON,d as FIND_TOOL,f as LOCAL_TOOLS,e as RUN_TOOL,g as VISIBLE_TOOLS,a as isFundingBootstrap,b as isReadDiscovery,h as visibleTools};
@@ -15,6 +15,7 @@ export interface UnsignedTx {
15
15
  value: DecimalString;
16
16
  chainId: number;
17
17
  description: string;
18
+ gasLimit?: DecimalString;
18
19
  }
19
20
  export interface TypedDataRequest {
20
21
  domain: {
@@ -136,6 +137,10 @@ export interface Preview {
136
137
  txs: UnsignedTx[];
137
138
  summary: string;
138
139
  changes: TokenAmount[];
140
+ readResults?: Hex[];
141
+ }
142
+ export interface PreviewReads {
143
+ reads: Pick<UnsignedTx, 'to' | 'data' | 'chainId'>[];
139
144
  }
140
145
  export interface ModuleContext {
141
146
  network?: OakNetwork;
@@ -143,7 +148,7 @@ export interface ModuleContext {
143
148
  http: typeof fetch;
144
149
  unsignedTx(tx: UnsignedTx): UnsignedTx;
145
150
  approval(token: Address, spender: Address, amount: DecimalString, chainId: number): UnsignedTx;
146
- preview(txs: UnsignedTx[], wallet: Address): Promise<Preview>;
151
+ preview(txs: UnsignedTx[], wallet: Address, auxiliary?: PreviewReads): Promise<Preview>;
147
152
  parseAmount(amount: string, decimals: number): DecimalString;
148
153
  formatAmount(amount: DecimalString, decimals: number): string;
149
154
  plainError(error: unknown): string;
@@ -1 +1 @@
1
- import{j as s}from"./57MEFFCU.js";import{formatUnits as c}from"viem";function l(e){return`HoodLock creation fee: ${e.eth} ETH (${e.amount} wei; ${e.usd===null?"USD unavailable: no fresh ETH/USD reference":`approximately $${e.usd} USD`}), not refundable after creation. Paid to ${e.contract}; separate from network gas.`}async function p(e,t,d,r){let o=r===0n?"0":null;if(r>0n)try{let a=await s("ETH",{client:e.clientFor(4663),chainId:4663});BigInt(a.usdE18)>0n&&(o=c(r*BigInt(a.usdE18)/10n**18n,18))}catch{}let n={contract:d,amount:r.toString(),eth:c(r,18),usd:o,refundable:!1},i=l(n);return{...t,summary:`${t.summary} ${i}`,preview:{...t.preview,summary:`${t.preview.summary} ${i}`},protocolFee:n}}export{l as a,p as b};
1
+ import{j as s}from"./7KWZ5QJU.js";import{formatUnits as c}from"viem";function l(e){return`HoodLock creation fee: ${e.eth} ETH (${e.amount} wei; ${e.usd===null?"USD unavailable: no fresh ETH/USD reference":`approximately $${e.usd} USD`}), not refundable after creation. Paid to ${e.contract}; separate from network gas.`}async function p(e,t,d,r){let o=r===0n?"0":null;if(r>0n)try{let a=await s("ETH",{client:e.clientFor(4663),chainId:4663});BigInt(a.usdE18)>0n&&(o=c(r*BigInt(a.usdE18)/10n**18n,18))}catch{}let n={contract:d,amount:r.toString(),eth:c(r,18),usd:o,refundable:!1},i=l(n);return{...t,summary:`${t.summary} ${i}`,preview:{...t.preview,summary:`${t.preview.summary} ${i}`},protocolFee:n}}export{l as a,p as b};
@@ -1 +1 @@
1
- import{c as Re,d as je,e as qe,f as ye,i as Le,j as ze}from"./6B3VVISQ.js";import{i as ce}from"./57MEFFCU.js";import{b as Ie,o as Ce}from"./3NJ5KQ3Q.js";import{a as ae}from"./3MLUCYCB.js";import{a as T,b as Oe}from"./43LI5NKJ.js";import{a as L}from"./66F5ZH34.js";import{b as U}from"./IX3GZMTM.js";import{a as m,d as Xe,i as Q,j as Be}from"./FWD4L3CJ.js";import{a as o,b as He,e as ee}from"./XSD5NL7J.js";import{encodeAbiParameters as A,encodeFunctionData as ne,erc20Abi as We,getAddress as y,isAddress as In,keccak256 as Cn,pad as qn,parseAbi as Pe,parseAbiParameters as B,toEventSelector as Ln,toHex as Ge}from"viem";var Tn=y(Q[4663].uniswap.v4_pool_manager.address),$=y(Q[4663].uniswap.v4_position_manager.address),le=y(Q[4663].uniswap.v4_state_view.address),_e=y(Q[4663].uniswap.permit2.address),lt=y(Q[4663].ponsTrade.universal_router.address),te=y(Q[4663].uniswap.WETH.address),E=y(Be),k="0x0000000000000000000000000000000000000000",Ue=8388608,Ee=-887272,ke=887272,mn=(1n<<48n)-1n,J=(1n<<128n)-1n,$n=(1n<<160n)-1n,ue=1n<<96n,Ze=1800n,yn=50n,Ye=e=>e*(10000n-yn)/10000n,Qe=(e,n)=>{let i=(e*(10000n+yn)+9999n)/10000n;return i<n?i:n},Mn="0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",Ke=[{poolId:"0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",key:{currency0:k,currency1:E,fee:8388608,tickSpacing:10,hooks:y("0x06a889870c8f83640d6816319f72e2aa579b6080")},liquidity:"5532026605872066941",sqrtPriceX96:"3839897026469220985301794",tick:-198703,protocolFee:0,lpFee:0},{poolId:"0x387bf619da4d3fb62bb276482693dba1b9b3520f573cabdfe033384a24125982",key:{currency0:k,currency1:E,fee:500,tickSpacing:10,hooks:k},liquidity:"225820987949255613",sqrtPriceX96:"3840577772610961024680304",tick:-198700,protocolFee:512125,lpFee:500},{poolId:"0x54f7883914619af9105355bf83ed678bcf9f63560218ac61c9963b9503d0ba32",key:{currency0:k,currency1:E,fee:460,tickSpacing:9,hooks:k},liquidity:"85654324417347171",sqrtPriceX96:"3840419018843648722761192",tick:-198701,protocolFee:479349,lpFee:460},{poolId:"0xc7b615a3721594f73664eb3f62d8290d0fcc8d9d1156aed1ddecbd7f32efd9f5",key:{currency0:k,currency1:E,fee:8388608,tickSpacing:10,hooks:y("0xcb787a5cdea8b3715d984d82f1203fd7bfebe0c4")},liquidity:"50517446454827887",sqrtPriceX96:"3840495145865430860317598",tick:-198700,protocolFee:0,lpFee:0},{poolId:"0x24107d152f14a76d292123265ae3f3c71f863fc2f4ef7ba49d64e78d28ea379e",key:{currency0:k,currency1:E,fee:100,tickSpacing:1,hooks:k},liquidity:"36478878201789434",sqrtPriceX96:"3840363370720475418748563",tick:-198701,protocolFee:102425,lpFee:100},{poolId:"0x84bd4e2d8be11aeb0afc1195b38f587b61e90068548f1063fdbe448fb8cad0b6",key:{currency0:te,currency1:E,fee:200,tickSpacing:4,hooks:k},liquidity:"5980655057479791",sqrtPriceX96:"3839891926195366283625355",tick:-198703,protocolFee:213044,lpFee:200},{poolId:"0x3b0cbf0603ecc67b5fc9bb4fbb6ac9e08d3b2f406b63d1662a36063a7fe5e866",key:{currency0:k,currency1:E,fee:87,tickSpacing:1,hooks:k},liquidity:"5486760264498148",sqrtPriceX96:"3840563617639470134132117",tick:-198700,protocolFee:90134,lpFee:87}],Ne=y("0x987e330f00b79864a07fe81dfac344d0078abcc0"),wn="0xa791e5169faf703c0b63fd9552c33ec1128a773a00f5dc33a640da62a022cd35",_n={currency0:k,currency1:E,fee:Ue,tickSpacing:1,hooks:Ne},En=new Set([...Ke.map(e=>e.key.hooks.toLowerCase()),Ne.toLowerCase()]),Dn=B("address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks"),Un=B("(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"),Kn=B("address currency0, address currency1"),Nn=B("address currency, address recipient"),we=B("uint256 tokenId, uint256 liquidity, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Fn=B("uint256 tokenId, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Te=B("address currency0, address currency1, address recipient"),de=B("bytes actions, bytes[] params"),F=Pe(["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)"]),Vn=Pe(["function initialize((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint160 sqrtPriceX96) returns (int24 tick)"]),Je=B("address currency"),en=1e6,pe=Pe(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Hn=Pe(["function approve(address token, address spender, uint160 amount, uint48 expiration)"]),Xn=Ln("Transfer(address,address,uint256)");function he(e){if(typeof e!="string"||!In(e,{strict:!1}))throw new o("Provide a valid v4 currency address.");let n=e.toLowerCase();return n===k||n===ae.toLowerCase()?k:y(e)}function X(e){let n=e.toLowerCase();return n===k||n===ae.toLowerCase()}function fe(e){let n=he(e.currency0),i=he(e.currency1);T(e.hooks);let r=y(e.hooks);return Cn(A(Dn,[n,i,e.fee,e.tickSpacing,r]))}function bn(e){return((typeof e=="number"?e:e.fee)&Ue)!==0}function nn(e,n){return bn(e)?{dynamicFee:!0,storedLpFee:n,swapsAreFree:!1,feeNote:"Pool uses dynamic fee flag 0x800000; stored lpFee=0 does not mean swaps are free. The hook determines the swap fee; a past observation is not a current quote."}:{dynamicFee:!1,storedLpFee:n,swapsAreFree:n===0,feeNote:`Static LP fee ${n} pips.`}}function be(e,n){if(!e||typeof e!="object")throw new o("Provide a valid v4 PoolKey.");let i=he(e.currency0),r=he(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=y(e.hooks),s=bn(e.fee);if(!s&&e.fee>en)throw new o(`PoolKey static fee ${e.fee} exceeds the v4 maximum of ${en} pips (100%).`);if(s&&e.fee!==Ue)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(!En.has(c.toLowerCase()))throw 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=fe(t);if(c===Ne&&d.toLowerCase()!==wn)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 Bn(e){if(!Number.isInteger(e)||e<=0||e>ke)throw new o("tickSpacing must be a positive integer.");let n=Math.trunc(Ee/e)*e,i=Math.trunc(ke/e)*e;return{tickLower:n===0?0:n,tickUpper:i===0?0:i}}function On(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<Ee||n>ke)throw new o(`Ticks [${e}, ${n}] are outside Uniswap bounds [${Ee}, ${ke}].`);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 tn(e,n,i,r,c=m){if(T(e),T(n),X(e))throw new o("Native ETH does not use Permit2 approval.");let s=U(i);if(s<=0n||s>$n)throw new o("Permit2 approval amount must be a positive integer within uint160.");let t=U(String(r));if(t<=0n||t>mn)throw new o("Permit2 expiration must be a positive timestamp within uint48.");let d=ne({abi:Hn,functionName:"approve",args:[e,n,s,Number(t)]});return Oe({to:_e,data:d,value:"0",chainId:c,description:`Approve Permit2 allowance of ${s} base units of ${e} for ${n} until ${t}.`})}function on(e){let n=Number(e&0xffffffn);return(n&8388608)!==0?n-16777216:n}function Rn(e){let n=(e&0xffn)!==0n,i=on(e>>8n&0xffffffn),r=on(e>>32n&0xffffffn);return{poolIdBytes25:`0x${(e>>56n&(1n<<200n)-1n).toString(16).padStart(50,"0")}`,tickLower:i,tickUpper:r,hasSubscriber:n}}function rn(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 sn(e,n,i,r=!1){let[c,s]=e<=n?[e,n]:[n,e],t=i*(s-c);return r?(t+ue-1n)/ue:t/ue}function gn(e){if(e.liquidity<=0n)return{amount0:0n,amount1:0n};let n=ce(e.tickLower),i=ce(e.tickUpper);return e.sqrtPriceX96<=n?{amount0:rn(n,i,e.liquidity,e.roundUp),amount1:0n}:e.sqrtPriceX96<i?{amount0:rn(e.sqrtPriceX96,i,e.liquidity,e.roundUp),amount1:sn(n,e.sqrtPriceX96,e.liquidity,e.roundUp)}:{amount0:0n,amount1:sn(n,i,e.liquidity,e.roundUp)}}function jn(e){let n=ce(e.tickLower),i=ce(e.tickUpper),r=(s,t,d)=>t<=s||d<=0n?0n:d*s*t/ue/(t-s),c=(s,t,d)=>t<=s||d<=0n?0n:d*ue/(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 $e(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 an(e,n=m){if(X(e))return{address:ae,symbol:"ETH",decimals:18,chainId:n};let i=y(e);return i.toLowerCase()===E.toLowerCase()?{address:E,symbol:"USDG",decimals:Xe,chainId:n}:i.toLowerCase()===te.toLowerCase()?{address:te,symbol:"WETH",decimals:18,chainId:n}:{address:i,symbol:i.slice(0,10),decimals:18,chainId:n}}async function N(e,n,i=m){if(X(n))return an(n,i);let r=y(n);if(r.toLowerCase()===E.toLowerCase()||r.toLowerCase()===te.toLowerCase())return an(r,i);let[c,s]=await Promise.all([e.readContract({address:r,abi:We,functionName:"symbol"}),e.readContract({address:r,abi:We,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:ze(c,r),decimals:Number(s),chainId:i}}function j(e,n){if(typeof e!="string"||!/^\d+$/.test(e))throw new o(`${n} must be a non-negative integer string in base units.`);return U(e)}function cn(e,n,i,r){let c=e===void 0?U(Ce(n.toString(),i)):j(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 kn(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 Me(e,n,i){let r=await kn(e,i);if(n==null)return r+1800n;let c=U(String(n));if(c<=r)throw new o(`Transaction deadline ${c} has expired (current timestamp ${r}).`);return c}async function De(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??E),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(X(c.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===te.toLowerCase())throw new o("Native ETH currency0 differs from WETH; do not supply WETH for a native-ETH v4 pool.");let b=be(c,i);return{poolId:fe(b),poolKey:b}}let s=(i??Mn).toLowerCase();if(s===wn)return{poolId:s,poolKey:be(_n,s)};let t=Ke.find(b=>b.poolId.toLowerCase()===s);if(t){if(X(t.key.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===te.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:$,abi:F,functionName:"poolKeys",args:[d]}),[p,l,f,u,h]=a;if(p.toLowerCase()===k&&l.toLowerCase()===k&&Number(u)===0)throw new o(`Unknown or uninitialized v4 poolId ${s}.`);let w=be({currency0:p,currency1:l,fee:Number(f),tickSpacing:Number(u),hooks:h},s);return{poolId:s,poolKey:w}}async function ge(e,n,i){try{let[r,c]=await e.readContract({address:$,abi:F,functionName:"getPoolAndPositionInfo",args:[n]}),s=be({currency0:r.currency0,currency1:r.currency1,fee:Number(r.fee),tickSpacing:Number(r.tickSpacing),hooks:r.hooks});if((i.poolKey||i.poolId)&&(await De(e,i)).poolId.toLowerCase()!==fe(s).toLowerCase())throw new o("The supplied PoolKey does not match this v4 position.");let t=Rn(BigInt(c));return{poolKey:s,poolId:fe(s),tickLower:t.tickLower,tickUpper:t.tickUpper}}catch(r){throw new o(`Could not read v4 position #${n}. ${ee(r)}`)}}function zn(e){if(typeof e!="string")throw new o("wallet must be a valid 20-byte hex address.");return T(e),y(e)}async function dn(e,n,i={}){T(n);let r=y(n),c=e.clientFor(m),s=new Set;if(i.tokenIds)for(let d of i.tokenIds)s.add(U(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,f=await c.request({method:"eth_getLogs",params:[{address:$.toLowerCase(),topics:[Xn,null,qn(r)],fromBlock:Ge(p),toBlock:Ge(l)}]});if(!Array.isArray(f))throw new o("Invalid v4 position log response.");for(let u of f){if(!Array.isArray(u.topics)||u.topics.length!==4||!/^0x[0-9a-fA-F]{64}$/.test(u.topics[3]??""))throw new o("Invalid v4 position transfer log.");s.add(BigInt(u.topics[3]).toString())}}}catch(d){if(!i.tokenIds)throw new o(`Could not discover v4 positions. ${ee(d)}`)}let t=[];for(let d of s){let a=BigInt(d);try{let p;try{p=await c.readContract({address:$,abi:F,functionName:"ownerOf",args:[a]})}catch(P){if(He(P,3))continue;throw P}if(p.toLowerCase()!==r.toLowerCase())continue;let l=await c.readContract({address:$,abi:F,functionName:"getPositionLiquidity",args:[a]}),f=BigInt(l);if(f===0n&&!i.includeZero)continue;let{poolKey:u,poolId:h,tickLower:w,tickUpper:b}=await ge(c,a,{}),I=await c.readContract({address:le,abi:pe,functionName:"getSlot0",args:[h]}),x=BigInt(I[0]),{amount0:g,amount1:S}=gn({liquidity:f,tickLower:w,tickUpper:b,sqrtPriceX96:x}),[v,D]=await Promise.all([N(c,u.currency0,m),N(c,u.currency1,m)]);t.push({module:"uniswap",id:`uniswap:v4:${a.toString()}`,chainId:m,assets:[{token:v,amount:g.toString()},{token:D,amount:S.toString()}],description:`Uniswap v4 LP position #${a.toString()} (${v.symbol}/${D.symbol}, liquidity=${f.toString()}, ticks=[${w},${b}], poolId=${h})`})}catch(p){throw new o(`Could not read v4 position #${a}. ${ee(p)}`)}}return t}var Wn={type:"object",properties:{version:{type:"string",enum:["v4"]},poolId:{type:"string",description:"32-byte Uniswap v4 poolId hex string."},poolKey:{type:"object",properties:{currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"}}},currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"},tickLower:{type:"number"},tickUpper:{type:"number"},fullRange:{type:"boolean"},liquidity:L("Position liquidity in base units."),amount0Max:L("Maximum currency0 base units to spend."),amount1Max:L("Maximum currency1 base units to spend."),recipient:{type:"string"},deadline:L(),permit2Expiration:{type:"string"},hookData:{type:"string"},tokenId:L("Existing v4 position NFT to increase (keeps its tick range). Omit to mint a new position."),initialPrice:{type:"string",description:"Only when the pool does not exist: starting price as token1 per 1 token0 in human units (native ETH is 18 decimals). Needs the full poolKey. Creates the pool then mints the first position in separately confirmed transactions."},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},Gn={type:"object",description:"Create and initialize an empty Uniswap v4 pool (permissionless PoolManager.initialize). Add liquidity afterwards with uniswap_add.",properties:{version:{type:"string",enum:["v4"]},poolKey:{type:"object",properties:{currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"}}},currency0:{type:"string",description:"Lower sorted currency; the zero address is native ETH."},currency1:{type:"string"},fee:{type:"number",description:"Static LP fee in pips (3000 = 0.30%), at most 1000000."},tickSpacing:{type:"number"},hooks:{type:"string",description:"Hook address; only hooks Oak has measured are accepted. Defaults to none."},initialPrice:{type:"string",description:'Starting price as token1 per 1 token0 in human units, e.g. "3000" for 1 ETH = 3000 USDG.'},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},Zn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenId:L(),poolId:{type:"string"},poolKey:{type:"object"},amount0Min:L(),amount1Min:L(),recipient:{type:"string"},deadline:L(),hookData:{type:"string"}},required:["tokenId"]},Yn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenId:L(),liquidity:{type:"string",pattern:"^(?:[0-9]+|all)$",description:"Positive base-unit liquidity amount, or all for a full burn."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:Ie},fullExit:{type:"boolean"},burn:{type:"boolean"},amount0Min:L(),amount1Min:L(),poolId:{type:"string"},poolKey:{type:"object"},recipient:{type:"string"},deadline:L(),hookData:{type:"string"}},required:["tokenId"]},Qn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenIds:{type:"array",items:L()},includeZero:{type:"boolean"}}};function un(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 ln(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 je(BigInt(e.sqrtPriceX96))}return Re(e.initialPrice,n,i)}async function Jn(e,n,i){let r;try{r=await e.readContract({address:$,abi:F,functionName:"ownerOf",args:[n]})}catch(c){throw new o(`Could not verify owner of Uniswap v4 position #${n}. ${ee(c)}`)}if(y(r)!==y(i))throw new o(`Wallet ${y(i)} is not the owner of Uniswap v4 position #${n} (owned by ${y(r)}).`)}async function pn(e,n){let i=fe(n).toLowerCase(),r=new Map;for(let s of Ke)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:pe,functionName:"getLiquidity",args:[s]}))===0n)continue;let a=await e.readContract({address:le,abi:pe,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 fn(e,n,i,r,c,s){return e.unsignedTx({to:Tn.toLowerCase(),data:ne({abi:Vn,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:m,description:`Create and initialize Uniswap v4 pool ${i} (${c.symbol}/${s.symbol}, fee ${n.fee}, tickSpacing ${n.tickSpacing}) at ${ye(r,c.decimals,s.decimals)} ${s.symbol} per ${c.symbol}.`})}var et=e=>({tools:[{name:"uniswap_add",inputSchema:Wn,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:U(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(a!==void 0&&p)throw new o("initialPrice cannot be combined with tokenId.");if(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.");let l=e.clientFor(m);p&&un(t);let f,u,h,w;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 Jn(l,a,d),{poolId:f,poolKey:u,tickLower:h,tickUpper:w}=await ge(l,a,t)}else{({poolId:f,poolKey:u}=await De(l,t));let q=Bn(u.tickSpacing);h=t.fullRange===!0&&t.tickLower===void 0?q.tickLower:Number(t.tickLower),w=t.fullRange===!0&&t.tickUpper===void 0?q.tickUpper:Number(t.tickUpper),On(h,w,u.tickSpacing)}let[b,I]=await Promise.all([N(l,u.currency0,m),N(l,u.currency1,m)]),x=j(t.amount0Max??t.amount0Desired,"amount0Max"),g=j(t.amount1Max??t.amount1Desired,"amount1Max");if(x<=0n&&g<=0n||x>J||g>J)throw new o("Provide positive amount0Max/amount1Max within uint128.");let S=await l.readContract({address:le,abi:pe,functionName:"getSlot0",args:[f]}),v=BigInt(S[0]),D=Number(S[3]),P;if(p){if(v>0n)throw new o(`Pool ${f} already exists; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);let q=ln(t,b.decimals,I.decimals),K=Le(q,await pn(l,u),t.acceptPriceDeviation===!0,b.decimals,I.decimals);P={sqrtPriceX96:q,note:K},v=q}else if(v<=0n)throw new o(`Pool ${f} 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 C=t.liquidity!==void 0?j(t.liquidity,"liquidity"):jn({amount0:Ye(x),amount1:Ye(g),tickLower:h,tickUpper:w,sqrtPriceX96:v});if(C<=0n||C>J)throw new o("Position liquidity must be a positive integer within uint128.");let{amount0:V,amount1:z}=gn({liquidity:C,tickLower:h,tickUpper:w,sqrtPriceX96:v,roundUp:!0});if(V>x||z>g)throw new o("Liquidity requires more tokens than amount0Max or amount1Max.");let ie=Qe(V,x),oe=Qe(z,g),W=t.recipient!==void 0?String(t.recipient):d;if(T(W),y(W)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let G=await kn(l),re=await Me(l,t.deadline,G.toString()),_=re<G+Ze?re:G+Ze,M=t.permit2Expiration===void 0?_:U(String(t.permit2Expiration));if(M<=G||M>_||M>mn)throw new o("Permit2 expiration must be in the next 30 minutes and no later than the transaction deadline.");let Z=typeof t.hookData=="string"?t.hookData:"0x",Y=((q,K)=>{let R=P?[fn(e,u,f,P.sqrtPriceX96,b,I)]:[];if(!X(u.currency0)&&q>0n){let se=u.currency0.toLowerCase();R.push(e.approval(se,_e.toLowerCase(),q.toString(),m)),R.push(tn(se,$.toLowerCase(),q.toString(),M.toString(),m))}if(!X(u.currency1)&&K>0n){let se=u.currency1.toLowerCase();R.push(e.approval(se,_e.toLowerCase(),K.toString(),m)),R.push(tn(se,$.toLowerCase(),K.toString(),M.toString(),m))}let H={currency0:u.currency0.toLowerCase(),currency1:u.currency1.toLowerCase(),fee:u.fee,tickSpacing:u.tickSpacing,hooks:u.hooks.toLowerCase()},Se=A(Un,[H,h,w,C,q,K,W.toLowerCase(),Z]),Pn=A(Kn,[H.currency0,H.currency1]),Ve=A(Nn,[k,W.toLowerCase()]),vn=A(we,[a??0n,C,q,K,Z]),An=a===void 0?A(de,["0x020d14",[Se,Pn,Ve]]):A(de,["0x00121214",[vn,A(Je,[H.currency0]),A(Je,[H.currency1]),Ve]]),xn=ne({abi:F,functionName:"modifyLiquidities",args:[An,re]}),Sn=X(u.currency0)?q.toString():"0";return R.push(e.unsignedTx({to:$.toLowerCase(),data:xn,value:Sn,chainId:m,description:a!==void 0?`Increase Uniswap v4 position #${a} on pool ${f} (liquidity +${C}).`:`Mint Uniswap v4 position on pool ${f} (ticks [${h}, ${w}], liquidity ${C}).`})),R})(ie,oe),O=await e.preview(Y,d),Fe=(q,K)=>{let R=X(K)?ae:K.toLowerCase();return-q.changes.filter(H=>H.token.address.toLowerCase()===R).reduce((H,Se)=>H+BigInt(Se.amount),0n)},ve=Fe(O,u.currency0),Ae=Fe(O,u.currency1);if(ve<0n||Ae<0n||ve>ie||Ae>oe||ve===0n&&Ae===0n&&a===void 0)throw new o("Invalid simulated v4 mint spend. Refresh the liquidity preview.");let hn=$e(O.changes,e.formatAmount),xe=nn(u,D);return{txs:Y,preview:O,poolId:f,poolKey:u,tickLower:h,tickUpper:w,liquidity:C.toString(),amount0Max:{token:b,amount:x.toString()},amount1Max:{token:I,amount:g.toString()},dynamicFee:xe.dynamicFee,swapsAreFree:xe.swapsAreFree,action:a!==void 0?"increase":P?"createAndMint":"mint",...a!==void 0?{tokenId:a.toString()}:{},...P?{poolCreated:!0,sqrtPriceX96:P.sqrtPriceX96.toString(),initialPrice:ye(P.sqrtPriceX96,b.decimals,I.decimals),initialTick:qe(P.sqrtPriceX96),priceCheck:P.note}:{},summary:`${a!==void 0?`Increase Uniswap v4 position #${a}`:P?"Create Uniswap v4 pool and add first liquidity":"Add Uniswap v4 liquidity"} (${C} L, ticks [${h}, ${w}]) on pool ${f}. Preview deltas: ${hn.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. ${xe.feeNote}${P?` ${P.note}`:""}`}}},{name:"uniswap_collect",inputSchema:Zn,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=U(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(m),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),y(l)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let f=await Me(p,t.deadline,t.now),u=t.amount0Min!==void 0?j(t.amount0Min,"amount0Min"):0n,h=t.amount1Min!==void 0?j(t.amount1Min,"amount1Min"):0n;if(u>J||h>J)throw new o("amount0Min and amount1Min must fit in uint128.");let w=typeof t.hookData=="string"?t.hookData:"0x",{poolKey:b,poolId:I}=await ge(p,a,t),[x,g]=await Promise.all([N(p,b.currency0,m),N(p,b.currency1,m)]),S=A(we,[a,0n,u,h,w]),v=A(Te,[b.currency0.toLowerCase(),b.currency1.toLowerCase(),l.toLowerCase()]),D=A(de,["0x0111",[S,v]]),P=ne({abi:F,functionName:"modifyLiquidities",args:[D,f]}),C=[e.unsignedTx({to:$.toLowerCase(),data:P,value:"0",chainId:m,description:`Collect Uniswap v4 fees from position #${a} to ${l}.`})],V=await e.preview(C,d),z=$e(V.changes,e.formatAmount);return{txs:C,preview:V,tokenId:a.toString(),poolId:I,recipient:l,currencies:[x,g],summary:`Collect Uniswap v4 fees for position #${a} (actions 0x0111). Preview deltas: ${z.join(", ")||"0"}.`}}},{name:"uniswap_remove",inputSchema:Yn,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=U(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(m),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),y(l)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let f=await Me(p,t.deadline,t.now),{poolKey:u,poolId:h}=await ge(p,a,t),[w,b]=await Promise.all([N(p,u.currency0,m),N(p,u.currency1,m)]),I=t.slippageBps??Ie;if(typeof I!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");Ce("0",I);let x=typeof t.hookData=="string"?t.hookData:"0x",g=t.fullExit===!0||t.burn===!0||t.liquidity==="all";if(!g&&t.liquidity===void 0)throw new o('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let S=t.liquidity===void 0||t.liquidity==="all"?void 0:j(t.liquidity,"liquidity");if(S!==void 0&&(S<0n||S===0n&&!g||S>J))throw new o("Provide positive liquidity within uint128 for v4 removal.");let v;try{v=BigInt(await p.readContract({address:$,abi:F,functionName:"getPositionLiquidity",args:[a]}))}catch(_){throw new o(`Could not read v4 position liquidity. ${ee(_)}`)}if(v<0n||v===0n&&!g||S!==void 0&&S>v)throw new o("Removal requires a nonempty position and cannot exceed its liquidity.");if(g&&S!==void 0&&S!==v)throw new o("A full burn must match the position liquidity; omit the amount when explicitly choosing all.");let D=g?"0x0311":"0x0111",P=(_,M,Z)=>{let me=g?A(Fn,[a,_,M,x]):A(we,[a,S,_,M,x]),Y=A(Te,[u.currency0,u.currency1,Z]);return e.unsignedTx({to:$.toLowerCase(),data:ne({abi:F,functionName:"modifyLiquidities",args:[A(de,[D,[me,Y]]),f]}),value:"0",chainId:m,description:`${g?"Burn and exit":"Decrease"} Uniswap v4 position #${a} (${D}).`})},C=0n,V=0n;if(v>0n&&(t.amount0Min===void 0||t.amount1Min===void 0)){let _=e.unsignedTx({to:$.toLowerCase(),data:ne({abi:F,functionName:"modifyLiquidities",args:[A(de,["0x0111",[A(we,[a,0n,0n,0n,x]),A(Te,[u.currency0,u.currency1,$])]]),f]}),value:"0",chainId:m,description:"Simulation only: separate fees from removal principal."}),M=await e.preview([_,P(2n,2n,d)],d),Z=me=>M.changes.reduce((Y,O)=>O.token.chainId===m&&O.token.address.toLowerCase()===me.address.toLowerCase()?Y+BigInt(O.amount):Y,0n);if(C=Z(w),V=Z(b),C<0n||V<0n)throw new o("Removal simulation did not return the expected currencies.")}let z=(_,M)=>{if(_!==void 0&&j(_,M)!==0n)throw new o(`${M} must be zero for an empty position burn.`);return 0n},ie=v===0n?z(t.amount0Min,"amount0Min"):cn(t.amount0Min,C,I,"amount0Min"),oe=v===0n?z(t.amount1Min,"amount1Min"):cn(t.amount1Min,V,I,"amount1Min"),W=[P(ie,oe,l)],G=await e.preview(W,d),re=$e(G.changes,e.formatAmount);return{txs:W,preview:G,action:D,tokenId:a.toString(),poolId:h,amount0Min:{token:w,amount:ie.toString()},amount1Min:{token:b,amount:oe.toString()},summary:`${g?"Full exit":"Partial remove"} Uniswap v4 position #${a} (${D})${g?`; burns position #${a} at ${$}`:""}. Preview deltas: ${re.join(", ")||"none"}.`}}},{name:"uniswap_list_positions",inputSchema:Qn,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?y(d):zn(t.wallet),f=await dn(e,l,{tokenIds:a,includeZero:p});return{version:"v4",positions:f,summary:`Found ${f.length} active Uniswap v4 position(s) for ${l}.`}}},{name:"uniswap_create_pool",inputSchema:Gn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');un(t);let a=e.clientFor(m),{poolId:p,poolKey:l}=await De(a,t),[f,u]=await Promise.all([N(a,l.currency0,m),N(a,l.currency1,m)]),h=await a.readContract({address:le,abi:pe,functionName:"getSlot0",args:[p]});if(BigInt(h[0])>0n)throw new o(`Uniswap v4 pool ${p} already exists. Use uniswap_add to provide liquidity.`);let w=ln(t,f.decimals,u.decimals),b=Le(w,await pn(a,l),t.acceptPriceDeviation===!0,f.decimals,u.decimals),I=ye(w,f.decimals,u.decimals),x=[fn(e,l,p,w,f,u)],g=await e.preview(x,d),S=nn(l,l.fee);return{txs:x,preview:g,poolId:p,poolKey:l,sqrtPriceX96:w.toString(),initialPrice:I,initialTick:qe(w),priceCheck:b,action:"createPool",summary:`${x[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add. ${S.feeNote} ${b}`}}}],positions:t=>dn(e,t)}),pt=et;export{Tn as a,$ as b,le as c,_e as d,lt as e,te as f,E as g,k as h,Ue as i,Ee as j,ke as k,Mn as l,Ke as m,Ne as n,wn as o,_n as p,En as q,X as r,fe as s,bn as t,nn as u,be as v,Bn as w,On as x,tn as y,Rn as z,gn as A,jn as B,$e as C,an as D,N as E,ge as F,dn as G,Wn as H,Gn as I,Zn as J,Yn as K,Qn as L,pn as M,et as N,pt as O};
1
+ import{c as Re,d as je,e as qe,f as ye,i as Le,j as ze}from"./ALLLYOUG.js";import{i as ce}from"./7KWZ5QJU.js";import{b as Ie,o as Ce}from"./BOVMED7R.js";import{a as ae}from"./QHBS3PVU.js";import{a as T,b as Oe}from"./43LI5NKJ.js";import{a as L}from"./66F5ZH34.js";import{b as U}from"./IX3GZMTM.js";import{a as m,d as Xe,i as Q,j as Be}from"./FWD4L3CJ.js";import{a as o,b as He,e as ee}from"./XSD5NL7J.js";import{encodeAbiParameters as A,encodeFunctionData as ne,erc20Abi as We,getAddress as y,isAddress as In,keccak256 as Cn,pad as qn,parseAbi as Pe,parseAbiParameters as B,toEventSelector as Ln,toHex as Ge}from"viem";var Tn=y(Q[4663].uniswap.v4_pool_manager.address),$=y(Q[4663].uniswap.v4_position_manager.address),le=y(Q[4663].uniswap.v4_state_view.address),_e=y(Q[4663].uniswap.permit2.address),lt=y(Q[4663].ponsTrade.universal_router.address),te=y(Q[4663].uniswap.WETH.address),E=y(Be),k="0x0000000000000000000000000000000000000000",Ue=8388608,Ee=-887272,ke=887272,mn=(1n<<48n)-1n,J=(1n<<128n)-1n,$n=(1n<<160n)-1n,ue=1n<<96n,Ze=1800n,yn=50n,Ye=e=>e*(10000n-yn)/10000n,Qe=(e,n)=>{let i=(e*(10000n+yn)+9999n)/10000n;return i<n?i:n},Mn="0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",Ke=[{poolId:"0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",key:{currency0:k,currency1:E,fee:8388608,tickSpacing:10,hooks:y("0x06a889870c8f83640d6816319f72e2aa579b6080")},liquidity:"5532026605872066941",sqrtPriceX96:"3839897026469220985301794",tick:-198703,protocolFee:0,lpFee:0},{poolId:"0x387bf619da4d3fb62bb276482693dba1b9b3520f573cabdfe033384a24125982",key:{currency0:k,currency1:E,fee:500,tickSpacing:10,hooks:k},liquidity:"225820987949255613",sqrtPriceX96:"3840577772610961024680304",tick:-198700,protocolFee:512125,lpFee:500},{poolId:"0x54f7883914619af9105355bf83ed678bcf9f63560218ac61c9963b9503d0ba32",key:{currency0:k,currency1:E,fee:460,tickSpacing:9,hooks:k},liquidity:"85654324417347171",sqrtPriceX96:"3840419018843648722761192",tick:-198701,protocolFee:479349,lpFee:460},{poolId:"0xc7b615a3721594f73664eb3f62d8290d0fcc8d9d1156aed1ddecbd7f32efd9f5",key:{currency0:k,currency1:E,fee:8388608,tickSpacing:10,hooks:y("0xcb787a5cdea8b3715d984d82f1203fd7bfebe0c4")},liquidity:"50517446454827887",sqrtPriceX96:"3840495145865430860317598",tick:-198700,protocolFee:0,lpFee:0},{poolId:"0x24107d152f14a76d292123265ae3f3c71f863fc2f4ef7ba49d64e78d28ea379e",key:{currency0:k,currency1:E,fee:100,tickSpacing:1,hooks:k},liquidity:"36478878201789434",sqrtPriceX96:"3840363370720475418748563",tick:-198701,protocolFee:102425,lpFee:100},{poolId:"0x84bd4e2d8be11aeb0afc1195b38f587b61e90068548f1063fdbe448fb8cad0b6",key:{currency0:te,currency1:E,fee:200,tickSpacing:4,hooks:k},liquidity:"5980655057479791",sqrtPriceX96:"3839891926195366283625355",tick:-198703,protocolFee:213044,lpFee:200},{poolId:"0x3b0cbf0603ecc67b5fc9bb4fbb6ac9e08d3b2f406b63d1662a36063a7fe5e866",key:{currency0:k,currency1:E,fee:87,tickSpacing:1,hooks:k},liquidity:"5486760264498148",sqrtPriceX96:"3840563617639470134132117",tick:-198700,protocolFee:90134,lpFee:87}],Ne=y("0x987e330f00b79864a07fe81dfac344d0078abcc0"),wn="0xa791e5169faf703c0b63fd9552c33ec1128a773a00f5dc33a640da62a022cd35",_n={currency0:k,currency1:E,fee:Ue,tickSpacing:1,hooks:Ne},En=new Set([...Ke.map(e=>e.key.hooks.toLowerCase()),Ne.toLowerCase()]),Dn=B("address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks"),Un=B("(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"),Kn=B("address currency0, address currency1"),Nn=B("address currency, address recipient"),we=B("uint256 tokenId, uint256 liquidity, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Fn=B("uint256 tokenId, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Te=B("address currency0, address currency1, address recipient"),de=B("bytes actions, bytes[] params"),F=Pe(["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)"]),Vn=Pe(["function initialize((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint160 sqrtPriceX96) returns (int24 tick)"]),Je=B("address currency"),en=1e6,pe=Pe(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Hn=Pe(["function approve(address token, address spender, uint160 amount, uint48 expiration)"]),Xn=Ln("Transfer(address,address,uint256)");function he(e){if(typeof e!="string"||!In(e,{strict:!1}))throw new o("Provide a valid v4 currency address.");let n=e.toLowerCase();return n===k||n===ae.toLowerCase()?k:y(e)}function X(e){let n=e.toLowerCase();return n===k||n===ae.toLowerCase()}function fe(e){let n=he(e.currency0),i=he(e.currency1);T(e.hooks);let r=y(e.hooks);return Cn(A(Dn,[n,i,e.fee,e.tickSpacing,r]))}function bn(e){return((typeof e=="number"?e:e.fee)&Ue)!==0}function nn(e,n){return bn(e)?{dynamicFee:!0,storedLpFee:n,swapsAreFree:!1,feeNote:"Pool uses dynamic fee flag 0x800000; stored lpFee=0 does not mean swaps are free. The hook determines the swap fee; a past observation is not a current quote."}:{dynamicFee:!1,storedLpFee:n,swapsAreFree:n===0,feeNote:`Static LP fee ${n} pips.`}}function be(e,n){if(!e||typeof e!="object")throw new o("Provide a valid v4 PoolKey.");let i=he(e.currency0),r=he(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=y(e.hooks),s=bn(e.fee);if(!s&&e.fee>en)throw new o(`PoolKey static fee ${e.fee} exceeds the v4 maximum of ${en} pips (100%).`);if(s&&e.fee!==Ue)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(!En.has(c.toLowerCase()))throw 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=fe(t);if(c===Ne&&d.toLowerCase()!==wn)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 Bn(e){if(!Number.isInteger(e)||e<=0||e>ke)throw new o("tickSpacing must be a positive integer.");let n=Math.trunc(Ee/e)*e,i=Math.trunc(ke/e)*e;return{tickLower:n===0?0:n,tickUpper:i===0?0:i}}function On(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<Ee||n>ke)throw new o(`Ticks [${e}, ${n}] are outside Uniswap bounds [${Ee}, ${ke}].`);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 tn(e,n,i,r,c=m){if(T(e),T(n),X(e))throw new o("Native ETH does not use Permit2 approval.");let s=U(i);if(s<=0n||s>$n)throw new o("Permit2 approval amount must be a positive integer within uint160.");let t=U(String(r));if(t<=0n||t>mn)throw new o("Permit2 expiration must be a positive timestamp within uint48.");let d=ne({abi:Hn,functionName:"approve",args:[e,n,s,Number(t)]});return Oe({to:_e,data:d,value:"0",chainId:c,description:`Approve Permit2 allowance of ${s} base units of ${e} for ${n} until ${t}.`})}function on(e){let n=Number(e&0xffffffn);return(n&8388608)!==0?n-16777216:n}function Rn(e){let n=(e&0xffn)!==0n,i=on(e>>8n&0xffffffn),r=on(e>>32n&0xffffffn);return{poolIdBytes25:`0x${(e>>56n&(1n<<200n)-1n).toString(16).padStart(50,"0")}`,tickLower:i,tickUpper:r,hasSubscriber:n}}function rn(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 sn(e,n,i,r=!1){let[c,s]=e<=n?[e,n]:[n,e],t=i*(s-c);return r?(t+ue-1n)/ue:t/ue}function gn(e){if(e.liquidity<=0n)return{amount0:0n,amount1:0n};let n=ce(e.tickLower),i=ce(e.tickUpper);return e.sqrtPriceX96<=n?{amount0:rn(n,i,e.liquidity,e.roundUp),amount1:0n}:e.sqrtPriceX96<i?{amount0:rn(e.sqrtPriceX96,i,e.liquidity,e.roundUp),amount1:sn(n,e.sqrtPriceX96,e.liquidity,e.roundUp)}:{amount0:0n,amount1:sn(n,i,e.liquidity,e.roundUp)}}function jn(e){let n=ce(e.tickLower),i=ce(e.tickUpper),r=(s,t,d)=>t<=s||d<=0n?0n:d*s*t/ue/(t-s),c=(s,t,d)=>t<=s||d<=0n?0n:d*ue/(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 $e(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 an(e,n=m){if(X(e))return{address:ae,symbol:"ETH",decimals:18,chainId:n};let i=y(e);return i.toLowerCase()===E.toLowerCase()?{address:E,symbol:"USDG",decimals:Xe,chainId:n}:i.toLowerCase()===te.toLowerCase()?{address:te,symbol:"WETH",decimals:18,chainId:n}:{address:i,symbol:i.slice(0,10),decimals:18,chainId:n}}async function N(e,n,i=m){if(X(n))return an(n,i);let r=y(n);if(r.toLowerCase()===E.toLowerCase()||r.toLowerCase()===te.toLowerCase())return an(r,i);let[c,s]=await Promise.all([e.readContract({address:r,abi:We,functionName:"symbol"}),e.readContract({address:r,abi:We,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:ze(c,r),decimals:Number(s),chainId:i}}function j(e,n){if(typeof e!="string"||!/^\d+$/.test(e))throw new o(`${n} must be a non-negative integer string in base units.`);return U(e)}function cn(e,n,i,r){let c=e===void 0?U(Ce(n.toString(),i)):j(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 kn(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 Me(e,n,i){let r=await kn(e,i);if(n==null)return r+1800n;let c=U(String(n));if(c<=r)throw new o(`Transaction deadline ${c} has expired (current timestamp ${r}).`);return c}async function De(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??E),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(X(c.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===te.toLowerCase())throw new o("Native ETH currency0 differs from WETH; do not supply WETH for a native-ETH v4 pool.");let b=be(c,i);return{poolId:fe(b),poolKey:b}}let s=(i??Mn).toLowerCase();if(s===wn)return{poolId:s,poolKey:be(_n,s)};let t=Ke.find(b=>b.poolId.toLowerCase()===s);if(t){if(X(t.key.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===te.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:$,abi:F,functionName:"poolKeys",args:[d]}),[p,l,f,u,h]=a;if(p.toLowerCase()===k&&l.toLowerCase()===k&&Number(u)===0)throw new o(`Unknown or uninitialized v4 poolId ${s}.`);let w=be({currency0:p,currency1:l,fee:Number(f),tickSpacing:Number(u),hooks:h},s);return{poolId:s,poolKey:w}}async function ge(e,n,i){try{let[r,c]=await e.readContract({address:$,abi:F,functionName:"getPoolAndPositionInfo",args:[n]}),s=be({currency0:r.currency0,currency1:r.currency1,fee:Number(r.fee),tickSpacing:Number(r.tickSpacing),hooks:r.hooks});if((i.poolKey||i.poolId)&&(await De(e,i)).poolId.toLowerCase()!==fe(s).toLowerCase())throw new o("The supplied PoolKey does not match this v4 position.");let t=Rn(BigInt(c));return{poolKey:s,poolId:fe(s),tickLower:t.tickLower,tickUpper:t.tickUpper}}catch(r){throw new o(`Could not read v4 position #${n}. ${ee(r)}`)}}function zn(e){if(typeof e!="string")throw new o("wallet must be a valid 20-byte hex address.");return T(e),y(e)}async function dn(e,n,i={}){T(n);let r=y(n),c=e.clientFor(m),s=new Set;if(i.tokenIds)for(let d of i.tokenIds)s.add(U(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,f=await c.request({method:"eth_getLogs",params:[{address:$.toLowerCase(),topics:[Xn,null,qn(r)],fromBlock:Ge(p),toBlock:Ge(l)}]});if(!Array.isArray(f))throw new o("Invalid v4 position log response.");for(let u of f){if(!Array.isArray(u.topics)||u.topics.length!==4||!/^0x[0-9a-fA-F]{64}$/.test(u.topics[3]??""))throw new o("Invalid v4 position transfer log.");s.add(BigInt(u.topics[3]).toString())}}}catch(d){if(!i.tokenIds)throw new o(`Could not discover v4 positions. ${ee(d)}`)}let t=[];for(let d of s){let a=BigInt(d);try{let p;try{p=await c.readContract({address:$,abi:F,functionName:"ownerOf",args:[a]})}catch(P){if(He(P,3))continue;throw P}if(p.toLowerCase()!==r.toLowerCase())continue;let l=await c.readContract({address:$,abi:F,functionName:"getPositionLiquidity",args:[a]}),f=BigInt(l);if(f===0n&&!i.includeZero)continue;let{poolKey:u,poolId:h,tickLower:w,tickUpper:b}=await ge(c,a,{}),I=await c.readContract({address:le,abi:pe,functionName:"getSlot0",args:[h]}),x=BigInt(I[0]),{amount0:g,amount1:S}=gn({liquidity:f,tickLower:w,tickUpper:b,sqrtPriceX96:x}),[v,D]=await Promise.all([N(c,u.currency0,m),N(c,u.currency1,m)]);t.push({module:"uniswap",id:`uniswap:v4:${a.toString()}`,chainId:m,assets:[{token:v,amount:g.toString()},{token:D,amount:S.toString()}],description:`Uniswap v4 LP position #${a.toString()} (${v.symbol}/${D.symbol}, liquidity=${f.toString()}, ticks=[${w},${b}], poolId=${h})`})}catch(p){throw new o(`Could not read v4 position #${a}. ${ee(p)}`)}}return t}var Wn={type:"object",properties:{version:{type:"string",enum:["v4"]},poolId:{type:"string",description:"32-byte Uniswap v4 poolId hex string."},poolKey:{type:"object",properties:{currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"}}},currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"},tickLower:{type:"number"},tickUpper:{type:"number"},fullRange:{type:"boolean"},liquidity:L("Position liquidity in base units."),amount0Max:L("Maximum currency0 base units to spend."),amount1Max:L("Maximum currency1 base units to spend."),recipient:{type:"string"},deadline:L(),permit2Expiration:{type:"string"},hookData:{type:"string"},tokenId:L("Existing v4 position NFT to increase (keeps its tick range). Omit to mint a new position."),initialPrice:{type:"string",description:"Only when the pool does not exist: starting price as token1 per 1 token0 in human units (native ETH is 18 decimals). Needs the full poolKey. Creates the pool then mints the first position in separately confirmed transactions."},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},Gn={type:"object",description:"Create and initialize an empty Uniswap v4 pool (permissionless PoolManager.initialize). Add liquidity afterwards with uniswap_add.",properties:{version:{type:"string",enum:["v4"]},poolKey:{type:"object",properties:{currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"}}},currency0:{type:"string",description:"Lower sorted currency; the zero address is native ETH."},currency1:{type:"string"},fee:{type:"number",description:"Static LP fee in pips (3000 = 0.30%), at most 1000000."},tickSpacing:{type:"number"},hooks:{type:"string",description:"Hook address; only hooks Oak has measured are accepted. Defaults to none."},initialPrice:{type:"string",description:'Starting price as token1 per 1 token0 in human units, e.g. "3000" for 1 ETH = 3000 USDG.'},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},Zn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenId:L(),poolId:{type:"string"},poolKey:{type:"object"},amount0Min:L(),amount1Min:L(),recipient:{type:"string"},deadline:L(),hookData:{type:"string"}},required:["tokenId"]},Yn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenId:L(),liquidity:{type:"string",pattern:"^(?:[0-9]+|all)$",description:"Positive base-unit liquidity amount, or all for a full burn."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:Ie},fullExit:{type:"boolean"},burn:{type:"boolean"},amount0Min:L(),amount1Min:L(),poolId:{type:"string"},poolKey:{type:"object"},recipient:{type:"string"},deadline:L(),hookData:{type:"string"}},required:["tokenId"]},Qn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenIds:{type:"array",items:L()},includeZero:{type:"boolean"}}};function un(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 ln(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 je(BigInt(e.sqrtPriceX96))}return Re(e.initialPrice,n,i)}async function Jn(e,n,i){let r;try{r=await e.readContract({address:$,abi:F,functionName:"ownerOf",args:[n]})}catch(c){throw new o(`Could not verify owner of Uniswap v4 position #${n}. ${ee(c)}`)}if(y(r)!==y(i))throw new o(`Wallet ${y(i)} is not the owner of Uniswap v4 position #${n} (owned by ${y(r)}).`)}async function pn(e,n){let i=fe(n).toLowerCase(),r=new Map;for(let s of Ke)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:pe,functionName:"getLiquidity",args:[s]}))===0n)continue;let a=await e.readContract({address:le,abi:pe,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 fn(e,n,i,r,c,s){return e.unsignedTx({to:Tn.toLowerCase(),data:ne({abi:Vn,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:m,description:`Create and initialize Uniswap v4 pool ${i} (${c.symbol}/${s.symbol}, fee ${n.fee}, tickSpacing ${n.tickSpacing}) at ${ye(r,c.decimals,s.decimals)} ${s.symbol} per ${c.symbol}.`})}var et=e=>({tools:[{name:"uniswap_add",inputSchema:Wn,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:U(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(a!==void 0&&p)throw new o("initialPrice cannot be combined with tokenId.");if(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.");let l=e.clientFor(m);p&&un(t);let f,u,h,w;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 Jn(l,a,d),{poolId:f,poolKey:u,tickLower:h,tickUpper:w}=await ge(l,a,t)}else{({poolId:f,poolKey:u}=await De(l,t));let q=Bn(u.tickSpacing);h=t.fullRange===!0&&t.tickLower===void 0?q.tickLower:Number(t.tickLower),w=t.fullRange===!0&&t.tickUpper===void 0?q.tickUpper:Number(t.tickUpper),On(h,w,u.tickSpacing)}let[b,I]=await Promise.all([N(l,u.currency0,m),N(l,u.currency1,m)]),x=j(t.amount0Max??t.amount0Desired,"amount0Max"),g=j(t.amount1Max??t.amount1Desired,"amount1Max");if(x<=0n&&g<=0n||x>J||g>J)throw new o("Provide positive amount0Max/amount1Max within uint128.");let S=await l.readContract({address:le,abi:pe,functionName:"getSlot0",args:[f]}),v=BigInt(S[0]),D=Number(S[3]),P;if(p){if(v>0n)throw new o(`Pool ${f} already exists; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);let q=ln(t,b.decimals,I.decimals),K=Le(q,await pn(l,u),t.acceptPriceDeviation===!0,b.decimals,I.decimals);P={sqrtPriceX96:q,note:K},v=q}else if(v<=0n)throw new o(`Pool ${f} 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 C=t.liquidity!==void 0?j(t.liquidity,"liquidity"):jn({amount0:Ye(x),amount1:Ye(g),tickLower:h,tickUpper:w,sqrtPriceX96:v});if(C<=0n||C>J)throw new o("Position liquidity must be a positive integer within uint128.");let{amount0:V,amount1:z}=gn({liquidity:C,tickLower:h,tickUpper:w,sqrtPriceX96:v,roundUp:!0});if(V>x||z>g)throw new o("Liquidity requires more tokens than amount0Max or amount1Max.");let ie=Qe(V,x),oe=Qe(z,g),W=t.recipient!==void 0?String(t.recipient):d;if(T(W),y(W)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let G=await kn(l),re=await Me(l,t.deadline,G.toString()),_=re<G+Ze?re:G+Ze,M=t.permit2Expiration===void 0?_:U(String(t.permit2Expiration));if(M<=G||M>_||M>mn)throw new o("Permit2 expiration must be in the next 30 minutes and no later than the transaction deadline.");let Z=typeof t.hookData=="string"?t.hookData:"0x",Y=((q,K)=>{let R=P?[fn(e,u,f,P.sqrtPriceX96,b,I)]:[];if(!X(u.currency0)&&q>0n){let se=u.currency0.toLowerCase();R.push(e.approval(se,_e.toLowerCase(),q.toString(),m)),R.push(tn(se,$.toLowerCase(),q.toString(),M.toString(),m))}if(!X(u.currency1)&&K>0n){let se=u.currency1.toLowerCase();R.push(e.approval(se,_e.toLowerCase(),K.toString(),m)),R.push(tn(se,$.toLowerCase(),K.toString(),M.toString(),m))}let H={currency0:u.currency0.toLowerCase(),currency1:u.currency1.toLowerCase(),fee:u.fee,tickSpacing:u.tickSpacing,hooks:u.hooks.toLowerCase()},Se=A(Un,[H,h,w,C,q,K,W.toLowerCase(),Z]),Pn=A(Kn,[H.currency0,H.currency1]),Ve=A(Nn,[k,W.toLowerCase()]),vn=A(we,[a??0n,C,q,K,Z]),An=a===void 0?A(de,["0x020d14",[Se,Pn,Ve]]):A(de,["0x00121214",[vn,A(Je,[H.currency0]),A(Je,[H.currency1]),Ve]]),xn=ne({abi:F,functionName:"modifyLiquidities",args:[An,re]}),Sn=X(u.currency0)?q.toString():"0";return R.push(e.unsignedTx({to:$.toLowerCase(),data:xn,value:Sn,chainId:m,description:a!==void 0?`Increase Uniswap v4 position #${a} on pool ${f} (liquidity +${C}).`:`Mint Uniswap v4 position on pool ${f} (ticks [${h}, ${w}], liquidity ${C}).`})),R})(ie,oe),O=await e.preview(Y,d),Fe=(q,K)=>{let R=X(K)?ae:K.toLowerCase();return-q.changes.filter(H=>H.token.address.toLowerCase()===R).reduce((H,Se)=>H+BigInt(Se.amount),0n)},ve=Fe(O,u.currency0),Ae=Fe(O,u.currency1);if(ve<0n||Ae<0n||ve>ie||Ae>oe||ve===0n&&Ae===0n&&a===void 0)throw new o("Invalid simulated v4 mint spend. Refresh the liquidity preview.");let hn=$e(O.changes,e.formatAmount),xe=nn(u,D);return{txs:Y,preview:O,poolId:f,poolKey:u,tickLower:h,tickUpper:w,liquidity:C.toString(),amount0Max:{token:b,amount:x.toString()},amount1Max:{token:I,amount:g.toString()},dynamicFee:xe.dynamicFee,swapsAreFree:xe.swapsAreFree,action:a!==void 0?"increase":P?"createAndMint":"mint",...a!==void 0?{tokenId:a.toString()}:{},...P?{poolCreated:!0,sqrtPriceX96:P.sqrtPriceX96.toString(),initialPrice:ye(P.sqrtPriceX96,b.decimals,I.decimals),initialTick:qe(P.sqrtPriceX96),priceCheck:P.note}:{},summary:`${a!==void 0?`Increase Uniswap v4 position #${a}`:P?"Create Uniswap v4 pool and add first liquidity":"Add Uniswap v4 liquidity"} (${C} L, ticks [${h}, ${w}]) on pool ${f}. Preview deltas: ${hn.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. ${xe.feeNote}${P?` ${P.note}`:""}`}}},{name:"uniswap_collect",inputSchema:Zn,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=U(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(m),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),y(l)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let f=await Me(p,t.deadline,t.now),u=t.amount0Min!==void 0?j(t.amount0Min,"amount0Min"):0n,h=t.amount1Min!==void 0?j(t.amount1Min,"amount1Min"):0n;if(u>J||h>J)throw new o("amount0Min and amount1Min must fit in uint128.");let w=typeof t.hookData=="string"?t.hookData:"0x",{poolKey:b,poolId:I}=await ge(p,a,t),[x,g]=await Promise.all([N(p,b.currency0,m),N(p,b.currency1,m)]),S=A(we,[a,0n,u,h,w]),v=A(Te,[b.currency0.toLowerCase(),b.currency1.toLowerCase(),l.toLowerCase()]),D=A(de,["0x0111",[S,v]]),P=ne({abi:F,functionName:"modifyLiquidities",args:[D,f]}),C=[e.unsignedTx({to:$.toLowerCase(),data:P,value:"0",chainId:m,description:`Collect Uniswap v4 fees from position #${a} to ${l}.`})],V=await e.preview(C,d),z=$e(V.changes,e.formatAmount);return{txs:C,preview:V,tokenId:a.toString(),poolId:I,recipient:l,currencies:[x,g],summary:`Collect Uniswap v4 fees for position #${a} (actions 0x0111). Preview deltas: ${z.join(", ")||"0"}.`}}},{name:"uniswap_remove",inputSchema:Yn,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=U(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(m),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),y(l)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let f=await Me(p,t.deadline,t.now),{poolKey:u,poolId:h}=await ge(p,a,t),[w,b]=await Promise.all([N(p,u.currency0,m),N(p,u.currency1,m)]),I=t.slippageBps??Ie;if(typeof I!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");Ce("0",I);let x=typeof t.hookData=="string"?t.hookData:"0x",g=t.fullExit===!0||t.burn===!0||t.liquidity==="all";if(!g&&t.liquidity===void 0)throw new o('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let S=t.liquidity===void 0||t.liquidity==="all"?void 0:j(t.liquidity,"liquidity");if(S!==void 0&&(S<0n||S===0n&&!g||S>J))throw new o("Provide positive liquidity within uint128 for v4 removal.");let v;try{v=BigInt(await p.readContract({address:$,abi:F,functionName:"getPositionLiquidity",args:[a]}))}catch(_){throw new o(`Could not read v4 position liquidity. ${ee(_)}`)}if(v<0n||v===0n&&!g||S!==void 0&&S>v)throw new o("Removal requires a nonempty position and cannot exceed its liquidity.");if(g&&S!==void 0&&S!==v)throw new o("A full burn must match the position liquidity; omit the amount when explicitly choosing all.");let D=g?"0x0311":"0x0111",P=(_,M,Z)=>{let me=g?A(Fn,[a,_,M,x]):A(we,[a,S,_,M,x]),Y=A(Te,[u.currency0,u.currency1,Z]);return e.unsignedTx({to:$.toLowerCase(),data:ne({abi:F,functionName:"modifyLiquidities",args:[A(de,[D,[me,Y]]),f]}),value:"0",chainId:m,description:`${g?"Burn and exit":"Decrease"} Uniswap v4 position #${a} (${D}).`})},C=0n,V=0n;if(v>0n&&(t.amount0Min===void 0||t.amount1Min===void 0)){let _=e.unsignedTx({to:$.toLowerCase(),data:ne({abi:F,functionName:"modifyLiquidities",args:[A(de,["0x0111",[A(we,[a,0n,0n,0n,x]),A(Te,[u.currency0,u.currency1,$])]]),f]}),value:"0",chainId:m,description:"Simulation only: separate fees from removal principal."}),M=await e.preview([_,P(2n,2n,d)],d),Z=me=>M.changes.reduce((Y,O)=>O.token.chainId===m&&O.token.address.toLowerCase()===me.address.toLowerCase()?Y+BigInt(O.amount):Y,0n);if(C=Z(w),V=Z(b),C<0n||V<0n)throw new o("Removal simulation did not return the expected currencies.")}let z=(_,M)=>{if(_!==void 0&&j(_,M)!==0n)throw new o(`${M} must be zero for an empty position burn.`);return 0n},ie=v===0n?z(t.amount0Min,"amount0Min"):cn(t.amount0Min,C,I,"amount0Min"),oe=v===0n?z(t.amount1Min,"amount1Min"):cn(t.amount1Min,V,I,"amount1Min"),W=[P(ie,oe,l)],G=await e.preview(W,d),re=$e(G.changes,e.formatAmount);return{txs:W,preview:G,action:D,tokenId:a.toString(),poolId:h,amount0Min:{token:w,amount:ie.toString()},amount1Min:{token:b,amount:oe.toString()},summary:`${g?"Full exit":"Partial remove"} Uniswap v4 position #${a} (${D})${g?`; burns position #${a} at ${$}`:""}. Preview deltas: ${re.join(", ")||"none"}.`}}},{name:"uniswap_list_positions",inputSchema:Qn,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?y(d):zn(t.wallet),f=await dn(e,l,{tokenIds:a,includeZero:p});return{version:"v4",positions:f,summary:`Found ${f.length} active Uniswap v4 position(s) for ${l}.`}}},{name:"uniswap_create_pool",inputSchema:Gn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');un(t);let a=e.clientFor(m),{poolId:p,poolKey:l}=await De(a,t),[f,u]=await Promise.all([N(a,l.currency0,m),N(a,l.currency1,m)]),h=await a.readContract({address:le,abi:pe,functionName:"getSlot0",args:[p]});if(BigInt(h[0])>0n)throw new o(`Uniswap v4 pool ${p} already exists. Use uniswap_add to provide liquidity.`);let w=ln(t,f.decimals,u.decimals),b=Le(w,await pn(a,l),t.acceptPriceDeviation===!0,f.decimals,u.decimals),I=ye(w,f.decimals,u.decimals),x=[fn(e,l,p,w,f,u)],g=await e.preview(x,d),S=nn(l,l.fee);return{txs:x,preview:g,poolId:p,poolKey:l,sqrtPriceX96:w.toString(),initialPrice:I,initialTick:qe(w),priceCheck:b,action:"createPool",summary:`${x[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add. ${S.feeNote} ${b}`}}}],positions:t=>dn(e,t)}),pt=et;export{Tn as a,$ as b,le as c,_e as d,lt as e,te as f,E as g,k as h,Ue as i,Ee as j,ke as k,Mn as l,Ke as m,Ne as n,wn as o,_n as p,En as q,X as r,fe as s,bn as t,nn as u,be as v,Bn as w,On as x,tn as y,Rn as z,gn as A,jn as B,$e as C,an as D,N as E,ge as F,dn as G,Wn as H,Gn as I,Zn as J,Yn as K,Qn as L,pn as M,et as N,pt as O};
@@ -1 +1 @@
1
- import{c as u,f as h}from"./C5ZZAYXD.js";import{i as g,j as k}from"./W6BS3T7S.js";import{d as p,f}from"./BTD5SMOW.js";import{q as m}from"./IY7BXLT4.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
1
+ import{q as m}from"./XL3LLGIR.js";import{c as u,f as h}from"./C5ZZAYXD.js";import{d as p,f}from"./OLSP46ZD.js";import{i as g,j as k}from"./KVFZKPJT.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
@@ -1 +1 @@
1
- import{a as ie,b as le,c as de,d as Z}from"./TX2EOIRS.js";import{a as E,b as Y}from"./MJ6WEWMI.js";import{c as ae}from"./VEQBHI6O.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as se,e as h,g,i as oe}from"./NWNYJ26T.js";import{a as v,i as ne,l as D,n as re}from"./FWD4L3CJ.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as M,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),ye=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),be=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,se)}function j(e,t,o){let r=e??t;if(typeof r!="number"||!Number.isInteger(r)||r<1||r>o)throw new T(`Choose a limit from 1 to ${o}.`);return r}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(r=>O(r,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([r])=>/^[A-Za-z0-9_]{1,40}$/.test(r)).slice(0,40).map(([r,d])=>[r,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function J(e,t,o){let r=e.clientFor(v),[d,a]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:o}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),r=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),s=e.clientFor(v),m=await s.getBlockNumber({cacheTime:0}),k=await E(e,o,m),i=await le(e,o),n=await s.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(re),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([J(e,o,n),s.readContract({address:o,abi:M,functionName:"totalSupply",blockNumber:n})]),W=c=>1+R.filter(y=>BigInt(y.balance)>BigInt(c)).length,B=async(c,y)=>{let F=await s.readContract({address:o,abi:M,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:y,indexedRank:y===null||_.has(c)?null:W(y),indexedShareOfSupply:y===null?null:Z(y,u.supply),shareOfSupply:Z(F.toString(),q.toString()),balance:{token:G,amount:F.toString()},matchesIndex:y===null?null:F.toString()===y}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=r?i.rows.find(c=>g(c.wallet,r)):void 0,H=r?{...await B(r,V?.balance??null),excluded:_.get(r)??null,rankStatus:_.has(r)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(y=>g(y.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(y=>g(y.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let r=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${r.toLowerCase()}?view=positions`,ve),s=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await E(e,u,s);let[w,_]=await Promise.all([J(e,u,s),a.readContract({address:u,abi:M,functionName:"balanceOf",args:[r],blockNumber:s})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:r,statusBlock:s.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),r=await U(e,`${x}/launches/trending`,Ae),d=r.items.filter(s=>g(s.launch.factory,D)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async s=>({status:await Y(e,f(s.launch.address),a),index:{volumeUsd:p(s.volumeUsd),trades:p(s.trades),traders:p(s.traders),change:p(s.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:r.items.length-r.items.filter(s=>g(s.launch.factory,D)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let r=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(r.series)?r.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(r.generatedAt),latestDay:p(r.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(r.today),earnings:O(r.earnings),indexer:O(r.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(r,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let r=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${r.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:r,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(s=>({kind:$(s.kind,24),block:p(s.block),time:p(s.time),tx:typeof s.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(s.tx)?s.tx:null,token:typeof s.token=="string"&&C.test(s.token)?f(s.token):null,symbol:$(s.symbol,24),amount:typeof s.amount=="string"&&ke.test(s.amount)?s.amount:null,decimals:p(s.decimals),usd:p(s.usd),counterparty:typeof s.counterparty=="string"&&C.test(s.counterparty)?f(s.counterparty):null,counterpartyLabel:$(s.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let r=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${r.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},s=await U(e,`${x}/launches?deployer=${r.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=s.items.filter(i=>g(i.factory,D)&&g(i.deployer,r)).slice(0,d);return{address:r,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let r=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),s=await E(e,r,l),m=ne[v].pons.buybackVault.address,k=[],i=async(b,K)=>{try{return await K()}catch{return k.push(b),null}},n=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),u=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),w=b=>i(b,()=>a.readContract({address:m,abi:ue,functionName:b,args:[r],blockNumber:l})),[_,R,G,q,W,B,A,V,H,c,y,F,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:s.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:r,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:D,abi:be,functionName:"pendingCreatorFeeRecipient",args:[r],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),J(e,r,l)]),S=b=>b===null?null:b.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:s.phase,statusBlock:l.toString(),curve:s.curve,creatorFeeRecipient:s.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(W),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((b,K)=>[b,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:s.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(y),vestingStart:S(F),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),r=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await E(e,o,a),s=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?s>=pe?s-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>s||s>a||s-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:ye,fromBlock:m,toBlock:s,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await J(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:s.toString(),statusBlock:a.toString(),truncated:i.length>r,total:i.length,trades:i.slice(0,r).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,r,d){return{name:o,inputSchema:{type:"object",properties:r,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let s of Object.keys(a))if(!(s in r))throw new T(`Unknown ${o} input: ${s}.`);return await d(a,l)}catch(s){throw new T(e.plainError(s))}}}}return{tools:[t("pons_holders",{token:P,holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:P,limit:{type:"integer",minimum:1,maximum:40}},(o,r)=>xe(e,o,r)),t("pons_trending",{limit:{type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:P,cursor:{type:"string",maxLength:32}},(o,r)=>Pe(e,o,r)),t("pons_launch_info",{token:P,holder:P},(o,r)=>_e(e,o,r)),t("pons_trades",{token:P,fromBlock:X(),toBlock:X(),limit:{type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:P,limit:{type:"integer",minimum:1,maximum:20}},(o,r)=>Ne(e,o,r))]}};export{O as a,xe as b,Le as c};
1
+ import{a as ie,b as le,c as de,d as Z}from"./TX2EOIRS.js";import{a as E,b as Y}from"./HQUVB7Z5.js";import{c as ae}from"./VEQBHI6O.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as se,e as h,g,i as oe}from"./NWNYJ26T.js";import{a as v,i as ne,l as D,n as re}from"./FWD4L3CJ.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as M,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),ye=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),be=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,se)}function j(e,t,o){let r=e??t;if(typeof r!="number"||!Number.isInteger(r)||r<1||r>o)throw new T(`Choose a limit from 1 to ${o}.`);return r}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(r=>O(r,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([r])=>/^[A-Za-z0-9_]{1,40}$/.test(r)).slice(0,40).map(([r,d])=>[r,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function J(e,t,o){let r=e.clientFor(v),[d,a]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:o}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),r=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),s=e.clientFor(v),m=await s.getBlockNumber({cacheTime:0}),k=await E(e,o,m),i=await le(e,o),n=await s.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(re),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([J(e,o,n),s.readContract({address:o,abi:M,functionName:"totalSupply",blockNumber:n})]),W=c=>1+R.filter(y=>BigInt(y.balance)>BigInt(c)).length,B=async(c,y)=>{let F=await s.readContract({address:o,abi:M,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:y,indexedRank:y===null||_.has(c)?null:W(y),indexedShareOfSupply:y===null?null:Z(y,u.supply),shareOfSupply:Z(F.toString(),q.toString()),balance:{token:G,amount:F.toString()},matchesIndex:y===null?null:F.toString()===y}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=r?i.rows.find(c=>g(c.wallet,r)):void 0,H=r?{...await B(r,V?.balance??null),excluded:_.get(r)??null,rankStatus:_.has(r)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(y=>g(y.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(y=>g(y.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let r=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${r.toLowerCase()}?view=positions`,ve),s=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await E(e,u,s);let[w,_]=await Promise.all([J(e,u,s),a.readContract({address:u,abi:M,functionName:"balanceOf",args:[r],blockNumber:s})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:r,statusBlock:s.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),r=await U(e,`${x}/launches/trending`,Ae),d=r.items.filter(s=>g(s.launch.factory,D)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async s=>({status:await Y(e,f(s.launch.address),a),index:{volumeUsd:p(s.volumeUsd),trades:p(s.trades),traders:p(s.traders),change:p(s.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:r.items.length-r.items.filter(s=>g(s.launch.factory,D)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let r=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(r.series)?r.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(r.generatedAt),latestDay:p(r.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(r.today),earnings:O(r.earnings),indexer:O(r.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(r,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let r=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${r.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:r,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(s=>({kind:$(s.kind,24),block:p(s.block),time:p(s.time),tx:typeof s.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(s.tx)?s.tx:null,token:typeof s.token=="string"&&C.test(s.token)?f(s.token):null,symbol:$(s.symbol,24),amount:typeof s.amount=="string"&&ke.test(s.amount)?s.amount:null,decimals:p(s.decimals),usd:p(s.usd),counterparty:typeof s.counterparty=="string"&&C.test(s.counterparty)?f(s.counterparty):null,counterpartyLabel:$(s.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let r=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${r.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},s=await U(e,`${x}/launches?deployer=${r.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=s.items.filter(i=>g(i.factory,D)&&g(i.deployer,r)).slice(0,d);return{address:r,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let r=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),s=await E(e,r,l),m=ne[v].pons.buybackVault.address,k=[],i=async(b,K)=>{try{return await K()}catch{return k.push(b),null}},n=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),u=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),w=b=>i(b,()=>a.readContract({address:m,abi:ue,functionName:b,args:[r],blockNumber:l})),[_,R,G,q,W,B,A,V,H,c,y,F,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:s.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:r,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:D,abi:be,functionName:"pendingCreatorFeeRecipient",args:[r],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),J(e,r,l)]),S=b=>b===null?null:b.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:s.phase,statusBlock:l.toString(),curve:s.curve,creatorFeeRecipient:s.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(W),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((b,K)=>[b,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:s.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(y),vestingStart:S(F),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),r=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await E(e,o,a),s=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?s>=pe?s-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>s||s>a||s-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:ye,fromBlock:m,toBlock:s,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await J(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:s.toString(),statusBlock:a.toString(),truncated:i.length>r,total:i.length,trades:i.slice(0,r).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,r,d){return{name:o,inputSchema:{type:"object",properties:r,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let s of Object.keys(a))if(!(s in r))throw new T(`Unknown ${o} input: ${s}.`);return await d(a,l)}catch(s){throw new T(e.plainError(s))}}}}return{tools:[t("pons_holders",{token:P,holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:P,limit:{type:"integer",minimum:1,maximum:40}},(o,r)=>xe(e,o,r)),t("pons_trending",{limit:{type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:P,cursor:{type:"string",maxLength:32}},(o,r)=>Pe(e,o,r)),t("pons_launch_info",{token:P,holder:P},(o,r)=>_e(e,o,r)),t("pons_trades",{token:P,fromBlock:X(),toBlock:X(),limit:{type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:P,limit:{type:"integer",minimum:1,maximum:20}},(o,r)=>Ne(e,o,r))]}};export{O as a,xe as b,Le as c};
@@ -1 +1 @@
1
- import{a as b,b as w,e as R,f as N,g as S}from"./T2WHOZXM.js";import{a as h}from"./66F5ZH34.js";import{c as g,g as E}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as v,erc20Abi as I,getAddress as _,parseAbi as O,zeroAddress as C}from"viem";var k=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),a=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=O(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),B={assets:{type:"array",minItems:1,maxItems:20,items:g},nonce:h(),maxResourceAmount:h()};function F(n){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:B},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(w);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=n.clientFor(d),e=await s.getBlockNumber(),[x,P,u,f]=await Promise.all([s.readContract({address:a,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(P),k)||x===C)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await R(n,w(x),e),T=await Promise.all(c.map(async l=>({token:await R(n,l,e),amount:(l===C?await s.getBalance({address:k,blockNumber:e}):await s.readContract({address:l,abi:I,functionName:"balanceOf",args:[k],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:T,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let J=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>J)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[n.approval(p.address,a,String(u),d),n.unsignedTx({to:a,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(n,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{k as a,a as b,o as c,F as d};
1
+ import{a as b,b as w,e as R,f as N,g as S}from"./PIIHOXWF.js";import{a as h}from"./66F5ZH34.js";import{c as g,g as E}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as v,erc20Abi as I,getAddress as _,parseAbi as O,zeroAddress as C}from"viem";var k=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),a=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=O(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),B={assets:{type:"array",minItems:1,maxItems:20,items:g},nonce:h(),maxResourceAmount:h()};function F(n){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:B},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(w);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=n.clientFor(d),e=await s.getBlockNumber(),[x,P,u,f]=await Promise.all([s.readContract({address:a,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(P),k)||x===C)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await R(n,w(x),e),T=await Promise.all(c.map(async l=>({token:await R(n,l,e),amount:(l===C?await s.getBalance({address:k,blockNumber:e}):await s.readContract({address:l,abi:I,functionName:"balanceOf",args:[k],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:T,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let J=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>J)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[n.approval(p.address,a,String(u),d),n.unsignedTx({to:a,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(n,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{k as a,a as b,o as c,F as d};
@@ -0,0 +1 @@
1
+ import{parseAbi as t}from"viem";var o=t(["function shieldBound(address asset,uint256 amount,bytes32 commitment,bytes proof) payable","function transfer(bytes proof,bytes32 root,bytes32 nullifier,bytes32[2] newCommitments)","function unshield(bytes proof,bytes32 root,bytes32 nullifier,address asset,address to,uint256 amount)"]),s=t(["function postMemo(bytes32 paymentCommitment,bytes memo)"]),n=t(["function approve(address spender,uint256 amount) returns (bool)"]);export{o as a,s as b,n as c};
@@ -0,0 +1,3 @@
1
+ import{d as F,e as M}from"./V5JWGWXC.js";import{a as y,b as x,c,e as $,h as L,j as S,k as O,l as U}from"./YWSX6IE6.js";import{a as N}from"./JFYBH3DX.js";import{c as H,d as R}from"./7QZOTRSA.js";import{a as r}from"./I6PQW2JI.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};