@oakagentkit/core 0.2.7 → 0.3.0

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 (462) hide show
  1. package/build/dist/api/addresses.d.ts +9 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/chain.d.ts +4 -0
  4. package/build/dist/api/chain.js +1 -1
  5. package/build/dist/api/history.js +1 -1
  6. package/build/dist/api/identity-link.js +1 -1
  7. package/build/dist/api/metadata.js +1 -1
  8. package/build/dist/api/modules/beefy/boosts.js +1 -1
  9. package/build/dist/api/modules/beefy/clm.js +1 -1
  10. package/build/dist/api/modules/beefy/guard.js +1 -1
  11. package/build/dist/api/modules/beefy/index.js +1 -1
  12. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  13. package/build/dist/api/modules/beefy/management.js +1 -1
  14. package/build/dist/api/modules/beefy/vaults.js +1 -1
  15. package/build/dist/api/modules/borro/abi.d.ts +54 -0
  16. package/build/dist/api/modules/borro/abi.js +1 -1
  17. package/build/dist/api/modules/borro/actions.d.ts +14 -1
  18. package/build/dist/api/modules/borro/actions.js +1 -1
  19. package/build/dist/api/modules/borro/checks.js +1 -1
  20. package/build/dist/api/modules/borro/copy.d.ts +10 -2
  21. package/build/dist/api/modules/borro/copy.js +1 -1
  22. package/build/dist/api/modules/borro/index.js +1 -1
  23. package/build/dist/api/modules/borro/liquidity.js +1 -1
  24. package/build/dist/api/modules/borro/pins.d.ts +30 -14
  25. package/build/dist/api/modules/borro/pins.js +1 -1
  26. package/build/dist/api/modules/borro/positions.js +1 -1
  27. package/build/dist/api/modules/borro/reader.js +1 -1
  28. package/build/dist/api/modules/borro/types.d.ts +1 -0
  29. package/build/dist/api/modules/chop/guard.js +1 -1
  30. package/build/dist/api/modules/chop/index.js +1 -1
  31. package/build/dist/api/modules/clanker/extensions.js +1 -1
  32. package/build/dist/api/modules/clanker/index.js +1 -1
  33. package/build/dist/api/modules/clanker/manage.js +1 -1
  34. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  35. package/build/dist/api/modules/clanker/protocol.js +1 -1
  36. package/build/dist/api/modules/clanker/state.js +1 -1
  37. package/build/dist/api/modules/earn/copy.d.ts +6 -6
  38. package/build/dist/api/modules/earn/copy.js +1 -1
  39. package/build/dist/api/modules/earn/cost.d.ts +1 -1
  40. package/build/dist/api/modules/earn/cost.js +1 -1
  41. package/build/dist/api/modules/earn/index.js +1 -1
  42. package/build/dist/api/modules/earn/lp.js +1 -1
  43. package/build/dist/api/modules/earn/options.js +1 -1
  44. package/build/dist/api/modules/erc8004/common.js +1 -1
  45. package/build/dist/api/modules/erc8004/domain.js +1 -1
  46. package/build/dist/api/modules/erc8004/index.js +1 -1
  47. package/build/dist/api/modules/erc8004/management.js +1 -1
  48. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  49. package/build/dist/api/modules/erc8004/services.js +1 -1
  50. package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
  51. package/build/dist/api/modules/erc8004/thesis.js +1 -0
  52. package/build/dist/api/modules/erc8004/validation.js +1 -1
  53. package/build/dist/api/modules/gloam/index.js +1 -1
  54. package/build/dist/api/modules/grove/index.js +1 -1
  55. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  56. package/build/dist/api/modules/heyresearch/index.js +1 -1
  57. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  58. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  59. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  60. package/build/dist/api/modules/hoodag/index.d.ts +12 -1
  61. package/build/dist/api/modules/hoodag/index.js +1 -1
  62. package/build/dist/api/modules/hoodag/management.js +1 -1
  63. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  64. package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
  65. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  66. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  67. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  68. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  69. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  70. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  71. package/build/dist/api/modules/hoodlock/index.js +1 -1
  72. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  73. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  74. package/build/dist/api/modules/hoodlock/public.js +1 -1
  75. package/build/dist/api/modules/hookr/actions.js +1 -1
  76. package/build/dist/api/modules/hookr/addons.js +1 -1
  77. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  78. package/build/dist/api/modules/hookr/contracts.js +1 -1
  79. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  80. package/build/dist/api/modules/hookr/discovery.js +1 -1
  81. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  82. package/build/dist/api/modules/hookr/index.js +1 -1
  83. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  84. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  85. package/build/dist/api/modules/hookr/launch.js +1 -1
  86. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  87. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  88. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  89. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  90. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  91. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  92. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  93. package/build/dist/api/modules/hookr/relay.js +1 -1
  94. package/build/dist/api/modules/hookr/revenue.js +1 -1
  95. package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
  96. package/build/dist/api/modules/kyberswap/index.js +1 -1
  97. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  98. package/build/dist/api/modules/layerbank/abi.js +1 -1
  99. package/build/dist/api/modules/layerbank/actions.js +1 -1
  100. package/build/dist/api/modules/layerbank/checks.js +1 -1
  101. package/build/dist/api/modules/layerbank/index.js +1 -1
  102. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  103. package/build/dist/api/modules/layerbank/reader.js +1 -1
  104. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  105. package/build/dist/api/modules/lighter/index.js +1 -1
  106. package/build/dist/api/modules/longbow/administration.js +1 -1
  107. package/build/dist/api/modules/longbow/analytics.js +1 -1
  108. package/build/dist/api/modules/longbow/fixed.js +1 -1
  109. package/build/dist/api/modules/longbow/index.js +1 -1
  110. package/build/dist/api/modules/longbow/nft.js +1 -1
  111. package/build/dist/api/modules/longbow/rebates.js +1 -1
  112. package/build/dist/api/modules/longbow/staking.js +1 -1
  113. package/build/dist/api/modules/meridian/index.js +1 -1
  114. package/build/dist/api/modules/meridian/markets.js +1 -1
  115. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  116. package/build/dist/api/modules/meridian/rfq.js +1 -1
  117. package/build/dist/api/modules/merkl/discovery.js +1 -1
  118. package/build/dist/api/modules/merkl/index.js +1 -1
  119. package/build/dist/api/modules/merkl/manage.js +1 -1
  120. package/build/dist/api/modules/merkl/protocol.js +1 -1
  121. package/build/dist/api/modules/morpho/allocator.js +1 -1
  122. package/build/dist/api/modules/morpho/bundles.js +1 -1
  123. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  124. package/build/dist/api/modules/morpho/index.js +1 -1
  125. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  126. package/build/dist/api/modules/morpho/midnight.js +1 -1
  127. package/build/dist/api/modules/morpho/protocol.js +1 -1
  128. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  129. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  130. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  131. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  132. package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
  133. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  134. package/build/dist/api/modules/netnet/card-read.js +1 -1
  135. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  136. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  137. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  138. package/build/dist/api/modules/netnet/financial.js +1 -1
  139. package/build/dist/api/modules/netnet/index.js +1 -1
  140. package/build/dist/api/modules/netnet/staking.js +1 -1
  141. package/build/dist/api/modules/orbio/index.d.ts +6 -0
  142. package/build/dist/api/modules/orbio/index.js +1 -1
  143. package/build/dist/api/modules/orbio/positions.js +1 -1
  144. package/build/dist/api/modules/pendle/costs.js +1 -1
  145. package/build/dist/api/modules/pendle/index.js +1 -1
  146. package/build/dist/api/modules/pendle/markets.js +1 -1
  147. package/build/dist/api/modules/pendle/positions.js +1 -1
  148. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  149. package/build/dist/api/modules/pendle/reader.js +1 -1
  150. package/build/dist/api/modules/pendle/redeem.js +1 -1
  151. package/build/dist/api/modules/pendle/trade.js +1 -1
  152. package/build/dist/api/modules/pendle/validate.js +1 -1
  153. package/build/dist/api/modules/pendle/verify.js +1 -1
  154. package/build/dist/api/modules/pons/claim.js +1 -1
  155. package/build/dist/api/modules/pons/index.js +1 -1
  156. package/build/dist/api/modules/pons/launch-status.js +1 -1
  157. package/build/dist/api/modules/pons/prices.js +1 -1
  158. package/build/dist/api/modules/pons/reads.js +1 -1
  159. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  160. package/build/dist/api/modules/pons/trade.js +1 -1
  161. package/build/dist/api/modules/poolstrade/index.js +1 -1
  162. package/build/dist/api/modules/priors/coverage.js +1 -1
  163. package/build/dist/api/modules/priors/discovery.js +1 -1
  164. package/build/dist/api/modules/priors/features.js +1 -1
  165. package/build/dist/api/modules/priors/holdings.js +1 -1
  166. package/build/dist/api/modules/priors/index.js +1 -1
  167. package/build/dist/api/modules/priors/integration.js +1 -1
  168. package/build/dist/api/modules/priors/market.js +1 -1
  169. package/build/dist/api/modules/priors/pt.js +1 -1
  170. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  171. package/build/dist/api/modules/priors/starter-line.js +1 -1
  172. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  173. package/build/dist/api/modules/raeto/index.js +1 -1
  174. package/build/dist/api/modules/relay/api.js +1 -1
  175. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  176. package/build/dist/api/modules/relay/discovery.js +1 -1
  177. package/build/dist/api/modules/relay/inbound.js +1 -1
  178. package/build/dist/api/modules/relay/index.js +1 -1
  179. package/build/dist/api/modules/relay/order.js +1 -1
  180. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  181. package/build/dist/api/modules/relay/readiness.js +1 -1
  182. package/build/dist/api/modules/relay/reads.js +1 -1
  183. package/build/dist/api/modules/relay/vaults.js +1 -1
  184. package/build/dist/api/modules/spark/actions.js +1 -1
  185. package/build/dist/api/modules/spark/details.js +1 -1
  186. package/build/dist/api/modules/spark/index.js +1 -1
  187. package/build/dist/api/modules/spark/management.js +1 -1
  188. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  189. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  190. package/build/dist/api/modules/steakhouse/index.js +1 -1
  191. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  192. package/build/dist/api/modules/steakhouse/management.js +1 -1
  193. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  194. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  195. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  196. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  197. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  198. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  199. package/build/dist/api/modules/tickerspring/index.js +1 -1
  200. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  201. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  202. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  203. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  204. package/build/dist/api/modules/tickerspring/research.js +1 -1
  205. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  206. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  207. package/build/dist/api/modules/uniswap/auction.js +1 -1
  208. package/build/dist/api/modules/uniswap/batch.js +1 -1
  209. package/build/dist/api/modules/uniswap/common.js +1 -1
  210. package/build/dist/api/modules/uniswap/fees.js +1 -1
  211. package/build/dist/api/modules/uniswap/index.js +1 -1
  212. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  213. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  214. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  215. package/build/dist/api/modules/uniswap/pools.js +1 -1
  216. package/build/dist/api/modules/uniswap/position.js +1 -1
  217. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  218. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  219. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  220. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  221. package/build/dist/api/modules/uniswap/trade.js +1 -1
  222. package/build/dist/api/modules/uniswap/v2.js +1 -1
  223. package/build/dist/api/modules/uniswap/v3.js +1 -1
  224. package/build/dist/api/modules/uniswap/v4.js +1 -1
  225. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  226. package/build/dist/api/modules/upoch/copy.d.ts +5 -0
  227. package/build/dist/api/modules/upoch/copy.js +1 -0
  228. package/build/dist/api/modules/upoch/index.d.ts +8 -0
  229. package/build/dist/api/modules/upoch/index.js +1 -0
  230. package/build/dist/api/modules/upoch/pins.d.ts +8 -0
  231. package/build/dist/api/modules/upoch/pins.js +1 -0
  232. package/build/dist/api/modules/upoch/reads.d.ts +509 -0
  233. package/build/dist/api/modules/upoch/reads.js +1 -0
  234. package/build/dist/api/modules/velora/claims.js +1 -1
  235. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  236. package/build/dist/api/modules/velora/index.js +1 -1
  237. package/build/dist/api/modules/wormhole/index.js +1 -1
  238. package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
  239. package/build/dist/api/modules/wormhole/x402-client.js +1 -1
  240. package/build/dist/api/positions.js +1 -1
  241. package/build/dist/api/pricenote.js +1 -1
  242. package/build/dist/api/prices.js +1 -1
  243. package/build/dist/api/pricing.js +1 -1
  244. package/build/dist/api/rpc.js +1 -1
  245. package/build/dist/api/secret-fields.d.ts +2 -0
  246. package/build/dist/api/secret-fields.js +1 -1
  247. package/build/dist/api/send.js +1 -1
  248. package/build/dist/api/signing-registry.js +1 -1
  249. package/build/dist/api/signing.js +1 -1
  250. package/build/dist/api/simulate.js +1 -1
  251. package/build/dist/api/swap.js +1 -1
  252. package/build/dist/api/tokens.js +1 -1
  253. package/build/dist/api/tool-policy.d.ts +1 -0
  254. package/build/dist/api/tool-policy.js +1 -1
  255. package/build/dist/api/usd-estimate.js +1 -1
  256. package/build/dist/chunks/23HNDJ76.js +2 -0
  257. package/build/dist/chunks/{JS53DQVT.js → 24Q3FNGX.js} +1 -1
  258. package/build/dist/chunks/{N245WC5R.js → 25C4DTVA.js} +1 -1
  259. package/build/dist/chunks/{PV4AK32X.js → 2HN3U6OG.js} +1 -1
  260. package/build/dist/chunks/{GQYV4TFO.js → 2OVJ2BTJ.js} +1 -1
  261. package/build/dist/chunks/{DYYEA5HB.js → 2QGLPY2D.js} +1 -1
  262. package/build/dist/chunks/{ZFU65MB4.js → 2WRXH6BL.js} +1 -1
  263. package/build/dist/chunks/{EZZM2GQT.js → 2ZBSE2LD.js} +1 -1
  264. package/build/dist/chunks/{HIX5N25Z.js → 2ZQ7X223.js} +1 -1
  265. package/build/dist/chunks/{V37L4DU4.js → 3A2IKFTV.js} +1 -1
  266. package/build/dist/chunks/{FWIFTPSE.js → 3PU2SD3U.js} +1 -1
  267. package/build/dist/chunks/{SBY4RJ7I.js → 3ZH5SOC2.js} +1 -1
  268. package/build/dist/chunks/4NBXBKOX.js +2 -0
  269. package/build/dist/chunks/{FOKEFXGP.js → 4PLLS6CT.js} +1 -1
  270. package/build/dist/chunks/{KREBNL2D.js → 4R3G3H42.js} +1 -1
  271. package/build/dist/chunks/{XHYFISVV.js → 4Z3IGMU6.js} +1 -1
  272. package/build/dist/chunks/{CSDN4MYP.js → 5GQJVKVY.js} +1 -1
  273. package/build/dist/chunks/{JOKL5L6X.js → 5R576SDB.js} +1 -1
  274. package/build/dist/chunks/{UUID2E22.js → 5W74Z4WZ.js} +1 -1
  275. package/build/dist/chunks/{EH5G4O3U.js → 65356YKW.js} +1 -1
  276. package/build/dist/chunks/{QFSBDPLN.js → 65OITTDL.js} +1 -1
  277. package/build/dist/chunks/{DSTMEY5F.js → 6F527FLN.js} +1 -1
  278. package/build/dist/chunks/{CO4GCF4L.js → 6MDYKE2O.js} +1 -1
  279. package/build/dist/chunks/{IEG6GLFR.js → 6OCLWSMZ.js} +1 -1
  280. package/build/dist/chunks/75SULXNT.js +1 -0
  281. package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
  282. package/build/dist/chunks/{AMTRDPVO.js → 7U62MMUQ.js} +1 -1
  283. package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
  284. package/build/dist/chunks/{XVJ7ILKK.js → A2V4NFVA.js} +1 -1
  285. package/build/dist/chunks/A3BJSQ23.js +1 -0
  286. package/build/dist/chunks/{YSMWCKIX.js → ADIPEGNN.js} +1 -1
  287. package/build/dist/chunks/ANIF3JMV.js +4 -0
  288. package/build/dist/chunks/{RLI4JDOL.js → ATEVAJ5Y.js} +1 -1
  289. package/build/dist/chunks/{F3VDVTMS.js → B2HSLY5F.js} +1 -1
  290. package/build/dist/chunks/{N4XNNXOJ.js → B7BNDW35.js} +1 -1
  291. package/build/dist/chunks/{GLF7WEY2.js → C6VJAL5B.js} +1 -1
  292. package/build/dist/chunks/{5PI57UC2.js → C76D54YG.js} +1 -1
  293. package/build/dist/chunks/{GRSXWQWD.js → CD2JQ32C.js} +1 -1
  294. package/build/dist/chunks/{4GNUXN4K.js → CI5ENLYA.js} +1 -1
  295. package/build/dist/chunks/{F4UQEPJT.js → CZQ2CGYV.js} +1 -1
  296. package/build/dist/chunks/{APHNOGNS.js → D2IYA4LP.js} +1 -1
  297. package/build/dist/chunks/{4RQAOOO2.js → D7QXZM3S.js} +1 -1
  298. package/build/dist/chunks/{TDZTC5WR.js → DBOGRUPS.js} +1 -1
  299. package/build/dist/chunks/{Y77EVVT4.js → DGDMRATN.js} +1 -1
  300. package/build/dist/chunks/{3DNJTJ2X.js → DMB64UIN.js} +1 -1
  301. package/build/dist/chunks/{TM7Z5SA4.js → DMDOSHV7.js} +1 -1
  302. package/build/dist/chunks/{WHVZ372B.js → DRLBTB4E.js} +1 -1
  303. package/build/dist/chunks/{FZ6IJZZM.js → E76Z2TT4.js} +1 -1
  304. package/build/dist/chunks/{C75MT5SD.js → EHK7CDTU.js} +1 -1
  305. package/build/dist/chunks/{KKPMOAVI.js → ELHRXA5U.js} +1 -1
  306. package/build/dist/chunks/{XCKTE4ON.js → F7MGYRPU.js} +1 -1
  307. package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
  308. package/build/dist/chunks/{M7ZXDLKM.js → FGEGJOAA.js} +1 -1
  309. package/build/dist/chunks/{N6GIC7HJ.js → FN6GNTPR.js} +1 -1
  310. package/build/dist/chunks/{ZF2VPDRQ.js → FTMA24EC.js} +1 -1
  311. package/build/dist/chunks/FXOFR432.js +1 -0
  312. package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
  313. package/build/dist/chunks/{JWR5XVP2.js → GBIBRYOV.js} +1 -1
  314. package/build/dist/chunks/{FNGIJKMZ.js → GDOHHXNH.js} +1 -1
  315. package/build/dist/chunks/{LR4XTZ37.js → GP6YO24Z.js} +1 -1
  316. package/build/dist/chunks/{2OKYXT25.js → GQITAJVF.js} +1 -1
  317. package/build/dist/chunks/H3E7UD2X.js +1 -0
  318. package/build/dist/chunks/HFVXNKA5.js +1 -0
  319. package/build/dist/chunks/HHYE42JG.js +21 -0
  320. package/build/dist/chunks/{UOCRYXAB.js → HRAHGYNK.js} +1 -1
  321. package/build/dist/chunks/{U363GQTF.js → HS5HWBMU.js} +1 -1
  322. package/build/dist/chunks/{ARI72OYT.js → HVFMIURK.js} +1 -1
  323. package/build/dist/chunks/IBL6TL2Q.js +1 -0
  324. package/build/dist/chunks/{HCBX4NFM.js → IT2JLILU.js} +1 -1
  325. package/build/dist/chunks/{REWXG6X6.js → JDSSYT6R.js} +1 -1
  326. package/build/dist/chunks/{XRDXFHIK.js → JFWJBZ7M.js} +1 -1
  327. package/build/dist/chunks/{523ZIR3J.js → JI5DXDMY.js} +1 -1
  328. package/build/dist/chunks/{7QKYDNF6.js → JPPQDELB.js} +1 -1
  329. package/build/dist/chunks/{ZP36DSOD.js → K4P5VYDP.js} +1 -1
  330. package/build/dist/chunks/{32RXFUOH.js → KBU3PYP7.js} +1 -1
  331. package/build/dist/chunks/{BB765L75.js → KH4QFN72.js} +1 -1
  332. package/build/dist/chunks/{YTLH4M4Y.js → KMSAUFYV.js} +1 -1
  333. package/build/dist/chunks/{6UVGQYZ3.js → KOTGFD2V.js} +1 -1
  334. package/build/dist/chunks/{4JTTA3BX.js → KZA5GYZR.js} +1 -1
  335. package/build/dist/chunks/{WUT7TZYM.js → LCH6F5HT.js} +1 -1
  336. package/build/dist/chunks/{ARLGF5MU.js → LDJI2JAL.js} +1 -1
  337. package/build/dist/chunks/LEV5SNNC.js +3 -0
  338. package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
  339. package/build/dist/chunks/{J73ATSEQ.js → LJJYYUEG.js} +1 -1
  340. package/build/dist/chunks/{CAWTAR5V.js → LKX5WDOQ.js} +1 -1
  341. package/build/dist/chunks/M7BUKZW2.js +1 -0
  342. package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
  343. package/build/dist/chunks/{YWZQJJYY.js → MMCM3GSM.js} +1 -1
  344. package/build/dist/chunks/MQ5F2VOK.js +1 -0
  345. package/build/dist/chunks/{TE6D3OIX.js → MSMHS456.js} +1 -1
  346. package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
  347. package/build/dist/chunks/{YMV5TL5C.js → N64JJN37.js} +1 -1
  348. package/build/dist/chunks/{JKRBGAX2.js → NAO7VWZF.js} +1 -1
  349. package/build/dist/chunks/ND32LJWI.js +1 -0
  350. package/build/dist/chunks/{RT7IU6TI.js → NMJVQX5M.js} +1 -1
  351. package/build/dist/chunks/{67BWOVET.js → NMQBOBWJ.js} +1 -1
  352. package/build/dist/chunks/NQ4MTIU3.js +1 -0
  353. package/build/dist/chunks/{XWKK75TO.js → NWPAQER2.js} +1 -1
  354. package/build/dist/chunks/O2J5I4VA.js +1 -0
  355. package/build/dist/chunks/{2SUHQWND.js → O4S6XAYV.js} +1 -1
  356. package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
  357. package/build/dist/chunks/{NA424YAL.js → OB7BFDOV.js} +1 -1
  358. package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
  359. package/build/dist/chunks/{FL5SSHUL.js → OIQTZOBN.js} +1 -1
  360. package/build/dist/chunks/{XPEDQBLI.js → OODSXDIH.js} +1 -1
  361. package/build/dist/chunks/OOPMZIG7.js +1 -0
  362. package/build/dist/chunks/{GG24LO2R.js → OQFNUDMQ.js} +1 -1
  363. package/build/dist/chunks/{Q2ACLVWR.js → ORG6LVKJ.js} +1 -1
  364. package/build/dist/chunks/{XYPGLG6A.js → OSMOBKRQ.js} +1 -1
  365. package/build/dist/chunks/{EGZREEG2.js → OTLUQWLF.js} +1 -1
  366. package/build/dist/chunks/{OYJFXEDU.js → OTYB6BHK.js} +1 -1
  367. package/build/dist/chunks/{OZ5MDUD2.js → OVM4QIET.js} +1 -1
  368. package/build/dist/chunks/{OYPAVXGQ.js → OYDKAIS2.js} +1 -1
  369. package/build/dist/chunks/P6OB2AFW.js +1 -0
  370. package/build/dist/chunks/{UQEEF5W5.js → PDPTJMTJ.js} +1 -1
  371. package/build/dist/chunks/PEHXHQVA.js +1 -0
  372. package/build/dist/chunks/PMFR47H3.js +1 -0
  373. package/build/dist/chunks/{HHO5ISMM.js → PQXYTOV5.js} +1 -1
  374. package/build/dist/chunks/{HKVQ646Q.js → PSGRZWES.js} +1 -1
  375. package/build/dist/chunks/Q7L3BX6U.js +1 -0
  376. package/build/dist/chunks/{753HZZTY.js → QBYV7NXH.js} +1 -1
  377. package/build/dist/chunks/{2LWBN35N.js → QIB6OMQV.js} +1 -1
  378. package/build/dist/chunks/{TPEKCXVE.js → QLAOBULN.js} +1 -1
  379. package/build/dist/chunks/{DNNFKDZR.js → QLFPAN6S.js} +1 -1
  380. package/build/dist/chunks/QMEGAKLI.js +1 -0
  381. package/build/dist/chunks/{TK55VASJ.js → QMNUB2GM.js} +1 -1
  382. package/build/dist/chunks/{YUHNPUNK.js → R73R4KN3.js} +1 -1
  383. package/build/dist/chunks/{VR344DAZ.js → RN3WUJIO.js} +1 -1
  384. package/build/dist/chunks/{5HIHUYA4.js → RNCMXKKS.js} +1 -1
  385. package/build/dist/chunks/{ZOMFHTB2.js → ROQQ62LP.js} +1 -1
  386. package/build/dist/chunks/{D742AYEV.js → RUTSEGGD.js} +1 -1
  387. package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
  388. package/build/dist/chunks/{KDGSYNOP.js → S4UJDZGN.js} +1 -1
  389. package/build/dist/chunks/{AI3VAPA3.js → SMSXZ3FN.js} +1 -1
  390. package/build/dist/chunks/{JLRHM2DQ.js → SUNTJ6IU.js} +1 -1
  391. package/build/dist/chunks/{2FHELZ7Y.js → TGFQQCRY.js} +1 -1
  392. package/build/dist/chunks/{4JRXEN7C.js → THL4TMQW.js} +2 -2
  393. package/build/dist/chunks/TI727O2H.js +1 -0
  394. package/build/dist/chunks/{RLMVA575.js → TMRAF2L2.js} +1 -1
  395. package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
  396. package/build/dist/chunks/U243AWCH.js +1 -0
  397. package/build/dist/chunks/U762746N.js +1 -0
  398. package/build/dist/chunks/{GDRQ2ANN.js → U7UPLF4F.js} +1 -1
  399. package/build/dist/chunks/{4Q2ZBZXM.js → UPKVD7WG.js} +1 -1
  400. package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
  401. package/build/dist/chunks/{VTPT5544.js → USEF3QKG.js} +1 -1
  402. package/build/dist/chunks/{U2YCQWZK.js → UVAR6BHU.js} +1 -1
  403. package/build/dist/chunks/{7VC53B5X.js → V5YSJKRH.js} +13 -13
  404. package/build/dist/chunks/{7D73A6KS.js → VB36EHIR.js} +1 -1
  405. package/build/dist/chunks/VMZYFO6I.js +1 -0
  406. package/build/dist/chunks/{UEDGYZOC.js → VVAM3EAK.js} +1 -1
  407. package/build/dist/chunks/VVJO6OYK.js +1 -0
  408. package/build/dist/chunks/{JESMX2UC.js → VXCGMALF.js} +1 -1
  409. package/build/dist/chunks/{ZKZUS3QU.js → VZVW5J7J.js} +1 -1
  410. package/build/dist/chunks/{NUFZUKYS.js → W32UECOL.js} +1 -1
  411. package/build/dist/chunks/{O3JWCJIF.js → W4RYRLL5.js} +1 -1
  412. package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
  413. package/build/dist/chunks/{BAIY32AV.js → WBNFRPAT.js} +1 -1
  414. package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
  415. package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
  416. package/build/dist/chunks/{L646YWDP.js → X24YTJST.js} +1 -1
  417. package/build/dist/chunks/{4FPV4CRC.js → X5AL3DUK.js} +1 -1
  418. package/build/dist/chunks/{SOTYQGPT.js → XBNZ7GTY.js} +1 -1
  419. package/build/dist/chunks/{BZ34ZR65.js → XEBMS5KU.js} +1 -1
  420. package/build/dist/chunks/{FOD34G2H.js → XL3W7DAQ.js} +1 -1
  421. package/build/dist/chunks/{GSFHM5L3.js → XPWGPZ2C.js} +1 -1
  422. package/build/dist/chunks/{2E4I7CJ7.js → XRDLMTBJ.js} +1 -1
  423. package/build/dist/chunks/{SKEKXEUU.js → XV3YJ4P6.js} +1 -1
  424. package/build/dist/chunks/XW3VGWXK.js +1 -0
  425. package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
  426. package/build/dist/chunks/Y64GFBTA.js +1 -0
  427. package/build/dist/chunks/{FJLJ7ZQ5.js → YARZE7SJ.js} +1 -1
  428. package/build/dist/chunks/{OARVU3RC.js → YBLJ75U5.js} +1 -1
  429. package/build/dist/chunks/YRSAZTTC.js +7 -0
  430. package/build/dist/chunks/{3VBIRLU3.js → YXXK6EPI.js} +1 -1
  431. package/build/dist/chunks/Z3IBPCY4.js +2 -0
  432. package/build/dist/chunks/{H5DY7CNB.js → Z7FGEWO2.js} +1 -1
  433. package/build/dist/chunks/{INOYMBWE.js → ZNPVBNC5.js} +1 -1
  434. package/build/dist/chunks/{EVBHQQQG.js → ZTKT3ZQK.js} +1 -1
  435. package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
  436. package/package.json +1 -1
  437. package/build/dist/chunks/3K2N5VFH.js +0 -1
  438. package/build/dist/chunks/3ZABD6ZF.js +0 -2
  439. package/build/dist/chunks/44MB6SA6.js +0 -1
  440. package/build/dist/chunks/4D4ZRZUW.js +0 -1
  441. package/build/dist/chunks/4OVIMYNH.js +0 -2
  442. package/build/dist/chunks/6NUNCD5J.js +0 -1
  443. package/build/dist/chunks/6PZGDVHV.js +0 -1
  444. package/build/dist/chunks/7MBVTNLU.js +0 -1
  445. package/build/dist/chunks/7VNO46LV.js +0 -1
  446. package/build/dist/chunks/DPE7SPW7.js +0 -1
  447. package/build/dist/chunks/E3RACZUY.js +0 -1
  448. package/build/dist/chunks/EI6GGPDS.js +0 -20
  449. package/build/dist/chunks/FV4WZOTD.js +0 -1
  450. package/build/dist/chunks/FWD4L3CJ.js +0 -1
  451. package/build/dist/chunks/JBTOZ6IH.js +0 -1
  452. package/build/dist/chunks/MVD3KWPP.js +0 -1
  453. package/build/dist/chunks/P6OMKZMR.js +0 -3
  454. package/build/dist/chunks/PXVREXCS.js +0 -1
  455. package/build/dist/chunks/QJNLLI6N.js +0 -1
  456. package/build/dist/chunks/RPB46QAC.js +0 -1
  457. package/build/dist/chunks/TID4C2KC.js +0 -1
  458. package/build/dist/chunks/UWBKAWX3.js +0 -7
  459. package/build/dist/chunks/WHTRPRRD.js +0 -1
  460. package/build/dist/chunks/WLMWWEP7.js +0 -2
  461. package/build/dist/chunks/XQ24RSEI.js +0 -1
  462. package/build/dist/chunks/YDNTY67T.js +0 -1
@@ -1 +1 @@
1
- import{b as H,c as N}from"./NUFZUKYS.js";import{a as S}from"./LT5P6PZW.js";import{a as O}from"./G2LAO23N.js";import{a as D}from"./H5DY7CNB.js";import{a as C}from"./66F5ZH34.js";import{c as _,f as I}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as x,erc20Abi as L,getAddress as c,parseAbi as q,zeroAddress as M}from"viem";var k={timeShares:{factory:"timeFactory",abi:[{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ASSETS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"FOREVER",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_AMOUNT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DIVISOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"minLockAmount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"MIN_TIP_GROWTH",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ISSUE_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_CLAIM_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"currencyAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"address"}]},{name:"lockedTotal",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pendingLocks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"amount"},{type:"uint256",name:"tick"},{type:"uint256",name:"firstLock"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"heldAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},{name:"lockEpochs",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"uint256",name:"joinEpoch"},{type:"uint256",name:"leaveEpoch"}]},{name:"sweepable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"from"},{type:"uint256",name:"max"}],outputs:[{type:"uint256[]",name:"ids"},{type:"uint256",name:"next"}]},{name:"lockCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"lockAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"tuple",components:[{type:"address",name:"owner"},{type:"uint64",name:"lockedAt"},{type:"uint32",name:"firstDay"},{type:"uint128",name:"amount"},{type:"uint32",name:"lastDay"},{type:"uint64",name:"unlockedAt"}]}]},{name:"isIssued",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"}],outputs:[{type:"bool"}]},{name:"unitSupply",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"}],outputs:[{type:"uint256"}]},{name:"currentDay",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"k"}],outputs:[{type:"uint64",name:"timestamp"},{type:"uint256[]",name:"indexes"}]},{name:"index",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"carry",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"pulled",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"paid",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"held",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"dayIndex",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"holder"},{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lockClaimable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"uint32",name:"numberOfDays"}],outputs:[{type:"uint256",name:"lockId"}]},{name:"issue",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"},{type:"address",name:"to"}],outputs:[]},{name:"issueRange",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"firstDay"},{type:"uint256",name:"lastDay"},{type:"address",name:"to"}],outputs:[]},{name:"unlock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"address",name:"to"}],outputs:[]},{name:"syncAssets",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"catchUp",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"max"}],outputs:[{type:"bool",name:"done"}]},{name:"settle",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"roll",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"sweepDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"},{type:"uint256",name:"claimGas"}],outputs:[{type:"uint256[]",name:"amounts"}]},{name:"claim",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimMany",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"days_"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimLock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"receiver"},{type:"uint256",name:"id"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},dayWrapper:{factory:"wrapperFactory",abi:[{name:"shares",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"day",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"basket",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"previewRedeem",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"amount"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"deposit",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"redeemShort",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"owedTo",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimOwed",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[]},{name:"collect",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},compounder:{factory:"compoundFactory",abi:[{name:"MIN_SHARES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BANDS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BAND_TICKS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ADD_GAS_FLOOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_DRIFT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_PERIOD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_TOLERANCE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"DROP_SCAN",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DROP_CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"parked",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"dropId"}],outputs:[{type:"bool"}]},{name:"syncSides",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"count"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolManager",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolId",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{name:"poolKey",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"currency0"},{type:"address",name:"currency1"},{type:"uint24",name:"fee"},{type:"int24",name:"tickSpacing"},{type:"address",name:"hooks"}]}]},{name:"quote",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tokenIsCurrency0",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bool"}]},{name:"bandTicks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint128"}]},{name:"reserve",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"bands",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple[]",components:[{type:"int24",name:"tickLower"},{type:"int24",name:"tickUpper"},{type:"uint128",name:"liquidity"}]}]},{name:"anchor",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"int24",name:"high"},{type:"int24",name:"low"},{type:"uint40",name:"lookedAt"}]}]},{name:"creator",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"holdings",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"deposit",type:"function",stateMutability:"payable",inputs:[{type:"uint256",name:"tokensMax"},{type:"uint256",name:"quoteMax"},{type:"address",name:"to"},{type:"uint256",name:"minShares"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"shares"},{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeemUnlocked",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"poke",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"claimDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"}],outputs:[{type:"uint256",name:"tip"}]},{name:"listSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"asset"}],outputs:[{type:"uint256",name:"side"}]},{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_SIDES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"SIDE_READ_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DEAD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"sideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"fixedSideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"side"}],outputs:[{type:"tuple",components:[{type:"address",name:"currency"},{type:"uint256",name:"index"},{type:"uint256",name:"carry"},{type:"uint128",name:"recognized"},{type:"uint128",name:"paid"},{type:"uint128",name:"dropped"},{type:"uint40",name:"droppedAt"}]}]},{name:"sideOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"currency"}],outputs:[{type:"bool",name:"listed"},{type:"uint256",name:"side"}]},{name:"dropStream",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"earningSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideClaimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"side"}],outputs:[{type:"uint256"}]},{name:"claimSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"side"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]}};var W=q(["function approve(address spender,uint256 id,uint256 amount) returns (bool)"]),R=t=>I(t,"Provide the documented Hookr add-on parameters."),X=t=>["view","pure"].includes(t.stateMutability);function E(t){return Object.entries(k).flatMap(([e,n])=>n.abi.filter(i=>X(i)===t).map(i=>({role:e,fn:i})))}var B={timeShares:"time-share locker of a revenue token",dayWrapper:"one-day wrapper of time shares",compounder:"compounding vault of a revenue token"};function T(t){return{type:"object",oneOf:E(t).map(({role:e,fn:n})=>({type:"object",properties:{addon:{const:e,description:`Add-on kind "${e}": the ${B[e]??e}.`},token:{..._,description:O.address("Hookr revenue token whose add-on is used")},...e==="dayWrapper"?{day:{...C(),description:'Day number that selects the day wrapper, as a decimal string. Example: "42".'}}:{},function:{const:n.name,description:`Add-on function to call: ${n.name}.`},params:{...H(n.inputs,n.name),description:`Arguments of ${e}.${n.name}; integers are decimal strings.`}},required:["addon","token",...e==="dayWrapper"?["day"]:[],"function","params"],additionalProperties:!1}))}}function P(t,e){let n=E(e).find(a=>a.role===t.addon&&a.fn.name===t.function);if(!n)throw new r("Choose a documented Hookr add-on function.");let i=["addon","token","function","params",...n.role==="dayWrapper"?["day"]:[]];if(Object.keys(t).length!==i.length||Object.keys(t).some(a=>!i.includes(a)))throw new r("Provide exactly the documented Hookr add-on arguments.");let s;try{s=c(String(t.token))}catch{throw new r("Provide a valid revenue token address.")}let p=0n;if(n.role==="dayWrapper"){if(typeof t.day!="string"||!/^(0|[1-9][0-9]*)$/.test(t.day)||t.day.length>78||BigInt(t.day)>=1n<<256n)throw new r("Provide a wrapper day as a decimal integer string.");p=BigInt(t.day)}return{...n,token:s,day:p,...N(n.fn,R(t.params))}}async function $(t,e,n,i){let s=t.clientFor(d),p=async(f,b,v=[])=>s.readContract({address:c(S[f].address),abi:S[f].abi,functionName:b,args:v}),a=R(await p("tokenizer","tokenizations",[n]));if(typeof a.createdAt!="bigint"||a.createdAt<=0n||c(String(a.creator))===M)throw new r("Current Hookr tokenizer has no matching token record; legacy add-ons need their generation-specific route.");let m=e==="compounder"?void 0:c(String(await p("timeFactory","sharesOf",[n]))),u=e==="timeShares"?m:e==="compounder"?c(String(await p("compoundFactory","vaultOf",[n]))):c(String(await p("wrapperFactory","wrapperOf",[m,i])));if(u===M||m===M)throw new r("Hookr add-on is not open yet. Open it with its pinned factory through hookr_action first.");let y=k[e].abi,l=await s.readContract({address:u,abi:y,functionName:e==="dayWrapper"?"shares":"token"});if(c(String(l))!==(e==="dayWrapper"?m:n))throw new r("Hookr add-on disagrees with its factory record.");if(e==="dayWrapper"&&await s.readContract({address:u,abi:y,functionName:"day"})!==i)throw new r("Hookr day wrapper disagrees with its factory day.");return{target:u,shares:m}}async function K(t,e,n){if(t.network==="testnet")throw new r("Hookr add-ons require mainnet, chain 4663.");let{role:i,token:s,day:p,fn:a,values:m,params:u}=P(e,!1),{target:y,shares:l}=await $(t,i,s,p),f=[],b=[],v=0n,h=t.clientFor(d),A=async(o,w)=>{if(w<0n||w>=1n<<128n)throw new r("Hookr add-on funding exceeds its bounded exact approval.");if(!w)return;if(o===M){v+=w,b.push({token:D,amount:w,to:y});return}let g=await h.readContract({address:o,abi:L,functionName:"allowance",args:[n,y]});g>0n&&g!==w&&f.push(t.approval(o,y,"0",d)),f.push(t.approval(o,y,w.toString(),d)),b.push({token:o,amount:w})};if(i==="timeShares"&&a.name==="lock"&&await A(s,u.amount),i==="dayWrapper"&&a.name==="deposit"){let o=u.amount;if(o<=0n||o>=1n<<128n)throw new r("Hookr wrapper deposit needs a positive bounded share amount.");f.push(t.unsignedTx({chainId:d,to:l,value:"0",data:x({abi:W,functionName:"approve",args:[y,p,o]}),description:`Approve exactly ${o} time shares of day ${p} to the factory-recorded wrapper ${y}.`})),b.push({token:l,id:p,amount:o,to:y})}if(i==="compounder"&&a.name==="deposit"){let o=c(String(await h.readContract({address:y,abi:k.compounder.abi,functionName:"quote"})));await A(s,u.tokensMax),await A(o,u.quoteMax)}if(["redeem","redeemShort","redeemUnlocked"].includes(a.name)&&b.push({token:y,amount:u.shares??u.amount,to:M}),a.name==="transfer"&&b.push({token:y,amount:u.amount,to:c(String(u.receiver??u.to)),...i==="timeShares"?{id:u.id}:{}}),u.deadline!==void 0){let o=await h.getBlock();if(typeof o.timestamp!="bigint"||u.deadline<o.timestamp)throw new r("Hookr add-on deadline expired or chain time is unavailable.")}return f.push(t.unsignedTx({chainId:d,to:y,value:v.toString(),data:x({abi:[a],functionName:a.name,args:m}),description:`Hookr ${i}.${a.name}: ${JSON.stringify(e.params)}. Token ${s}${i==="dayWrapper"?`; day ${p}`:""}. Review lock duration, recipients and minimum outputs.`})),{txs:f,inputs:b}}function nt(t){return[{name:"hookr_addon_read",inputSchema:{...T(!0),description:"Read factory-verified current Hookr revenue time shares, day wrappers or compounders: locks, day income, unwrap baskets, bands and side assets. Open factories via hookr_action."},execute:async e=>{let{role:n,token:i,day:s,fn:p,values:a}=P(e,!0),{target:m}=await $(t,n,i,s),u=await t.clientFor(d).readContract({address:m,abi:[p],functionName:p.name,args:a});return{chainId:d,token:i,contract:m,function:p.name,result:JSON.parse(JSON.stringify(u,(y,l)=>typeof l=="bigint"?l.toString():l))}}},{name:"hookr_addon_action",inputSchema:{...T(!1),description:"Preview current Hookr time-share lock/issue/unlock/roll/claims, day wrap/unwrap/owed claims, or compound deposit/redeem/poke/side claims. Exact approvals, factory provenance and local human confirmation required."},execute:async(e,n)=>{let{txs:i}=await K(t,e,n),s=await t.preview(i,n);return{txs:i,preview:s,summary:`Hookr ${e.addon}.${e.function}; verify the receipt and read the resulting lock or balances.`}}}]}export{K as a,nt as b};
1
+ import{b as H,c as N}from"./W32UECOL.js";import{a as S}from"./LT5P6PZW.js";import{a as O}from"./G2LAO23N.js";import{a as D}from"./Z7FGEWO2.js";import{a as C}from"./66F5ZH34.js";import{c as _,f as I}from"./NWNYJ26T.js";import{b as d}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as x,erc20Abi as L,getAddress as c,parseAbi as q,zeroAddress as M}from"viem";var k={timeShares:{factory:"timeFactory",abi:[{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ASSETS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"FOREVER",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_AMOUNT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DIVISOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"minLockAmount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"MIN_TIP_GROWTH",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ISSUE_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_CLAIM_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"currencyAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"address"}]},{name:"lockedTotal",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pendingLocks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"amount"},{type:"uint256",name:"tick"},{type:"uint256",name:"firstLock"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"heldAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},{name:"lockEpochs",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"uint256",name:"joinEpoch"},{type:"uint256",name:"leaveEpoch"}]},{name:"sweepable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"from"},{type:"uint256",name:"max"}],outputs:[{type:"uint256[]",name:"ids"},{type:"uint256",name:"next"}]},{name:"lockCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"lockAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"tuple",components:[{type:"address",name:"owner"},{type:"uint64",name:"lockedAt"},{type:"uint32",name:"firstDay"},{type:"uint128",name:"amount"},{type:"uint32",name:"lastDay"},{type:"uint64",name:"unlockedAt"}]}]},{name:"isIssued",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"}],outputs:[{type:"bool"}]},{name:"unitSupply",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"}],outputs:[{type:"uint256"}]},{name:"currentDay",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"k"}],outputs:[{type:"uint64",name:"timestamp"},{type:"uint256[]",name:"indexes"}]},{name:"index",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"carry",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"pulled",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"paid",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"held",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"dayIndex",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"holder"},{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lockClaimable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"uint32",name:"numberOfDays"}],outputs:[{type:"uint256",name:"lockId"}]},{name:"issue",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"},{type:"address",name:"to"}],outputs:[]},{name:"issueRange",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"firstDay"},{type:"uint256",name:"lastDay"},{type:"address",name:"to"}],outputs:[]},{name:"unlock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"address",name:"to"}],outputs:[]},{name:"syncAssets",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"catchUp",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"max"}],outputs:[{type:"bool",name:"done"}]},{name:"settle",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"roll",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"sweepDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"},{type:"uint256",name:"claimGas"}],outputs:[{type:"uint256[]",name:"amounts"}]},{name:"claim",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimMany",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"days_"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimLock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"receiver"},{type:"uint256",name:"id"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},dayWrapper:{factory:"wrapperFactory",abi:[{name:"shares",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"day",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"basket",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"previewRedeem",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"amount"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"deposit",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"redeemShort",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"owedTo",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimOwed",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[]},{name:"collect",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},compounder:{factory:"compoundFactory",abi:[{name:"MIN_SHARES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BANDS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BAND_TICKS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ADD_GAS_FLOOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_DRIFT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_PERIOD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_TOLERANCE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"DROP_SCAN",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DROP_CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"parked",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"dropId"}],outputs:[{type:"bool"}]},{name:"syncSides",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"count"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolManager",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolId",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{name:"poolKey",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"currency0"},{type:"address",name:"currency1"},{type:"uint24",name:"fee"},{type:"int24",name:"tickSpacing"},{type:"address",name:"hooks"}]}]},{name:"quote",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tokenIsCurrency0",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bool"}]},{name:"bandTicks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint128"}]},{name:"reserve",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"bands",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple[]",components:[{type:"int24",name:"tickLower"},{type:"int24",name:"tickUpper"},{type:"uint128",name:"liquidity"}]}]},{name:"anchor",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"int24",name:"high"},{type:"int24",name:"low"},{type:"uint40",name:"lookedAt"}]}]},{name:"creator",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"holdings",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"deposit",type:"function",stateMutability:"payable",inputs:[{type:"uint256",name:"tokensMax"},{type:"uint256",name:"quoteMax"},{type:"address",name:"to"},{type:"uint256",name:"minShares"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"shares"},{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeemUnlocked",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"poke",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"claimDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"}],outputs:[{type:"uint256",name:"tip"}]},{name:"listSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"asset"}],outputs:[{type:"uint256",name:"side"}]},{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_SIDES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"SIDE_READ_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DEAD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"sideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"fixedSideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"side"}],outputs:[{type:"tuple",components:[{type:"address",name:"currency"},{type:"uint256",name:"index"},{type:"uint256",name:"carry"},{type:"uint128",name:"recognized"},{type:"uint128",name:"paid"},{type:"uint128",name:"dropped"},{type:"uint40",name:"droppedAt"}]}]},{name:"sideOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"currency"}],outputs:[{type:"bool",name:"listed"},{type:"uint256",name:"side"}]},{name:"dropStream",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"earningSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideClaimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"side"}],outputs:[{type:"uint256"}]},{name:"claimSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"side"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]}};var W=q(["function approve(address spender,uint256 id,uint256 amount) returns (bool)"]),R=t=>I(t,"Provide the documented Hookr add-on parameters."),X=t=>["view","pure"].includes(t.stateMutability);function E(t){return Object.entries(k).flatMap(([e,n])=>n.abi.filter(i=>X(i)===t).map(i=>({role:e,fn:i})))}var B={timeShares:"time-share locker of a revenue token",dayWrapper:"one-day wrapper of time shares",compounder:"compounding vault of a revenue token"};function T(t){return{type:"object",oneOf:E(t).map(({role:e,fn:n})=>({type:"object",properties:{addon:{const:e,description:`Add-on kind "${e}": the ${B[e]??e}.`},token:{..._,description:O.address("Hookr revenue token whose add-on is used")},...e==="dayWrapper"?{day:{...C(),description:'Day number that selects the day wrapper, as a decimal string. Example: "42".'}}:{},function:{const:n.name,description:`Add-on function to call: ${n.name}.`},params:{...H(n.inputs,n.name),description:`Arguments of ${e}.${n.name}; integers are decimal strings.`}},required:["addon","token",...e==="dayWrapper"?["day"]:[],"function","params"],additionalProperties:!1}))}}function P(t,e){let n=E(e).find(a=>a.role===t.addon&&a.fn.name===t.function);if(!n)throw new r("Choose a documented Hookr add-on function.");let i=["addon","token","function","params",...n.role==="dayWrapper"?["day"]:[]];if(Object.keys(t).length!==i.length||Object.keys(t).some(a=>!i.includes(a)))throw new r("Provide exactly the documented Hookr add-on arguments.");let s;try{s=c(String(t.token))}catch{throw new r("Provide a valid revenue token address.")}let p=0n;if(n.role==="dayWrapper"){if(typeof t.day!="string"||!/^(0|[1-9][0-9]*)$/.test(t.day)||t.day.length>78||BigInt(t.day)>=1n<<256n)throw new r("Provide a wrapper day as a decimal integer string.");p=BigInt(t.day)}return{...n,token:s,day:p,...N(n.fn,R(t.params))}}async function $(t,e,n,i){let s=t.clientFor(d),p=async(f,b,v=[])=>s.readContract({address:c(S[f].address),abi:S[f].abi,functionName:b,args:v}),a=R(await p("tokenizer","tokenizations",[n]));if(typeof a.createdAt!="bigint"||a.createdAt<=0n||c(String(a.creator))===M)throw new r("Current Hookr tokenizer has no matching token record; legacy add-ons need their generation-specific route.");let m=e==="compounder"?void 0:c(String(await p("timeFactory","sharesOf",[n]))),u=e==="timeShares"?m:e==="compounder"?c(String(await p("compoundFactory","vaultOf",[n]))):c(String(await p("wrapperFactory","wrapperOf",[m,i])));if(u===M||m===M)throw new r("Hookr add-on is not open yet. Open it with its pinned factory through hookr_action first.");let y=k[e].abi,l=await s.readContract({address:u,abi:y,functionName:e==="dayWrapper"?"shares":"token"});if(c(String(l))!==(e==="dayWrapper"?m:n))throw new r("Hookr add-on disagrees with its factory record.");if(e==="dayWrapper"&&await s.readContract({address:u,abi:y,functionName:"day"})!==i)throw new r("Hookr day wrapper disagrees with its factory day.");return{target:u,shares:m}}async function K(t,e,n){if(t.network==="testnet")throw new r("Hookr add-ons require mainnet, chain 4663.");let{role:i,token:s,day:p,fn:a,values:m,params:u}=P(e,!1),{target:y,shares:l}=await $(t,i,s,p),f=[],b=[],v=0n,h=t.clientFor(d),A=async(o,w)=>{if(w<0n||w>=1n<<128n)throw new r("Hookr add-on funding exceeds its bounded exact approval.");if(!w)return;if(o===M){v+=w,b.push({token:D,amount:w,to:y});return}let g=await h.readContract({address:o,abi:L,functionName:"allowance",args:[n,y]});g>0n&&g!==w&&f.push(t.approval(o,y,"0",d)),f.push(t.approval(o,y,w.toString(),d)),b.push({token:o,amount:w})};if(i==="timeShares"&&a.name==="lock"&&await A(s,u.amount),i==="dayWrapper"&&a.name==="deposit"){let o=u.amount;if(o<=0n||o>=1n<<128n)throw new r("Hookr wrapper deposit needs a positive bounded share amount.");f.push(t.unsignedTx({chainId:d,to:l,value:"0",data:x({abi:W,functionName:"approve",args:[y,p,o]}),description:`Approve exactly ${o} time shares of day ${p} to the factory-recorded wrapper ${y}.`})),b.push({token:l,id:p,amount:o,to:y})}if(i==="compounder"&&a.name==="deposit"){let o=c(String(await h.readContract({address:y,abi:k.compounder.abi,functionName:"quote"})));await A(s,u.tokensMax),await A(o,u.quoteMax)}if(["redeem","redeemShort","redeemUnlocked"].includes(a.name)&&b.push({token:y,amount:u.shares??u.amount,to:M}),a.name==="transfer"&&b.push({token:y,amount:u.amount,to:c(String(u.receiver??u.to)),...i==="timeShares"?{id:u.id}:{}}),u.deadline!==void 0){let o=await h.getBlock();if(typeof o.timestamp!="bigint"||u.deadline<o.timestamp)throw new r("Hookr add-on deadline expired or chain time is unavailable.")}return f.push(t.unsignedTx({chainId:d,to:y,value:v.toString(),data:x({abi:[a],functionName:a.name,args:m}),description:`Hookr ${i}.${a.name}: ${JSON.stringify(e.params)}. Token ${s}${i==="dayWrapper"?`; day ${p}`:""}. Review lock duration, recipients and minimum outputs.`})),{txs:f,inputs:b}}function nt(t){return[{name:"hookr_addon_read",inputSchema:{...T(!0),description:"Read factory-verified current Hookr revenue time shares, day wrappers or compounders: locks, day income, unwrap baskets, bands and side assets. Open factories via hookr_action."},execute:async e=>{let{role:n,token:i,day:s,fn:p,values:a}=P(e,!0),{target:m}=await $(t,n,i,s),u=await t.clientFor(d).readContract({address:m,abi:[p],functionName:p.name,args:a});return{chainId:d,token:i,contract:m,function:p.name,result:JSON.parse(JSON.stringify(u,(y,l)=>typeof l=="bigint"?l.toString():l))}}},{name:"hookr_addon_action",inputSchema:{...T(!1),description:"Preview current Hookr time-share lock/issue/unlock/roll/claims, day wrap/unwrap/owed claims, or compound deposit/redeem/poke/side claims. Exact approvals, factory provenance and local human confirmation required."},execute:async(e,n)=>{let{txs:i}=await K(t,e,n),s=await t.preview(i,n);return{txs:i,preview:s,summary:`Hookr ${e.addon}.${e.function}; verify the receipt and read the resulting lock or balances.`}}}]}export{K as a,nt as b};
@@ -1 +1 @@
1
- import{i as Y}from"./U2YCQWZK.js";import{b as V,c as W,d as G}from"./DNNFKDZR.js";import{d as de,e as L}from"./CAWTAR5V.js";import{a as B}from"./H5DY7CNB.js";import{a as N}from"./43LI5NKJ.js";import{b as H,c as se,d as ae,e as j}from"./IX3GZMTM.js";import{a as x,i as D}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as S}from"./JXOEJPJ4.js";import{decodeEventLog as $e,encodeAbiParameters as pe,encodeFunctionData as ye,erc20Abi as Z,getAddress as l,isAddress as E,keccak256 as Ee,parseAbi as _e,parseAbiParameters as we,toEventSelector as ge}from"viem";var A=l(D[4663].hookr.HookrLimitOrders.address),ve=l(D[4663].hookr.HookrRoot.address),Ne=l(D[4663].hookr.HookrRouter.address),It=l(D[4663].hookr.HookrRegistry.address),Be=l(D[4663].hookr.HookrForwarder.address),Fe=l(D[4663].hookr.PoolManager.address),At=l(D[4663].hookr.HOOKR_Token.address),Me=l("0x000000000000000000000000000000000000dEaD"),ze=8388608,qe=200,ce=60n,Xe=604800n,ue=31536000n,ht=10,St=100,xt="500000000000000",Ct="10000000000000000",me=4096n,Q=32n,Ke=1e4,Ue=(1n<<127n)-1n,le=(1n<<128n)-1n,je=(1n<<160n)-1n,Ve=(1n<<40n)-1n,We=16777215,Ge=8388607,fe=1n<<192n,ee=0,M=1,Ye=2,Qe=3,Ze=ge("OrderCreated(uint256,address,bytes32,bool,uint128,uint128,uint128,uint40,address)"),Dt=ge("OrderCancelled(uint256,address,address,uint256,uint256)"),P=_e(["function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function createOrder(((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint160 sqrtPriceLimitX96, address recipient, uint40 expiry, uint128 bounty) params) payable returns (uint256 orderId)","function cancel(uint256 orderId, address to)","function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)","function router() view returns (address)","function registry() view returns (address)","function poolManager() view returns (address)","function forwarder() view returns (address)","event OrderCreated(uint256 indexed orderId, address indexed owner, bytes32 indexed poolId, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint40 expiry, address recipient)","event OrderCancelled(uint256 indexed orderId, address indexed owner, address indexed to, uint256 amountIn, uint256 bounty)"]);function F(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ke(e){let t=e.toLowerCase();return t===L.toLowerCase()||t===B.toLowerCase()||t===de.toLowerCase()}function $(e,t){if(typeof e!="string"||!e.trim())throw new o(`Provide a valid contract address for ${t}. Identify tokens by chain and address, never by symbol.`);let n=e.trim();if(!E(n,{strict:!1}))throw new o(`Invalid token address "${n}" for ${t}. Identify tokens by chain and address, never by symbol.`);return ke(n)?L:l(n)}function be(e){let t=e===void 0?x:Number(e);if(!Number.isSafeInteger(t)||t!==x)throw new o(`Hookr limit orders are only supported on Robinhood Chain (${x}).`);return x}function Je(e){switch(e){case ee:return"None";case M:return"Open";case Ye:return"Filled";case Qe:return"Cancelled";default:return"Unknown"}}function et(e,t,n=ae){if(typeof e!="string"||!/^-?\d+$/.test(e.trim()))throw new o("Signed amount must be an integer string in base units.");let r=e.trim();if(r.startsWith("-")){let i=r.slice(1),u=n(i,t);return u==="0"?"0":`-${u}`}return n(r,t)}function Pt(e,t,n="floor"){return se(e,t,n)}function Oe(e){return Ee(pe(we("address, address, uint24, int24, address"),[l(e.currency0),l(e.currency1),e.fee,e.tickSpacing,l(e.hooks)]))}function Ie(e,t){let n=e.toLowerCase();if(new Set([L.toLowerCase(),Me.toLowerCase(),A.toLowerCase(),Ne.toLowerCase(),Be.toLowerCase(),Fe.toLowerCase(),t.toLowerCase()]).has(n))throw new o(`Recipient ${e} is a reserved address and cannot receive Hookr limit order funds.`)}async function J(e,t,n,r){if(ke(e))return{address:B,symbol:V.symbol,decimals:V.decimals,chainId:t};let i=l(e),u=i.toLowerCase();if(F(r)){let s=typeof r.decimals=="number"&&Number.isInteger(r.decimals)&&r.decimals>=0&&r.decimals<=255?r.decimals:void 0,a=typeof r.symbol=="string"&&r.symbol.trim()?r.symbol.trim():void 0;if(s!==void 0&&a!==void 0)return{address:i,symbol:a,decimals:s,chainId:t}}if(u===W.address.toLowerCase())return{...W,chainId:t};if(u===G.address.toLowerCase())return{...G,chainId:t};try{let[s,a]=await Promise.all([n.readContract({address:i,abi:Z,functionName:"symbol"}),n.readContract({address:i,abi:Z,functionName:"decimals"})]);if(typeof s!="string"||!s.trim()||typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new o(`Invalid token metadata for ${i}.`);return{address:i,symbol:s.trim(),decimals:a,chainId:t}}catch{throw new o(`Could not read valid token metadata for ${i}. Refusing to guess token decimals.`)}}function tt(e){let t=F(e.key)?e.key:F(e.poolKey)?e.poolKey:void 0,n=t?.fee??e.fee??ze,r=(typeof n=="string"&&/^\d+$/.test(n),Number(n));if(!Number.isInteger(r)||r<0||r>We)throw new o("Pool fee must be a valid uint24 integer (default 8388608 for Hookr dynamic fee pools).");let i=t?.tickSpacing??e.tickSpacing??qe,u=(typeof i=="string"&&/^-?\d+$/.test(i),Number(i));if(!Number.isInteger(u)||u<=0||u>Ge)throw new o("Pool tickSpacing must be a positive int24 integer.");let s=t?.hooks??e.hooks??ve;if(typeof s!="string"||!E(s,{strict:!1}))throw new o("Provide a valid Hookr root contract address for hooks.");let a=l(s);if(t?.currency0!==void 0&&t?.currency1!==void 0||e.currency0!==void 0&&e.currency1!==void 0){let m=$(t?.currency0??e.currency0,"currency0"),I=$(t?.currency1??e.currency1,"currency1");if(m.toLowerCase()===I.toLowerCase())throw new o("Pool currency0 and currency1 must be distinct token addresses.");if(BigInt(m)>=BigInt(I))throw new o("Pool currency0 must sort strictly before currency1 by address.");let b;if(typeof e.zeroForOne=="boolean")b=e.zeroForOne;else if(e.tokenIn!==void 0||e.from!==void 0){let C=$(e.tokenIn??e.from,"tokenIn");if(C.toLowerCase()===m.toLowerCase())b=!0;else if(C.toLowerCase()===I.toLowerCase())b=!1;else throw new o("tokenIn does not match currency0 or currency1 of the pool key.")}else throw new o("Provide zeroForOne (boolean) or tokenIn when specifying a pool key.");return{key:{currency0:m,currency1:I,fee:r,tickSpacing:u,hooks:a},zeroForOne:b}}let w=e.tokenIn??e.from,f=e.tokenOut??e.to;if(w===void 0||f===void 0)throw new o("Provide either key ({ currency0, currency1, fee, tickSpacing, hooks }) with zeroForOne or tokenIn and tokenOut addresses.");let g=$(w,"tokenIn"),k=$(f,"tokenOut");if(g.toLowerCase()===k.toLowerCase())throw new o("Input and output tokens must have distinct addresses.");let p=BigInt(g)<BigInt(k),y=p?g:k,d=p?k:g;if(typeof e.zeroForOne=="boolean"&&e.zeroForOne!==p)throw new o("zeroForOne conflicts with the canonical sorting of tokenIn and tokenOut.");return{key:{currency0:y,currency1:d,fee:r,tickSpacing:u,hooks:a},zeroForOne:p}}function nt(e,t,n){let r=Y(t),i=r*r;if(n){let s=j(e.toString(),i.toString(),fe.toString(),"ceil");return BigInt(s)}let u=j(e.toString(),fe.toString(),i.toString(),"ceil");return BigInt(u)}function R(e,t){if(typeof e=="bigint"){if(e<0n)throw new o(`${t} must be a non-negative integer.`);return e}if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new o(`${t} must be a non-negative safe integer.`);return BigInt(e)}if(typeof e=="string")return H(e.trim());throw new o(`Provide ${t} as a decimal base-unit string.`)}async function ot(e,t){if(t!==void 0)return R(t,"now");if(typeof e.getBlock=="function"){let n=await e.getBlock().catch(()=>{throw new o("Could not read the chain timestamp for Hookr order expiry.")});return BigInt(n.timestamp)}throw new o("Could not read the chain timestamp for Hookr order expiry.")}function Ae(e,t){return!e.changes||e.changes.length===0?"no net ERC-20 transfer deltas":e.changes.map(n=>`${et(n.amount,n.token.decimals,t.formatAmount)} ${S(n.token.symbol)}`).join(", ")}function rt(e,t,n,r){if(!e||!Array.isArray(e.logs))throw new o("Provide a transaction receipt with a logs array.");for(let i of e.logs){if(!i||typeof i.address!="string"||!E(i.address,{strict:!1})||!Array.isArray(i.topics)||typeof i.data!="string"||i.topics.some(u=>typeof u!="string"||!/^0x[0-9a-fA-F]{64}$/.test(u)))throw new o(`Malformed Hookr ${t} receipt log.`);if(i.address.toLowerCase()===A.toLowerCase()&&i.topics[0]?.toLowerCase()===n.toLowerCase()){if(i.topics.length!==4||!/^0x0{24}/i.test(i.topics[2])||t==="OrderCancelled"&&!/^0x0{24}/i.test(i.topics[3])||!/^0x[0-9a-fA-F]*$/.test(i.data)||i.data.length!==2+r*64)throw new o(`Malformed Hookr ${t} receipt log.`);return{topics:i.topics,data:i.data}}}throw new o(`Could not find Hookr ${t} event in transaction receipt logs.`)}function he(e){if(e.receipt!==void 0){if(!F(e.receipt)||!Array.isArray(e.receipt.logs))throw new o("Provide a transaction receipt with a logs array.");return st({logs:e.receipt.logs})}if(e.logs!==void 0){if(!Array.isArray(e.logs))throw new o("Provide receipt logs as an array.");return it(e.logs)}}function Se(e){let t=rt(e,"OrderCreated",Ze,6);try{let n=$e({abi:P,eventName:"OrderCreated",...t,strict:!0});if(pe(we("bool, uint128, uint128, uint128, uint40, address"),[n.args.zeroForOne,n.args.amountIn,n.args.minAmountOut,n.args.bounty,n.args.expiry,n.args.recipient]).toLowerCase()!==t.data.toLowerCase())throw new o("Noncanonical Hookr OrderCreated event data.");return{orderId:n.args.orderId.toString(),owner:l(n.args.owner),poolId:n.args.poolId,zeroForOne:n.args.zeroForOne,amountIn:n.args.amountIn.toString(),minAmountOut:n.args.minAmountOut.toString(),bounty:n.args.bounty.toString(),expiry:n.args.expiry.toString(),recipient:l(n.args.recipient)}}catch{throw new o("Malformed Hookr OrderCreated receipt log.")}}function it(e){return Se({logs:e}).orderId}function st(e){return Se(e).orderId}function xe(e){if(Array.isArray(e)){let[n,r,i,u,s,a,c,w,f,g,k]=e;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:r,createdAt:i,expiry:u,zeroForOne:s,status:a,recipient:c,amountIn:BigInt(w),minAmountOut:BigInt(f),bounty:BigInt(g),sqrtPriceLimitX96:BigInt(k)}}let t=e;return{key:{currency0:t.key.currency0,currency1:t.key.currency1,fee:Number(t.key.fee),tickSpacing:Number(t.key.tickSpacing),hooks:t.key.hooks},owner:t.owner,createdAt:t.createdAt,expiry:t.expiry,zeroForOne:!!t.zeroForOne,status:Number(t.status),recipient:t.recipient,amountIn:BigInt(t.amountIn),minAmountOut:BigInt(t.minAmountOut),bounty:BigInt(t.bounty),sqrtPriceLimitX96:BigInt(t.sqrtPriceLimitX96)}}async function Ce(e,t,n){let r=R(t,"orderId");if(r<=0n)throw new o("Order ID must be a positive integer.");let i=e.clientFor(x),u=n?.order??await i.readContract({address:A,abi:P,functionName:"getOrder",args:[r]}).catch(()=>{throw new o(`Could not read Hookr order #${r}. Order coverage is incomplete.`)}),s=xe(u),a=Number(s.status);if(s.owner.toLowerCase()===L.toLowerCase()||a===ee)throw new o(`Hookr order #${r} does not exist.`);let c={currency0:l(s.key.currency0),currency1:l(s.key.currency1),fee:Number(s.key.fee),tickSpacing:Number(s.key.tickSpacing),hooks:l(s.key.hooks)},w=s.zeroForOne?c.currency0:c.currency1,f=s.zeroForOne?c.currency1:c.currency0,g=m=>{let I=m.toLowerCase(),b=n?.tokens.get(I);if(b)return b;let C=J(m,x,i);return n?.tokens.set(I,C),C},[k,p]=await Promise.all([g(w),g(f)]),y=!1,d=0n;if(a===M)try{let m=await i.readContract({address:A,abi:P,functionName:"quoteFill",args:[r]});if(typeof m[0]!="boolean"||typeof m[1]!="bigint"||m[1]<0n)throw new o(`Invalid quote for Hookr order #${r}.`);y=m[0],d=m[1]}catch{throw new o(`Could not quote Hookr order #${r}. Fillability and output amount are unknown.`)}return{orderId:r.toString(),poolId:Oe(c),key:c,owner:l(s.owner),recipient:l(s.recipient),createdAt:BigInt(s.createdAt).toString(),expiry:BigInt(s.expiry).toString(),zeroForOne:s.zeroForOne,status:a,statusLabel:Je(a),amountIn:s.amountIn.toString(),minAmountOut:s.minAmountOut.toString(),bounty:s.bounty.toString(),sqrtPriceLimitX96:s.sqrtPriceLimitX96.toString(),tokenIn:k,tokenOut:p,fillable:y,quotedAmountOut:d.toString()}}function at(e){return{name:"hookr_create",inputSchema:{type:"object",properties:{key:{type:"object",description:"Uniswap v4 PoolKey of the pool to place the order in; omitted fee, tickSpacing and hooks use Hookr defaults. tokenIn or zeroForOne picks the direction.",properties:{currency0:{type:"string",description:"Lower-sorted pool token address (0x followed by 40 hex digits)."},currency1:{type:"string",description:"Higher-sorted pool token address (0x followed by 40 hex digits)."},fee:{type:"number",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%); default 8388608, the v4 dynamic-fee flag of Hookr pools."},tickSpacing:{type:"number",description:"Pool tick spacing, a positive integer; defaults to the Hookr pool spacing."},hooks:{type:"string",description:"Address of the pool hook contract; defaults to the Hookr root hook."}}},tokenIn:{type:"string",description:"Input token address on chain 4663."},tokenOut:{type:"string",description:"Output token address on chain 4663."},zeroForOne:{type:"boolean",description:"True when selling currency0 for currency1."},amountIn:{type:"string",description:"Input amount in base units (uint128)."},minAmountOut:{type:"string",description:"Minimum net output amount in base units (uint128)."},tick:{type:"number",description:"Optional limit tick in [-887272, 887272]."},expiry:{type:"string",description:"Order expiry unix timestamp in seconds (uint40)."},deadline:{type:"string",description:"Alias for expiry unix timestamp in seconds."},bounty:{type:"string",description:"Keeper bounty in native ETH wei (uint128)."},recipient:{type:"string",description:"Order output recipient address (must be the signing wallet)."},sqrtPriceLimitX96:{type:"string",description:"Optional sqrtPriceLimitX96 (defaults to 0)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["amountIn"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=e.clientFor(i),s=he(t),{key:a,zeroForOne:c}=tt(t),w=c?a.currency0:a.currency1,f=c?a.currency1:a.currency0,[g,k]=await Promise.all([J(w,i,u,t.tokenInMeta),J(f,i,u,t.tokenOutMeta)]),p=t.recipient??r;if(typeof p!="string"||!E(p,{strict:!1}))throw new o("Provide a valid recipient address for the Hookr limit order.");let y=l(p);if(Ie(y,a.hooks),y!==r)throw new o("Hookr recipient must be the signing wallet.");if(typeof t.amountIn!="string")throw new o("Provide amountIn as an integer string in base units.");let d=H(t.amountIn);if(d<=0n||d>Ue)throw new o("amountIn must be between 1 and int128.max base units.");if(t.tick!==void 0){let T=Number(t.tick);Y(T)}let m;if(t.minAmountOut!==void 0){if(typeof t.minAmountOut!="string")throw new o("Provide minAmountOut as an integer string in base units.");m=H(t.minAmountOut)}else if(t.tick!==void 0)m=nt(d,Number(t.tick),c);else throw new o("Provide minAmountOut in base units (or tick to derive minAmountOut).");if(m<=0n||m>le)throw new o("minAmountOut must be between 1 and uint128.max base units.");let I=t.sqrtPriceLimitX96!==void 0?R(t.sqrtPriceLimitX96,"sqrtPriceLimitX96"):0n;if(I>je)throw new o("sqrtPriceLimitX96 exceeds uint160 bounds.");let b=await ot(u,t.now),C=t.expiry??t.deadline,O;if(C!==void 0)O=R(C,"expiry");else if(t.lifetime!==void 0||t.ttlSeconds!==void 0){let T=R(t.lifetime??t.ttlSeconds,"lifetime");O=b+T}else O=b+Xe;if(O<b+ce)throw new o(`Order expiry (${O}) is expired or below the minimum lifetime of ${ce} seconds from block timestamp ${b}.`);if(O>b+ue||O>Ve)throw new o(`Order expiry (${O}) exceeds the maximum lifetime of ${ue} seconds (365 days).`);let z=await u.readContract({address:A,abi:P,functionName:"bountyBounds",args:[a,c,d,m]}).catch(()=>{throw new o("Could not read Hookr bounty bounds.")}),_=BigInt(z[0]),q=BigInt(z[1]),X=BigInt(z[2]);if(t.bounty!==void 0&&typeof t.bounty!="string")throw new o("Provide bounty as an integer string in base units.");let h=t.bounty!==void 0?H(t.bounty):q,K=_>0n?_:q;if(h<_||K>0n&&h<K)throw new o(`Order keeper bounty (${h} wei) is underbounty: must be at least ${K} wei (default keeper bounty floor).`);if(h>X||h>le)throw new o(`Order keeper bounty (${h} wei) exceeds the maximum allowed bounty of ${X} wei.`);let te=w.toLowerCase()===L.toLowerCase(),v=[];if(!te){let T;try{let U=await u.readContract({address:w,abi:Z,functionName:"allowance",args:[r,A]});if(typeof U!="bigint"||U<0n)throw new o("Invalid token allowance.");T=U}catch{throw new o(`Could not read token allowance for ${w}. No approval was prepared.`)}T<d&&v.push(e.approval(w,A,d.toString(),i))}let Pe=te?d+h:h,Le=ye({abi:P,functionName:"createOrder",args:[{key:a,zeroForOne:c,amountIn:d,minAmountOut:m,sqrtPriceLimitX96:I,recipient:y,expiry:Number(O),bounty:h}]}),ne=e.formatAmount(d.toString(),g.decimals),oe=e.formatAmount(m.toString(),k.decimals),re=e.formatAmount(h.toString(),18),Te=e.unsignedTx({to:A,data:Le,value:Pe.toString(),chainId:i,description:`Create Hookr limit order on ${A}: sell ${ne} ${S(g.symbol)} (${g.address}) for at least ${oe} ${S(k.symbol)} (${k.address}) with ${re} ETH keeper bounty (fee=${a.fee}, tickSpacing=${a.tickSpacing}, expiry=${O}).`});v.push(Te);let ie=await e.preview(v,r),Re=Ae(ie,e),He=Oe(a);return{txs:v,summary:`Hookr limit order prepared: sell ${ne} ${S(g.symbol)} for at least ${oe} ${S(k.symbol)} (bounty ${re} ETH, expiry ${O}; preview deltas: ${Re}).`,preview:ie,poolId:He,key:a,zeroForOne:c,amountIn:d.toString(),minAmountOut:m.toString(),bounty:h.toString(),bountyBounds:{minBounty:_.toString(),defaultBounty:q.toString(),maxBounty:X.toString()},expiry:O.toString(),recipient:y,sqrtPriceLimitX96:I.toString(),tokenIn:g,tokenOut:k,...s!==void 0?{orderId:s}:{}}}}}function dt(e){return{name:"hookr_cancel",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"Hookr order ID to cancel (uint256 decimal string)."},to:{type:"string",description:"Recipient address for the refunded principal and bounty (must be the signing wallet)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["orderId"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=he(t),s=t.orderId??t.id??u;if(s===void 0)throw new o("Provide orderId to cancel a Hookr limit order.");let a=R(s,"orderId");if(a<=0n)throw new o("orderId must be a positive integer.");let c=await Ce(e,a);if(c.owner.toLowerCase()!==r.toLowerCase())throw new o(`Unauthorized cancellation: only the order owner (${c.owner}) can cancel Hookr order #${a} (caller is ${r}).`);if(c.status!==M)throw new o(`Hookr order #${a} is not open (current status: ${c.statusLabel}).`);let w=t.to??r;if(typeof w!="string"||!E(w,{strict:!1}))throw new o("Provide a valid refund recipient address for cancel.");let f=l(w);if(Ie(f,c.key.hooks),f!==r)throw new o("Hookr refund recipient must be the signing wallet.");let g=ye({abi:P,functionName:"cancel",args:[a,f]}),k=e.formatAmount(c.amountIn,c.tokenIn.decimals),p=e.formatAmount(c.bounty,18),y=e.unsignedTx({to:A,data:g,value:"0",chainId:i,description:`Cancel Hookr limit order #${a} on ${A} and refund ${k} ${S(c.tokenIn.symbol)} plus ${p} ETH bounty to ${f}.`}),d=await e.preview([y],r),m=Ae(d,e);return{txs:[y],summary:`Cancel Hookr limit order #${a}: refund ${k} ${S(c.tokenIn.symbol)} and ${p} ETH bounty to ${f} (preview deltas: ${m}).`,preview:d,orderId:a.toString(),to:f,refundedAmountIn:c.amountIn,refundedBounty:c.bounty,tokenIn:c.tokenIn,tokenOut:c.tokenOut}}}}function ct(e){let t=performance.now()+Ke;return new Proxy(e,{get(n,r,i){return r!=="readContract"?Reflect.get(n,r,i):async(...u)=>{let s=t-performance.now(),a=()=>new o("Hookr scan deadline exceeded. Order coverage is incomplete; retry later.");if(s<=0)throw a();let c;try{return await Promise.race([n.readContract(...u),new Promise((w,f)=>{c=setTimeout(()=>f(a()),s)})])}finally{c!==void 0&&clearTimeout(c)}}}})}function ut(e){return async t=>{N(t);let n=l(t),r=ct(e.clientFor(x)),i={...e,clientFor:()=>r},u=await r.readContract({address:A,abi:P,functionName:"lastOrderId"}).catch(()=>{throw new o("Could not read the last Hookr order ID. Order coverage is incomplete.")});if(typeof u!="bigint"||u<0n)throw new o("Could not read a valid last Hookr order ID. Order coverage is incomplete.");let s=u,a=s>me?s-me+1n:1n;if(s<=0n)return[];let c=[],w=new Map;for(let f=a;f<=s;f+=Q){let g=Array.from({length:Number(s-f+1n<Q?s-f+1n:Q)},(p,y)=>f+BigInt(y)),k=await Promise.all(g.map(async p=>{let y=await r.readContract({address:A,abi:P,functionName:"getOrder",args:[p]}).catch(()=>{throw new o(`Could not read Hookr order #${p}. Order coverage is incomplete.`)}),d=xe(y);if(d.owner.toLowerCase()===L||Number(d.status)===ee)throw new o(`Hookr order #${p} does not exist. Order coverage is incomplete.`);return{id:p,order:d}}));for(let{id:p,order:y}of k){if(y.owner.toLowerCase()!==n.toLowerCase()||Number(y.status)!==M)continue;let d=await Ce(i,p,{order:y,tokens:w}),m=[{token:d.tokenIn,amount:d.amountIn}];BigInt(d.bounty)>0n&&m.push({token:{address:B,symbol:"ETH",decimals:18,chainId:x},amount:d.bounty});let I=e.formatAmount(d.amountIn,d.tokenIn.decimals),b=e.formatAmount(d.minAmountOut,d.tokenOut.decimals),C=e.formatAmount(d.bounty,18),O=e.formatAmount(d.quotedAmountOut,d.tokenOut.decimals);c.push({module:"hookr",id:d.orderId,chainId:x,assets:m,description:`Hookr open limit order #${d.orderId}: sell ${I} ${S(d.tokenIn.symbol)} (${d.tokenIn.address}) for at least ${b} ${S(d.tokenOut.symbol)} (${d.tokenOut.address}), bounty ${C} ETH, expiry ${d.expiry}, fillable=${d.fillable} (quoted output ${O} ${S(d.tokenOut.symbol)}).`})}}return a>1n&&c.push({module:"hookr",id:"coverage",chainId:x,assets:[],description:`Hookr order coverage is incomplete: scanned IDs ${a}-${s}. Older orders require an explicit order ID.`}),c}}var De=e=>{let t=[at(e),dt(e)],n=ut(e);return{tools:t,positions:n}},Lt=De,Tt=De;export{A as a,ve as b,Ne as c,It as d,Be as e,Fe as f,At as g,Me as h,ze as i,qe as j,ce as k,Xe as l,ue as m,ht as n,St as o,xt as p,Ct as q,me as r,Ke as s,ee as t,M as u,Ye as v,Qe as w,Ze as x,Dt as y,P as z,et as A,Pt as B,Oe as C,rt as D,Se as E,it as F,st as G,xe as H,Ce as I,at as J,dt as K,ct as L,ut as M,De as N,Lt as O,Tt as P};
1
+ import{i as Y}from"./UVAR6BHU.js";import{b as V,c as W,d as G}from"./QLFPAN6S.js";import{d as de,e as L}from"./LKX5WDOQ.js";import{a as B}from"./Z7FGEWO2.js";import{a as N}from"./43LI5NKJ.js";import{b as H,c as se,d as ae,e as j}from"./IX3GZMTM.js";import{b as x,j as D}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{a as S}from"./JXOEJPJ4.js";import{decodeEventLog as $e,encodeAbiParameters as pe,encodeFunctionData as ye,erc20Abi as Z,getAddress as l,isAddress as E,keccak256 as Ee,parseAbi as _e,parseAbiParameters as we,toEventSelector as ge}from"viem";var A=l(D[4663].hookr.HookrLimitOrders.address),ve=l(D[4663].hookr.HookrRoot.address),Ne=l(D[4663].hookr.HookrRouter.address),It=l(D[4663].hookr.HookrRegistry.address),Be=l(D[4663].hookr.HookrForwarder.address),Fe=l(D[4663].hookr.PoolManager.address),At=l(D[4663].hookr.HOOKR_Token.address),Me=l("0x000000000000000000000000000000000000dEaD"),ze=8388608,qe=200,ce=60n,Xe=604800n,ue=31536000n,ht=10,St=100,xt="500000000000000",Ct="10000000000000000",me=4096n,Q=32n,Ke=1e4,Ue=(1n<<127n)-1n,le=(1n<<128n)-1n,je=(1n<<160n)-1n,Ve=(1n<<40n)-1n,We=16777215,Ge=8388607,fe=1n<<192n,ee=0,M=1,Ye=2,Qe=3,Ze=ge("OrderCreated(uint256,address,bytes32,bool,uint128,uint128,uint128,uint40,address)"),Dt=ge("OrderCancelled(uint256,address,address,uint256,uint256)"),P=_e(["function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function createOrder(((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint160 sqrtPriceLimitX96, address recipient, uint40 expiry, uint128 bounty) params) payable returns (uint256 orderId)","function cancel(uint256 orderId, address to)","function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)","function router() view returns (address)","function registry() view returns (address)","function poolManager() view returns (address)","function forwarder() view returns (address)","event OrderCreated(uint256 indexed orderId, address indexed owner, bytes32 indexed poolId, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint40 expiry, address recipient)","event OrderCancelled(uint256 indexed orderId, address indexed owner, address indexed to, uint256 amountIn, uint256 bounty)"]);function F(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ke(e){let t=e.toLowerCase();return t===L.toLowerCase()||t===B.toLowerCase()||t===de.toLowerCase()}function $(e,t){if(typeof e!="string"||!e.trim())throw new o(`Provide a valid contract address for ${t}. Identify tokens by chain and address, never by symbol.`);let n=e.trim();if(!E(n,{strict:!1}))throw new o(`Invalid token address "${n}" for ${t}. Identify tokens by chain and address, never by symbol.`);return ke(n)?L:l(n)}function be(e){let t=e===void 0?x:Number(e);if(!Number.isSafeInteger(t)||t!==x)throw new o(`Hookr limit orders are only supported on Robinhood Chain (${x}).`);return x}function Je(e){switch(e){case ee:return"None";case M:return"Open";case Ye:return"Filled";case Qe:return"Cancelled";default:return"Unknown"}}function et(e,t,n=ae){if(typeof e!="string"||!/^-?\d+$/.test(e.trim()))throw new o("Signed amount must be an integer string in base units.");let r=e.trim();if(r.startsWith("-")){let i=r.slice(1),u=n(i,t);return u==="0"?"0":`-${u}`}return n(r,t)}function Pt(e,t,n="floor"){return se(e,t,n)}function Oe(e){return Ee(pe(we("address, address, uint24, int24, address"),[l(e.currency0),l(e.currency1),e.fee,e.tickSpacing,l(e.hooks)]))}function Ie(e,t){let n=e.toLowerCase();if(new Set([L.toLowerCase(),Me.toLowerCase(),A.toLowerCase(),Ne.toLowerCase(),Be.toLowerCase(),Fe.toLowerCase(),t.toLowerCase()]).has(n))throw new o(`Recipient ${e} is a reserved address and cannot receive Hookr limit order funds.`)}async function J(e,t,n,r){if(ke(e))return{address:B,symbol:V.symbol,decimals:V.decimals,chainId:t};let i=l(e),u=i.toLowerCase();if(F(r)){let s=typeof r.decimals=="number"&&Number.isInteger(r.decimals)&&r.decimals>=0&&r.decimals<=255?r.decimals:void 0,a=typeof r.symbol=="string"&&r.symbol.trim()?r.symbol.trim():void 0;if(s!==void 0&&a!==void 0)return{address:i,symbol:a,decimals:s,chainId:t}}if(u===W.address.toLowerCase())return{...W,chainId:t};if(u===G.address.toLowerCase())return{...G,chainId:t};try{let[s,a]=await Promise.all([n.readContract({address:i,abi:Z,functionName:"symbol"}),n.readContract({address:i,abi:Z,functionName:"decimals"})]);if(typeof s!="string"||!s.trim()||typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new o(`Invalid token metadata for ${i}.`);return{address:i,symbol:s.trim(),decimals:a,chainId:t}}catch{throw new o(`Could not read valid token metadata for ${i}. Refusing to guess token decimals.`)}}function tt(e){let t=F(e.key)?e.key:F(e.poolKey)?e.poolKey:void 0,n=t?.fee??e.fee??ze,r=(typeof n=="string"&&/^\d+$/.test(n),Number(n));if(!Number.isInteger(r)||r<0||r>We)throw new o("Pool fee must be a valid uint24 integer (default 8388608 for Hookr dynamic fee pools).");let i=t?.tickSpacing??e.tickSpacing??qe,u=(typeof i=="string"&&/^-?\d+$/.test(i),Number(i));if(!Number.isInteger(u)||u<=0||u>Ge)throw new o("Pool tickSpacing must be a positive int24 integer.");let s=t?.hooks??e.hooks??ve;if(typeof s!="string"||!E(s,{strict:!1}))throw new o("Provide a valid Hookr root contract address for hooks.");let a=l(s);if(t?.currency0!==void 0&&t?.currency1!==void 0||e.currency0!==void 0&&e.currency1!==void 0){let m=$(t?.currency0??e.currency0,"currency0"),I=$(t?.currency1??e.currency1,"currency1");if(m.toLowerCase()===I.toLowerCase())throw new o("Pool currency0 and currency1 must be distinct token addresses.");if(BigInt(m)>=BigInt(I))throw new o("Pool currency0 must sort strictly before currency1 by address.");let b;if(typeof e.zeroForOne=="boolean")b=e.zeroForOne;else if(e.tokenIn!==void 0||e.from!==void 0){let C=$(e.tokenIn??e.from,"tokenIn");if(C.toLowerCase()===m.toLowerCase())b=!0;else if(C.toLowerCase()===I.toLowerCase())b=!1;else throw new o("tokenIn does not match currency0 or currency1 of the pool key.")}else throw new o("Provide zeroForOne (boolean) or tokenIn when specifying a pool key.");return{key:{currency0:m,currency1:I,fee:r,tickSpacing:u,hooks:a},zeroForOne:b}}let w=e.tokenIn??e.from,f=e.tokenOut??e.to;if(w===void 0||f===void 0)throw new o("Provide either key ({ currency0, currency1, fee, tickSpacing, hooks }) with zeroForOne or tokenIn and tokenOut addresses.");let g=$(w,"tokenIn"),k=$(f,"tokenOut");if(g.toLowerCase()===k.toLowerCase())throw new o("Input and output tokens must have distinct addresses.");let p=BigInt(g)<BigInt(k),y=p?g:k,d=p?k:g;if(typeof e.zeroForOne=="boolean"&&e.zeroForOne!==p)throw new o("zeroForOne conflicts with the canonical sorting of tokenIn and tokenOut.");return{key:{currency0:y,currency1:d,fee:r,tickSpacing:u,hooks:a},zeroForOne:p}}function nt(e,t,n){let r=Y(t),i=r*r;if(n){let s=j(e.toString(),i.toString(),fe.toString(),"ceil");return BigInt(s)}let u=j(e.toString(),fe.toString(),i.toString(),"ceil");return BigInt(u)}function R(e,t){if(typeof e=="bigint"){if(e<0n)throw new o(`${t} must be a non-negative integer.`);return e}if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new o(`${t} must be a non-negative safe integer.`);return BigInt(e)}if(typeof e=="string")return H(e.trim());throw new o(`Provide ${t} as a decimal base-unit string.`)}async function ot(e,t){if(t!==void 0)return R(t,"now");if(typeof e.getBlock=="function"){let n=await e.getBlock().catch(()=>{throw new o("Could not read the chain timestamp for Hookr order expiry.")});return BigInt(n.timestamp)}throw new o("Could not read the chain timestamp for Hookr order expiry.")}function Ae(e,t){return!e.changes||e.changes.length===0?"no net ERC-20 transfer deltas":e.changes.map(n=>`${et(n.amount,n.token.decimals,t.formatAmount)} ${S(n.token.symbol)}`).join(", ")}function rt(e,t,n,r){if(!e||!Array.isArray(e.logs))throw new o("Provide a transaction receipt with a logs array.");for(let i of e.logs){if(!i||typeof i.address!="string"||!E(i.address,{strict:!1})||!Array.isArray(i.topics)||typeof i.data!="string"||i.topics.some(u=>typeof u!="string"||!/^0x[0-9a-fA-F]{64}$/.test(u)))throw new o(`Malformed Hookr ${t} receipt log.`);if(i.address.toLowerCase()===A.toLowerCase()&&i.topics[0]?.toLowerCase()===n.toLowerCase()){if(i.topics.length!==4||!/^0x0{24}/i.test(i.topics[2])||t==="OrderCancelled"&&!/^0x0{24}/i.test(i.topics[3])||!/^0x[0-9a-fA-F]*$/.test(i.data)||i.data.length!==2+r*64)throw new o(`Malformed Hookr ${t} receipt log.`);return{topics:i.topics,data:i.data}}}throw new o(`Could not find Hookr ${t} event in transaction receipt logs.`)}function he(e){if(e.receipt!==void 0){if(!F(e.receipt)||!Array.isArray(e.receipt.logs))throw new o("Provide a transaction receipt with a logs array.");return st({logs:e.receipt.logs})}if(e.logs!==void 0){if(!Array.isArray(e.logs))throw new o("Provide receipt logs as an array.");return it(e.logs)}}function Se(e){let t=rt(e,"OrderCreated",Ze,6);try{let n=$e({abi:P,eventName:"OrderCreated",...t,strict:!0});if(pe(we("bool, uint128, uint128, uint128, uint40, address"),[n.args.zeroForOne,n.args.amountIn,n.args.minAmountOut,n.args.bounty,n.args.expiry,n.args.recipient]).toLowerCase()!==t.data.toLowerCase())throw new o("Noncanonical Hookr OrderCreated event data.");return{orderId:n.args.orderId.toString(),owner:l(n.args.owner),poolId:n.args.poolId,zeroForOne:n.args.zeroForOne,amountIn:n.args.amountIn.toString(),minAmountOut:n.args.minAmountOut.toString(),bounty:n.args.bounty.toString(),expiry:n.args.expiry.toString(),recipient:l(n.args.recipient)}}catch{throw new o("Malformed Hookr OrderCreated receipt log.")}}function it(e){return Se({logs:e}).orderId}function st(e){return Se(e).orderId}function xe(e){if(Array.isArray(e)){let[n,r,i,u,s,a,c,w,f,g,k]=e;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:r,createdAt:i,expiry:u,zeroForOne:s,status:a,recipient:c,amountIn:BigInt(w),minAmountOut:BigInt(f),bounty:BigInt(g),sqrtPriceLimitX96:BigInt(k)}}let t=e;return{key:{currency0:t.key.currency0,currency1:t.key.currency1,fee:Number(t.key.fee),tickSpacing:Number(t.key.tickSpacing),hooks:t.key.hooks},owner:t.owner,createdAt:t.createdAt,expiry:t.expiry,zeroForOne:!!t.zeroForOne,status:Number(t.status),recipient:t.recipient,amountIn:BigInt(t.amountIn),minAmountOut:BigInt(t.minAmountOut),bounty:BigInt(t.bounty),sqrtPriceLimitX96:BigInt(t.sqrtPriceLimitX96)}}async function Ce(e,t,n){let r=R(t,"orderId");if(r<=0n)throw new o("Order ID must be a positive integer.");let i=e.clientFor(x),u=n?.order??await i.readContract({address:A,abi:P,functionName:"getOrder",args:[r]}).catch(()=>{throw new o(`Could not read Hookr order #${r}. Order coverage is incomplete.`)}),s=xe(u),a=Number(s.status);if(s.owner.toLowerCase()===L.toLowerCase()||a===ee)throw new o(`Hookr order #${r} does not exist.`);let c={currency0:l(s.key.currency0),currency1:l(s.key.currency1),fee:Number(s.key.fee),tickSpacing:Number(s.key.tickSpacing),hooks:l(s.key.hooks)},w=s.zeroForOne?c.currency0:c.currency1,f=s.zeroForOne?c.currency1:c.currency0,g=m=>{let I=m.toLowerCase(),b=n?.tokens.get(I);if(b)return b;let C=J(m,x,i);return n?.tokens.set(I,C),C},[k,p]=await Promise.all([g(w),g(f)]),y=!1,d=0n;if(a===M)try{let m=await i.readContract({address:A,abi:P,functionName:"quoteFill",args:[r]});if(typeof m[0]!="boolean"||typeof m[1]!="bigint"||m[1]<0n)throw new o(`Invalid quote for Hookr order #${r}.`);y=m[0],d=m[1]}catch{throw new o(`Could not quote Hookr order #${r}. Fillability and output amount are unknown.`)}return{orderId:r.toString(),poolId:Oe(c),key:c,owner:l(s.owner),recipient:l(s.recipient),createdAt:BigInt(s.createdAt).toString(),expiry:BigInt(s.expiry).toString(),zeroForOne:s.zeroForOne,status:a,statusLabel:Je(a),amountIn:s.amountIn.toString(),minAmountOut:s.minAmountOut.toString(),bounty:s.bounty.toString(),sqrtPriceLimitX96:s.sqrtPriceLimitX96.toString(),tokenIn:k,tokenOut:p,fillable:y,quotedAmountOut:d.toString()}}function at(e){return{name:"hookr_create",inputSchema:{type:"object",properties:{key:{type:"object",description:"Uniswap v4 PoolKey of the pool to place the order in; omitted fee, tickSpacing and hooks use Hookr defaults. tokenIn or zeroForOne picks the direction.",properties:{currency0:{type:"string",description:"Lower-sorted pool token address (0x followed by 40 hex digits)."},currency1:{type:"string",description:"Higher-sorted pool token address (0x followed by 40 hex digits)."},fee:{type:"number",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%); default 8388608, the v4 dynamic-fee flag of Hookr pools."},tickSpacing:{type:"number",description:"Pool tick spacing, a positive integer; defaults to the Hookr pool spacing."},hooks:{type:"string",description:"Address of the pool hook contract; defaults to the Hookr root hook."}}},tokenIn:{type:"string",description:"Input token address on chain 4663."},tokenOut:{type:"string",description:"Output token address on chain 4663."},zeroForOne:{type:"boolean",description:"True when selling currency0 for currency1."},amountIn:{type:"string",description:"Input amount in base units (uint128)."},minAmountOut:{type:"string",description:"Minimum net output amount in base units (uint128)."},tick:{type:"number",description:"Optional limit tick in [-887272, 887272]."},expiry:{type:"string",description:"Order expiry unix timestamp in seconds (uint40)."},deadline:{type:"string",description:"Alias for expiry unix timestamp in seconds."},bounty:{type:"string",description:"Keeper bounty in native ETH wei (uint128)."},recipient:{type:"string",description:"Order output recipient address (must be the signing wallet)."},sqrtPriceLimitX96:{type:"string",description:"Optional sqrtPriceLimitX96 (defaults to 0)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["amountIn"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=e.clientFor(i),s=he(t),{key:a,zeroForOne:c}=tt(t),w=c?a.currency0:a.currency1,f=c?a.currency1:a.currency0,[g,k]=await Promise.all([J(w,i,u,t.tokenInMeta),J(f,i,u,t.tokenOutMeta)]),p=t.recipient??r;if(typeof p!="string"||!E(p,{strict:!1}))throw new o("Provide a valid recipient address for the Hookr limit order.");let y=l(p);if(Ie(y,a.hooks),y!==r)throw new o("Hookr recipient must be the signing wallet.");if(typeof t.amountIn!="string")throw new o("Provide amountIn as an integer string in base units.");let d=H(t.amountIn);if(d<=0n||d>Ue)throw new o("amountIn must be between 1 and int128.max base units.");if(t.tick!==void 0){let T=Number(t.tick);Y(T)}let m;if(t.minAmountOut!==void 0){if(typeof t.minAmountOut!="string")throw new o("Provide minAmountOut as an integer string in base units.");m=H(t.minAmountOut)}else if(t.tick!==void 0)m=nt(d,Number(t.tick),c);else throw new o("Provide minAmountOut in base units (or tick to derive minAmountOut).");if(m<=0n||m>le)throw new o("minAmountOut must be between 1 and uint128.max base units.");let I=t.sqrtPriceLimitX96!==void 0?R(t.sqrtPriceLimitX96,"sqrtPriceLimitX96"):0n;if(I>je)throw new o("sqrtPriceLimitX96 exceeds uint160 bounds.");let b=await ot(u,t.now),C=t.expiry??t.deadline,O;if(C!==void 0)O=R(C,"expiry");else if(t.lifetime!==void 0||t.ttlSeconds!==void 0){let T=R(t.lifetime??t.ttlSeconds,"lifetime");O=b+T}else O=b+Xe;if(O<b+ce)throw new o(`Order expiry (${O}) is expired or below the minimum lifetime of ${ce} seconds from block timestamp ${b}.`);if(O>b+ue||O>Ve)throw new o(`Order expiry (${O}) exceeds the maximum lifetime of ${ue} seconds (365 days).`);let z=await u.readContract({address:A,abi:P,functionName:"bountyBounds",args:[a,c,d,m]}).catch(()=>{throw new o("Could not read Hookr bounty bounds.")}),_=BigInt(z[0]),q=BigInt(z[1]),X=BigInt(z[2]);if(t.bounty!==void 0&&typeof t.bounty!="string")throw new o("Provide bounty as an integer string in base units.");let h=t.bounty!==void 0?H(t.bounty):q,K=_>0n?_:q;if(h<_||K>0n&&h<K)throw new o(`Order keeper bounty (${h} wei) is underbounty: must be at least ${K} wei (default keeper bounty floor).`);if(h>X||h>le)throw new o(`Order keeper bounty (${h} wei) exceeds the maximum allowed bounty of ${X} wei.`);let te=w.toLowerCase()===L.toLowerCase(),v=[];if(!te){let T;try{let U=await u.readContract({address:w,abi:Z,functionName:"allowance",args:[r,A]});if(typeof U!="bigint"||U<0n)throw new o("Invalid token allowance.");T=U}catch{throw new o(`Could not read token allowance for ${w}. No approval was prepared.`)}T<d&&v.push(e.approval(w,A,d.toString(),i))}let Pe=te?d+h:h,Le=ye({abi:P,functionName:"createOrder",args:[{key:a,zeroForOne:c,amountIn:d,minAmountOut:m,sqrtPriceLimitX96:I,recipient:y,expiry:Number(O),bounty:h}]}),ne=e.formatAmount(d.toString(),g.decimals),oe=e.formatAmount(m.toString(),k.decimals),re=e.formatAmount(h.toString(),18),Te=e.unsignedTx({to:A,data:Le,value:Pe.toString(),chainId:i,description:`Create Hookr limit order on ${A}: sell ${ne} ${S(g.symbol)} (${g.address}) for at least ${oe} ${S(k.symbol)} (${k.address}) with ${re} ETH keeper bounty (fee=${a.fee}, tickSpacing=${a.tickSpacing}, expiry=${O}).`});v.push(Te);let ie=await e.preview(v,r),Re=Ae(ie,e),He=Oe(a);return{txs:v,summary:`Hookr limit order prepared: sell ${ne} ${S(g.symbol)} for at least ${oe} ${S(k.symbol)} (bounty ${re} ETH, expiry ${O}; preview deltas: ${Re}).`,preview:ie,poolId:He,key:a,zeroForOne:c,amountIn:d.toString(),minAmountOut:m.toString(),bounty:h.toString(),bountyBounds:{minBounty:_.toString(),defaultBounty:q.toString(),maxBounty:X.toString()},expiry:O.toString(),recipient:y,sqrtPriceLimitX96:I.toString(),tokenIn:g,tokenOut:k,...s!==void 0?{orderId:s}:{}}}}}function dt(e){return{name:"hookr_cancel",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"Hookr order ID to cancel (uint256 decimal string)."},to:{type:"string",description:"Recipient address for the refunded principal and bounty (must be the signing wallet)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["orderId"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=he(t),s=t.orderId??t.id??u;if(s===void 0)throw new o("Provide orderId to cancel a Hookr limit order.");let a=R(s,"orderId");if(a<=0n)throw new o("orderId must be a positive integer.");let c=await Ce(e,a);if(c.owner.toLowerCase()!==r.toLowerCase())throw new o(`Unauthorized cancellation: only the order owner (${c.owner}) can cancel Hookr order #${a} (caller is ${r}).`);if(c.status!==M)throw new o(`Hookr order #${a} is not open (current status: ${c.statusLabel}).`);let w=t.to??r;if(typeof w!="string"||!E(w,{strict:!1}))throw new o("Provide a valid refund recipient address for cancel.");let f=l(w);if(Ie(f,c.key.hooks),f!==r)throw new o("Hookr refund recipient must be the signing wallet.");let g=ye({abi:P,functionName:"cancel",args:[a,f]}),k=e.formatAmount(c.amountIn,c.tokenIn.decimals),p=e.formatAmount(c.bounty,18),y=e.unsignedTx({to:A,data:g,value:"0",chainId:i,description:`Cancel Hookr limit order #${a} on ${A} and refund ${k} ${S(c.tokenIn.symbol)} plus ${p} ETH bounty to ${f}.`}),d=await e.preview([y],r),m=Ae(d,e);return{txs:[y],summary:`Cancel Hookr limit order #${a}: refund ${k} ${S(c.tokenIn.symbol)} and ${p} ETH bounty to ${f} (preview deltas: ${m}).`,preview:d,orderId:a.toString(),to:f,refundedAmountIn:c.amountIn,refundedBounty:c.bounty,tokenIn:c.tokenIn,tokenOut:c.tokenOut}}}}function ct(e){let t=performance.now()+Ke;return new Proxy(e,{get(n,r,i){return r!=="readContract"?Reflect.get(n,r,i):async(...u)=>{let s=t-performance.now(),a=()=>new o("Hookr scan deadline exceeded. Order coverage is incomplete; retry later.");if(s<=0)throw a();let c;try{return await Promise.race([n.readContract(...u),new Promise((w,f)=>{c=setTimeout(()=>f(a()),s)})])}finally{c!==void 0&&clearTimeout(c)}}}})}function ut(e){return async t=>{N(t);let n=l(t),r=ct(e.clientFor(x)),i={...e,clientFor:()=>r},u=await r.readContract({address:A,abi:P,functionName:"lastOrderId"}).catch(()=>{throw new o("Could not read the last Hookr order ID. Order coverage is incomplete.")});if(typeof u!="bigint"||u<0n)throw new o("Could not read a valid last Hookr order ID. Order coverage is incomplete.");let s=u,a=s>me?s-me+1n:1n;if(s<=0n)return[];let c=[],w=new Map;for(let f=a;f<=s;f+=Q){let g=Array.from({length:Number(s-f+1n<Q?s-f+1n:Q)},(p,y)=>f+BigInt(y)),k=await Promise.all(g.map(async p=>{let y=await r.readContract({address:A,abi:P,functionName:"getOrder",args:[p]}).catch(()=>{throw new o(`Could not read Hookr order #${p}. Order coverage is incomplete.`)}),d=xe(y);if(d.owner.toLowerCase()===L||Number(d.status)===ee)throw new o(`Hookr order #${p} does not exist. Order coverage is incomplete.`);return{id:p,order:d}}));for(let{id:p,order:y}of k){if(y.owner.toLowerCase()!==n.toLowerCase()||Number(y.status)!==M)continue;let d=await Ce(i,p,{order:y,tokens:w}),m=[{token:d.tokenIn,amount:d.amountIn}];BigInt(d.bounty)>0n&&m.push({token:{address:B,symbol:"ETH",decimals:18,chainId:x},amount:d.bounty});let I=e.formatAmount(d.amountIn,d.tokenIn.decimals),b=e.formatAmount(d.minAmountOut,d.tokenOut.decimals),C=e.formatAmount(d.bounty,18),O=e.formatAmount(d.quotedAmountOut,d.tokenOut.decimals);c.push({module:"hookr",id:d.orderId,chainId:x,assets:m,description:`Hookr open limit order #${d.orderId}: sell ${I} ${S(d.tokenIn.symbol)} (${d.tokenIn.address}) for at least ${b} ${S(d.tokenOut.symbol)} (${d.tokenOut.address}), bounty ${C} ETH, expiry ${d.expiry}, fillable=${d.fillable} (quoted output ${O} ${S(d.tokenOut.symbol)}).`})}}return a>1n&&c.push({module:"hookr",id:"coverage",chainId:x,assets:[],description:`Hookr order coverage is incomplete: scanned IDs ${a}-${s}. Older orders require an explicit order ID.`}),c}}var De=e=>{let t=[at(e),dt(e)],n=ut(e);return{tools:t,positions:n}},Lt=De,Tt=De;export{A as a,ve as b,Ne as c,It as d,Be as e,Fe as f,At as g,Me as h,ze as i,qe as j,ce as k,Xe as l,ue as m,ht as n,St as o,xt as p,Ct as q,me as r,Ke as s,ee as t,M as u,Ye as v,Qe as w,Ze as x,Dt as y,P as z,et as A,Pt as B,Oe as C,rt as D,Se as E,it as F,st as G,xe as H,Ce as I,at as J,dt as K,ct as L,ut as M,De as N,Lt as O,Tt as P};
@@ -1 +1 @@
1
- import{b as z,c as I}from"./SPRVVJXI.js";import{b as W}from"./TM7Z5SA4.js";import{d as R,e as _}from"./XV6F3RET.js";import{K as E}from"./7QKYDNF6.js";import{a as F}from"./43LI5NKJ.js";import{d as H,g as A,i as j}from"./NWNYJ26T.js";import{a as C,s as S}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as M,erc20Abi as V,getAddress as Z,keccak256 as K,zeroAddress as x}from"viem";var r=R.turbo,h=R.blackjack,g=m=>j(m,"Provide an explicit card address.",H);function G(m,d){if(/^uint\d*\[\]$/.test(m.type)&&Array.isArray(d))return d.map(c=>G({...m,type:m.type.slice(0,-2)},c));if(/^uint\d*$/.test(m.type)&&(typeof d!="string"||!/^(0|[1-9]\d*)$/.test(d)))throw new s("Card integers must be canonical decimal strings, without leading zeros.");return W(m,d)}var J=["buy","cashOut","claimExpiry","refund","safeTransferFrom","safeBatchTransferFrom"],X=["liquidate","recordKnock","liquidateKnock","clearKnock","recordDrift","settle","markVoid","depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries","haltSales","resumeSales","sweepFees","skim"],Q=m=>m==="netnet_turbo_action"||m.startsWith("netnet_blackjack_")&&["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"].includes(m);async function de(m,d,c,k){if(F(c),!Q(m))throw new s("No local NetNet card action builder exists.");let v=m!=="netnet_turbo_action";if(Object.keys(d).some(e=>!(v?["sessionId","seriesId"]:["operation","values","minimum","allowZeroPayout"]).includes(e)))throw new s("Unexpected card action argument.");if(v&&!z(m,d))throw new s("Recovery accepts exactly one positive decimal session or series ID.");if(await k.getChainId()!==C)throw new s("NetNet cards require chain 4663.");let w=await k.getBlock();if(w.number===null||!w.hash)throw new s("Card action block is unavailable.");let p=(e,t,i=[])=>k.readContract({address:e.address,abi:e.abi,functionName:t,args:i,blockNumber:w.number});for(let e of v?[r,h]:[r]){let t=await k.getCode({address:e.address,blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet card runtime changed or is unavailable. Requalify this deployment before signing.")}for(let e of v?Object.values(_):[_.turbo]){let t=await k.getCode({address:Z(e.address),blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet linked card library changed or is unavailable. Requalify before signing.")}let l={txs:[],inputs:[],cards:[],decision:"",blockNumber:w.number,blockHash:w.hash},$=(e,t,i,a,o)=>({chainId:4663,collection:r.address,operator:e,from:t,to:i,id:a,amount:o,operation:t===x?"mint":i===x?"burn":"transfer"}),T=(e,t,i,a,o=[])=>{l.txs.push({to:e,chainId:C,value:"0",data:M({abi:t,functionName:i,args:a}),description:l.decision}),l.cards.push(o)},D=(e,t)=>{if(t<=0n||t>=1n<<128n)throw new s("Card payment must be positive and below the exact-approval ceiling.");l.inputs.push({token:e,amount:t,to:r.address}),T(e,V,"approve",[r.address,t])};if(v){if(g(await p(h,"cards"))!==r.address||g(await p(h,"turbo"))!==r.address)throw new s("Blackjack card wiring changed.");let e=m==="netnet_blackjack_claim";if(Object.keys(d).some(b=>b!==(e?"seriesId":"sessionId")))throw new s("Recovery accepts only its one exact session or series ID.");let t=E(e?d.seriesId:d.sessionId),i,a,o,u="Original-series parked payout; self-claim only.";if(e){if(i=t,a=await p(h,"unclaimedChips",[t,c]),o="claimUnclaimedChips",a===0n)throw new s("This wallet has no parked chips for that series.")}else{let b=await p(h,"sessionOf",[t]);if(!b||!A(b.player,c))throw new s("Recovery is limited to this wallet\u2019s recorded blackjack session.");let y=m==="netnet_blackjack_finalize";if(o=y?"finalize":"expireSession",b.state!==(y?2:1))throw new s(y?"Session is not Closing. Use its current on-chain state to choose recovery.":"Session is not Open. A Closing session uses finalize after its challenge window.");let N=y?b.closeAt:b.deadline;if(u=y?`Challenge ends ${new Date(Number(N)*1e3).toISOString()}.`:`Session deadline ${new Date(Number(N)*1e3).toISOString()}; player-only expiry until ${new Date(Number(N+3600n)*1e3).toISOString()}.`,w.timestamp<N)throw new s(`Recovery is not due until ${N} Unix seconds.`);i=await p(h,"tableSeries"),a=b.chips}if(i<=0n||a<0n)throw new s("Blackjack recovery accounting is unavailable.");return l.decision=`${o} ${e?"series":"session"} ${t} at ${h.address}: return ${a} whole cards of collection ${r.address}, series ${i}, to ${Z(c)}. ${u} Last on-chain chips may omit off-chain winnings; cards may be worthless. A failed receiver parks the payout at ${h.address}; self-claim only. ETH gas extra.`,T(h.address,h.abi,o,[t],a===0n?[]:[$(h.address,h.address,c,i,a)]),l.recovery={...e?{}:{sessionId:t.toString()},seriesId:i.toString(),count:a.toString(),player:c,operation:o},l}let n=String(d.operation);if(n==="setApprovalForAll")throw new s(I.setApprovalForAll);if(["convertPremiums","convertSleeveFees"].includes(n))throw new s(I.conversion);if(![...J,...X].includes(n))throw new s("Choose a qualified finite TURBO operation.");if(!Array.isArray(d.values))throw new s("Provide ordered TURBO values using decimal integer strings.");let U=n==="safeTransferFrom"||n==="safeBatchTransferFrom",B=r.abi.find(e=>e.name===n),q=U?B.inputs.slice(1,-1):B.inputs;if(d.values.length!==q.length)throw new s("TURBO values do not match the exact operation inputs.");let f=q.map((e,t)=>G(e,d.values[t])),O=g(await p(r,"manager")),L=g(await p(r,"sleeve")),P=[];if(U){if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Transfer has no payout floor.");let e=g(f[0]);if(e===x||A(e,c))throw new s("Name a nonzero, non-self card recipient.");let t=await k.getCode({address:e,blockNumber:w.number});if(t&&t!=="0x")throw new s("Card transfer to a contract requires qualified credit and recovery. New blackjack seating remains disabled.");let i=n==="safeTransferFrom"?[f[1]]:f[1],a=n==="safeTransferFrom"?[f[2]]:f[2];if(!i.length||i.length>8||i.length!==a.length||new Set(i.map(String)).size!==i.length||i.some((o,u)=>o<=0n||a[u]<=0n||u>0&&o<=i[u-1]))throw new s("Use at most eight unique positive series IDs in increasing order and exact positive counts.");for(let o=0;o<i.length;o++){if(await p(r,"balanceOf",[c,i[o]])<a[o])throw new s("Card transfer exceeds this wallet\u2019s balance.");P.push($(c,c,e,i[o],a[o])),l.inputs.push({token:r.address,id:i[o],amount:a[o],to:e,exact:!0})}l.decision=`Transfer whole cards of collection ${r.address}: ${i.map((o,u)=>`series ${o} count ${a[u]}`).join(", ")} to ${e}. Basis does not travel with cards; no operator approval. No payout; transfer is irreversible. ETH gas extra.`,f=[c,...f,"0x"]}else if(["buy","cashOut","claimExpiry","refund"].includes(n)){let e=f[0],t=f[1],i=await p(r,"seriesOf",[e]);if(!i||i.asset===x||t<=0n)throw new s("Choose a known series and positive whole-card count.");let a=i.side===0?g(i.asset):S.mainnet.usdg,o=await k.readContract({address:a,abi:V,functionName:"decimals",blockNumber:w.number});if((n==="buy"||n==="cashOut")&&(i.state!==1||w.timestamp>=i.expiry))throw new s("This TURBO series is not OPEN and unexpired.");if(n==="buy"){let[u]=await p(r,"quoteBuy",[e,t]);if(!u||u>f[2])throw new s("Current card quote exceeds the explicit maximum USDG payment.");if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Buy uses its exact count and maximum USDG price.");l.decision=`Spend at most ${f[2]} USDG base units (${S.mainnet.usdg}, decimals 6) at ${r.address}; receive ${t} whole cards, collection ${r.address}, series ${e}, into this wallet. Exact quoted approval ${u}; fees included. Strike ${i.strikeWad} WAD; expiry ${new Date(Number(i.expiry)*1e3).toISOString()}; cards can lose all value. Any residual USDG allowance requires zero cleanup. ETH gas extra.`,D(S.mainnet.usdg,u),P=[$(c,x,c,e,t)]}else{if(n==="cashOut"&&d.minimum!==void 0)throw new s("cashOut takes its one encoded minimum in values, not a second local minimum.");if(await p(r,"balanceOf",[c,e])<t)throw new s("Card burn exceeds this wallet\u2019s balance.");let u=n==="cashOut"?f[2]:E(d.minimum,!0);if(u===0n&&d.allowZeroPayout!==!0)throw new s("A zero payout floor requires allowZeroPayout:true and explicit human confirmation.");let b=0n;if(n==="cashOut"){let y=await p(r,"quoteCashOut",[e,t,c]);if(y[0]<u)throw new s("The current cash-out quote misses the payout minimum.");b=y[1]}else if(i.state!==(n==="claimExpiry"?3:4))throw new s("Expiry claims require EXPIRED; pro-rata refunds require VOID.");l.decision=`Burn ${t} whole cards of ${r.address}, series ${e}; ${n==="refund"?"series pro-rata VOID refund, not personal purchase-price repayment":n}; receive >=${u} base units of ${a} (decimals ${o}) into this wallet. ${n==="cashOut"?`Minimum encoded in calldata; current performance fee ${b}.`:"Floor is local simulation only; no on-chain minimum. Settled payout includes applicable fees."} Burned cards cannot be returned; ETH gas extra.`,P=[$(c,c,x,e,t)],l.inputs.push({token:r.address,id:e,amount:t,to:x,exact:!0}),l.receipt={token:a,minimum:u,recipient:c,enforcement:n==="cashOut"?"calldata":"simulation"}}}else{if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("This TURBO operation has no caller payout floor.");if(["withdrawHouse","withdrawPutPot","createSeries","resumeSales"].includes(n)&&!A(O,c))throw new s(`This TURBO operation requires manager ${O}.`);if(n==="haltSales"&&!A(c,O)&&!A(c,g(await p(r,"halter"))))throw new s("TURBO haltSales requires the current manager or halter.");if(["depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries"].includes(n)){let t=g(f[0]);if(!(await Promise.all(["asset0","asset1","asset2"].map(a=>p(r,a)))).some(a=>typeof a=="string"&&A(a,t)))throw new s("This is not a pinned TURBO reserve asset.")}l.decision=`${n} at ${r.address}; values ${JSON.stringify(f,(t,i)=>typeof i=="bigint"?String(i):i)}. Protocol capital/accounting action; manager ${O}; sleeve ${L}; no caller reward. ${n.startsWith("deposit")?"Irreversible house funding; no personal withdrawable balance.":n.startsWith("withdraw")?"Pays the current manager; operating and reservation floors still apply.":"Series state, risk or protocol fee allocation may change."} No card approval; ETH gas extra.`,(n==="depositHouse"||n==="depositPutPot")&&D(n==="depositHouse"?g(f[0]):S.mainnet.usdg,f[1])}if(l.decision.length>1024)throw new s("Card decision terms exceed the complete confirmation label capacity. Use fewer card IDs.");T(r.address,r.abi,n,f,P);for(let e of l.txs)e.description=l.decision;return l}export{J as a,X as b,Q as c,de as d};
1
+ import{b as W}from"./DMDOSHV7.js";import{d as R,e as _}from"./XV6F3RET.js";import{b as z,c as I}from"./LFSJDFMY.js";import{K as E}from"./JPPQDELB.js";import{a as F}from"./43LI5NKJ.js";import{d as H,g as A,i as j}from"./NWNYJ26T.js";import{b as C,t as S}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as M,erc20Abi as V,getAddress as Z,keccak256 as K,zeroAddress as x}from"viem";var r=R.turbo,h=R.blackjack,g=m=>j(m,"Provide an explicit card address.",H);function G(m,d){if(/^uint\d*\[\]$/.test(m.type)&&Array.isArray(d))return d.map(c=>G({...m,type:m.type.slice(0,-2)},c));if(/^uint\d*$/.test(m.type)&&(typeof d!="string"||!/^(0|[1-9]\d*)$/.test(d)))throw new s("Card integers must be canonical decimal strings, without leading zeros.");return W(m,d)}var J=["buy","cashOut","claimExpiry","refund","safeTransferFrom","safeBatchTransferFrom"],X=["liquidate","recordKnock","liquidateKnock","clearKnock","recordDrift","settle","markVoid","depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries","haltSales","resumeSales","sweepFees","skim"],Q=m=>m==="netnet_turbo_action"||m.startsWith("netnet_blackjack_")&&["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"].includes(m);async function de(m,d,c,k){if(F(c),!Q(m))throw new s("No local NetNet card action builder exists.");let v=m!=="netnet_turbo_action";if(Object.keys(d).some(e=>!(v?["sessionId","seriesId"]:["operation","values","minimum","allowZeroPayout"]).includes(e)))throw new s("Unexpected card action argument.");if(v&&!z(m,d))throw new s("Recovery accepts exactly one positive decimal session or series ID.");if(await k.getChainId()!==C)throw new s("NetNet cards require chain 4663.");let w=await k.getBlock();if(w.number===null||!w.hash)throw new s("Card action block is unavailable.");let p=(e,t,i=[])=>k.readContract({address:e.address,abi:e.abi,functionName:t,args:i,blockNumber:w.number});for(let e of v?[r,h]:[r]){let t=await k.getCode({address:e.address,blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet card runtime changed or is unavailable. Requalify this deployment before signing.")}for(let e of v?Object.values(_):[_.turbo]){let t=await k.getCode({address:Z(e.address),blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet linked card library changed or is unavailable. Requalify before signing.")}let l={txs:[],inputs:[],cards:[],decision:"",blockNumber:w.number,blockHash:w.hash},$=(e,t,i,a,o)=>({chainId:4663,collection:r.address,operator:e,from:t,to:i,id:a,amount:o,operation:t===x?"mint":i===x?"burn":"transfer"}),T=(e,t,i,a,o=[])=>{l.txs.push({to:e,chainId:C,value:"0",data:M({abi:t,functionName:i,args:a}),description:l.decision}),l.cards.push(o)},D=(e,t)=>{if(t<=0n||t>=1n<<128n)throw new s("Card payment must be positive and below the exact-approval ceiling.");l.inputs.push({token:e,amount:t,to:r.address}),T(e,V,"approve",[r.address,t])};if(v){if(g(await p(h,"cards"))!==r.address||g(await p(h,"turbo"))!==r.address)throw new s("Blackjack card wiring changed.");let e=m==="netnet_blackjack_claim";if(Object.keys(d).some(b=>b!==(e?"seriesId":"sessionId")))throw new s("Recovery accepts only its one exact session or series ID.");let t=E(e?d.seriesId:d.sessionId),i,a,o,u="Original-series parked payout; self-claim only.";if(e){if(i=t,a=await p(h,"unclaimedChips",[t,c]),o="claimUnclaimedChips",a===0n)throw new s("This wallet has no parked chips for that series.")}else{let b=await p(h,"sessionOf",[t]);if(!b||!A(b.player,c))throw new s("Recovery is limited to this wallet\u2019s recorded blackjack session.");let y=m==="netnet_blackjack_finalize";if(o=y?"finalize":"expireSession",b.state!==(y?2:1))throw new s(y?"Session is not Closing. Use its current on-chain state to choose recovery.":"Session is not Open. A Closing session uses finalize after its challenge window.");let N=y?b.closeAt:b.deadline;if(u=y?`Challenge ends ${new Date(Number(N)*1e3).toISOString()}.`:`Session deadline ${new Date(Number(N)*1e3).toISOString()}; player-only expiry until ${new Date(Number(N+3600n)*1e3).toISOString()}.`,w.timestamp<N)throw new s(`Recovery is not due until ${N} Unix seconds.`);i=await p(h,"tableSeries"),a=b.chips}if(i<=0n||a<0n)throw new s("Blackjack recovery accounting is unavailable.");return l.decision=`${o} ${e?"series":"session"} ${t} at ${h.address}: return ${a} whole cards of collection ${r.address}, series ${i}, to ${Z(c)}. ${u} Last on-chain chips may omit off-chain winnings; cards may be worthless. A failed receiver parks the payout at ${h.address}; self-claim only. ETH gas extra.`,T(h.address,h.abi,o,[t],a===0n?[]:[$(h.address,h.address,c,i,a)]),l.recovery={...e?{}:{sessionId:t.toString()},seriesId:i.toString(),count:a.toString(),player:c,operation:o},l}let n=String(d.operation);if(n==="setApprovalForAll")throw new s(I.setApprovalForAll);if(["convertPremiums","convertSleeveFees"].includes(n))throw new s(I.conversion);if(![...J,...X].includes(n))throw new s("Choose a qualified finite TURBO operation.");if(!Array.isArray(d.values))throw new s("Provide ordered TURBO values using decimal integer strings.");let U=n==="safeTransferFrom"||n==="safeBatchTransferFrom",B=r.abi.find(e=>e.name===n),q=U?B.inputs.slice(1,-1):B.inputs;if(d.values.length!==q.length)throw new s("TURBO values do not match the exact operation inputs.");let f=q.map((e,t)=>G(e,d.values[t])),O=g(await p(r,"manager")),L=g(await p(r,"sleeve")),P=[];if(U){if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Transfer has no payout floor.");let e=g(f[0]);if(e===x||A(e,c))throw new s("Name a nonzero, non-self card recipient.");let t=await k.getCode({address:e,blockNumber:w.number});if(t&&t!=="0x")throw new s("Card transfer to a contract requires qualified credit and recovery. New blackjack seating remains disabled.");let i=n==="safeTransferFrom"?[f[1]]:f[1],a=n==="safeTransferFrom"?[f[2]]:f[2];if(!i.length||i.length>8||i.length!==a.length||new Set(i.map(String)).size!==i.length||i.some((o,u)=>o<=0n||a[u]<=0n||u>0&&o<=i[u-1]))throw new s("Use at most eight unique positive series IDs in increasing order and exact positive counts.");for(let o=0;o<i.length;o++){if(await p(r,"balanceOf",[c,i[o]])<a[o])throw new s("Card transfer exceeds this wallet\u2019s balance.");P.push($(c,c,e,i[o],a[o])),l.inputs.push({token:r.address,id:i[o],amount:a[o],to:e,exact:!0})}l.decision=`Transfer whole cards of collection ${r.address}: ${i.map((o,u)=>`series ${o} count ${a[u]}`).join(", ")} to ${e}. Basis does not travel with cards; no operator approval. No payout; transfer is irreversible. ETH gas extra.`,f=[c,...f,"0x"]}else if(["buy","cashOut","claimExpiry","refund"].includes(n)){let e=f[0],t=f[1],i=await p(r,"seriesOf",[e]);if(!i||i.asset===x||t<=0n)throw new s("Choose a known series and positive whole-card count.");let a=i.side===0?g(i.asset):S.mainnet.usdg,o=await k.readContract({address:a,abi:V,functionName:"decimals",blockNumber:w.number});if((n==="buy"||n==="cashOut")&&(i.state!==1||w.timestamp>=i.expiry))throw new s("This TURBO series is not OPEN and unexpired.");if(n==="buy"){let[u]=await p(r,"quoteBuy",[e,t]);if(!u||u>f[2])throw new s("Current card quote exceeds the explicit maximum USDG payment.");if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Buy uses its exact count and maximum USDG price.");l.decision=`Spend at most ${f[2]} USDG base units (${S.mainnet.usdg}, decimals 6) at ${r.address}; receive ${t} whole cards, collection ${r.address}, series ${e}, into this wallet. Exact quoted approval ${u}; fees included. Strike ${i.strikeWad} WAD; expiry ${new Date(Number(i.expiry)*1e3).toISOString()}; cards can lose all value. Any residual USDG allowance requires zero cleanup. ETH gas extra.`,D(S.mainnet.usdg,u),P=[$(c,x,c,e,t)]}else{if(n==="cashOut"&&d.minimum!==void 0)throw new s("cashOut takes its one encoded minimum in values, not a second local minimum.");if(await p(r,"balanceOf",[c,e])<t)throw new s("Card burn exceeds this wallet\u2019s balance.");let u=n==="cashOut"?f[2]:E(d.minimum,!0);if(u===0n&&d.allowZeroPayout!==!0)throw new s("A zero payout floor requires allowZeroPayout:true and explicit human confirmation.");let b=0n;if(n==="cashOut"){let y=await p(r,"quoteCashOut",[e,t,c]);if(y[0]<u)throw new s("The current cash-out quote misses the payout minimum.");b=y[1]}else if(i.state!==(n==="claimExpiry"?3:4))throw new s("Expiry claims require EXPIRED; pro-rata refunds require VOID.");l.decision=`Burn ${t} whole cards of ${r.address}, series ${e}; ${n==="refund"?"series pro-rata VOID refund, not personal purchase-price repayment":n}; receive >=${u} base units of ${a} (decimals ${o}) into this wallet. ${n==="cashOut"?`Minimum encoded in calldata; current performance fee ${b}.`:"Floor is local simulation only; no on-chain minimum. Settled payout includes applicable fees."} Burned cards cannot be returned; ETH gas extra.`,P=[$(c,c,x,e,t)],l.inputs.push({token:r.address,id:e,amount:t,to:x,exact:!0}),l.receipt={token:a,minimum:u,recipient:c,enforcement:n==="cashOut"?"calldata":"simulation"}}}else{if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("This TURBO operation has no caller payout floor.");if(["withdrawHouse","withdrawPutPot","createSeries","resumeSales"].includes(n)&&!A(O,c))throw new s(`This TURBO operation requires manager ${O}.`);if(n==="haltSales"&&!A(c,O)&&!A(c,g(await p(r,"halter"))))throw new s("TURBO haltSales requires the current manager or halter.");if(["depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries"].includes(n)){let t=g(f[0]);if(!(await Promise.all(["asset0","asset1","asset2"].map(a=>p(r,a)))).some(a=>typeof a=="string"&&A(a,t)))throw new s("This is not a pinned TURBO reserve asset.")}l.decision=`${n} at ${r.address}; values ${JSON.stringify(f,(t,i)=>typeof i=="bigint"?String(i):i)}. Protocol capital/accounting action; manager ${O}; sleeve ${L}; no caller reward. ${n.startsWith("deposit")?"Irreversible house funding; no personal withdrawable balance.":n.startsWith("withdraw")?"Pays the current manager; operating and reservation floors still apply.":"Series state, risk or protocol fee allocation may change."} No card approval; ETH gas extra.`,(n==="depositHouse"||n==="depositPutPot")&&D(n==="depositHouse"?g(f[0]):S.mainnet.usdg,f[1])}if(l.decision.length>1024)throw new s("Card decision terms exceed the complete confirmation label capacity. Use fewer card IDs.");T(r.address,r.abi,n,f,P);for(let e of l.txs)e.description=l.decision;return l}export{J as a,X as b,Q as c,de as d};
@@ -0,0 +1 @@
1
+ var c={chainId:4663,owner:"0x8A22d6e75e9427b9D57e42a7984200029e7E173C",curator:"0x8A22d6e75e9427b9D57e42a7984200029e7E173C",factory:{address:"0x0FBad98595b0186dA120E41f77C102beb49f803c",codeHash:"0xba55eb73d42937607d7e3c77f68353c2517c4fad4df02f0c9bbd2e4248475503",membershipFunction:"isVaultV2",creationEvent:"CreateVaultV2(address,address,bytes32,address)",fromBlock:"0",source:"https://github.com/morpho-org/vault-v2/blob/main/src/VaultV2Factory.sol",measuredAtBlock:"106289278"},builders:{address:"0x082Ae609bdC7ccEec0C58B2361a21c49dc2aE291",codeHash:"0x1fcfd90e9aa3c0fe6310723d51ae7a6b3a671702a789415ad9044bcb0228bcf4",source:"https://github.com/Borro-Markets/contracts/blob/main/src/BorroBuilders.sol"},assetRule:{usdg:{address:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",symbol:"USDG",decimals:6},officialStockRegistry:"https://api.robinhood.com/rhj/assets"},source:"https://borro.markets/contracts.json"},e="0x6f616b0000000000000000000000000000000000000000000000000000000000",a=[...[{chainId:4663,symbol:"SPY",entry:"0xc3ed4a5a7db4102f4ed37af26ef0d3f21e2360c1",proxy:"0x117cc2133c37b721f49de2a7a74833232b3b4c0c",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"QQQ",entry:"0xbad8a97da1050092d6a14194d53e72d407d6cc17",proxy:"0xd5f3879160bc7c32ebb4dc785f8a4f505888de68",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"NVDA",entry:"0x508e23274c39c60c345e35b1f0188be180717cb9",proxy:"0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"TSLA",entry:"0x60b3d353e7e5bd12ed4ea2589c11b5603dd4c988",proxy:"0x322f0929c4625ed5bad873c95208d54e1c003b2d",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"MSTR",entry:"0x2b74f8f2b76cd4e97265bc37fb2578a04b8437e9",proxy:"0xec262a75e413fafd0df80480274532c79d42da09",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"COIN",entry:"0x7ba71bccecb12860ae7e141b6b6f1f8b96d31257",proxy:"0x6330d8c3178a418788df01a47479c0ce7ccf450b",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"PLTR",entry:"0xfe9419e70e5481f7a2ddddc18f856b09b3687b27",proxy:"0x894e1ec2d74ffe5aef8dc8a9e84686accb964f2a",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"SPCX",entry:"0x1261210e19052157fce2064d9aa9a2140bd89791",proxy:"0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"GME",entry:"0x328461fb01f54c2ab73909ea947c583d0dc24c3d",proxy:"0x1b0e319c6a659f002271b69db8a7df2f911c153e",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"AAPL",entry:"0x24fe7bcaeb75bc2202a42ecd48a177a27782c64a",proxy:"0xaf3d76f1834a1d425780943c99ea8a608f8a93f9",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"GOOGL",entry:"0xf0731b1022abd1e3f543cfd837c7eba42ed60e4f",proxy:"0x2e0847e8910a9732eb3fb1bb4b70a580adad4fe3",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"},{chainId:4663,symbol:"MSFT",entry:"0x8032c80a7817a3c4c401b096515b27b2ceda4e71",proxy:"0xe93237c50d904957cf27e7b1133b510c669c2e74",proxyCodeHash:"0x6c1fdd40002dcb440c7fff6a84171404d279ccb057803b65826f7546acd65630",implementation:"0xb35490d6f9163de4f80d88dc75c3516eb64c5ae2",codeHash:"0xdc07e86ee482f99641bdafb9a0d772846b167401e094d90a666b94dbdcd1eec7",measuredAtBlock:"106350992",source:"https://rpc.mainnet.chain.robinhood.com"}].flatMap(d=>[d,{...d,entry:d.proxy},{...d,entry:c.builders.address.toLowerCase()}]),{chainId:4663,symbol:"USDG",entry:c.builders.address.toLowerCase(),proxy:"0x5fc5360d0400a0fd4f2af552add042d716f1d168",proxyCodeHash:"0x864cc9ad53b338b82da1f7cab85ab0b3d5c8861acb422b6fec63cf36234f36a6",implementation:"0x68184c449e1a8f34fa18d289737129fd27b66f8f",codeHash:"0x3a551ac5c744af57e68a1d1431ac403c0f516ffd7d224a75746aee11fc4f3baf",measuredAtBlock:"106936475",source:"https://rpc.mainnet.chain.robinhood.com"}];export{c as a,e as b,a as c};
@@ -1 +1 @@
1
- import{a as E}from"./43LI5NKJ.js";import{c as O}from"./SCG5HWMN.js";import{c as C,e as u,g as I}from"./NWNYJ26T.js";import{a as m}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{getAddress as k}from"viem";var D="https://api.velora.xyz/v2/delta",A=["PENDING","AWAITING_SIGNATURE","ACTIVE","SUSPENDED","CANCELLING","BRIDGING","COMPLETED","FAILED","EXPIRED","REFUNDING","CANCELLED","REFUNDED"],w=["Order","FillableOrder","ProductiveOrder","ExternalOrder","TWAPOrder","TWAPBuyOrder"],x="^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";function i(e){if(!e)throw new y("Velora Delta returned an unexpected response.")}function l(e){if(typeof e!="string")throw new y("Provide an address.");return E(e),k(e)}function N(e,p,o){if(e===void 0)return o;if(typeof e!="number"||!Number.isSafeInteger(e)||e<1||e>p)throw new y(`Provide an integer between 1 and ${p}.`);return e}function b(e,p){if(typeof e!="string"||!p.includes(e))throw new y(`Choose one of: ${p.join(", ")}.`);return e}function T(e){i(u(e)&&Number.isSafeInteger(e.chainId)&&Number(e.chainId)>0);let p=l(e.token);for(let o of["amount","expectedAmount","executedAmount"])i(e[o]===void 0||e[o]===null||typeof e[o]=="string"&&/^(0|[1-9][0-9]*)$/.test(e[o])&&BigInt(e[o])<1n<<256n);return i(typeof e.amount=="string"||typeof e.expectedAmount=="string"),{chainId:e.chainId,token:p,...Object.fromEntries(["amount","expectedAmount","executedAmount"].filter(o=>e[o]!==void 0).map(o=>[o,e[o]]))}}function P(e,p,o){i(u(e)&&typeof e.id=="string"&&new RegExp(x).test(e.id)),i(o===void 0||I(e.id,o));let h=l(e.owner);i(I(h,p)),i(typeof e.status=="string"&&A.includes(e.status)),i(e.side==="SELL"||e.side==="BUY"),i(e.type==="MARKET"||e.type==="LIMIT"),i(typeof e.onChainOrderType=="string"&&w.includes(e.onChainOrderType));let t=T(e.input);i(t.chainId===m);let a=T(e.output);i(typeof e.orderHash=="string"&&/^0x[0-9a-fA-F]{64}$/.test(e.orderHash)),i(Array.isArray(e.transactions)&&Array.isArray(e.refunds));for(let r of e.transactions){i(u(r)&&typeof r.originTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.originTx)),i(r.destinationTx===void 0||r.destinationTx===null||typeof r.destinationTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.destinationTx)),i(typeof r.filledPercent=="number"&&Number.isFinite(r.filledPercent)&&r.filledPercent>=0&&r.filledPercent<=100);for(let d of["spentAmount","receivedAmount"])i(r[d]===void 0||r[d]===null||typeof r[d]=="string"&&/^(0|[1-9][0-9]*)$/.test(r[d]))}let n=e.refunds.map(r=>(i(u(r)&&typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)),{...T(r),tx:r.tx}));return{id:e.id,status:e.status,side:e.side,type:e.type,onChainOrderType:e.onChainOrderType,owner:h,beneficiary:l(e.beneficiary),orderHash:e.orderHash,input:t,output:a,transactions:structuredClone(e.transactions),refunds:n,...Object.fromEntries(["createdAt","updatedAt","expiresAt"].filter(r=>typeof e[r]=="string").map(r=>[r,e[r]]))}}function L(e){function p(t,a,n,r){return{name:t,inputSchema:{type:"object",additionalProperties:!1,properties:a,required:n},execute:async(d,s)=>{try{l(s);for(let c of Object.keys(d))if(!Object.hasOwn(a,c))throw new y(`Unsupported ${t} argument: ${c}.`);return await r(d,s)}catch(c){throw new y(e.plainError(c))}}}}let o=t=>O(e.http,`${D}/${t}`,{method:"GET"},u),h="Provider activity is not receipt proof. Token amounts are base units; resolve symbols and decimals with find_token. Delta signing and submission are not enabled in Oak.";return[p("velora_delta_token_support",{token:{...C,description:"Address of the token to inspect or use."}},["token"],async t=>{let a=l(t.token),n=await o(`prices/is-token-supported?${new URLSearchParams({chainId:String(m),token:a})}`);return i(typeof n.supported=="boolean"),{token:a,chainId:m,supported:n.supported}}),p("velora_delta_orders",{page:{description:"Result page number, starting at 1; defaults to 1.",type:"integer",minimum:1},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:1e3},type:{description:'Choose "MARKET" for a market order or "LIMIT" for a limit order.',type:"string",enum:["MARKET","LIMIT"]},status:{description:"Filter by the listed Delta lifecycle statuses; omit to include all statuses.",type:"array",minItems:1,maxItems:A.length,items:{type:"string",enum:A}},onChainOrderType:{description:"Filter by Delta contract family: Order, ProductiveOrder, ExternalOrder, TWAPOrder or TWAPBuyOrder.",type:"string",enum:w.filter(t=>t!=="FillableOrder")}},[],async(t,a)=>{let n=N(t.page,Number.MAX_SAFE_INTEGER,1),r=N(t.limit,1e3,100),d=new URLSearchParams({userAddress:a,chainId:String(m),page:String(n),limit:String(r)});if(t.type!==void 0&&d.set("type",b(t.type,["MARKET","LIMIT"])),t.onChainOrderType!==void 0&&d.set("onChainOrderType",b(t.onChainOrderType,w.filter(f=>f!=="FillableOrder"))),t.status!==void 0){if(!Array.isArray(t.status)||!t.status.length||t.status.length>A.length)throw new y("Provide a nonempty list of Delta statuses.");d.set("status",t.status.map(f=>b(f,A)).join(","))}let s=await o(`orders?${d}`);i(Array.isArray(s.data)&&s.data.length<=r),i(s.page===n&&s.limit===r&&Number.isSafeInteger(s.total)&&Number(s.total)>=0&&typeof s.hasMore=="boolean");let c=(n-1)*r+s.data.length;i(Number.isSafeInteger(c)&&c<=Math.max(Number(s.total),(n-1)*r)),i(s.hasMore===c<Number(s.total)&&(!s.hasMore||s.data.length>0));let g=s.data.map(f=>P(f,a));return i(new Set(g.map(f=>f.id.toLowerCase())).size===g.length),i(g.every(f=>(t.type===void 0||f.type===t.type)&&(t.onChainOrderType===void 0||f.onChainOrderType===t.onChainOrderType)&&(t.status===void 0||t.status.includes(f.status)))),{data:g,total:s.total,page:n,limit:r,hasMore:s.hasMore,notice:h}}),p("velora_delta_order",{orderId:{description:"Identifier of the Delta order, as a UUID.",type:"string",pattern:x}},["orderId"],async(t,a)=>{if(typeof t.orderId!="string"||!new RegExp(x).test(t.orderId))throw new y("Provide a Delta order UUID.");let n=await o(`orders/${t.orderId}`);return{order:P(n,a,t.orderId),notice:h}}),p("velora_delta_bridge_routes",{},[],async()=>{let t=await o("prices/bridge-routes");i(Array.isArray(t.routes));let a=t.routes.map(n=>(i(u(n)&&Number.isSafeInteger(n.srcChainId)&&Number(n.srcChainId)>0&&Number.isSafeInteger(n.destChainId)&&Number(n.destChainId)>0&&Array.isArray(n.tokens)),{srcChainId:n.srcChainId,destChainId:n.destChainId,tokens:n.tokens.map(l)})).filter(n=>n.srcChainId===m||n.destChainId===m);return{chainId:m,routes:a,executionAvailable:!1}}),p("velora_delta_bridge_protocols",{},[],async()=>{let t=await o("prices/bridge-protocols");return i(Array.isArray(t.bridgeProtocols)),{bridgeProtocols:t.bridgeProtocols.map(n=>(i(u(n)&&typeof n.protocol=="string"&&typeof n.displayName=="string"),{protocol:n.protocol,displayName:n.displayName})),executionAvailable:!1}}),p("velora_delta_strategies",{},[],async()=>{let t=await o(`prices/strategies/${m}`),a=Object.entries(t).map(([n,r])=>(i(u(r)&&Array.isArray(r.strategies)),{underlying:l(n),address:l(r.address),strategies:r.strategies.map(d=>{i(u(d)&&typeof d.name=="string");let s=d.apr;return i(s===null||u(s)&&["gross","net"].every(c=>typeof s[c]=="string"&&/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(s[c]))),{vault:l(d.vault),name:d.name,apr:structuredClone(d.apr)}})}));return{chainId:m,strategies:a,executionAvailable:!1,notice:"APRs are provider estimates refreshed every three hours, not promised returns. Verify each vault and its exit before depositing."}})]}export{L as a};
1
+ import{a as E}from"./43LI5NKJ.js";import{c as O}from"./SCG5HWMN.js";import{c as C,e as u,g as I}from"./NWNYJ26T.js";import{b as m}from"./TI727O2H.js";import{a as y}from"./XSD5NL7J.js";import{getAddress as k}from"viem";var D="https://api.velora.xyz/v2/delta",A=["PENDING","AWAITING_SIGNATURE","ACTIVE","SUSPENDED","CANCELLING","BRIDGING","COMPLETED","FAILED","EXPIRED","REFUNDING","CANCELLED","REFUNDED"],w=["Order","FillableOrder","ProductiveOrder","ExternalOrder","TWAPOrder","TWAPBuyOrder"],x="^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";function i(e){if(!e)throw new y("Velora Delta returned an unexpected response.")}function l(e){if(typeof e!="string")throw new y("Provide an address.");return E(e),k(e)}function N(e,p,o){if(e===void 0)return o;if(typeof e!="number"||!Number.isSafeInteger(e)||e<1||e>p)throw new y(`Provide an integer between 1 and ${p}.`);return e}function b(e,p){if(typeof e!="string"||!p.includes(e))throw new y(`Choose one of: ${p.join(", ")}.`);return e}function T(e){i(u(e)&&Number.isSafeInteger(e.chainId)&&Number(e.chainId)>0);let p=l(e.token);for(let o of["amount","expectedAmount","executedAmount"])i(e[o]===void 0||e[o]===null||typeof e[o]=="string"&&/^(0|[1-9][0-9]*)$/.test(e[o])&&BigInt(e[o])<1n<<256n);return i(typeof e.amount=="string"||typeof e.expectedAmount=="string"),{chainId:e.chainId,token:p,...Object.fromEntries(["amount","expectedAmount","executedAmount"].filter(o=>e[o]!==void 0).map(o=>[o,e[o]]))}}function P(e,p,o){i(u(e)&&typeof e.id=="string"&&new RegExp(x).test(e.id)),i(o===void 0||I(e.id,o));let h=l(e.owner);i(I(h,p)),i(typeof e.status=="string"&&A.includes(e.status)),i(e.side==="SELL"||e.side==="BUY"),i(e.type==="MARKET"||e.type==="LIMIT"),i(typeof e.onChainOrderType=="string"&&w.includes(e.onChainOrderType));let t=T(e.input);i(t.chainId===m);let a=T(e.output);i(typeof e.orderHash=="string"&&/^0x[0-9a-fA-F]{64}$/.test(e.orderHash)),i(Array.isArray(e.transactions)&&Array.isArray(e.refunds));for(let r of e.transactions){i(u(r)&&typeof r.originTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.originTx)),i(r.destinationTx===void 0||r.destinationTx===null||typeof r.destinationTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.destinationTx)),i(typeof r.filledPercent=="number"&&Number.isFinite(r.filledPercent)&&r.filledPercent>=0&&r.filledPercent<=100);for(let d of["spentAmount","receivedAmount"])i(r[d]===void 0||r[d]===null||typeof r[d]=="string"&&/^(0|[1-9][0-9]*)$/.test(r[d]))}let n=e.refunds.map(r=>(i(u(r)&&typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)),{...T(r),tx:r.tx}));return{id:e.id,status:e.status,side:e.side,type:e.type,onChainOrderType:e.onChainOrderType,owner:h,beneficiary:l(e.beneficiary),orderHash:e.orderHash,input:t,output:a,transactions:structuredClone(e.transactions),refunds:n,...Object.fromEntries(["createdAt","updatedAt","expiresAt"].filter(r=>typeof e[r]=="string").map(r=>[r,e[r]]))}}function L(e){function p(t,a,n,r){return{name:t,inputSchema:{type:"object",additionalProperties:!1,properties:a,required:n},execute:async(d,s)=>{try{l(s);for(let c of Object.keys(d))if(!Object.hasOwn(a,c))throw new y(`Unsupported ${t} argument: ${c}.`);return await r(d,s)}catch(c){throw new y(e.plainError(c))}}}}let o=t=>O(e.http,`${D}/${t}`,{method:"GET"},u),h="Provider activity is not receipt proof. Token amounts are base units; resolve symbols and decimals with find_token. Delta signing and submission are not enabled in Oak.";return[p("velora_delta_token_support",{token:{...C,description:"Address of the token to inspect or use."}},["token"],async t=>{let a=l(t.token),n=await o(`prices/is-token-supported?${new URLSearchParams({chainId:String(m),token:a})}`);return i(typeof n.supported=="boolean"),{token:a,chainId:m,supported:n.supported}}),p("velora_delta_orders",{page:{description:"Result page number, starting at 1; defaults to 1.",type:"integer",minimum:1},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:1e3},type:{description:'Choose "MARKET" for a market order or "LIMIT" for a limit order.',type:"string",enum:["MARKET","LIMIT"]},status:{description:"Filter by the listed Delta lifecycle statuses; omit to include all statuses.",type:"array",minItems:1,maxItems:A.length,items:{type:"string",enum:A}},onChainOrderType:{description:"Filter by Delta contract family: Order, ProductiveOrder, ExternalOrder, TWAPOrder or TWAPBuyOrder.",type:"string",enum:w.filter(t=>t!=="FillableOrder")}},[],async(t,a)=>{let n=N(t.page,Number.MAX_SAFE_INTEGER,1),r=N(t.limit,1e3,100),d=new URLSearchParams({userAddress:a,chainId:String(m),page:String(n),limit:String(r)});if(t.type!==void 0&&d.set("type",b(t.type,["MARKET","LIMIT"])),t.onChainOrderType!==void 0&&d.set("onChainOrderType",b(t.onChainOrderType,w.filter(f=>f!=="FillableOrder"))),t.status!==void 0){if(!Array.isArray(t.status)||!t.status.length||t.status.length>A.length)throw new y("Provide a nonempty list of Delta statuses.");d.set("status",t.status.map(f=>b(f,A)).join(","))}let s=await o(`orders?${d}`);i(Array.isArray(s.data)&&s.data.length<=r),i(s.page===n&&s.limit===r&&Number.isSafeInteger(s.total)&&Number(s.total)>=0&&typeof s.hasMore=="boolean");let c=(n-1)*r+s.data.length;i(Number.isSafeInteger(c)&&c<=Math.max(Number(s.total),(n-1)*r)),i(s.hasMore===c<Number(s.total)&&(!s.hasMore||s.data.length>0));let g=s.data.map(f=>P(f,a));return i(new Set(g.map(f=>f.id.toLowerCase())).size===g.length),i(g.every(f=>(t.type===void 0||f.type===t.type)&&(t.onChainOrderType===void 0||f.onChainOrderType===t.onChainOrderType)&&(t.status===void 0||t.status.includes(f.status)))),{data:g,total:s.total,page:n,limit:r,hasMore:s.hasMore,notice:h}}),p("velora_delta_order",{orderId:{description:"Identifier of the Delta order, as a UUID.",type:"string",pattern:x}},["orderId"],async(t,a)=>{if(typeof t.orderId!="string"||!new RegExp(x).test(t.orderId))throw new y("Provide a Delta order UUID.");let n=await o(`orders/${t.orderId}`);return{order:P(n,a,t.orderId),notice:h}}),p("velora_delta_bridge_routes",{},[],async()=>{let t=await o("prices/bridge-routes");i(Array.isArray(t.routes));let a=t.routes.map(n=>(i(u(n)&&Number.isSafeInteger(n.srcChainId)&&Number(n.srcChainId)>0&&Number.isSafeInteger(n.destChainId)&&Number(n.destChainId)>0&&Array.isArray(n.tokens)),{srcChainId:n.srcChainId,destChainId:n.destChainId,tokens:n.tokens.map(l)})).filter(n=>n.srcChainId===m||n.destChainId===m);return{chainId:m,routes:a,executionAvailable:!1}}),p("velora_delta_bridge_protocols",{},[],async()=>{let t=await o("prices/bridge-protocols");return i(Array.isArray(t.bridgeProtocols)),{bridgeProtocols:t.bridgeProtocols.map(n=>(i(u(n)&&typeof n.protocol=="string"&&typeof n.displayName=="string"),{protocol:n.protocol,displayName:n.displayName})),executionAvailable:!1}}),p("velora_delta_strategies",{},[],async()=>{let t=await o(`prices/strategies/${m}`),a=Object.entries(t).map(([n,r])=>(i(u(r)&&Array.isArray(r.strategies)),{underlying:l(n),address:l(r.address),strategies:r.strategies.map(d=>{i(u(d)&&typeof d.name=="string");let s=d.apr;return i(s===null||u(s)&&["gross","net"].every(c=>typeof s[c]=="string"&&/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(s[c]))),{vault:l(d.vault),name:d.name,apr:structuredClone(d.apr)}})}));return{chainId:m,strategies:a,executionAvailable:!1,notice:"APRs are provider estimates refreshed every three hours, not promised returns. Verify each vault and its exit before depositing."}})]}export{L as a};
@@ -1 +1 @@
1
- import{c as d,d as n,h as C}from"./XQ24RSEI.js";import{h as r}from"./NWNYJ26T.js";import{a as I,i as x}from"./FWD4L3CJ.js";import{decodeAbiParameters as j,encodeAbiParameters as R,erc20Abi as b,getAddress as F,keccak256 as D,parseAbi as G,parseAbiParameters as J,zeroAddress as K}from"viem";var Q=G(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)","function realAssets() view returns (uint256)","function morphoVaultV1() view returns (address)","function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),V=J("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),p=F(x[I].morpho.morpho_blue.address),P=(a,t)=>a<t?a:t;async function _(a,t,u,z){let e=(w,i,m=[])=>a.readContract({address:w,abi:Q,functionName:i,args:m,blockNumber:u}),[O,$,B,f]=await Promise.all([a.readContract({address:t.asset,abi:b,functionName:"balanceOf",args:[t.vault],blockNumber:u}),e(t.vault,"adaptersLength"),e(t.vault,"liquidityAdapter"),e(t.vault,"liquidityData")]),g=n(O),v=n($);if(v>64n||typeof f!="string")return{kind:"unknown"};if(r(B,K))return{kind:"unknown"};let s=d(B),A=await Promise.all(Array.from({length:Number(v)},async(w,i)=>d(await e(t.vault,"adapters",[BigInt(i)]))));if(new Set(A).size!==A.length||!A.includes(s)||!r(await e(s,"parentVault"),t.vault))return{kind:"unknown"};if(/^0x[0-9a-f]{320}$/i.test(f)){if(v!==1n||!r(await e(s,"asset"),t.asset)||!r(await e(s,"morpho"),p))return{kind:"unknown"};let[w]=j(V,f),i=D(R(V,[w])),m=n(await e(s,"marketIdsLength"));if(m>64n)return{kind:"unknown"};let y=await Promise.all(Array.from({length:Number(m)},(o,U)=>e(s,"marketIds",[BigInt(U)])));if(y.some(o=>typeof o!="string"||!/^0x[0-9a-f]{64}$/i.test(o))||new Set(y.map(o=>String(o).toLowerCase())).size!==y.length||!y.some(o=>r(o,i)))return{kind:"unknown"};let[l,c,M,N]=await Promise.all([e(p,"idToMarketParams",[i]),e(p,"market",[i]),e(s,"expectedSupplyAssets",[i]),a.readContract({address:t.asset,abi:b,functionName:"balanceOf",args:[p],blockNumber:u})]);if(!Array.isArray(l)||l.length!==5||!Array.isArray(c)||c.length!==6)return{kind:"unknown"};let T={loanToken:d(l[0]),collateralToken:d(l[1]),oracle:d(l[2]),irm:d(l[3]),lltv:n(l[4])};if(!r(D(R(V,[T])),i)||!r(T.loanToken,t.asset))return{kind:"unknown"};for(let o of c)if(n(o)>=1n<<128n)return{kind:"unknown"};let q=n(c[0]),L=n(c[2]);return L>q?{kind:"unknown"}:{kind:"morpho-market",readyBase:g+P(n(N),P(n(M),q-L))}}if(f!=="0x"||!z)return{kind:"unknown"};let[E,H]=await Promise.all([e(s,"realAssets"),e(s,"morphoVaultV1")]),k=d(H);if(r(k,t.vault)||!r(await e(k,"asset"),t.asset))return{kind:"unknown"};let h=n(E);if(n(await a.readContract({address:t.asset,abi:b,functionName:"balanceOf",args:[k],blockNumber:u}))>=h)return{kind:"parked-vault",readyBase:g+h};let S=await _(a,{...t,vault:k},u,!1).catch(()=>({kind:"unknown",readyBase:void 0}));return S.readyBase===void 0?{kind:"unknown"}:{kind:"parked-vault",readyBase:g+P(h,S.readyBase)}}async function W(a,t,u){try{return await _(a,t,await C(a,u),!0)}catch{return{kind:"unknown"}}}var at=(a,t)=>W(a,t);export{W as a,at as b};
1
+ import{c as d,d as n,h as C}from"./VVJO6OYK.js";import{h as r}from"./NWNYJ26T.js";import{b as I,j as x}from"./TI727O2H.js";import{decodeAbiParameters as j,encodeAbiParameters as R,erc20Abi as b,getAddress as F,keccak256 as D,parseAbi as G,parseAbiParameters as J,zeroAddress as K}from"viem";var Q=G(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)","function realAssets() view returns (uint256)","function morphoVaultV1() view returns (address)","function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),V=J("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),p=F(x[I].morpho.morpho_blue.address),P=(a,t)=>a<t?a:t;async function _(a,t,u,z){let e=(w,i,m=[])=>a.readContract({address:w,abi:Q,functionName:i,args:m,blockNumber:u}),[O,$,B,f]=await Promise.all([a.readContract({address:t.asset,abi:b,functionName:"balanceOf",args:[t.vault],blockNumber:u}),e(t.vault,"adaptersLength"),e(t.vault,"liquidityAdapter"),e(t.vault,"liquidityData")]),g=n(O),v=n($);if(v>64n||typeof f!="string")return{kind:"unknown"};if(r(B,K))return{kind:"unknown"};let s=d(B),A=await Promise.all(Array.from({length:Number(v)},async(w,i)=>d(await e(t.vault,"adapters",[BigInt(i)]))));if(new Set(A).size!==A.length||!A.includes(s)||!r(await e(s,"parentVault"),t.vault))return{kind:"unknown"};if(/^0x[0-9a-f]{320}$/i.test(f)){if(v!==1n||!r(await e(s,"asset"),t.asset)||!r(await e(s,"morpho"),p))return{kind:"unknown"};let[w]=j(V,f),i=D(R(V,[w])),m=n(await e(s,"marketIdsLength"));if(m>64n)return{kind:"unknown"};let y=await Promise.all(Array.from({length:Number(m)},(o,U)=>e(s,"marketIds",[BigInt(U)])));if(y.some(o=>typeof o!="string"||!/^0x[0-9a-f]{64}$/i.test(o))||new Set(y.map(o=>String(o).toLowerCase())).size!==y.length||!y.some(o=>r(o,i)))return{kind:"unknown"};let[l,c,M,N]=await Promise.all([e(p,"idToMarketParams",[i]),e(p,"market",[i]),e(s,"expectedSupplyAssets",[i]),a.readContract({address:t.asset,abi:b,functionName:"balanceOf",args:[p],blockNumber:u})]);if(!Array.isArray(l)||l.length!==5||!Array.isArray(c)||c.length!==6)return{kind:"unknown"};let T={loanToken:d(l[0]),collateralToken:d(l[1]),oracle:d(l[2]),irm:d(l[3]),lltv:n(l[4])};if(!r(D(R(V,[T])),i)||!r(T.loanToken,t.asset))return{kind:"unknown"};for(let o of c)if(n(o)>=1n<<128n)return{kind:"unknown"};let q=n(c[0]),L=n(c[2]);return L>q?{kind:"unknown"}:{kind:"morpho-market",readyBase:g+P(n(N),P(n(M),q-L))}}if(f!=="0x"||!z)return{kind:"unknown"};let[E,H]=await Promise.all([e(s,"realAssets"),e(s,"morphoVaultV1")]),k=d(H);if(r(k,t.vault)||!r(await e(k,"asset"),t.asset))return{kind:"unknown"};let h=n(E);if(n(await a.readContract({address:t.asset,abi:b,functionName:"balanceOf",args:[k],blockNumber:u}))>=h)return{kind:"parked-vault",readyBase:g+h};let S=await _(a,{...t,vault:k},u,!1).catch(()=>({kind:"unknown",readyBase:void 0}));return S.readyBase===void 0?{kind:"unknown"}:{kind:"parked-vault",readyBase:g+P(h,S.readyBase)}}async function W(a,t,u){try{return await _(a,t,await C(a,u),!0)}catch{return{kind:"unknown"}}}var at=(a,t)=>W(a,t);export{W as a,at as b};
@@ -1 +1 @@
1
- import{i as a,j as s,k as r,n as i,o as f}from"./QJNLLI6N.js";import{a as p}from"./XSD5NL7J.js";import{hashStruct as g}from"viem";var w={Order:[{name:"version",type:"string"},{name:"solverChainId",type:"string"},{name:"solver",type:"address"},{name:"salt",type:"uint256"},{name:"inputs",type:"Input[]"},{name:"output",type:"Output"},{name:"fees",type:"Fee[]"}],Input:[{name:"payment",type:"InputPayment"},{name:"refunds",type:"InputRefund[]"}],InputPayment:[{name:"chainId",type:"string"},{name:"currency",type:"bytes"},{name:"amount",type:"uint256"},{name:"weight",type:"uint256"}],InputRefund:[{name:"chainId",type:"string"},{name:"recipient",type:"bytes"},{name:"currency",type:"bytes"},{name:"minimumAmount",type:"uint256"},{name:"deadline",type:"uint32"},{name:"extraData",type:"bytes"}],Output:[{name:"chainId",type:"string"},{name:"payments",type:"OutputPayment[]"},{name:"deadline",type:"uint32"},{name:"calls",type:"bytes[]"},{name:"extraData",type:"bytes"}],OutputPayment:[{name:"recipient",type:"bytes"},{name:"currency",type:"bytes"},{name:"minimumAmount",type:"uint256"},{name:"expectedAmount",type:"uint256"}],Fee:[{name:"recipientChainId",type:"string"},{name:"recipient",type:"bytes"},{name:"currencyChainId",type:"string"},{name:"currency",type:"bytes"},{name:"amount",type:"uint256"}]};function A(I,l){let t=a(I);if(t.version!=="v1")throw new p("Relay order ID cannot be verified for this order version. Request a supported v1 quote.");let u=n=>{if(typeof n!="string"||!l.includes(n))throw new p("Relay order ID cannot be verified for an unknown or non-EVM chain.");return n},c=n=>{if(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(n))throw new p("Relay order ID cannot be verified with malformed bytes.");return n},d=n=>{let e=f(n);if(e>4294967295)throw new p("Relay order deadline exceeds uint32. Request a new quote.");return e};if(typeof t.salt!="string"||!/^(?:0x[0-9a-fA-F]{1,64}|0|[1-9][0-9]*)$/.test(t.salt)||BigInt(t.salt)>=1n<<256n)throw new p("Relay order ID cannot be verified with an invalid salt.");let y=a(t.output);return g({types:w,primaryType:"Order",data:{version:t.version,solverChainId:u(t.solverChainId),solver:r(t.solver),salt:BigInt(t.salt),inputs:s(t.inputs).map(n=>{let e=a(n),o=a(e.payment);return{payment:{chainId:u(o.chainId),currency:r(o.currency),amount:BigInt(i(o.amount)),weight:BigInt(i(o.weight))},refunds:s(e.refunds).map(h=>{let m=a(h);return{chainId:u(m.chainId),recipient:r(m.recipient),currency:r(m.currency),minimumAmount:BigInt(i(m.minimumAmount)),deadline:d(m.deadline),extraData:c(m.extraData)}})}}),output:{chainId:u(y.chainId),payments:s(y.payments).map(n=>{let e=a(n);return{recipient:r(e.recipient),currency:r(e.currency),minimumAmount:BigInt(i(e.minimumAmount)),expectedAmount:BigInt(i(e.expectedAmount))}}),deadline:d(y.deadline),calls:s(y.calls).map(c),extraData:c(y.extraData)},fees:s(t.fees).map(n=>{let e=a(n);return{recipientChainId:u(e.recipientChainId),recipient:r(e.recipient),currencyChainId:u(e.currencyChainId),currency:r(e.currency),amount:BigInt(i(e.amount))}})}})}export{A as a};
1
+ import{i as a,j as s,k as r,n as i,o as f}from"./Y64GFBTA.js";import{a as p}from"./XSD5NL7J.js";import{hashStruct as g}from"viem";var w={Order:[{name:"version",type:"string"},{name:"solverChainId",type:"string"},{name:"solver",type:"address"},{name:"salt",type:"uint256"},{name:"inputs",type:"Input[]"},{name:"output",type:"Output"},{name:"fees",type:"Fee[]"}],Input:[{name:"payment",type:"InputPayment"},{name:"refunds",type:"InputRefund[]"}],InputPayment:[{name:"chainId",type:"string"},{name:"currency",type:"bytes"},{name:"amount",type:"uint256"},{name:"weight",type:"uint256"}],InputRefund:[{name:"chainId",type:"string"},{name:"recipient",type:"bytes"},{name:"currency",type:"bytes"},{name:"minimumAmount",type:"uint256"},{name:"deadline",type:"uint32"},{name:"extraData",type:"bytes"}],Output:[{name:"chainId",type:"string"},{name:"payments",type:"OutputPayment[]"},{name:"deadline",type:"uint32"},{name:"calls",type:"bytes[]"},{name:"extraData",type:"bytes"}],OutputPayment:[{name:"recipient",type:"bytes"},{name:"currency",type:"bytes"},{name:"minimumAmount",type:"uint256"},{name:"expectedAmount",type:"uint256"}],Fee:[{name:"recipientChainId",type:"string"},{name:"recipient",type:"bytes"},{name:"currencyChainId",type:"string"},{name:"currency",type:"bytes"},{name:"amount",type:"uint256"}]};function A(I,l){let t=a(I);if(t.version!=="v1")throw new p("Relay order ID cannot be verified for this order version. Request a supported v1 quote.");let u=n=>{if(typeof n!="string"||!l.includes(n))throw new p("Relay order ID cannot be verified for an unknown or non-EVM chain.");return n},c=n=>{if(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(n))throw new p("Relay order ID cannot be verified with malformed bytes.");return n},d=n=>{let e=f(n);if(e>4294967295)throw new p("Relay order deadline exceeds uint32. Request a new quote.");return e};if(typeof t.salt!="string"||!/^(?:0x[0-9a-fA-F]{1,64}|0|[1-9][0-9]*)$/.test(t.salt)||BigInt(t.salt)>=1n<<256n)throw new p("Relay order ID cannot be verified with an invalid salt.");let y=a(t.output);return g({types:w,primaryType:"Order",data:{version:t.version,solverChainId:u(t.solverChainId),solver:r(t.solver),salt:BigInt(t.salt),inputs:s(t.inputs).map(n=>{let e=a(n),o=a(e.payment);return{payment:{chainId:u(o.chainId),currency:r(o.currency),amount:BigInt(i(o.amount)),weight:BigInt(i(o.weight))},refunds:s(e.refunds).map(h=>{let m=a(h);return{chainId:u(m.chainId),recipient:r(m.recipient),currency:r(m.currency),minimumAmount:BigInt(i(m.minimumAmount)),deadline:d(m.deadline),extraData:c(m.extraData)}})}}),output:{chainId:u(y.chainId),payments:s(y.payments).map(n=>{let e=a(n);return{recipient:r(e.recipient),currency:r(e.currency),minimumAmount:BigInt(i(e.minimumAmount)),expectedAmount:BigInt(i(e.expectedAmount))}}),deadline:d(y.deadline),calls:s(y.calls).map(c),extraData:c(y.extraData)},fees:s(t.fees).map(n=>{let e=a(n);return{recipientChainId:u(e.recipientChainId),recipient:r(e.recipient),currencyChainId:u(e.currencyChainId),currency:r(e.currency),amount:BigInt(i(e.amount))}})}})}export{A as a};
@@ -1 +1 @@
1
- import{a as c,b as F,e as P,f as T,g as I}from"./J73ATSEQ.js";import{a as l}from"./66F5ZH34.js";import{c as N,g,h as S}from"./NWNYJ26T.js";import{a as h}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as w,getAddress as _,parseAbi as Q,parseAbiItem as j,zeroAddress as H}from"viem";var x=_("0x000000001f26a0044baa66024e7b6599c61963f8"),M=j("event AuctionCreated(address indexed auction,address indexed token,uint256 amount,bytes configData)"),o=Q(["function currency() view returns (address)","function token() view returns (address)","function startBlock() view returns (uint64)","function endBlock() view returns (uint64)","function claimBlock() view returns (uint64)","function validationHook() view returns (address)","function clearingPrice() view returns (uint256)","function isGraduated() view returns (bool)","function bids(uint256) view returns ((uint64 startBlock,uint24 startCumulativeMps,uint64 exitedBlock,uint256 maxPrice,address owner,uint256 amountQ96,uint256 tokensFilled))","function submitBid(uint256 maxPrice,uint128 amount,address owner,uint256 prevTickPrice,bytes hookData) payable returns (uint256)","function exitBid(uint256)","function exitPartiallyFilledBid(uint256,uint64,uint64)","function claimTokens(uint256)","function claimTokensBatch(address,uint256[])","function checkpoint()","function sweepCurrency()","function sweepUnsoldTokens()"]);async function D(s,y){let n=F(y.auction),t=c(y.creationBlock,"creationBlock",64,!0),e=await s.getLogs({address:x,event:M,args:{auction:n},fromBlock:t,toBlock:t,strict:!0});if(e.length!==1||!g(e[0].address,x)||!S(e[0].args.auction,n))throw new u("Auction has no matching AuctionCreated event at the pinned CCA factory and creationBlock.");return n}async function E(s,y){let n=s.clientFor(h),t=await D(n,y),e=await n.getBlockNumber(),[a,b,i,k,m,v,d,B]=await Promise.all([n.readContract({address:t,abi:o,functionName:"currency",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"token",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"startBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"endBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"claimBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"validationHook",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"clearingPrice",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"isGraduated",blockNumber:e})]);return{auction:t,currency:a,saleToken:b,startBlock:i,endBlock:k,claimBlock:m,validationHook:v,clearingPrice:d,graduated:B,blockNumber:e}}var L={auction:{...N,description:"Address of the continuous clearing auction to verify against the pinned factory."},creationBlock:l("Auction creation block number, as a decimal string, used to verify the factory event."),bidId:l('Identifier of the auction bid, as a decimal string. Example: "1".'),amount:l('Amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),maxPrice:l("Maximum bid price in Q96 payment-currency base units per sale-token base unit."),prevTickPrice:l("Previous auction price tick in Q96 payment-currency base units per sale-token base unit; zero for the first tick."),lastFullyFilledCheckpointBlock:l("Last fully filled checkpoint block number for a partial bid exit, as a decimal string."),outbidBlock:l("Block number at which the bid was outbid, as a decimal string."),mode:{description:'Choose "full" to exit a bid, or "partial" to exit using checkpoint and outbid block hints.',type:"string",enum:["full","partial"]},bidIds:{description:'One to fifty unique auction bid identifiers as decimal strings. Example: ["1", "2"].',type:"array",minItems:1,maxItems:50,items:l()}};function R(s){let n=["status","bid","exit","claim","checkpoint","sweep_currency","sweep_tokens"].map(t=>({name:`uniswap_auction_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["auction","creationBlock",...t==="bid"?["amount","maxPrice","prevTickPrice"]:t==="exit"?["bidId","mode"]:[]],properties:L},async execute(e,a){I(e,["auction","creationBlock",...t==="bid"?["amount","maxPrice","prevTickPrice"]:t==="exit"?["bidId","mode","lastFullyFilledCheckpointBlock","outbidBlock"]:t==="claim"?["bidId","bidIds"]:t==="status"?["bidId"]:[]]);let i=await E(s,e),k=s.clientFor(h),[m,v]=await Promise.all([P(s,i.currency,i.blockNumber),P(s,i.saleToken,i.blockNumber)]),d=e.bidId===void 0?void 0:await k.readContract({address:i.auction,abi:o,functionName:"bids",args:[c(e.bidId,"bidId",256,!0)],blockNumber:i.blockNumber});if(t==="status")return{auction:i.auction,paymentToken:m,saleToken:v,startBlock:i.startBlock.toString(),endBlock:i.endBlock.toString(),claimBlock:i.claimBlock.toString(),validationHook:i.validationHook,clearingPrice:i.clearingPrice.toString(),graduated:i.graduated,...d?{bid:{...d,startBlock:d.startBlock.toString(),exitedBlock:d.exitedBlock.toString(),maxPrice:d.maxPrice.toString(),amountQ96:d.amountQ96.toString(),tokensFilled:d.tokensFilled.toString()}}:{},summary:"CCA prices use currency-base-units per sale-token-base-unit in Q96. Clearing price/graduation reflect the latest checkpoint and may lag the head."};let B=[],f,A=0n;if(t==="bid"){if(i.validationHook!==H)throw new u("This auction has a validation hook. Its validation/signing contract is not configured; do not pass an off-chain signature manually.");if(i.blockNumber<i.startBlock||i.blockNumber>=i.endBlock)throw new u("Auction is not in its bidding window.");let r=c(e.amount,"amount",128),p=c(e.maxPrice,"maxPrice"),C=c(e.prevTickPrice,"prevTickPrice",256,!0);if(p<=i.clearingPrice)throw new u("Bid maxPrice must be above the checkpoint clearing price.");i.currency===H?A=r:B.push(s.approval(i.currency,i.auction,r.toString(),h)),f=w({abi:o,functionName:"submitBid",args:[p,r,a,C,"0x"]})}else if(t==="exit"){if(!d||!g(d.owner,a))throw new u("Only exit a bid owned by the signing wallet.");let r=c(e.bidId,"bidId",256,!0);if(e.mode==="full"){if(e.lastFullyFilledCheckpointBlock!==void 0||e.outbidBlock!==void 0)throw new u("Full exit takes no checkpoint hints.");f=w({abi:o,functionName:"exitBid",args:[r]})}else if(e.mode==="partial")f=w({abi:o,functionName:"exitPartiallyFilledBid",args:[r,c(e.lastFullyFilledCheckpointBlock,"lastFullyFilledCheckpointBlock",64,!0),c(e.outbidBlock,"outbidBlock",64,!0)]});else throw new u("Choose full or partial exit explicitly; partial exits require checkpoint hints.")}else if(t==="claim"){if(e.bidId===void 0==(e.bidIds===void 0))throw new u("Provide bidId or bidIds, not both.");let r=e.bidIds===void 0?[c(e.bidId,"bidId",256,!0)]:Array.isArray(e.bidIds)?e.bidIds.map(p=>c(p,"bidIds",256,!0)):[];if(r.length<1||r.length>50||new Set(r.map(String)).size!==r.length)throw new u("Provide 1 to 50 unique bid IDs.");for(let p of r){let C=await k.readContract({address:i.auction,abi:o,functionName:"bids",args:[p],blockNumber:i.blockNumber});if(!g(C.owner,a))throw new u("Claimed tokens must belong to the signing wallet.")}f=w({abi:o,functionName:"claimTokensBatch",args:[a,r]})}else f=w({abi:o,functionName:t==="checkpoint"?"checkpoint":t==="sweep_currency"?"sweepCurrency":"sweepUnsoldTokens"});return B.push(s.unsignedTx({to:i.auction,data:f,value:A.toString(),chainId:h,description:`CCA ${t} on factory-verified auction ${i.auction}. Bid owner ${a}.`})),T(s,B,a,`CCA ${t}; checkpoint/exit/claim eligibility and creator-only sweeps are checked by the contract in preview. Sweeps pay the auction's immutable funds/tokens recipient, not an arbitrary recipient.`)}}));return n.push({name:"uniswap_auctions",inputSchema:{type:"object",additionalProperties:!1,properties:{fromBlock:l("First block number of the scan, as a decimal string; inclusive."),toBlock:l("Last block number of the scan, as a decimal string; inclusive.")}},async execute(t){I(t,["fromBlock","toBlock"]);let e=s.clientFor(h),a=await e.getBlockNumber(),b=t.fromBlock===void 0?a>9999n?a-9999n:0n:c(t.fromBlock,"fromBlock",64,!0),i=t.toBlock===void 0?a:c(t.toBlock,"toBlock",64,!0);if(b>i||i>a||i-b>=10000n)throw new u("Scan an ordered range of at most 10000 blocks, ending at or before the head.");let k=await e.getLogs({address:x,event:M,fromBlock:b,toBlock:i,strict:!0});return{factory:x,fromBlock:b.toString(),toBlock:i.toString(),auctions:k.map(m=>({auction:m.args.auction,token:m.args.token,amount:m.args.amount.toString(),creationBlock:m.blockNumber.toString()})),summary:"Factory-verified auctions in this block window only. An empty result does not establish that no auctions exist outside it. Scan earlier windows for older launches."}}}),{tools:n}}export{x as a,M as b,o as c,D as d,E as e,R as f};
1
+ import{a as c,b as F,e as P,f as T,g as I}from"./LJJYYUEG.js";import{a as l}from"./66F5ZH34.js";import{c as N,g,h as S}from"./NWNYJ26T.js";import{b as h}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as w,getAddress as _,parseAbi as Q,parseAbiItem as j,zeroAddress as H}from"viem";var x=_("0x000000001f26a0044baa66024e7b6599c61963f8"),M=j("event AuctionCreated(address indexed auction,address indexed token,uint256 amount,bytes configData)"),o=Q(["function currency() view returns (address)","function token() view returns (address)","function startBlock() view returns (uint64)","function endBlock() view returns (uint64)","function claimBlock() view returns (uint64)","function validationHook() view returns (address)","function clearingPrice() view returns (uint256)","function isGraduated() view returns (bool)","function bids(uint256) view returns ((uint64 startBlock,uint24 startCumulativeMps,uint64 exitedBlock,uint256 maxPrice,address owner,uint256 amountQ96,uint256 tokensFilled))","function submitBid(uint256 maxPrice,uint128 amount,address owner,uint256 prevTickPrice,bytes hookData) payable returns (uint256)","function exitBid(uint256)","function exitPartiallyFilledBid(uint256,uint64,uint64)","function claimTokens(uint256)","function claimTokensBatch(address,uint256[])","function checkpoint()","function sweepCurrency()","function sweepUnsoldTokens()"]);async function D(s,y){let n=F(y.auction),t=c(y.creationBlock,"creationBlock",64,!0),e=await s.getLogs({address:x,event:M,args:{auction:n},fromBlock:t,toBlock:t,strict:!0});if(e.length!==1||!g(e[0].address,x)||!S(e[0].args.auction,n))throw new u("Auction has no matching AuctionCreated event at the pinned CCA factory and creationBlock.");return n}async function E(s,y){let n=s.clientFor(h),t=await D(n,y),e=await n.getBlockNumber(),[a,b,i,k,m,v,d,B]=await Promise.all([n.readContract({address:t,abi:o,functionName:"currency",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"token",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"startBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"endBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"claimBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"validationHook",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"clearingPrice",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"isGraduated",blockNumber:e})]);return{auction:t,currency:a,saleToken:b,startBlock:i,endBlock:k,claimBlock:m,validationHook:v,clearingPrice:d,graduated:B,blockNumber:e}}var L={auction:{...N,description:"Address of the continuous clearing auction to verify against the pinned factory."},creationBlock:l("Auction creation block number, as a decimal string, used to verify the factory event."),bidId:l('Identifier of the auction bid, as a decimal string. Example: "1".'),amount:l('Amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),maxPrice:l("Maximum bid price in Q96 payment-currency base units per sale-token base unit."),prevTickPrice:l("Previous auction price tick in Q96 payment-currency base units per sale-token base unit; zero for the first tick."),lastFullyFilledCheckpointBlock:l("Last fully filled checkpoint block number for a partial bid exit, as a decimal string."),outbidBlock:l("Block number at which the bid was outbid, as a decimal string."),mode:{description:'Choose "full" to exit a bid, or "partial" to exit using checkpoint and outbid block hints.',type:"string",enum:["full","partial"]},bidIds:{description:'One to fifty unique auction bid identifiers as decimal strings. Example: ["1", "2"].',type:"array",minItems:1,maxItems:50,items:l()}};function R(s){let n=["status","bid","exit","claim","checkpoint","sweep_currency","sweep_tokens"].map(t=>({name:`uniswap_auction_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["auction","creationBlock",...t==="bid"?["amount","maxPrice","prevTickPrice"]:t==="exit"?["bidId","mode"]:[]],properties:L},async execute(e,a){I(e,["auction","creationBlock",...t==="bid"?["amount","maxPrice","prevTickPrice"]:t==="exit"?["bidId","mode","lastFullyFilledCheckpointBlock","outbidBlock"]:t==="claim"?["bidId","bidIds"]:t==="status"?["bidId"]:[]]);let i=await E(s,e),k=s.clientFor(h),[m,v]=await Promise.all([P(s,i.currency,i.blockNumber),P(s,i.saleToken,i.blockNumber)]),d=e.bidId===void 0?void 0:await k.readContract({address:i.auction,abi:o,functionName:"bids",args:[c(e.bidId,"bidId",256,!0)],blockNumber:i.blockNumber});if(t==="status")return{auction:i.auction,paymentToken:m,saleToken:v,startBlock:i.startBlock.toString(),endBlock:i.endBlock.toString(),claimBlock:i.claimBlock.toString(),validationHook:i.validationHook,clearingPrice:i.clearingPrice.toString(),graduated:i.graduated,...d?{bid:{...d,startBlock:d.startBlock.toString(),exitedBlock:d.exitedBlock.toString(),maxPrice:d.maxPrice.toString(),amountQ96:d.amountQ96.toString(),tokensFilled:d.tokensFilled.toString()}}:{},summary:"CCA prices use currency-base-units per sale-token-base-unit in Q96. Clearing price/graduation reflect the latest checkpoint and may lag the head."};let B=[],f,A=0n;if(t==="bid"){if(i.validationHook!==H)throw new u("This auction has a validation hook. Its validation/signing contract is not configured; do not pass an off-chain signature manually.");if(i.blockNumber<i.startBlock||i.blockNumber>=i.endBlock)throw new u("Auction is not in its bidding window.");let r=c(e.amount,"amount",128),p=c(e.maxPrice,"maxPrice"),C=c(e.prevTickPrice,"prevTickPrice",256,!0);if(p<=i.clearingPrice)throw new u("Bid maxPrice must be above the checkpoint clearing price.");i.currency===H?A=r:B.push(s.approval(i.currency,i.auction,r.toString(),h)),f=w({abi:o,functionName:"submitBid",args:[p,r,a,C,"0x"]})}else if(t==="exit"){if(!d||!g(d.owner,a))throw new u("Only exit a bid owned by the signing wallet.");let r=c(e.bidId,"bidId",256,!0);if(e.mode==="full"){if(e.lastFullyFilledCheckpointBlock!==void 0||e.outbidBlock!==void 0)throw new u("Full exit takes no checkpoint hints.");f=w({abi:o,functionName:"exitBid",args:[r]})}else if(e.mode==="partial")f=w({abi:o,functionName:"exitPartiallyFilledBid",args:[r,c(e.lastFullyFilledCheckpointBlock,"lastFullyFilledCheckpointBlock",64,!0),c(e.outbidBlock,"outbidBlock",64,!0)]});else throw new u("Choose full or partial exit explicitly; partial exits require checkpoint hints.")}else if(t==="claim"){if(e.bidId===void 0==(e.bidIds===void 0))throw new u("Provide bidId or bidIds, not both.");let r=e.bidIds===void 0?[c(e.bidId,"bidId",256,!0)]:Array.isArray(e.bidIds)?e.bidIds.map(p=>c(p,"bidIds",256,!0)):[];if(r.length<1||r.length>50||new Set(r.map(String)).size!==r.length)throw new u("Provide 1 to 50 unique bid IDs.");for(let p of r){let C=await k.readContract({address:i.auction,abi:o,functionName:"bids",args:[p],blockNumber:i.blockNumber});if(!g(C.owner,a))throw new u("Claimed tokens must belong to the signing wallet.")}f=w({abi:o,functionName:"claimTokensBatch",args:[a,r]})}else f=w({abi:o,functionName:t==="checkpoint"?"checkpoint":t==="sweep_currency"?"sweepCurrency":"sweepUnsoldTokens"});return B.push(s.unsignedTx({to:i.auction,data:f,value:A.toString(),chainId:h,description:`CCA ${t} on factory-verified auction ${i.auction}. Bid owner ${a}.`})),T(s,B,a,`CCA ${t}; checkpoint/exit/claim eligibility and creator-only sweeps are checked by the contract in preview. Sweeps pay the auction's immutable funds/tokens recipient, not an arbitrary recipient.`)}}));return n.push({name:"uniswap_auctions",inputSchema:{type:"object",additionalProperties:!1,properties:{fromBlock:l("First block number of the scan, as a decimal string; inclusive."),toBlock:l("Last block number of the scan, as a decimal string; inclusive.")}},async execute(t){I(t,["fromBlock","toBlock"]);let e=s.clientFor(h),a=await e.getBlockNumber(),b=t.fromBlock===void 0?a>9999n?a-9999n:0n:c(t.fromBlock,"fromBlock",64,!0),i=t.toBlock===void 0?a:c(t.toBlock,"toBlock",64,!0);if(b>i||i>a||i-b>=10000n)throw new u("Scan an ordered range of at most 10000 blocks, ending at or before the head.");let k=await e.getLogs({address:x,event:M,fromBlock:b,toBlock:i,strict:!0});return{factory:x,fromBlock:b.toString(),toBlock:i.toString(),auctions:k.map(m=>({auction:m.args.auction,token:m.args.token,amount:m.args.amount.toString(),creationBlock:m.blockNumber.toString()})),summary:"Factory-verified auctions in this block window only. An empty result does not establish that no auctions exist outside it. Scan earlier windows for older launches."}}}),{tools:n}}export{x as a,M as b,o as c,D as d,E as e,R as f};