@oakagentkit/core 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (730) hide show
  1. package/build/dist/api/abort-scope.d.ts +2 -0
  2. package/build/dist/api/abort-scope.js +1 -0
  3. package/build/dist/api/addresses.d.ts +9 -0
  4. package/build/dist/api/addresses.js +1 -1
  5. package/build/dist/api/chain.d.ts +4 -0
  6. package/build/dist/api/chain.js +1 -1
  7. package/build/dist/api/history.js +1 -1
  8. package/build/dist/api/http.js +1 -1
  9. package/build/dist/api/identity-link.js +1 -1
  10. package/build/dist/api/metadata.js +1 -1
  11. package/build/dist/api/modules/beefy/boosts.js +1 -1
  12. package/build/dist/api/modules/beefy/clm.js +1 -1
  13. package/build/dist/api/modules/beefy/guard.js +1 -1
  14. package/build/dist/api/modules/beefy/index.js +1 -1
  15. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  16. package/build/dist/api/modules/beefy/management.js +1 -1
  17. package/build/dist/api/modules/beefy/vaults.js +1 -1
  18. package/build/dist/api/modules/borro/abi.d.ts +54 -0
  19. package/build/dist/api/modules/borro/abi.js +1 -1
  20. package/build/dist/api/modules/borro/actions.d.ts +14 -1
  21. package/build/dist/api/modules/borro/actions.js +1 -1
  22. package/build/dist/api/modules/borro/checks.js +1 -1
  23. package/build/dist/api/modules/borro/copy.d.ts +23 -10
  24. package/build/dist/api/modules/borro/copy.js +1 -1
  25. package/build/dist/api/modules/borro/index.js +1 -1
  26. package/build/dist/api/modules/borro/liquidity.js +1 -1
  27. package/build/dist/api/modules/borro/pins.d.ts +30 -14
  28. package/build/dist/api/modules/borro/pins.js +1 -1
  29. package/build/dist/api/modules/borro/positions.js +1 -1
  30. package/build/dist/api/modules/borro/reader.js +1 -1
  31. package/build/dist/api/modules/borro/types.d.ts +1 -0
  32. package/build/dist/api/modules/chop/abi.d.ts +31 -0
  33. package/build/dist/api/modules/chop/abi.js +1 -1
  34. package/build/dist/api/modules/chop/actions.js +1 -1
  35. package/build/dist/api/modules/chop/checks.d.ts +13 -5
  36. package/build/dist/api/modules/chop/checks.js +1 -1
  37. package/build/dist/api/modules/chop/copy.d.ts +11 -1
  38. package/build/dist/api/modules/chop/copy.js +1 -1
  39. package/build/dist/api/modules/chop/guard.js +1 -1
  40. package/build/dist/api/modules/chop/index.js +1 -1
  41. package/build/dist/api/modules/chop/positions.js +1 -1
  42. package/build/dist/api/modules/chop/reader.d.ts +132 -7
  43. package/build/dist/api/modules/chop/reader.js +1 -1
  44. package/build/dist/api/modules/chop/types.d.ts +12 -0
  45. package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
  46. package/build/dist/api/modules/clanker/extensions.js +1 -1
  47. package/build/dist/api/modules/clanker/index.js +1 -1
  48. package/build/dist/api/modules/clanker/manage.js +1 -1
  49. package/build/dist/api/modules/clanker/pool-config.d.ts +15 -0
  50. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  51. package/build/dist/api/modules/clanker/protocol.js +1 -1
  52. package/build/dist/api/modules/clanker/state.js +1 -1
  53. package/build/dist/api/modules/earn/copy.d.ts +36 -14
  54. package/build/dist/api/modules/earn/copy.js +1 -1
  55. package/build/dist/api/modules/earn/cost.d.ts +11 -1
  56. package/build/dist/api/modules/earn/cost.js +1 -1
  57. package/build/dist/api/modules/earn/index.js +1 -1
  58. package/build/dist/api/modules/earn/lp.d.ts +14 -1
  59. package/build/dist/api/modules/earn/lp.js +1 -1
  60. package/build/dist/api/modules/earn/options.d.ts +6 -4
  61. package/build/dist/api/modules/earn/options.js +1 -1
  62. package/build/dist/api/modules/erc8004/common.d.ts +1 -1
  63. package/build/dist/api/modules/erc8004/common.js +1 -1
  64. package/build/dist/api/modules/erc8004/domain.js +1 -1
  65. package/build/dist/api/modules/erc8004/index.js +1 -1
  66. package/build/dist/api/modules/erc8004/management.js +1 -1
  67. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  68. package/build/dist/api/modules/erc8004/services.js +1 -1
  69. package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
  70. package/build/dist/api/modules/erc8004/thesis.js +1 -0
  71. package/build/dist/api/modules/erc8004/validation.js +1 -1
  72. package/build/dist/api/modules/factor/abi.d.ts +642 -0
  73. package/build/dist/api/modules/factor/abi.js +1 -0
  74. package/build/dist/api/modules/factor/actions.d.ts +15 -0
  75. package/build/dist/api/modules/factor/actions.js +1 -0
  76. package/build/dist/api/modules/factor/api.d.ts +7 -0
  77. package/build/dist/api/modules/factor/api.js +1 -0
  78. package/build/dist/api/modules/factor/checks.d.ts +11 -0
  79. package/build/dist/api/modules/factor/checks.js +1 -0
  80. package/build/dist/api/modules/factor/copy.d.ts +33 -0
  81. package/build/dist/api/modules/factor/copy.js +1 -0
  82. package/build/dist/api/modules/factor/guard.d.ts +12 -0
  83. package/build/dist/api/modules/factor/guard.js +1 -0
  84. package/build/dist/api/modules/factor/index.d.ts +16 -0
  85. package/build/dist/api/modules/factor/index.js +8 -0
  86. package/build/dist/api/modules/factor/messages.d.ts +46 -0
  87. package/build/dist/api/modules/factor/messages.js +1 -0
  88. package/build/dist/api/modules/factor/pins.d.ts +64 -0
  89. package/build/dist/api/modules/factor/pins.js +1 -0
  90. package/build/dist/api/modules/factor/reader.d.ts +17 -0
  91. package/build/dist/api/modules/factor/reader.js +1 -0
  92. package/build/dist/api/modules/factor/types.d.ts +18 -0
  93. package/build/dist/api/modules/factor/types.js +0 -0
  94. package/build/dist/api/modules/gloam/copy.d.ts +4 -3
  95. package/build/dist/api/modules/gloam/copy.js +2 -2
  96. package/build/dist/api/modules/gloam/index.js +1 -1
  97. package/build/dist/api/modules/grove/index.js +1 -1
  98. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  99. package/build/dist/api/modules/heyresearch/index.js +1 -1
  100. package/build/dist/api/modules/heyresearch/public-reads.d.ts +29 -1
  101. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  102. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  103. package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
  104. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  105. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  106. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  107. package/build/dist/api/modules/hoodag/index.d.ts +12 -1
  108. package/build/dist/api/modules/hoodag/index.js +1 -1
  109. package/build/dist/api/modules/hoodag/management.js +1 -1
  110. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  111. package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
  112. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  113. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  114. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  115. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  116. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  117. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  118. package/build/dist/api/modules/hoodlock/index.js +1 -1
  119. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  120. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  121. package/build/dist/api/modules/hoodlock/public.js +1 -1
  122. package/build/dist/api/modules/hookr/actions.js +1 -1
  123. package/build/dist/api/modules/hookr/addons.js +1 -1
  124. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  125. package/build/dist/api/modules/hookr/contracts.d.ts +2 -1
  126. package/build/dist/api/modules/hookr/contracts.js +1 -1
  127. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  128. package/build/dist/api/modules/hookr/discovery.js +1 -1
  129. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  130. package/build/dist/api/modules/hookr/index.js +1 -1
  131. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  132. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  133. package/build/dist/api/modules/hookr/launch.js +1 -1
  134. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  135. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  136. package/build/dist/api/modules/hookr/lp-reads.d.ts +2 -0
  137. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  138. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  139. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  140. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  141. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  142. package/build/dist/api/modules/hookr/relay.js +1 -1
  143. package/build/dist/api/modules/hookr/revenue.js +1 -1
  144. package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
  145. package/build/dist/api/modules/kyberswap/index.js +1 -1
  146. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  147. package/build/dist/api/modules/layerbank/abi.js +1 -1
  148. package/build/dist/api/modules/layerbank/actions.js +1 -1
  149. package/build/dist/api/modules/layerbank/checks.js +1 -1
  150. package/build/dist/api/modules/layerbank/index.js +1 -1
  151. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  152. package/build/dist/api/modules/layerbank/reader.js +1 -1
  153. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  154. package/build/dist/api/modules/lighter/index.js +1 -1
  155. package/build/dist/api/modules/longbow/administration.js +1 -1
  156. package/build/dist/api/modules/longbow/analytics.js +1 -1
  157. package/build/dist/api/modules/longbow/fixed.js +1 -1
  158. package/build/dist/api/modules/longbow/index.js +1 -1
  159. package/build/dist/api/modules/longbow/nft.js +1 -1
  160. package/build/dist/api/modules/longbow/rebates.js +1 -1
  161. package/build/dist/api/modules/longbow/staking.js +1 -1
  162. package/build/dist/api/modules/meridian/index.js +1 -1
  163. package/build/dist/api/modules/meridian/markets.js +1 -1
  164. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  165. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  166. package/build/dist/api/modules/meridian/perps.js +1 -1
  167. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  168. package/build/dist/api/modules/meridian/rfq.js +1 -1
  169. package/build/dist/api/modules/merkl/discovery.js +1 -1
  170. package/build/dist/api/modules/merkl/index.js +1 -1
  171. package/build/dist/api/modules/merkl/manage.js +1 -1
  172. package/build/dist/api/modules/merkl/protocol.js +1 -1
  173. package/build/dist/api/modules/morpho/allocator.js +1 -1
  174. package/build/dist/api/modules/morpho/bundles.js +1 -1
  175. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  176. package/build/dist/api/modules/morpho/index.js +1 -1
  177. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  178. package/build/dist/api/modules/morpho/midnight.js +1 -1
  179. package/build/dist/api/modules/morpho/protocol.js +1 -1
  180. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  181. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  182. package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
  183. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  184. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  185. package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
  186. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  187. package/build/dist/api/modules/netnet/card-read.js +1 -1
  188. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  189. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  190. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  191. package/build/dist/api/modules/netnet/financial.js +1 -1
  192. package/build/dist/api/modules/netnet/index.js +1 -1
  193. package/build/dist/api/modules/netnet/staking.js +1 -1
  194. package/build/dist/api/modules/orbio/gateway.js +1 -1
  195. package/build/dist/api/modules/orbio/index.d.ts +6 -0
  196. package/build/dist/api/modules/orbio/index.js +1 -1
  197. package/build/dist/api/modules/orbio/positions.js +1 -1
  198. package/build/dist/api/modules/pendle/convert.js +1 -1
  199. package/build/dist/api/modules/pendle/costs.js +1 -1
  200. package/build/dist/api/modules/pendle/index.js +1 -1
  201. package/build/dist/api/modules/pendle/markets.js +1 -1
  202. package/build/dist/api/modules/pendle/positions.js +1 -1
  203. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  204. package/build/dist/api/modules/pendle/reader.js +1 -1
  205. package/build/dist/api/modules/pendle/redeem.js +1 -1
  206. package/build/dist/api/modules/pendle/trade.js +1 -1
  207. package/build/dist/api/modules/pendle/validate.js +1 -1
  208. package/build/dist/api/modules/pendle/verify.js +1 -1
  209. package/build/dist/api/modules/pons/claim.js +1 -1
  210. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  211. package/build/dist/api/modules/pons/index.js +1 -1
  212. package/build/dist/api/modules/pons/launch-status.js +1 -1
  213. package/build/dist/api/modules/pons/prices.js +1 -1
  214. package/build/dist/api/modules/pons/reads.js +1 -1
  215. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  216. package/build/dist/api/modules/pons/trade.d.ts +3 -2
  217. package/build/dist/api/modules/pons/trade.js +1 -1
  218. package/build/dist/api/modules/poolstrade/index.js +1 -1
  219. package/build/dist/api/modules/priors/coverage.js +1 -1
  220. package/build/dist/api/modules/priors/discovery.js +1 -1
  221. package/build/dist/api/modules/priors/features.js +1 -1
  222. package/build/dist/api/modules/priors/holdings.js +1 -1
  223. package/build/dist/api/modules/priors/index.js +1 -1
  224. package/build/dist/api/modules/priors/integration.d.ts +1 -0
  225. package/build/dist/api/modules/priors/integration.js +1 -1
  226. package/build/dist/api/modules/priors/market.js +1 -1
  227. package/build/dist/api/modules/priors/pt.js +1 -1
  228. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  229. package/build/dist/api/modules/priors/starter-line.js +1 -1
  230. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  231. package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
  232. package/build/dist/api/modules/raeto/authorization.js +1 -0
  233. package/build/dist/api/modules/raeto/copy.d.ts +46 -0
  234. package/build/dist/api/modules/raeto/copy.js +1 -0
  235. package/build/dist/api/modules/raeto/errors.d.ts +4 -0
  236. package/build/dist/api/modules/raeto/errors.js +1 -0
  237. package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
  238. package/build/dist/api/modules/raeto/estimate.js +1 -0
  239. package/build/dist/api/modules/raeto/index.d.ts +16 -0
  240. package/build/dist/api/modules/raeto/index.js +1 -0
  241. package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
  242. package/build/dist/api/modules/raeto/pairing.js +1 -0
  243. package/build/dist/api/modules/raeto/pins.d.ts +24 -0
  244. package/build/dist/api/modules/raeto/pins.js +1 -0
  245. package/build/dist/api/modules/raeto/templates.d.ts +22 -0
  246. package/build/dist/api/modules/raeto/templates.js +1 -0
  247. package/build/dist/api/modules/raeto/terms.d.ts +8 -0
  248. package/build/dist/api/modules/raeto/terms.js +1 -0
  249. package/build/dist/api/modules/raeto/types.d.ts +64 -0
  250. package/build/dist/api/modules/raeto/types.js +0 -0
  251. package/build/dist/api/modules/relay/api.d.ts +16 -0
  252. package/build/dist/api/modules/relay/api.js +1 -1
  253. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  254. package/build/dist/api/modules/relay/discovery.js +1 -1
  255. package/build/dist/api/modules/relay/inbound.js +1 -1
  256. package/build/dist/api/modules/relay/index.d.ts +1 -0
  257. package/build/dist/api/modules/relay/index.js +1 -1
  258. package/build/dist/api/modules/relay/order.js +1 -1
  259. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  260. package/build/dist/api/modules/relay/readiness.d.ts +1 -0
  261. package/build/dist/api/modules/relay/readiness.js +1 -1
  262. package/build/dist/api/modules/relay/reads.js +1 -1
  263. package/build/dist/api/modules/relay/vaults.js +1 -1
  264. package/build/dist/api/modules/spark/actions.js +1 -1
  265. package/build/dist/api/modules/spark/details.js +1 -1
  266. package/build/dist/api/modules/spark/index.js +1 -1
  267. package/build/dist/api/modules/spark/management.js +1 -1
  268. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  269. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  270. package/build/dist/api/modules/steakhouse/index.js +1 -1
  271. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  272. package/build/dist/api/modules/steakhouse/management.js +1 -1
  273. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  274. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  275. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  276. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  277. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  278. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  279. package/build/dist/api/modules/tickerspring/index.js +1 -1
  280. package/build/dist/api/modules/tickerspring/journeys.d.ts +1 -0
  281. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  282. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  283. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  284. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  285. package/build/dist/api/modules/tickerspring/research.js +1 -1
  286. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  287. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  288. package/build/dist/api/modules/uniswap/auction.js +1 -1
  289. package/build/dist/api/modules/uniswap/batch.js +1 -1
  290. package/build/dist/api/modules/uniswap/common.js +1 -1
  291. package/build/dist/api/modules/uniswap/fee-percent.d.ts +4 -0
  292. package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
  293. package/build/dist/api/modules/uniswap/fees.js +1 -1
  294. package/build/dist/api/modules/uniswap/index.js +1 -1
  295. package/build/dist/api/modules/uniswap/local-guard.d.ts +2 -0
  296. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  297. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  298. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  299. package/build/dist/api/modules/uniswap/pools.d.ts +2 -0
  300. package/build/dist/api/modules/uniswap/pools.js +1 -1
  301. package/build/dist/api/modules/uniswap/position.js +1 -1
  302. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  303. package/build/dist/api/modules/uniswap/quote-guard.d.ts +38 -0
  304. package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
  305. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  306. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  307. package/build/dist/api/modules/uniswap/trade.d.ts +10 -3
  308. package/build/dist/api/modules/uniswap/trade.js +1 -1
  309. package/build/dist/api/modules/uniswap/v2.js +1 -1
  310. package/build/dist/api/modules/uniswap/v3.js +1 -1
  311. package/build/dist/api/modules/uniswap/v4.d.ts +6 -0
  312. package/build/dist/api/modules/uniswap/v4.js +1 -1
  313. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  314. package/build/dist/api/modules/upoch/copy.d.ts +5 -0
  315. package/build/dist/api/modules/upoch/copy.js +1 -0
  316. package/build/dist/api/modules/upoch/index.d.ts +8 -0
  317. package/build/dist/api/modules/upoch/index.js +1 -0
  318. package/build/dist/api/modules/upoch/pins.d.ts +8 -0
  319. package/build/dist/api/modules/upoch/pins.js +1 -0
  320. package/build/dist/api/modules/upoch/reads.d.ts +509 -0
  321. package/build/dist/api/modules/upoch/reads.js +1 -0
  322. package/build/dist/api/modules/velora/claims.js +1 -1
  323. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  324. package/build/dist/api/modules/velora/index.js +1 -1
  325. package/build/dist/api/modules/wormhole/index.js +1 -1
  326. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  327. package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -1
  328. package/build/dist/api/modules/wormhole/third-party-text.d.ts +14 -3
  329. package/build/dist/api/modules/wormhole/third-party-text.js +1 -1
  330. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  331. package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
  332. package/build/dist/api/modules/wormhole/x402-client.js +1 -1
  333. package/build/dist/api/oak-fee.d.ts +12 -0
  334. package/build/dist/api/oak-fee.js +1 -0
  335. package/build/dist/api/param-text.d.ts +22 -0
  336. package/build/dist/api/param-text.js +1 -0
  337. package/build/dist/api/position-economics.d.ts +70 -0
  338. package/build/dist/api/position-economics.js +1 -0
  339. package/build/dist/api/positions.d.ts +8 -5
  340. package/build/dist/api/positions.js +1 -1
  341. package/build/dist/api/pricenote.js +1 -1
  342. package/build/dist/api/prices.d.ts +3 -0
  343. package/build/dist/api/prices.js +1 -1
  344. package/build/dist/api/pricing.js +1 -1
  345. package/build/dist/api/progress.d.ts +7 -0
  346. package/build/dist/api/progress.js +1 -0
  347. package/build/dist/api/read-budgets.d.ts +4 -0
  348. package/build/dist/api/read-budgets.js +1 -0
  349. package/build/dist/api/read-shape.d.ts +45 -0
  350. package/build/dist/api/read-shape.js +1 -0
  351. package/build/dist/api/revert.d.ts +23 -0
  352. package/build/dist/api/revert.js +1 -0
  353. package/build/dist/api/routes.js +1 -1
  354. package/build/dist/api/rpc.d.ts +1 -0
  355. package/build/dist/api/rpc.js +1 -1
  356. package/build/dist/api/secret-fields.d.ts +2 -0
  357. package/build/dist/api/secret-fields.js +1 -1
  358. package/build/dist/api/send.js +1 -1
  359. package/build/dist/api/signing-registry.d.ts +8 -0
  360. package/build/dist/api/signing-registry.js +1 -1
  361. package/build/dist/api/signing.js +1 -1
  362. package/build/dist/api/simulate.js +1 -1
  363. package/build/dist/api/swap.d.ts +4 -0
  364. package/build/dist/api/swap.js +1 -1
  365. package/build/dist/api/tokens.d.ts +1 -0
  366. package/build/dist/api/tokens.js +1 -1
  367. package/build/dist/api/tool-policy.d.ts +1 -0
  368. package/build/dist/api/tool-policy.js +1 -1
  369. package/build/dist/api/types.d.ts +3 -0
  370. package/build/dist/api/untrusted-unwrap.d.ts +1 -0
  371. package/build/dist/api/untrusted-unwrap.js +1 -0
  372. package/build/dist/api/usd-estimate.d.ts +23 -0
  373. package/build/dist/api/usd-estimate.js +1 -0
  374. package/build/dist/api/vendor-limits.js +1 -1
  375. package/build/dist/chunks/23HNDJ76.js +2 -0
  376. package/build/dist/chunks/24Q3FNGX.js +1 -0
  377. package/build/dist/chunks/25C4DTVA.js +1 -0
  378. package/build/dist/chunks/2GXHYI23.js +1 -0
  379. package/build/dist/chunks/2HN3U6OG.js +1 -0
  380. package/build/dist/chunks/{QU5XKRGK.js → 2OVJ2BTJ.js} +1 -1
  381. package/build/dist/chunks/{FUDAXV5X.js → 2QGLPY2D.js} +1 -1
  382. package/build/dist/chunks/2WRXH6BL.js +1 -0
  383. package/build/dist/chunks/2ZBSE2LD.js +2 -0
  384. package/build/dist/chunks/2ZQ7X223.js +1 -0
  385. package/build/dist/chunks/2ZWKIBJT.js +1 -0
  386. package/build/dist/chunks/3A2IKFTV.js +1 -0
  387. package/build/dist/chunks/3CH2IPQL.js +1 -0
  388. package/build/dist/chunks/3PU2SD3U.js +2 -0
  389. package/build/dist/chunks/{ER47KGRM.js → 3ZH5SOC2.js} +1 -1
  390. package/build/dist/chunks/4NBXBKOX.js +2 -0
  391. package/build/dist/chunks/{WV3A3OUU.js → 4PLLS6CT.js} +1 -1
  392. package/build/dist/chunks/4R3G3H42.js +1 -0
  393. package/build/dist/chunks/4TTDAF4B.js +1 -0
  394. package/build/dist/chunks/4Z3IGMU6.js +1 -0
  395. package/build/dist/chunks/5DPJQCKJ.js +68 -0
  396. package/build/dist/chunks/{SJJR4ZBZ.js → 5GQJVKVY.js} +1 -1
  397. package/build/dist/chunks/5R576SDB.js +1 -0
  398. package/build/dist/chunks/5RXALTDT.js +1 -0
  399. package/build/dist/chunks/5TUXSOMI.js +1 -0
  400. package/build/dist/chunks/5UAXLWJ2.js +1 -0
  401. package/build/dist/chunks/{QQECG3WP.js → 5W74Z4WZ.js} +1 -1
  402. package/build/dist/chunks/5XAXJEWM.js +5 -0
  403. package/build/dist/chunks/65356YKW.js +1 -0
  404. package/build/dist/chunks/65OITTDL.js +1 -0
  405. package/build/dist/chunks/6F527FLN.js +1 -0
  406. package/build/dist/chunks/6MDYKE2O.js +1 -0
  407. package/build/dist/chunks/6OCLWSMZ.js +1 -0
  408. package/build/dist/chunks/75SULXNT.js +1 -0
  409. package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
  410. package/build/dist/chunks/7U62MMUQ.js +1 -0
  411. package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
  412. package/build/dist/chunks/A2V4NFVA.js +1 -0
  413. package/build/dist/chunks/A3BJSQ23.js +1 -0
  414. package/build/dist/chunks/ACH4BSME.js +3 -0
  415. package/build/dist/chunks/ADIPEGNN.js +1 -0
  416. package/build/dist/chunks/AHUCYDBC.js +1 -0
  417. package/build/dist/chunks/ANIF3JMV.js +4 -0
  418. package/build/dist/chunks/{ALLLYOUG.js → ATEVAJ5Y.js} +1 -1
  419. package/build/dist/chunks/B2HSLY5F.js +1 -0
  420. package/build/dist/chunks/{WTXC3XKW.js → B7BNDW35.js} +1 -1
  421. package/build/dist/chunks/BE3A7677.js +1 -0
  422. package/build/dist/chunks/{PAY5PD4H.js → BX46C5ZP.js} +1 -1
  423. package/build/dist/chunks/C3WBHFLX.js +1 -0
  424. package/build/dist/chunks/C6VJAL5B.js +1 -0
  425. package/build/dist/chunks/C76D54YG.js +1 -0
  426. package/build/dist/chunks/CD2JQ32C.js +1 -0
  427. package/build/dist/chunks/CI5ENLYA.js +1 -0
  428. package/build/dist/chunks/CNLL4NCR.js +1 -0
  429. package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
  430. package/build/dist/chunks/CSOO4SW7.js +1 -0
  431. package/build/dist/chunks/CZL6T2ZQ.js +1 -0
  432. package/build/dist/chunks/CZQ2CGYV.js +1 -0
  433. package/build/dist/chunks/D2IYA4LP.js +1 -0
  434. package/build/dist/chunks/D7QXZM3S.js +1 -0
  435. package/build/dist/chunks/{GNC6RXLT.js → DBOGRUPS.js} +1 -1
  436. package/build/dist/chunks/DGCJZ3HO.js +1 -0
  437. package/build/dist/chunks/DGDMRATN.js +1 -0
  438. package/build/dist/chunks/DMB64UIN.js +1 -0
  439. package/build/dist/chunks/DMDOSHV7.js +1 -0
  440. package/build/dist/chunks/DRLBTB4E.js +1 -0
  441. package/build/dist/chunks/E76Z2TT4.js +1 -0
  442. package/build/dist/chunks/EFESPGA2.js +1 -0
  443. package/build/dist/chunks/EHK7CDTU.js +1 -0
  444. package/build/dist/chunks/ELHRXA5U.js +1 -0
  445. package/build/dist/chunks/F7MGYRPU.js +1 -0
  446. package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
  447. package/build/dist/chunks/{QBIY6FQN.js → FGEGJOAA.js} +1 -1
  448. package/build/dist/chunks/FHTNMGFR.js +1 -0
  449. package/build/dist/chunks/FN6GNTPR.js +1 -0
  450. package/build/dist/chunks/{EGYVRQUR.js → FTMA24EC.js} +1 -1
  451. package/build/dist/chunks/FXOFR432.js +1 -0
  452. package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
  453. package/build/dist/chunks/G2LAO23N.js +1 -0
  454. package/build/dist/chunks/{WIRBCS4W.js → GBIBRYOV.js} +1 -1
  455. package/build/dist/chunks/GDOHHXNH.js +1 -0
  456. package/build/dist/chunks/{GSBIERZD.js → GP6YO24Z.js} +1 -1
  457. package/build/dist/chunks/GQ3XZFRL.js +1 -0
  458. package/build/dist/chunks/{4HG6FRVH.js → GQITAJVF.js} +1 -1
  459. package/build/dist/chunks/H3E7UD2X.js +1 -0
  460. package/build/dist/chunks/HFVXNKA5.js +1 -0
  461. package/build/dist/chunks/HHYE42JG.js +21 -0
  462. package/build/dist/chunks/HRAHGYNK.js +1 -0
  463. package/build/dist/chunks/HS5HWBMU.js +1 -0
  464. package/build/dist/chunks/{BND2UFVW.js → HVFMIURK.js} +1 -1
  465. package/build/dist/chunks/IBL6TL2Q.js +1 -0
  466. package/build/dist/chunks/IT2JLILU.js +1 -0
  467. package/build/dist/chunks/IV4K7FMD.js +1 -0
  468. package/build/dist/chunks/{PNA6UIE5.js → JDSSYT6R.js} +1 -1
  469. package/build/dist/chunks/JFWJBZ7M.js +1 -0
  470. package/build/dist/chunks/JI5DXDMY.js +1 -0
  471. package/build/dist/chunks/JJGZ7W3V.js +1 -0
  472. package/build/dist/chunks/JPPQDELB.js +18 -0
  473. package/build/dist/chunks/{OLSP46ZD.js → K4P5VYDP.js} +1 -1
  474. package/build/dist/chunks/{JFYBH3DX.js → K6D6SDIG.js} +1 -1
  475. package/build/dist/chunks/K7HTDKAT.js +1 -0
  476. package/build/dist/chunks/KBU3PYP7.js +1 -0
  477. package/build/dist/chunks/KH4QFN72.js +3 -0
  478. package/build/dist/chunks/KMSAUFYV.js +1 -0
  479. package/build/dist/chunks/{RTAHNWHN.js → KOTGFD2V.js} +1 -1
  480. package/build/dist/chunks/KZA5GYZR.js +1 -0
  481. package/build/dist/chunks/LCH6F5HT.js +1 -0
  482. package/build/dist/chunks/LDJI2JAL.js +1 -0
  483. package/build/dist/chunks/LEV5SNNC.js +3 -0
  484. package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
  485. package/build/dist/chunks/{PIIHOXWF.js → LJJYYUEG.js} +1 -1
  486. package/build/dist/chunks/LKX5WDOQ.js +1 -0
  487. package/build/dist/chunks/LVFI74ST.js +1 -0
  488. package/build/dist/chunks/M7BUKZW2.js +1 -0
  489. package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
  490. package/build/dist/chunks/MMCM3GSM.js +1 -0
  491. package/build/dist/chunks/MQ5F2VOK.js +1 -0
  492. package/build/dist/chunks/MSMHS456.js +1 -0
  493. package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
  494. package/build/dist/chunks/{XSKFKBDR.js → N64JJN37.js} +1 -1
  495. package/build/dist/chunks/NAO7VWZF.js +1 -0
  496. package/build/dist/chunks/ND32LJWI.js +1 -0
  497. package/build/dist/chunks/{Q42YI3EP.js → NMJVQX5M.js} +1 -1
  498. package/build/dist/chunks/NMQBOBWJ.js +1 -0
  499. package/build/dist/chunks/NQ4MTIU3.js +1 -0
  500. package/build/dist/chunks/NWPAQER2.js +1 -0
  501. package/build/dist/chunks/O2J5I4VA.js +1 -0
  502. package/build/dist/chunks/O4S6XAYV.js +1 -0
  503. package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
  504. package/build/dist/chunks/{RUC7KH7A.js → OB7BFDOV.js} +1 -1
  505. package/build/dist/chunks/OEZ7FCLF.js +1 -0
  506. package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
  507. package/build/dist/chunks/{WP6RHXGN.js → OIQTZOBN.js} +1 -1
  508. package/build/dist/chunks/OODSXDIH.js +1 -0
  509. package/build/dist/chunks/OOPMZIG7.js +1 -0
  510. package/build/dist/chunks/OQFNUDMQ.js +1 -0
  511. package/build/dist/chunks/ORG6LVKJ.js +1 -0
  512. package/build/dist/chunks/{CBLMQ5UU.js → OSMOBKRQ.js} +1 -1
  513. package/build/dist/chunks/OTLUQWLF.js +1 -0
  514. package/build/dist/chunks/{2MT3G7YZ.js → OTYB6BHK.js} +1 -1
  515. package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
  516. package/build/dist/chunks/{SMYWWIE6.js → OVM4QIET.js} +1 -1
  517. package/build/dist/chunks/OYDKAIS2.js +1 -0
  518. package/build/dist/chunks/P6OB2AFW.js +1 -0
  519. package/build/dist/chunks/PDPTJMTJ.js +1 -0
  520. package/build/dist/chunks/PEHXHQVA.js +1 -0
  521. package/build/dist/chunks/PMFR47H3.js +1 -0
  522. package/build/dist/chunks/PQXYTOV5.js +1 -0
  523. package/build/dist/chunks/PSGRZWES.js +1 -0
  524. package/build/dist/chunks/PZEF5LBL.js +2 -0
  525. package/build/dist/chunks/Q7L3BX6U.js +1 -0
  526. package/build/dist/chunks/QBYV7NXH.js +1 -0
  527. package/build/dist/chunks/QIB6OMQV.js +1 -0
  528. package/build/dist/chunks/QLAOBULN.js +1 -0
  529. package/build/dist/chunks/QLFPAN6S.js +1 -0
  530. package/build/dist/chunks/QMEGAKLI.js +1 -0
  531. package/build/dist/chunks/QMNUB2GM.js +2 -0
  532. package/build/dist/chunks/QMZEGT5B.js +1 -0
  533. package/build/dist/chunks/R73R4KN3.js +1 -0
  534. package/build/dist/chunks/RN3WUJIO.js +1 -0
  535. package/build/dist/chunks/RNCMXKKS.js +1 -0
  536. package/build/dist/chunks/ROQQ62LP.js +1 -0
  537. package/build/dist/chunks/RUTSEGGD.js +1 -0
  538. package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
  539. package/build/dist/chunks/{2VXLVXIB.js → S4UJDZGN.js} +1 -1
  540. package/build/dist/chunks/SCG5HWMN.js +1 -0
  541. package/build/dist/chunks/{XQA5LCL6.js → SENOU5JR.js} +1 -1
  542. package/build/dist/chunks/SMSXZ3FN.js +1 -0
  543. package/build/dist/chunks/SUNTJ6IU.js +1 -0
  544. package/build/dist/chunks/SZ466I5X.js +1 -0
  545. package/build/dist/chunks/TGFQQCRY.js +1 -0
  546. package/build/dist/chunks/{K4DHHQBI.js → THL4TMQW.js} +2 -2
  547. package/build/dist/chunks/TI727O2H.js +1 -0
  548. package/build/dist/chunks/{UD2XMNIT.js → TMRAF2L2.js} +1 -1
  549. package/build/dist/chunks/TNJTET4G.js +1 -0
  550. package/build/dist/chunks/TVIMP5CK.js +1 -0
  551. package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
  552. package/build/dist/chunks/U243AWCH.js +1 -0
  553. package/build/dist/chunks/U762746N.js +1 -0
  554. package/build/dist/chunks/U7UPLF4F.js +1 -0
  555. package/build/dist/chunks/{7QIO77VE.js → UPKVD7WG.js} +1 -1
  556. package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
  557. package/build/dist/chunks/USEF3QKG.js +1 -0
  558. package/build/dist/chunks/UVAR6BHU.js +1 -0
  559. package/build/dist/chunks/V5YSJKRH.js +70 -0
  560. package/build/dist/chunks/VB36EHIR.js +1 -0
  561. package/build/dist/chunks/VMZYFO6I.js +1 -0
  562. package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
  563. package/build/dist/chunks/{U4JGEMKT.js → VVAM3EAK.js} +1 -1
  564. package/build/dist/chunks/VVJO6OYK.js +1 -0
  565. package/build/dist/chunks/VVWFB53Q.js +1 -0
  566. package/build/dist/chunks/VXCGMALF.js +1 -0
  567. package/build/dist/chunks/VZVW5J7J.js +1 -0
  568. package/build/dist/chunks/W32UECOL.js +1 -0
  569. package/build/dist/chunks/{XD6X3KTC.js → W4RYRLL5.js} +1 -1
  570. package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
  571. package/build/dist/chunks/WBNFRPAT.js +1 -0
  572. package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
  573. package/build/dist/chunks/{4DP2VPXR.js → WOGWLFAL.js} +1 -1
  574. package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
  575. package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
  576. package/build/dist/chunks/X24YTJST.js +1 -0
  577. package/build/dist/chunks/{IPN6Z4JM.js → X5AL3DUK.js} +1 -1
  578. package/build/dist/chunks/XBNZ7GTY.js +1 -0
  579. package/build/dist/chunks/{XL3LLGIR.js → XEBMS5KU.js} +1 -1
  580. package/build/dist/chunks/XEPCDGN2.js +1 -0
  581. package/build/dist/chunks/{KIFZ5ZSK.js → XL3W7DAQ.js} +1 -1
  582. package/build/dist/chunks/{DL6AEWEM.js → XPWGPZ2C.js} +1 -1
  583. package/build/dist/chunks/{T7TFUH5K.js → XRDLMTBJ.js} +1 -1
  584. package/build/dist/chunks/XTFRPI4G.js +1 -0
  585. package/build/dist/chunks/XV3YJ4P6.js +1 -0
  586. package/build/dist/chunks/XW3VGWXK.js +1 -0
  587. package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
  588. package/build/dist/chunks/Y64GFBTA.js +1 -0
  589. package/build/dist/chunks/YARZE7SJ.js +1 -0
  590. package/build/dist/chunks/YBLJ75U5.js +1 -0
  591. package/build/dist/chunks/YEIM6BZQ.js +1 -0
  592. package/build/dist/chunks/YRSAZTTC.js +7 -0
  593. package/build/dist/chunks/YXXK6EPI.js +1 -0
  594. package/build/dist/chunks/Z3IBPCY4.js +2 -0
  595. package/build/dist/chunks/{QHBS3PVU.js → Z7FGEWO2.js} +1 -1
  596. package/build/dist/chunks/ZNPVBNC5.js +1 -0
  597. package/build/dist/chunks/ZQ6AF3VX.js +1 -0
  598. package/build/dist/chunks/ZTKT3ZQK.js +1 -0
  599. package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
  600. package/package.json +1 -1
  601. package/build/dist/chunks/2THSW4QN.js +0 -1
  602. package/build/dist/chunks/2TK3ETUO.js +0 -1
  603. package/build/dist/chunks/35KR3VSS.js +0 -1
  604. package/build/dist/chunks/3GQ7A3VB.js +0 -1
  605. package/build/dist/chunks/3XNZUIRU.js +0 -1
  606. package/build/dist/chunks/46547QT3.js +0 -1
  607. package/build/dist/chunks/4EN6MQEI.js +0 -1
  608. package/build/dist/chunks/4I3OU56B.js +0 -1
  609. package/build/dist/chunks/52ELWNXJ.js +0 -2
  610. package/build/dist/chunks/5AXWBSPG.js +0 -1
  611. package/build/dist/chunks/5N3O42X6.js +0 -1
  612. package/build/dist/chunks/5SMVQCAP.js +0 -1
  613. package/build/dist/chunks/5SZPNZG4.js +0 -1
  614. package/build/dist/chunks/64GOINYS.js +0 -1
  615. package/build/dist/chunks/6I4NTKB2.js +0 -1
  616. package/build/dist/chunks/6JAXZNZ3.js +0 -1
  617. package/build/dist/chunks/6O3Q5B6M.js +0 -1
  618. package/build/dist/chunks/6OGDTEGH.js +0 -1
  619. package/build/dist/chunks/6WZX7C4T.js +0 -2
  620. package/build/dist/chunks/6YB3VOUL.js +0 -1
  621. package/build/dist/chunks/7GJ6SLEV.js +0 -1
  622. package/build/dist/chunks/7KWZ5QJU.js +0 -1
  623. package/build/dist/chunks/7QZOTRSA.js +0 -2
  624. package/build/dist/chunks/7WSHW7KW.js +0 -1
  625. package/build/dist/chunks/A7I4IWUB.js +0 -1
  626. package/build/dist/chunks/ABPL3ZZI.js +0 -1
  627. package/build/dist/chunks/ACW63WIL.js +0 -20
  628. package/build/dist/chunks/AEL62KCG.js +0 -1
  629. package/build/dist/chunks/AKYF5264.js +0 -7
  630. package/build/dist/chunks/AW7AXQCZ.js +0 -1
  631. package/build/dist/chunks/AXRL3REN.js +0 -1
  632. package/build/dist/chunks/BBTPRZ6T.js +0 -1
  633. package/build/dist/chunks/BOVMED7R.js +0 -1
  634. package/build/dist/chunks/BTPXJAUX.js +0 -1
  635. package/build/dist/chunks/C7AXJHBT.js +0 -1
  636. package/build/dist/chunks/CBG5HARQ.js +0 -2
  637. package/build/dist/chunks/CDPSMI3Z.js +0 -1
  638. package/build/dist/chunks/CHXBOXOD.js +0 -1
  639. package/build/dist/chunks/CQEJSCFQ.js +0 -1
  640. package/build/dist/chunks/DBNTZEAJ.js +0 -1
  641. package/build/dist/chunks/DHUDSOGR.js +0 -18
  642. package/build/dist/chunks/DJN3JAWB.js +0 -1
  643. package/build/dist/chunks/E3RACZUY.js +0 -1
  644. package/build/dist/chunks/FEYAY6OZ.js +0 -1
  645. package/build/dist/chunks/FJ4S4GHY.js +0 -1
  646. package/build/dist/chunks/FWD4L3CJ.js +0 -1
  647. package/build/dist/chunks/GG6Y4OCJ.js +0 -1
  648. package/build/dist/chunks/GGHBFLRC.js +0 -1
  649. package/build/dist/chunks/GGSAKCND.js +0 -1
  650. package/build/dist/chunks/GRQYTVNT.js +0 -1
  651. package/build/dist/chunks/H6T5FXEX.js +0 -1
  652. package/build/dist/chunks/HHXBUYHO.js +0 -1
  653. package/build/dist/chunks/HKEMQBFA.js +0 -1
  654. package/build/dist/chunks/HQUVB7Z5.js +0 -3
  655. package/build/dist/chunks/HU7IMNBI.js +0 -1
  656. package/build/dist/chunks/HWX36XJI.js +0 -1
  657. package/build/dist/chunks/I26DMNJG.js +0 -1
  658. package/build/dist/chunks/I55MURSJ.js +0 -1
  659. package/build/dist/chunks/IMO3GDA5.js +0 -1
  660. package/build/dist/chunks/IPRVIKYC.js +0 -1
  661. package/build/dist/chunks/IVX4R5OL.js +0 -1
  662. package/build/dist/chunks/JQOQMFWD.js +0 -3
  663. package/build/dist/chunks/JUZ5JU6D.js +0 -70
  664. package/build/dist/chunks/JZS3E66E.js +0 -1
  665. package/build/dist/chunks/K3RDPI5J.js +0 -1
  666. package/build/dist/chunks/KBKK7UNY.js +0 -1
  667. package/build/dist/chunks/KVFZKPJT.js +0 -1
  668. package/build/dist/chunks/L5BLHY34.js +0 -1
  669. package/build/dist/chunks/LKXO2BQS.js +0 -1
  670. package/build/dist/chunks/LKZX4CAA.js +0 -1
  671. package/build/dist/chunks/LYMNHO5T.js +0 -1
  672. package/build/dist/chunks/M2UXYCKH.js +0 -1
  673. package/build/dist/chunks/M37654RL.js +0 -1
  674. package/build/dist/chunks/M6LC6DRE.js +0 -1
  675. package/build/dist/chunks/MOE3EVAL.js +0 -1
  676. package/build/dist/chunks/N4Q6GN65.js +0 -1
  677. package/build/dist/chunks/NAZPDRIF.js +0 -1
  678. package/build/dist/chunks/NKX3FE34.js +0 -1
  679. package/build/dist/chunks/NKZKKCK2.js +0 -1
  680. package/build/dist/chunks/NOFUKKP5.js +0 -1
  681. package/build/dist/chunks/O6ROOKY2.js +0 -1
  682. package/build/dist/chunks/OJ4WJUPP.js +0 -1
  683. package/build/dist/chunks/OOZSE2R7.js +0 -1
  684. package/build/dist/chunks/OTXSKFUD.js +0 -1
  685. package/build/dist/chunks/P5AJSLZ7.js +0 -1
  686. package/build/dist/chunks/PACN53TR.js +0 -1
  687. package/build/dist/chunks/PAHXBLCS.js +0 -1
  688. package/build/dist/chunks/PK66GCDT.js +0 -1
  689. package/build/dist/chunks/PSBQWDYI.js +0 -1
  690. package/build/dist/chunks/PXT5YTWU.js +0 -1
  691. package/build/dist/chunks/PZGGE5D3.js +0 -1
  692. package/build/dist/chunks/QA2RRIES.js +0 -1
  693. package/build/dist/chunks/QA3UHEO3.js +0 -1
  694. package/build/dist/chunks/QFNT73OF.js +0 -1
  695. package/build/dist/chunks/QW2OPEYJ.js +0 -1
  696. package/build/dist/chunks/QYVREJYC.js +0 -1
  697. package/build/dist/chunks/ROFPXEQ5.js +0 -2
  698. package/build/dist/chunks/RTGS7RIO.js +0 -1
  699. package/build/dist/chunks/RUX3RY7Y.js +0 -1
  700. package/build/dist/chunks/RVDUSNWW.js +0 -1
  701. package/build/dist/chunks/S5CBVFHY.js +0 -1
  702. package/build/dist/chunks/SIYUNOLI.js +0 -1
  703. package/build/dist/chunks/TEJ7W534.js +0 -1
  704. package/build/dist/chunks/TPBAFS7K.js +0 -1
  705. package/build/dist/chunks/TVWMTMEF.js +0 -1
  706. package/build/dist/chunks/U2RMUVVY.js +0 -1
  707. package/build/dist/chunks/U5PMVP56.js +0 -1
  708. package/build/dist/chunks/V5JWGWXC.js +0 -1
  709. package/build/dist/chunks/VCOTCVKN.js +0 -1
  710. package/build/dist/chunks/VEQBHI6O.js +0 -1
  711. package/build/dist/chunks/VNV6ZISN.js +0 -1
  712. package/build/dist/chunks/VYAJXLND.js +0 -1
  713. package/build/dist/chunks/WCNHZYQQ.js +0 -1
  714. package/build/dist/chunks/WLMWWEP7.js +0 -2
  715. package/build/dist/chunks/X2P55AC3.js +0 -1
  716. package/build/dist/chunks/XBE3B6Y2.js +0 -1
  717. package/build/dist/chunks/XKSVTN5X.js +0 -1
  718. package/build/dist/chunks/XSRIJUFU.js +0 -1
  719. package/build/dist/chunks/YCZPSMZ5.js +0 -1
  720. package/build/dist/chunks/YDNTY67T.js +0 -1
  721. package/build/dist/chunks/YN56C7PN.js +0 -1
  722. package/build/dist/chunks/YRNXGQJC.js +0 -1
  723. package/build/dist/chunks/YWRLY5EA.js +0 -1
  724. package/build/dist/chunks/YWSX6IE6.js +0 -1
  725. package/build/dist/chunks/YXTSWRV5.js +0 -1
  726. package/build/dist/chunks/Z6LZGCVW.js +0 -1
  727. package/build/dist/chunks/ZQWZGH7V.js +0 -1
  728. package/build/dist/chunks/ZSN4IRI5.js +0 -1
  729. package/build/dist/chunks/ZV5HIQXC.js +0 -1
  730. package/build/dist/chunks/ZXJ24B4L.js +0 -1
@@ -0,0 +1 @@
1
+ import{d as ee}from"./NAO7VWZF.js";import{e as ie}from"./M7BUKZW2.js";import{a as ne,h as se,k as re}from"./5W74Z4WZ.js";import{a as ae,b as D,c as F}from"./4PLLS6CT.js";import{e as te}from"./PDPTJMTJ.js";import{b as Z}from"./SPJCSEKP.js";import{a as $}from"./43LI5NKJ.js";import{c as B}from"./SCG5HWMN.js";import{b as X}from"./66F5ZH34.js";import{c as A,d as z,e as b,g as N,j as J,m as Q,n as K}from"./NWNYJ26T.js";import{b as l,j as O}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=O[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function R(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function U(a){return N(a,V.address)}function P(a){return ne.some(f=>N(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(s){try{return await s()}catch(i){throw new u(a.plainError(i))}}function S(s,i){if(s.chainId!==void 0&&s.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(s))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let s=await B(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return s.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return B(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(s,i){let d=s[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let s=a.clientFor(l);if(await s.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await s.getBlockNumber()),d=(t,r)=>s.readContract({address:t,abi:q,functionName:r,blockNumber:i}),e=async(t,r)=>T(await s.readContract({address:t,abi:M,functionName:"balanceOf",args:[r],blockNumber:i}));async function n(t){let[r,p]=await Promise.all([s.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),s.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof r!="string"||!r.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:r,decimals:ue(p)}}async function o(t){let r=t.earnContractAddress,p=v(await d(r,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(r),d(r,"strategy"),d(r,"balance"),d(r,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let _=v(m),x=await d(_,"paused");if(typeof x!="boolean")throw new u("The strategy returned an invalid pause flag.");let G=T(w);if(G===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:_,paused:x,managed:T(c),pricePerFullShare:G}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function Y(s){let i=v(s.vault),d=D(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function W(s,i,d,e){let n=j(await H(),e),o=await a.preview(s,i),t=o.changes.map(r=>{let p=r.amount.startsWith("-"),h=p?r.amount.slice(1):r.amount;return`${p?"-":"+"}${a.formatAmount(h,r.token.decimals)} ${g(r.token.symbol)} (${r.token.address}, chain ${r.token.chainId})`}).join("; ");return{txs:s,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let r=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await se(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:r.want,shares:r.shares,vaultTotalWant:{token:r.want,amount:r.managed.toString()},pricePerFullShare:{token:r.want,amount:r.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:r.paused,source:"strategy.paused()",address:r.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:U(t.earnContractAddress),qualification:U(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:D(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!r.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"],description:"Price-history window as candle size_range: 1h_1d = hourly over 1 day, 1h_1w = 1 week, 1h_1M = 1 month, 1d_1M = daily over 1 month (default), 1d_1Y = 1 year, 1d_all = all time."}},required:["vault"],additionalProperties:!1},execute:s=>f(async()=>{S(s,["vault","historyBucket"]);let i=s.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(s.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await B(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},_=>_!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,r,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...r,currency:"USD"},history:p,forkQualified:U(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},token:{...A,description:"Address of the vault's want (LP or CLM share) token being deposited; must equal the vault's want token."},amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Maximum slippage in basis points (50 = 0.5%) used to set the minimum shares if minSharesOut is omitted. Default 50."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","token","amount"],additionalProperties:!1},execute:(s,i)=>f(async()=>{if(S(s,["vault","token","amount","minSharesOut","slippageBps"]),$(i),s.slippageBps!==void 0&&(!Number.isInteger(s.slippageBps)||Number(s.slippageBps)<0||Number(s.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");s.minSharesOut!==void 0&&R(s.minSharesOut);let d=R(s.amount),e=v(s.token),n=await Y(s),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let r=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await W(r,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=s.minSharesOut===void 0?h*BigInt(1e4-Number(s.slippageBps??50))/10000n:R(s.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:O[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},shares:{description:'Vault shares (moo tokens) to redeem for want, in base units of the share token (read its decimals). "all" redeems your full share balance.',anyOf:[E,{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","shares"],additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,["vault","shares"]),$(i);let d=s.shares==="all"?void 0:R(s.shares),e=await Y(s),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let r=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return W(r,i,"Withdraw from",e)})}],positions:s=>f(async()=>{$(s);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,s),t===0n)continue;let r=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:r.want,amount:(t*r.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),r.shares.decimals)} ${g(r.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${r.paused}. ${U(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(r){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(r)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),re(a),ee(a),te(a)])}export{he as a,Te as b};
@@ -0,0 +1 @@
1
+ import{c as me}from"./KH4QFN72.js";import{a as fe}from"./PQXYTOV5.js";import{a as Z}from"./2HN3U6OG.js";import{a as M,b as P}from"./Z7FGEWO2.js";import{a as L}from"./VVAM3EAK.js";import{a as ue}from"./P4UQGWCP.js";import{a as x}from"./43LI5NKJ.js";import{b as de,c as le}from"./SCG5HWMN.js";import{a as re,b as X,c as j}from"./5HCXZWUH.js";import{q as ie,s as F,t as ce}from"./MQ5F2VOK.js";import{b as w,c as _,d as B,e as oe,j as E,k as ae,t as N}from"./TI727O2H.js";import{a as k}from"./XSD5NL7J.js";import{a as p,b as V,c as se}from"./JXOEJPJ4.js";import{decodeFunctionResult as De,encodeFunctionData as ve,erc20Abi as Y,getAddress as b,isAddress as G,parseAbi as ne}from"viem";var z="https://api.robinhood.com/rhj/assets",Pe={address:M,symbol:"ETH",decimals:18,chainId:w},Q={address:b(ae),symbol:"USDG",decimals:oe,chainId:w},J={address:b(E[4663].tokens.WETH.address),symbol:"WETH",decimals:18,chainId:w},we={address:b(E[4663].meridian.CollateralToken_USDe.address),symbol:"USDe",decimals:18,chainId:w};function K(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function $(e,n=w,s={}){let t=Array.isArray(e)?e:K(e)&&Array.isArray(e.assets)?e.assets:void 0;if(!t)throw new k("Official stock asset list response is malformed.");let a=new Map,d=new Map;if(t.length>1e4)throw new k("Official stock asset list exceeds the lookup limit.");for(let o of t){if(!K(o))continue;let r=o;if(typeof r.tokenSymbol!="string"||!r.tokenSymbol.trim()||!Array.isArray(r.deployments))continue;if(r.deployments.length>100)throw new k("Official stock deployment list exceeds the lookup limit.");let l=r.tokenSymbol;if(!/^[A-Za-z0-9.$_-]{1,32}$/.test(l))throw new k(`Invalid official stock ticker ${p(l)}.`);if(r.tokenDecimals!==void 0&&(typeof r.tokenDecimals!="number"||!Number.isInteger(r.tokenDecimals)||r.tokenDecimals<0||r.tokenDecimals>255))throw new k("Official stock asset has invalid token decimals.");let u=typeof r.tokenDecimals=="number"&&Number.isInteger(r.tokenDecimals)&&r.tokenDecimals>=0&&r.tokenDecimals<=255?r.tokenDecimals:18;for(let m of r.deployments){if(!K(m))continue;let h=m;if(h.chainId!==n)continue;if(typeof h.contractAddress!="string"||!G(h.contractAddress,{strict:!1}))throw new k("Official stock deployment has an invalid contract address.");let y=b(h.contractAddress),f=y.toLowerCase(),g=l.toUpperCase(),i=d.get(g);if(!s.allowAmbiguousSymbols&&i&&i!==f)throw new k(`Ambiguous official stock ticker ${p(l)} across multiple addresses.`);let c=a.get(f);if(c&&(c.symbol!==l||c.decimals!==u))throw new k(`Conflicting official stock identity at ${y}.`);d.set(g,f),a.set(f,{address:y,symbol:l,decimals:u,chainId:n,...s.includeNames&&typeof r.tokenName=="string"&&r.tokenName.trim()?{name:r.tokenName.trim()}:{}})}}return[...a.values()]}function Ee(e,n){if(typeof e.address!="string"||!G(e.address,{strict:!1}))return!1;let s=e.chainId??w,t=e.address.toLowerCase();return n.some(a=>a.chainId===s&&a.address.toLowerCase()===t&&a.symbol===e.symbol)}function W(e,n){x(e.address);let s=e.chainId??w,t=b(e.address),a=t.toLowerCase(),d=O(e.symbol),o=n.find(l=>l.chainId===s&&l.address.toLowerCase()===a),r=n.find(l=>l.chainId===s&&O(l.symbol)===d);if(o){if(e.symbol!==o.symbol)throw new k(`Token at ${t} does not match official stock ticker ${p(o.symbol)} (received ${p(e.symbol)}).`);if(e.decimals!==void 0&&e.decimals!==o.decimals)throw new k(`Token ${p(o.symbol)} at ${t} does not match official decimals ${o.decimals}.`);return o}if(r)throw new k(`Token symbol ${p(e.symbol)} at ${t} does not match the official stock contract address ${r.address}.`);return{address:t,symbol:e.symbol.trim(),decimals:e.decimals??18,chainId:s}}var xe=["AAOI","AAPL","ABCL","ADBE","AEHR","AEIS","ALAB","AMAT","AMBA","AMC","AMD","AMKR","AMZN","ANET","APLD","APP","ASML","ASTS","AUR","AVAV","AVGO","AXON","AXTI","BA","BABA","BB","BE","BMNR","BND","BULL","CBRS","CCL","CEG","CELH","CIEN","CLOV","CLS","CLSK","COHR","COIN","COST","CRCL","CRDO","CRM","CRWD","CRWV","CSCO","CTSH","CVNA","DDOG","DELL","DIS","DJT","DOCN","ELF","EWT","EWY","F","FICO","FIG","FISV","FIX","FLNC","FLY","FTNT","FUTU","GDX","GE","GEV","GLD","GLW","GLXY","GME","GOOGL","HII","HIMS","HPE","HWM","IBM","IBRX","INDA","INFQ","INOD","INTC","INTU","IONQ","IREN","JBL","JNJ","JOBY","JPM","KLAC","KSS","KTOS","LHX","LITE","LLY","LMT","LRCX","LULU","LUNR","MCD","MDB","META","MOD","MPWR","MRNA","MRVL","MSFT","MSTR","MTSI","MU","MXL","NAVN","NBIS","NET","NFLX","NNE","NOW","NU","NVDA","NVTS","OKLO","ON","ONTO","ORCL","OUST","P","PANW","PATH","PENG","PFE","PL","PLTR","POET","POWL","PR","PWR","PYPL","QBTS","QCOM","QQQ","QUBT","RBLX","RCAT","RDDT","RDW","RGTI","RIVN","RKLB","RUN","SATS","SCHD","SGOV","SHOP","SHY","SIMO","SKHY","SLS","SLV","SMCI","SMH","SMR","SNAP","SNDK","SNOW","SOFI","SOUN","SOXX","SPCX","SPMO","SPY","TE","TEAM","TEM","TER","TSEM","TSLA","TSM","TTD","TTWO","UBER","UMC","UNH","UPS","USAR","USO","V","VICR","VRT","VSAT","VST","VTI","WDAY","WDC","WULF","WYFI","XLK","XNDU","XOM","ZETA","ZM","ZS"],q=new WeakMap,ke=new WeakMap,ge=3e4,he=Object.freeze([]),D;function tt(){if(!D)return he;let e=Date.now()-D.started;return e>=0&&e<ge?D.tokens:he}var ee=new WeakMap;function H(e,n){return(ee.get(e)??F)(n)}async function Ae(e){let n=e?.http??de(),s=e?.url??z,t=e?.chainId??w,a=j(n),d=ke.get(a);d||(d=new re(ge),ke.set(a,d));let{value:o,started:r}=await H(n,()=>d.read(`${t}:${s}`,async()=>{let u=await F(h=>le(a,s,{method:"GET",signal:h},y=>K(y)||Array.isArray(y))),m=$(u,t,{allowAmbiguousSymbols:!0});if(t===w&&m.length===0)throw new k("Official stock asset list has no mainnet deployments; retry when the list is available.");return u})),l=$(o,t,e);if(t===w&&s===z&&(!D||r>=D.started||Date.now()<D.started)&&(D={started:r,tokens:Object.freeze($(o,t,{allowAmbiguousSymbols:!0}).map(u=>Object.freeze(u)))}),t===w){let u=q.get(a);u||(u=new Set,q.set(a,u));for(let m of l)u.add(O(m.symbol))}return l}var Me=ne(["function aggregate3((address target, bool allowFailure, bytes callData)[] calls) payable returns ((bool success, bytes returnData)[] returnData)"]);function ye(e){let n=e,s=new Set;for(;n&&typeof n=="object"&&!s.has(n)&&s.size<10;){s.add(n);let t=n;if(t.name==="ContractFunctionZeroDataError"||t.name==="AbiDecodingZeroDataError")return!0;let a=`${typeof t.shortMessage=="string"?t.shortMessage:""} ${typeof t.message=="string"?t.message:""}`;if(/returned no data \("0x"\)|Cannot decode zero data/i.test(a))return!0;n=t.cause}return!1}function Re(e){return e instanceof k?/RPC endpoint|too many requests|malformed JSON/i.test(e.message):e instanceof Error?/fetch failed|network|ECONNREFUSED|ETIMEDOUT|HTTP \d{3}|rate limit|too many requests/i.test(e.message):!1}async function Ue(e,n,s){if(typeof e.getCode=="function")try{let t=await e.getCode({address:n});return!t||t==="0x"}catch{return ye(s)}return ye(s)}async function Te(e,n,s){if(n.length===0)return[];let t=await Promise.allSettled(n.map(a=>e.readContract({address:a.address,abi:Y,functionName:"balanceOf",args:[s]})));if(t.every(a=>a.status==="rejected")&&t[0]?.status==="rejected"&&Re(t[0].reason))throw t[0].reason;return t.map(a=>{if(a.status!=="fulfilled"||a.value===void 0||a.value===null)return{ok:!1};try{let d=typeof a.value=="bigint"?a.value:BigInt(a.value);return d>=0n?{ok:!0,amount:d}:{ok:!1}}catch{return{ok:!1}}})}async function Se(e,n,s,t){if(s.length===0)return[];let a=ie(n,e);if(!a)return Te(e,s,t);let d=s.map(r=>({target:r.address,allowFailure:!0,callData:ve({abi:Y,functionName:"balanceOf",args:[t]})})),o;try{o=await e.readContract({address:a,abi:Me,functionName:"aggregate3",args:[d]})}catch(r){if(await Ue(e,a,r))return Te(e,s,t);throw r}if(!Array.isArray(o)||o.length!==s.length)throw new k("Multicall3 aggregate3 returned an invalid result list.");return o.map(r=>{let l=r,u=Array.isArray(l)?l[0]:l?.success,m=Array.isArray(l)?l[1]:l?.returnData;if(!u||typeof m!="string"||m==="0x")return{ok:!1};try{let h=De({abi:Y,functionName:"balanceOf",data:m}),y=typeof h=="bigint"?h:BigInt(h);return y>=0n?{ok:!0,amount:y}:{ok:!1}}catch{return{ok:!1}}})}async function nt(e,n={}){x(e);let s=b(e),t=n.chainId??w,a=n.client??ce(n.rpcUrl,t),d=[];if(n.stockTokens?d=[...n.stockTokens]:n.stockAssetsPayload!==void 0?d=$(n.stockAssetsPayload,t):n.includeStockTokens!==!1&&t!==_&&(d=await Ae({http:n.http,url:n.stockAssetsUrl,chainId:t})),n.tokens)for(let i of n.tokens)W(i,d);let o=t===w?[Q,J,we,...n.oakTokenAddress||process.env.OAK_TOKEN_ADDRESS?[{address:b(n.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS),symbol:"OAK",decimals:B,chainId:t}]:[]]:t===_?[{...Q,address:b(N.testnet.usdg),chainId:t},{...J,address:b(N.testnet.weth),chainId:t},...n.oakTokenAddress?[{address:b(n.oakTokenAddress),symbol:"OAK",decimals:B,chainId:t}]:[]]:[],r=t===w&&n.includePoolTokens!==!1?ue.vaults.flatMap(i=>[{address:b(i.tokenAddress),symbol:b(i.tokenAddress),decimals:i.tokenDecimals,chainId:t},{address:b(i.earnContractAddress),symbol:b(i.earnContractAddress),decimals:18,chainId:t}]):[],l=new Set(r.map(i=>i.address.toLowerCase())),u=[],m=new Set;for(let i of[...o,...d,...n.tokens??[],...r]){if(i.chainId!==t||P(i.address)===M)continue;let c=W(i,d),T=c.address.toLowerCase();m.has(T)||(m.add(T),u.push(c))}let[h,y]=await Promise.all([a.getBalance({address:s}),Se(a,t,u,s)]),f=[],g={address:M,symbol:"ETH",decimals:18,chainId:t};(h>0n||n.includeZero)&&f.push({token:g,amount:h.toString()});for(let i=0;i<u.length;i++){let c=u[i],T=o.some(S=>C(S.address,c.address))||d.some(S=>C(S.address,c.address))?c.symbol:p(c.symbol),I=y[i]??{ok:!1};if(!I.ok){f.push({token:{address:c.address,symbol:T,decimals:c.decimals,chainId:c.chainId},amount:"unavailable"});continue}let A=I.amount;if(A>0n&&l.has(c.address.toLowerCase()))try{let[S,R]=await Promise.all([L(a,t,c.address,"symbol"),L(a,t,c.address,"decimals")]);T=p(S),c.decimals=R}catch{}(A>0n||n.includeZero)&&f.push({token:{address:c.address,symbol:T,decimals:c.decimals,chainId:c.chainId},amount:A.toString()})}return f}async function st(e,n,s){if(x(e),n.length>1e4)throw new k("Journal token discovery exceeds the balance lookup limit.");let t=[...new Set(n.map(o=>(x(o),b(o))))].filter(o=>P(o)!==M).map(o=>({address:o,symbol:o,decimals:0,chainId:s.chainId})),a=await Se(s.client,s.chainId,t,b(e)),d=t.flatMap((o,r)=>{let l=a[r];return l.ok&&l.amount===0n?[]:[{token:o,amount:l.ok?l.amount.toString():"unavailable"}]});return Promise.all(d.map(async({token:o,amount:r})=>{let[l,u]=await Promise.all([L(s.client,s.chainId,o.address,"symbol").catch(()=>o.address),L(s.client,s.chainId,o.address,"decimals").catch(()=>{throw new k(`Token decimals are unavailable for journal-received token ${o.address}; retry balances when RPC metadata is available.`)})]);return{token:{...o,symbol:p(l),decimals:u},amount:r}}))}var C=(e,n)=>e.toLowerCase()===n.toLowerCase(),O=e=>se(e.normalize("NFKC")).toLowerCase().replace(/[^\p{L}\p{N}]/gu,"");function Oe(e){let n=e.context.network??"mainnet",{chainId:s,usdg:t,weth:a}=N[n],d=(o,r,l)=>({...o,address:P(b(o.address)),name:r,kind:l,verified:!0,source:"Oak fixed addresses",warnings:[]});return[d({...Pe,chainId:s},"Ether","native"),d({...Q,address:t,chainId:s},"Global Dollar","stablecoin"),d({...J,address:a,chainId:s},"Wrapped Ether","wrapped"),...n==="mainnet"?[d(we,"USDe","stablecoin")]:[],...e.oakTokenAddress?[d({address:e.oakTokenAddress,symbol:"OAK",decimals:B,chainId:s},"Oak","oak")]:[]]}async function Ce(e){if(e.context.network==="testnet")return[];let n=e.officialStockTokens??await Ae({http:e.context.http,includeNames:!0,allowAmbiguousSymbols:!0});return n.filter(s=>Ee(s,n)).map(s=>({...s,name:s.name??s.symbol,kind:"official_stock",verified:!0,source:z,warnings:[],identityNote:"Official Robinhood stock token: this address matches Robinhood's published list. The quoted name is text from that list."}))}async function te(e,n,s=!0){let{chainId:t}=N[n.context.network??"mainnet"],a=n.context.clientFor(t);if(await a.getChainId()!==t)throw new k(`Token lookup requires Robinhood Chain ${t}.`);let[d,o,r]=await Promise.all([H(a,()=>L(a,t,e,"name",n.blockNumber)).catch(l=>{if(s)throw l;return""}),H(a,()=>L(a,t,e,"symbol",n.blockNumber)),H(a,()=>L(a,t,e,"decimals",n.blockNumber))]);if(typeof d!="string"||s&&!d.trim()||typeof o!="string"||!o.trim()||!Number.isInteger(r)||r<0||r>255)throw new k("The contract returned invalid token metadata.");return{address:b(e),name:d||o,symbol:o,decimals:r,chainId:t}}async function be(e,n){let s=await n.context.clientFor(w).readContract({address:E[w].clanker.factory.address,abi:ne(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),functionName:"tokenDeploymentInfo",args:[e]});return Array.isArray(s)&&s.length===4&&typeof s[0]=="string"&&C(s[0],e)}async function _e(e,n){let s=n.context.clientFor(w),t=E[w].poolsTrade,a=[t.instantLaunchStrategyFeesOn.address,t.instantLaunchStrategyFeesOff.address],d=ne(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)"])[0],o=await s.getBlockNumber(),r=new Set,l=0,u=0;for(let m=63127652n;m<=o;m+=10000000n){if(++l>Ie)throw new k("Token origin scan limit reached.");let h=m+9999999n>o?o:m+9999999n,y=await s.getLogs({address:a,event:d,args:{token:e},fromBlock:m,toBlock:h,strict:!0});for(let f of y){if(f.removed||!a.some(i=>C(i,f.address))||!f.args.token||!C(f.args.token,e)||!f.transactionHash||r.has(f.transactionHash))continue;if(r.add(f.transactionHash),++u>20)throw new k("Token origin receipt limit reached.");let g=await s.getTransactionReceipt({hash:f.transactionHash});if(fe(g).some(i=>C(i.token,e)))return b(g.from)}}}var Ie=5,Be=100,Fe=500,Ke=3e4;function Le(e){let n=Date.now()+Ke,s=0,t=new Map,a=o=>{let r=n-Date.now();if(r<=0)throw new k("Token lookup time budget reached; results are partial.");return F(o,Math.min(1e4,r))},d=X((o,r)=>a(async l=>{let u=await e.context.http(o,{...r,signal:l});return new Proxy(u,{get(m,h){if(h==="json")return()=>a(()=>m.json());let y=Reflect.get(m,h,m);return typeof y=="function"?y.bind(m):y}})}),e.context.http);return ee.set(d,a),{...e,context:{...e.context,http:d,clientFor:o=>{if(!t.has(o)){let r=e.context.clientFor(o),l=u=>{if(++s>Fe)throw new k("Token lookup RPC budget reached; results are partial.");return a(u)};t.set(o,X(new Proxy(r,{get(u,m){let h=Reflect.get(u,m);return typeof h!="function"?h:(...y)=>l(()=>h.apply(u,y))}}),r)),ee.set(t.get(o),l)}return t.get(o)}}}}function pe(e){return e.source==="Oak fixed addresses"?e:{...e,symbol:p(e.symbol),name:p(e.name)}}async function ot(e,n){if(n=Le(n),typeof e!="string"||e.length>256||!O(e))throw new k("Provide a token name, symbol or address to find_token.");let s=O(e),t=G(e.trim(),{strict:!1})?P(b(e.trim())):void 0,{chainId:a}=N[n.context.network??"mainnet"],d=[],o=Oe(n),r=!1;try{o.push(...await Ce(n))}catch{r=!0,d.push("The official stock list is unavailable; results are partial and stock identities and lookalikes could not be checked.")}let l=i=>t?C(i.address,t):O(i.symbol).includes(s)||O(i.name).includes(s),u=o.filter(l),m=[],h=(i,c)=>[i.symbol,i.name??""].some(T=>[c.symbol,c.name].some(I=>{let A=O(T),S=O(I);return!!A&&!!S&&(A.includes(S)||S.includes(A))})),y=(i,c={})=>{if(m.some(A=>C(A.address,i.address)))return;let T=[`Token ${p(i.symbol)} at ${i.address} is an unverified ${c.launchpad?"launchpad token":"token"}. Use its address, not its name or symbol.`];(V(i.symbol)||V(i.name)||o.some(A=>!C(A.address,i.address)&&h(i,A)))&&T.push(`Lookalike warning: ${p(i.symbol)} at ${i.address} resembles a verified token's name or symbol.`);let I={...i,...c,kind:c.launchpad?"launchpad":"erc20",verified:!1,source:c.launchpad?`${c.launchpad} origin and on-chain metadata; not a verified token`:"On-chain metadata only",warnings:T};m.push(I),d.push(...T)};if(t&&!u.length){let i=await te(t,n),c={};if(a===w){try{await be(t,n)&&(c.launchpad="clanker")}catch{d.push("Clanker origin lookup was unavailable for this address.")}if(c.launchpad==="clanker")try{let I=(await Z(n.context,{q:t,limit:20})).tokens.find(A=>C(A.contract_address,t));I&&(c.creator=b(I.msg_sender),c.creatorSource="Clanker indexer msg_sender")}catch{d.push("Clanker creator lookup is unavailable.")}else try{let T=await me(n.context,t);c.launchpad="pons",c.creator=b(T.creator),c.creatorSource="Pons factory deployer"}catch{d.push("Pons launch origin could not be confirmed for this address.")}if(!c.launchpad)try{let T=await _e(t,n);T&&(c.launchpad="pools.trade",c.creator=T,c.creatorSource="Launch transaction sender; may be a relayer")}catch{r=!0,d.push("pools.trade launch receipt lookup is unavailable; origin results are partial.")}}y(i,c)}else if(!t&&a===w){let i=new Set,c=new Set,T,I=0,A=0;try{do{if(++I>Ie)throw new k("Token search page limit reached.");let S=await Z(n.context,{q:e.trim(),limit:20,...T?{cursor:T}:{}});for(let R of S.tokens){if(++A>Be)throw new k("Token candidate limit reached.");let v=b(R.contract_address);if(!(c.has(v)||o.some(U=>C(U.address,v)))){c.add(v);try{let U=await te(v,n);if(!l(U))continue;let Ne=await be(v,n)?{launchpad:"clanker",creator:b(R.msg_sender),creatorSource:"Clanker indexer msg_sender"}:{};y(U,Ne)}catch{r=!0,d.push(`Could not read Clanker candidate ${v}; it was omitted from these partial results.`)}}}if(S.cursor&&i.has(S.cursor))throw new k("The Clanker indexer repeated a pagination cursor.");S.cursor&&i.add(S.cursor),T=S.cursor??void 0}while(T)}catch{r=!0,d.push("Clanker name search is unavailable, incomplete or reached its scan limit; results are partial.")}d.push("Pons and pools.trade require a token address; name search does not cover those launchpads.")}a===_&&d.push("Testnet lookup covers pinned tokens and explicit token addresses; stock and launchpad discovery are unavailable.");let f=i=>[...new Map(i.map(c=>[c.address.toLowerCase(),c])).values()],g=f([...u,...m]);for(let i of g)if(g.some(c=>!C(c.address,i.address)&&(O(i.symbol)===O(c.symbol)||O(i.name)===O(c.name)))){let c=`Duplicate warning: several tokens share the symbol or name of ${i.address}. Choose the intended address; do not guess from the name.`;i.warnings.push(c),d.push(c)}return u.length>1&&d.push("Several verified tokens match this search, including possible substring matches. Choose an exact address; the search does not select a quote token."),{query:p(e.trim()),chainId:a,partial:r,matches:f(u).map(pe),unverified:f(m).map(pe),warnings:d}}async function at(e,n){if(typeof e!="string"||!e.trim())throw new k("Provide a token address or verified symbol; use find_token to look it up.");if(!/^[A-Za-z0-9.$_-]{1,42}$/.test(e))throw new k("Use an exact ASCII verified symbol or token address; use find_token to look it up.");let s=e,t=G(s,{strict:!1})?P(b(s)):void 0,a=Oe(n),d=t&&a.find(y=>C(y.address,t));if(d)return d;let o=s.toUpperCase()==="$OAK"?"OAK":s.toUpperCase(),r=!t&&a.find(y=>y.symbol.toUpperCase()===o),l=[],u=!1;try{l=await Ce(n)}catch{if(r)return r;if(!t)throw new k("The official stock list is unavailable; stock symbols cannot be checked. Use find_token and try again when the list is reachable.");u=!0}if(t){let y=l.find(i=>C(i.address,t));if(y)return n.tokenMetadata&&W(n.tokenMetadata,l),{...y,name:p(y.name)};let f=n.tokenMetadata??await n.readMetadata?.(t);if(f&&(!C(f.address,t)||f.chainId!==N[n.context.network??"mainnet"].chainId))throw new k("Token metadata does not match the requested address and chain.");if(f&&(typeof f.symbol!="string"||!f.symbol.trim()||!Number.isInteger(f.decimals)||f.decimals<0||f.decimals>255))throw new k("The contract returned invalid token metadata.");let g=f?{...f,name:f.symbol}:await te(t,Le(n),!1);if(u){let i=O(g.symbol),c=q.get(j(n.context.http));if(xe.some(T=>O(T)===i)||c?.has(i))throw new k("The official stock list is unavailable; this address claims a stock ticker that cannot be checked. Try again when the list is reachable.")}return W(g,l),{...g,symbol:p(g.symbol),name:p(g.name),kind:"erc20",verified:!1,source:"On-chain metadata only",warnings:["This token address is unverified. On-chain names and symbols do not prove identity.",...u?["The official stock list is unavailable; stock identity could not be verified."]:[]]}}let m=[...a,...l].filter(y=>y.symbol.toUpperCase()===o);if(m.length!==1)throw new k(`Token symbol ${p(s)} is ${m.length?"ambiguous":"unverified"}; use find_token and choose an explicit address.`);let h=m[0];if(h.kind==="official_stock"&&s!==h.symbol)throw new k(`Use the exact official stock ticker ${p(h.symbol)}; case variants are refused.`);return h.source==="Oak fixed addresses"?h:{...h,name:p(h.name)}}export{z as a,Pe as b,Q as c,J as d,we as e,$ as f,Ee as g,W as h,tt as i,Ae as j,Me as k,nt as l,st as m,ot as n,at as o};
@@ -0,0 +1 @@
1
+ import{d as o}from"./HVFMIURK.js";import{a as i}from"./LFSJDFMY.js";import{b as a}from"./TI727O2H.js";var m=s=>({tools:i.map(e=>{let t=e==="netnet_blackjack_claim"?"seriesId":"sessionId";return{name:e,inputSchema:{description:"Self-only recovery on chain 4663, available without an active identity or subscription; every action requires local human confirmation. Card counts use whole units.",type:"object",additionalProperties:!1,required:[t],properties:{[t]:{type:"string",pattern:"^[1-9][0-9]{0,77}$",description:t==="seriesId"?'Card series id holding your parked blackjack chips, as a decimal string. Example: "1".':'Blackjack session id to settle, as a decimal string. Example: "1".'}}},execute:async(n,c)=>{let r=await o(e,n,c,s.clientFor(a));return{txs:r.txs,summary:r.decision}}}})});export{m as a};
@@ -0,0 +1,2 @@
1
+ import{c as R}from"./FAH7FKUT.js";import{b,i as O}from"./NMJVQX5M.js";import{d as P,e as D,f as C,g as w}from"./SK2VBNAU.js";import{h as x}from"./2GXHYI23.js";import{b as m}from"./TI727O2H.js";import{a as S}from"./XSD5NL7J.js";var T=/^PT-[\p{L}\p{N}._-]{1,40}$/u,L=10n**18n,N=e=>new Date(e*1e3).toISOString().slice(0,10);async function E(e,i,t){let a=await w(e,t.map(s=>({address:s.pt,abi:C,functionName:"balanceOf",args:[i]}))),r=new Map;return t.forEach((s,l)=>{let n=a[l];if(!n.ok||typeof n.value!="bigint")throw new S("Oak couldn't read every Pendle balance, so it won't show this wallet's terms as complete.");r.set(s.pt.toLowerCase(),n.value)}),r}function M(e,i,t){let[a,r=""]=e.formatAmount(i.toString(),t).split("."),s=r.slice(0,6).replace(/0+$/,"");return s?`${a}.${s}`:a}function Y(e){let i=`Your fixed term on Pendle ended on ${e.endDate}.`;if(e.kind==="stable"){let r=e.unitAmount?`Your ${e.ptAmount} tokens are worth ${e.unitAmount} USDG now.`:`Your ${e.ptAmount} tokens can be cashed out to USDG now.`;return`${i} ${r}
2
+ Want me to cash out to USDG, or start a new term? One "yes" is enough; say "cash out" or "new term".`}let t=e.unitAddress?`${e.unitSymbol} (token ${e.unitAddress})`:e.unitSymbol,a=e.unitAmount?`Your ${e.ptAmount} tokens pay out about ${e.unitAmount} ${t} now.`:`Your ${e.ptAmount} tokens can be cashed out for ${t} now.`;return`${i} ${a} Want me to cash out and swap that to USDG, or start a new term? One "yes" is enough.`}async function G(e,i){let t=new Map,a=await w(e,i.map(n=>({address:n.facts.verified.yt,abi:D,functionName:"pyIndexStored"}))),r=i.map((n,c)=>{let d=a[c];if(!d.ok||typeof d.value!="bigint")return;let p=d.value>n.facts.syExchangeRate?d.value:n.facts.syExchangeRate;return p>0n?n.balance*L/p:void 0}),s=i.flatMap((n,c)=>r[c]===void 0?[]:[{item:n,amount:r[c]}]),l=await w(e,s.map(({item:n,amount:c})=>({address:n.facts.verified.sy,abi:P,functionName:"previewRedeem",args:[n.facts.verified.inputToken,c]})));return s.forEach(({item:n},c)=>{let d=l[c];d.ok&&typeof d.value=="bigint"&&t.set(n.row.market.toLowerCase(),d.value)}),t}async function H(e,i,t={}){let a=e.clientFor(m),r=t.now!==void 0?{now:t.now}:{},s=await O(e,{allowChain:!0,...r,...t.signal?{signal:t.signal}:{}});b(t.signal);let l=await E(a,i,s.rows),n=s.rows.filter(u=>(l.get(u.pt.toLowerCase())??0n)>0n);b(t.signal);let{ok:c}=await R(a,n,r),d=c.map(u=>({...u,balance:l.get(u.row.pt.toLowerCase())}));b(t.signal);let p=await G(a,d.filter(u=>u.facts.verified.expired));return d.map(({row:u,facts:g,balance:A})=>{let o=g.verified,h=M(e,A,o.ptDecimals),f=N(o.expiry),k=T.test(g.ptSymbol)?g.ptSymbol:"PT",y=p.get(u.market.toLowerCase()),$={module:"pendle",id:`${m}:${o.pt}`,chainId:m,assets:[{token:{address:o.pt,chainId:m,symbol:k,decimals:o.ptDecimals},amount:A.toString()}],economics:{principal:[x(o.expired?"redeemable":"maturity",{token:{address:o.inputToken,chainId:m,symbol:o.inputSymbol,decimals:o.inputDecimals},amount:y?.toString()??null,source:o.expired?"pendle.previewRedeem":"pendle.expiry",heldAs:o.pt,dueAt:o.expiry.toString(),...y===void 0?{unknownReason:o.expired?"The payout preview is unavailable; try again.":`The term pays out on ${f}; Oak reads the payout only after the term ends.`}:{}})],debt:[],rewards:[],backing:[],coverage:{complete:!0}}};if(!o.expired)return{...$,description:`${h} ${k} in the Pendle term ending ${f}. It pays out at the end date if held until then; leaving early sells at that day's market price.`};let v=y===void 0?void 0:M(e,y,o.inputDecimals),I=Y({kind:o.kind,endDate:f,ptAmount:h,unitSymbol:o.inputSymbol,...v!==void 0?{unitAmount:v}:{},...u.source==="chain"?{unitAddress:o.inputToken}:{}});return{...$,matured:!0,oakNotice:I,description:`${h} ${k} in a Pendle term that ended ${f}; ready to cash out.`}})}export{N as a,E as b,M as c,Y as d,H as e};
@@ -0,0 +1 @@
1
+ import{c as y}from"./VVWFB53Q.js";import{a as g,b as f}from"./3CH2IPQL.js";var E=2*1024*1024,l=class extends Error{constructor(i){super(y);this.diagnostic=i}diagnostic},b=class extends Error{constructor(i){super(y);this.captured=i}captured},u=(t,r={})=>{throw new l({failedRule:t,observation:r})};function h(t,r,i={}){return t instanceof l?new l({...t.diagnostic,observation:{...i,...t.diagnostic.observation}}):new l({failedRule:r,observation:i})}function P(t,r){throw r?new b(t.diagnostic):new Error(y)}var T=t=>({prefix:typeof t=="string"&&t.startsWith("sk-raeto-")?"ok":"no",length:typeof t=="string"?t.length:0}),R=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),v=t=>Object.keys(t).map(r=>/^(?:sign_link|typed_data|preview|error|message|detail|status|ok|nonce|signature|agent_id|data|result|domain|types|primaryType)$/.test(r)?r:"[REDACTED_FIELD]");function O(t,r){let i=t.pathname.split("/").filter(Boolean).at(-1)??"",s=k(t.origin.split(r).join("[REDACTED_KEY]"));return{signLink:{origin:i?s.split(i).join("<nonce>"):s,path:t.pathname.split("/").map((a,o)=>a?o<4&&/^(?:v\d+|statements|sign|me)$/.test(a)?a:"<nonce>":"").join("/")}}}function w(t){return(typeof t!="string"||!/^[A-Za-z0-9_-]{1,256}$/.test(t)||/sk-raeto-|0x[0-9a-f]{130}/i.test(t))&&u("nonce_format",{nonceValid:!1}),`${f.signPath}${t}`}function k(t){return t.replace(/sk-raeto-(?:[A-Za-z0-9_-]|\\+u[0-9a-fA-F]{4})*/g,"[REDACTED_KEY]").replace(/0x[0-9a-fA-F]{130}/g,"[REDACTED_SIGNATURE]")}function D(t,r="",i=""){let s=o=>{let n=i?o.split(i).join("[REDACTED_KEY]"):o;return k(r?n.split(r).join("<nonce>"):n)},a=o=>/^[a-z][a-z0-9_]{0,39}$/.test(o)?o:"[REDACTED_FIELD]";return{bodyFields:Object.entries(t).map(([o,n])=>{let e={name:a(o),type:n===null?"null":Array.isArray(n)?"array":typeof n};if(typeof n!="string")return e;let c;try{c=new URL(n)}catch{return{...e,length:n.length}}if(c.protocol!=="https:")return{...e,length:n.length};let p=c.pathname.startsWith(f.signPath)?c.pathname.slice(f.signPath.length):"",A=s(p?c.origin.split(p).join("<nonce>"):c.origin);return{...e,length:n.length,url:{origin:A,pathname:c.pathname.split("/").map(d=>d.length>16?`<seg:${d.length}>`:d&&d===p?"<nonce>":s(d)).join("/"),queryKeys:[...c.searchParams.keys()].map(a),originAllowed:c.origin===g.apiOrigin}}})}}function C(t,r,i){let s=/^(?:(?:proxy[-_])?authorization|bearer|(?:x[-_])?(?:api[-_]?key|auth(?:entication)?(?:[-_].*)?))$/i,a=n=>{let e=n.split(i).join("[REDACTED_KEY]").replace(/sk-raeto-(?:[A-Za-z0-9_-]|\\+u[0-9a-fA-F]{4})*/g,"[REDACTED_KEY]").replace(/0x[0-9a-fA-F]{130}/g,"[REDACTED_SIGNATURE]").replace(/\bBearer\s+(?:"[^"\r\n]*"|'[^'\r\n]*'|[^\s"\\,]+)/gi,"Bearer [REDACTED_AUTH]").replace(/((?:Proxy-)?Authorization\s*:\s*)[^\r\n]+/gi,"$1[REDACTED_AUTH]").replace(/\/v1\/statements\/sign\/[^/"\\\s?#]+/g,"/v1/statements/sign/<nonce>");return r&&(e=e.split(r).join("<nonce>")),e};return`untrusted ${JSON.stringify(t??null,(n,e)=>s.test(n)?"[REDACTED_AUTH]":typeof e=="string"?a(e):Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&s.test(e[0])?[e[0],"[REDACTED_AUTH]"]:R(e)?Object.fromEntries(Object.entries(e).map(([c,_])=>[a(c),_])):e).replace(/[<>&\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g,n=>`\\u${n.charCodeAt(0).toString(16).padStart(4,"0")}`)}`}async function j(t,r){if(!t.body)return u("body_missing",{bodyPresent:!1});let i=t.body.getReader(),s=()=>{i.cancel().catch(()=>{})};r.addEventListener("abort",s,{once:!0});let a=0,o="",n=new TextDecoder("utf-8",{fatal:!0});try{for(;;){let c=await i.read();if(a+=c.value?.length??0,a>E&&u("body_size",{limitBytes:E,exceeded:!0}),o+=n.decode(c.value,{stream:!c.done}),c.done)break}let e;try{e=JSON.parse(o)}catch{return u("body_json",{validJson:!1})}return R(e)?e:u("body_object",{bodyType:e===null?"null":Array.isArray(e)?"array":typeof e,bodyKeys:[]})}catch(e){throw h(e,"body_read",e instanceof l?{}:{bodyReadable:!1})}finally{r.removeEventListener("abort",s),i.cancel().catch(()=>{}),i.releaseLock()}}async function m(t,r,i,s){let a=new AbortController,o,n;try{let e=new URL(t,g.apiOrigin);(e.origin!==g.apiOrigin||e.protocol!=="https:"||e.username||e.password||e.search||e.hash)&&u("request_origin",{originAllowed:!1});let c=new Headers({accept:"application/json"});s!==void 0&&(/^sk-raeto-[A-Za-z0-9_-]{32}$/.test(s)||u("key_format",T(s)),c.set("authorization",`Bearer ${s}`)),i!==void 0&&c.set("content-type","application/json");let _=new Promise((A,d)=>{o=setTimeout(()=>{d(new l({failedRule:"timeout",observation:{timeoutMs:1e4}})),a.abort()},1e4)}),p=async()=>(n=await globalThis.fetch(e.href,{method:r,headers:c,redirect:"manual",signal:a.signal,...i!==void 0?{body:JSON.stringify(i)}:{}}),n.redirected||n.status<200||n.status>=300?u("http_response",{httpStatus:n.status,redirected:n.redirected}):{data:await j(n,a.signal),status:n.status});return await Promise.race([p(),_])}catch(e){throw a.abort(),h(e,"request_failed",{...n?{httpStatus:n.status,redirected:n.redirected}:{responseReceived:!1}})}finally{clearTimeout(o),n&&!n.bodyUsed&&n.body?.cancel().catch(()=>{})}}async function L(t,r,i={}){let s={};try{(typeof t!="string"||!/^sk-raeto-[A-Za-z0-9_-]{32}$/.test(t))&&u("key_format",T(t)),(!r||r.verified!==!0||typeof r.agentId!="string"||!/^[1-9]\d{0,29}$/.test(r.agentId))&&u("identity_verified",{identityVerified:!1});let{data:a,status:o}=await m(f.startPath,"POST",{agent_id:r.agentId},t);if(s={httpStatus:o,redirected:!1,bodyKeys:v(a),...i.capture?D(a,"",t):{}},!("sign_link"in a)&&a.state==="on_record")return typeof i.wallet!="string"||!/^0x[0-9a-f]{40}$/i.test(i.wallet)||typeof a.account!="string"||a.account.toLowerCase()!==i.wallet.toLowerCase()||a.agent_id!==r.agentId?u("record_identity",{recordIdentityMatches:!1}):{kind:"already_paired",untrusted:!0,record:R(a.record)?a.record:{},status:o,...i.capture?{observation:s}:{}};if(typeof a.sign_link!="string")return u("sign_link_type",{signLinkType:typeof a.sign_link});let n;try{n=new URL(a.sign_link)}catch{return u("sign_link_url",{validUrl:!1})}Object.assign(s,O(n,t));let e=n.pathname.slice(f.signPath.length);return n.origin!==g.apiOrigin?u("sign_link_origin",{originAllowed:!1}):a.sign_link!==`${g.apiOrigin}${w(e)}`?u("sign_link_exact",{exactLink:!1}):{nonce:e,status:o,...i.capture?{observation:s}:{}}}catch(a){return P(h(a,"start_failed",s),i.capture)}}function x(t){try{return{untrusted:!0,data:JSON.parse(k(JSON.stringify(t)))}}catch{return u("reply_redaction",{replySerializable:!1})}}async function U(t,r={}){try{let{data:i,status:s}=await m(w(t),"GET");return{...r.capture?{untrusted:!0,data:i,observation:D(i,t)}:x(i),status:s}}catch(i){return P(h(i,"request_failed"),r.capture)}}async function z(t,r){try{if(typeof r!="string"||!/^0x[0-9a-fA-F]{130}$/.test(r))return u("signature_format",{signatureValid:!1});let{data:i,status:s}=await m(w(t),"POST",{signature:r});return{...x(i),status:s}}catch{throw new Error(y)}}export{b as a,D as b,C as c,L as d,U as e,z as f};
@@ -0,0 +1 @@
1
+ import{g as m}from"./YXXK6EPI.js";import{a as U}from"./43LI5NKJ.js";import{a as w}from"./66F5ZH34.js";import{h as x}from"./NWNYJ26T.js";import{b as l,j as E}from"./TI727O2H.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as k,getAddress as D,parseAbi as T,parseAbiItem as P,zeroAddress as R}from"viem";var b=D("0x23e99d72e24dc538c955b9bade710d2ce3a7fca4"),I={address:D(E[l].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:l},f=T(["function rewardToken() view returns (address)","function owner() view returns (address)","function publisher() view returns (address)","function epochs(uint256) view returns (bytes32 root,uint128 total,uint128 claimed,uint64 expiry,bool swept)","function hasClaimed(uint256,address) view returns (bool)","function claimable(uint256 epochId,address account,uint256 amount,bytes32[] proof) view returns (bool)","function claim(uint256 epochId,uint256 amount,bytes32[] proof)","function setPublisher(address publisher)","function sweep(uint256 epochId,address to)","function fundEpoch(uint256 epochId,bytes32 root,uint256 total,uint64 expiry)","function transferOwnership(address newOwner)","function renounceOwnership()"]),C=P("event EpochFunded(uint256 indexed epochId,bytes32 root,uint256 total,uint64 expiry)"),O=p=>{if(typeof p!="string"||!/^0x[0-9a-f]{64}$/i.test(p))throw new n("Provide a bytes32 Merkle root or proof element.");return p};function G(p){if(!Array.isArray(p)||p.length>64)throw new n("Provide the publisher\u2019s Merkle proof array (at most 64 elements).");return p.map(O)}var j=p=>{async function v(){let e=p.clientFor(l);if(await e.getChainId()!==l)throw new n("Longbow rebates require chain 4663.");let a=await e.getBlock(),s=(o,c=[])=>e.readContract({address:b,abi:f,functionName:o,args:c,blockNumber:a.number}),i=await s("rewardToken");if(!x(i,I.address))throw new n("The Longbow rebate distributor does not report canonical USDG.");return{client:e,block:a,read:s}}async function S(e,a,s,i){let[o,c]=await Promise.all([s("epochs",[e]),s("hasClaimed",[e,a])]);if(!Array.isArray(o)||o.length!==5||typeof c!="boolean")throw new n("Invalid rebate epoch state.");let[r,d,u,h,t]=o;if(typeof d!="bigint"||typeof u!="bigint"||u>d||typeof h!="bigint"||typeof t!="boolean")throw new n("Invalid rebate epoch amounts.");return{epochId:e.toString(),root:O(r),total:d.toString(),claimedAmount:u.toString(),outstanding:(t?0n:d-u).toString(),expiry:h.toString(),swept:t,hasClaimed:c,open:r!==`0x${"0".repeat(64)}`&&!t&&i<h}}let A=(e,a,s,i)=>({name:e,inputSchema:{type:"object",properties:a,required:s,additionalProperties:!1},execute:async(o,c)=>{try{if(U(c),Object.keys(o).some(r=>!Object.hasOwn(a,r)))throw new n("Unsupported Longbow rebate argument.");return await i(o,c)}catch(r){throw new n(p.plainError(r))}}});return{tools:[A("longbow_rebates",{epochIds:{type:"array",maxItems:100,description:"Rebate epoch ids to read, at most 100. Use this or fromBlock, not both.",items:w("Rebate epoch id, as a decimal string.")},fromBlock:w("Block number to start scanning for funded epochs, as a decimal string. Default is the last 100000 blocks; at most 1000000 blocks are scanned.")},[],async(e,a)=>{let{client:s,read:i,block:o}=await v();if(e.epochIds!==void 0&&e.fromBlock!==void 0)throw new n("Use epochIds or fromBlock, not both.");let c,r;if(e.epochIds!==void 0){if(!Array.isArray(e.epochIds)||e.epochIds.length>100)throw new n("Provide at most 100 rebate epochIds.");c=e.epochIds.map(t=>m(t))}else{if(r=e.fromBlock===void 0?o.number>100000n?o.number-100000n:0n:m(e.fromBlock),r>o.number||o.number-r>1000000n)throw new n("Read at most 1000000 blocks per rebate discovery window.");let t=await s.getLogs({address:b,event:C,fromBlock:r,toBlock:o.number,strict:!0});if(c=[...new Set(t.map(y=>y.args.epochId))],c.length>100)throw new n("Too many rebate epochs; narrow the block window.")}let[d,u,h]=await Promise.all([i("owner"),i("publisher"),Promise.all(c.map(t=>S(t,a,i,o.timestamp)))]);return{chainId:l,distributor:b,token:I,blockNumber:o.number.toString(),owner:d,publisher:u,epochs:h,scannedFromBlock:r?.toString()??null,caveat:"Discovery covers only these IDs or this event window. Amounts/proofs require the publisher\u2019s tree; the app does not expose a verified proof endpoint. Claims expire at each on-chain expiry, even if app prose says otherwise."}}),A("longbow_claim_rebate",{epochId:w("Rebate epoch id to claim from, as a decimal string."),amount:w('Amount of USDG you are entitled to in this epoch, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.'),proof:{type:"array",maxItems:64,description:"Merkle proof for this wallet and amount from the rebate publisher, as 0x-prefixed 32-byte hex strings.",items:{type:"string"}}},["epochId","amount","proof"],async(e,a)=>{let s=m(e.epochId),i=m(e.amount),o=G(e.proof),{read:c,block:r}=await v(),d=await S(s,a,c,r.timestamp);if(!d.open||d.hasClaimed||i===0n||await c("claimable",[s,a,i,o])!==!0)throw new n("Rebate is closed, already claimed or not proven for this wallet and amount.");let u=`Claim ${i} USDG base units from Longbow rebate epoch ${s} to this wallet ${a}. No approvals.`,h=[p.unsignedTx({to:b,data:k({abi:f,functionName:"claim",args:[s,i,o]}),value:"0",chainId:l,description:u})],t=await p.preview(h,a);if(t.changes.filter(g=>g.token.chainId===l&&x(g.token.address,I.address)&&g.token.decimals===6).reduce((g,B)=>g+BigInt(B.amount),0n)!==i)throw new n("Rebate preview does not return the exact proven USDG amount.");return{txs:h,preview:t,summary:`${u} ${t.summary}`}}),A("longbow_manage_rebates",{operation:{enum:["setPublisher","fundEpoch","sweep","transferOwnership","renounceOwnership"],description:"Distributor admin call: set the publisher, fund an epoch (publisher), sweep an expired epoch, transfer ownership, or renounce it permanently (owner)."},epochId:w("Rebate epoch id, as a decimal string. Used by fundEpoch and sweep."),root:{type:"string",description:"Merkle root of the epoch claims, as 0x followed by 64 hex digits. Used by fundEpoch."},amount:w('Total USDG funded into the epoch, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG. Used by fundEpoch.'),expiry:w("Unix seconds when claims close; must be at least 30 days ahead. Used by fundEpoch."),account:{type:"string",description:"Address that receives the role or funds: new publisher, new owner, or the sweep recipient."}},["operation"],async(e,a)=>{let{read:s,block:i}=await v(),o=e.operation==="fundEpoch";if(!x(await s(o?"publisher":"owner"),a))throw new n("This wallet lacks the rebate publisher/owner role.");let c=o?["operation","epochId","root","amount","expiry"]:e.operation==="sweep"?["operation","epochId","account"]:e.operation==="renounceOwnership"?["operation"]:["operation","account"];if(Object.keys(e).some(t=>!c.includes(t)))throw new n("Unexpected fields for this rebate management operation.");let r,d=0n;if(o){let t=m(e.expiry,64);if(d=m(e.amount,128),d===0n||t<i.timestamp+30n*86400n)throw new n("Fund a positive rebate amount with at least 30 days to claim.");r=k({abi:f,functionName:"fundEpoch",args:[m(e.epochId),O(e.root),d,t]})}else if(e.operation==="renounceOwnership")r=k({abi:f,functionName:"renounceOwnership"});else{if(typeof e.account!="string")throw new n("Provide the explicit publisher, owner or sweep recipient.");U(e.account);let t=D(e.account);if(t===R)throw new n("The rebate recipient/role cannot be zero.");if(e.operation==="sweep"){let y=await S(m(e.epochId),a,s,i.timestamp);if(y.swept||i.timestamp<BigInt(y.expiry))throw new n("Only expired, unswept rebate epochs can be swept.");r=k({abi:f,functionName:"sweep",args:[m(e.epochId),t]})}else if(e.operation==="setPublisher"||e.operation==="transferOwnership")r=k({abi:f,functionName:e.operation,args:[t]});else throw new n("Choose a supported rebate management operation.")}let u=`Longbow rebate ${String(e.operation)}: ${JSON.stringify(e)}. ${e.operation==="renounceOwnership"?"Owner administration is permanently relinquished.":""}`,h=[...o?[p.approval(I.address,b,d.toString(),l)]:[],p.unsignedTx({to:b,data:r,value:"0",chainId:l,description:u})];return{txs:h,preview:await p.preview(h,a),summary:u}})]}};export{b as a,f as b,j as c};
@@ -0,0 +1 @@
1
+ import{a as b}from"./W32UECOL.js";import{a as v}from"./G2LAO23N.js";import{a as k}from"./66F5ZH34.js";import{c as l}from"./NWNYJ26T.js";import{b as p}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as S,getAddress as m,parseAbi as f,zeroAddress as y}from"viem";var C=f(["function tokenizations(address token) view returns ((address creator,address forwarder,bytes32 marketFamilyId,uint64 createdAt))"]),I=f(["function tokenizations(address token) view returns ((address creator,uint8 way,address forwarder,address adapter,address door,bytes32 familyId,bytes32 marketFamilyId,uint64 unlockBlock,uint16 legBps))"]),A=f(["function name() view returns (string)","function symbol() view returns (string)","function decimals() view returns (uint8)","function balanceOf(address account) view returns (uint256)","function totalSupply() view returns (uint256)","function assetCount() view returns (uint256)","function claimable(address account,uint256 asset) view returns (uint256)","function streamSeconds() view returns (uint32)","function tipBps() view returns (uint16)","function doorCount() view returns (uint256)","function dropBox() view returns (address)","function bridge() view returns (address)","function claim(uint256 asset,address to) returns (uint256 amount)","function claimAll(address to) returns (uint256[] amounts)","function sync() returns (uint256 tip)","function syncRange(uint256 start,uint256 count) returns (uint256 tip)","function syncSome(uint256[] doorIds) returns (uint256 tip)"]),O=f(["function dropCount() view returns (uint256)","function claimable(uint256 dropId,address holder) view returns (uint256)","function claim(uint256[] dropIds,address to) returns (uint256[] amounts)"]),w=["0x522723A7a09684515881568Ab8247f3846D66F43","0xfb3c1501c727f30883cd7B36Ec380381af7412Ef"].map(m),P={token:A,drops:O};function R(t){let r=e=>{let o=b(e.type,e.name,`argument of ${t.name}`);return e.type==="address"?{...l,description:o}:e.type==="uint256[]"?{type:"array",items:k(),maxItems:128,description:o}:{...k(),description:o}};return{type:"object",properties:Object.fromEntries(t.inputs.map(e=>[e.name,r(e)])),required:t.inputs.map(e=>e.name),additionalProperties:!1}}function g(t){return Object.entries(P).flatMap(([r,e])=>e.filter(o=>o.stateMutability==="view"===t).map(o=>({target:r,fn:o})))}var j={token:"the revenue token itself",drops:"its derived drop box"};function h(t){return{type:"object",oneOf:g(t).map(({target:r,fn:e})=>({type:"object",properties:{token:{...l,description:v.address("registered Hookr revenue token")},target:{const:r,description:`Contract to call: "${r}", ${j[r]}.`},function:{const:e.name,description:`Function to call: ${e.name}.`},params:{...R(e),description:`Arguments of ${r}.${e.name}; integers are decimal strings.`}},required:["token","target","function","params"],additionalProperties:!1}))}}function H(t,r){if(Object.keys(t).length!==4||Object.keys(t).some(n=>!["token","target","function","params"].includes(n)))throw new s("Provide token, target, function and params for the Hookr revenue operation.");let e=g(r).find(n=>n.target===t.target&&n.fn.name===t.function);if(!e||!t.params||typeof t.params!="object"||Array.isArray(t.params))throw new s("Choose a documented Hookr revenue function and parameter object.");let o;try{o=m(String(t.token))}catch{throw new s("Provide a valid Hookr revenue token address.")}let i=t.params,a=e.fn;if(Object.keys(i).length!==a.inputs.length||Object.keys(i).some(n=>!a.inputs.some(u=>u.name===n)))throw new s("Provide exactly the documented Hookr revenue parameters.");let c=n=>{if(typeof n!="string"||!/^(0|[1-9][0-9]*)$/.test(n)||n.length>78||BigInt(n)>=1n<<256n)throw new s("Revenue token indices and amounts must be decimal base-unit strings.");return BigInt(n)},d=a.inputs.map(n=>{let u=i[n.name];if(n.type==="address")try{return m(String(u))}catch{throw new s("Provide a valid Hookr revenue address.")}if(n.type==="uint256[]"){if(!Array.isArray(u)||u.length>128)throw new s("Provide at most 128 Hookr revenue indices.");return u.map(c)}return c(u)});return{token:o,fn:a,values:d,operation:e}}async function x(t,r,e){let o=t.clientFor(p),i;for(let c of w){let d=c===w[0],n=await o.readContract({address:c,abi:d?C:I,functionName:"tokenizations",args:[r]});if(!n||typeof n.creator!="string"||d&&(!("createdAt"in n)||typeof n.createdAt!="bigint"||n.createdAt<0n||n.createdAt>=1n<<64n))throw new s("Hookr token provenance is unavailable.");if(m(n.creator)!==y&&(!d||"createdAt"in n&&n.createdAt>0n)){i=c;break}}if(!i)throw new s("This token has no record on a pinned Hookr tokenizer.");let a=e?m(await o.readContract({address:r,abi:A,functionName:"dropBox"})):r;if(a===y)throw new s("Hookr revenue drop box is unavailable.");return{to:a,tokenizer:i}}async function F(t,r,e){if(t.network==="testnet")throw new s("Hookr revenue actions require mainnet, chain 4663.");let{token:o,fn:i,values:a}=H(r,!1),{to:c}=await x(t,o,r.target==="drops"),d=i.inputs.findIndex(n=>n.name==="to");if(d>=0&&[y,o,c].includes(a[d]))throw new s("Choose a valid revenue claim recipient.");return{txs:[t.unsignedTx({chainId:p,to:c,value:"0",data:S({abi:[i],functionName:i.name,args:a}),description:`Hookr revenue ${r.target}.${i.name}: ${JSON.stringify(r.params)}. No token approval or principal deposit.`})],inputs:[]}}function D(t){return[{name:"hookr_revenue_read",inputSchema:{...h(!0),description:"Read a registered Hookr revenue token or its derived drop box: balance, claimable, terms and indices. Checks tokenizer provenance on chain."},execute:async r=>{let{token:e,fn:o,values:i}=H(r,!0),{to:a,tokenizer:c}=await x(t,e,r.target==="drops"),d=await t.clientFor(p).readContract({address:a,abi:[o],functionName:o.name,args:i});return{chainId:p,token:e,tokenizer:c,contract:a,function:o.name,result:JSON.parse(JSON.stringify(d,(n,u)=>typeof u=="bigint"?u.toString():u))}}},{name:"hookr_revenue_action",inputSchema:{...h(!1),description:"Preview holder income/drop claims or permissionless sync/syncRange/syncSome on a registered Hookr revenue token. No approvals; local human confirmation required. Claims and syncs are separate actions."},execute:async(r,e)=>{let{txs:o}=await F(t,r,e),i=await t.preview(o,e);return{txs:o,preview:i,summary:`Hookr revenue ${r.function}; verify receipt and holder balances after confirmation.`}}}]}export{w as a,F as b,D as c};
@@ -0,0 +1 @@
1
+ import{c as A,d as M,m as $}from"./24Q3FNGX.js";import{f as C,g as H}from"./LJJYYUEG.js";import{d as m,e as s,z as k}from"./WBNFRPAT.js";import{g as b}from"./NWNYJ26T.js";import{b as x}from"./TI727O2H.js";import{a as e}from"./XSD5NL7J.js";import{decodeFunctionData as v,encodeFunctionData as B,erc20Abi as q,getAddress as F}from"viem";function Q(u){return{tools:[{name:"uniswap_swap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["routes"],properties:{routes:{description:"One to twenty complete uniswap_swap argument objects, each with its own minAmountOut or maxAmountIn bound.",type:"array",minItems:1,maxItems:20,items:{type:"object",description:"Complete uniswap_swap arguments, including an absolute minAmountOut or maxAmountIn."}}}},async execute(n,y){if(H(n,["routes"]),!Array.isArray(n.routes)||n.routes.length<1||n.routes.length>20)throw new e("Provide 1 to 20 explicit bounded Uniswap routes.");let p=[],I=[],l=new Map,i="0x",E=0n,a,w=[],P=new Set;for(let t of n.routes){if(!t||typeof t!="object"||Array.isArray(t))throw new e("Each route must contain uniswap_swap arguments.");let c=await $(u,t,y,!1);if(!("txs"in c))throw new e("Route did not build swap transactions.");p.push(...c.warnings??[]),I.push(...c.confirmationWarnings??[]);let R=c.txs;for(let r of R.slice(0,-1))if(b(r.to,m)){let[o,N,O,U]=v({abi:M,data:r.data}).args;if(N!==s)throw new e("Unexpected route approval spender.");let _=o.toLowerCase(),d=l.get(_),j=(d?.amount??0n)+O;if(j>=1n<<160n)throw new e("Combined input approvals exceed uint160.");l.set(_,{token:o,amount:j,expiration:d&&d.expiration<BigInt(U)?d.expiration:BigInt(U)})}else{let o=v({abi:q,data:r.data});if(o.functionName!=="approve"||!b(o.args[0],m))throw new e("Unexpected route prerequisite.")}let g=R.at(-1);if(g.to!==s)throw new e("Route does not use the pinned Universal Router.");E+=BigInt(g.value);let[D,h,S]=v({abi:A,data:g.data}).args,T=D.slice(2).match(/../g)??[];if(T.length!==h.length)throw new e("Unexpected route command/parameter count.");T.forEach((r,o)=>{r==="04"?P.add(h[o]):(i=`${i}${r}`,w.push(h[o]))}),a=a===void 0||S<a?S:a}for(let t of P)i=`${i}04`,w.push(t);let f=[];for(let t of l.values())f.push(u.approval(F(t.token),m,t.amount.toString(),x),k(t.token,s,t.amount.toString(),t.expiration.toString()));return f.push(u.unsignedTx({to:s,data:B({abi:A,functionName:"execute",args:[i,w,a]}),value:E.toString(),chainId:x,description:`Atomically execute ${n.routes.length} caller-selected v2/v3/v4 routes, preserving each route's trade bound.`})),{...await C(u,f,y,`${p.join(" ")}${p.length?" ":""}Explicit mixed-version/split routes; every route must meet its own bound. No automatic best-route search or allow-revert branch. The wallet must fund each independently previewed route.`),warnings:p,confirmationWarnings:I}}}]}}export{Q as a};
@@ -0,0 +1 @@
1
+ import{a as y,b as P,d as I,e as q,f as T,g as L}from"./LJJYYUEG.js";import{a as w}from"./66F5ZH34.js";import{c as k,g as D}from"./NWNYJ26T.js";import{b as f}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{encodeFunctionData as U,erc20Abi as $,getAddress as O,parseAbi as S,zeroAddress as g}from"viem";var _=O("0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f"),h=O("0x89e5db8b5aa49aa85ac63f691524311aeb649eba"),F=S(["function getPair(address,address) view returns (address)"]),N=S(["function token0() view returns (address)","function token1() view returns (address)","function getReserves() view returns (uint112,uint112,uint32)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)"]),E=S(["function factory() view returns (address)","function addLiquidity(address tokenA,address tokenB,uint256 amountADesired,uint256 amountBDesired,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256,uint256)","function removeLiquidity(address tokenA,address tokenB,uint256 liquidity,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256)","function getAmountsOut(uint256 amountIn,address[] path) view returns (uint256[] amounts)","function getAmountsIn(uint256 amountOut,address[] path) view returns (uint256[] amounts)"]);async function z(s,p,t,n){if(p===g||t===g||p===t)throw new c("Provide two different ERC-20 tokens; use WETH for native ETH.");let r=s.clientFor(f),i=await r.getBlockNumber(),a=await r.readContract({address:_,abi:F,functionName:"getPair",args:[p,t],blockNumber:i}),[e,A]=await Promise.all([q(s,p,i),q(s,t,i)]);if(a===g)return{pair:a,tokenA:e,tokenB:A,reserveA:0n,reserveB:0n,supply:0n,balance:0n,blockNumber:i};let[M,l,v,B]=await Promise.all([r.readContract({address:a,abi:N,functionName:"token0",blockNumber:i}),r.readContract({address:a,abi:N,functionName:"getReserves",blockNumber:i}),r.readContract({address:a,abi:N,functionName:"totalSupply",blockNumber:i}),r.readContract({address:a,abi:$,functionName:"balanceOf",args:[n],blockNumber:i})]),[b,o]=D(M,p)?l:[l[1],l[0]];return{pair:a,tokenA:e,tokenB:A,reserveA:b,reserveB:o,supply:v,balance:B,blockNumber:i}}var H={tokenA:{...k,description:"Address of the first ERC-20 token."},tokenB:{...k,description:"Address of the second ERC-20 token."},amountADesired:w('Desired amount of tokenA in base units; use tokenA decimals. Example: "1000000" = 1 tokenA at 6 decimals.'),amountBDesired:w('Desired amount of tokenB in base units; use tokenB decimals. Example: "1000000" = 1 tokenB at 6 decimals.'),liquidity:{description:'LP token amount in base units (18 decimals), or "all" for the wallet balance. Example: "1000000000000000000" = 1 LP token.',type:"string",pattern:"^(?:[0-9]+|all)$"},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999},amountAMin:w('Minimum amount of tokenA in base units; use tokenA decimals. Example: "1000000" = 1 tokenA at 6 decimals.'),amountBMin:w('Minimum amount of tokenB in base units; use tokenB decimals. Example: "1000000" = 1 tokenB at 6 decimals.')};function J(s){let p=async(t,n,r)=>{L(n,t==="pool"?["tokenA","tokenB"]:["tokenA","tokenB","slippageBps","amountAMin","amountBMin",...t==="add"?["amountADesired","amountBDesired"]:["liquidity"]]);let i=P(n.tokenA),a=P(n.tokenB),e=await z(s,i,a,r);if(t==="pool")return{pair:e.pair,tokenA:e.tokenA,tokenB:e.tokenB,reserveA:e.reserveA.toString(),reserveB:e.reserveB.toString(),totalSupply:e.supply.toString(),balance:e.balance.toString(),blockNumber:e.blockNumber.toString(),initialized:e.pair!==g};let A=s.clientFor(f),M=I(n.slippageBps);if(!D(await A.readContract({address:h,abi:E,functionName:"factory"}),_))throw new c("Uniswap v2 router factory differs from its pinned deployment.");let l=(await A.getBlock()).timestamp+300n,v=[],B=(o,d,m)=>{let u=o===void 0?d*BigInt(1e4-M)/10000n:y(o,m,256,!0);if(u>d||d>0n&&u===0n)throw new c(`${m} must be positive and no more than the reserve-ratio estimate.`);return u},b;if(t==="add"){let o=y(n.amountADesired,"amountADesired"),d=y(n.amountBDesired,"amountBDesired");if(e.reserveA===0n!=(e.reserveB===0n))throw new c("Uniswap v2 pair reserves are inconsistent.");let m=o,u=d;if(e.reserveA>0n&&e.reserveB>0n){let R=o*e.reserveB/e.reserveA;R<=d?u=R:m=d*e.reserveA/e.reserveB}if(m===0n||u===0n)throw new c("Liquidity amounts round to zero at the pool reserve ratio.");let x=B(n.amountAMin,m,"amountAMin"),C=B(n.amountBMin,u,"amountBMin");v.push(s.approval(i,h,o.toString(),f),s.approval(a,h,d.toString(),f)),b=U({abi:E,functionName:"addLiquidity",args:[i,a,o,d,x,C,r,l]})}else{if(e.pair===g||e.supply===0n)throw new c("No Uniswap v2 liquidity exists for this pair.");let o=n.liquidity==="all"?e.balance:y(n.liquidity,"liquidity");if(o===0n||o>e.balance)throw new c("Removal exceeds the wallet LP token balance or is zero.");let[d,m]=await Promise.all([i,a].map(C=>A.readContract({address:C,abi:$,functionName:"balanceOf",args:[e.pair]}))),u=B(n.amountAMin,o*d/e.supply,"amountAMin"),x=B(n.amountBMin,o*m/e.supply,"amountBMin");v.push(s.approval(e.pair,h,o.toString(),f)),b=U({abi:E,functionName:"removeLiquidity",args:[i,a,o,u,x,r,l]})}return v.push(s.unsignedTx({to:h,data:b,value:"0",chainId:f,description:`${t} Uniswap v2 liquidity for ${i}/${a}; recipient ${r}; deadline ${l}.`})),T(s,v,r,`${t==="add"?"Add":"Remove"} v2 liquidity. Review exact approvals, token minimums and wallet recipient. The first deposit sets the price; v2 locks MINIMUM_LIQUIDITY permanently.`)};return{tools:["pool","add","remove"].map(t=>({name:`uniswap_v2_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["tokenA","tokenB",...t==="add"?["amountADesired","amountBDesired"]:t==="remove"?["liquidity"]:[]],properties:t==="pool"?{tokenA:{...k,description:"Address of the first ERC-20 token."},tokenB:{...k,description:"Address of the second ERC-20 token."}}:H},execute:(n,r)=>p(t,n,r)}))}}export{_ as a,h as b,F as c,N as d,E as e,z as f,J as g};
@@ -0,0 +1 @@
1
+ import{a as l}from"./43LI5NKJ.js";import{a as F}from"./66F5ZH34.js";import{g as D}from"./NWNYJ26T.js";import{b as U}from"./IX3GZMTM.js";import{b as c}from"./TI727O2H.js";import{a as w}from"./XSD5NL7J.js";import{encodeFunctionData as A,getAddress as S,parseAbi as _}from"viem";var N={address:S("0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"),symbol:"NET",decimals:9,chainId:c},r={address:S("0xb773ec2C326B7f98a5a83fc098825492F020a4c7"),symbol:"sNET",decimals:9,chainId:c},u={address:S("0x63C12667638f2Ae6fC6ae09B43D98Ec84a8586eA"),symbol:"wsNET",decimals:18,chainId:c},i=S("0xB078cc304A0B264C5F3680DC0488954ACcd02E87"),k=S("0xA1ee052EC32532304a7522bd9A4b594eC28fF1b1"),tt=[i,u.address,k],p=_(["function net() view returns (address)","function sNet() view returns (address)","function warmupEpochs() view returns (uint256)","function epoch() view returns (uint64 length,uint64 number,uint64 end,uint256 distribute)","function warmup(address) view returns (uint256 gons,uint64 releaseEpoch)","function totalStaked() view returns (uint256)","function enabled() view returns (bool)","function claim(address to) returns (uint256)","function rebase()","function stake(address to, uint256 amount) returns (uint256)","function unstake(address to, uint256 amount) returns (uint256)"]),E=_(["function sNet() view returns (address)","function wrap(uint256 sNetAmount) returns (uint256)","function unwrap(uint256 wsAmount) returns (uint256)","function sNetToWs(uint256 sNetAmount) view returns (uint256)","function wsToSNet(uint256 wsAmount) view returns (uint256)"]),$=_(["function net() view returns (address)","function sNet() view returns (address)","function staking() view returns (address)","function wsNet() view returns (address)","function zap(uint256 netAmount) returns (uint256)"]),W=_(["function balanceOf(address owner) view returns (uint256)","function balanceForGons(uint256) view returns (uint256)"]),z="The expected output is a chain-read estimate; these calls encode no minimum output. No transaction was sent.",O=o=>({description:`${o.symbol} amount in base units (${o.symbol} has ${o.decimals} decimals; "${"1".padEnd(o.decimals+1,"0")}" = 1 ${o.symbol}), or "max" for the whole wallet balance.`,anyOf:[F(`Positive ${o.symbol} amount in integer base units (${o.decimals} decimals).`),{const:"max",description:`The fresh full ${o.symbol} wallet balance.`}]}),et=o=>{async function v(e){try{return await e()}catch(t){throw new w(o.plainError(t))}}function y(e,t){if(Object.keys(e).some(n=>!t.includes(n)))throw new w("Unsupported NetNet staking argument. Use the fields in the tool schema.")}async function f(e=!1){let t=o.clientFor(c);if(await t.getChainId()!==c)throw new w("NetNet staking requires chain 4663.");let n=[t.readContract({address:i,abi:p,functionName:"net"}),t.readContract({address:i,abi:p,functionName:"sNet"}),t.readContract({address:u.address,abi:E,functionName:"sNet"}),...e?[t.readContract({address:k,abi:$,functionName:"net"}),t.readContract({address:k,abi:$,functionName:"sNet"}),t.readContract({address:k,abi:$,functionName:"staking"}),t.readContract({address:k,abi:$,functionName:"wsNet"})]:[]],[s,a,d,...m]=await Promise.all(n),b=[N.address,r.address,r.address,...e?[N.address,r.address,i,u.address]:[]];if(![s,a,d,...m].every((T,q)=>typeof T=="string"&&D(T,b[q])))throw new w("NetNet staking contracts do not report the pinned NET, sNET and wsNET links.");return t}async function x(e,t){return o.clientFor(c).readContract({address:e.address,abi:W,functionName:"balanceOf",args:[t]})}async function C(e,t,n){let s=await x(t,n),a;if(e==="max")a=s;else{if(typeof e!="string")throw new w(`Provide an integer ${t.symbol} amount in base units, or "max".`);a=U(e)}if(a<=0n||a>=1n<<256n)throw new w(`This wallet has no ${t.symbol} to use; the amount must be positive.`);if(a>s)throw new w(`Insufficient ${t.symbol}: wallet holds ${s.toString()} base units, requested ${a.toString()}.`);return a}async function g(e,t,n,s){let a=await o.preview(e,t),d=a.changes.map(({token:m,amount:b})=>{let T=b.startsWith("-");return`${T?"-":"+"}${o.formatAmount(T?b.slice(1):b,m.decimals)} ${m.symbol}`}).join(", ");return{txs:e,preview:a,expectedOutput:n,summary:`${s} ${a.summary} ${d?`Estimated changes: ${d}. `:""}${z}`}}let h=(e,t,n)=>o.unsignedTx({to:e,data:t,value:"0",chainId:c,description:n});async function j(e,t){if(y(e,["amount","wrap"]),l(t),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new w("wrap must be a boolean.");let n=await f(e.wrap===!0);if(e.amount==="max")throw new w("Provide an exact NET amount in base units to stake.");let s=await n.readContract({address:i,abi:p,functionName:"warmupEpochs"});if(s!==0n&&e.wrap===!0)throw new w("NetNet warmup prevents immediate Zap wrapping; stake directly, then claim matured sNET before wrapping.");let a=await C(e.amount,N,t),d=o.formatAmount(a.toString(),N.decimals);if(e.wrap===!0){let m=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[a]});return g([o.approval(N.address,k,a.toString(),c),h(k,A({abi:$,functionName:"zap",args:[a]}),`Stake ${d} NET and wrap it into wsNET with NetNet's Zap.`)],t,{token:u,amount:m.toString()},`Approve exactly ${d} NET, then stake and wrap it into wsNET in one call.`)}return g([o.approval(N.address,i,a.toString(),c),h(i,A({abi:p,functionName:"stake",args:[S(t),a]}),`Stake ${d} NET into sNET.`)],t,{token:r,amount:s===0n?a.toString():"0"},s===0n?`Approve exactly ${d} NET, then stake it 1:1 into rebasing sNET.`:`Approve exactly ${d} NET and stake it into a ${s}-epoch warmup. No immediate sNET receipt; netnet_claim_stake releases matured sNET. Another stake resets your release epoch.`)}async function B(e,t){y(e,["amount"]),l(t),await f();let n=await C(e.amount,r,t),s=o.formatAmount(n.toString(),r.decimals);return g([o.approval(r.address,i,n.toString(),c),h(i,A({abi:p,functionName:"unstake",args:[S(t),n]}),`Unstake ${s} sNET into NET.`)],t,{token:N,amount:n.toString()},`Approve exactly ${s} sNET, then unstake it 1:1 into NET.`)}async function L(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,r,t),a=o.formatAmount(s.toString(),r.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[s]});return g([o.approval(r.address,u.address,s.toString(),c),h(u.address,A({abi:E,functionName:"wrap",args:[s]}),`Wrap ${a} sNET into wsNET.`)],t,{token:u,amount:d.toString()},`Approve exactly ${a} sNET, then wrap it into non-rebasing wsNET, the Loopback collateral.`)}async function G(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,u,t),a=o.formatAmount(s.toString(),u.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});return g([h(u.address,A({abi:E,functionName:"unwrap",args:[s]}),`Unwrap ${a} wsNET into sNET.`)],t,{token:r,amount:d.toString()},`Unwrap ${a} wsNET into sNET; no approval is needed.`)}async function M(e){return v(async()=>{l(e);let t=await f(),[n,s]=await Promise.all([x(r,e),x(u,e)]),a=[];if(n>0n&&a.push({module:"netnet",id:`${c}:${r.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:n.toString()}],description:`${o.formatAmount(n.toString(),r.decimals)} sNET staked NET (rebasing; unstakes 1:1 into NET with netnet_unstake).`}),s>0n){let m=await t.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});a.push({module:"netnet",id:`${c}:${u.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:m.toString()}],description:`${o.formatAmount(s.toString(),u.decimals)} wsNET in the wallet, worth ${o.formatAmount(m.toString(),r.decimals)} sNET (NET 1:1) at the current index. wsNET posted as Morpho collateral appears under Morpho instead.`})}if(await t.readContract({address:i,abi:p,functionName:"warmupEpochs"})>0n){let m=await I({},e);BigInt(m.warmup.pendingSNet)>0n&&a.push({module:"netnet",id:`${c}:${i.toLowerCase()}:warmup`,chainId:c,assets:[{token:N,amount:m.warmup.pendingSNet}],description:`Pending NetNet warmup stake; releases sNET at epoch ${m.warmup.releaseEpoch}. Claim with netnet_claim_stake, then wrap or unstake.`})}return a})}async function I(e,t){y(e,[]),l(t);let n=await f(),[s,a,d,m,b]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.readContract({address:i,abi:p,functionName:"warmup",args:[t]}),n.readContract({address:i,abi:p,functionName:"warmupEpochs"}),n.readContract({address:i,abi:p,functionName:"totalStaked"}),n.readContract({address:i,abi:p,functionName:"enabled"})]),T=await n.readContract({address:r.address,abi:W,functionName:"balanceForGons",args:[a[0]]});return{chainId:c,staking:i,tokens:{net:N,sNet:r,wsNet:u},enabled:b,epoch:{length:s[0].toString(),number:s[1].toString(),end:s[2].toString(),distribute:s[3].toString()},warmupEpochs:d.toString(),totalStaked:m.toString(),warmup:{gons:a[0].toString(),releaseEpoch:a[1].toString(),pendingSNet:T.toString(),matured:a[0]>0n&&s[1]>=a[1]},caveat:"Warmup uses epoch numbers, not wall-clock time. Each rebase advances at most one due epoch; a claim also rebases once if due. A new stake resets the warmup release epoch."}}async function R(e,t){let n=await I(e,t);if(!n.enabled||!n.warmup.matured)throw new w("No matured NetNet warmup stake. Read netnet_staking_status and advance a due epoch before claiming.");return g([h(i,A({abi:p,functionName:"claim",args:[t]}),`Claim matured sNET to this wallet ${t}.`)],t,{token:r,amount:n.warmup.pendingSNet},"Claim matured NetNet staking warmup; rebase may change the sNET receipt.")}async function Z(e,t){y(e,[]),l(t);let n=await f(),[s,a,d]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.getBlock(),n.readContract({address:i,abi:p,functionName:"enabled"})]);if(!d||a.timestamp<s[2])throw new w("No enabled NetNet epoch is due to rebase.");return g([h(i,A({abi:p,functionName:"rebase"}),"Advance one due NetNet staking epoch and checkpoint its oracle.")],t,{token:r,amount:"0"},"Advance one due epoch. Distribution depends on live protocol state; this does not guarantee a reward.")}let P=(e,t,n)=>({name:e,inputSchema:{type:"object",properties:t,required:["amount"],additionalProperties:!1},execute:(s,a)=>v(()=>n(s,a))});return{positions:M,tools:[{name:"netnet_staking_status",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>I(e,t))},{name:"netnet_claim_stake",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>R(e,t))},{name:"netnet_rebase",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>Z(e,t))},P("netnet_stake",{amount:F("Positive NET amount in integer base units (9 decimals)."),wrap:{type:"boolean",default:!1,description:"Stake and wrap into wsNET in one call through NetNet's Zap."}},j),P("netnet_wrap",{amount:O(r)},L),P("netnet_unwrap",{amount:O(u)},G),P("netnet_unstake",{amount:O(r)},B)]}};export{N as a,r as b,u as c,i as d,k as e,tt as f,et as g};
@@ -1 +1 @@
1
- import{a as n,b as o,c,g as b,h as i}from"./2MZXTOZU.js";import{e as m,h as t}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";var p="LayerBank's setup no longer matches what Oak checked. Nothing was signed.";async function C(r,u){try{if(await r.getChainId()!==d)throw new a("LayerBank requires chain 4663.");let e=u??await r.getBlockNumber({cacheTime:0}),[l,k,f,s]=await Promise.all([r.readContract({address:o,abi:i,functionName:"POOL",blockNumber:e}),r.readContract({address:o,abi:i,functionName:"UNDERLYING_ASSET_ADDRESS",blockNumber:e}),r.readContract({address:o,abi:i,functionName:"decimals",blockNumber:e}),r.readContract({address:n,abi:b,functionName:"getReserveData",args:[c.address],blockNumber:e})]);if(!t(l,n)||!t(k,c.address)||f!==6||!m(s)||!t(s.aTokenAddress,o))throw new a(p);return s}catch(e){throw e instanceof a?e:new a("LayerBank setup could not be read. Please try again.")}}export{p as a,C as b};
1
+ import{a as n,b as o,c,g as b,h as i}from"./WAKZWSHB.js";import{e as m,h as t}from"./NWNYJ26T.js";import{b as d}from"./TI727O2H.js";import{a}from"./XSD5NL7J.js";var p="LayerBank's setup no longer matches what Oak checked. Nothing was signed.";async function C(r,u){try{if(await r.getChainId()!==d)throw new a("LayerBank requires chain 4663.");let e=u??await r.getBlockNumber({cacheTime:0}),[l,k,f,s]=await Promise.all([r.readContract({address:o,abi:i,functionName:"POOL",blockNumber:e}),r.readContract({address:o,abi:i,functionName:"UNDERLYING_ASSET_ADDRESS",blockNumber:e}),r.readContract({address:o,abi:i,functionName:"decimals",blockNumber:e}),r.readContract({address:n,abi:b,functionName:"getReserveData",args:[c.address],blockNumber:e})]);if(!t(l,n)||!t(k,c.address)||f!==6||!m(s)||!t(s.aTokenAddress,o))throw new a(p);return s}catch(e){throw e instanceof a?e:new a("LayerBank setup could not be read. Please try again.")}}export{p as a,C as b};
@@ -1 +1 @@
1
- import{q as m}from"./XL3LLGIR.js";import{c as u,f as h}from"./C5ZZAYXD.js";import{d as p,f}from"./OLSP46ZD.js";import{i as g,j as k}from"./KVFZKPJT.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
1
+ import{i as g,j as k}from"./B2HSLY5F.js";import{d as p,f}from"./K4P5VYDP.js";import{q as m}from"./XEBMS5KU.js";import{c as u,f as h}from"./MI5HZDMH.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
@@ -0,0 +1 @@
1
+ import{a as y,b as N}from"./5TUXSOMI.js";import{b as q}from"./5RXALTDT.js";import{a as s,e as k}from"./XSD5NL7J.js";function O(t){return t===404||t===410?`The service returned HTTP ${t}: it has no record of that request, so trying again will not help.`:`The service returned HTTP ${t}. Please try again.`}var b=class extends s{constructor(n){super(O(n.status));this.response=n}response};function m(){return new s("The request was cancelled.")}async function g(t,r){if(r.aborted)throw m();await new Promise((n,c)=>{let o=setTimeout(()=>{r.removeEventListener("abort",w),n()},t),w=()=>{clearTimeout(o),r.removeEventListener("abort",w),c(m())};r.addEventListener("abort",w,{once:!0})})}function L(t,r){if(t===null)return r;if(/^\d+(\.\d+)?$/.test(t))return Number(t)*1e3;let n=Date.parse(t);return Number.isFinite(n)?Math.max(0,n-Date.now()):r}function J(t={}){let r=t.fetch??globalThis.fetch,n=t.timeoutMs??1e4,c=t.retries??2,u=t.retryDelayMs??250,o=t.maxRetryDelayMs??3e4;if(!Number.isInteger(c)||c<0||c>10||!Number.isFinite(n)||n<=0||n>2147483647||!Number.isFinite(u)||u<0||!Number.isFinite(o)||o<0||o>2147483647)throw new s("Provide finite timeout and retry bounds, with 0 to 10 retries.");return async(w,_)=>{let l=new Request(w,{..._,redirect:"error"}),D=q(),i=D?AbortSignal.any([l.signal,D]):l.signal,f=N(r,l.url),j=l.method==="GET"||l.method==="HEAD";for(let p=0;;p++){if(i.aborted)throw m();if(f){let e=Date.now()+2e3,h=f.reserve();for(h>0&&await g(h,i);;){if(i.aborted)throw m();if(Date.now()>e)throw new y(f.label,1);let a=f.dispatchDelay();if(a===0)break;if(Date.now()+a>e)throw new y(f.label,a/1e3);await g(a,i)}}if(i.aborted)throw m();let T=new AbortController,M=()=>T.abort();i.addEventListener("abort",M,{once:!0});let E=!1,A=setTimeout(()=>{E=!0,T.abort()},n),P;try{let e=await r(l.clone(),{signal:T.signal});if(e.redirected)throw await e.body?.cancel(),new s("The request failed. Please try again.");if(e.ok){let h=await e.text();if(l.method!=="HEAD"&&e.status!==204&&e.status!==205){let a=l.headers.get("accept")?.toLowerCase(),d=e.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase(),v=d?.startsWith("text/"),R=a?.split(",").some(x=>x.trim().startsWith("text/"));if(!R&&a?.split(",").some(x=>/(?:application\/json|\+json)(?:\s*;.*)?$/.test(x.trim()))||d==="application/json"||d?.endsWith("+json")||!v&&!R)try{JSON.parse(h)}catch{throw new s("The service returned malformed JSON.")}}return new Response(h||null,{status:e.status,statusText:e.statusText,headers:e.headers})}else{let h=e.status===429||e.status>=500,a=u*2**p*(.5+Math.random()),d=Math.max(a,L(e.headers.get("Retry-After"),a));if(e.status===429&&f?.backoff(d),!j||!h||p>=c||d>o){if(e.status===429)throw await e.body?.cancel(),new y(f?.label??"The service",Math.max(1,d/1e3));let v=await e.text();throw new b(new Response(v||null,{status:e.status,statusText:e.statusText,headers:e.headers}))}await e.body?.cancel(),P=d}}catch(e){throw i.aborted?m():E?new s("The request timed out. Please try again."):e instanceof b?e:new s(k(e))}finally{clearTimeout(A),i.removeEventListener("abort",M)}await g(P,i)}}}async function $(t,r,n,c){let u=await t(r,n);if(!u.ok)throw new s(O(u.status));let o;try{o=await u.json()}catch{throw new s("The service returned malformed JSON.")}try{if(c(o))return o}catch{}throw new s("The service returned an unexpected response.")}export{b as a,J as b,$ as c};
@@ -1 +1 @@
1
- import{c as a}from"./PAY5PD4H.js";import{createHash as c}from"node:crypto";async function u(i,d){let e;try{e=await a(d,{token:i})}catch{e={status:"unchecked",reason:"unsupported_token"}}let n="reason"in e&&["invalid_signature","identity_or_scope_mismatch","bundle_mismatch","record_mismatch"].includes(e.reason),t=n||e.status==="verified"&&"verdict"in e&&e.verdict==="flagged"?"flagged":e.status==="verified"&&"verdict"in e&&e.verdict==="clean_by_rules"?"verified metadata":"no current verdict",r=`wormhole-token-${c("sha256").update(JSON.stringify({token:i,evidence:e})).digest("hex")}`;return{verdict:t,sentence:`Agent Wormhole: ${t} (${n?"metadata evidence failed verification":t==="flagged"?"the signed metadata snapshot was flagged":t==="verified metadata"?"signed snapshot checked; current displayed text is not bound":"a current signed snapshot could not be verified"}). This is not proof of safety.`,evidenceBlockId:r,evidence:e}}export{u as a};
1
+ import{c as a}from"./BX46C5ZP.js";import{createHash as c}from"node:crypto";async function u(i,d){let e;try{e=await a(d,{token:i})}catch{e={status:"unchecked",reason:"unsupported_token"}}let n="reason"in e&&["invalid_signature","identity_or_scope_mismatch","bundle_mismatch","record_mismatch"].includes(e.reason),t=n||e.status==="verified"&&"verdict"in e&&e.verdict==="flagged"?"flagged":e.status==="verified"&&"verdict"in e&&e.verdict==="clean_by_rules"?"verified metadata":"no current verdict",r=`wormhole-token-${c("sha256").update(JSON.stringify({token:i,evidence:e})).digest("hex")}`;return{verdict:t,sentence:`Agent Wormhole: ${t} (${n?"metadata evidence failed verification":t==="flagged"?"the signed metadata snapshot was flagged":t==="verified metadata"?"signed snapshot checked; current displayed text is not bound":"a current signed snapshot could not be verified"}). This is not proof of safety.`,evidenceBlockId:r,evidence:e}}export{u as a};
@@ -0,0 +1 @@
1
+ import{a as K}from"./MSRCJ2BS.js";import{b as Y,d as Z,e as Q}from"./V74F6IDY.js";import{a as J}from"./JDSSYT6R.js";import{a as W,c as x,d as B,h as F,i as E,j as L}from"./VVJO6OYK.js";import{a as P}from"./IBL6TL2Q.js";import{ea as z,ja as H}from"./HHYE42JG.js";import{k as j}from"./UVAR6BHU.js";import{j as M}from"./QLFPAN6S.js";import{a as $}from"./IOYRL6AY.js";import{e as O,h as U}from"./NWNYJ26T.js";import{a as v}from"./XSD5NL7J.js";import{erc20Abi as X,formatUnits as G,parseAbiItem as q}from"viem";var ee=q("event CreateVaultV2(address indexed caller,address indexed owner,bytes32 salt,address indexed vault)"),te=r=>H("unverified",{...r?{vaultLabel:r}:{}});function ae(r){if(!O(r)||!O(r.chain)||r.chain.id!==4663||!Array.isArray(r.contracts)||!Array.isArray(r.markets)||r.contracts.length>1e3||r.markets.length>1e3)throw new v("Borro vault discovery returned an unreadable candidate list.");let i=[...r.contracts.filter(O).filter(e=>e.name==="BorroUSDGVault").map(e=>e.address),...r.markets.filter(O).map(e=>O(e.vault)?e.vault.address:void 0)];return[...new Set(i.map(x))]}function se(r){return r.sort((i,e)=>+(e.symbol==="USDG")-+(i.symbol==="USDG")||0)}var re=6e4;function oe(r,i={}){let e=i.resolveAllowedAsset??E(i.officialStockTokens),g=L({resolveAllowedAsset:e}),S=new WeakMap,A=s=>{let t=S.get(s);return t||(t={},S.set(s,t)),t},m=s=>{if(s?.aborted)throw new v("Borro read was cancelled.")};async function h(s,t,u){let c=A(s);if(c.inventory&&Date.now()<c.inventory.expiresAt)return structuredClone(c.inventory);let a={items:[],sources:[],incomplete:!1,warnings:[],expiresAt:0},o=new Map;m(u);try{for(let l of ae(await Y(r.http,"contracts",u)))o.set(l.toLowerCase(),{vault:l});a.sources.push("contracts.json")}catch{a.incomplete=!0,a.warnings.push("Borro candidate discovery is unavailable; this inventory may be incomplete.")}if(i.factoryEvents!==!1)try{let l=new Map;for(let p=BigInt(P.factory.fromBlock);p<=t;p+=10000000n){m(u);let k=p+9999999n<t?p+9999999n:t,y=await s.getLogs({address:P.factory.address,event:ee,fromBlock:p,toBlock:k,strict:!0});if(y.length>1e3)throw new v("Borro factory inventory exceeds the read limit.");for(let d of y){let n=x(d.args.vault);if(d.removed||!U(d.address,P.factory.address)||d.blockNumber===null||d.blockNumber<p||d.blockNumber>k||l.has(n.toLowerCase()))throw new v("Borro factory events are unreadable.");l.set(n.toLowerCase(),{vault:n,block:d.blockNumber})}if(l.size>1e3)throw new v("Borro factory inventory exceeds the read limit.")}for(let[p,k]of l)o.set(p,k);a.sources.push("factory-events")}catch{a.incomplete=!0,a.warnings.push("Borro factory discovery is unavailable; vault creation dates or inventory may be incomplete.")}return m(u),a.items=[...o.values()],a.expiresAt=Date.now()+re,a.incomplete||(c.inventory=structuredClone(a)),a}let w=async(s,t={})=>{m(t.signal);let u=await F(s),c=A(s);if(!t.wallet&&c.verified&&Date.now()<c.verified.expiresAt)return structuredClone(c.verified.result);let a=await h(s,u,t.signal),o={vaults:[],refused:[],sources:a.sources,incomplete:a.incomplete,warnings:a.warnings,measuredAtBlock:u.toString()},l=a.items;if(t.heldOnly){if(!t.wallet)throw new v("Provide a wallet for Borro holdings.");m(t.signal);let y=l.length?await s.multicall({allowFailure:!1,batchSize:0,contracts:l.map(({vault:d})=>({address:d,abi:X,functionName:"balanceOf",args:[t.wallet]})),blockNumber:u}):[];if(!Array.isArray(y)||y.length!==l.length)throw new v("Borro share balances could not be read completely. Please try again.");o.shareBalances=l.map((d,n)=>({vault:d.vault,amount:B(y[n]).toString()})),l=l.filter((d,n)=>BigInt(o.shareBalances[n].amount)>0n)}m(t.signal);let p=e;if(l.length&&!i.resolveAllowedAsset&&!i.officialStockTokens)try{p=E(await M({http:r.http,allowAmbiguousSymbols:!0}))}catch{o.incomplete=!0,o.warnings.push("Official stock identities could not be checked; held-share exits remain available by vault address.")}let k=L({resolveAllowedAsset:p});for(let y=0;y<l.length;y+=4){m(t.signal);let d=await Promise.all(l.slice(y,y+4).map(async n=>{try{let b=await k(s,n.vault,t.wallet?"withdraw":"deposit",{blockNumber:u,...t.wallet?{wallet:t.wallet}:{}});if(n.block!==void 0)try{let V=await s.getBlock({blockNumber:n.block}),f=B(V.timestamp);f<=8640000000000n&&V.number===n.block&&(b.deployedAt=new Date(Number(f)*1e3).toISOString())}catch{}return{facts:b}}catch{return{rejected:{vault:n.vault,reason:te(n.vault)}}}}));for(let n of d)n.facts&&o.vaults.push(n.facts),n.rejected&&o.refused.push(n.rejected)}return m(t.signal),se(o.vaults),!t.wallet&&!o.incomplete&&(c.verified={result:structuredClone(o),expiresAt:a.expiresAt}),o},T=async(s,t={})=>{m(t.signal);let u=A(s),c;if(t.wallet||t.signal)c=await w(s,t);else{let a=u.pending??w(s);u.pending=a;try{c=structuredClone(await a)}finally{u.pending===a&&(u.pending=void 0)}}return m(t.signal),{...c,vaults:c.vaults.filter(a=>!t.asset||a.symbol.toUpperCase()===t.asset.toUpperCase())}};return{discoverVaults:T,verifyVault:g,resolveVault:async(s,t,u,c)=>{if(t.asset!==void 0&&!/^[A-Za-z0-9.$_-]{1,32}$/.test(t.asset))throw new v("Provide an official asset symbol.");if(t.vault){let y=await g(s,t.vault,u,{wallet:c});if(t.asset&&y.symbol.toUpperCase()!==t.asset.toUpperCase())throw new v("The asset symbol does not match the verified vault.");return y}if(!t.asset)throw new v("Provide an asset symbol or the vault address.");let a=await T(s,{asset:t.asset,...u==="withdraw"?{wallet:c}:{}});if(a.incomplete)throw new v("Borro discovery is incomplete. Provide the vault address for on-chain verification.");let o=a.vaults.length===1?a.vaults[0]:void 0;if(!o&&t.asset.toUpperCase()==="USDG"&&a.vaults.length>1){let y=await F(s);try{if(a.vaults.some(f=>!U(f.asset,P.assetRule.usdg.address)||f.assetDecimals!==6))throw new v("Unreadable USDG identity.");let d=a.vaults.filter(f=>f.setup.drift.length===0&&f.assetAllowed),n=await Promise.all(d.map(async f=>({facts:f,total:B(await s.readContract({address:f.vault,abi:W,functionName:"totalAssets",blockNumber:y}))})));n.sort((f,_)=>f.total>_.total?-1:f.total<_.total?1:0);let[b,V]=n;b&&b.total>=100000000n&&(!V||b.total>=V.total*10n)&&(o=b.facts)}catch{}}if(!o)throw new v(a.vaults.length?"More than one Borro vault uses this symbol. Provide the vault address.":"No verified Borro vault matched this asset. Provide the vault address to check it on chain.");let l=e;if(!i.resolveAllowedAsset&&!i.officialStockTokens&&!U(o.asset,P.assetRule.usdg.address))try{l=E(await M({http:r.http,allowAmbiguousSymbols:!0}))}catch{}let k=await L({resolveAllowedAsset:l})(s,o.vault,u,{wallet:c});if(k.symbol.toUpperCase()!==t.asset.toUpperCase())throw new v("The asset symbol does not match the verified vault.");return{...k,...o.deployedAt?{deployedAt:o.deployedAt}:{}}}}}var N=(r,i)=>({token:r,amount:i.toString()});async function ne(r,i,e){try{let[g,S]=await Promise.all([i.getGasPrice(),j("ETH",{client:i,http:r.http,chainId:4663,blockNumber:e})]);if(!/^\d+$/.test(S.usdE18)||BigInt(S.usdE18)<=0n||B(g)===0n)return{};let A=w=>Number(G(w*g*BigInt(S.usdE18)/10n**18n,18)),m=A($*2n),h=A($);return[m,h].every(w=>Number.isFinite(w)&&w>0)?{gasInUsd:m,gasOutUsd:h}:{}}catch{return{}}}async function ie(r,i,e,g,S=new Map,A){let m={vault:e.vault,verified:!0,symbol:e.symbol,vaultSymbol:e.vaultSymbol,setup:e.setup,measuredAtBlock:(A??BigInt(e.measuredAtBlock)).toString(),verifiedAtBlock:e.measuredAtBlock,...e.owner?{owner:e.owner}:{},...e.curator?{curator:e.curator}:{},...e.deployedAt?{deployedAt:e.deployedAt}:{}};try{let h=A??BigInt(e.measuredAtBlock),w={address:e.asset,symbol:e.symbol,decimals:e.assetDecimals,chainId:4663},T={address:e.vault,symbol:e.vaultSymbol,decimals:18,chainId:4663},R=(D,C,I=[])=>i.readContract({address:D,abi:[...W,...X],functionName:C,args:I,blockNumber:h}),[s,t,u,c,a,o,l]=await Promise.all([R(e.vault,"totalAssets"),R(e.vault,"performanceFee"),R(e.asset,"balanceOf",[g]),R(e.vault,"balanceOf",[g]),J(i,e,h),ne(r,i,h),i.getBlock({blockNumber:h})]),p=B(c),k=B(t);if(k>10n**18n)throw new v("Borro performance fee is unreadable.");let y=B(await R(e.vault,"convertToAssets",[p])),d={};if(e.owner)try{let[D,C]=await Promise.all([R(e.owner,"getThreshold"),R(e.owner,"getOwners")]),I=B(D);if(!Array.isArray(C)||C.length>1e3||new Set(C.map(x)).size!==C.length||I<1n||I>BigInt(C.length))throw new v("Unreadable group wallet.");d={safeThreshold:Number(I),safeOwners:C.length}}catch{}let n;if(U(e.asset,P.assetRule.usdg.address))try{let D=(await K(i,h)).rateBasePct;Number.isFinite(D)&&D>=0&&(n=D)}catch{}let b=Q(S,w,e.vault);if(l.number!==h)throw new v("Borro block timestamp could not be verified.");let V=Number(B(l.timestamp)),f=e.deployedAt?Date.parse(e.deployedAt)/1e3:void 0,_=z({symbol:e.symbol,kind:U(e.asset,P.assetRule.usdg.address)?"usdg":"stock",nowSeconds:V,...f===void 0?{}:{deployedAtSeconds:f},threshold:d.safeThreshold,owners:d.safeOwners,borroRatePct:b.apr===void 0?void 0:b.apr*100,feePct:Number(G(k,16)),layerbankRatePct:n,totalAmount:G(B(s),e.assetDecimals),readyAmount:a.readyBase===void 0?void 0:G(a.readyBase,e.assetDecimals),gasInUsd:o.gasInUsd===void 0?void 0:`up to $${o.gasInUsd.toFixed(4)}`,gasOutUsd:o.gasOutUsd===void 0?void 0:`up to $${o.gasOutUsd.toFixed(4)}`});return{...m,asset:w,shares:T,totalAssets:N(w,B(s)),performanceFeeWad:k.toString(),walletAssetBalance:N(w,B(u)),walletShares:N(T,p),walletShareValue:N(w,y),liquidityKind:a.kind,...a.readyBase===void 0?{}:{cashOnHand:N(w,a.readyBase)},...d,...o,...n===void 0?{}:{layerbankRateBasePct:n},...b.apr===void 0?{}:{apr:b.apr,rateSource:b.source},...b.readyToWithdraw?{vendorReadyToWithdraw:b.readyToWithdraw}:{},...f!==void 0&&f<=V?{ageSeconds:String(Math.floor(V-f))}:{},risk:{title:"Lending on Borro",text:_,source:"Oak"}}}catch{return{...m,error:"This Borro vault can't be read right now. Please try again."}}}async function ge(r,i,e={},g={},S){if(e.vault&&!g.resolveAllowedAsset&&!g.officialStockTokens)try{g={...g,officialStockTokens:await M({http:r.http,allowAmbiguousSymbols:!0})}}catch{}let A=r.clientFor(4663),m=S??oe(r,g);x(i);let h;if(e.vault){let s=await m.resolveVault(A,e,"deposit",i);h={vaults:[s],refused:[],sources:[],incomplete:!1,warnings:[],measuredAtBlock:s.measuredAtBlock}}else h=await m.discoverVaults(A,e.asset?{asset:e.asset}:{});let[w,T]=await Promise.all([Z(r.http),F(A)]),R=[];for(let s=0;s<h.vaults.length;s+=4)R.push(...await Promise.all(h.vaults.slice(s,s+4).map(t=>ie(r,A,t,i,w,T))));return{...h,vaults:R}}export{ae as a,se as b,oe as c,N as d,ie as e,ge as f};
@@ -0,0 +1 @@
1
+ import{d as R,e as z,g as V,h as k,k as I,l as S,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./3A2IKFTV.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as H}from"./43LI5NKJ.js";import{a as U}from"./66F5ZH34.js";import{c as _,e as K,g as p,h as G}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function x(t,c,s,g,v){let{chainId:b,registry:O}=k(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(k(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let M=await de({...c,signature:g});if(p(M,s))return!0}catch{}let v=t.clientFor(k(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},F=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function N(t,c){let{chainId:s,registry:g}=k(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return H(v),v}async function L(t,c,s){let{chainId:g,registry:v}=k(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return H(b),b}var Re=t=>{let{chainId:c,registry:s}=k(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return H(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=S(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([N(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:x(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object",description:"Internal continuation returned by the previous local signing round."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Internal hexadecimal signature supplied by local signing; never enter manually."},...te}},async(a,r)=>{let e=S(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await L(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let D=x(t,e,n,T,w);if(!await ue(t,D,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=x(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=x(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",F({agentId:R},["agentId"]),async(a,r)=>{let e=S(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await L(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),M=g("erc8004_transfer",F({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=S(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await N(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([N(t,e),L(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",F({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=S(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await N(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await L(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",F({operator:{..._,description:"Address granted or revoked permission to manage all agents owned by this wallet."},approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",F({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=S(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25,description:"Maximum owned agent IDs to return, from 1 to 50."}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let D of[...T].reverse()){let A=D.args.tokenId.toString();if(!(D.removed||m.has(A))&&(m.add(A),p(await N(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,M,ae,ne,re,oe]}};export{we as a,x as b,Re as c};
@@ -0,0 +1 @@
1
+ import{b as P,e as _,f as b}from"./O7HCEPQY.js";import{c as p,f as r,g as f,h as M,i as S,k as D,p as v,q}from"./46KWRAYK.js";import{b as I}from"./66F5ZH34.js";import{h as A}from"./NWNYJ26T.js";import{randomInt as $,randomUUID as H}from"node:crypto";import{isDeepStrictEqual as h}from"node:util";import{recoverTypedDataAddress as z}from"viem";function j(t){Object.keys(t).some(c=>!["subaccount","subaccountId","instructions","failureBehavior","continuation","signature"].includes(c))&&r("Use the Meridian batch schema."),D(t.subaccountId),(!Array.isArray(t.instructions)||t.instructions.length<1||t.instructions.length>20)&&r("A Meridian batch needs 1\u201320 instructions."),["ContinueOnFailure","StopOnFailure"].includes(String(t.failureBehavior))||r("Choose ContinueOnFailure or StopOnFailure explicitly; a batch does not roll back earlier results.");let u=new Set;return t.instructions.map(c=>{let e=f(c),a=e.kind;a!=="NEW"&&a!=="CANCEL"&&r("Each Meridian batch instruction needs kind NEW or CANCEL.");let o=a==="NEW"?P.order:["orderId","clientOrderId"];Object.keys(e).some(i=>i!=="kind"&&!o.includes(i))&&r("Unsupported Meridian batch instruction fields."),a==="CANCEL"&&e.orderId===void 0==(e.clientOrderId===void 0)&&r("Each batch cancellation needs exactly one orderId or clientOrderId.");for(let i of a==="NEW"?["clientOrderId"]:["orderId","clientOrderId"])if(e[i]!==void 0){let g=`${a}:${i}:${e[i]}`;u.has(g)&&r("Duplicate Meridian batch order identifiers."),u.add(g)}let d={subaccountId:t.subaccountId,...t.subaccount===void 0?{}:{subaccount:t.subaccount}};return a==="CANCEL"?{action:"cancel",kind:a,args:{...d,...e.orderId===void 0?{clientOrderIds:[e.clientOrderId]}:{orderIds:[e.orderId]}}}:{action:"order",kind:a,args:{...d,...Object.fromEntries(Object.entries(e).filter(([i])=>i!=="kind"))}}})}function O(t,u,c,e,a){let o=j(t);(!Number.isInteger(u)||u<0||u>=o.length)&&r("Invalid Meridian batch signing index.");let d=o[u],i=_(d.action,d.args,c,e,a);return d.kind==="CANCEL"&&(i.data={sender:c,subaccount:i.data.subaccount,nonce:e,...i.data.orderIds?{orderId:i.data.orderIds[0]}:{clientOrderId:i.data.clientOrderIds[0]}}),i}function ee(t,u,c,e,a,o){(e.stage!=="perps_batch_sign"||e.chainId!==p||!A(e.wallet,u)||typeof e.requestId!="string"||!e.requestId||typeof e.index!="number"||typeof e.signedAt!="number"||typeof e.expiresAt!="number"||e.expiresAt<=o||e.expiresAt>o+120||e.signedAt<o-120||e.signedAt>o+10)&&r("Meridian batch signing round is invalid or expired."),(a?a.requestId!==e.requestId||Number(a.index)+1!==e.index||a.expiresAt!==e.expiresAt:e.index!==0)&&r("Unexpected Meridian batch signing order.");let d=O(t,e.index,u,M(e.nonce,"the nonce",!1,64),e.signedAt),i=b(d,f(e.signatureTypes));(!h(e.request,i)||!h(e.data,d.data)||!h(c,[{kind:"typedData",request:i}]))&&r("Meridian batch signing fields differ from the local instruction.")}function te(t,u){let c=new Map;return{name:"meridian_perps_batch",inputSchema:{type:"object",additionalProperties:!1,required:["subaccountId","instructions","failureBehavior"],description:"Sign 1\u201320 NEW/CANCEL instructions locally and submit one batch. failureBehavior is explicit. Cancel/replace is not atomic. Reconcile each result and check fills after submission.",properties:{subaccountId:{type:"string",format:"uuid",description:"Subaccount identifier as a UUID."},subaccount:{type:"string",description:"ASCII subaccount name (default primary) or 0x-prefixed bytes32."},failureBehavior:{type:"string",enum:["ContinueOnFailure","StopOnFailure"],description:"ContinueOnFailure continues after a failed instruction; StopOnFailure stops the batch."},instructions:{type:"array",minItems:1,maxItems:20,items:{type:"object",properties:{kind:{type:"string",enum:["NEW","CANCEL"],description:"NEW places an order; CANCEL cancels one order."},quantity:I('Product base-asset quantity in D9 base units (9 decimals): "1000000000" = 1 base asset; "0" only for a full close.'),price:I('Limit price in quote-token D9 base units per base asset (9 decimals): "1000000000" = 1 quote token per base asset.'),stopPrice:I('Trigger price in quote-token D9 base units per base asset (9 decimals): "1000000000" = 1 quote token per base asset.'),expiresAt:I("Order expiry in Unix seconds, as a decimal string.")},additionalProperties:!0},description:"Ordered NEW or CANCEL instructions to sign and submit."},continuation:{type:"object",description:"Internal continuation returned by the previous local signing round."},signature:{type:"string",description:"Internal hexadecimal signature supplied by local signing; never enter manually."}}},execute:async(e,a)=>{let o=S(a),d=j(e);d.forEach((s,n)=>O(e,n,o,"0",Math.floor(Date.now()/1e3)));let i=s=>({steps:[{kind:"typedData",request:structuredClone(s.round.request)}],continuation:structuredClone(s.round),summary:`Review and confirm Meridian batch instruction ${Number(s.round.index)+1}/${d.length}. D9 signed quantities and prices have 9 decimals. Every instruction is separately signed; no API submission occurs until all signatures are collected. ${e.failureBehavior}; earlier successful results are never rolled back.`});if(e.continuation!==void 0){let s=f(e.continuation),n=c.get(String(s.requestId));(!n||!A(s.wallet,o)||!h(n.round,s)||!h(n.args,Object.fromEntries(Object.entries(e).filter(([l])=>!["continuation","signature"].includes(l)))))&&r("Meridian batch continuation is lost, expired or changed. Check orders before restarting."),c.delete(String(s.requestId));let L=s.request;(typeof s.expiresAt!="number"||s.expiresAt<=Math.floor(Date.now()/1e3))&&(clearTimeout(n.timer),r("Meridian batch expired. Check orders before restarting."));try{(typeof e.signature!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e.signature)||!A(await z({...L,signature:e.signature}),o))&&r("The local Meridian batch signature does not match this wallet.");let l=Number(s.index),R=n.values[l];if(n.signed.push({type:d[l].kind,data:R.data,signature:e.signature}),l+1<d.length){let m=n.values[l+1],U=f(s.signatureTypes);return n.round={...s,index:l+1,nonce:m.message.nonce,data:m.data,request:b(m,U),review:n.reviews[l+1]},c.set(String(s.requestId),n),i(n)}clearTimeout(n.timer),(t.network==="testnet"||await t.clientFor(p).getChainId()!==p)&&r("Meridian batch requires chain 4663.");let W=await q(t);return n.values.some(m=>!h(b(m,W).types,b(m,f(s.signatureTypes)).types))&&r("Meridian batch signing types changed; check orders before restarting."),{result:await v(t,"/v1/order/batch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({failureBehavior:e.failureBehavior,instructions:n.signed})}),chainId:p,summary:"Meridian batch API responded. Inspect every instruction result and subsequent order/fill state. HTTP success is not atomic success or proof of execution."}}catch(l){throw clearTimeout(n.timer),l}}e.signature!==void 0&&r("Meridian batch signatures require an active local signing round."),c.size>=1e3&&r("Too many pending Meridian batches. Try again shortly."),(t.network==="testnet"||await t.clientFor(p).getChainId()!==p)&&r("Meridian batch requires chain 4663.");let g=await q(t),y=f(await v(t,"/v1/time")).time;(typeof y!="number"||!Number.isSafeInteger(y)||Math.abs(y-Date.now())>3e4)&&r("Synchronize the clock before signing a Meridian batch.");let C=Math.floor(y/1e3),B=BigInt(y)*1000000n+BigInt($(999980)),k=d.map((s,n)=>O(e,n,o,(B+BigInt(n)).toString(),C)),x=[];for(let[s,n]of d.entries())x.push(await u(n.action,n.args,o,k[s].data));let w=H(),T=k[0],F={stage:"perps_batch_sign",chainId:p,wallet:o,requestId:w,index:0,signedAt:C,expiresAt:C+90,nonce:T.message.nonce,data:T.data,request:b(T,g),signatureTypes:{TradeOrder:g.TradeOrder,CancelOrder:g.CancelOrder},review:x[0]},E=setTimeout(()=>c.delete(w),9e4);E.unref?.();let N={args:structuredClone(e),round:F,values:k,reviews:x,signed:[],timer:E};return c.set(w,N),i(N)}}}export{ee as a,te as b};
@@ -0,0 +1 @@
1
+ import{a as x}from"./G2LAO23N.js";import{c as O,d as z,e as g}from"./HS5HWBMU.js";import{a as m}from"./66F5ZH34.js";import{c as u,f as B,g as p,i as D}from"./NWNYJ26T.js";import{b as H}from"./TI727O2H.js";import{a as i}from"./XSD5NL7J.js";import{decodeEventLog as W,encodeFunctionData as Q,getAddress as V,hashStruct as Y,isHex as J,parseAbi as Z,zeroAddress as k}from"viem";var ee="struct HookrSwapIntent { PoolKey key; bool zeroForOne; int128 amountSpecified; uint128 amountBound; uint160 sqrtPriceLimitX96; address recipient; address relayer; uint256 relayerFee; address engagement; uint256[] campaigns; uint256 nonce; uint256 deadline; }",I=Z(["struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }",ee,"function execute(HookrSwapIntent intent, address owner, bytes signature) returns (uint256 amountIn, uint256 amountOut)","function hashIntent(HookrSwapIntent intent) pure returns (bytes32)","function pullOf(HookrSwapIntent intent) view returns (address token, uint256 amount, bool feeFromInput)","function isNonceUsed(address owner, uint256 intentNonce) view returns (bool)","function router() view returns (address)","function registry() view returns (address)","function permit2() view returns (address)","event IntentExecuted(bytes32 indexed intentHash,address indexed owner,address indexed relayer,bytes32 poolId,uint256 amountIn,uint256 amountOut,uint256 relayerFee,bool feeFromInput)"]),te={PoolKey:[{name:"currency0",type:"address"},{name:"currency1",type:"address"},{name:"fee",type:"uint24"},{name:"tickSpacing",type:"int24"},{name:"hooks",type:"address"}],HookrSwapIntent:[{name:"key",type:"PoolKey"},{name:"zeroForOne",type:"bool"},{name:"amountSpecified",type:"int128"},{name:"amountBound",type:"uint128"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"recipient",type:"address"},{name:"relayer",type:"address"},{name:"relayerFee",type:"uint256"},{name:"engagement",type:"address"},{name:"campaigns",type:"uint256[]"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},ne=V("0x000000000022D473030F116dDEE9F6B43aC78BA3"),P={key:{type:"object",description:"Uniswap v4 PoolKey of the pool to swap in.",properties:{currency0:{...u,description:"Lower-sorted pool token address; the zero address is native ETH, which cannot be the relay input."},currency1:{...u,description:"Higher-sorted pool token address; must be greater than currency0."},fee:{type:"integer",description:x.pips()},tickSpacing:{type:"integer",description:"Pool tick spacing, a positive integer."},hooks:{...u,description:"Address of the pool hook contract."}},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},zeroForOne:{type:"boolean",description:"True swaps currency0 for currency1 (input is currency0); false swaps currency1 for currency0."},amountSpecified:{type:"string",pattern:"^-?[0-9]+$",description:'Signed amount in base units: negative = exact input of the input token, positive = exact output of the output token. Example: "-1000000" = 1 USDG in, if USDG (6 decimals) is the input.'},amountBound:{...m(),description:"Slippage bound in base units: minimum output token if amountSpecified is negative, maximum input token if positive. Must be nonzero; read that token's decimals."},sqrtPriceLimitX96:{...m(),description:"Swap price limit as a Q64.96 sqrt price, decimal string."},recipient:{...u,description:x.recipient("account that receives the swap output")},relayer:{...u,description:"Address of the relayer allowed to submit this intent (must be the submitting wallet), or the zero address for an open relay with no fee."},relayerFee:{...m(),description:"Fee paid to the relayer in base units of the fee token (the input token if charged on input, else the output token); read its decimals. Must be 0 for an open relay."},engagement:{...u,description:"Address of the Hookr engagement contract for campaign credit, or the zero address when campaigns is empty."},campaigns:{type:"array",items:m(),maxItems:8,description:"Up to eight campaign IDs (decimal strings) to credit; empty when engagement is the zero address."},nonce:{...m(),description:"Unique Permit2-style intent nonce of the trader, a decimal string; each nonce can execute once."},deadline:{...m(),description:"Intent expiry as a Unix seconds timestamp; the relay fails after this time."}},F={owner:{...u,description:x.recipient("trader who signed the intent and supplies the input funds")},signature:{type:"string",pattern:"^0x[0-9a-fA-F]+$",description:"The trader's Permit2 witness signature over the intent, as 0x-prefixed hex."},intent:{type:"object",description:"The complete trader-signed Hookr swap intent.",properties:P,required:Object.keys(P),additionalProperties:!1}};function N(n){return B(n,"Provide a complete trader-signed Hookr intent.")}function l(n,o=256,e=!1){if(typeof n!="string"||!/^-?\d+$/.test(n)||n.length>79)throw new i("Hookr intent amounts, nonce and deadline must be decimal base-unit strings.");let t=BigInt(n);if(e?t<=-(1n<<BigInt(o-1))||t>=1n<<BigInt(o-1):t<0n||t>=1n<<BigInt(o))throw new i("Hookr intent integer is outside its ABI range.");return t}function y(n){return D(n,"Provide valid Hookr intent addresses.")}function q(n,o){if(Object.keys(n).some(s=>!Object.hasOwn(F,s)))throw new i("Provide only owner, intent and the trader signature for Hookr relay.");let e=N(n.intent);if(Object.keys(e).some(s=>!Object.hasOwn(P,s)))throw new i("Hookr intent contains an undocumented field.");let t=N(e.key);if(Object.keys(t).some(s=>!["currency0","currency1","fee","tickSpacing","hooks"].includes(s))||typeof t.fee!="number"||!Number.isInteger(t.fee)||t.fee<0||t.fee>16777215||typeof t.tickSpacing!="number"||!Number.isInteger(t.tickSpacing)||t.tickSpacing<=0||t.tickSpacing>8388607||typeof e.zeroForOne!="boolean")throw new i("Provide a valid canonical v4 pool key and direction.");let a={currency0:y(t.currency0),currency1:y(t.currency1),fee:t.fee,tickSpacing:t.tickSpacing,hooks:y(t.hooks)};if(BigInt(a.currency0)>=BigInt(a.currency1))throw new i("Hookr pool currencies must sort strictly by address.");let r=y(n.owner);if(r===k||p(r,o))throw new i("Hookr relay requires another trader as owner; the relayer funds gas only.");if(!Array.isArray(e.campaigns)||e.campaigns.length>8)throw new i("Provide at most eight Hookr campaign IDs.");let c={key:a,zeroForOne:e.zeroForOne,amountSpecified:l(e.amountSpecified,128,!0),amountBound:l(e.amountBound,128),sqrtPriceLimitX96:l(e.sqrtPriceLimitX96,160),recipient:y(e.recipient),relayer:y(e.relayer),relayerFee:l(e.relayerFee),engagement:y(e.engagement),campaigns:e.campaigns.map(s=>l(s)),nonce:l(e.nonce),deadline:l(e.deadline)};if(c.amountSpecified===0n||c.amountBound===0n)throw new i("Hookr intent input/output amounts and bound must be nonzero.");if([k,g,O].some(s=>p(s,c.recipient)))throw new i("Hookr intent recipient is reserved.");if(c.relayer!==k&&!p(c.relayer,o)||c.relayer===k&&c.relayerFee!==0n)throw new i("Hookr intent names a different relayer or an open relay with a fee.");if(c.engagement===k!=(c.campaigns.length===0))throw new i("Hookr engagement and campaigns must be supplied together.");let f=c.zeroForOne?a.currency0:a.currency1;if(f===k)throw new i("Hookr Permit2 relay cannot pull native ETH input.");if(typeof n.signature!="string"||!J(n.signature,{strict:!0})||n.signature.length<4||n.signature.length%2!==0||n.signature.length>16386)throw new i("Provide the trader-signed Permit2 witness signature, never a private key.");let S=n.signature,w=Y({data:c,primaryType:"HookrSwapIntent",types:te});return{owner:r,intent:c,signature:S,input:f,intentHash:w}}function U(n,o){let{owner:e,intent:t,signature:a}=q(n,o);return{chainId:H,to:g,value:"0",data:Q({abi:I,functionName:"execute",args:[t,e,a]}),description:`Relay Hookr trader ${e} to recipient ${t.recipient}; relayer fee ${t.relayerFee} in pool quote currency. Relayer pays gas; owner supplies Permit2 funds.`}}function ue(n,o,e){let t=U(o,e);if(n.length!==1||n[0].chainId!==t.chainId||!p(n[0].to,t.to)||n[0].value!=="0"||!p(n[0].data,t.data))throw new i("Hookr relay calldata differs from the locally requested signed intent.")}function pe(n){return[{name:"hookr_relay",inputSchema:{type:"object",description:"Preview a trader-signed Permit2 swap for local human-confirmed submission. Relayer pays gas; the trader supplies input. No signature is created by this tool.",properties:F,required:Object.keys(F),additionalProperties:!1},execute:async(o,e)=>{let t=q(o,e),{owner:a,intent:r,signature:c,input:f,intentHash:S}=t,w=n.clientFor(H),s=await w.getBlock();if(typeof s.number!="bigint"||typeof s.timestamp!="bigint"||s.timestamp<=0n||s.timestamp>r.deadline)throw new i("Hookr signed intent expired or the chain timestamp is unavailable.");let h=(X,G=[])=>w.readContract({address:g,abi:I,functionName:X,args:G,blockNumber:s.number}),[j,d,_,K,$,L]=await Promise.all([h("hashIntent",[r]),h("pullOf",[r]),h("isNonceUsed",[a,r.nonce]),h("router"),h("registry"),h("permit2")]);if(j!==S||_!==!1||K!==O||$!==z||L!==ne)throw new i("Hookr intent hash, nonce or forwarder deployment is invalid. Ask the trader for a fresh signed intent.");if(!Array.isArray(d)||d.length!==3||typeof d[0]!="string"||!p(d[0],f)||typeof d[1]!="bigint"||typeof d[2]!="boolean")throw new i("Hookr Permit2 pull could not be verified.");let b=d[2],A=r.amountSpecified<0n?-r.amountSpecified:r.amountBound;if(d[1]!==A+(b?r.relayerFee:0n)||r.amountSpecified>0n&&!b&&r.relayerFee>r.amountSpecified)throw new i("Hookr Permit2 pull or output-side fee differs from the signed terms.");let C=await w.simulateContract({address:g,abi:I,functionName:"execute",args:[r,a,c],account:e,blockNumber:s.number}),[R,T]=C.result,E=r.amountSpecified<0n?r.amountBound:r.amountSpecified-(b?0n:r.relayerFee);if(R>A||T<E)throw new i("Hookr relay simulation did not satisfy the signed input/output bounds.");let v=[n.unsignedTx(U(o,e))],M=await n.preview(v,e);return{txs:v,preview:M,summary:v[0].description,intentHash:S,owner:a,recipient:r.recipient,relayer:e,inputToken:f,maximumPull:d[1].toString(),feeToken:b?f:r.zeroForOne?r.key.currency1:r.key.currency0,relayerFee:r.relayerFee.toString(),feeFromInput:b,minimumOutput:E.toString(),simulatedAmountIn:R.toString(),simulatedAmountOut:T.toString(),note:"Verify IntentExecuted in the receipt and your fee balance after submission."}}},{name:"hookr_relay_receipt",inputSchema:{type:"object",description:"Read the executed intent and fee from a mined Hookr relay receipt.",properties:{transactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hash of the mined relay transaction: 32 bytes, 0x followed by 64 hex digits."}},required:["transactionHash"],additionalProperties:!1},execute:async o=>{if(Object.keys(o).some(a=>a!=="transactionHash")||typeof o.transactionHash!="string"||!/^0x[0-9a-fA-F]{64}$/.test(o.transactionHash))throw new i("Provide a Hookr relay transactionHash.");let e=await n.clientFor(H).getTransactionReceipt({hash:o.transactionHash});if(e.status!=="success")throw new i("Hookr relay reverted. No fee is proven paid.");let t=e.logs.filter(a=>p(a.address,g)).flatMap(a=>{try{let r=W({abi:I,eventName:"IntentExecuted",topics:a.topics,data:a.data});return[{...r.args,amountIn:r.args.amountIn.toString(),amountOut:r.args.amountOut.toString(),relayerFee:r.args.relayerFee.toString()}]}catch{return[]}});if(!t.length)throw new i("Receipt contains no verified Hookr IntentExecuted event.");return{chainId:H,transactionHash:e.transactionHash,blockNumber:e.blockNumber.toString(),intents:t,note:"Event evidence at this mined block; check balances and finality."}}}]}export{I as a,q as b,U as c,ue as d,pe as e};
@@ -1,4 +1,4 @@
1
- import{a as I}from"./NKX3FE34.js";import{f as t,g as c,i as y}from"./46KWRAYK.js";import{a as m}from"./XSD5NL7J.js";var s={GetAccountBalance:{query:`query GetAccountBalance($address: Address!, $interval: TimeInterval!, $from: Int, $to: Int) {
1
+ import{c as I}from"./PEHXHQVA.js";import{f as n,g as l,i as y}from"./46KWRAYK.js";import{a as m}from"./XSD5NL7J.js";var f={GetAccountBalance:{query:`query GetAccountBalance($address: Address!, $interval: TimeInterval!, $from: Int, $to: Int) {
2
2
  account(address: $address) {
3
3
  statsHistory(interval: $interval, filter: { timestamp: { gte: $from, lte: $to } }) {
4
4
  nodes {
@@ -1114,4 +1114,4 @@ fragment ConditionGroupMetaFields on ConditionGroup {
1114
1114
  }
1115
1115
  }
1116
1116
  }
1117
- `,variables:{seller:{type:"Address!"},chainId:{type:"Int"},take:{type:"Int"}}}};function g(e,i){if(e==null){i.endsWith("!")&&t("Provide every required Meridian Predict query variable.");return}let o=i.replace(/!$/,"");o.startsWith("[")?((!Array.isArray(e)||e.length>250)&&t("Meridian Predict query lists support at most 250 entries."),e.forEach(d=>g(d,o.slice(1,-1)))):o==="Address"?y(e):o==="Bytes32"||o==="Bytes"?(typeof e!="string"||!(o==="Bytes32"?/^0x[0-9a-fA-F]{64}$/:/^0x(?:[0-9a-fA-F]{2})+$/).test(e))&&t("Provide a valid hexadecimal Meridian Predict identifier."):o==="Int"?(typeof e!="number"||!Number.isInteger(e)||e<-2147483648||e>2147483647)&&t("Provide GraphQL Int query variables as 32-bit integers."):o==="Boolean"?typeof e!="boolean"&&t("Provide boolean Meridian Predict query flags."):["QuestionFilter","QuestionOrder","IntRangeFilter"].includes(o)?c(e):(typeof e!="string"||!e||e.length>4096)&&t("Provide string or enum Meridian Predict query variables.")}var b=e=>({tools:[{name:"meridian_predict_read",inputSchema:{type:"object",additionalProperties:!1,required:[],description:"Omit operation to discover variable schemas locally. Run fixed official Predict app reads: competitions/rules/standings, historical predictions/trades, categories/tags/questions/odds, collateral transfers and account statistics. Follow pageInfo cursors and preserve filters. Indexed data can lag the chain.",properties:{operation:{type:"string",enum:Object.keys(s)},variables:{type:"object",description:"Exact variables of the selected fixed operation. Omitted wallet fields default to this wallet and chainId to 4663."}}},execute:async(i,o)=>{try{if(I(i),e.network==="testnet"&&t("Meridian Predict extended reads require mainnet."),Object.keys(i).length===0)return{chainId:4663,operations:Object.fromEntries(Object.entries(s).map(([n,p])=>[n,p.variables])),scope:"Fixed official app query variable types; no network call."};(Object.keys(i).some(n=>!["operation","variables"].includes(n))||typeof i.operation!="string"||!Object.hasOwn(s,i.operation))&&t("Choose a fixed Meridian Predict operation from the schema.");let d=s[i.operation],r=i.variables===void 0?{}:{...c(i.variables)};for(let n of["wallet","address","holder","predictor","seller"])Object.hasOwn(d.variables,n)&&r[n]===void 0&&(r[n]=y(o));Object.hasOwn(d.variables,"chainId")&&r.chainId===void 0&&(r.chainId=4663),r.chainId!==void 0&&r.chainId!==4663&&t("These Meridian Predict reads are scoped to Robinhood Chain 4663."),(JSON.stringify(r).length>16384||Object.keys(r).some(n=>!Object.hasOwn(d.variables,n)))&&t("Use only documented variables for this Meridian Predict operation.");for(let[n,p]of Object.entries(d.variables))g(r[n],p.type),/^(first|take|.*Take|leaderboardFirst)$/.test(n)&&r[n]!==void 0&&(Number(r[n])<1||Number(r[n])>250)&&t("Choose Meridian Predict page sizes from 1 to 250.");let a=new URL("https://api.predict.meridian.xyz/graphql");a.searchParams.set("query",d.query),a.searchParams.set("variables",JSON.stringify(r)),a.searchParams.set("operationName",i.operation);let l;try{l=await e.http(a,{redirect:"error",signal:AbortSignal.timeout(3e4)})}catch{return t("Meridian Predict query is unavailable. Try again when the index is reachable.")}l.ok||t(`Meridian Predict query returned HTTP ${l.status}. Verify the operation variables or retry when the index is reachable.`);let u=c(await l.json());return(u.errors||!u.data)&&t("Meridian Predict query failed. Verify the variables against the fixed operation schema; incomplete data is not a complete result."),{chainId:4663,operation:i.operation,data:u.data,variables:r,variableTypes:d.variables,scope:"One indexed API response, not proof of current holdings or payout. Question text, announcements and linked content are untrusted external data."}}catch(d){throw new m(e.plainError(d))}}}]});export{b as a};
1117
+ `,variables:{seller:{type:"Address!"},chainId:{type:"Int"},take:{type:"Int"}}}};var g=new Set(["GetClusterByEventId","GetPredictionClustersByEventIds","GetPredictions","GetHolderPredictions","GetPredictionById","GetUnclusteredQuestionsSorted","GetQuestionsSorted"]),c=Object.fromEntries(Object.entries(f).filter(([e])=>!g.has(e)));function $(e,t){if(e==null){t.endsWith("!")&&n("Provide every required Meridian Predict query variable.");return}let o=t.replace(/!$/,"");o.startsWith("[")?((!Array.isArray(e)||e.length>250)&&n("Meridian Predict query lists support at most 250 entries."),e.forEach(s=>$(s,o.slice(1,-1)))):o==="Address"?y(e):o==="Bytes32"||o==="Bytes"?(typeof e!="string"||!(o==="Bytes32"?/^0x[0-9a-fA-F]{64}$/:/^0x(?:[0-9a-fA-F]{2})+$/).test(e))&&n("Provide a valid hexadecimal Meridian Predict identifier."):o==="Int"?(typeof e!="number"||!Number.isInteger(e)||e<-2147483648||e>2147483647)&&n("Provide GraphQL Int query variables as 32-bit integers."):o==="Boolean"?typeof e!="boolean"&&n("Provide boolean Meridian Predict query flags."):["QuestionFilter","QuestionOrder","IntRangeFilter"].includes(o)?l(e):(typeof e!="string"||!e||e.length>4096)&&n("Provide string or enum Meridian Predict query variables.")}var F=e=>({tools:[{name:"meridian_predict_read",inputSchema:{type:"object",additionalProperties:!1,required:[],description:"Omit operation to discover variable schemas locally. Run fixed official Predict app reads: competitions/rules/standings, historical predictions/trades, categories/tags/questions/odds, collateral transfers and account statistics. Follow pageInfo cursors and preserve filters. Indexed data can lag the chain.",properties:{operation:{type:"string",enum:Object.keys(c),description:"Fixed Predict query operation name; omit to discover available operations and variable types."},variables:{type:"object",description:"Exact variables of the selected fixed operation. Omitted wallet fields default to this wallet and chainId to 4663."}}},execute:async(t,o)=>{try{if(I(t),e.network==="testnet"&&n("Meridian Predict extended reads require mainnet."),Object.keys(t).length===0)return{chainId:4663,operations:Object.fromEntries(Object.entries(c).map(([r,p])=>[r,p.variables])),scope:"Fixed official app query variable types; no network call."};typeof t.operation=="string"&&g.has(t.operation)&&n("This Meridian read isn't available in Oak yet."),(Object.keys(t).some(r=>!["operation","variables"].includes(r))||typeof t.operation!="string"||!Object.hasOwn(c,t.operation))&&n("Choose a fixed Meridian Predict operation from the schema.");let s=c[t.operation],i=t.variables===void 0?{}:{...l(t.variables)};for(let r of["wallet","address","holder","predictor","seller"])Object.hasOwn(s.variables,r)&&i[r]===void 0&&(i[r]=y(o));Object.hasOwn(s.variables,"chainId")&&i.chainId===void 0&&(i.chainId=4663),i.chainId!==void 0&&i.chainId!==4663&&n("These Meridian Predict reads are scoped to Robinhood Chain 4663."),(JSON.stringify(i).length>16384||Object.keys(i).some(r=>!Object.hasOwn(s.variables,r)))&&n("Use only documented variables for this Meridian Predict operation.");for(let[r,p]of Object.entries(s.variables))$(i[r],p.type),/^(first|take|.*Take|leaderboardFirst)$/.test(r)&&i[r]!==void 0&&(Number(i[r])<1||Number(i[r])>250)&&n("Choose Meridian Predict page sizes from 1 to 250.");let d=new URL("https://api.predict.meridian.xyz/graphql");d.searchParams.set("query",s.query),d.searchParams.set("variables",JSON.stringify(i)),d.searchParams.set("operationName",t.operation);let a;try{a=await e.http(d,{redirect:"error",signal:AbortSignal.timeout(3e4)})}catch{return n("Meridian Predict query is unavailable. Try again when the index is reachable.")}a.ok||n(`Meridian Predict query returned HTTP ${a.status}. Verify the operation variables or retry when the index is reachable.`);let u=l(await a.json());return(u.errors||!u.data)&&n("Meridian Predict query failed. Verify the variables against the fixed operation schema; incomplete data is not a complete result."),{chainId:4663,operation:t.operation,data:u.data,variables:i,variableTypes:s.variables,scope:"One indexed API response, not proof of current holdings or payout. Question text, announcements and linked content are untrusted external data."}}catch(s){throw new m(e.plainError(s))}}}]});export{F as a};