@oakagentkit/core 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (535) hide show
  1. package/build/dist/api/addresses.d.ts +112 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/amounts.js +1 -1
  4. package/build/dist/api/args.js +1 -1
  5. package/build/dist/api/cache.js +1 -1
  6. package/build/dist/api/canonical.js +1 -1
  7. package/build/dist/api/chain.js +1 -1
  8. package/build/dist/api/deployments.js +1 -1
  9. package/build/dist/api/errors.d.ts +1 -0
  10. package/build/dist/api/errors.js +1 -1
  11. package/build/dist/api/gas.js +1 -1
  12. package/build/dist/api/grandfather.js +1 -1
  13. package/build/dist/api/guards.js +1 -1
  14. package/build/dist/api/history.js +1 -1
  15. package/build/dist/api/http.js +1 -1
  16. package/build/dist/api/identity-link.d.ts +1 -0
  17. package/build/dist/api/identity-link.js +1 -1
  18. package/build/dist/api/launch.js +1 -1
  19. package/build/dist/api/merkle.js +1 -1
  20. package/build/dist/api/metadata.js +1 -1
  21. package/build/dist/api/module.js +1 -1
  22. package/build/dist/api/modules/beefy/boosts.js +1 -1
  23. package/build/dist/api/modules/beefy/clm.js +1 -1
  24. package/build/dist/api/modules/beefy/guard.js +1 -1
  25. package/build/dist/api/modules/beefy/index.js +1 -1
  26. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  27. package/build/dist/api/modules/beefy/management.js +1 -1
  28. package/build/dist/api/modules/beefy/vaults.js +1 -1
  29. package/build/dist/api/modules/clanker/extensions.js +1 -1
  30. package/build/dist/api/modules/clanker/index.js +1 -1
  31. package/build/dist/api/modules/clanker/manage.js +1 -1
  32. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  33. package/build/dist/api/modules/clanker/protocol.js +1 -1
  34. package/build/dist/api/modules/clanker/state.js +1 -1
  35. package/build/dist/api/modules/earn/copy.d.ts +114 -0
  36. package/build/dist/api/modules/earn/copy.js +1 -0
  37. package/build/dist/api/modules/earn/cost.d.ts +47 -0
  38. package/build/dist/api/modules/earn/cost.js +1 -0
  39. package/build/dist/api/modules/earn/index.d.ts +8 -0
  40. package/build/dist/api/modules/earn/index.js +1 -0
  41. package/build/dist/api/modules/earn/lp.d.ts +17 -0
  42. package/build/dist/api/modules/earn/lp.js +1 -0
  43. package/build/dist/api/modules/earn/options.d.ts +36 -0
  44. package/build/dist/api/modules/earn/options.js +1 -0
  45. package/build/dist/api/modules/earn/types.d.ts +39 -0
  46. package/build/dist/api/modules/earn/types.js +0 -0
  47. package/build/dist/api/modules/erc8004/abi.js +1 -1
  48. package/build/dist/api/modules/erc8004/common.js +1 -1
  49. package/build/dist/api/modules/erc8004/domain.js +1 -1
  50. package/build/dist/api/modules/erc8004/index.js +1 -1
  51. package/build/dist/api/modules/erc8004/management.js +1 -1
  52. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  53. package/build/dist/api/modules/erc8004/services.js +1 -1
  54. package/build/dist/api/modules/erc8004/validation.js +1 -1
  55. package/build/dist/api/modules/grove/index.js +1 -1
  56. package/build/dist/api/modules/heyresearch/backoff.js +1 -1
  57. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  58. package/build/dist/api/modules/heyresearch/freshness.js +1 -1
  59. package/build/dist/api/modules/heyresearch/index.js +1 -1
  60. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  61. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  62. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  63. package/build/dist/api/modules/heyresearch/status-labels.d.ts +1 -1
  64. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  65. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  66. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  67. package/build/dist/api/modules/hoodag/index.js +1 -1
  68. package/build/dist/api/modules/hoodag/management.js +1 -1
  69. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  70. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  71. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  72. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  73. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  74. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  75. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  76. package/build/dist/api/modules/hoodlock/index.js +1 -1
  77. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  78. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  79. package/build/dist/api/modules/hoodlock/public.js +1 -1
  80. package/build/dist/api/modules/hookr/actions.js +1 -1
  81. package/build/dist/api/modules/hookr/addons.js +1 -1
  82. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  83. package/build/dist/api/modules/hookr/contracts.js +1 -1
  84. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  85. package/build/dist/api/modules/hookr/discovery.js +1 -1
  86. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  87. package/build/dist/api/modules/hookr/index.js +1 -1
  88. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  89. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  90. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  91. package/build/dist/api/modules/hookr/launch.js +1 -1
  92. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  93. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  94. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  95. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  96. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  97. package/build/dist/api/modules/hookr/pins.js +1 -1
  98. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  99. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  100. package/build/dist/api/modules/hookr/relay.js +1 -1
  101. package/build/dist/api/modules/hookr/revenue.js +1 -1
  102. package/build/dist/api/modules/kyberswap/index.js +1 -1
  103. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  104. package/build/dist/api/modules/layerbank/abi.d.ts +165 -0
  105. package/build/dist/api/modules/layerbank/abi.js +1 -0
  106. package/build/dist/api/modules/layerbank/actions.d.ts +2 -0
  107. package/build/dist/api/modules/layerbank/actions.js +1 -0
  108. package/build/dist/api/modules/layerbank/checks.d.ts +21 -0
  109. package/build/dist/api/modules/layerbank/checks.js +1 -0
  110. package/build/dist/api/modules/layerbank/index.d.ts +2 -0
  111. package/build/dist/api/modules/layerbank/index.js +1 -0
  112. package/build/dist/api/modules/layerbank/merkl.d.ts +6 -0
  113. package/build/dist/api/modules/layerbank/merkl.js +1 -0
  114. package/build/dist/api/modules/layerbank/reader.d.ts +15 -0
  115. package/build/dist/api/modules/layerbank/reader.js +1 -0
  116. package/build/dist/api/modules/layerbank/reserve.d.ts +13 -0
  117. package/build/dist/api/modules/layerbank/reserve.js +1 -0
  118. package/build/dist/api/modules/lighter/index.js +1 -1
  119. package/build/dist/api/modules/longbow/administration.js +1 -1
  120. package/build/dist/api/modules/longbow/analytics.js +1 -1
  121. package/build/dist/api/modules/longbow/fixed.js +1 -1
  122. package/build/dist/api/modules/longbow/index.js +1 -1
  123. package/build/dist/api/modules/longbow/nft.js +1 -1
  124. package/build/dist/api/modules/longbow/rebates.js +1 -1
  125. package/build/dist/api/modules/longbow/staking.js +1 -1
  126. package/build/dist/api/modules/meridian/index.js +1 -1
  127. package/build/dist/api/modules/meridian/markets.js +1 -1
  128. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  129. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  130. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  131. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  132. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  133. package/build/dist/api/modules/meridian/perps.js +1 -1
  134. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  135. package/build/dist/api/modules/meridian/rfq.js +1 -1
  136. package/build/dist/api/modules/merkl/discovery.js +1 -1
  137. package/build/dist/api/modules/merkl/index.js +1 -1
  138. package/build/dist/api/modules/merkl/manage.js +1 -1
  139. package/build/dist/api/modules/merkl/protocol.js +1 -1
  140. package/build/dist/api/modules/morpho/allocator.js +1 -1
  141. package/build/dist/api/modules/morpho/bundles-abi.js +1 -1
  142. package/build/dist/api/modules/morpho/bundles.js +1 -1
  143. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  144. package/build/dist/api/modules/morpho/index.js +1 -1
  145. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  146. package/build/dist/api/modules/morpho/midnight-abi.js +1 -1
  147. package/build/dist/api/modules/morpho/midnight.js +1 -1
  148. package/build/dist/api/modules/morpho/protocol.js +1 -1
  149. package/build/dist/api/modules/morpho/surface.js +1 -1
  150. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  151. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  152. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  153. package/build/dist/api/modules/netnet/blackjack-hashes.js +1 -1
  154. package/build/dist/api/modules/netnet/card-abi.js +1 -1
  155. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  156. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  157. package/build/dist/api/modules/netnet/card-read.js +1 -1
  158. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  159. package/build/dist/api/modules/netnet/desk-action-abi.js +1 -1
  160. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  161. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  162. package/build/dist/api/modules/netnet/desk-registry.js +1 -1
  163. package/build/dist/api/modules/netnet/financial-abi.js +1 -1
  164. package/build/dist/api/modules/netnet/financial.js +1 -1
  165. package/build/dist/api/modules/netnet/index.js +1 -1
  166. package/build/dist/api/modules/netnet/staking.js +1 -1
  167. package/build/dist/api/modules/orbio/gateway.js +1 -1
  168. package/build/dist/api/modules/orbio/index.js +1 -1
  169. package/build/dist/api/modules/orbio/pins.js +1 -1
  170. package/build/dist/api/modules/orbio/positions.d.ts +2 -0
  171. package/build/dist/api/modules/orbio/positions.js +1 -0
  172. package/build/dist/api/modules/pendle/abi.d.ts +205 -0
  173. package/build/dist/api/modules/pendle/abi.js +1 -0
  174. package/build/dist/api/modules/pendle/convert.d.ts +24 -0
  175. package/build/dist/api/modules/pendle/convert.js +1 -0
  176. package/build/dist/api/modules/pendle/costs.d.ts +3 -0
  177. package/build/dist/api/modules/pendle/costs.js +1 -0
  178. package/build/dist/api/modules/pendle/index.d.ts +11 -0
  179. package/build/dist/api/modules/pendle/index.js +1 -0
  180. package/build/dist/api/modules/pendle/markets.d.ts +37 -0
  181. package/build/dist/api/modules/pendle/markets.js +1 -0
  182. package/build/dist/api/modules/pendle/positions.d.ts +18 -0
  183. package/build/dist/api/modules/pendle/positions.js +1 -0
  184. package/build/dist/api/modules/pendle/pricecheck.d.ts +95 -0
  185. package/build/dist/api/modules/pendle/pricecheck.js +1 -0
  186. package/build/dist/api/modules/pendle/reader.d.ts +17 -0
  187. package/build/dist/api/modules/pendle/reader.js +1 -0
  188. package/build/dist/api/modules/pendle/redeem.d.ts +15 -0
  189. package/build/dist/api/modules/pendle/redeem.js +1 -0
  190. package/build/dist/api/modules/pendle/trade.d.ts +2 -0
  191. package/build/dist/api/modules/pendle/trade.js +1 -0
  192. package/build/dist/api/modules/pendle/types.d.ts +26 -0
  193. package/build/dist/api/modules/pendle/types.js +0 -0
  194. package/build/dist/api/modules/pendle/validate.d.ts +424 -0
  195. package/build/dist/api/modules/pendle/validate.js +1 -0
  196. package/build/dist/api/modules/pendle/verify.d.ts +22 -0
  197. package/build/dist/api/modules/pendle/verify.js +1 -0
  198. package/build/dist/api/modules/pons/claim.js +1 -1
  199. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  200. package/build/dist/api/modules/pons/index.js +1 -1
  201. package/build/dist/api/modules/pons/launch-status.js +1 -1
  202. package/build/dist/api/modules/pons/prices.js +1 -1
  203. package/build/dist/api/modules/pons/reads.d.ts +38 -2
  204. package/build/dist/api/modules/pons/reads.js +1 -1
  205. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  206. package/build/dist/api/modules/pons/trade.js +1 -1
  207. package/build/dist/api/modules/poolstrade/index.js +1 -1
  208. package/build/dist/api/modules/priors/coverage.js +1 -1
  209. package/build/dist/api/modules/priors/discovery.js +1 -1
  210. package/build/dist/api/modules/priors/features.js +1 -1
  211. package/build/dist/api/modules/priors/holdings.d.ts +4 -0
  212. package/build/dist/api/modules/priors/holdings.js +1 -0
  213. package/build/dist/api/modules/priors/index.js +1 -1
  214. package/build/dist/api/modules/priors/integration.js +1 -1
  215. package/build/dist/api/modules/priors/market.js +1 -1
  216. package/build/dist/api/modules/priors/pt.js +1 -1
  217. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  218. package/build/dist/api/modules/priors/starter-line.js +1 -1
  219. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  220. package/build/dist/api/modules/relay/api.js +1 -1
  221. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  222. package/build/dist/api/modules/relay/discovery.js +1 -1
  223. package/build/dist/api/modules/relay/inbound.js +1 -1
  224. package/build/dist/api/modules/relay/index.js +1 -1
  225. package/build/dist/api/modules/relay/order.js +1 -1
  226. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  227. package/build/dist/api/modules/relay/readiness.js +1 -1
  228. package/build/dist/api/modules/relay/reads.js +1 -1
  229. package/build/dist/api/modules/relay/vaults.js +1 -1
  230. package/build/dist/api/modules/spark/actions.js +1 -1
  231. package/build/dist/api/modules/spark/details.js +1 -1
  232. package/build/dist/api/modules/spark/index.js +1 -1
  233. package/build/dist/api/modules/spark/management.js +1 -1
  234. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  235. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  236. package/build/dist/api/modules/steakhouse/index.js +1 -1
  237. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  238. package/build/dist/api/modules/steakhouse/management.js +1 -1
  239. package/build/dist/api/modules/steakhouse/share-symbol.d.ts +3 -0
  240. package/build/dist/api/modules/steakhouse/share-symbol.js +1 -0
  241. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  242. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  243. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  244. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  249. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  250. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  251. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  252. package/build/dist/api/modules/tickerspring/research.js +1 -1
  253. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  254. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction.js +1 -1
  256. package/build/dist/api/modules/uniswap/batch.js +1 -1
  257. package/build/dist/api/modules/uniswap/common.js +1 -1
  258. package/build/dist/api/modules/uniswap/fees.js +1 -1
  259. package/build/dist/api/modules/uniswap/index.js +1 -1
  260. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  261. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  262. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  263. package/build/dist/api/modules/uniswap/pools.js +1 -1
  264. package/build/dist/api/modules/uniswap/position.js +1 -1
  265. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  266. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  267. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  268. package/build/dist/api/modules/uniswap/trade.js +1 -1
  269. package/build/dist/api/modules/uniswap/v2.js +1 -1
  270. package/build/dist/api/modules/uniswap/v3.d.ts +1 -0
  271. package/build/dist/api/modules/uniswap/v3.js +1 -1
  272. package/build/dist/api/modules/uniswap/v4.js +1 -1
  273. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  274. package/build/dist/api/modules/velora/claims.js +1 -1
  275. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  276. package/build/dist/api/modules/velora/index.js +1 -1
  277. package/build/dist/api/modules/wormhole/index.js +1 -1
  278. package/build/dist/api/modules/wormhole/license.js +1 -1
  279. package/build/dist/api/modules/wormhole/quotetext.js +1 -1
  280. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  281. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  282. package/build/dist/api/owner-signature.js +1 -1
  283. package/build/dist/api/positions.d.ts +5 -5
  284. package/build/dist/api/positions.js +1 -1
  285. package/build/dist/api/pricenote.js +1 -1
  286. package/build/dist/api/prices.js +1 -1
  287. package/build/dist/api/pricing.js +1 -1
  288. package/build/dist/api/reads.js +1 -1
  289. package/build/dist/api/routes.js +1 -1
  290. package/build/dist/api/rpc.js +1 -1
  291. package/build/dist/api/secret-fields.js +1 -1
  292. package/build/dist/api/send.js +1 -1
  293. package/build/dist/api/signing-registry.js +1 -1
  294. package/build/dist/api/signing.js +1 -1
  295. package/build/dist/api/simulate.js +1 -1
  296. package/build/dist/api/swap.js +1 -1
  297. package/build/dist/api/token-output.js +1 -1
  298. package/build/dist/api/tokens.js +1 -1
  299. package/build/dist/api/tool-policy.js +1 -1
  300. package/build/dist/api/tx.js +1 -1
  301. package/build/dist/api/types.d.ts +7 -2
  302. package/build/dist/api/untrusted.js +1 -1
  303. package/build/dist/api/vendor-limits.js +1 -1
  304. package/build/dist/chunks/{7YU6DELJ.js → 24CQ2SPB.js} +1 -1
  305. package/build/dist/chunks/2DUCTO5C.js +1 -0
  306. package/build/dist/chunks/2MZXTOZU.js +1 -0
  307. package/build/dist/chunks/2OJAOVMG.js +1 -0
  308. package/build/dist/chunks/2ZUP7ZEV.js +1 -0
  309. package/build/dist/chunks/{ZXQMF56D.js → 3AXVB23N.js} +1 -1
  310. package/build/dist/chunks/3ESNHZT5.js +1 -0
  311. package/build/dist/chunks/{GIV5JMTE.js → 3VAJW6TQ.js} +1 -1
  312. package/build/dist/chunks/{ALK6NKFP.js → 3WXK2FUA.js} +1 -1
  313. package/build/dist/chunks/{TQL7UDFL.js → 42DQTKEO.js} +1 -1
  314. package/build/dist/chunks/{E7R3J4H7.js → 43CSMYDO.js} +1 -1
  315. package/build/dist/chunks/46547QT3.js +1 -0
  316. package/build/dist/chunks/{XV2HQKND.js → 47YN4OUI.js} +1 -1
  317. package/build/dist/chunks/{S3HNPTXA.js → 4ALMYJJV.js} +1 -1
  318. package/build/dist/chunks/{SOYQOE5P.js → 4BVP652W.js} +1 -1
  319. package/build/dist/chunks/{GCWA4Z3W.js → 4ISR2U72.js} +1 -1
  320. package/build/dist/chunks/{AAGDMH54.js → 4TQQH7N6.js} +1 -1
  321. package/build/dist/chunks/{WTSMPDT5.js → 4YFVAYKR.js} +1 -1
  322. package/build/dist/chunks/{PTAWEHKB.js → 57JFKIMK.js} +1 -1
  323. package/build/dist/chunks/{3RFSGU2Y.js → 5CAAFU7R.js} +1 -1
  324. package/build/dist/chunks/{73N3TOJL.js → 5KUWLUPM.js} +1 -1
  325. package/build/dist/chunks/{SKQGLGES.js → 5MQ5KSSV.js} +1 -1
  326. package/build/dist/chunks/{AJP5LDM2.js → 5N4A5XAW.js} +1 -1
  327. package/build/dist/chunks/{OQVZVR2S.js → 5OKJEGBH.js} +1 -1
  328. package/build/dist/chunks/5U7TCKX2.js +2 -0
  329. package/build/dist/chunks/5WUKOQIJ.js +1 -0
  330. package/build/dist/chunks/5ZLOCQA4.js +1 -0
  331. package/build/dist/chunks/63YRSLDK.js +1 -0
  332. package/build/dist/chunks/64WKYWZV.js +1 -0
  333. package/build/dist/chunks/{JPOYTTTW.js → 65EQECL3.js} +1 -1
  334. package/build/dist/chunks/{57HAXNQV.js → 6AAARNZ3.js} +1 -1
  335. package/build/dist/chunks/6FTYNYGF.js +1 -0
  336. package/build/dist/chunks/{L7YBCMZU.js → 6L5KTE6Y.js} +1 -1
  337. package/build/dist/chunks/{53N7PNJH.js → 6PY3IRDS.js} +1 -1
  338. package/build/dist/chunks/{5VHH5PW3.js → 6YYCGUCU.js} +1 -1
  339. package/build/dist/chunks/{UNZRE3YU.js → 7UOOIDR3.js} +1 -1
  340. package/build/dist/chunks/{LQUDJCAR.js → 7WQEPZJY.js} +1 -1
  341. package/build/dist/chunks/A3PN3PK3.js +1 -0
  342. package/build/dist/chunks/A6YQ5H24.js +1 -0
  343. package/build/dist/chunks/{CXLEQCP3.js → ABPL3ZZI.js} +1 -1
  344. package/build/dist/chunks/{R7FXNZRM.js → AG67Z3SC.js} +1 -1
  345. package/build/dist/chunks/{BX7XQANB.js → ALPYEM7B.js} +1 -1
  346. package/build/dist/chunks/{OE3CLZHR.js → ALRRW7SF.js} +1 -1
  347. package/build/dist/chunks/AUOXDNUO.js +7 -0
  348. package/build/dist/chunks/AWXJV2YH.js +1 -0
  349. package/build/dist/chunks/{PEA32CWB.js → BAAXGB4K.js} +1 -1
  350. package/build/dist/chunks/{R53P2K3C.js → BIRMUW7Z.js} +1 -1
  351. package/build/dist/chunks/{EA6IYKIB.js → BK23XJXE.js} +1 -1
  352. package/build/dist/chunks/{NATG6YA6.js → BNG2IWZL.js} +1 -1
  353. package/build/dist/chunks/BQICZFLR.js +1 -0
  354. package/build/dist/chunks/{ASDKY5NX.js → BXHNYCH2.js} +1 -1
  355. package/build/dist/chunks/{L62M7LOB.js → C5ZZAYXD.js} +1 -1
  356. package/build/dist/chunks/{52DHGSG4.js → CERNEJ2F.js} +1 -1
  357. package/build/dist/chunks/{LKJBMHCE.js → CTMA4BTM.js} +1 -1
  358. package/build/dist/chunks/{QXNPPCOU.js → D6ZJPNK7.js} +1 -1
  359. package/build/dist/chunks/DFM4T6ZE.js +1 -0
  360. package/build/dist/chunks/{SJPM5ST4.js → DP2NIYBP.js} +1 -1
  361. package/build/dist/chunks/DVVFT42J.js +1 -0
  362. package/build/dist/chunks/E3UBHTJO.js +1 -0
  363. package/build/dist/chunks/E6RRXNV2.js +1 -0
  364. package/build/dist/chunks/{ZT47KN7A.js → E6UU7DL2.js} +1 -1
  365. package/build/dist/chunks/ECWGKLBW.js +1 -0
  366. package/build/dist/chunks/EKNSLLJK.js +1 -0
  367. package/build/dist/chunks/{XWEFKXKA.js → ENX72ARB.js} +1 -1
  368. package/build/dist/chunks/{DRWWPBOQ.js → EOQYLFXA.js} +1 -1
  369. package/build/dist/chunks/{ELZNT5Q3.js → ET23SES4.js} +1 -1
  370. package/build/dist/chunks/EU3OAJU2.js +1 -0
  371. package/build/dist/chunks/{2W46IRX6.js → EYFBVQ46.js} +1 -1
  372. package/build/dist/chunks/{VXLJRRKV.js → F26FK47J.js} +1 -1
  373. package/build/dist/chunks/{O5IVZHHP.js → F3BSEE52.js} +1 -1
  374. package/build/dist/chunks/FWD4L3CJ.js +1 -0
  375. package/build/dist/chunks/G7XSFUDL.js +1 -0
  376. package/build/dist/chunks/{5O5ZE3ZV.js → GHPREYQK.js} +1 -1
  377. package/build/dist/chunks/{AFHHRDPJ.js → GRIGSPD4.js} +1 -1
  378. package/build/dist/chunks/{TPDOUL4N.js → GVPX5XCL.js} +1 -1
  379. package/build/dist/chunks/{TLJPVYRJ.js → GW5IXLKU.js} +1 -1
  380. package/build/dist/chunks/H4NYYJ3Z.js +1 -0
  381. package/build/dist/chunks/{J3GFCBZZ.js → HSFOWJ3Z.js} +1 -1
  382. package/build/dist/chunks/{CY75R4FK.js → HTXKERNS.js} +1 -1
  383. package/build/dist/chunks/{6ZYLNB2B.js → HVM2EEXB.js} +1 -1
  384. package/build/dist/chunks/{U3F6DDML.js → I4TGMF2C.js} +1 -1
  385. package/build/dist/chunks/I6KUORFT.js +1 -0
  386. package/build/dist/chunks/{AMICUXS6.js → IKEJCBYU.js} +1 -1
  387. package/build/dist/chunks/IMRXZ7JB.js +1 -0
  388. package/build/dist/chunks/IQGY5FW7.js +1 -0
  389. package/build/dist/chunks/{L3ZM77SJ.js → IQIWASRD.js} +1 -1
  390. package/build/dist/chunks/JG27HM4P.js +1 -0
  391. package/build/dist/chunks/{V5LTA42G.js → JPNYUEQP.js} +1 -1
  392. package/build/dist/chunks/JZXYLHI7.js +1 -0
  393. package/build/dist/chunks/{QYYFRAWY.js → K22EXPWN.js} +1 -1
  394. package/build/dist/chunks/K72EYD6R.js +1 -0
  395. package/build/dist/chunks/KA7BPBCV.js +2 -0
  396. package/build/dist/chunks/KBKK7UNY.js +1 -0
  397. package/build/dist/chunks/{LBEMCOND.js → KBXU7U6Q.js} +1 -1
  398. package/build/dist/chunks/L6D26AMO.js +1 -0
  399. package/build/dist/chunks/{GGUEKSR4.js → L7OQUHM5.js} +1 -1
  400. package/build/dist/chunks/{F6WBPPBN.js → LDT3QTSY.js} +1 -1
  401. package/build/dist/chunks/{CE7D6MUS.js → LROVANUR.js} +1 -1
  402. package/build/dist/chunks/{WWFOYZT2.js → LVLVP5KQ.js} +1 -1
  403. package/build/dist/chunks/MBTARLZQ.js +1 -0
  404. package/build/dist/chunks/{SSTROLQM.js → MDDHG34Y.js} +1 -1
  405. package/build/dist/chunks/{OVK4EEOD.js → MDV7GECM.js} +1 -1
  406. package/build/dist/chunks/{DCTUYDWF.js → MFCPL6LF.js} +1 -1
  407. package/build/dist/chunks/MGPHD4VV.js +1 -0
  408. package/build/dist/chunks/{VC2RCYQE.js → MKAPRRKF.js} +1 -1
  409. package/build/dist/chunks/{FBSUTF3B.js → MKBNLGDD.js} +1 -1
  410. package/build/dist/chunks/{NRBIXV7V.js → MOPETB64.js} +1 -1
  411. package/build/dist/chunks/{ACN2BFMA.js → MQK6OP7S.js} +1 -1
  412. package/build/dist/chunks/{TWCSCRFS.js → MQYOG66Q.js} +1 -1
  413. package/build/dist/chunks/{2UU5TBBB.js → MXW2TP5P.js} +1 -1
  414. package/build/dist/chunks/MYFAKCQI.js +1 -0
  415. package/build/dist/chunks/{MKQVS3IO.js → NA7R6J5N.js} +1 -1
  416. package/build/dist/chunks/NB3LYS3G.js +1 -0
  417. package/build/dist/chunks/{TNSKEHPC.js → NDW5DAFL.js} +1 -1
  418. package/build/dist/chunks/{MRWCFTMS.js → NKX3FE34.js} +1 -1
  419. package/build/dist/chunks/NYNJITCM.js +1 -0
  420. package/build/dist/chunks/{YZSTP2E6.js → NZXQWDGF.js} +1 -1
  421. package/build/dist/chunks/{Z7RL4NGX.js → O6L4BJP4.js} +1 -1
  422. package/build/dist/chunks/{KSZMMNXK.js → OFI3Y55L.js} +1 -1
  423. package/build/dist/chunks/{2LM7U4S7.js → OTIXQZ3X.js} +1 -1
  424. package/build/dist/chunks/{WCKMQFGS.js → PADWZX7J.js} +1 -1
  425. package/build/dist/chunks/{6IM6A5VA.js → PBQSJSZO.js} +1 -1
  426. package/build/dist/chunks/PLZKXQ76.js +1 -0
  427. package/build/dist/chunks/{XUYHMOHS.js → PQC5635W.js} +1 -1
  428. package/build/dist/chunks/PSVOVZH7.js +70 -0
  429. package/build/dist/chunks/{PWBL4WKB.js → PWH464CJ.js} +1 -1
  430. package/build/dist/chunks/QJFXLYZG.js +1 -0
  431. package/build/dist/chunks/{4KQZTPMS.js → QRC4ZPDA.js} +1 -1
  432. package/build/dist/chunks/{4AKIXLXH.js → QSN6Y2K6.js} +1 -1
  433. package/build/dist/chunks/{C3TJLARP.js → QVYCJ6WV.js} +1 -1
  434. package/build/dist/chunks/{WVXW6VL3.js → RNC463IM.js} +1 -1
  435. package/build/dist/chunks/RPNAFUM5.js +1 -0
  436. package/build/dist/chunks/RVO3QK2B.js +1 -0
  437. package/build/dist/chunks/{FUXT7GRK.js → S2TAJHHK.js} +1 -1
  438. package/build/dist/chunks/{YHPOXAKA.js → S3FPF537.js} +1 -1
  439. package/build/dist/chunks/{H4S2ZCWK.js → S5WICHIS.js} +1 -1
  440. package/build/dist/chunks/SDHPFXRM.js +1 -0
  441. package/build/dist/chunks/{3NDVXEBR.js → SGEZIYJW.js} +1 -1
  442. package/build/dist/chunks/SK2VBNAU.js +1 -0
  443. package/build/dist/chunks/SKMPKAZI.js +1 -0
  444. package/build/dist/chunks/{5IIR3GIN.js → SQL6HD5E.js} +1 -1
  445. package/build/dist/chunks/SSIENQVU.js +1 -0
  446. package/build/dist/chunks/{EXRKBBX2.js → SUFA2GKR.js} +1 -1
  447. package/build/dist/chunks/TBCSZDAF.js +1 -0
  448. package/build/dist/chunks/{LMVB3B6T.js → TBIVTEP5.js} +1 -1
  449. package/build/dist/chunks/{2FSX7MMR.js → TJWVY4VO.js} +1 -1
  450. package/build/dist/chunks/{7XLEYOZH.js → TNKVRVTH.js} +1 -1
  451. package/build/dist/chunks/{VCLPOU7T.js → TPL4U3AQ.js} +1 -1
  452. package/build/dist/chunks/{QRDDKA4I.js → U4JGEMKT.js} +1 -1
  453. package/build/dist/chunks/{6AWTAE4Q.js → UA4O226F.js} +1 -1
  454. package/build/dist/chunks/UFVPMWPJ.js +1 -0
  455. package/build/dist/chunks/UHRCM7AG.js +1 -0
  456. package/build/dist/chunks/{XQXLFF7Y.js → UOGHQLQX.js} +1 -1
  457. package/build/dist/chunks/UP7FBDMJ.js +1 -0
  458. package/build/dist/chunks/{YQUKU2LS.js → UPMGGK34.js} +1 -1
  459. package/build/dist/chunks/VHLINDDS.js +1 -0
  460. package/build/dist/chunks/{PARWLWXW.js → VV2HEIFI.js} +1 -1
  461. package/build/dist/chunks/{YA5WWDEW.js → VVA72C6O.js} +1 -1
  462. package/build/dist/chunks/{TCPPYBGQ.js → W2OJ57ZO.js} +1 -1
  463. package/build/dist/chunks/{WQ6H62DM.js → W76QC2AW.js} +1 -1
  464. package/build/dist/chunks/{VFSRRDLY.js → WD37MEMZ.js} +1 -1
  465. package/build/dist/chunks/{R7QPJQP6.js → WGL46F3S.js} +1 -1
  466. package/build/dist/chunks/WIVYKLQM.js +2 -0
  467. package/build/dist/chunks/{XQUPZ3GU.js → WMNRP3YH.js} +1 -1
  468. package/build/dist/chunks/WOEKXQAH.js +1 -0
  469. package/build/dist/chunks/WPAF55SP.js +1 -0
  470. package/build/dist/chunks/{EVANKNJV.js → WPFAEBE7.js} +1 -1
  471. package/build/dist/chunks/WVONJOWN.js +1 -0
  472. package/build/dist/chunks/{TWSTOFN3.js → WWHCEMNB.js} +1 -1
  473. package/build/dist/chunks/{DZGEQBO7.js → XDZRO5JQ.js} +1 -1
  474. package/build/dist/chunks/XFKVU46U.js +3 -0
  475. package/build/dist/chunks/{RAKUK5VR.js → XJEOEMDS.js} +1 -1
  476. package/build/dist/chunks/XSD5NL7J.js +1 -0
  477. package/build/dist/chunks/{NU4K3TEZ.js → XSRIJUFU.js} +1 -1
  478. package/build/dist/chunks/{VFKNXQXI.js → Y7PRJOIK.js} +1 -1
  479. package/build/dist/chunks/Y7RPSDD2.js +1 -0
  480. package/build/dist/chunks/YAJYDD6C.js +1 -0
  481. package/build/dist/chunks/{5OEHZJ6X.js → YEXUSRIZ.js} +1 -1
  482. package/build/dist/chunks/YHRUAQQK.js +1 -0
  483. package/build/dist/chunks/{3EFV4FQF.js → YPM2UITD.js} +1 -1
  484. package/build/dist/chunks/{3WBDHUV2.js → YRXT3HTW.js} +1 -1
  485. package/build/dist/chunks/Z4SRGAVL.js +1 -0
  486. package/build/dist/chunks/{SQ5BNSXR.js → ZBFKKUNP.js} +1 -1
  487. package/build/dist/chunks/{NWSPC3NH.js → ZCOFMGPS.js} +1 -1
  488. package/build/dist/chunks/ZCUXM52B.js +1 -0
  489. package/build/dist/chunks/ZE7EU2CS.js +1 -0
  490. package/build/dist/chunks/{CQCVFRQ5.js → ZET37EIG.js} +1 -1
  491. package/build/dist/chunks/{VVEUJ36E.js → ZGKVXFM5.js} +1 -1
  492. package/build/dist/chunks/{WQQJ7UPJ.js → ZSQOMSOC.js} +1 -1
  493. package/build/dist/chunks/{JST5JGAP.js → ZYH4B2GR.js} +1 -1
  494. package/package.json +2 -2
  495. package/build/dist/chunks/2MSQ6JII.js +0 -1
  496. package/build/dist/chunks/3SC5UI35.js +0 -1
  497. package/build/dist/chunks/4GHVIBL5.js +0 -1
  498. package/build/dist/chunks/4X2JOQ2L.js +0 -1
  499. package/build/dist/chunks/5YS5V2LK.js +0 -1
  500. package/build/dist/chunks/6UPPUHCL.js +0 -1
  501. package/build/dist/chunks/AXYOJBX6.js +0 -1
  502. package/build/dist/chunks/CEIPDEXZ.js +0 -1
  503. package/build/dist/chunks/CUNQ5RG5.js +0 -1
  504. package/build/dist/chunks/EG6M6SSO.js +0 -1
  505. package/build/dist/chunks/EGUMOD3A.js +0 -1
  506. package/build/dist/chunks/G3MHDTGT.js +0 -1
  507. package/build/dist/chunks/G6HCV67X.js +0 -1
  508. package/build/dist/chunks/GJY3P6OG.js +0 -1
  509. package/build/dist/chunks/HIMVOTIU.js +0 -1
  510. package/build/dist/chunks/IBXYIN7Q.js +0 -1
  511. package/build/dist/chunks/IUE6RASI.js +0 -1
  512. package/build/dist/chunks/JWCOXLYA.js +0 -1
  513. package/build/dist/chunks/KHJFXJBU.js +0 -1
  514. package/build/dist/chunks/LLM5WDM3.js +0 -1
  515. package/build/dist/chunks/LQGPMOD2.js +0 -1
  516. package/build/dist/chunks/MYBDO5SA.js +0 -1
  517. package/build/dist/chunks/NAYRD43N.js +0 -1
  518. package/build/dist/chunks/NMYGNJIJ.js +0 -1
  519. package/build/dist/chunks/NSOEDRBU.js +0 -3
  520. package/build/dist/chunks/PZHR4ITH.js +0 -1
  521. package/build/dist/chunks/R7SXC74O.js +0 -1
  522. package/build/dist/chunks/RETS2ZEK.js +0 -1
  523. package/build/dist/chunks/SJPYXNOK.js +0 -1
  524. package/build/dist/chunks/SQZRVIVF.js +0 -1
  525. package/build/dist/chunks/SXAIXD56.js +0 -1
  526. package/build/dist/chunks/SXX3VTBP.js +0 -1
  527. package/build/dist/chunks/TMGWXDCZ.js +0 -1
  528. package/build/dist/chunks/TNLHMDWL.js +0 -1
  529. package/build/dist/chunks/UFS2RVEZ.js +0 -1
  530. package/build/dist/chunks/USSOVTD5.js +0 -1
  531. package/build/dist/chunks/UWOFA6GV.js +0 -1
  532. package/build/dist/chunks/V2OOOV6B.js +0 -1
  533. package/build/dist/chunks/XVFLT275.js +0 -1
  534. package/build/dist/chunks/YHB55C5T.js +0 -1
  535. package/build/dist/chunks/YOENHHKI.js +0 -1
@@ -1 +1 @@
1
- import{A as le,s as D,x as W}from"./YOENHHKI.js";import{d as fe}from"./MKQVS3IO.js";import{a as me,b as ee,c as de,e as oe,f as ye,g as pe,h as V,i as b,j as g,l as M,m as N,o as U,p as B,q as T,s as O,u as E,v as _}from"./5OEHZJ6X.js";import{b as G,g as K,h as X,i as se,j as ue}from"./ACN2BFMA.js";import{c as Z}from"./73N3TOJL.js";import{a as i}from"./5YS5V2LK.js";import{encodeAbiParameters as Oe,getAddress as we,keccak256 as Ke,parseAbi as Ve,toHex as ae,zeroAddress as je}from"viem";import{encodeAbiParameters as ge,encodePacked as Ce,getAddress as Ae,keccak256 as te,parseAbi as Fe,toHex as Le,zeroAddress as ke}from"viem";var Re=1n<<256n,ve=1n<<128n,Ue=Fe(["function extsload(bytes32[] slots) view returns (bytes32[])"]),$=(o,n)=>({type:"object",additionalProperties:!1,properties:o,required:n}),qe={oneOf:[$({kind:{const:"family"},launcher:Z,familyId:ee,member:{type:"string",enum:["0","1","2","3","4","5","6","7"]}},["kind","launcher","familyId","member"]),$({kind:{const:"nft"},tokenId:me},["kind","tokenId"]),$({kind:{const:"agent-account"},account:Z,positionId:ee},["kind","account","positionId"])]};function Ne(o){let n=N(o);if(n.kind!=="family")throw new i("This step supports Launcher family positions only. NFT and agent-account position reads are reserved for a later integration.");oe(n,["kind","launcher","familyId","member"],["kind","launcher","familyId","member"]);let e=ye(n.member,8);if(e>7n)throw new i("Hookr family member must be a decimal string from 0 to 7.");return{kind:"family",launcher:ue(n.launcher),familyId:V(n.familyId),member:e.toString()}}var C=o=>Le(BigInt.asUintN(256,o),{size:32}),ne=(o,n)=>te(ge([{type:"bytes32"},{type:"bytes32"}],[o,n]));function re(o,n,e,a,r,H){let w=ne(o,C(6n)),P=m=>ne(C(BigInt(m)),C(BigInt(w)+4n)),y=te(ge([{type:"bytes32"},{type:"uint8"}],[e,a])),c=te(Ce(["address","int24","int24","bytes32"],[n,r,H,y])),u=ne(c,C(BigInt(w)+6n));return[w,C(BigInt(w)+1n),C(BigInt(w)+2n),C(BigInt(P(r))+1n),C(BigInt(P(r))+2n),C(BigInt(P(H))+1n),C(BigInt(P(H))+2n),u,C(BigInt(u)+1n),C(BigInt(u)+2n)]}function Q(o,n,e,a,r,H){return BigInt.asUintN(256,a<r?n-e:a>=H?e-n:o-n-e)}function J(o,n,e){if(o<0n||o>=1n<<128n||[n,e].some(a=>a<0n||a>=Re))throw new i("Hookr fee inputs are outside the verified v4 layout.");return o*BigInt.asUintN(256,n-e)/ve}function ie(o){let n=N(o),e={currency0:b(n.currency0),currency1:b(n.currency1),fee:Number(g(n.fee,24)),tickSpacing:Number(g(n.tickSpacing,24)),hooks:b(n.hooks)};if(BigInt(e.currency0)>=BigInt(e.currency1)||e.fee!==8388608||e.hooks!==T||e.tickSpacing<1||e.tickSpacing>32767)throw new i("Hookr family PoolKey is not a supported Root dynamic-fee pool.");return e}async function Te(o,n,e,a){let r=await X(o,a),H={},w=new Set,P=(t,k=[])=>B(o,e.launcher,U(e.launcher===Ae(G.launcherV1)?"launcherV1":"launcher"),t,k,r.number),y=async(t,k)=>{try{return await k()}catch(S){return H[t]=S instanceof i?S.message:`Hookr ${t} read failed at block ${r.number}. Retry the named-block read; no zero or empty result is implied.`,null}},c={chainId:4663,blockNumber:r.number.toString(),blockHash:r.hash,position:e,owner:null,ownedByWallet:null,poolId:null,poolKey:null,range:null,liquidity:null,tokens:null,principal:null,uncollectedLpFees:null,collectedLpFees:null,claimableCoreCredits:null,poolPendingRecapture:null,inRange:null,gateStatus:null,locks:null},u=async()=>(await se(o,r),{...c,readStatus:{status:Object.keys(H).length?"partial":"complete",reasons:H},warnings:["collectedLpFees is null: no complete collection-history reconstruction is available in this step.","LP fees can include donations already released into v4 fee growth. Pending recapture is pool-level, unallocated and excluded from LP fees.","Principal is current withdrawable token inventory before fees, gas or price changes; it is not the original deposit value."]});if(await y("pins",async()=>(await K(o,r.number,[e.launcher,T,O],w),!0))===null)return u();let m=await y("owner",async()=>{let t=b(await P("familyOwner",[e.familyId]));if(t===ke)throw new i("Hookr family does not exist at this block. Check its Launcher and family ID.");return t});if(m===null)return u();c.owner=m,c.ownedByWallet=m===n;let R=await y("position",async()=>{let[t,k,S]=await Promise.all([P("memberCount",[e.familyId]),P("position",[e.familyId,Number(e.member)]),P("poolManager")]);if(S!==O||g(t,8)>8n||BigInt(e.member)>=g(t,8))throw new i("Hookr family member or PoolManager is invalid.");let h=N(k),d=ie(h.key);if(typeof h.tickLower!="number"||typeof h.tickUpper!="number")throw new i("Hookr position range is incomplete.");W(h.tickLower,h.tickUpper,d.tickSpacing);let s=g(h.liquidity,128),L=D(d);if(await P("poolFamily",[L])!==e.familyId)throw new i("Hookr pool does not belong to this family.");return{key:d,id:L,tickLower:h.tickLower,tickUpper:h.tickUpper,liquidity:s}});if(R===null)return u();let{key:l,id:p,tickLower:A,tickUpper:I,liquidity:v}=R;c.poolKey=l,c.poolId=p,c.range={tickLower:A,tickUpper:I},c.liquidity=v.toString();let[f,q,F]=await Promise.all([y("tokens",()=>Promise.all([_(o,l.currency0,r.number),_(o,l.currency1,r.number)])),y("feeGrowth",async()=>{let t=re(p,e.launcher,e.familyId,Number(e.member),A,I),k=await B(o,O,Ue,"extsload",[t],r.number),S=M(k,10).map(Be=>BigInt(V(Be))),[h,d,s,L,Y,x,j,Pe,Ie,Se]=S,ce=h&(1n<<160n)-1n,z=Number(BigInt.asIntN(24,h>>160n));if(ce===0n||z<-887272||z>887272||Pe!==v)throw new i("Hookr PoolManager position is uninitialized or differs from the Launcher liquidity. No principal or fee amount is inferred.");let He=Q(d,L,x,z,A,I),xe=Q(s,Y,j,z,A,I);return{sqrtPriceX96:ce,tick:z,fee0:J(v,He,Ie),fee1:J(v,xe,Se)}}),y("poolConfig",async()=>{let t=N(await B(o,T,U("rootV1"),"poolConfig",[p],r.number));if(b(t.liquidityOwner)!==e.launcher||![l.currency0,l.currency1].includes(b(t.subject))||![l.currency0,l.currency1].includes(b(t.quote))||t.subject===t.quote)throw new i("Hookr pool configuration differs from this family position.");let k=b(t.rules),S=E(k);return await K(o,r.number,[k],w),{pc:t,core:k,role:S}})]);if(c.tokens=f,q&&(c.inRange=q.tick>=A&&q.tick<I,f)){let t=le({liquidity:v,tickLower:A,tickUpper:I,sqrtPriceX96:q.sqrtPriceX96});c.principal=[{token:f[0],amount:t.amount0.toString()},{token:f[1],amount:t.amount1.toString()}],c.uncollectedLpFees=[{token:f[0],amount:q.fee0.toString()},{token:f[1],amount:q.fee1.toString()}]}if(F){let t=(s,L=[])=>B(o,F.core,U("rulesV1"),s,L,r.number),[k,S,h,d]=await Promise.all([y("gateStatus",async()=>{let s=b(F.pc.advisory);return s!==ke&&await K(o,r.number,[s],w),fe(o,r.number,p,e.launcher,s)}),y("locks",async()=>be(o,{position:e,block:r,poolId:p,core:F.core,role:F.role})),y("claimableCoreCredits",async()=>{if(!f)throw new i("Read token metadata before displaying core credits.");let s=await t("poolAccruedCurrencies",[p]);if(!Array.isArray(s)||s.length>32||s.some(x=>x!==l.currency0&&x!==l.currency1))throw new i("Core accrual includes unmeasured currencies; read the core directly before collecting.");let[L,Y]=await Promise.all([Promise.all([l.currency0,l.currency1].map(x=>t("poolAccrued",[p,x]))),Promise.all([l.currency0,l.currency1].map(x=>B(o,F.core,U(F.role),"claimable",[x,n],r.number)))]);return{core:F.core,familyOwnerAccrual:L.map((x,j)=>({token:f[j],amount:g(x).toString()})),walletCredits:Y.map((x,j)=>({token:f[j],amount:g(x).toString()})),walletCreditsScope:"Core-wide wallet credits, not attributed to this position. Do not add them to LP fees."}}),y("poolPendingRecapture",async()=>{if(!f)throw new i("Read token metadata before displaying pending recapture.");let s=M(await t("pendingDonation",[p]),5).map(L=>g(L));return{due:[{token:f[0],amount:s[0].toString()},{token:f[1],amount:s[1].toString()}],fresh:[{token:f[0],amount:s[2].toString()},{token:f[1],amount:s[3].toString()}],freshChildBlock:s[4].toString(),scope:"pool",allocatedToPosition:!1}})]);c.gateStatus=k,c.locks=S,c.claimableCoreCredits=h,c.poolPendingRecapture=d}return u()}function Je(o){return[{name:"hookr_lp_position",inputSchema:$({position:qe,...de},["position"]),execute:async(n,e)=>{oe(n,["position","blockNumber"],["position"]);let a=Ne(n.position);if(o.network==="testnet")throw new i("Hookr LP reads are configured only on mainnet, chain 4663.");try{return await Te(o.clientFor(4663),e,a,pe(n))}catch(r){throw r instanceof i?r:new i("Hookr position block is unavailable. Retry the complete named-block read; no zero position or fee is implied.")}}}]}var he=o=>U(o.launcher===we(G.launcherV1)?"launcherV1":"launcher");function ze(o){let n=Ke(Oe([{type:"bytes32"},{type:"bytes32"}],[o,"0x3c0d3d8cba92527b3a48aa783c8734a4e170057eb16401c9df8a7c8a6588b900"]));return ae(BigInt(n)+5n,{size:32})}async function Me(o,n){try{let e="0x0000000000000000000000000000000000000a11",a=await o.request({method:"eth_call",params:[{to:e,data:"0x"},ae(n.number),{[e]:{code:"0x4360005260206000f3"}}]});return BigInt(V(a))}catch{throw new i("Hookr parent-block clock is unavailable. Retry with an RPC supporting named-block eth_call state overrides; child-chain height cannot establish lock expiry.")}}async function io(o,n,e){let a=await X(o);await K(o,a.number,[e.launcher,T,O]);let r=(d,s=[])=>B(o,e.launcher,he(e),d,s,a.number),[H,w,P,y]=await Promise.all([r("familyOwner",[e.familyId]),r("memberCount",[e.familyId]),r("position",[e.familyId,Number(e.member)]),r("poolManager")]),c=b(H);if(c===je||c!==n)throw new i("Only the current Hookr family owner can add, collect or remove this position. Use its signing wallet.");if(y!==O||g(w,8)<1n||g(w,8)>8n||BigInt(e.member)>=g(w,8))throw new i("Hookr family member or PoolManager differs from the reviewed deployment.");let u=N(P),m=ie(u.key),R=g(u.liquidity,128);if(typeof u.tickLower!="number"||typeof u.tickUpper!="number")throw new i("Hookr family range is unavailable.");let l=u.tickLower,p=u.tickUpper;W(l,p,m.tickSpacing);let A=D(m);if(await r("poolFamily",[A])!==e.familyId)throw new i("Hookr pool does not belong to this Launcher family.");let I=N(await B(o,T,U("rootV1"),"poolConfig",[A],a.number)),v=b(I.rules),f=E(v);if(b(I.liquidityOwner)!==e.launcher||![m.currency0,m.currency1].includes(b(I.subject))||![m.currency0,m.currency1].includes(b(I.quote))||I.subject===I.quote)throw new i("Hookr pool configuration differs from this family key.");await K(o,a.number,[v]);let[q,F]=await Promise.all([Promise.all([m.currency0,m.currency1].map(d=>_(o,d,a.number))),B(o,O,Ve(["function extsload(bytes32[] slots) view returns (bytes32[])"]),"extsload",[re(A,e.launcher,e.familyId,Number(e.member),l,p)],a.number)]),t=M(F,10).map(d=>BigInt(V(d))),k=t[0]&(1n<<160n)-1n,S=Number(BigInt.asIntN(24,t[0]>>160n));if(!k||S<-887272||S>887272||t[7]!==R)throw new i("Hookr PoolManager state differs from the family position. Retry the full read.");let h=[0,1].map(d=>J(R,Q(t[1+d],t[3+d],t[5+d],S,l,p),t[8+d]));return{position:e,block:a,owner:c,key:m,poolId:A,liquidity:R,tickLower:l,tickUpper:p,sqrtPriceX96:k,fees:h,tokens:q,pc:I,core:v,role:f}}async function be(o,n){let{position:e,block:a,poolId:r,core:H,role:w}=n,[P,y,c,u]=await Promise.all([B(o,e.launcher,he(e),"principalLockedUntil",[e.familyId],a.number),B(o,H,U(w),"removalLockedUntil",[r],a.number),o.getStorageAt({address:T,slot:ze(r),blockNumber:a.number}),Me(o,a)]),m=BigInt(V(c));if(we(ae(m&(1n<<160n)-1n,{size:20}))!==e.launcher)throw new i("Hookr frozen Root lock storage does not match the family owner contract.");let R=m>>160n&(1n<<40n)-1n,l=g(P),p=g(y);return{clock:"parent-block",parentBlock:u.toString(),familyUntilParentBlock:l.toString(),poolRulesUntilParentBlock:p.toString(),rootUntilParentBlock:R.toString(),currentlyLocked:u<l||u<p||u<R,feesCollectableDuringPrincipalLocks:!0}}export{he as a,ze as b,Me as c,io as d,be as e,qe as f,Ne as g,re as h,Q as i,J as j,ie as k,Te as l,Je as m};
1
+ import{A as le,s as D,x as W}from"./WPAF55SP.js";import{d as fe}from"./NA7R6J5N.js";import{a as me,b as ee,c as de,e as oe,f as ye,g as pe,h as V,i as b,j as g,l as M,m as N,o as U,p as B,q as T,s as O,u as E,v as _}from"./YEXUSRIZ.js";import{b as G,g as K,h as X,i as se,j as ue}from"./MQK6OP7S.js";import{c as Z}from"./5KUWLUPM.js";import{a as i}from"./XSD5NL7J.js";import{encodeAbiParameters as Oe,getAddress as we,keccak256 as Ke,parseAbi as Ve,toHex as ae,zeroAddress as je}from"viem";import{encodeAbiParameters as ge,encodePacked as Ce,getAddress as Ae,keccak256 as te,parseAbi as Fe,toHex as Le,zeroAddress as ke}from"viem";var Re=1n<<256n,ve=1n<<128n,Ue=Fe(["function extsload(bytes32[] slots) view returns (bytes32[])"]),$=(o,n)=>({type:"object",additionalProperties:!1,properties:o,required:n}),qe={oneOf:[$({kind:{const:"family"},launcher:Z,familyId:ee,member:{type:"string",enum:["0","1","2","3","4","5","6","7"]}},["kind","launcher","familyId","member"]),$({kind:{const:"nft"},tokenId:me},["kind","tokenId"]),$({kind:{const:"agent-account"},account:Z,positionId:ee},["kind","account","positionId"])]};function Ne(o){let n=N(o);if(n.kind!=="family")throw new i("This step supports Launcher family positions only. NFT and agent-account position reads are reserved for a later integration.");oe(n,["kind","launcher","familyId","member"],["kind","launcher","familyId","member"]);let e=ye(n.member,8);if(e>7n)throw new i("Hookr family member must be a decimal string from 0 to 7.");return{kind:"family",launcher:ue(n.launcher),familyId:V(n.familyId),member:e.toString()}}var C=o=>Le(BigInt.asUintN(256,o),{size:32}),ne=(o,n)=>te(ge([{type:"bytes32"},{type:"bytes32"}],[o,n]));function re(o,n,e,a,r,H){let w=ne(o,C(6n)),P=m=>ne(C(BigInt(m)),C(BigInt(w)+4n)),y=te(ge([{type:"bytes32"},{type:"uint8"}],[e,a])),c=te(Ce(["address","int24","int24","bytes32"],[n,r,H,y])),u=ne(c,C(BigInt(w)+6n));return[w,C(BigInt(w)+1n),C(BigInt(w)+2n),C(BigInt(P(r))+1n),C(BigInt(P(r))+2n),C(BigInt(P(H))+1n),C(BigInt(P(H))+2n),u,C(BigInt(u)+1n),C(BigInt(u)+2n)]}function Q(o,n,e,a,r,H){return BigInt.asUintN(256,a<r?n-e:a>=H?e-n:o-n-e)}function J(o,n,e){if(o<0n||o>=1n<<128n||[n,e].some(a=>a<0n||a>=Re))throw new i("Hookr fee inputs are outside the verified v4 layout.");return o*BigInt.asUintN(256,n-e)/ve}function ie(o){let n=N(o),e={currency0:b(n.currency0),currency1:b(n.currency1),fee:Number(g(n.fee,24)),tickSpacing:Number(g(n.tickSpacing,24)),hooks:b(n.hooks)};if(BigInt(e.currency0)>=BigInt(e.currency1)||e.fee!==8388608||e.hooks!==T||e.tickSpacing<1||e.tickSpacing>32767)throw new i("Hookr family PoolKey is not a supported Root dynamic-fee pool.");return e}async function Te(o,n,e,a){let r=await X(o,a),H={},w=new Set,P=(t,k=[])=>B(o,e.launcher,U(e.launcher===Ae(G.launcherV1)?"launcherV1":"launcher"),t,k,r.number),y=async(t,k)=>{try{return await k()}catch(S){return H[t]=S instanceof i?S.message:`Hookr ${t} read failed at block ${r.number}. Retry the named-block read; no zero or empty result is implied.`,null}},c={chainId:4663,blockNumber:r.number.toString(),blockHash:r.hash,position:e,owner:null,ownedByWallet:null,poolId:null,poolKey:null,range:null,liquidity:null,tokens:null,principal:null,uncollectedLpFees:null,collectedLpFees:null,claimableCoreCredits:null,poolPendingRecapture:null,inRange:null,gateStatus:null,locks:null},u=async()=>(await se(o,r),{...c,readStatus:{status:Object.keys(H).length?"partial":"complete",reasons:H},warnings:["collectedLpFees is null: no complete collection-history reconstruction is available in this step.","LP fees can include donations already released into v4 fee growth. Pending recapture is pool-level, unallocated and excluded from LP fees.","Principal is current withdrawable token inventory before fees, gas or price changes; it is not the original deposit value."]});if(await y("pins",async()=>(await K(o,r.number,[e.launcher,T,O],w),!0))===null)return u();let m=await y("owner",async()=>{let t=b(await P("familyOwner",[e.familyId]));if(t===ke)throw new i("Hookr family does not exist at this block. Check its Launcher and family ID.");return t});if(m===null)return u();c.owner=m,c.ownedByWallet=m===n;let R=await y("position",async()=>{let[t,k,S]=await Promise.all([P("memberCount",[e.familyId]),P("position",[e.familyId,Number(e.member)]),P("poolManager")]);if(S!==O||g(t,8)>8n||BigInt(e.member)>=g(t,8))throw new i("Hookr family member or PoolManager is invalid.");let h=N(k),d=ie(h.key);if(typeof h.tickLower!="number"||typeof h.tickUpper!="number")throw new i("Hookr position range is incomplete.");W(h.tickLower,h.tickUpper,d.tickSpacing);let s=g(h.liquidity,128),L=D(d);if(await P("poolFamily",[L])!==e.familyId)throw new i("Hookr pool does not belong to this family.");return{key:d,id:L,tickLower:h.tickLower,tickUpper:h.tickUpper,liquidity:s}});if(R===null)return u();let{key:l,id:p,tickLower:A,tickUpper:I,liquidity:v}=R;c.poolKey=l,c.poolId=p,c.range={tickLower:A,tickUpper:I},c.liquidity=v.toString();let[f,q,F]=await Promise.all([y("tokens",()=>Promise.all([_(o,l.currency0,r.number),_(o,l.currency1,r.number)])),y("feeGrowth",async()=>{let t=re(p,e.launcher,e.familyId,Number(e.member),A,I),k=await B(o,O,Ue,"extsload",[t],r.number),S=M(k,10).map(Be=>BigInt(V(Be))),[h,d,s,L,Y,x,j,Pe,Ie,Se]=S,ce=h&(1n<<160n)-1n,z=Number(BigInt.asIntN(24,h>>160n));if(ce===0n||z<-887272||z>887272||Pe!==v)throw new i("Hookr PoolManager position is uninitialized or differs from the Launcher liquidity. No principal or fee amount is inferred.");let He=Q(d,L,x,z,A,I),xe=Q(s,Y,j,z,A,I);return{sqrtPriceX96:ce,tick:z,fee0:J(v,He,Ie),fee1:J(v,xe,Se)}}),y("poolConfig",async()=>{let t=N(await B(o,T,U("rootV1"),"poolConfig",[p],r.number));if(b(t.liquidityOwner)!==e.launcher||![l.currency0,l.currency1].includes(b(t.subject))||![l.currency0,l.currency1].includes(b(t.quote))||t.subject===t.quote)throw new i("Hookr pool configuration differs from this family position.");let k=b(t.rules),S=E(k);return await K(o,r.number,[k],w),{pc:t,core:k,role:S}})]);if(c.tokens=f,q&&(c.inRange=q.tick>=A&&q.tick<I,f)){let t=le({liquidity:v,tickLower:A,tickUpper:I,sqrtPriceX96:q.sqrtPriceX96});c.principal=[{token:f[0],amount:t.amount0.toString()},{token:f[1],amount:t.amount1.toString()}],c.uncollectedLpFees=[{token:f[0],amount:q.fee0.toString()},{token:f[1],amount:q.fee1.toString()}]}if(F){let t=(s,L=[])=>B(o,F.core,U("rulesV1"),s,L,r.number),[k,S,h,d]=await Promise.all([y("gateStatus",async()=>{let s=b(F.pc.advisory);return s!==ke&&await K(o,r.number,[s],w),fe(o,r.number,p,e.launcher,s)}),y("locks",async()=>be(o,{position:e,block:r,poolId:p,core:F.core,role:F.role})),y("claimableCoreCredits",async()=>{if(!f)throw new i("Read token metadata before displaying core credits.");let s=await t("poolAccruedCurrencies",[p]);if(!Array.isArray(s)||s.length>32||s.some(x=>x!==l.currency0&&x!==l.currency1))throw new i("Core accrual includes unmeasured currencies; read the core directly before collecting.");let[L,Y]=await Promise.all([Promise.all([l.currency0,l.currency1].map(x=>t("poolAccrued",[p,x]))),Promise.all([l.currency0,l.currency1].map(x=>B(o,F.core,U(F.role),"claimable",[x,n],r.number)))]);return{core:F.core,familyOwnerAccrual:L.map((x,j)=>({token:f[j],amount:g(x).toString()})),walletCredits:Y.map((x,j)=>({token:f[j],amount:g(x).toString()})),walletCreditsScope:"Core-wide wallet credits, not attributed to this position. Do not add them to LP fees."}}),y("poolPendingRecapture",async()=>{if(!f)throw new i("Read token metadata before displaying pending recapture.");let s=M(await t("pendingDonation",[p]),5).map(L=>g(L));return{due:[{token:f[0],amount:s[0].toString()},{token:f[1],amount:s[1].toString()}],fresh:[{token:f[0],amount:s[2].toString()},{token:f[1],amount:s[3].toString()}],freshChildBlock:s[4].toString(),scope:"pool",allocatedToPosition:!1}})]);c.gateStatus=k,c.locks=S,c.claimableCoreCredits=h,c.poolPendingRecapture=d}return u()}function Je(o){return[{name:"hookr_lp_position",inputSchema:$({position:qe,...de},["position"]),execute:async(n,e)=>{oe(n,["position","blockNumber"],["position"]);let a=Ne(n.position);if(o.network==="testnet")throw new i("Hookr LP reads are configured only on mainnet, chain 4663.");try{return await Te(o.clientFor(4663),e,a,pe(n))}catch(r){throw r instanceof i?r:new i("Hookr position block is unavailable. Retry the complete named-block read; no zero position or fee is implied.")}}}]}var he=o=>U(o.launcher===we(G.launcherV1)?"launcherV1":"launcher");function ze(o){let n=Ke(Oe([{type:"bytes32"},{type:"bytes32"}],[o,"0x3c0d3d8cba92527b3a48aa783c8734a4e170057eb16401c9df8a7c8a6588b900"]));return ae(BigInt(n)+5n,{size:32})}async function Me(o,n){try{let e="0x0000000000000000000000000000000000000a11",a=await o.request({method:"eth_call",params:[{to:e,data:"0x"},ae(n.number),{[e]:{code:"0x4360005260206000f3"}}]});return BigInt(V(a))}catch{throw new i("Hookr parent-block clock is unavailable. Retry with an RPC supporting named-block eth_call state overrides; child-chain height cannot establish lock expiry.")}}async function io(o,n,e){let a=await X(o);await K(o,a.number,[e.launcher,T,O]);let r=(d,s=[])=>B(o,e.launcher,he(e),d,s,a.number),[H,w,P,y]=await Promise.all([r("familyOwner",[e.familyId]),r("memberCount",[e.familyId]),r("position",[e.familyId,Number(e.member)]),r("poolManager")]),c=b(H);if(c===je||c!==n)throw new i("Only the current Hookr family owner can add, collect or remove this position. Use its signing wallet.");if(y!==O||g(w,8)<1n||g(w,8)>8n||BigInt(e.member)>=g(w,8))throw new i("Hookr family member or PoolManager differs from the reviewed deployment.");let u=N(P),m=ie(u.key),R=g(u.liquidity,128);if(typeof u.tickLower!="number"||typeof u.tickUpper!="number")throw new i("Hookr family range is unavailable.");let l=u.tickLower,p=u.tickUpper;W(l,p,m.tickSpacing);let A=D(m);if(await r("poolFamily",[A])!==e.familyId)throw new i("Hookr pool does not belong to this Launcher family.");let I=N(await B(o,T,U("rootV1"),"poolConfig",[A],a.number)),v=b(I.rules),f=E(v);if(b(I.liquidityOwner)!==e.launcher||![m.currency0,m.currency1].includes(b(I.subject))||![m.currency0,m.currency1].includes(b(I.quote))||I.subject===I.quote)throw new i("Hookr pool configuration differs from this family key.");await K(o,a.number,[v]);let[q,F]=await Promise.all([Promise.all([m.currency0,m.currency1].map(d=>_(o,d,a.number))),B(o,O,Ve(["function extsload(bytes32[] slots) view returns (bytes32[])"]),"extsload",[re(A,e.launcher,e.familyId,Number(e.member),l,p)],a.number)]),t=M(F,10).map(d=>BigInt(V(d))),k=t[0]&(1n<<160n)-1n,S=Number(BigInt.asIntN(24,t[0]>>160n));if(!k||S<-887272||S>887272||t[7]!==R)throw new i("Hookr PoolManager state differs from the family position. Retry the full read.");let h=[0,1].map(d=>J(R,Q(t[1+d],t[3+d],t[5+d],S,l,p),t[8+d]));return{position:e,block:a,owner:c,key:m,poolId:A,liquidity:R,tickLower:l,tickUpper:p,sqrtPriceX96:k,fees:h,tokens:q,pc:I,core:v,role:f}}async function be(o,n){let{position:e,block:a,poolId:r,core:H,role:w}=n,[P,y,c,u]=await Promise.all([B(o,e.launcher,he(e),"principalLockedUntil",[e.familyId],a.number),B(o,H,U(w),"removalLockedUntil",[r],a.number),o.getStorageAt({address:T,slot:ze(r),blockNumber:a.number}),Me(o,a)]),m=BigInt(V(c));if(we(ae(m&(1n<<160n)-1n,{size:20}))!==e.launcher)throw new i("Hookr frozen Root lock storage does not match the family owner contract.");let R=m>>160n&(1n<<40n)-1n,l=g(P),p=g(y);return{clock:"parent-block",parentBlock:u.toString(),familyUntilParentBlock:l.toString(),poolRulesUntilParentBlock:p.toString(),rootUntilParentBlock:R.toString(),currentlyLocked:u<l||u<p||u<R,feesCollectableDuringPrincipalLocks:!0}}export{he as a,ze as b,Me as c,io as d,be as e,qe as f,Ne as g,re as h,Q as i,J as j,ie as k,Te as l,Je as m};
@@ -0,0 +1,70 @@
1
+ import{a as ot}from"./63YRSLDK.js";var yt={};ot(yt,{ACCESS_FEE_LINE:()=>M,ACCESS_NO_PLAN:()=>T,BANNED_COPY:()=>pt,BONUS_CLAUSE:()=>h,CARD_FOOTER_ASK:()=>E,CARD_FOOTER_NO_ASK:()=>k,CARD_HEADER:()=>s,CARD_HEADER_AMOUNT:()=>r,CARD_HEADER_AMOUNT_NOT_HELD:()=>i,ETH_HINT:()=>f,FEES_ESTIMATED_HIGH:()=>K,LAYERBANK_RISK_SUMMARY:()=>u,LAYERBANK_SETUP_MISMATCH:()=>Q,LAYERBANK_SITE:()=>st,LB_BONUS_NOTE:()=>N,LB_CASH_NOTE:()=>O,LB_DEPOSIT_SCREEN:()=>x,LB_WITHDRAW_SCREEN:()=>S,LP_ADD_BUTTON:()=>lt,LP_BLOCK:()=>q,LP_BLOCK_UNREADABLE:()=>j,LP_DECLINE_BUTTON:()=>ht,LP_NOT_WORTH_CLAUSE:()=>X,MATURED_NOTICE:()=>W,MATURED_STOCK_NOTICE:()=>F,MATURED_STOCK_NOTICE_NO_AMOUNT:()=>z,NOTHING_TO_EARN:()=>b,NO_NEW_TERM:()=>$,OPTION_A:()=>l,OPTION_A_CANT_CHECK:()=>y,OPTION_A_CLOSED:()=>g,OPTION_A_NO_ROOM:()=>m,OPTION_B:()=>c,OPTION_B_CANT_CHECK:()=>w,OPTION_B_NONE:()=>p,PAYOUT_APPROX:()=>U,PAYOUT_EXACT:()=>v,PENDLE_BUY_STABLE_SCREEN:()=>A,PENDLE_BUY_STOCK_SCREEN:()=>L,PENDLE_CONTRACT_CHANGE:()=>ut,PENDLE_EARLY_EXIT:()=>_,PENDLE_FIXED_RATE:()=>it,PENDLE_REDEEM_SCREEN:()=>I,PENDLE_REDEEM_STOCK_SCREEN:()=>R,PENDLE_RISK_SUMMARY:()=>d,PENDLE_SELL_DEFAULT_BUTTON:()=>dt,PENDLE_SELL_GAP_LINE:()=>D,PENDLE_SELL_NO_GAP_LINE:()=>C,PENDLE_SELL_SCREEN:()=>P,PENDLE_SERVICE_DOWN:()=>tt,PENDLE_SITE:()=>rt,PRICE_MISMATCH_REFUSAL:()=>J,SLIPPAGE_CAP_REFUSAL:()=>V,STOCK_PAID_IN:()=>B,STOCK_SHORT_TERM:()=>Y,STOCK_SHORT_TERM_DAYS:()=>_t,TEMPLATES:()=>ct,THIN_MARKET_REFUSAL:()=>Z,TOO_SMALL:()=>G,TOO_SMALL_NO_SIZE:()=>H,fill:()=>nt,placeholdersOf:()=>at});function t(e){return{text:e}}function at(e){return[...new Set([...e.text.matchAll(/\{([a-z][a-z0-9_]*)\}/g)].map(o=>o[1]))]}function nt(e,o){let et=o;return e.text.replace(/\{([a-z][a-z0-9_]*)\}/g,(wt,a)=>{let n=et[a];if(typeof n!="string")throw new Error(`Missing value for {${a}}`);return n})}var st="layerbank.finance",rt="app.pendle.finance",s=t("You have {amount_usd} in USDG that isn't earning anything. Here are two ways to make it earn. Pick one, or neither."),r=t("Looking at {amount_usd} of your USDG. Here are two ways to make it earn. Pick one, or neither."),i=t("Looking at {amount_usd} of USDG. Here are two ways to make it earn. Pick one, or neither."),u="LayerBank is a lending app; if its code fails or almost everything is lent out, you could lose money or have to wait.",d="Pendle is a trading app; thin trading can make leaving early cost you, and its code can fail or be changed by its team.",_="If you leave early you sell at the market price that day, and that can be less than you put in.",it="The rate is fixed only if you hold until the end date.",ut="Pendle's router can be upgraded by Pendle's team, so its code can change.",l=t(`A. LayerBank: lending, take it out any time
2
+ Pays about {lb_total_rate}% a year today ({lb_base_rate}% from borrowers{bonus_clause}). The rate changes, up or down.
3
+ You can take your money out any time while LayerBank has cash on hand (right now {lb_cash_usd}).
4
+ Risk: ${u}
5
+ Cost: network fees of about {lb_gas_in_usd} to put it in and {lb_gas_out_usd} to take it out.`),h=t(", plus a bonus of {lb_bonus_rate}% that ends {bonus_end}"),c=t(`B. Pendle: a fixed rate until {pendle_end_date}
6
+ Pays a fixed {pendle_rate}% a year if you keep it until {pendle_end_date}. You get {pendle_payout_usd} back for every {pendle_unit_usd} you put in.
7
+ ${_}
8
+ Risk: ${d}
9
+ Cost: about {pendle_cost_in_usd} in fees to start and about {pendle_gas_out_usd} to cash out.`),p=t("B. Pendle has no fixed-rate USDG term open right now."),y=t("A. LayerBank can't be checked right now, so I won't offer it."),w=t("B. Pendle can't be checked right now, so I won't offer it."),g=t("A. LayerBank isn't taking new deposits right now, so I won't offer it."),m=t("A. LayerBank can only take {cap_room_usd} more right now, which is less than {amount_usd}, so I won't offer it."),E=t("Nobody guarantees either one. Which do you want: {choices}?"),k=t("Nobody guarantees either one."),f=t("You hold ETH but no USDG. I can swap some ETH to USDG first with Oak's swap tool and show you the price before anything happens."),b=t("This wallet holds no USDG and no ETH to put to work, so there is nothing to compare yet."),T=t("Putting money in or taking it out through Oak needs an active Oak plan ({plan_price}). Taking it out on {project_site} always works too, with this same wallet."),x=t(`Put {amount_usd} into LayerBank?
10
+
11
+ What you get: about {lb_total_rate}% a year at today's rate. The rate changes.
12
+ What happens: {amount_usd} of USDG leaves your wallet and becomes {amount_usd} of "lRobUSDG", your receipt for money lent through LayerBank. Your receipt grows as interest arrives.
13
+ The risk: LayerBank is a lending app. If its code fails, or almost everything is lent out, you could lose money or have to wait to get it back.
14
+ Taking it out: any time LayerBank has cash on hand. Right now that is {lb_cash_usd}. You can also take it out on layerbank.finance with this wallet.
15
+ Cost: about {gas_usd} in network fees now and about {gas_out_usd} to take it out.
16
+
17
+ Put in {amount_usd}? [Yes] [No]`),S=t(`Take {amount_or_all} out of LayerBank?
18
+
19
+ You get back {usdg_out} USDG (your {amount_deposited_clause} plus interest so far{bonus_note}).
20
+ {cash_note}
21
+ Cost: about {gas_usd} in network fees.
22
+
23
+ Take it out? [Yes] [No]`),N=t(". Your bonus is paid separately; ask me to claim it"),O=t("LayerBank only has {lb_cash_usd} on hand right now, so I can take out {max_now} today."),A=t(`Lock {amount_usd} in a fixed rate until {pendle_end_date}?
24
+
25
+ What you get: a fixed {pendle_rate}% a year, if you keep it until {pendle_end_date}. You put in {amount_usd} and get {pt_out} tokens. Each token pays out {payout_per_pt_phrase} on {pendle_end_date}. That is about {gain_usd} more than you put in.
26
+ What happens now: {amount_usd} of USDG leaves your wallet and you receive at least {pt_min} "PT-USDG" tokens (the price can move a little before this goes through; Oak refuses anything worse than {slippage_pct}%).
27
+ The risk: if you leave before {pendle_end_date}, you sell at the market price that day, and that can be less than you put in. Pendle is a trading app; its code can fail, and its team can change it.
28
+ Cost: about {fees_usd} in trading and network fees now, and about {gas_out_usd} to cash out at the end.
29
+
30
+ Lock {amount_usd} until {pendle_end_date}? [Yes] [No]`),L=t(`Lock {amount_units} {stock_symbol} in a fixed rate until {pendle_end_date}?
31
+
32
+ What you get: you put in {amount_units} {stock_symbol} and receive at least {pt_min} tokens. On {pendle_end_date} each token pays out {payout_per_pt_phrase}. That is {gain_units} {stock_symbol} more than you put in, a fixed {pendle_rate}% a year in {stock_symbol}, not in dollars.
33
+ The catch: the payout is in {stock_symbol}, not dollars. If the stock token is worth less on {pendle_end_date}, you get less in dollars, even though the {stock_symbol} count is fixed.
34
+ The risk: leaving early sells at the market price that day, which can be less than you put in. This term is short ({days_left} days), so the extra {stock_symbol} is small. Pendle is a trading app; its code can fail, and its team can change it.
35
+ Cost: about {fees_usd} in trading and network fees now and about {gas_out_usd} to cash out.
36
+
37
+ Lock it until {pendle_end_date}? [Yes] [No]`),P=t(`Leave early and sell {pt_amount} tokens now?
38
+
39
+ If you wait until {pendle_end_date}, these tokens pay {payout_at_end} {unit}.
40
+ If you sell now, the market pays about {sell_now} {unit}, and Oak accepts no less than {sell_min}. {gap_line}
41
+ Selling early can lose money. The price today may be lower than what you paid.
42
+ Cost: about {fees_usd} in trading and network fees.
43
+
44
+ Sell now? [Yes, sell now] [No, keep waiting]`),D=t("That is {gap} less than waiting."),C=t("The market pays at least what waiting would, so selling now loses you nothing."),dt="No, keep waiting",I=t(`Cash out {pt_amount} tokens for {usdg_out} USDG?
45
+
46
+ The term ended on {pendle_end_date}. Each token pays out {payout_per_pt_phrase} now, with no market price involved.
47
+ Cost: about {gas_usd} in network fees.
48
+
49
+ Cash out? [Yes] [No]`),R=t(`Cash out {pt_amount} tokens for about {unit_out} {stock_symbol}?
50
+
51
+ The term ended on {pendle_end_date}. You receive {stock_symbol}, not USDG: about {unit_out} {stock_symbol}, worth about {value_usd} at today's price, which can move. No market price is involved in the payout itself.
52
+ To end up in USDG, I can swap the {stock_symbol} afterwards with Oak's swap tool and show you that price first.
53
+ Cost: about {gas_usd} in network fees.
54
+
55
+ Cash out? [Yes] [No]`),v=t("exactly 1 {unit}"),U=t("about {x} {unit} at today's exchange rate"),B=t("Paid in {stock_symbol}, not dollars."),Y=t("ends in {days_left} days, usually too short to be worth the fees"),_t=7,G=t("At {amount_usd}, this is too small to be worth it. You would earn about {gross_usd} over {horizon}, and fees would take about {costs_usd}, leaving about {net_usd}. Putting in {suggest_usd} or more would be worth it, and I can still do it if you want."),H=t("At {amount_usd}, this is too small to be worth it. You would earn about {gross_usd} over {horizon}, and fees would take about {costs_usd}, leaving about {net_usd}. At today's rate no amount would make up for the fees, and I can still do it if you want."),M=t("Also: Oak access costs {plan_price} per 30 days, which you pay whether or not you earn. At this size that is more than you would earn in a month."),K=t("Fees estimated high because the live price was unavailable."),W=t(`Your fixed term on Pendle ended on {pendle_end_date}. Your {pt_amount} tokens are worth {usdg_out} USDG now.
56
+ Want me to cash out to USDG, or start a new term? One "yes" is enough; say "cash out" or "new term".`),F=t('Your fixed term on Pendle ended on {pendle_end_date}. Your {pt_amount} tokens pay out about {unit_out} {stock_symbol} now, worth about {value_usd}. Want me to cash out and swap that to USDG, or start a new term? One "yes" is enough.'),z=t('Your fixed term on Pendle in {stock_symbol} ended on {pendle_end_date}. Your tokens pay out in {stock_symbol}, not USDG; I will show the exact amount before anything is sent. Want me to cash out and swap that to USDG, or start a new term? One "yes" is enough.'),$=t("There is no new fixed-rate USDG term open right now. I cashed out to USDG; want me to show LayerBank instead?"),q=t(`Before you add liquidity: what it is worth, and what can go wrong
57
+
58
+ Worth: at today's reward rate of about {apr}% a year, {amount_usd} would earn about {gross_usd} until the campaign ends on {end_date}, and about {gas_usd} of that goes to network fees, leaving about {net_usd}. {worth_clause}
59
+ What can go wrong:
60
+ - Price exposure: you put in two coins. If one moves a lot against the other, you can end up with less than you started with, even if you earn rewards.
61
+ - Going out of range: if the price leaves the range you chose, you stop earning until it comes back, and you hold mostly the weaker coin.
62
+ - The rewards can end: the campaign ends on {end_date}, or sooner, and the rate shown is today's rate, which changes.
63
+ Your call. [Add liquidity] [Don't]`),X=t("That is not worth it at this size."),j=t(`Before you add liquidity: what it is worth, and what can go wrong
64
+
65
+ Worth: the reward rate or end date couldn't be read, so I can't tell you what this is worth.
66
+ What can go wrong:
67
+ - Price exposure: you put in two coins. If one moves a lot against the other, you can end up with less than you started with, even if you earn rewards.
68
+ - Going out of range: if the price leaves the range you chose, you stop earning until it comes back, and you hold mostly the weaker coin.
69
+ - The rewards can end: a campaign can end at any time, and any rate shown is the rate of that day, which changes.
70
+ Your call. If you say nothing, the answer is Don't. [Don't] [Add liquidity]`),lt="Add liquidity",ht="Don't",V=t("Oak won't accept a price move that big. The most it allows is {cap_pct}%."),Z=t("This is a thin market and your size moves the price too much. Try a smaller amount."),J=t("Pendle's price doesn't match what Oak checked on the chain. Nothing was signed."),Q=t("LayerBank's setup no longer matches what Oak checked. Nothing was signed."),tt=t("Pendle's price service isn't answering, so I can't quote or start a new term; I can still cash out ended terms."),ct={CARD_HEADER:s,CARD_HEADER_AMOUNT:r,CARD_HEADER_AMOUNT_NOT_HELD:i,OPTION_A:l,BONUS_CLAUSE:h,OPTION_B:c,OPTION_B_NONE:p,OPTION_A_CANT_CHECK:y,OPTION_B_CANT_CHECK:w,OPTION_A_CLOSED:g,OPTION_A_NO_ROOM:m,CARD_FOOTER_ASK:E,CARD_FOOTER_NO_ASK:k,ETH_HINT:f,NOTHING_TO_EARN:b,ACCESS_NO_PLAN:T,LB_DEPOSIT_SCREEN:x,LB_WITHDRAW_SCREEN:S,LB_BONUS_NOTE:N,LB_CASH_NOTE:O,PENDLE_BUY_STABLE_SCREEN:A,PENDLE_BUY_STOCK_SCREEN:L,PENDLE_SELL_SCREEN:P,PENDLE_SELL_GAP_LINE:D,PENDLE_SELL_NO_GAP_LINE:C,PENDLE_REDEEM_SCREEN:I,PENDLE_REDEEM_STOCK_SCREEN:R,PAYOUT_EXACT:v,PAYOUT_APPROX:U,STOCK_PAID_IN:B,STOCK_SHORT_TERM:Y,TOO_SMALL:G,TOO_SMALL_NO_SIZE:H,ACCESS_FEE_LINE:M,FEES_ESTIMATED_HIGH:K,MATURED_NOTICE:W,MATURED_STOCK_NOTICE:F,MATURED_STOCK_NOTICE_NO_AMOUNT:z,NO_NEW_TERM:$,LP_BLOCK:q,LP_NOT_WORTH_CLAUSE:X,LP_BLOCK_UNREADABLE:j,SLIPPAGE_CAP_REFUSAL:V,THIN_MARKET_REFUSAL:Z,PRICE_MISMATCH_REFUSAL:J,LAYERBANK_SETUP_MISMATCH:Q,PENDLE_SERVICE_DOWN:tt},pt=[/\bsafe(ly|ty)?\b/i,/\bguaranteed\b/i,/\brisk-free\b/i,/\bpassive\b/i,/\binvest/i,/\bAPY\b(?! a year)/];export{at as a,nt as b,st as c,rt as d,s as e,r as f,i as g,u as h,d as i,_ as j,it as k,ut as l,l as m,h as n,c as o,p,y as q,w as r,g as s,m as t,E as u,k as v,f as w,b as x,T as y,x as z,S as A,N as B,O as C,A as D,L as E,P as F,D as G,C as H,dt as I,I as J,R as K,v as L,U as M,B as N,Y as O,_t as P,G as Q,H as R,M as S,K as T,W as U,F as V,z as W,$ as X,q as Y,X as Z,j as _,lt as $,ht as aa,V as ba,Z as ca,J as da,Q as ea,tt as fa,ct as ga,pt as ha,yt as ia};
@@ -1 +1 @@
1
- import{d as n,f as a,g as s,h as l,i as u}from"./AMICUXS6.js";import{c as e}from"./JPOYTTTW.js";var m="In-kind exits are a separate unsupported flow.";function b(t,i){return n(t,i,e)}function V(t,i,o,r,x,p){return a(t,i,o,r,x,p,e)}function A(t,i,o){return s(t,i,o,e,m)}function P(t){return l(t,e.symbol)}function S(t,i,o,r){u(t,i,o,r,e)}export{b as a,V as b,A as c,P as d,S as e};
1
+ import{d as n,f as a,g as s,h as l,i as u}from"./IKEJCBYU.js";import{c as e}from"./65EQECL3.js";var m="In-kind exits are a separate unsupported flow.";function b(t,i){return n(t,i,e)}function V(t,i,o,r,x,p){return a(t,i,o,r,x,p,e)}function A(t,i,o){return s(t,i,o,e,m)}function P(t){return l(t,e.symbol)}function S(t,i,o,r){u(t,i,o,r,e)}export{b as a,V as b,A as c,P as d,S as e};
@@ -0,0 +1 @@
1
+ import{a as H}from"./E3UBHTJO.js";import{a as L}from"./KA7BPBCV.js";import{b as z}from"./Z4SRGAVL.js";import{a as P}from"./PBQSJSZO.js";import{c as D}from"./MYFAKCQI.js";import{c as y,e as b,g as A,i as N,l as _}from"./5KUWLUPM.js";import{a as E}from"./UP7FBDMJ.js";import{a as l,i as I}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as S}from"./JXOEJPJ4.js";import{encodeFunctionData as C,parseAbi as Y,zeroAddress as v}from"viem";import{encodeAbiParameters as B,encodeFunctionData as G,keccak256 as O,parseAbi as J}from"viem";var R=I[l].merkl.distributor.address,w="Claim rewards on Merkl (Powered by Merkl \u2014 https://app.merkl.xyz)",j=`${w}. No claimable rewards on Robinhood Chain. Pending rewards must settle into a Merkle root before they can be claimed.`,T=J(["function claimed(address user,address token) view returns (uint208 amount,uint48 timestamp,bytes32 merkleRoot)","function getMerkleRoot() view returns (bytes32)","function claim(address[] users,address[] tokens,uint256[] amounts,bytes32[][] proofs)"]);function W(o){return typeof o=="string"&&/^0x[0-9a-fA-F]{64}$/.test(o)}function p(){throw new u("Merkl returned an unexpected response. Please refetch rewards.")}function x(o){typeof o!="string"&&p();let d=E(o);if(d>=1n<<256n)throw new u("The Merkl reward amount exceeds the uint256 range.");return d.toString()}function K(o){let d=[],m=new Set;for(let c of o)if((!b(c)||!b(c.chain)||!Number.isSafeInteger(c.chain.id))&&p(),c.chain.id===l){Array.isArray(c.rewards)||p();for(let r of c.rewards){if((!b(r)||typeof r.distributionLayer!="string"||!b(r.token))&&p(),r.distributionLayer!=="TREE"||(Number.isSafeInteger(r.token.chainId)||p(),r.token.chainId!==l)||(Array.isArray(r.proofs)||p(),!r.proofs.length))continue;(!r.proofs.every(W)||typeof r.token.address!="string"||typeof r.token.symbol!="string"||!r.token.symbol.trim()||typeof r.token.decimals!="number"||!Number.isInteger(r.token.decimals)||r.token.decimals<0||r.token.decimals>255)&&p(),P(r.token.address);let t=x(r.amount),e=x(r.pending);if(BigInt(t)===0n)continue;let n=r.token.address.toLowerCase();if(m.has(n))throw new u("Merkl returned duplicate token leaves. Please refetch rewards.");m.add(n),d.push({token:{address:r.token.address,chainId:l,decimals:r.token.decimals,symbol:r.token.symbol},amount:t,pending:e,proofs:r.proofs})}}return d}function Q(o,d,m){let c=O(B([{type:"address"},{type:"address"},{type:"uint256"}],[o,d.token.address,BigInt(d.amount)]));for(let r of d.proofs){let t=BigInt(c)<BigInt(r)?[c,r]:[r,c];c=O(B([{type:"bytes32"},{type:"bytes32"}],t))}if(!A(c,m))throw new u("The Merkl proof does not match the active root. Please refetch rewards.")}function F(o){if(!b(o)||Object.keys(o).length)throw new u("This Merkl tool takes no arguments and uses the connected wallet.")}async function V(o,d){let m=await Z(o,d),c=[],r=new Set;for(let t of m)if((!b(t)||!b(t.chain)||!Number.isSafeInteger(t.chain.id))&&p(),t.chain.id===l){Array.isArray(t.rewards)||p();for(let e of t.rewards){if((!b(e)||typeof e.distributionLayer!="string"||!b(e.token)||!Number.isSafeInteger(e.token.chainId))&&p(),e.token.chainId!==l)continue;(typeof e.token.address!="string"||typeof e.token.symbol!="string"||!e.token.symbol.trim()||typeof e.token.decimals!="number"||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)&&p(),P(e.token.address);let n=x(e.amount),i=x(e.pending),s=`${e.distributionLayer}:${e.token.address.toLowerCase()}`;if(r.has(s))throw new u("Merkl returned duplicate earning rows. Please refetch rewards.");r.add(s);let a={address:e.token.address,symbol:e.token.symbol,decimals:e.token.decimals,chainId:l},k="0";if(e.distributionLayer==="TREE"){let h=await o.clientFor(l).readContract({address:R,abi:T,functionName:"claimed",args:[d,a.address]});(!Array.isArray(h)||typeof h[0]!="bigint"||h[0]<0n||h[0]>=1n<<208n)&&p(),k=h[0].toString()}c.push({token:a,amount:n,pending:i,claimed:k,claimable:"0",distributionLayer:e.distributionLayer,status:e.distributionLayer!=="TREE"?"unsupported_distribution_layer":BigInt(n)>BigInt(k)?"awaiting_verified_proof":BigInt(i)>0n?"pending_settlement":"settled"})}}return{body:m,earnings:c}}async function Z(o,d){return P(d),D(o.http,`https://api.merkl.xyz/v4/users/${d}/rewards/summary?chainId=${l}`,{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},m=>Array.isArray(m))}async function $(o,d,m){P(d);let c=K(m??await Z(o,d)),r=o.clientFor(l),t=[];for(let n of c){let i=await r.readContract({address:R,abi:T,functionName:"claimed",args:[d,n.token.address]});if(!Array.isArray(i)||typeof i[0]!="bigint"||i[0]<0n||i[0]>=1n<<208n)throw new u("The Merkl claimed balance could not be read. Please try again.");BigInt(n.amount)<=i[0]||t.push({...n,claimed:i[0].toString(),claimable:(BigInt(n.amount)-i[0]).toString()})}if(!t.length)return[];let e=await r.readContract({address:R,abi:T,functionName:"getMerkleRoot"});if(!W(e))throw new u("The active Merkl root could not be read. Please try again.");for(let n of t)Q(d,n,e);return t}var X=o=>{async function d(t){try{return await t()}catch(e){throw new u(o.plainError(e))}}function m(t){let e=t.amount.startsWith("-"),n=e?t.amount.slice(1):t.amount;return`${e?"-":""}${o.formatAmount(n,t.token.decimals)} ${S(t.token.symbol)} (${t.token.address}, chain ${t.token.chainId}, ${t.token.decimals} decimals)`}let c=t=>$(o,t);return{tools:[{name:"merkl_rewards",description:"Read claimable rewards (Powered by Merkl \u2014 https://app.merkl.xyz).",inputSchema:{type:"object",properties:{},additionalProperties:!1,description:"Read rewards (Powered by Merkl \u2014 https://app.merkl.xyz)."},execute:(t,e)=>d(async()=>{F(t);let{body:n,earnings:i}=await V(o,e),s=await $(o,e,n);for(let a of i){let k=s.find(h=>A(h.token.address,a.token.address)&&a.distributionLayer==="TREE");k&&(a.claimed=k.claimed,a.claimable=k.claimable,a.status="claimable")}return{earnings:i,rewards:s.map(({proofs:a,...k})=>k),summary:s.length?`${w}. Claimable reward leaves: ${s.map(a=>m({token:a.token,amount:a.claimable})).join("; ")}. Wrapped leaves may transfer underlying tokens; claim preview shows the received assets. Pending rewards appear separately in earnings and are excluded from claimable amounts.`:`${j} Earnings include pending-only and unsupported distribution layers; an unverified amount is never presented as claimable.`}})},{name:"merkl_claim",description:w,inputSchema:{type:"object",properties:{},additionalProperties:!1,description:w},execute:(t,e)=>d(async()=>{F(t);let n=await c(e);if(!n.length)return{txs:[],summary:j};let i=[o.unsignedTx({to:R,chainId:l,value:"0",description:w,data:G({abi:T,functionName:"claim",args:[n.map(()=>e),n.map(a=>a.token.address),n.map(a=>BigInt(a.amount)),n.map(a=>a.proofs)]})})],s=await o.preview(i,e);return{txs:i,summary:`${w}. Prepared unsigned claim. Expected wallet changes: ${s.changes.length?s.changes.map(m).join("; "):"no token transfers in simulation"}. ${s.summary}`}})}],positions:t=>d(async()=>(await c(t)).map(e=>({module:"merkl",id:`${l}:${e.token.address.toLowerCase()}`,chainId:l,assets:[{token:e.token,amount:e.claimable}],description:`${w}. Unclaimed reward leaf; wrapped rewards may transfer underlying assets. Pending rewards are excluded.`})))}},ue=o=>z("merkl",[X(o),L(o),U(o),H(o)]);var M=I[l].merkl.distributor.address,g=Y(["function operators(address,address) view returns (uint256)","function claimRecipient(address,address) view returns (address)","function toggleOperator(address,address)","function setClaimRecipient(address,address)","function claim(address[],address[],uint256[],bytes32[][])","function claimWithRecipient(address[],address[],uint256[],bytes32[][],address[],bytes[])"]),q="Provide a valid address.";function f(o,d=!1){let m=N(o,q);return d?m:_(m,q)}var U=o=>{let d=()=>o.clientFor(l),m=async(r,t,e)=>{let n=[o.unsignedTx({to:M,chainId:l,value:"0",data:r,description:t})],i=await o.preview(n,e);return{txs:n,preview:i,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${t} ${i.summary}`}},c=(r,t,e,n)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:t,required:e,additionalProperties:!1},execute:async(i,s)=>{try{let a=Object.keys(i).find(k=>!Object.hasOwn(t,k));if(a)throw new u(`Unsupported Merkl input: ${a}.`);return await n(i,f(s))}catch(a){throw new u(o.plainError(a))}}});return{tools:[c("claim_config",{token:y,operator:y},[],async(r,t)=>{let e=f(r.token??v,!0),n=f(await d().readContract({address:M,abi:g,functionName:"claimRecipient",args:[t,v]}),!0),i=f(await d().readContract({address:M,abi:g,functionName:"claimRecipient",args:[t,e]}),!0),s;if(r.operator!==void 0){let a=await d().readContract({address:M,abi:g,functionName:"operators",args:[t,f(r.operator,!0)]});if(a!==0n&&a!==1n)throw new u("Merkl returned invalid operator authorization.");s=a===1n}return{chainId:l,wallet:t,token:e,defaultRecipient:n,tokenRecipient:i,effectiveRecipient:i!==v?i:n!==v?n:t,...s===void 0?{}:{operatorEnabled:s},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Zero recipient restores self-claims. Token overrides take precedence over the global recipient."}}),c("set_operator",{operator:y,enabled:{type:"boolean"}},["operator","enabled"],async(r,t)=>{let e=f(r.operator,!0);if(typeof r.enabled!="boolean")throw new u("Provide enabled as boolean.");let n=await d().readContract({address:M,abi:g,functionName:"operators",args:[t,e]});if(n!==0n&&n!==1n)throw new u("Merkl returned invalid operator authorization.");return n===1n===r.enabled?{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Operator already has the requested state; no transaction needed."}:m(C({abi:g,functionName:"toggleOperator",args:[t,e]}),`${r.enabled?"Authorize":"Revoke"} Merkl claims by ${e} for ${t}. Zero operator grants permissionless claiming; configured recipients still apply. The contract toggles the observed state; preview and confirmation must remain current.`,t)}),c("set_recipient",{recipient:y,token:y},["recipient"],async(r,t)=>{let e=f(r.recipient,!0),n=f(r.token??v,!0);return m(C({abi:g,functionName:"setClaimRecipient",args:[e,n]}),`Set Merkl reward recipient for ${n===v?"all tokens":n} to ${e===v?`self (${t})`:e}. This redirects future claims; token-specific overrides remain authoritative.`,t)}),c("claim_to",{recipient:y,token:y,data:{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:16386}},["recipient"],async(r,t)=>{let e=f(r.recipient),n=r.token===void 0?void 0:f(r.token),i=r.data??"0x";if(typeof i!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(i)||i.length>16386)throw new u("Provide callback data as at most 8192 hexadecimal bytes.");let s=(await $(o,t)).filter(a=>!n||A(a.token.address,n));return s.length?m(C({abi:g,functionName:"claimWithRecipient",args:[s.map(()=>t),s.map(a=>a.token.address),s.map(a=>BigInt(a.amount)),s.map(a=>a.proofs),s.map(()=>e),s.map(()=>i)]}),`Claim ${s.map(a=>`${a.claimable} ${a.token.symbol} base units (token ${a.token.address}, decimals ${a.token.decimals})`).join("; ")} to ${e}, overriding saved claim recipients for this claim only. Callback data for each leaf: ${i}. Inspect all callback effects in preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for the selected token."}}),c("claim_for",{user:y,token:y},["user"],async(r,t)=>{let e=f(r.user),n=r.token===void 0?void 0:f(r.token),i=(await $(o,e)).filter(s=>!n||A(s.token.address,n));return i.length?m(C({abi:g,functionName:"claim",args:[i.map(()=>e),i.map(s=>s.token.address),i.map(s=>BigInt(s.amount)),i.map(s=>s.proofs)]}),`Claim Merkl rewards for ${e}; caller ${t} pays gas. The user's saved recipients control payment. Claim authorization and actual receipts must pass preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for this user."}})]}};export{U as a,$ as b,X as c,ue as d};
@@ -1 +1 @@
1
- import{a as s,d as h,e as u}from"./GGUEKSR4.js";import{a as l}from"./UWOFA6GV.js";import{a as c}from"./G6HCV67X.js";import{a as d}from"./5YS5V2LK.js";import{concatHex as P,encodeAbiParameters as x,encodeFunctionData as w,getAddress as m,keccak256 as f,parseAbi as k,stringToHex as v}from"viem";var g=k(["function ownerOf(uint256) view returns (address)","function tokenURI(uint256) view returns (string)","function setMetadata(uint256,string,bytes)","function approve(address,uint256)"]),I=k(["function listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))","function recordHash(uint256) view returns (bytes32)"]),_=(t,r)=>f(P(BigInt(t)<BigInt(r)?[t,r]:[r,t]));function C(t){if(!Array.isArray(t)||t.length<1||t.length>1e4)throw new d("Provide 1 to 10000 identity IDs.");let r=[...new Set(t.map(e=>u(e,"agentIds").toString()))].sort((e,a)=>BigInt(e)<BigInt(a)?-1:1),n=[r.map(e=>f(f(x([{type:"uint256"}],[BigInt(e)]))))];for(;n.at(-1).length>1;){let e=n.at(-1),a=[];for(let o=0;o<e.length;o+=2)a.push(e[o+1]?_(e[o],e[o+1]):e[o]);n.push(a)}return{root:n.at(-1)[0],ids:r,proofs:r.map((e,a)=>{let o=[],p=a;for(let b of n.slice(0,-1)){let y=b[p^1];y&&o.push(y),p=Math.floor(p/2)}return{agentId:e,proof:o}})}}function A(t){return{tools:[{name:"priors_market_origin",inputSchema:{type:"object",properties:{agentIds:{type:"array",minItems:1,maxItems:1e4,items:l()}},required:["agentIds"],additionalProperties:!1},async execute(r){return{chainId:c,...C(r.agentIds),caveat:"Locally commits exactly these IDs. This does not verify third-party origin, quality, current owner or a seller claim."}}},{name:"priors_market_pins",inputSchema:{type:"object",properties:{agentId:l()},required:["agentId"],additionalProperties:!1},async execute(r){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let i=u(r.agentId,"agentId"),n=t.clientFor(c),e=await n.getBlockNumber({cacheTime:0}),[a,o,p]=await Promise.all([n.readContract({address:s.market,abi:I,functionName:"listingOf",args:[i],blockNumber:e}),n.readContract({address:s.market,abi:I,functionName:"recordHash",args:[i],blockNumber:e}),n.readContract({address:s.registry,abi:g,functionName:"tokenURI",args:[i],blockNumber:e})]);return{chainId:c,blockNumber:e.toString(),listing:h(a),recordHash:o,currentUriHash:f(v(p)),caveat:"Pins bind identity file and credit state, not included code, servers or keys. Listing and current URI hashes may differ; preview refuses an altered listing."}}},{name:"priors_market_clear_bid_budget",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(r,i){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let n=[t.approval(s.usdg,s.bidSpender,"0",c)],e=await t.preview(n,m(i));return{txs:n,summary:`Clear all this wallet future bid spending allowance to ${s.bidSpender}. Existing bids cannot fill from it until approved again. ${e.summary}`}}},{name:"priors_market_revoke_nft",inputSchema:{type:"object",properties:{agentId:l()},required:["agentId"],additionalProperties:!1},async execute(r,i){let n=u(r.agentId,"agentId");if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");if(m(await t.clientFor(c).readContract({address:s.registry,abi:g,functionName:"ownerOf",args:[n]}))!==m(i))throw new d("Only current NFT owner may revoke this per-token approval.");let e=[t.unsignedTx({to:s.registry,data:w({abi:g,functionName:"approve",args:["0x0000000000000000000000000000000000000000",n]}),value:"0",chainId:c,description:`Revoke exact ERC-8004 NFT ${n} market approval.`})],a=await t.preview(e,i);return{txs:e,summary:`Clear this identity per-token transfer approval. Also cancel its listing before granting any new market approval. ${a.summary}`}}},{name:"priors_x_link",inputSchema:{type:"object",properties:{agentId:l(),postUrl:{type:"string",maxLength:160,description:"Canonical https://x.com/<handle>/status/<id> owner proof post URL, or empty to unlink. Owner creates the public post themselves."}},required:["agentId","postUrl"],additionalProperties:!1},async execute(r,i){if(t.network==="testnet")throw new d("Priors X metadata is mainnet only.");let n=u(r.agentId,"agentId");if(m(await t.clientFor(c).readContract({address:s.registry,abi:g,functionName:"ownerOf",args:[n]}))!==m(i))throw new d("Only the identity owner can link or clear X metadata.");if(typeof r.postUrl!="string"||r.postUrl!==""&&!/^https:\/\/x\.com\/[A-Za-z0-9_]{1,15}\/status\/[0-9]{1,30}$/.test(r.postUrl))throw new d("Provide a canonical X status URL or empty string to unlink.");let e=[t.unsignedTx({to:s.registry,data:w({abi:g,functionName:"setMetadata",args:[n,"x",v(r.postUrl)]}),value:"0",chainId:c,description:"Set/clear the owner identity X proof-post metadata."})],a=await t.preview(e,i);return{txs:e,summary:`Publish ${r.postUrl?"the specified X post URL":"empty X metadata"} on public ERC-8004 identity ${n}. Priors independently verifies the post; metadata alone does not prove the X account or affect credit terms. ${a.summary}`}}}]}}export{C as a,A as b};
1
+ import{a as s,d as h,e as u}from"./L7OQUHM5.js";import{a as l}from"./5ZLOCQA4.js";import{a as c}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{concatHex as P,encodeAbiParameters as x,encodeFunctionData as w,getAddress as m,keccak256 as f,parseAbi as k,stringToHex as v}from"viem";var g=k(["function ownerOf(uint256) view returns (address)","function tokenURI(uint256) view returns (string)","function setMetadata(uint256,string,bytes)","function approve(address,uint256)"]),I=k(["function listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))","function recordHash(uint256) view returns (bytes32)"]),_=(t,r)=>f(P(BigInt(t)<BigInt(r)?[t,r]:[r,t]));function C(t){if(!Array.isArray(t)||t.length<1||t.length>1e4)throw new d("Provide 1 to 10000 identity IDs.");let r=[...new Set(t.map(e=>u(e,"agentIds").toString()))].sort((e,a)=>BigInt(e)<BigInt(a)?-1:1),n=[r.map(e=>f(f(x([{type:"uint256"}],[BigInt(e)]))))];for(;n.at(-1).length>1;){let e=n.at(-1),a=[];for(let o=0;o<e.length;o+=2)a.push(e[o+1]?_(e[o],e[o+1]):e[o]);n.push(a)}return{root:n.at(-1)[0],ids:r,proofs:r.map((e,a)=>{let o=[],p=a;for(let b of n.slice(0,-1)){let y=b[p^1];y&&o.push(y),p=Math.floor(p/2)}return{agentId:e,proof:o}})}}function A(t){return{tools:[{name:"priors_market_origin",inputSchema:{type:"object",properties:{agentIds:{type:"array",minItems:1,maxItems:1e4,items:l()}},required:["agentIds"],additionalProperties:!1},async execute(r){return{chainId:c,...C(r.agentIds),caveat:"Locally commits exactly these IDs. This does not verify third-party origin, quality, current owner or a seller claim."}}},{name:"priors_market_pins",inputSchema:{type:"object",properties:{agentId:l()},required:["agentId"],additionalProperties:!1},async execute(r){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let i=u(r.agentId,"agentId"),n=t.clientFor(c),e=await n.getBlockNumber({cacheTime:0}),[a,o,p]=await Promise.all([n.readContract({address:s.market,abi:I,functionName:"listingOf",args:[i],blockNumber:e}),n.readContract({address:s.market,abi:I,functionName:"recordHash",args:[i],blockNumber:e}),n.readContract({address:s.registry,abi:g,functionName:"tokenURI",args:[i],blockNumber:e})]);return{chainId:c,blockNumber:e.toString(),listing:h(a),recordHash:o,currentUriHash:f(v(p)),caveat:"Pins bind identity file and credit state, not included code, servers or keys. Listing and current URI hashes may differ; preview refuses an altered listing."}}},{name:"priors_market_clear_bid_budget",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(r,i){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let n=[t.approval(s.usdg,s.bidSpender,"0",c)],e=await t.preview(n,m(i));return{txs:n,summary:`Clear all this wallet future bid spending allowance to ${s.bidSpender}. Existing bids cannot fill from it until approved again. ${e.summary}`}}},{name:"priors_market_revoke_nft",inputSchema:{type:"object",properties:{agentId:l()},required:["agentId"],additionalProperties:!1},async execute(r,i){let n=u(r.agentId,"agentId");if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");if(m(await t.clientFor(c).readContract({address:s.registry,abi:g,functionName:"ownerOf",args:[n]}))!==m(i))throw new d("Only current NFT owner may revoke this per-token approval.");let e=[t.unsignedTx({to:s.registry,data:w({abi:g,functionName:"approve",args:["0x0000000000000000000000000000000000000000",n]}),value:"0",chainId:c,description:`Revoke exact ERC-8004 NFT ${n} market approval.`})],a=await t.preview(e,i);return{txs:e,summary:`Clear this identity per-token transfer approval. Also cancel its listing before granting any new market approval. ${a.summary}`}}},{name:"priors_x_link",inputSchema:{type:"object",properties:{agentId:l(),postUrl:{type:"string",maxLength:160,description:"Canonical https://x.com/<handle>/status/<id> owner proof post URL, or empty to unlink. Owner creates the public post themselves."}},required:["agentId","postUrl"],additionalProperties:!1},async execute(r,i){if(t.network==="testnet")throw new d("Priors X metadata is mainnet only.");let n=u(r.agentId,"agentId");if(m(await t.clientFor(c).readContract({address:s.registry,abi:g,functionName:"ownerOf",args:[n]}))!==m(i))throw new d("Only the identity owner can link or clear X metadata.");if(typeof r.postUrl!="string"||r.postUrl!==""&&!/^https:\/\/x\.com\/[A-Za-z0-9_]{1,15}\/status\/[0-9]{1,30}$/.test(r.postUrl))throw new d("Provide a canonical X status URL or empty string to unlink.");let e=[t.unsignedTx({to:s.registry,data:w({abi:g,functionName:"setMetadata",args:[n,"x",v(r.postUrl)]}),value:"0",chainId:c,description:"Set/clear the owner identity X proof-post metadata."})],a=await t.preview(e,i);return{txs:e,summary:`Publish ${r.postUrl?"the specified X post URL":"empty X metadata"} on public ERC-8004 identity ${n}. Priors independently verifies the post; metadata alone does not prove the X account or affect credit terms. ${a.summary}`}}}]}}export{C as a,A as b};
@@ -1 +1 @@
1
- import{n as k}from"./5O5ZE3ZV.js";import{a as y}from"./QRDDKA4I.js";import{b as T}from"./6IM6A5VA.js";import{b as R}from"./UWOFA6GV.js";import{c as _,d as I,g as v,i as $,n as V}from"./73N3TOJL.js";import{a as u}from"./G6HCV67X.js";import{a as o}from"./5YS5V2LK.js";import{encodeFunctionData as D,erc20Abi as O,getAddress as C,parseAbi as S}from"viem";var N=C("0x0000000000bbf5c5fd284e657f01bd000933c96d"),b=C("0x0a0d53b6684c7b32b4cbef5fe8483bfcc8406742"),U=C("0x00700052c0608F670705380a4900e0a8080010CC"),x=S(["function getCollectedFees(address partner,address token) view returns (uint256)","function withdrawAllFees(address token,address recipient) returns (uint256 amount)","function getBalance(address token,address partner) view returns (uint256)","function withdrawAllERC20(address token,address recipient) returns (bool)","function withdrawNative(uint256 amount,address owner,address receiver)"]),H=(1n<<256n)-1n,P={type:"string",enum:["market","delta"]};function p(t){return $(t,"Provide a token or wallet address.",I)}function A(t){if(t!=="market"&&t!=="delta")throw new o("Choose market or delta fees.");return t}function B(t){return V(t,"Amount must be positive and within uint256.",{notString:"Amount must be a decimal base-unit string.",positive:!0}).toString()}function E(t,m,d){if(d=p(d),t==="velora_unwrap_deth"){for(let e of Object.keys(m))if(e!=="amount")throw new o(`Unsupported ${t} argument: ${e}.`);let a=B(m.amount);return{tx:T({to:b,chainId:u,value:"0",data:D({abi:x,functionName:"withdrawNative",args:[BigInt(a),d,d]}),description:`Unwrap ${a} dETH base units into the same amount of native ETH for ${d} on chain ${u}.`}),inputs:[{token:b,amount:a}]}}if(t!=="velora_claim_fees")throw new o("Unknown Velora claim action.");for(let a of Object.keys(m))if(!["token","kind"].includes(a))throw new o(`Unsupported ${t} argument: ${a}.`);let f=p(m.token);if(k(f))throw new o("Velora fee claims require an ERC-20 token address.");let c=A(m.kind);return{tx:T({to:c==="delta"?N:U,chainId:u,value:"0",data:D({abi:x,functionName:c==="delta"?"withdrawAllFees":"withdrawAllERC20",args:[f,d]}),description:`Claim the full accrued ${c} fee balance of ${f} to ${d} on chain ${u}. Receipt amount can change before mining; no minimum is encoded.`}),inputs:[]}}function Q(t,m,d,f){let{tx:c}=E(m,d,f),a=t[0];if(t.length!==1||!a||a.chainId!==c.chainId||!v(a.to,c.to)||!v(a.data,c.data)||a.value!==c.value)throw new o("Velora claim calldata, recipient, amount or destination differs from the request.")}function X(t){let m=async()=>{let e=t.clientFor(u);if(await e.getChainId()!==u)throw new o("Velora requires an RPC on chain 4663.");return e};async function d(e){if(e===b)return{address:e,symbol:"dETH",decimals:18,chainId:u};let n=await m(),[s,i]=await Promise.all([y(n,u,e,"symbol"),y(n,u,e,"decimals")]);if(typeof s!="string"||!s.trim()||!Number.isInteger(i)||i<0||i>255)throw new o("Velora fee token metadata is unavailable.");return{address:e,symbol:s,decimals:i,chainId:u}}async function f(e,n){let s=A(e.kind),i=p(e.token);if(k(i))throw new o("Velora fee claims require an ERC-20 token address.");let r=await(await m()).readContract({address:s==="delta"?N:U,abi:x,functionName:s==="delta"?"getCollectedFees":"getBalance",args:s==="delta"?[n,i]:[i,n]});if(typeof r!="bigint"||r<0n||r>H)throw new o("Velora fee balance is unavailable.");return r}function c(e,n,s,i){return{name:e,inputSchema:{type:"object",additionalProperties:!1,properties:n,required:s},execute:async(w,r)=>{try{r=p(r);for(let l of Object.keys(w))if(!Object.hasOwn(n,l))throw new o(`Unsupported ${e} argument: ${l}.`);return await i(w,r)}catch(l){throw new o(t.plainError(l))}}}}let a={token:_,kind:P};return[c("velora_fee_balance",a,["token","kind"],async(e,n)=>({kind:A(e.kind),token:await d(p(e.token)),amount:(await f(e,n)).toString()})),c("velora_claim_fees",a,["token","kind"],async(e,n)=>{let{tx:s}=E("velora_claim_fees",e,n),i=await f(e,n);if(i===0n)throw new o("No accrued Velora fees for this wallet and token.");let w=await d(p(e.token)),r=[s],l=await t.preview(r,n);return{txs:r,preview:l,estimatedReceipt:{token:w,amount:i.toString()},summary:`${s.description} ${l.summary}`}}),c("velora_unwrap_deth",{amount:R("Positive amount of wallet-held dETH in base units (18 decimals).")},["amount"],async(e,n)=>{let{tx:s,inputs:i}=E("velora_unwrap_deth",e,n),r=await(await m()).readContract({address:b,abi:O,functionName:"balanceOf",args:[n]});if(typeof r!="bigint"||r<0n||r>H)throw new o("Wallet dETH balance is unavailable.");if(r<BigInt(i[0].amount))throw new o("Insufficient wallet-held dETH. An active native Delta order must first settle, expire or cancel.");let l=[s],g=await t.preview(l,n);if(g.changes.filter(h=>h.token.chainId===u&&k(h.token.address)).reduce((h,F)=>h+BigInt(F.amount),0n)<BigInt(i[0].amount))throw new o("Velora dETH preview does not return the requested native ETH amount.");return{txs:l,preview:g,summary:`${s.description} ${g.summary}`}})]}export{N as a,b,U as c,x as d,E as e,Q as f,X as g};
1
+ import{n as k}from"./GHPREYQK.js";import{a as y}from"./U4JGEMKT.js";import{b as T}from"./PBQSJSZO.js";import{b as R}from"./5ZLOCQA4.js";import{c as _,d as I,g as v,i as $,n as V}from"./5KUWLUPM.js";import{a as u}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as D,erc20Abi as O,getAddress as C,parseAbi as S}from"viem";var N=C("0x0000000000bbf5c5fd284e657f01bd000933c96d"),b=C("0x0a0d53b6684c7b32b4cbef5fe8483bfcc8406742"),U=C("0x00700052c0608F670705380a4900e0a8080010CC"),x=S(["function getCollectedFees(address partner,address token) view returns (uint256)","function withdrawAllFees(address token,address recipient) returns (uint256 amount)","function getBalance(address token,address partner) view returns (uint256)","function withdrawAllERC20(address token,address recipient) returns (bool)","function withdrawNative(uint256 amount,address owner,address receiver)"]),H=(1n<<256n)-1n,P={type:"string",enum:["market","delta"]};function p(t){return $(t,"Provide a token or wallet address.",I)}function A(t){if(t!=="market"&&t!=="delta")throw new o("Choose market or delta fees.");return t}function B(t){return V(t,"Amount must be positive and within uint256.",{notString:"Amount must be a decimal base-unit string.",positive:!0}).toString()}function E(t,m,d){if(d=p(d),t==="velora_unwrap_deth"){for(let e of Object.keys(m))if(e!=="amount")throw new o(`Unsupported ${t} argument: ${e}.`);let a=B(m.amount);return{tx:T({to:b,chainId:u,value:"0",data:D({abi:x,functionName:"withdrawNative",args:[BigInt(a),d,d]}),description:`Unwrap ${a} dETH base units into the same amount of native ETH for ${d} on chain ${u}.`}),inputs:[{token:b,amount:a}]}}if(t!=="velora_claim_fees")throw new o("Unknown Velora claim action.");for(let a of Object.keys(m))if(!["token","kind"].includes(a))throw new o(`Unsupported ${t} argument: ${a}.`);let f=p(m.token);if(k(f))throw new o("Velora fee claims require an ERC-20 token address.");let c=A(m.kind);return{tx:T({to:c==="delta"?N:U,chainId:u,value:"0",data:D({abi:x,functionName:c==="delta"?"withdrawAllFees":"withdrawAllERC20",args:[f,d]}),description:`Claim the full accrued ${c} fee balance of ${f} to ${d} on chain ${u}. Receipt amount can change before mining; no minimum is encoded.`}),inputs:[]}}function Q(t,m,d,f){let{tx:c}=E(m,d,f),a=t[0];if(t.length!==1||!a||a.chainId!==c.chainId||!v(a.to,c.to)||!v(a.data,c.data)||a.value!==c.value)throw new o("Velora claim calldata, recipient, amount or destination differs from the request.")}function X(t){let m=async()=>{let e=t.clientFor(u);if(await e.getChainId()!==u)throw new o("Velora requires an RPC on chain 4663.");return e};async function d(e){if(e===b)return{address:e,symbol:"dETH",decimals:18,chainId:u};let n=await m(),[s,i]=await Promise.all([y(n,u,e,"symbol"),y(n,u,e,"decimals")]);if(typeof s!="string"||!s.trim()||!Number.isInteger(i)||i<0||i>255)throw new o("Velora fee token metadata is unavailable.");return{address:e,symbol:s,decimals:i,chainId:u}}async function f(e,n){let s=A(e.kind),i=p(e.token);if(k(i))throw new o("Velora fee claims require an ERC-20 token address.");let r=await(await m()).readContract({address:s==="delta"?N:U,abi:x,functionName:s==="delta"?"getCollectedFees":"getBalance",args:s==="delta"?[n,i]:[i,n]});if(typeof r!="bigint"||r<0n||r>H)throw new o("Velora fee balance is unavailable.");return r}function c(e,n,s,i){return{name:e,inputSchema:{type:"object",additionalProperties:!1,properties:n,required:s},execute:async(w,r)=>{try{r=p(r);for(let l of Object.keys(w))if(!Object.hasOwn(n,l))throw new o(`Unsupported ${e} argument: ${l}.`);return await i(w,r)}catch(l){throw new o(t.plainError(l))}}}}let a={token:_,kind:P};return[c("velora_fee_balance",a,["token","kind"],async(e,n)=>({kind:A(e.kind),token:await d(p(e.token)),amount:(await f(e,n)).toString()})),c("velora_claim_fees",a,["token","kind"],async(e,n)=>{let{tx:s}=E("velora_claim_fees",e,n),i=await f(e,n);if(i===0n)throw new o("No accrued Velora fees for this wallet and token.");let w=await d(p(e.token)),r=[s],l=await t.preview(r,n);return{txs:r,preview:l,estimatedReceipt:{token:w,amount:i.toString()},summary:`${s.description} ${l.summary}`}}),c("velora_unwrap_deth",{amount:R("Positive amount of wallet-held dETH in base units (18 decimals).")},["amount"],async(e,n)=>{let{tx:s,inputs:i}=E("velora_unwrap_deth",e,n),r=await(await m()).readContract({address:b,abi:O,functionName:"balanceOf",args:[n]});if(typeof r!="bigint"||r<0n||r>H)throw new o("Wallet dETH balance is unavailable.");if(r<BigInt(i[0].amount))throw new o("Insufficient wallet-held dETH. An active native Delta order must first settle, expire or cancel.");let l=[s],g=await t.preview(l,n);if(g.changes.filter(h=>h.token.chainId===u&&k(h.token.address)).reduce((h,F)=>h+BigInt(F.amount),0n)<BigInt(i[0].amount))throw new o("Velora dETH preview does not return the requested native ETH amount.");return{txs:l,preview:g,summary:`${s.description} ${g.summary}`}})]}export{N as a,b,U as c,x as d,E as e,Q as f,X as g};
@@ -1 +1 @@
1
- import{f as u,h as c,i as g,l as f}from"./73N3TOJL.js";import{a as p}from"./5YS5V2LK.js";import{formatUnits as w,parseAbi as l,parseAbiParameters as M,stringToHex as A}from"viem";var y="0xD540F47F214dC7D6D244E62A6aE7e06B586Ef44A",P="https://api.meridian.xyz",h=4663,$=l(["function deposit(bytes32 subaccount,address depositToken,uint256 amount,bytes32 referralCode)","function finalizeWithdraw(address account,bytes32 withdrawDigest) payable"]),m={name:"Meridian",version:"1",chainId:h,verifyingContract:y};function i(n){throw new p(n)}function a(n){return u(n,"Meridian perps returned an invalid object.")}function x(n,e,t=!1,o=256){return(typeof n!="string"||!/^(0|[1-9][0-9]*)$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(o)||t&&n==="0")&&i(`Provide ${e} as a ${t?"positive ":""}decimal base-unit string.`),n}function D(n){let e="Provide a nonzero Meridian perps address.";return f(g(n,e),e)}function b(n){return(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))&&i("Provide a bytes32 Meridian perps identifier."),n}function k(n){return(typeof n!="string"||!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(n))&&i("Provide the Meridian API UUID."),n}function B(n="primary"){return typeof n=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n)?b(n):((typeof n!="string"||!/^[A-Za-z0-9_-]{1,32}$/.test(n))&&i("Provide a subaccount name of 1\u201332 ASCII letters, digits, underscores or hyphens, or its bytes32 encoding."),A(n,{size:32}))}function E(n){(typeof n!="string"||n.length>100||!/^(0|[1-9][0-9]*)(\.[0-9]{1,9})?$/.test(n))&&i("Meridian perps returned an invalid D9 decimal.");let[e,t=""]=n.split(".");return BigInt(e)*1000000000n+BigInt(t.padEnd(9,"0"))}function H(n,e){let t=BigInt(x(n,"the token amount",!0)),o=10n**BigInt(Math.abs(e-9));return e>9&&t%o!==0n&&i("Meridian transfers support at most nine decimal places; reduce the token amount precision."),e>=9?t/o:t*o}function z(n){return w(BigInt(x(n,"the D9 amount",!1,128)),9)}async function d(n,e,t,o="api"){let r,s=o==="archive"?"https://archive.meridian.xyz":o==="candles"?"https://trading-view.meridian.xyz":P;try{r=await n.http(new URL(e,s),{...t,redirect:"error",signal:AbortSignal.timeout(3e4)})}catch{return i("Meridian perps request is unavailable. Check order and transfer history before retrying an action.")}r.ok||i(`Meridian perps returned HTTP ${r.status}. Check order and transfer history before retrying an action.`);try{return await r.json()}catch{return i("Meridian perps returned invalid JSON. Check history before retrying an action.")}}async function S(n){let e=a(await d(n,"/v1/rpc/config")),t=a(e.domain);return(t.name!==m.name||t.version!==m.version||t.chainId!==h||!c(t.verifyingContract,y)||Object.keys(t).length!==4)&&i("Meridian perps signing domain changed. Verify the deployment before updating Oak."),a(e.signatureTypes)}function _(n,e,t){let o=n[e];(typeof o!="string"||o.length>2e3)&&i("Meridian perps signing type is unavailable.");let r;try{r=M(o)}catch{return i("Meridian perps signing type is malformed.")}return(r.length!==Object.keys(t).length||r.some(s=>!s.name||t[s.name]!==s.type)||new Set(r.map(s=>s.name)).size!==r.length)&&i("Meridian perps signing fields changed. Verify the protocol before updating Oak."),{[e]:r.map(s=>({name:s.name,type:s.type}))}}async function v(n,e,t,o){let r=a(await d(n,`/v1/subaccount/${k(e)}`));return(r.id!==e||!c(r.account,t)||o&&!c(r.name,o))&&i("Meridian perps subaccount does not match this wallet and name."),b(r.name),(typeof r.registeredBlockNumber!="string"||!/^[0-9]+$/.test(r.registeredBlockNumber))&&i("Meridian perps subaccount registration is pending. Wait for the deposit to settle."),r}async function T(n,e){let t=a(await d(n,`/v1/token/${k(e)}`));return t.id!==e&&i("Meridian perps returned a different token."),t}export{y as a,P as b,h as c,$ as d,m as e,i as f,a as g,x as h,D as i,b as j,k,B as l,E as m,H as n,z as o,d as p,S as q,_ as r,v as s,T as t};
1
+ import{f as u,h as c,i as g,l as f}from"./5KUWLUPM.js";import{a as p}from"./XSD5NL7J.js";import{formatUnits as w,parseAbi as l,parseAbiParameters as M,stringToHex as A}from"viem";var y="0xD540F47F214dC7D6D244E62A6aE7e06B586Ef44A",P="https://api.meridian.xyz",h=4663,$=l(["function deposit(bytes32 subaccount,address depositToken,uint256 amount,bytes32 referralCode)","function finalizeWithdraw(address account,bytes32 withdrawDigest) payable"]),m={name:"Meridian",version:"1",chainId:h,verifyingContract:y};function i(n){throw new p(n)}function a(n){return u(n,"Meridian perps returned an invalid object.")}function x(n,e,t=!1,o=256){return(typeof n!="string"||!/^(0|[1-9][0-9]*)$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(o)||t&&n==="0")&&i(`Provide ${e} as a ${t?"positive ":""}decimal base-unit string.`),n}function D(n){let e="Provide a nonzero Meridian perps address.";return f(g(n,e),e)}function b(n){return(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))&&i("Provide a bytes32 Meridian perps identifier."),n}function k(n){return(typeof n!="string"||!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(n))&&i("Provide the Meridian API UUID."),n}function B(n="primary"){return typeof n=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n)?b(n):((typeof n!="string"||!/^[A-Za-z0-9_-]{1,32}$/.test(n))&&i("Provide a subaccount name of 1\u201332 ASCII letters, digits, underscores or hyphens, or its bytes32 encoding."),A(n,{size:32}))}function E(n){(typeof n!="string"||n.length>100||!/^(0|[1-9][0-9]*)(\.[0-9]{1,9})?$/.test(n))&&i("Meridian perps returned an invalid D9 decimal.");let[e,t=""]=n.split(".");return BigInt(e)*1000000000n+BigInt(t.padEnd(9,"0"))}function H(n,e){let t=BigInt(x(n,"the token amount",!0)),o=10n**BigInt(Math.abs(e-9));return e>9&&t%o!==0n&&i("Meridian transfers support at most nine decimal places; reduce the token amount precision."),e>=9?t/o:t*o}function z(n){return w(BigInt(x(n,"the D9 amount",!1,128)),9)}async function d(n,e,t,o="api"){let r,s=o==="archive"?"https://archive.meridian.xyz":o==="candles"?"https://trading-view.meridian.xyz":P;try{r=await n.http(new URL(e,s),{...t,redirect:"error",signal:AbortSignal.timeout(3e4)})}catch{return i("Meridian perps request is unavailable. Check order and transfer history before retrying an action.")}r.ok||i(`Meridian perps returned HTTP ${r.status}. Check order and transfer history before retrying an action.`);try{return await r.json()}catch{return i("Meridian perps returned invalid JSON. Check history before retrying an action.")}}async function S(n){let e=a(await d(n,"/v1/rpc/config")),t=a(e.domain);return(t.name!==m.name||t.version!==m.version||t.chainId!==h||!c(t.verifyingContract,y)||Object.keys(t).length!==4)&&i("Meridian perps signing domain changed. Verify the deployment before updating Oak."),a(e.signatureTypes)}function _(n,e,t){let o=n[e];(typeof o!="string"||o.length>2e3)&&i("Meridian perps signing type is unavailable.");let r;try{r=M(o)}catch{return i("Meridian perps signing type is malformed.")}return(r.length!==Object.keys(t).length||r.some(s=>!s.name||t[s.name]!==s.type)||new Set(r.map(s=>s.name)).size!==r.length)&&i("Meridian perps signing fields changed. Verify the protocol before updating Oak."),{[e]:r.map(s=>({name:s.name,type:s.type}))}}async function v(n,e,t,o){let r=a(await d(n,`/v1/subaccount/${k(e)}`));return(r.id!==e||!c(r.account,t)||o&&!c(r.name,o))&&i("Meridian perps subaccount does not match this wallet and name."),b(r.name),(typeof r.registeredBlockNumber!="string"||!/^[0-9]+$/.test(r.registeredBlockNumber))&&i("Meridian perps subaccount registration is pending. Wait for the deposit to settle."),r}async function T(n,e){let t=a(await d(n,`/v1/token/${k(e)}`));return t.id!==e&&i("Meridian perps returned a different token."),t}export{y as a,P as b,h as c,$ as d,m as e,i as f,a as g,x as h,D as i,b as j,k,B as l,E as m,H as n,z as o,d as p,S as q,_ as r,v as s,T as t};
@@ -1 +1 @@
1
- import{a as m,b as c,f as h,g as d,h as i,i as u}from"./WQ6H62DM.js";import{c as T,e as a}from"./73N3TOJL.js";import{a as o}from"./5YS5V2LK.js";import{encodeAbiParameters as y,parseAbiParameters as g,zeroAddress as B}from"viem";var C={type:"object",properties:{pairedToken:T,startingTick:{type:"integer",minimum:-887272,maximum:887272},tickSpacing:{type:"integer",minimum:1,maximum:32767},positions:{type:"array",minItems:1,maxItems:7,items:{type:"object",properties:{tickLower:{type:"integer"},tickUpper:{type:"integer"},bps:{type:"integer",minimum:1,maximum:1e4}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3},maxFeeBps:{type:"integer",minimum:25,maximum:1e3},referenceTickFilterPeriod:c,resetPeriod:c,resetTickFilter:{type:"integer",minimum:-887272,maximum:887272},feeControlNumerator:c,decayFilterBps:{type:"integer",minimum:0,maximum:3e4}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function _(l){let r=l.pool??{};if(!a(r))throw new o("Provide pool configuration as an object.");u(r,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=h(r.pairedToken??m.paired_weth.address),b=i(r.startingTick??-230400,-887272,887272),f=i(r.tickSpacing??200,1,32767),n=r.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new o("Provide one to seven liquidity positions.");let p=n.map(e=>{if(!a(e))throw new o("Provide liquidity position objects.");u(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<b||t%f||s%f)throw new o("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(p.reduce((e,t)=>e+t.bps,0)!==1e4)throw new o("Liquidity position allocations must total 10000 bps.");let k=i(l.feeBps??100,0,1e3)*100,F=m.fee_static_hook_v2.address,P=y(g("uint24,uint24"),[k,k]),w=`Static LP fee ${k/100} bps`;if(r.dynamicFee!==void 0){let e=r.dynamicFee;if(!a(e)||l.feeBps!==void 0)throw new o("Provide dynamic fee configuration without a static feeBps override.");u(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);F=m.fee_dynamic_hook_v2.address,P=y(g("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),w=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:w,poolConfig:{hook:F,pairedToken:x,tickIfToken0IsClanker:b,tickSpacing:f,poolData:y(g("(address,bytes,bytes)"),[[B,"0x",P]])},tickLower:p.map(e=>e.lower),tickUpper:p.map(e=>e.upper),positionBps:p.map(e=>e.bps)}}export{C as a,_ as b};
1
+ import{a as m,b as c,f as h,g as d,h as i,i as u}from"./W76QC2AW.js";import{c as T,e as a}from"./5KUWLUPM.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as y,parseAbiParameters as g,zeroAddress as B}from"viem";var C={type:"object",properties:{pairedToken:T,startingTick:{type:"integer",minimum:-887272,maximum:887272},tickSpacing:{type:"integer",minimum:1,maximum:32767},positions:{type:"array",minItems:1,maxItems:7,items:{type:"object",properties:{tickLower:{type:"integer"},tickUpper:{type:"integer"},bps:{type:"integer",minimum:1,maximum:1e4}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3},maxFeeBps:{type:"integer",minimum:25,maximum:1e3},referenceTickFilterPeriod:c,resetPeriod:c,resetTickFilter:{type:"integer",minimum:-887272,maximum:887272},feeControlNumerator:c,decayFilterBps:{type:"integer",minimum:0,maximum:3e4}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function _(l){let r=l.pool??{};if(!a(r))throw new o("Provide pool configuration as an object.");u(r,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=h(r.pairedToken??m.paired_weth.address),b=i(r.startingTick??-230400,-887272,887272),f=i(r.tickSpacing??200,1,32767),n=r.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new o("Provide one to seven liquidity positions.");let p=n.map(e=>{if(!a(e))throw new o("Provide liquidity position objects.");u(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<b||t%f||s%f)throw new o("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(p.reduce((e,t)=>e+t.bps,0)!==1e4)throw new o("Liquidity position allocations must total 10000 bps.");let k=i(l.feeBps??100,0,1e3)*100,F=m.fee_static_hook_v2.address,P=y(g("uint24,uint24"),[k,k]),w=`Static LP fee ${k/100} bps`;if(r.dynamicFee!==void 0){let e=r.dynamicFee;if(!a(e)||l.feeBps!==void 0)throw new o("Provide dynamic fee configuration without a static feeBps override.");u(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);F=m.fee_dynamic_hook_v2.address,P=y(g("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),w=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:w,poolConfig:{hook:F,pairedToken:x,tickIfToken0IsClanker:b,tickSpacing:f,poolData:y(g("(address,bytes,bytes)"),[[B,"0x",P]])},tickLower:p.map(e=>e.lower),tickUpper:p.map(e=>e.upper),positionBps:p.map(e=>e.bps)}}export{C as a,_ as b};
@@ -0,0 +1 @@
1
+ import{b as k,c as P,d as R}from"./65EQECL3.js";import{a as Z}from"./HTXKERNS.js";import{a as H}from"./PBQSJSZO.js";import{g as G,i as Q}from"./5KUWLUPM.js";import{a as W,b as V}from"./UP7FBDMJ.js";import{a as c,d as X,i as O}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as T}from"./JXOEJPJ4.js";import{encodeFunctionData as nt,erc20Abi as J,getAddress as a,parseAbi as gt}from"viem";var At="hookr",y=a(O[4663].hookr.HookrLimitOrders.address),wt=a(O[4663].hookr.HookrRoot.address),Ot=a(O[4663].hookr.HookrRouter.address),Bt=a(O[4663].hookr.HookrForwarder.address),ht=a(O[4663].hookr.PoolManager.address),It=a(O[4663].hookr.HOOKR_Token.address),N="0x0000000000000000000000000000000000000000",St="0x000000000000000000000000000000000000dEaD",Y=(1n<<128n)-1n,Tt=new Set([N.toLowerCase(),St.toLowerCase(),y.toLowerCase(),Ot.toLowerCase(),Bt.toLowerCase(),ht.toLowerCase(),wt.toLowerCase()]),B=gt(["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 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 fill(uint256 orderId) returns (uint256 amountOut)","function claimBounty(address to) returns (uint256 amount)","function bountyOf(address keeper) view returns (uint256)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)"]);function Ht(t){let n=t.toLowerCase();return n===N.toLowerCase()||n===Z.toLowerCase()}function $t(t,n,i){let o=n.trim();if(o.startsWith("-")){let s=o.slice(1),r=t(s,i);return r==="0"?"0":`-${r}`}return t(o,i)}function Wt(t,n,i){return V(t,n,i)}function et(t,n){return!t.changes||t.changes.length===0?"no net ERC-20/native transfer delta on caller":t.changes.map(i=>`${$t(n,i.amount,i.token.decimals)} ${T(i.token.symbol)} (${i.token.address})`).join(", ")}function xt(t){if(typeof t=="bigint"){if(t<=0n)throw new u("Hookr orderId must be a positive integer.");return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<=0)throw new u("Hookr orderId must be a positive integer.");return BigInt(t)}if(typeof t=="string"&&/^\d+$/.test(t.trim())){let n=BigInt(t.trim());if(n<=0n)throw new u("Hookr orderId must be a positive integer.");return n}throw new u("Provide a positive integer Hookr orderId.")}function ot(t){if(t==null)return c;if(typeof t!="number"||!Number.isSafeInteger(t)||t!==c)throw new u(`Hookr limit orders are only supported on chain ${c}.`);return c}function Rt(t){switch(t){case 0:return"None";case 1:return"Open";case 2:return"Filled";case 3:return"Cancelled";default:return"Unknown"}}function Ct(t){if(Array.isArray(t)){let[n,i,o,s,r,d,g,m,b,e,l]=t;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:i,createdAt:o,expiry:s,zeroForOne:!!r,status:d,recipient:g,amountIn:BigInt(m),minAmountOut:BigInt(b),bounty:BigInt(e),sqrtPriceLimitX96:BigInt(l)}}if(t&&typeof t=="object"){let n=t;if(n.key&&typeof n.key=="object")return{key:{currency0:n.key.currency0,currency1:n.key.currency1,fee:Number(n.key.fee),tickSpacing:Number(n.key.tickSpacing),hooks:n.key.hooks},owner:n.owner,createdAt:n.createdAt,expiry:n.expiry,zeroForOne:!!n.zeroForOne,status:n.status,recipient:n.recipient,amountIn:BigInt(n.amountIn),minAmountOut:BigInt(n.minAmountOut),bounty:BigInt(n.bounty),sqrtPriceLimitX96:BigInt(n.sqrtPriceLimitX96)}}throw new u("HookrLimitOrders returned a malformed order tuple.")}function Dt(t){if(Array.isArray(t)&&t.length>=2)return{fillable:!!t[0],amountOut:BigInt(t[1])};if(t&&typeof t=="object"&&"fillable"in t&&"amountOut"in t){let n=t;return{fillable:!!n.fillable,amountOut:BigInt(n.amountOut)}}throw new u("HookrLimitOrders returned a malformed quoteFill response.")}function Pt(t){if(Array.isArray(t)&&t.length>=3)return{minBounty:BigInt(t[0]),defaultBounty:BigInt(t[1]),maxBounty:BigInt(t[2])};if(t&&typeof t=="object"&&"minBounty"in t&&"defaultBounty"in t&&"maxBounty"in t){let n=t;return{minBounty:BigInt(n.minBounty),defaultBounty:BigInt(n.defaultBounty),maxBounty:BigInt(n.maxBounty)}}throw new u("HookrLimitOrders returned a malformed bountyBounds response.")}async function tt(t,n,i=c){if(i!==c)throw new u(`Unsupported token chain ${i}; Hookr requires chain ${c}.`);if(Ht(n))return{...k,chainId:i};H(n);let o=a(n),s=o.toLowerCase();if(s===P.address.toLowerCase())return{address:o,symbol:P.symbol,decimals:X,chainId:i};if(s===R.address.toLowerCase())return{address:o,symbol:R.symbol,decimals:R.decimals,chainId:i};if(s===It.toLowerCase())return{address:o,symbol:"HOOKR",decimals:18,chainId:i};let[r,d]=await Promise.all([t.readContract({address:o,abi:J,functionName:"symbol"}),t.readContract({address:o,abi:J,functionName:"decimals"})]),g=typeof r=="string"&&r.trim()?r.trim():o,m=Number(d);if(!Number.isInteger(m)||m<0||m>255)throw new u(`Invalid token decimals for ${o} on chain ${i}.`);return{address:o,symbol:g,decimals:m,chainId:i}}async function Et(t){if(typeof t.getBlock!="function")throw new u("Cannot read the latest block timestamp for Hookr order expiry.");let n=await t.getBlock().catch(()=>{throw new u("Cannot read the latest block timestamp for Hookr order expiry.")});if(!n||typeof n.timestamp!="bigint"||n.timestamp<=0n)throw new u("Hookr requires a usable latest block timestamp to check order expiry.");return n.timestamp}function E(t,n=[]){let i=Q(t,"Provide a valid recipient wallet address."),o=i.toLowerCase();if(Tt.has(o)||n.some(s=>s.toLowerCase()===o))throw new u(`Recipient ${i} is a reserved protocol or zero address (invalid recipient).`);return i}function rt(t){if(t.minBountyEth!==void 0||t.minAmountOutDecimal!==void 0||t.rounding!==void 0)throw new u("Use minBounty and minAmountOut as base-unit integer strings.")}function L(t,n){if(t!==void 0){if(typeof t!="string"||!/^\d+$/.test(t))throw new u(`Provide ${n} as a base-unit integer string.`);return W(t)}}function Lt(t){return{name:"hookr_fill",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"HookrLimitOrders orderId as a positive integer string."},minBounty:{type:"string",description:"Optional minimum keeper bounty in wei (decimal base-unit string)."},minAmountOut:{type:"string",description:"Optional quote pre-check only, in token base-unit integer strings. Not enforced on chain: fill(uint256) enforces only the order minAmountOut."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},required:["orderId"],additionalProperties:!1},async execute(n,i){try{rt(n),H(i);let o=a(i),s=ot(n.chainId),r=xt(n.orderId),d=t.clientFor(s),[g,m,b]=await Promise.all([d.readContract({address:y,abi:B,functionName:"getOrder",args:[r]}),d.readContract({address:y,abi:B,functionName:"quoteFill",args:[r]}),Et(d)]),e=Ct(g),l=Number(e.status),h=Rt(l);if(l===0||G(e.owner,N))throw new u(`Hookr order #${r} does not exist.`);if(l!==1)throw new u(`Hookr order #${r} is not open (current status: ${h}).`);let A=BigInt(e.expiry);if(A<b)throw new u(`Hookr order #${r} is expired (expiry ${A} < current timestamp ${b}).`);let f=Number(e.key.tickSpacing),$=Number(e.key.fee);if(!Number.isInteger(f)||f<=0)throw new u(`Hookr order #${r} has an invalid pool tickSpacing (${f}).`);if(e.amountIn<=0n||e.amountIn>Y)throw new u(`Hookr order #${r} has an invalid amountIn (${e.amountIn}).`);if(e.minAmountOut<=0n||e.minAmountOut>Y)throw new u(`Hookr order #${r} has an invalid minAmountOut (${e.minAmountOut}).`);let C=a(e.key.hooks);E(e.recipient,[C]);let it=await d.readContract({address:y,abi:B,functionName:"bountyBounds",args:[{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:$,tickSpacing:f,hooks:C},e.zeroForOne,e.amountIn,e.minAmountOut]}),w=Pt(it),D=L(n.minBounty,"minBounty"),F=D!==void 0&&D>w.minBounty?D:w.minBounty;if(e.bounty<F)throw new u(`Hookr order #${r} is underbounty: order bounty (${e.bounty} wei) is below the required keeper bounty (${F} wei).`);if(e.bounty>w.maxBounty)throw new u(`Hookr order #${r} bounty (${e.bounty} wei) exceeds maximum bounty bound (${w.maxBounty} wei).`);let I=Dt(m),ut=e.zeroForOne?e.key.currency0:e.key.currency1,st=e.zeroForOne?e.key.currency1:e.key.currency0,[x,p]=await Promise.all([tt(d,ut,s),tt(d,st,s)]),S=L(n.minAmountOut,"minAmountOut"),v=S!==void 0&&S>e.minAmountOut?S:e.minAmountOut;if(!I.fillable||I.amountOut<=0n||I.amountOut<v)throw new u(`Hookr order #${r} is not executable: quoted output (${I.amountOut} base units of ${p.address}) does not meet minimum output (${v} base units).`);let at=nt({abi:B,functionName:"fill",args:[r]}),mt=t.formatAmount(e.amountIn.toString(),x.decimals),dt=t.formatAmount(I.amountOut.toString(),p.decimals),ct=t.formatAmount(e.minAmountOut.toString(),p.decimals),lt=t.formatAmount(e.bounty.toString(),18),yt=S===void 0?"":` Caller minAmountOut ${S} base units is a quote pre-check only, not enforced on chain; fill(uint256) enforces the order minimum of ${e.minAmountOut} base units.`,q=`Fill Hookr order #${r}: maker's escrow pays ${mt} ${T(x.symbol)} (${e.amountIn} base units of ${x.address}); net output goes to ${a(e.recipient)} (quoted ${dt} ${T(p.symbol)}, order minimum ${ct} ${T(p.symbol)}, ${e.minAmountOut} base units of ${p.address}). The filler sends no tokens or ETH (value 0), pays gas, and accrues ${lt} ETH (${e.bounty} wei) bounty to ${o}, payable only via claimBounty. Pool tickSpacing ${f}; expiry ${A} inclusive.${yt}`,M=t.unsignedTx({to:y,data:at,value:"0",chainId:s,description:q}),z=await t.preview([M],o),bt=et(z,t.formatAmount),K={token:x,amount:e.amountIn.toString()},U={token:p,amount:e.minAmountOut.toString()},ft={token:p,amount:I.amountOut.toString()},j={token:{...k,chainId:s},amount:e.bounty.toString()},pt={orderId:r.toString(),key:{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:$,tickSpacing:f,hooks:C},owner:a(e.owner),recipient:a(e.recipient),createdAt:BigInt(e.createdAt).toString(),expiry:A.toString(),zeroForOne:e.zeroForOne,status:l,statusLabel:h,amountIn:K,minAmountOut:U,bounty:j,sqrtPriceLimitX96:e.sqrtPriceLimitX96.toString()},kt={minBounty:{token:{...k,chainId:s},amount:w.minBounty.toString()},defaultBounty:{token:{...k,chainId:s},amount:w.defaultBounty.toString()},maxBounty:{token:{...k,chainId:s},amount:w.maxBounty.toString()}};return{txs:[M],summary:`${q} Preview deltas: ${bt}.`,preview:z,orderId:r.toString(),fillable:!0,amountIn:K,minAmountOut:U,quotedAmountOut:ft,bounty:j,bountyBounds:kt,order:pt}}catch(o){throw new u(t.plainError(o))}}}}function Nt(t){return{name:"hookr_claim_bounty",inputSchema:{type:"object",properties:{to:{type:"string",description:"Optional recipient address for the claimed native ETH bounty (must be the signing wallet)."},minBounty:{type:"string",description:"Optional minimum claimable bounty in wei (decimal base-unit string)."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},additionalProperties:!1},async execute(n,i){try{rt(n),H(i);let o=a(i),s=ot(n.chainId),r=n.to!==void 0&&n.to!==null?E(String(n.to)):E(o);if(r!==o)throw new u("Hookr bounty recipient must be the signing wallet.");let g=await t.clientFor(s).readContract({address:y,abi:B,functionName:"bountyOf",args:[o]}),m=BigInt(g);if(m<=0n)throw new u(`No claimable Hookr keeper bounty for ${o}.`);let b=L(n.minBounty,"minBounty");if(b!==void 0&&m<b)throw new u(`Claimable Hookr bounty (${m} wei) is below the requested minimum (${b} wei).`);let e=nt({abi:B,functionName:"claimBounty",args:[r]}),l=t.formatAmount(m.toString(),18),h=t.unsignedTx({to:y,data:e,value:"0",chainId:s,description:`Claim ${l} ETH (${m} wei) of accrued Hookr keeper bounty from ${y} to ${r}.`}),A=await t.preview([h],o),f=et(A,t.formatAmount),$={token:{...k,chainId:s},amount:m.toString()};return{txs:[h],summary:`Claim ${l} ETH (${m} wei) Hookr keeper bounty to ${r}. Preview deltas: ${f}.`,preview:A,recipient:r,claimableBounty:$}}catch(o){throw new u(t.plainError(o))}}}}async function _t(t,n){H(n);let i=a(n),o=t.clientFor(c);try{let s=await o.readContract({address:y,abi:B,functionName:"bountyOf",args:[i]}),r=BigInt(s);if(r<=0n)return[];let d=t.formatAmount(r.toString(),18);return[{module:At,id:`hookr:bounty:${i.toLowerCase()}`,chainId:c,assets:[{token:{...k,chainId:c},amount:r.toString()}],description:`Hookr claimable keeper bounty (${d} ETH)`}]}catch(s){throw new u(t.plainError(s))}}var _=t=>({tools:[Lt(t),Nt(t)],positions:n=>_t(t,n)}),Vt=_,Gt=_,Qt=_;export{At as a,y as b,wt as c,Ot as d,Bt as e,ht as f,It as g,B as h,$t as i,Wt as j,Lt as k,Nt as l,_t as m,_ as n,Vt as o,Gt as p,Qt as q};
@@ -0,0 +1 @@
1
+ import{a as x,c}from"./UHRCM7AG.js";import{a}from"./XSD5NL7J.js";import{parseAbi as M}from"viem";var b=M(["function readState(address router) view returns ((int256 totalPt,int256 totalSy,int256 totalLp,address treasury,int256 scalarRoot,uint256 expiry,uint256 lnFeeRateRoot,uint256 reserveFeePercent,uint256 lastLnImpliedRate) market)","function pyIndexCurrent() returns(uint256)","function exchangeRate() view returns(uint256)","function previewDeposit(address tokenIn,uint256 amount) view returns(uint256)","function previewRedeem(address tokenOut,uint256 amount) view returns(uint256)"]),R=10n**18n,E=31536e3,P="Pendle's price doesn't match what Oak checked on the chain. Try a smaller amount. Nothing was signed.";function n(e,t=!1){if(typeof e!="bigint"||e<(t?1n:0n)||e>=1n<<256n)throw new a("Oak could not read the Pendle price check from the chain. Nothing was signed.");return e}function d(e){return c(Number.isInteger(e)&&e>=0&&e<=77,"unreadable token decimals"),10n**BigInt(e)}function k(e){if(!Number.isFinite(e)||Math.abs(e)>40)throw new a(P);return BigInt(Math.floor(Math.exp(e)*1e18))}async function A(e,t,v,p,u,f){try{c(Number.isFinite(f)&&Math.abs(f)<=.03,"unreadable or excessive price impact"),n(p,!0),n(u,!0);let i=await e.getBlock(),s=i.number,[h,C]=await Promise.all([e.readContract({address:t.market,abi:b,functionName:"readState",args:[x],blockNumber:s}),e.simulateContract({address:t.yt,abi:b,functionName:"pyIndexCurrent",blockNumber:s}).then(o=>o.result)]),I=n(h.lastLnImpliedRate),D=n(h.lnFeeRateRoot),w=n(C,!0);c(Number.isSafeInteger(t.expiry)&&t.expiry>Number(i.timestamp),"this term has ended; use pendle_redeem");let y=(t.expiry-Number(i.timestamp))/E,g=Number(I)/1e18*y,r;if(v==="buy")r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewDeposit",args:[t.inputToken,p],blockNumber:s}),!0)*w*k(g)*d(t.ptDecimals)/(R*R*d(t.syDecimals));else{let o=p*k(-g)*d(t.syDecimals)/(w*d(t.ptDecimals));n(o,!0),r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewRedeem",args:[t.inputToken,o],blockNumber:s}),!0)}n(r,!0);let m=1-Math.exp(-Number(D)/1e18*y);c(Number.isFinite(m)&&m>=0&&m<=1,"unreadable market fee");let N=.01+m,F=u>r?u-r:r-u,l=Number(F)/Number(r);if(!Number.isFinite(l)||l>N)throw new a(P);return{estimateBase:r,relativeDifference:l,tolerance:N,blockNumber:s}}catch(i){throw i instanceof a?i:new a("Oak could not read the Pendle price check from the chain. Nothing was signed.")}}export{b as a,n as b,A as c};
@@ -1 +1 @@
1
- import{m as v,n as F}from"./OVK4EEOD.js";import{b as A,i as U,n as X,o as V,q as j}from"./R7QPJQP6.js";import{a as q}from"./E7R3J4H7.js";import{b as z,e as C,n as Y}from"./JPOYTTTW.js";import{a as w,b as S}from"./CY75R4FK.js";import{a as k}from"./LIUXNOLP.js";import{a as x}from"./QRDDKA4I.js";import{a as B}from"./AXYOJBX6.js";import{b as $}from"./MYBDO5SA.js";import{a as T}from"./RETS2ZEK.js";import{o as y}from"./CXLEQCP3.js";import{a as u,b as f,c as H,d as P,i as g,j as R,k as W,p as K}from"./G6HCV67X.js";import{a as o}from"./5YS5V2LK.js";import{a as N,b as L}from"./JXOEJPJ4.js";import{getAddress as b,isAddress as J,parseAbi as se}from"viem";var Q=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];var M=300,oe="1000000000000000000",ee=b(g[u].tokens.USDG.address),te=b(g[f].deployments.test_USDG.address),O=b(g[u].tokens.WETH.address),_=b(g[f].deployments.test_WETH.address);function ne(n){let e=n.address.toLowerCase();return n.chainId===u?e===ee.toLowerCase():n.chainId===f?e===te.toLowerCase():!1}function re(n){return n.chainId!==u&&n.chainId!==f?!1:S(n.address)===w}function ie(n){let e=n.address.toLowerCase();return n.chainId===u?e===O.toLowerCase():n.chainId===f?e===_.toLowerCase():!1}function de(n){return re(n)||ie(n)}var ce=-887272,me=887272,ue=(1n<<256n)-1n,fe=se(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]);function I(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new o(`Invalid ${e} timestamp.`)}function Oe(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){try{return l(n,e,t),!0}catch{return!1}}function l(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){if(!Number.isInteger(t)||t<0)throw new o("Maximum price age must be a non-negative integer.");let s=I(n,"price"),a=I(e,"current");if(s<=0n)throw new o("Price timestamp must be positive.");if(s>a)throw new o("Price timestamp is in the future.");let r=a-s;if(r>BigInt(t))throw new o(`Price is stale: age ${r}s exceeds ${t}s.`);return s.toString()}function le(n){if(!Number.isInteger(n)||n<ce||n>me)throw new o(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=ue/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function Z(n,e,t,s){let a=async()=>{throw new o("Price identity resolution is read-only.")},r=B({network:e===f?"testnet":"mainnet",clientFor:i=>t.client??y(t.rpcUrl,i),http:t.http??$(),preview:a,quoteSwap:a,buildSwap:a}),c=await Y(n,{context:r,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:s,blockNumber:t.blockNumber,readMetadata:async i=>{let d=t.client??y(t.rpcUrl,e),[m,p]=await Promise.all([x(d,e,i,"symbol",t.blockNumber),x(d,e,i,"decimals",t.blockNumber)]);return{address:i,symbol:m,decimals:p,chainId:e}}});return{address:c.address,symbol:c.kind==="erc20"&&s?s.symbol:c.symbol,decimals:c.decimals,chainId:c.chainId}}async function be(n,e,t){if(typeof n=="object"&&n!==null){let i=n.chainId??e,d=S(n.address)===w?w:b(n.address),m={address:d,symbol:n.symbol,decimals:n.decimals,chainId:i};return ne(m)?{address:d,symbol:"USDG",decimals:P,chainId:i}:re(m)?{address:w,symbol:"ETH",decimals:18,chainId:i}:ie(m)?{address:d,symbol:"WETH",decimals:18,chainId:i}:Z(m.address,i,t,m)}let s=n.trim(),a=s.toUpperCase(),r=s.toLowerCase();if(a==="ETH"||J(s,{strict:!1})&&S(s)===w)return{...z,chainId:e};if(a==="WETH"||e===u&&r===O.toLowerCase()||e===f&&r===_.toLowerCase()){if(e!==u&&e!==f)throw new o(`No canonical WETH address configured for chain ${e}.`);return{address:e===f?_:O,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===u&&r===R.toLowerCase()||e===f&&r===W.toLowerCase()){if(e!==u&&e!==f)throw new o(`No canonical USDG address configured for chain ${e}.`);return{address:e===f?te:ee,symbol:"USDG",decimals:P,chainId:e}}if(e===u&&(a==="USDE"||r===C.address.toLowerCase()))return{...C,chainId:e};let c=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||c&&s.toLowerCase()===c.toLowerCase()){if(!c&&!J(s,{strict:!1}))throw new o("OAK token address is required to price OAK.");return{address:b(c??s),symbol:"OAK",decimals:H,chainId:e}}return Z(n,e,t)}async function h(n,e,t){if(e)return(await n.readContract({address:e,abi:Q,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:b(K),abi:fe,functionName:"observe",args:[[A,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new o("ETH/USDG pool observation returned insufficient tick cumulatives.");let r=X(a[0],a[1],A),c=le(r);return V(c)}async function D(n,e,t,s){if(n.timestamp!==void 0)return l(n.timestamp,t(),s);if(e&&typeof e.getBlock=="function"){let r=await k(e,n.blockNumber);return l(r.timestamp,t(),s)}let a=t();return l(a,a,s)}async function _e(n,e={}){let t=e.chainId??u,s=e.maxAgeSeconds??M,a=()=>e.now!==void 0?I(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),r=await be(n,t,e);if((L(r.symbol)||r.symbol.length>256)&&(r.symbol=N(r.symbol)),e.signedNote||e.priceNote){let i=e.signedNote?e.signedNote.note:e.priceNote,d=l(i.timestamp,a(),s);if(e.spotOakPerEthE18!==void 0&&!v(i.oakPerEthE18,e.spotOakPerEthE18))throw new o("Price note is outside the 50% spot guard band.");let m=e.signedNote?.signature??e.signature,p=e.signedNote?.consumer??e.consumer;if(m&&p){let G=await F({note:i,signature:m,consumer:p,signer:e.signer,now:a(),spotOakPerEthE18:e.spotOakPerEthE18,chainId:t});if(!G.valid)throw new o(G.error??"Price note verification failed.")}let E=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:r,usdE18:U(E,i.oakPerEthE18),timestamp:d}}if(e.trades){let i=await D(e,e.client,a,s),d=j(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!v(d,e.spotOakPerEthE18))throw new o("30-minute average is outside the 50% spot guard band.");let m=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:r,usdE18:U(m,d),timestamp:i}}if(e.usdE18!==void 0){let i=await D(e,e.client,a,s),d=T(e.usdE18.toString());if(d<=0n)throw new o("USD price must be positive.");return{token:r,usdE18:d.toString(),timestamp:i}}if(e.resolver){let i=await e.resolver(r),d=l(i.timestamp,a(),s),m=T(i.usdE18);if(m<=0n)throw new o("USD price must be positive.");return{token:r,usdE18:m.toString(),timestamp:d}}let c=e.client??y(e.rpcUrl,t);if(ne(r)){let i=await D(e,c,a,s);return{token:r,usdE18:oe,timestamp:i}}if(de(r)){let i=await D(e,c,a,s),d=await h(c,e.oracleAddress,e.blockNumber);return{token:r,usdE18:d,timestamp:i}}if(r.chainId===u)try{let i=await k(c,e.blockNumber),d=l(i.timestamp,a(),s);if(i.number===null)throw new o("Pons reference requires a mined block.");let[m,p]=await Promise.all([q(r,c,i.number),h(c,e.oracleAddress,i.number)]),E=T(p)*m.numerator/m.denominator;if(E<=0n)throw new o("Pons USD reference price must be positive.");return{token:r,usdE18:E.toString(),timestamp:d}}catch{}throw new o(`No fresh on-chain price source available for token ${N(r.symbol)} (${r.address}).`)}export{M as a,oe as b,ne as c,re as d,ie as e,de as f,Oe as g,l as h,le as i,_e as j};
1
+ import{m as v,n as F}from"./MDV7GECM.js";import{b as A,i as U,n as X,o as V,q as j}from"./WGL46F3S.js";import{a as q}from"./43CSMYDO.js";import{b as z,e as C,n as Y}from"./65EQECL3.js";import{a as w,b as S}from"./HTXKERNS.js";import{a as k}from"./LIUXNOLP.js";import{a as x}from"./U4JGEMKT.js";import{a as B}from"./Z4SRGAVL.js";import{b as $}from"./MYFAKCQI.js";import{a as T}from"./UP7FBDMJ.js";import{o as y}from"./ABPL3ZZI.js";import{a as u,b as f,c as H,d as P,i as g,j as R,k as W,p as K}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as N,b as L}from"./JXOEJPJ4.js";import{getAddress as b,isAddress as J,parseAbi as se}from"viem";var Q=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];var M=300,oe="1000000000000000000",ee=b(g[u].tokens.USDG.address),te=b(g[f].deployments.test_USDG.address),O=b(g[u].tokens.WETH.address),_=b(g[f].deployments.test_WETH.address);function ne(n){let e=n.address.toLowerCase();return n.chainId===u?e===ee.toLowerCase():n.chainId===f?e===te.toLowerCase():!1}function re(n){return n.chainId!==u&&n.chainId!==f?!1:S(n.address)===w}function ie(n){let e=n.address.toLowerCase();return n.chainId===u?e===O.toLowerCase():n.chainId===f?e===_.toLowerCase():!1}function de(n){return re(n)||ie(n)}var ce=-887272,me=887272,ue=(1n<<256n)-1n,fe=se(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]);function I(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new o(`Invalid ${e} timestamp.`)}function Oe(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){try{return l(n,e,t),!0}catch{return!1}}function l(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){if(!Number.isInteger(t)||t<0)throw new o("Maximum price age must be a non-negative integer.");let s=I(n,"price"),a=I(e,"current");if(s<=0n)throw new o("Price timestamp must be positive.");if(s>a)throw new o("Price timestamp is in the future.");let r=a-s;if(r>BigInt(t))throw new o(`Price is stale: age ${r}s exceeds ${t}s.`);return s.toString()}function le(n){if(!Number.isInteger(n)||n<ce||n>me)throw new o(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=ue/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function Z(n,e,t,s){let a=async()=>{throw new o("Price identity resolution is read-only.")},r=B({network:e===f?"testnet":"mainnet",clientFor:i=>t.client??y(t.rpcUrl,i),http:t.http??$(),preview:a,quoteSwap:a,buildSwap:a}),c=await Y(n,{context:r,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:s,blockNumber:t.blockNumber,readMetadata:async i=>{let d=t.client??y(t.rpcUrl,e),[m,p]=await Promise.all([x(d,e,i,"symbol",t.blockNumber),x(d,e,i,"decimals",t.blockNumber)]);return{address:i,symbol:m,decimals:p,chainId:e}}});return{address:c.address,symbol:c.kind==="erc20"&&s?s.symbol:c.symbol,decimals:c.decimals,chainId:c.chainId}}async function be(n,e,t){if(typeof n=="object"&&n!==null){let i=n.chainId??e,d=S(n.address)===w?w:b(n.address),m={address:d,symbol:n.symbol,decimals:n.decimals,chainId:i};return ne(m)?{address:d,symbol:"USDG",decimals:P,chainId:i}:re(m)?{address:w,symbol:"ETH",decimals:18,chainId:i}:ie(m)?{address:d,symbol:"WETH",decimals:18,chainId:i}:Z(m.address,i,t,m)}let s=n.trim(),a=s.toUpperCase(),r=s.toLowerCase();if(a==="ETH"||J(s,{strict:!1})&&S(s)===w)return{...z,chainId:e};if(a==="WETH"||e===u&&r===O.toLowerCase()||e===f&&r===_.toLowerCase()){if(e!==u&&e!==f)throw new o(`No canonical WETH address configured for chain ${e}.`);return{address:e===f?_:O,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===u&&r===R.toLowerCase()||e===f&&r===W.toLowerCase()){if(e!==u&&e!==f)throw new o(`No canonical USDG address configured for chain ${e}.`);return{address:e===f?te:ee,symbol:"USDG",decimals:P,chainId:e}}if(e===u&&(a==="USDE"||r===C.address.toLowerCase()))return{...C,chainId:e};let c=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||c&&s.toLowerCase()===c.toLowerCase()){if(!c&&!J(s,{strict:!1}))throw new o("OAK token address is required to price OAK.");return{address:b(c??s),symbol:"OAK",decimals:H,chainId:e}}return Z(n,e,t)}async function h(n,e,t){if(e)return(await n.readContract({address:e,abi:Q,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:b(K),abi:fe,functionName:"observe",args:[[A,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new o("ETH/USDG pool observation returned insufficient tick cumulatives.");let r=X(a[0],a[1],A),c=le(r);return V(c)}async function D(n,e,t,s){if(n.timestamp!==void 0)return l(n.timestamp,t(),s);if(e&&typeof e.getBlock=="function"){let r=await k(e,n.blockNumber);return l(r.timestamp,t(),s)}let a=t();return l(a,a,s)}async function _e(n,e={}){let t=e.chainId??u,s=e.maxAgeSeconds??M,a=()=>e.now!==void 0?I(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),r=await be(n,t,e);if((L(r.symbol)||r.symbol.length>256)&&(r.symbol=N(r.symbol)),e.signedNote||e.priceNote){let i=e.signedNote?e.signedNote.note:e.priceNote,d=l(i.timestamp,a(),s);if(e.spotOakPerEthE18!==void 0&&!v(i.oakPerEthE18,e.spotOakPerEthE18))throw new o("Price note is outside the 50% spot guard band.");let m=e.signedNote?.signature??e.signature,p=e.signedNote?.consumer??e.consumer;if(m&&p){let G=await F({note:i,signature:m,consumer:p,signer:e.signer,now:a(),spotOakPerEthE18:e.spotOakPerEthE18,chainId:t});if(!G.valid)throw new o(G.error??"Price note verification failed.")}let E=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:r,usdE18:U(E,i.oakPerEthE18),timestamp:d}}if(e.trades){let i=await D(e,e.client,a,s),d=j(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!v(d,e.spotOakPerEthE18))throw new o("30-minute average is outside the 50% spot guard band.");let m=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:r,usdE18:U(m,d),timestamp:i}}if(e.usdE18!==void 0){let i=await D(e,e.client,a,s),d=T(e.usdE18.toString());if(d<=0n)throw new o("USD price must be positive.");return{token:r,usdE18:d.toString(),timestamp:i}}if(e.resolver){let i=await e.resolver(r),d=l(i.timestamp,a(),s),m=T(i.usdE18);if(m<=0n)throw new o("USD price must be positive.");return{token:r,usdE18:m.toString(),timestamp:d}}let c=e.client??y(e.rpcUrl,t);if(ne(r)){let i=await D(e,c,a,s);return{token:r,usdE18:oe,timestamp:i}}if(de(r)){let i=await D(e,c,a,s),d=await h(c,e.oracleAddress,e.blockNumber);return{token:r,usdE18:d,timestamp:i}}if(r.chainId===u)try{let i=await k(c,e.blockNumber),d=l(i.timestamp,a(),s);if(i.number===null)throw new o("Pons reference requires a mined block.");let[m,p]=await Promise.all([q(r,c,i.number),h(c,e.oracleAddress,i.number)]),E=T(p)*m.numerator/m.denominator;if(E<=0n)throw new o("Pons USD reference price must be positive.");return{token:r,usdE18:E.toString(),timestamp:d}}catch{}throw new o(`No fresh on-chain price source available for token ${N(r.symbol)} (${r.address}).`)}export{M as a,oe as b,ne as c,re as d,ie as e,de as f,Oe as g,l as h,le as i,_e as j};
@@ -1 +1 @@
1
- import{f as s,g as u,k as v}from"./C3TJLARP.js";import{a as y}from"./5YS5V2LK.js";var k=["L2Book","Ticker","TradeFill","SubaccountLiquidation","PositionUpdate","OrderUpdate","OrderFill","TokenTransfer"],A=p=>({tools:[{name:"meridian_perps_stream",inputSchema:{type:"object",additionalProperties:!1,required:["stream"],description:"Read a bounded sample of an official perps WebSocket stream, then close. Empty timed-out samples do not prove no activity. L2Book starts with up to 100 levels per side, followed by deltas.",properties:{stream:{type:"string",enum:k},symbol:{type:"string",pattern:"^[A-Za-z0-9]{1,32}$"},subaccountId:{type:"string",format:"uuid"},maxEvents:{type:"integer",minimum:1,maximum:20,default:1},timeoutSeconds:{type:"integer",minimum:1,maximum:30,default:10}}},execute:async e=>{try{p.network==="testnet"&&s("Meridian perps streams require mainnet."),(Object.keys(e).some(c=>!["stream","symbol","subaccountId","maxEvents","timeoutSeconds"].includes(c))||!k.includes(e.stream))&&s("Choose a Meridian perps stream from the schema.");let i=["L2Book","Ticker","TradeFill"].includes(String(e.stream)),M=i?{type:e.stream,symbol:e.symbol}:{type:e.stream,subaccountId:v(e.subaccountId)};(i?e.subaccountId!==void 0||typeof e.symbol!="string"||!/^[A-Za-z0-9]{1,32}$/.test(e.symbol):e.symbol!==void 0)&&s("Market streams need symbol only; account streams need subaccountId only.");let o=e.maxEvents??1,d=e.timeoutSeconds??10;return(typeof o!="number"||!Number.isInteger(o)||o<1||o>20||typeof d!="number"||!Number.isInteger(d)||d<1||d>30)&&s("Choose 1\u201320 events and a timeout of 1\u201330 seconds."),await new Promise((c,S)=>{let n=new globalThis.WebSocket("wss://ws.meridian.xyz/v1/stream"),l=[],h=!1,f=!1,b,m=(a,r=!1)=>{if(!f){f=!0,clearTimeout(I);try{n.readyState<2&&n.close()}catch{}a?S(new y(a)):c({chainId:4663,stream:e.stream,events:l,timedOut:r,scope:"Bounded event sample; no durable subscription or complete history. L2Book events after the first are absolute-quantity deltas; zero removes a level."})}},I=setTimeout(()=>m(h?void 0:"Meridian perps stream did not connect.",!0),d*1e3);n.addEventListener("open",()=>{h=!0,n.send(JSON.stringify({event:"subscribe",data:M}))}),n.addEventListener("error",()=>m("Meridian perps stream is unavailable; retry or inspect the HTTP history.")),n.addEventListener("close",()=>m("Meridian perps stream closed before the requested sample completed.")),n.addEventListener("message",a=>{if(!f)try{(typeof a.data!="string"||a.data.length>262144)&&s("Meridian perps stream returned an oversized or invalid message.");let r=u(JSON.parse(a.data));if(r.ok===!1&&s("Meridian perps stream rejected the subscription. Verify the symbol, subaccount and subscription limits."),r.e==="pong"||r.ok===!0&&r.e===void 0)return;(r.e!==e.stream||typeof r.t!="number"||!Number.isSafeInteger(r.t))&&s("Meridian perps stream returned a different or invalid event.");let t=u(r.data);if(i&&t.s!==e.symbol&&s("Meridian perps stream returned a different product."),!i){let w=Array.isArray(t.d)?t.d.map(u):[t];(!(e.stream==="SubaccountLiquidation"?t.sid===e.subaccountId:w.every(E=>E.sid===e.subaccountId))||t.sid!==void 0&&t.sid!==e.subaccountId)&&s("Meridian perps stream returned a different subaccount.")}e.stream==="L2Book"&&((typeof t.t!="number"||!Number.isSafeInteger(t.t)||t.t<0||!Array.isArray(t.a)||!Array.isArray(t.b))&&s("Meridian perps book snapshot is malformed."),b!==void 0&&t.pt!==void 0&&t.pt!==b&&s("Meridian perps book updates have a gap. Request a fresh snapshot."),b=t.t),l.push(r),l.length>=o&&m()}catch(r){m(p.plainError(r))}})})}catch(i){throw new y(p.plainError(i))}}}]});export{k as a,A as b};
1
+ import{f as s,g as u,k as v}from"./QVYCJ6WV.js";import{a as y}from"./XSD5NL7J.js";var k=["L2Book","Ticker","TradeFill","SubaccountLiquidation","PositionUpdate","OrderUpdate","OrderFill","TokenTransfer"],A=p=>({tools:[{name:"meridian_perps_stream",inputSchema:{type:"object",additionalProperties:!1,required:["stream"],description:"Read a bounded sample of an official perps WebSocket stream, then close. Empty timed-out samples do not prove no activity. L2Book starts with up to 100 levels per side, followed by deltas.",properties:{stream:{type:"string",enum:k},symbol:{type:"string",pattern:"^[A-Za-z0-9]{1,32}$"},subaccountId:{type:"string",format:"uuid"},maxEvents:{type:"integer",minimum:1,maximum:20,default:1},timeoutSeconds:{type:"integer",minimum:1,maximum:30,default:10}}},execute:async e=>{try{p.network==="testnet"&&s("Meridian perps streams require mainnet."),(Object.keys(e).some(c=>!["stream","symbol","subaccountId","maxEvents","timeoutSeconds"].includes(c))||!k.includes(e.stream))&&s("Choose a Meridian perps stream from the schema.");let i=["L2Book","Ticker","TradeFill"].includes(String(e.stream)),M=i?{type:e.stream,symbol:e.symbol}:{type:e.stream,subaccountId:v(e.subaccountId)};(i?e.subaccountId!==void 0||typeof e.symbol!="string"||!/^[A-Za-z0-9]{1,32}$/.test(e.symbol):e.symbol!==void 0)&&s("Market streams need symbol only; account streams need subaccountId only.");let o=e.maxEvents??1,d=e.timeoutSeconds??10;return(typeof o!="number"||!Number.isInteger(o)||o<1||o>20||typeof d!="number"||!Number.isInteger(d)||d<1||d>30)&&s("Choose 1\u201320 events and a timeout of 1\u201330 seconds."),await new Promise((c,S)=>{let n=new globalThis.WebSocket("wss://ws.meridian.xyz/v1/stream"),l=[],h=!1,f=!1,b,m=(a,r=!1)=>{if(!f){f=!0,clearTimeout(I);try{n.readyState<2&&n.close()}catch{}a?S(new y(a)):c({chainId:4663,stream:e.stream,events:l,timedOut:r,scope:"Bounded event sample; no durable subscription or complete history. L2Book events after the first are absolute-quantity deltas; zero removes a level."})}},I=setTimeout(()=>m(h?void 0:"Meridian perps stream did not connect.",!0),d*1e3);n.addEventListener("open",()=>{h=!0,n.send(JSON.stringify({event:"subscribe",data:M}))}),n.addEventListener("error",()=>m("Meridian perps stream is unavailable; retry or inspect the HTTP history.")),n.addEventListener("close",()=>m("Meridian perps stream closed before the requested sample completed.")),n.addEventListener("message",a=>{if(!f)try{(typeof a.data!="string"||a.data.length>262144)&&s("Meridian perps stream returned an oversized or invalid message.");let r=u(JSON.parse(a.data));if(r.ok===!1&&s("Meridian perps stream rejected the subscription. Verify the symbol, subaccount and subscription limits."),r.e==="pong"||r.ok===!0&&r.e===void 0)return;(r.e!==e.stream||typeof r.t!="number"||!Number.isSafeInteger(r.t))&&s("Meridian perps stream returned a different or invalid event.");let t=u(r.data);if(i&&t.s!==e.symbol&&s("Meridian perps stream returned a different product."),!i){let w=Array.isArray(t.d)?t.d.map(u):[t];(!(e.stream==="SubaccountLiquidation"?t.sid===e.subaccountId:w.every(E=>E.sid===e.subaccountId))||t.sid!==void 0&&t.sid!==e.subaccountId)&&s("Meridian perps stream returned a different subaccount.")}e.stream==="L2Book"&&((typeof t.t!="number"||!Number.isSafeInteger(t.t)||t.t<0||!Array.isArray(t.a)||!Array.isArray(t.b))&&s("Meridian perps book snapshot is malformed."),b!==void 0&&t.pt!==void 0&&t.pt!==b&&s("Meridian perps book updates have a gap. Request a fresh snapshot."),b=t.t),l.push(r),l.length>=o&&m()}catch(r){m(p.plainError(r))}})})}catch(i){throw new y(p.plainError(i))}}}]});export{k as a,A as b};
@@ -1 +1 @@
1
- import{d as a,e as s,f as r,i,j as f}from"./53N7PNJH.js";import{a as p}from"./5YS5V2LK.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{d as a,e as s,f as r,i,j as f}from"./6PY3IRDS.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};
@@ -0,0 +1 @@
1
+ import{b as T}from"./WIVYKLQM.js";import{c as A}from"./DVVFT42J.js";import{i as b}from"./IMRXZ7JB.js";import{j as P}from"./S2TAJHHK.js";import{a as f,i as g}from"./FWD4L3CJ.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};
@@ -1 +1 @@
1
- import{j as p}from"./6ZYLNB2B.js";import{a as d}from"./CY75R4FK.js";import{a as f}from"./6IM6A5VA.js";import{d as a,i as c}from"./73N3TOJL.js";import{a as m}from"./RETS2ZEK.js";import{a as i}from"./G6HCV67X.js";import{a as s}from"./5YS5V2LK.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
1
+ import{j as p}from"./HVM2EEXB.js";import{a as d}from"./HTXKERNS.js";import{a as f}from"./PBQSJSZO.js";import{d as a,i as c}from"./5KUWLUPM.js";import{a as m}from"./UP7FBDMJ.js";import{a as i}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
@@ -0,0 +1 @@
1
+ import{parseAbi as e,parseAbiItem as s}from"viem";var o=e(["function isValidMarket(address market) view returns (bool)"]),u=s("event CreateNewMarket(address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)"),d=e(["function readTokens() view returns (address sy, address pt, address yt)","function expiry() view returns (uint256)","function isExpired() view returns (bool)","function readState(address router) view returns ((uint256 totalPt, uint256 totalSy, uint256 totalLp, address treasury, int256 scalarRoot, uint256 expiry, uint256 lnFeeRateRoot, uint256 reserveFeeRate, uint256 lastLnImpliedRate) state)"]),l=e(["function getTokensIn() view returns (address[])","function getTokensOut() view returns (address[])","function decimals() view returns (uint8)","function exchangeRate() view returns (uint256)","function previewRedeem(address tokenOut, uint256 amountSharesToRedeem) view returns (uint256 amountTokenOut)"]),c=e(["function pyIndexStored() view returns (uint256)"]),f=e(["function symbol() view returns (string)","function decimals() view returns (uint8)","function balanceOf(address owner) view returns (uint256)"]);async function p(r,t){return t.length===0?[]:(await r.multicall({contracts:t,allowFailure:!0})).map(n=>n.status==="success"?{ok:!0,value:n.result}:{ok:!1})}export{o as a,u as b,d as c,l as d,c as e,f,p as g};
@@ -0,0 +1 @@
1
+ import{a as u,f as I,g}from"./6JCEJ66K.js";import{a as P}from"./PBQSJSZO.js";import{m as B}from"./5KUWLUPM.js";import{a as e,i as _}from"./FWD4L3CJ.js";import{a as m}from"./XSD5NL7J.js";import{erc20Abi as C,getAddress as l}from"viem";var b=l(u.staking),f=l(u.agentVault),p=l(u.orbio),w={address:l(_[e].orbio.credit.address),chainId:e,symbol:"CREDIT",decimals:6},D=g.find(o=>o.type==="event"&&o.name==="AgentLaunched"),$=10000000n,A=o=>B(o,"Orbio returned an invalid on-chain amount.");async function F(o,N){try{P(N);let i=l(N),n=o.clientFor(e);if(await n.getChainId()!==e)throw new m(`Orbio requires chain ${e}.`);let a=await n.getBlockNumber(),[s,v,E,S,T]=await Promise.all([n.readContract({address:p,abi:C,functionName:"decimals",blockNumber:a}),n.readContract({address:b,abi:I,functionName:"positionOf",args:[i],blockNumber:a}),n.readContract({address:b,abi:I,functionName:"settledOf",args:[i],blockNumber:a}),n.readContract({address:p,abi:C,functionName:"balanceOf",args:[i],blockNumber:a}),n.readContract({address:w.address,abi:C,functionName:"balanceOf",args:[i],blockNumber:a})]);if(typeof s!="number"||!Number.isInteger(s)||s<0||s>36)throw new m("Orbio returned invalid ORBIO decimals.");let h={address:p,chainId:e,symbol:"ORBIO",decimals:s},R=[],d=(t,r,c,k)=>{let O=A(c);O!==0n&&R.push({module:"orbio",id:`${e}:${t}`,chainId:e,assets:[{token:{...r},amount:O.toString()}],description:`${k}: ${O} ${r.symbol} base units (${r.decimals} decimals).`})};d(`${b}:principal`,h,v,"Staked ORBIO principal; withdraw with orbio_unstake"),d(`${b}:credit`,w,E,"Claim settled staking CREDIT with orbio_claim_staking"),d(`${p}:held`,h,S,"Held ORBIO in this wallet"),d(`${w.address}:held`,w,T,"Held unactivated CREDIT in this wallet");let y=new Set;for(let t=0n;t<=a;t+=$){let r=t+$-1n<a?t+$-1n:a,c=await n.getLogs({address:f,event:D,args:{owner:i},fromBlock:t,toBlock:r,strict:!0});for(let k of c)y.add(A(k.args.agentId))}for(let t of y){let[r,c]=await Promise.all([n.readContract({address:f,abi:g,functionName:"stakeOf",args:[t],blockNumber:a}),n.readContract({address:f,abi:g,functionName:"unlocksAt",args:[t],blockNumber:a})]);d(`${f}:agent:${t}`,h,r,`ORBIO principal staked for owned agent ${t}; principal unlock time ${A(c)} (Unix seconds); withdraw with orbio_agent_withdraw_principal`)}return R}catch(i){throw new m(o.plainError(i))}}export{F as a};
@@ -1 +1 @@
1
- import{d as p}from"./M7U3A4EH.js";import{e as a}from"./73N3TOJL.js";import{a as l}from"./5YS5V2LK.js";import{createHash as x}from"node:crypto";var c=32768,g="wormhole-x402@0.11.0/603aba277a626630d9b9463f713121dc4327325c";function w(s){if(!a(s)||Object.keys(s).length!==1||typeof s.text!="string")throw new l("Provide only text as a string for the local Wormhole scan.");let n=s.text,f=n.length>c||Buffer.byteLength(n,"utf8")>c,i={local:!0,scannerVersion:g,attribution:{provider:"Agent Wormhole",source:"https://github.com/runningoffcode/agent-wormhole"},limitation:"Evadable English instruction-shape rules. Allow is not proof of safety, intent, or coverage of unknown attacks."};if(f)return{...i,decision:"abstain",codes:[],findings:[],scannedPaths:[],charsScanned:0,inputHash:null,reason:"Text exceeds the 32768-byte local scan limit; no text was scanned or hashed."};let u=x("sha256").update(n,"utf8").digest("hex"),m={maxFieldChars:c,maxDecodeDepth:3,maxDepth:12},d=t=>{try{return p(t,m)}catch{return{decision:"abstain",findings:[],scanned:[],charsScanned:0}}},e=[{path:"text",verdict:d(n)}];try{let t=JSON.parse(n);(typeof t=="string"||a(t)||Array.isArray(t))&&e.push({path:"text.json",verdict:d(t)})}catch{}let r=e.flatMap(t=>t.verdict.findings.map(o=>({code:o.code,severity:o.severity,path:t.path,offset:o.offset}))),h=e.some(t=>t.verdict.decision==="refuse")?"refuse":e.some(t=>t.verdict.decision==="abstain")?"abstain":"allow";return{...i,decision:h,codes:[...new Set(r.map(t=>t.code))],findings:r.slice(0,64),findingsTruncated:r.length>64,scannedPaths:e.filter(t=>t.verdict.scanned.length).map(t=>t.path),charsScanned:e.reduce((t,o)=>t+o.verdict.charsScanned,0),inputHash:u,...h==="abstain"?{reason:"The local scanner could not cover all supplied text. Treat the result as unknown."}:{}}}export{c as a,g as b,w as c};
1
+ import{d as p}from"./M7U3A4EH.js";import{e as a}from"./5KUWLUPM.js";import{a as l}from"./XSD5NL7J.js";import{createHash as x}from"node:crypto";var c=32768,g="wormhole-x402@0.11.0/603aba277a626630d9b9463f713121dc4327325c";function w(s){if(!a(s)||Object.keys(s).length!==1||typeof s.text!="string")throw new l("Provide only text as a string for the local Wormhole scan.");let n=s.text,f=n.length>c||Buffer.byteLength(n,"utf8")>c,i={local:!0,scannerVersion:g,attribution:{provider:"Agent Wormhole",source:"https://github.com/runningoffcode/agent-wormhole"},limitation:"Evadable English instruction-shape rules. Allow is not proof of safety, intent, or coverage of unknown attacks."};if(f)return{...i,decision:"abstain",codes:[],findings:[],scannedPaths:[],charsScanned:0,inputHash:null,reason:"Text exceeds the 32768-byte local scan limit; no text was scanned or hashed."};let u=x("sha256").update(n,"utf8").digest("hex"),m={maxFieldChars:c,maxDecodeDepth:3,maxDepth:12},d=t=>{try{return p(t,m)}catch{return{decision:"abstain",findings:[],scanned:[],charsScanned:0}}},e=[{path:"text",verdict:d(n)}];try{let t=JSON.parse(n);(typeof t=="string"||a(t)||Array.isArray(t))&&e.push({path:"text.json",verdict:d(t)})}catch{}let r=e.flatMap(t=>t.verdict.findings.map(o=>({code:o.code,severity:o.severity,path:t.path,offset:o.offset}))),h=e.some(t=>t.verdict.decision==="refuse")?"refuse":e.some(t=>t.verdict.decision==="abstain")?"abstain":"allow";return{...i,decision:h,codes:[...new Set(r.map(t=>t.code))],findings:r.slice(0,64),findingsTruncated:r.length>64,scannedPaths:e.filter(t=>t.verdict.scanned.length).map(t=>t.path),charsScanned:e.reduce((t,o)=>t+o.verdict.charsScanned,0),inputHash:u,...h==="abstain"?{reason:"The local scanner could not cover all supplied text. Treat the result as unknown."}:{}}}export{c as a,g as b,w as c};
@@ -0,0 +1 @@
1
+ import{a as S}from"./A3PN3PK3.js";import{a as M}from"./PBQSJSZO.js";import{a as s,j as I}from"./FWD4L3CJ.js";import{a as n}from"./XSD5NL7J.js";import{getAddress as c}from"viem";var j=["one_hour","six_hours","one_day","seven_days","thirty_days","ninety_days","one_year","inception"],v=["one_day","seven_days","thirty_days","ninety_days","one_year","inception"],A={apy:["v1","apy-averages"],allocations:["v0","allocations"],history:["v0","state/history"],pending_governance:["v0","pending-governance-actions"]};function f(o){if(!o||typeof o!="object"||Array.isArray(o))throw new n("Morpho analytics returned an invalid object.");return o}function b(o){if(typeof o!="string"||!/^\d+$/.test(o)||BigInt(o)>=1n<<256n)throw new n("Morpho analytics returned an invalid decimal base-unit amount.");return o}function N(o,d){let r=f(o);if(![s,String(s)].includes(r.chain_id)||typeof r.vault_address!="string"||c(r.vault_address)!==c(d))throw new n("Morpho analytics returned another chain or vault.")}function k(o,d=0){if(d>12)throw new n("Morpho analytics response is too deeply nested.");if(Array.isArray(o))return o.map(r=>k(r,d+1));if(o&&typeof o=="object")return Object.fromEntries(Object.entries(o).map(([r,e])=>{if(e!==null&&/(?:_assets|_shares|_supply|_cap|_wad|_ray)$/.test(r)&&typeof e!="object")return[r,b(e)];if(e!==null&&/_address$/.test(r)){if(typeof e!="string")throw new n("Morpho analytics returned an invalid address.");return[r,c(e)]}return[r,k(e,d+1)]}));if(typeof o=="number"&&!Number.isFinite(o))throw new n("Morpho analytics returned a non-finite value.");return o}function U(o,d,r){return{name:d,inputSchema:{type:"object",additionalProperties:!1,required:["view"],properties:{view:{type:"string",enum:Object.keys(A)},lookback:{type:"string",enum:j,description:"APY window: one_hour through inception. History: one_day, seven_days, thirty_days, ninety_days, one_year or inception. Defaults to six_hours for APY or seven_days for history."},cursor:{type:"string",maxLength:4096,description:"Opaque cursor from pending_governance only."},limit:{type:"integer",minimum:1,maximum:100}},allOf:[{if:{properties:{view:{const:"history"}},required:["view"]},then:{properties:{lookback:{enum:v}}}}]},execute:async(e,O)=>{try{if(M(O),Object.keys(e).some(t=>!["view","lookback","cursor","limit"].includes(t))||typeof e.view!="string"||!Object.hasOwn(A,e.view))throw new n("Choose a documented Morpho analytics view.");let a=e.view,u=a==="history",w=a==="apy",_=a==="pending_governance";if(e.lookback!==void 0&&(!u&&!w||typeof e.lookback!="string"||!j.includes(e.lookback)))throw new n("lookback is available only for APY/history with a documented window.");if(u&&e.lookback!==void 0&&!v.includes(e.lookback))throw new n(`Choose a history lookback from ${v.join(", ")}; sub-day history is unavailable.`);if(!_&&(e.cursor!==void 0||e.limit!==void 0))throw new n("Pagination applies only to pending_governance.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||e.cursor.length>4096))throw new n("Provide the opaque pending-governance cursor string.");let y=e.limit??100;if(typeof y!="number"||!Number.isInteger(y)||y<1||y>100)throw new n("Pagination limit must be an integer from 1 to 100.");let[Y,$]=A[a],p=new URL(`https://api.morpho.org/${Y}/vaults-v2/${s}:${c(r)}/${$}`);(u||w)&&p.searchParams.set("lookback",String(e.lookback??(u?"seven_days":"six_hours"))),_&&(p.searchParams.set("limit",String(y)),e.cursor!==void 0&&p.searchParams.set("cursor",e.cursor));let g=await o.http(p.toString(),{headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!g.ok)throw new n(`Morpho analytics HTTP ${g.status}. Retry when the service is reachable; no zero APY or empty book was inferred.`);let i=f(await g.json());N(w||a==="allocations"?i.data:i.params,r);let m,h=i.last_indexed_block,P=null;if(w){let t=f(i.data);if(t.lookback!==(e.lookback??"six_hours")||t.apy!==null&&(typeof t.apy!="number"||!Number.isFinite(t.apy)||t.apy<-1))throw new n("Morpho analytics returned an invalid APY or lookback.");m={annualYieldFraction:t.apy===null?null:String(t.apy),...t.apy===null?{status:"unavailable",reason:"Not enough history for the requested APY window."}:{},lookback:t.lookback,basis:"Realized post-fee share-price APY, excluding rewards; historical observation, not a promised return."},h=t.last_indexed_block}else if(a==="allocations"){let t=f(i.data);if(!Array.isArray(t.allocations))throw new n("Morpho analytics omitted adapter allocations.");m=k(t.allocations),h=t.last_indexed_block}else{if(!Array.isArray(i.data))throw new n("Morpho analytics omitted its record array.");if(u)for(let t of i.data){let l=f(t);if(typeof l.timestamp!="number"||!Number.isSafeInteger(l.timestamp)||l.timestamp<0)throw new n("Morpho history returned an invalid timestamp.");for(let C of["total_assets","total_supply","withdrawable_assets","allocated_assets","idle_assets"])b(l[C]);l.share_price_ray!==null&&b(l.share_price_ray)}if(_){if(i.cursor!==null&&typeof i.cursor!="string")throw new n("Morpho analytics returned an invalid pagination cursor.");P=i.cursor}m=k(i.data)}h!==void 0&&b(h);let x=o.clientFor(s);if(await x.getChainId()!==s)throw new n("Vault share metadata requires chain 4663.");let D=await S(x,c(r));return{vault:c(r),chainId:s,sourceUrl:p.toString(),view:a,lastIndexedBlock:h??null,cursor:P,data:m,asset:{address:c(I),symbol:"USDG",decimals:6,chainId:s},shareToken:{address:c(r),symbol:D,decimals:18,chainId:s},scales:{sharePriceRay:"1000000000000000000000000000",capWad:"1000000000000000000"},caveat:"Indexer data may lag the chain. APY excludes rewards; empty records describe only this API window/page. Re-read onchain state and preview before any action. API book data is never executed as calldata automatically."}}catch(a){throw new n(o.plainError(a))}}}}export{U as a};