@oakagentkit/core 0.2.7 → 0.3.1

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 (508) hide show
  1. package/build/dist/api/addresses.d.ts +9 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/chain.d.ts +4 -0
  4. package/build/dist/api/chain.js +1 -1
  5. package/build/dist/api/history.js +1 -1
  6. package/build/dist/api/identity-link.js +1 -1
  7. package/build/dist/api/metadata.js +1 -1
  8. package/build/dist/api/modules/beefy/boosts.js +1 -1
  9. package/build/dist/api/modules/beefy/clm.d.ts +9 -0
  10. package/build/dist/api/modules/beefy/clm.js +1 -1
  11. package/build/dist/api/modules/beefy/guard.js +1 -1
  12. package/build/dist/api/modules/beefy/index.js +1 -1
  13. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  14. package/build/dist/api/modules/beefy/management.js +1 -1
  15. package/build/dist/api/modules/beefy/vaults.js +1 -1
  16. package/build/dist/api/modules/borro/abi.d.ts +54 -0
  17. package/build/dist/api/modules/borro/abi.js +1 -1
  18. package/build/dist/api/modules/borro/actions.d.ts +14 -1
  19. package/build/dist/api/modules/borro/actions.js +1 -1
  20. package/build/dist/api/modules/borro/checks.js +1 -1
  21. package/build/dist/api/modules/borro/copy.d.ts +10 -2
  22. package/build/dist/api/modules/borro/copy.js +1 -1
  23. package/build/dist/api/modules/borro/index.js +1 -1
  24. package/build/dist/api/modules/borro/liquidity.js +1 -1
  25. package/build/dist/api/modules/borro/pins.d.ts +30 -14
  26. package/build/dist/api/modules/borro/pins.js +1 -1
  27. package/build/dist/api/modules/borro/positions.js +1 -1
  28. package/build/dist/api/modules/borro/reader.js +1 -1
  29. package/build/dist/api/modules/borro/types.d.ts +1 -0
  30. package/build/dist/api/modules/chop/actions.js +1 -1
  31. package/build/dist/api/modules/chop/checks.js +1 -1
  32. package/build/dist/api/modules/chop/copy.js +1 -1
  33. package/build/dist/api/modules/chop/guard.js +1 -1
  34. package/build/dist/api/modules/chop/index.js +1 -1
  35. package/build/dist/api/modules/chop/pins.d.ts +13 -0
  36. package/build/dist/api/modules/chop/pins.js +1 -1
  37. package/build/dist/api/modules/chop/positions.js +1 -1
  38. package/build/dist/api/modules/chop/reader.js +1 -1
  39. package/build/dist/api/modules/clanker/extensions.js +1 -1
  40. package/build/dist/api/modules/clanker/index.js +1 -1
  41. package/build/dist/api/modules/clanker/manage.js +1 -1
  42. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  43. package/build/dist/api/modules/clanker/protocol.js +1 -1
  44. package/build/dist/api/modules/clanker/state.js +1 -1
  45. package/build/dist/api/modules/earn/copy.d.ts +6 -6
  46. package/build/dist/api/modules/earn/copy.js +1 -1
  47. package/build/dist/api/modules/earn/cost.d.ts +1 -1
  48. package/build/dist/api/modules/earn/cost.js +1 -1
  49. package/build/dist/api/modules/earn/index.js +1 -1
  50. package/build/dist/api/modules/earn/lp.js +1 -1
  51. package/build/dist/api/modules/earn/options.js +1 -1
  52. package/build/dist/api/modules/erc8004/common.js +1 -1
  53. package/build/dist/api/modules/erc8004/domain.js +1 -1
  54. package/build/dist/api/modules/erc8004/index.js +1 -1
  55. package/build/dist/api/modules/erc8004/management.js +1 -1
  56. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  57. package/build/dist/api/modules/erc8004/services.js +1 -1
  58. package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
  59. package/build/dist/api/modules/erc8004/thesis.js +1 -0
  60. package/build/dist/api/modules/erc8004/validation.js +1 -1
  61. package/build/dist/api/modules/fobo/client.d.ts +9 -0
  62. package/build/dist/api/modules/fobo/client.js +1 -0
  63. package/build/dist/api/modules/fobo/index.d.ts +16 -0
  64. package/build/dist/api/modules/fobo/index.js +1 -0
  65. package/build/dist/api/modules/fobo/intent.d.ts +243 -0
  66. package/build/dist/api/modules/fobo/intent.js +1 -0
  67. package/build/dist/api/modules/fobo/pins.d.ts +178 -0
  68. package/build/dist/api/modules/fobo/pins.js +1 -0
  69. package/build/dist/api/modules/fobo/steps.d.ts +25 -0
  70. package/build/dist/api/modules/fobo/steps.js +1 -0
  71. package/build/dist/api/modules/fobo/verify.d.ts +89 -0
  72. package/build/dist/api/modules/fobo/verify.js +1 -0
  73. package/build/dist/api/modules/gloam/copy.d.ts +1 -1
  74. package/build/dist/api/modules/gloam/copy.js +1 -1
  75. package/build/dist/api/modules/gloam/index.js +1 -1
  76. package/build/dist/api/modules/grove/index.js +1 -1
  77. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  78. package/build/dist/api/modules/heyresearch/index.js +1 -1
  79. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  80. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  81. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  82. package/build/dist/api/modules/hoodag/index.d.ts +12 -1
  83. package/build/dist/api/modules/hoodag/index.js +1 -1
  84. package/build/dist/api/modules/hoodag/management.js +1 -1
  85. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  86. package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
  87. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  88. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  89. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  90. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  91. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  92. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  93. package/build/dist/api/modules/hoodlock/index.js +1 -1
  94. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  95. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  96. package/build/dist/api/modules/hoodlock/public.js +1 -1
  97. package/build/dist/api/modules/hookr/actions.js +1 -1
  98. package/build/dist/api/modules/hookr/addons.js +1 -1
  99. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  100. package/build/dist/api/modules/hookr/contracts.js +1 -1
  101. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  102. package/build/dist/api/modules/hookr/discovery.js +1 -1
  103. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  104. package/build/dist/api/modules/hookr/index.js +1 -1
  105. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  106. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  107. package/build/dist/api/modules/hookr/launch.js +1 -1
  108. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  109. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  110. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  111. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  112. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  113. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  114. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  115. package/build/dist/api/modules/hookr/relay.js +1 -1
  116. package/build/dist/api/modules/hookr/revenue.js +1 -1
  117. package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
  118. package/build/dist/api/modules/kyberswap/index.js +1 -1
  119. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  120. package/build/dist/api/modules/layerbank/abi.js +1 -1
  121. package/build/dist/api/modules/layerbank/actions.js +1 -1
  122. package/build/dist/api/modules/layerbank/checks.js +1 -1
  123. package/build/dist/api/modules/layerbank/index.js +1 -1
  124. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  125. package/build/dist/api/modules/layerbank/reader.js +1 -1
  126. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  127. package/build/dist/api/modules/lighter/index.js +1 -1
  128. package/build/dist/api/modules/longbow/administration.js +1 -1
  129. package/build/dist/api/modules/longbow/analytics.js +1 -1
  130. package/build/dist/api/modules/longbow/fixed.js +1 -1
  131. package/build/dist/api/modules/longbow/index.js +1 -1
  132. package/build/dist/api/modules/longbow/nft.js +1 -1
  133. package/build/dist/api/modules/longbow/rebates.js +1 -1
  134. package/build/dist/api/modules/longbow/staking.js +1 -1
  135. package/build/dist/api/modules/meridian/index.js +1 -1
  136. package/build/dist/api/modules/meridian/markets.js +1 -1
  137. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  138. package/build/dist/api/modules/meridian/rfq.js +1 -1
  139. package/build/dist/api/modules/merkl/discovery.js +1 -1
  140. package/build/dist/api/modules/merkl/index.js +1 -1
  141. package/build/dist/api/modules/merkl/manage.js +1 -1
  142. package/build/dist/api/modules/merkl/protocol.js +1 -1
  143. package/build/dist/api/modules/morpho/allocator.js +1 -1
  144. package/build/dist/api/modules/morpho/bundles.js +1 -1
  145. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  146. package/build/dist/api/modules/morpho/index.js +1 -1
  147. package/build/dist/api/modules/morpho/local-guard.d.ts +2 -1
  148. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  149. package/build/dist/api/modules/morpho/midnight.js +1 -1
  150. package/build/dist/api/modules/morpho/protocol.js +1 -1
  151. package/build/dist/api/modules/morpho/surface.js +1 -1
  152. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  153. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  154. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  155. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  156. package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
  157. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  158. package/build/dist/api/modules/netnet/card-read.js +1 -1
  159. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  160. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  161. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  162. package/build/dist/api/modules/netnet/financial.js +1 -1
  163. package/build/dist/api/modules/netnet/index.js +1 -1
  164. package/build/dist/api/modules/netnet/staking.js +1 -1
  165. package/build/dist/api/modules/orbio/index.d.ts +6 -0
  166. package/build/dist/api/modules/orbio/index.js +1 -1
  167. package/build/dist/api/modules/orbio/positions.js +1 -1
  168. package/build/dist/api/modules/pendle/costs.js +1 -1
  169. package/build/dist/api/modules/pendle/index.js +1 -1
  170. package/build/dist/api/modules/pendle/markets.js +1 -1
  171. package/build/dist/api/modules/pendle/positions.js +1 -1
  172. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  173. package/build/dist/api/modules/pendle/reader.js +1 -1
  174. package/build/dist/api/modules/pendle/redeem.js +1 -1
  175. package/build/dist/api/modules/pendle/trade.js +1 -1
  176. package/build/dist/api/modules/pendle/validate.js +1 -1
  177. package/build/dist/api/modules/pendle/verify.js +1 -1
  178. package/build/dist/api/modules/pons/claim.js +1 -1
  179. package/build/dist/api/modules/pons/index.js +1 -1
  180. package/build/dist/api/modules/pons/launch-status.js +1 -1
  181. package/build/dist/api/modules/pons/prices.js +1 -1
  182. package/build/dist/api/modules/pons/reads.js +1 -1
  183. package/build/dist/api/modules/pons/swap-terms.d.ts +2 -8
  184. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  185. package/build/dist/api/modules/pons/trade.js +1 -1
  186. package/build/dist/api/modules/poolstrade/index.js +1 -1
  187. package/build/dist/api/modules/priors/coverage.js +1 -1
  188. package/build/dist/api/modules/priors/discovery.js +1 -1
  189. package/build/dist/api/modules/priors/features.js +1 -1
  190. package/build/dist/api/modules/priors/holdings.js +1 -1
  191. package/build/dist/api/modules/priors/index.js +1 -1
  192. package/build/dist/api/modules/priors/integration.js +1 -1
  193. package/build/dist/api/modules/priors/market.js +1 -1
  194. package/build/dist/api/modules/priors/pt.js +1 -1
  195. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  196. package/build/dist/api/modules/priors/starter-line.js +1 -1
  197. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  198. package/build/dist/api/modules/relay/api.js +1 -1
  199. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  200. package/build/dist/api/modules/relay/discovery.js +1 -1
  201. package/build/dist/api/modules/relay/inbound.js +1 -1
  202. package/build/dist/api/modules/relay/index.js +1 -1
  203. package/build/dist/api/modules/relay/order.js +1 -1
  204. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  205. package/build/dist/api/modules/relay/readiness.js +1 -1
  206. package/build/dist/api/modules/relay/reads.js +1 -1
  207. package/build/dist/api/modules/relay/vaults.js +1 -1
  208. package/build/dist/api/modules/spark/actions.js +1 -1
  209. package/build/dist/api/modules/spark/details.js +1 -1
  210. package/build/dist/api/modules/spark/index.js +1 -1
  211. package/build/dist/api/modules/spark/management.js +1 -1
  212. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  213. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  214. package/build/dist/api/modules/steakhouse/index.js +1 -1
  215. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  216. package/build/dist/api/modules/steakhouse/management.js +1 -1
  217. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  218. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  219. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  220. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  221. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  222. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  223. package/build/dist/api/modules/tickerspring/index.js +1 -1
  224. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  225. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  226. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  227. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  228. package/build/dist/api/modules/tickerspring/research.js +1 -1
  229. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  230. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  231. package/build/dist/api/modules/uniswap/auction.js +1 -1
  232. package/build/dist/api/modules/uniswap/batch.js +1 -1
  233. package/build/dist/api/modules/uniswap/common.js +1 -1
  234. package/build/dist/api/modules/uniswap/fees.js +1 -1
  235. package/build/dist/api/modules/uniswap/index.js +1 -1
  236. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  237. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  238. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  239. package/build/dist/api/modules/uniswap/pools.js +1 -1
  240. package/build/dist/api/modules/uniswap/position.js +1 -1
  241. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  242. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  243. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  244. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  245. package/build/dist/api/modules/uniswap/trade.js +1 -1
  246. package/build/dist/api/modules/uniswap/v2.js +1 -1
  247. package/build/dist/api/modules/uniswap/v3.js +1 -1
  248. package/build/dist/api/modules/uniswap/v4.js +1 -1
  249. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  250. package/build/dist/api/modules/upoch/copy.d.ts +5 -0
  251. package/build/dist/api/modules/upoch/copy.js +1 -0
  252. package/build/dist/api/modules/upoch/index.d.ts +8 -0
  253. package/build/dist/api/modules/upoch/index.js +1 -0
  254. package/build/dist/api/modules/upoch/pins.d.ts +8 -0
  255. package/build/dist/api/modules/upoch/pins.js +1 -0
  256. package/build/dist/api/modules/upoch/reads.d.ts +509 -0
  257. package/build/dist/api/modules/upoch/reads.js +1 -0
  258. package/build/dist/api/modules/velora/claims.js +1 -1
  259. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  260. package/build/dist/api/modules/velora/index.js +1 -1
  261. package/build/dist/api/modules/wormhole/index.js +1 -1
  262. package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
  263. package/build/dist/api/modules/wormhole/x402-client.js +1 -1
  264. package/build/dist/api/positions.js +1 -1
  265. package/build/dist/api/pricenote.js +1 -1
  266. package/build/dist/api/prices.d.ts +5 -0
  267. package/build/dist/api/prices.js +1 -1
  268. package/build/dist/api/pricing.js +1 -1
  269. package/build/dist/api/rpc.js +1 -1
  270. package/build/dist/api/secret-fields.d.ts +2 -0
  271. package/build/dist/api/secret-fields.js +1 -1
  272. package/build/dist/api/send.js +1 -1
  273. package/build/dist/api/signing-registry.js +1 -1
  274. package/build/dist/api/signing.js +1 -1
  275. package/build/dist/api/simulate.js +1 -1
  276. package/build/dist/api/swap.d.ts +1 -0
  277. package/build/dist/api/swap.js +1 -1
  278. package/build/dist/api/tokens.js +1 -1
  279. package/build/dist/api/tool-policy.d.ts +1 -0
  280. package/build/dist/api/tool-policy.js +1 -1
  281. package/build/dist/api/universal-router.d.ts +45 -0
  282. package/build/dist/api/universal-router.js +1 -0
  283. package/build/dist/api/usd-estimate.js +1 -1
  284. package/build/dist/chunks/{ZOMFHTB2.js → 22TU5PFT.js} +1 -1
  285. package/build/dist/chunks/23HNDJ76.js +2 -0
  286. package/build/dist/chunks/{ZFU65MB4.js → 257N7343.js} +1 -1
  287. package/build/dist/chunks/{F3VDVTMS.js → 27PVS6BU.js} +1 -1
  288. package/build/dist/chunks/{N245WC5R.js → 2JWAFLJU.js} +1 -1
  289. package/build/dist/chunks/{GQYV4TFO.js → 2OVJ2BTJ.js} +1 -1
  290. package/build/dist/chunks/{JS53DQVT.js → 35LXCSHY.js} +1 -1
  291. package/build/dist/chunks/{V37L4DU4.js → 3A2IKFTV.js} +1 -1
  292. package/build/dist/chunks/{OYPAVXGQ.js → 3BMM3V4P.js} +1 -1
  293. package/build/dist/chunks/{ZKZUS3QU.js → 3FU6XP6S.js} +1 -1
  294. package/build/dist/chunks/{BB765L75.js → 3PHJUFU2.js} +1 -1
  295. package/build/dist/chunks/{FWIFTPSE.js → 3PU2SD3U.js} +1 -1
  296. package/build/dist/chunks/{SBY4RJ7I.js → 3ZH5SOC2.js} +1 -1
  297. package/build/dist/chunks/43BG2JRB.js +1 -0
  298. package/build/dist/chunks/{YTLH4M4Y.js → 47HSRR7G.js} +1 -1
  299. package/build/dist/chunks/4NBXBKOX.js +2 -0
  300. package/build/dist/chunks/{EZZM2GQT.js → 4NDIYRH5.js} +1 -1
  301. package/build/dist/chunks/{FOKEFXGP.js → 4PLLS6CT.js} +1 -1
  302. package/build/dist/chunks/4RCYYN6O.js +1 -0
  303. package/build/dist/chunks/{XHYFISVV.js → 4Z3IGMU6.js} +1 -1
  304. package/build/dist/chunks/4ZD5D2UP.js +1 -0
  305. package/build/dist/chunks/{CSDN4MYP.js → 5GQJVKVY.js} +1 -1
  306. package/build/dist/chunks/{QFSBDPLN.js → 65OITTDL.js} +1 -1
  307. package/build/dist/chunks/{4FPV4CRC.js → 6D3XNCOX.js} +1 -1
  308. package/build/dist/chunks/{DSTMEY5F.js → 6F527FLN.js} +1 -1
  309. package/build/dist/chunks/{O3JWCJIF.js → 6GWXPQZ6.js} +1 -1
  310. package/build/dist/chunks/{32RXFUOH.js → 73BZPPRS.js} +1 -1
  311. package/build/dist/chunks/75SULXNT.js +1 -0
  312. package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
  313. package/build/dist/chunks/{SKEKXEUU.js → 7FIEBJOZ.js} +1 -1
  314. package/build/dist/chunks/{4GNUXN4K.js → 7FZXSYFD.js} +1 -1
  315. package/build/dist/chunks/{ZP36DSOD.js → 7TSIF3F4.js} +1 -1
  316. package/build/dist/chunks/{AMTRDPVO.js → 7U62MMUQ.js} +1 -1
  317. package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
  318. package/build/dist/chunks/A3BJSQ23.js +1 -0
  319. package/build/dist/chunks/{YSMWCKIX.js → ADIPEGNN.js} +1 -1
  320. package/build/dist/chunks/AG2G7BHH.js +6 -0
  321. package/build/dist/chunks/AIYNFIG6.js +1 -0
  322. package/build/dist/chunks/ANIF3JMV.js +4 -0
  323. package/build/dist/chunks/{4JTTA3BX.js → AWV24X7F.js} +1 -1
  324. package/build/dist/chunks/{7QKYDNF6.js → AXHFNE6L.js} +1 -1
  325. package/build/dist/chunks/{WOGWLFAL.js → BGVC5NI6.js} +1 -1
  326. package/build/dist/chunks/BJK75C7G.js +1 -0
  327. package/build/dist/chunks/BSX4LFYI.js +1 -0
  328. package/build/dist/chunks/{OYJFXEDU.js → BZPFPQ2I.js} +1 -1
  329. package/build/dist/chunks/{5PI57UC2.js → C76D54YG.js} +1 -1
  330. package/build/dist/chunks/{TDZTC5WR.js → DBOGRUPS.js} +1 -1
  331. package/build/dist/chunks/{HHO5ISMM.js → DCGNVMKG.js} +1 -1
  332. package/build/dist/chunks/{Y77EVVT4.js → DGDMRATN.js} +1 -1
  333. package/build/dist/chunks/{EGZREEG2.js → DLNA5272.js} +1 -1
  334. package/build/dist/chunks/{TM7Z5SA4.js → DMDOSHV7.js} +1 -1
  335. package/build/dist/chunks/{WHVZ372B.js → DRLBTB4E.js} +1 -1
  336. package/build/dist/chunks/DXAPKN7H.js +1 -0
  337. package/build/dist/chunks/{FZ6IJZZM.js → E76Z2TT4.js} +1 -1
  338. package/build/dist/chunks/{67BWOVET.js → EHGH646D.js} +1 -1
  339. package/build/dist/chunks/{KKPMOAVI.js → ELHRXA5U.js} +1 -1
  340. package/build/dist/chunks/{PZEF5LBL.js → ETMD747Y.js} +1 -1
  341. package/build/dist/chunks/{XCKTE4ON.js → F7MGYRPU.js} +1 -1
  342. package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
  343. package/build/dist/chunks/FXOFR432.js +1 -0
  344. package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
  345. package/build/dist/chunks/{JWR5XVP2.js → GBIBRYOV.js} +1 -1
  346. package/build/dist/chunks/{FNGIJKMZ.js → GDOHHXNH.js} +1 -1
  347. package/build/dist/chunks/{BZ34ZR65.js → GGMVT5A6.js} +1 -1
  348. package/build/dist/chunks/GK3D7OKG.js +1 -0
  349. package/build/dist/chunks/{2OKYXT25.js → GQITAJVF.js} +1 -1
  350. package/build/dist/chunks/GYPMUYB5.js +1 -0
  351. package/build/dist/chunks/H3E7UD2X.js +1 -0
  352. package/build/dist/chunks/{GDRQ2ANN.js → H64QC4QR.js} +1 -1
  353. package/build/dist/chunks/HFVXNKA5.js +1 -0
  354. package/build/dist/chunks/HHYE42JG.js +21 -0
  355. package/build/dist/chunks/{U363GQTF.js → HIG7JY3J.js} +1 -1
  356. package/build/dist/chunks/{XWKK75TO.js → HOBIXKGO.js} +1 -1
  357. package/build/dist/chunks/HQIS3QI7.js +3 -0
  358. package/build/dist/chunks/{UOCRYXAB.js → HRAHGYNK.js} +1 -1
  359. package/build/dist/chunks/{GLF7WEY2.js → HUKDISRE.js} +1 -1
  360. package/build/dist/chunks/{GSFHM5L3.js → HZSYMGJ2.js} +1 -1
  361. package/build/dist/chunks/{FJLJ7ZQ5.js → I4473OC6.js} +1 -1
  362. package/build/dist/chunks/IBL6TL2Q.js +1 -0
  363. package/build/dist/chunks/{3DNJTJ2X.js → IJ4HZIDG.js} +1 -1
  364. package/build/dist/chunks/{OARVU3RC.js → IPU656WB.js} +1 -1
  365. package/build/dist/chunks/{HCBX4NFM.js → IT2JLILU.js} +1 -1
  366. package/build/dist/chunks/{REWXG6X6.js → JDSSYT6R.js} +1 -1
  367. package/build/dist/chunks/{XRDXFHIK.js → JFWJBZ7M.js} +1 -1
  368. package/build/dist/chunks/{TPEKCXVE.js → JTPHZCO3.js} +1 -1
  369. package/build/dist/chunks/{CSOO4SW7.js → K4GUZ5QS.js} +1 -1
  370. package/build/dist/chunks/{BAIY32AV.js → KLEJ3W4T.js} +1 -1
  371. package/build/dist/chunks/{ACH4BSME.js → KOKLM63Q.js} +1 -1
  372. package/build/dist/chunks/{7D73A6KS.js → KVVBT43U.js} +1 -1
  373. package/build/dist/chunks/{CO4GCF4L.js → KXX7ZBFY.js} +1 -1
  374. package/build/dist/chunks/{I6PQW2JI.js → L2AE32SL.js} +1 -1
  375. package/build/dist/chunks/{WUT7TZYM.js → LCH6F5HT.js} +1 -1
  376. package/build/dist/chunks/LEV5SNNC.js +3 -0
  377. package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
  378. package/build/dist/chunks/{6UVGQYZ3.js → LGLWEGPY.js} +1 -1
  379. package/build/dist/chunks/{PV4AK32X.js → LQSPWRHN.js} +1 -1
  380. package/build/dist/chunks/{C3WBHFLX.js → LTDF2LNP.js} +1 -1
  381. package/build/dist/chunks/{5HIHUYA4.js → M4AGEGWW.js} +1 -1
  382. package/build/dist/chunks/{ARI72OYT.js → M6SQPOOL.js} +1 -1
  383. package/build/dist/chunks/{SOTYQGPT.js → M7CQPTRK.js} +1 -1
  384. package/build/dist/chunks/{XPEDQBLI.js → MGVX5EUH.js} +1 -1
  385. package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
  386. package/build/dist/chunks/{APHNOGNS.js → MQ37QX6U.js} +1 -1
  387. package/build/dist/chunks/MQ5F2VOK.js +1 -0
  388. package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
  389. package/build/dist/chunks/{JKRBGAX2.js → NAO7VWZF.js} +1 -1
  390. package/build/dist/chunks/{RLMVA575.js → NDSNE6PS.js} +1 -1
  391. package/build/dist/chunks/{RT7IU6TI.js → NMJVQX5M.js} +1 -1
  392. package/build/dist/chunks/NQ4MTIU3.js +1 -0
  393. package/build/dist/chunks/{IEG6GLFR.js → NTUXDIY6.js} +1 -1
  394. package/build/dist/chunks/{F4UQEPJT.js → NUERUFH7.js} +1 -1
  395. package/build/dist/chunks/NV6FDIYT.js +1 -0
  396. package/build/dist/chunks/O2J5I4VA.js +1 -0
  397. package/build/dist/chunks/{XVJ7ILKK.js → O3CC5SRM.js} +1 -1
  398. package/build/dist/chunks/{2SUHQWND.js → O4S6XAYV.js} +1 -1
  399. package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
  400. package/build/dist/chunks/{NA424YAL.js → OB7BFDOV.js} +1 -1
  401. package/build/dist/chunks/{523ZIR3J.js → ODV3XT5U.js} +1 -1
  402. package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
  403. package/build/dist/chunks/{FL5SSHUL.js → OIQTZOBN.js} +1 -1
  404. package/build/dist/chunks/OLDQV43V.js +1 -0
  405. package/build/dist/chunks/OOPMZIG7.js +1 -0
  406. package/build/dist/chunks/{XYPGLG6A.js → OSMOBKRQ.js} +1 -1
  407. package/build/dist/chunks/{OZ5MDUD2.js → OVM4QIET.js} +1 -1
  408. package/build/dist/chunks/{N4XNNXOJ.js → OY5W7ZSL.js} +1 -1
  409. package/build/dist/chunks/{GRSXWQWD.js → PDGYM2WG.js} +1 -1
  410. package/build/dist/chunks/{UQEEF5W5.js → PDPTJMTJ.js} +1 -1
  411. package/build/dist/chunks/PEHXHQVA.js +1 -0
  412. package/build/dist/chunks/{JOKL5L6X.js → PKYQ3XVA.js} +1 -1
  413. package/build/dist/chunks/PMFR47H3.js +1 -0
  414. package/build/dist/chunks/{N6GIC7HJ.js → PWJVC2FV.js} +1 -1
  415. package/build/dist/chunks/{753HZZTY.js → QBYV7NXH.js} +1 -1
  416. package/build/dist/chunks/QHV5GORV.js +1 -0
  417. package/build/dist/chunks/{2LWBN35N.js → QIB6OMQV.js} +1 -1
  418. package/build/dist/chunks/{TK55VASJ.js → QMNUB2GM.js} +1 -1
  419. package/build/dist/chunks/{HKVQ646Q.js → QN45T4N3.js} +1 -1
  420. package/build/dist/chunks/{J73ATSEQ.js → QPY6UTLU.js} +1 -1
  421. package/build/dist/chunks/{YUHNPUNK.js → R73R4KN3.js} +1 -1
  422. package/build/dist/chunks/{RLI4JDOL.js → RA7DOR7F.js} +1 -1
  423. package/build/dist/chunks/{VR344DAZ.js → RN3WUJIO.js} +1 -1
  424. package/build/dist/chunks/RUSXMQSJ.js +1 -0
  425. package/build/dist/chunks/{D742AYEV.js → RUTSEGGD.js} +1 -1
  426. package/build/dist/chunks/{4Q2ZBZXM.js → RXP7ZUPY.js} +1 -1
  427. package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
  428. package/build/dist/chunks/{DYYEA5HB.js → SMKO7GKX.js} +1 -1
  429. package/build/dist/chunks/{C75MT5SD.js → SNCV6HV7.js} +1 -1
  430. package/build/dist/chunks/{HIX5N25Z.js → SOJHYMD7.js} +1 -1
  431. package/build/dist/chunks/{JLRHM2DQ.js → SUNTJ6IU.js} +1 -1
  432. package/build/dist/chunks/{4JRXEN7C.js → THL4TMQW.js} +2 -2
  433. package/build/dist/chunks/TI727O2H.js +1 -0
  434. package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
  435. package/build/dist/chunks/{Q2ACLVWR.js → UBI3HBXD.js} +1 -1
  436. package/build/dist/chunks/{YMV5TL5C.js → UEHN2IDF.js} +1 -1
  437. package/build/dist/chunks/{ZF2VPDRQ.js → UHIJMDD2.js} +1 -1
  438. package/build/dist/chunks/UJQYOTO5.js +1 -0
  439. package/build/dist/chunks/{VTPT5544.js → USEF3QKG.js} +1 -1
  440. package/build/dist/chunks/{LR4XTZ37.js → UYULQHZJ.js} +1 -1
  441. package/build/dist/chunks/{YWZQJJYY.js → V4UJMUIB.js} +1 -1
  442. package/build/dist/chunks/{7VC53B5X.js → V5YSJKRH.js} +13 -13
  443. package/build/dist/chunks/{INOYMBWE.js → VC5ZCQYZ.js} +1 -1
  444. package/build/dist/chunks/{M7ZXDLKM.js → VDJPDIBV.js} +1 -1
  445. package/build/dist/chunks/{2FHELZ7Y.js → VFM2BICB.js} +1 -1
  446. package/build/dist/chunks/{TE6D3OIX.js → VOJULRNU.js} +1 -1
  447. package/build/dist/chunks/{UEDGYZOC.js → VVAM3EAK.js} +1 -1
  448. package/build/dist/chunks/VVJO6OYK.js +1 -0
  449. package/build/dist/chunks/{JESMX2UC.js → VXCGMALF.js} +1 -1
  450. package/build/dist/chunks/{NUFZUKYS.js → W32UECOL.js} +1 -1
  451. package/build/dist/chunks/{UUID2E22.js → W3DGFMQE.js} +1 -1
  452. package/build/dist/chunks/W7OCS4AM.js +6 -0
  453. package/build/dist/chunks/{DNNFKDZR.js → W7QNSNOH.js} +1 -1
  454. package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
  455. package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
  456. package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
  457. package/build/dist/chunks/{L646YWDP.js → X24YTJST.js} +1 -1
  458. package/build/dist/chunks/{FOD34G2H.js → XL3W7DAQ.js} +1 -1
  459. package/build/dist/chunks/{2E4I7CJ7.js → XRDLMTBJ.js} +1 -1
  460. package/build/dist/chunks/{GG24LO2R.js → XVOW6UCI.js} +1 -1
  461. package/build/dist/chunks/XW3VGWXK.js +1 -0
  462. package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
  463. package/build/dist/chunks/Y64GFBTA.js +1 -0
  464. package/build/dist/chunks/Y7HBFQYG.js +1 -0
  465. package/build/dist/chunks/{ARLGF5MU.js → YGW4ODAP.js} +1 -1
  466. package/build/dist/chunks/YRSAZTTC.js +7 -0
  467. package/build/dist/chunks/YW4W3LPQ.js +1 -0
  468. package/build/dist/chunks/{3VBIRLU3.js → YXXK6EPI.js} +1 -1
  469. package/build/dist/chunks/{EH5G4O3U.js → Z2QV6EZY.js} +1 -1
  470. package/build/dist/chunks/Z3IBPCY4.js +2 -0
  471. package/build/dist/chunks/{H5DY7CNB.js → Z7FGEWO2.js} +1 -1
  472. package/build/dist/chunks/{KDGSYNOP.js → ZDCCFEVL.js} +1 -1
  473. package/build/dist/chunks/{4RQAOOO2.js → ZOLHVZDK.js} +1 -1
  474. package/build/dist/chunks/{AI3VAPA3.js → ZSVAGOF2.js} +1 -1
  475. package/build/dist/chunks/{EVBHQQQG.js → ZTKT3ZQK.js} +1 -1
  476. package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
  477. package/package.json +1 -1
  478. package/build/dist/chunks/3K2N5VFH.js +0 -1
  479. package/build/dist/chunks/3ZABD6ZF.js +0 -2
  480. package/build/dist/chunks/44MB6SA6.js +0 -1
  481. package/build/dist/chunks/4D4ZRZUW.js +0 -1
  482. package/build/dist/chunks/4OVIMYNH.js +0 -2
  483. package/build/dist/chunks/6NUNCD5J.js +0 -1
  484. package/build/dist/chunks/6PZGDVHV.js +0 -1
  485. package/build/dist/chunks/7MBVTNLU.js +0 -1
  486. package/build/dist/chunks/7VNO46LV.js +0 -1
  487. package/build/dist/chunks/CAWTAR5V.js +0 -1
  488. package/build/dist/chunks/DPE7SPW7.js +0 -1
  489. package/build/dist/chunks/E3RACZUY.js +0 -1
  490. package/build/dist/chunks/EI6GGPDS.js +0 -20
  491. package/build/dist/chunks/FV4WZOTD.js +0 -1
  492. package/build/dist/chunks/FWD4L3CJ.js +0 -1
  493. package/build/dist/chunks/JBTOZ6IH.js +0 -1
  494. package/build/dist/chunks/KREBNL2D.js +0 -1
  495. package/build/dist/chunks/MVD3KWPP.js +0 -1
  496. package/build/dist/chunks/P6OMKZMR.js +0 -3
  497. package/build/dist/chunks/PXVREXCS.js +0 -1
  498. package/build/dist/chunks/QJNLLI6N.js +0 -1
  499. package/build/dist/chunks/RPB46QAC.js +0 -1
  500. package/build/dist/chunks/TID4C2KC.js +0 -1
  501. package/build/dist/chunks/U2YCQWZK.js +0 -1
  502. package/build/dist/chunks/UWBKAWX3.js +0 -7
  503. package/build/dist/chunks/V6SDKPZS.js +0 -1
  504. package/build/dist/chunks/WHTRPRRD.js +0 -1
  505. package/build/dist/chunks/WLMWWEP7.js +0 -2
  506. package/build/dist/chunks/XQ24RSEI.js +0 -1
  507. package/build/dist/chunks/YDNTY67T.js +0 -1
  508. package/build/dist/chunks/ZQAFFWDK.js +0 -1
@@ -1 +1 @@
1
- import{a as I,b as S,d as g,f as c,g as $,h as p,i as T,k as v,l as R,m as P}from"./PV5FDT6O.js";import{c as f,g as y}from"./NWNYJ26T.js";import{a as h}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{encodeFunctionData as l,erc20Abi as x,parseAbi as E}from"viem";var w=E(["function admin() view returns (address)","function originalAdmin() view returns (address)","function updateAdmin(address)","function updateImage(string)","function updateMetadata(string)","function verify()","function delegate(address)","function burn(uint256)"]),U=m=>{let u=()=>m.clientFor(h),k=(t,a,n,e)=>({name:`clanker_${t}`,inputSchema:{type:"object",properties:a,required:n,additionalProperties:!1},execute:async(r,i)=>{try{return T(r,Object.keys(a)),await e(r,c(i))}catch(o){throw new d(m.plainError(o))}}}),A=async(t,a,n,e)=>{let r=[m.unsignedTx({to:t,data:a,chainId:h,value:"0",description:n})],i=await m.preview(r,e);return{txs:r,preview:i,summary:`${n} ${i.summary}`}},C=async t=>{let[a,n]=await Promise.all([u().readContract({address:t,abi:x,functionName:"symbol"}),u().readContract({address:t,abi:x,functionName:"decimals"})]);if(typeof a!="string"||!a.trim())throw new d("Clanker returned invalid metadata.");return{address:t,symbol:N(a),decimals:p(n,0,255),chainId:h}};return{tools:[k("status",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(t,a)=>{let n=c(t.token),e=await P(m,n),r=await C(n),[i,o,b]=await Promise.all([u().readContract({address:n,abi:x,functionName:"balanceOf",args:[a]}),Promise.all(e.rewardBps.map((s,F)=>u().readContract({address:e.locker,abi:g,functionName:"feePreferences",args:[n,BigInt(F)]}))),Promise.all([n,e.pairedToken].map(async s=>({token:await C(s),amount:v(await u().readContract({address:I.fee_locker.address,abi:E(["function availableFees(address,address) view returns (uint256)"]),functionName:"availableFees",args:[a,s]}))})))]);return{...e,token:r,balance:{token:r,amount:v(i)},feePreferences:o.map(s=>p(s,0,2)),collectedFees:b,summary:"Onchain pool and connected-wallet holdings. Collected fees exclude pending LP fees. Token metadata is untrusted public text."}}),k("update_reward",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},rewardIndex:{type:"integer",minimum:0,maximum:6,description:"Zero-based index of the reward row to change; you must be that row's admin."},field:{enum:["recipient","admin","feePreference"],description:"Which part of the reward row to change; give the matching value in recipient, admin or feePreference."},recipient:{...f,description:"New address that receives this row's fees, for field recipient."},admin:{...f,description:"New admin address for this row, for field admin; hands over future control."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in, for field feePreference: 0 = both tokens, 1 = paired token, 2 = launched token."}},["token","rewardIndex","field"],async(t,a)=>{let n=c(t.token),e=await P(m,n),r=p(t.rewardIndex,0,e.rewardAdmins.length-1);if(!y(e.rewardAdmins[r],a))throw new d("Only this reward index administrator may update its configuration.");let i=t.field;if(!["recipient","admin","feePreference"].includes(String(i)))throw new d("Choose recipient, admin or feePreference.");for(let s of["recipient","admin","feePreference"])if(t[s]!==void 0&&s!==i)throw new d(`Input ${s} does not match field ${String(i)}.`);let o=`Update Clanker reward ${r} ${String(i)} for ${n} to ${String(t[String(i)])}. Existing collected fees keep their prior recipient; transferring admin transfers future control.`,b=i==="feePreference"?l({abi:g,functionName:"updateFeePreference",args:[n,BigInt(r),p(t.feePreference,0,2)]}):l({abi:g,functionName:i==="admin"?"updateRewardAdmin":"updateRewardRecipient",args:[n,BigInt(r),c(t[String(i)])]});return A(e.locker,b,o,a)}),k("update_token",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},field:{enum:["image","metadata","admin","verify","delegate","burn"],description:"Update to make: set image or metadata text, change admin, mark verified, delegate voting power, or burn tokens (irreversible)."},text:{type:"string",description:"New image URL or metadata text, for field image or metadata. Public."},recipient:{...f,description:"New admin address for field admin, or the delegate address for field delegate."},amount:{...S,description:'Amount of the token to burn, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. For field burn.'}},["token","field"],async(t,a)=>{let n=c(t.token);await R(m,n);let e=t.field;if(!["image","metadata","admin","verify","delegate","burn"].includes(String(e)))throw new d("Choose a supported token update.");let r=e==="image"||e==="metadata"?"text":e==="admin"||e==="delegate"?"recipient":e==="burn"?"amount":void 0;for(let o of["text","recipient","amount"])if(t[o]!==void 0&&o!==r)throw new d(`Input ${o} does not match this token update.`);if(["image","metadata","admin","verify"].includes(String(e))){let o=await u().readContract({address:n,abi:w,functionName:e==="verify"?"originalAdmin":"admin"});if(!y(c(o),a))throw new d("The connected wallet is not the required token administrator.")}let i;if(e==="image"||e==="metadata"){if(typeof t.text!="string")throw new d("Provide public metadata text.");i=l({abi:w,functionName:e==="image"?"updateImage":"updateMetadata",args:[t.text]})}else if(e==="admin"||e==="delegate")i=l({abi:w,functionName:e==="admin"?"updateAdmin":"delegate",args:[c(t.recipient,e==="delegate")]});else if(e==="verify")i=l({abi:w,functionName:"verify"});else{let o=$(t.amount);if(!o)throw new d("Provide a positive burn amount.");i=l({abi:w,functionName:"burn",args:[o]})}return A(n,i,`Clanker token ${n}: ${String(e)} ${String(t.text??t.recipient??t.amount??"")}. Burns are irreversible; verification records original-admin approval, not an Oak safety review.`,a)})]}};export{U as a};
1
+ import{a as I,b as S,d as g,f as c,g as $,h as p,i as T,k as v,l as R,m as P}from"./TXGZ6NWN.js";import{c as f,g as y}from"./NWNYJ26T.js";import{b as h}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{encodeFunctionData as l,erc20Abi as x,parseAbi as E}from"viem";var w=E(["function admin() view returns (address)","function originalAdmin() view returns (address)","function updateAdmin(address)","function updateImage(string)","function updateMetadata(string)","function verify()","function delegate(address)","function burn(uint256)"]),U=m=>{let u=()=>m.clientFor(h),k=(t,a,n,e)=>({name:`clanker_${t}`,inputSchema:{type:"object",properties:a,required:n,additionalProperties:!1},execute:async(r,i)=>{try{return T(r,Object.keys(a)),await e(r,c(i))}catch(o){throw new d(m.plainError(o))}}}),A=async(t,a,n,e)=>{let r=[m.unsignedTx({to:t,data:a,chainId:h,value:"0",description:n})],i=await m.preview(r,e);return{txs:r,preview:i,summary:`${n} ${i.summary}`}},C=async t=>{let[a,n]=await Promise.all([u().readContract({address:t,abi:x,functionName:"symbol"}),u().readContract({address:t,abi:x,functionName:"decimals"})]);if(typeof a!="string"||!a.trim())throw new d("Clanker returned invalid metadata.");return{address:t,symbol:N(a),decimals:p(n,0,255),chainId:h}};return{tools:[k("status",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(t,a)=>{let n=c(t.token),e=await P(m,n),r=await C(n),[i,o,b]=await Promise.all([u().readContract({address:n,abi:x,functionName:"balanceOf",args:[a]}),Promise.all(e.rewardBps.map((s,F)=>u().readContract({address:e.locker,abi:g,functionName:"feePreferences",args:[n,BigInt(F)]}))),Promise.all([n,e.pairedToken].map(async s=>({token:await C(s),amount:v(await u().readContract({address:I.fee_locker.address,abi:E(["function availableFees(address,address) view returns (uint256)"]),functionName:"availableFees",args:[a,s]}))})))]);return{...e,token:r,balance:{token:r,amount:v(i)},feePreferences:o.map(s=>p(s,0,2)),collectedFees:b,summary:"Onchain pool and connected-wallet holdings. Collected fees exclude pending LP fees. Token metadata is untrusted public text."}}),k("update_reward",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},rewardIndex:{type:"integer",minimum:0,maximum:6,description:"Zero-based index of the reward row to change; you must be that row's admin."},field:{enum:["recipient","admin","feePreference"],description:"Which part of the reward row to change; give the matching value in recipient, admin or feePreference."},recipient:{...f,description:"New address that receives this row's fees, for field recipient."},admin:{...f,description:"New admin address for this row, for field admin; hands over future control."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in, for field feePreference: 0 = both tokens, 1 = paired token, 2 = launched token."}},["token","rewardIndex","field"],async(t,a)=>{let n=c(t.token),e=await P(m,n),r=p(t.rewardIndex,0,e.rewardAdmins.length-1);if(!y(e.rewardAdmins[r],a))throw new d("Only this reward index administrator may update its configuration.");let i=t.field;if(!["recipient","admin","feePreference"].includes(String(i)))throw new d("Choose recipient, admin or feePreference.");for(let s of["recipient","admin","feePreference"])if(t[s]!==void 0&&s!==i)throw new d(`Input ${s} does not match field ${String(i)}.`);let o=`Update Clanker reward ${r} ${String(i)} for ${n} to ${String(t[String(i)])}. Existing collected fees keep their prior recipient; transferring admin transfers future control.`,b=i==="feePreference"?l({abi:g,functionName:"updateFeePreference",args:[n,BigInt(r),p(t.feePreference,0,2)]}):l({abi:g,functionName:i==="admin"?"updateRewardAdmin":"updateRewardRecipient",args:[n,BigInt(r),c(t[String(i)])]});return A(e.locker,b,o,a)}),k("update_token",{token:{...f,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},field:{enum:["image","metadata","admin","verify","delegate","burn"],description:"Update to make: set image or metadata text, change admin, mark verified, delegate voting power, or burn tokens (irreversible)."},text:{type:"string",description:"New image URL or metadata text, for field image or metadata. Public."},recipient:{...f,description:"New admin address for field admin, or the delegate address for field delegate."},amount:{...S,description:'Amount of the token to burn, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. For field burn.'}},["token","field"],async(t,a)=>{let n=c(t.token);await R(m,n);let e=t.field;if(!["image","metadata","admin","verify","delegate","burn"].includes(String(e)))throw new d("Choose a supported token update.");let r=e==="image"||e==="metadata"?"text":e==="admin"||e==="delegate"?"recipient":e==="burn"?"amount":void 0;for(let o of["text","recipient","amount"])if(t[o]!==void 0&&o!==r)throw new d(`Input ${o} does not match this token update.`);if(["image","metadata","admin","verify"].includes(String(e))){let o=await u().readContract({address:n,abi:w,functionName:e==="verify"?"originalAdmin":"admin"});if(!y(c(o),a))throw new d("The connected wallet is not the required token administrator.")}let i;if(e==="image"||e==="metadata"){if(typeof t.text!="string")throw new d("Provide public metadata text.");i=l({abi:w,functionName:e==="image"?"updateImage":"updateMetadata",args:[t.text]})}else if(e==="admin"||e==="delegate")i=l({abi:w,functionName:e==="admin"?"updateAdmin":"delegate",args:[c(t.recipient,e==="delegate")]});else if(e==="verify")i=l({abi:w,functionName:"verify"});else{let o=$(t.amount);if(!o)throw new d("Provide a positive burn amount.");i=l({abi:w,functionName:"burn",args:[o]})}return A(n,i,`Clanker token ${n}: ${String(e)} ${String(t.text??t.recipient??t.amount??"")}. Burns are irreversible; verification records original-admin approval, not an Oak safety review.`,a)})]}};export{U as a};
@@ -1,2 +1,2 @@
1
- import{a as r}from"./I6PQW2JI.js";import{formatUnits as c}from"viem";var s="Oak x Chop. Chop's own team runs its product and contracts; Oak didn't build them and doesn't run them.",i="Chop's upgrade key can replace log code without a timelock.",u="Chop's unwrap has no on-chain minimum output. Oak checks the simulated net output, but the contract itself will not stop a worse result if state moves before inclusion.",p="Farming pairs tokens 50/50 with impermanent loss and pays in $CHOP, which can fall in price or be paused by Chop. Stake and newly earned rewards can be locked for 10 minutes.",y=[s,i,u,p],g="Wrapping $OAK moves it out of your wallet. If you are on Oak's Holder plan and your wallet balance drops below your signup amount, Oak's action tools pause until you unwrap or top up.",k="Oak checks that CHOP actually reached your wallet; a successful transaction alone does not prove a payout.",l=e=>(e.bond+e.debond)/100;function m(e){return`Wrap fee ${e.fees.bond/100}%; unwrap fee ${e.fees.debond/100}%. A short round trip loses about ${l(e.fees)}%. Caller exemptions and rounding can change the actual fee.`}function $(e){return[s,i,m(e),u,p,...e.underlying.address.toLowerCase()===r.oak.toLowerCase()?[g]:[],...e.drift.length?[`Warning: Chop code changed since Oak checked it (${e.drift.join(", ")}). New wraps and farms are refused; this exit uses the changed code.`]:[]].join(`
1
+ import{a as r}from"./L2AE32SL.js";import{formatUnits as c}from"viem";var s="Oak x Chop. Chop's own team runs its product and contracts; Oak didn't build them and doesn't run them.",i="Chop's upgrade key can replace log code without a timelock.",u="Chop's unwrap has no on-chain minimum output. Oak checks the simulated net output, but the contract itself will not stop a worse result if state moves before inclusion.",p="Farming pairs tokens 50/50 with impermanent loss and pays in $CHOP, which can fall in price or be paused by Chop. Stake and newly earned rewards can be locked for 10 minutes.",y=[s,i,u,p],g="Wrapping $OAK moves it out of your wallet. If you are on Oak's Holder plan and your wallet balance drops below your signup amount, Oak's action tools pause until you unwrap or top up.",k="Oak checks that CHOP actually reached your wallet; a successful transaction alone does not prove a payout.",l=e=>(e.bond+e.debond)/100;function m(e){return`Wrap fee ${e.fees.bond/100}%; unwrap fee ${e.fees.debond/100}%. A short round trip loses about ${l(e.fees)}%. Caller exemptions and rounding can change the actual fee.`}function $(e){return[s,i,m(e),u,p,...e.underlying.address.toLowerCase()===r.oak.toLowerCase()?[g]:[],...e.drift.length?[`Warning: Chop code changed since Oak checked it (${e.drift.join(", ")}). New wraps and farms are refused; this exit uses the changed code.`]:[]].join(`
2
2
  `)}function f(e){let o=e.underlying.symbol;return[`A log is a wrapped version of one token. You hand in ${o} and receive a log token that stays worth a share of the ${o} the log holds.`,"You can earn two ways: the log's backing can grow from other people's trading fees, and you can farm the log for CHOP rewards. Neither is a promised rate.",`Getting in and out costs about ${l(e.fees)}% together: the wrap fee plus the unwrap fee. Other fees set by the log can also apply.`,"The biggest risk: Chop's team holds a key that can replace the log's code at any time, with no waiting period."].join(" ")}function C(e,o,n,t){let a=o.usdEstimate===null?`price unavailable: ${o.estimateReason}`:`$${o.usdEstimate}, estimate, not a quote`,d=n.usdEstimate===null?"The pool's full USD depth has price unavailable; each reserve shows its amount and available estimate.":`The pool holds about $${n.usdEstimate} (estimate, not a quote).`,h=t.pct===null?`A rough $100 price move is unavailable: ${t.reason}.`:`A rough $100 trade using ${t.inputToken.symbol} to buy the log would move its price about ${t.pct}%.`;return[f(e),`This farm's whole CHOP reward pot is about ${o.humanAmount} CHOP (${a}). Oak can't read a reward rate, so it shows no yield.`,d,h,t.assumptions].join(" ")}var x=e=>`You hold 0 ${e}, so there is nothing to unwrap. Unwrapping needs a balance of that log. Nothing was signed.`;function O(e,o,n){let t=a=>c(a,e.decimals);return`You asked to unwrap ${t(o)} ${e.symbol} but hold ${t(n)} ${e.symbol}. Ask for ${t(n)} or less ("${n}" in base units).`}export{s as a,i as b,u as c,p as d,y as e,g as f,k as g,l as h,m as i,$ as j,f as k,C as l,x as m,O as n};
@@ -1 +1 @@
1
- import{i as s,j as h,k as p,m as E,n as C,p as T,r as O,v as w,y as L}from"./QJNLLI6N.js";import{b as P,c as I,e as k,g as S}from"./NWNYJ26T.js";import{a as $}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{a as D}from"./JXOEJPJ4.js";import{getAddress as R}from"viem";var u={type:"integer",minimum:1},l={type:"string",minLength:1,maxLength:512},_={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},g={type:"integer",minimum:1,maximum:100},v={limit:{...g,description:"Maximum number of results."},cursor:{...l,description:"Continuation cursor from a previous page."}},M={relay_chain_health:"Read Relay service health. chainId is required.",relay_requests:"Page this wallet\u2019s requests. Requires server OAK_RELAY_API_KEY; the wallet filter is automatic. Optional id, chain and status filters narrow results.",relay_balance_events:"Page this wallet\u2019s balance events. Requires server OAK_RELAY_API_KEY with access to this resource.",relay_exchange_rates:"Read reference rates without a freshness guarantee. Relay may be unavailable; use relay_token_price for an individual token."};function q(n,r){if(r.type==="string"){if(typeof n!="string"||n.length<Number(r.minLength??0)||n.length>Number(r.maxLength??1024)||typeof r.pattern=="string"&&!new RegExp(r.pattern).test(n))throw new d("Provide a valid Relay search, address or cursor.")}else if(r.type==="integer"){if(typeof n!="number"||!Number.isSafeInteger(n)||n<Number(r.minimum??0)||n>Number(r.maximum??Number.MAX_SAFE_INTEGER))throw new d("Provide an integer within the Relay parameter bounds.")}else{if(r.type==="boolean"&&typeof n!="boolean")throw new d("Provide a boolean Relay filter.");if(r.type==="array"){if(!Array.isArray(n)||n.length>100)throw new d("Provide at most 100 Relay search values.");for(let i of n)q(i,s(r.items))}}if(Array.isArray(r.enum)&&!r.enum.includes(n))throw new d("Choose a supported Relay filter.")}function y(n){return new URLSearchParams(Object.entries(n).map(([r,i])=>[r==="cursor"?"continuation":r,String(i)])).toString()}function x(n){if(n!=null)return q(n,l),n}function m(n){return typeof n=="string"?P.test(n)?R(n.toLowerCase()):/^(?:0x[0-9a-fA-F]{64}|-?\d+(?:\.\d+)?)$/.test(n)?n:D(n):Array.isArray(n)?n.map(m):k(n)?Object.fromEntries(Object.entries(n).filter(([r])=>!/api.?key|signature|authorization|secret/i.test(r)).map(([r,i])=>[r,m(i)])):n}function A(n){return h(n).map(r=>{let i=s(r),e=i.decimals;if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255||typeof i.address!="string")throw new d("Relay returned invalid currency metadata.");let t=i.vmType===void 0||i.vmType==="evm";return{chainId:E(i.chainId),address:t?R(p(i.address)):D(i.address),symbol:w(i.symbol)??"unknown",decimals:e,vmType:w(i.vmType),verified:k(i.metadata)&&i.metadata.verified===!0}})}var B=["relay_vault_status","relay_currencies","relay_token_price","relay_currency_classifications","relay_liquidity","relay_swap_sources","relay_requests","relay_app_fee_balance","relay_app_fee_claims","relay_balance_events","relay_deposit_address","relay_recovery_balances","relay_withdrawal_status","relay_chain_health","relay_token_details","relay_token_chart","relay_trending","relay_exchange_rates","relay_protocol_execution"],X=n=>{let r=L(n);function i(e,t,a,o){return{name:e,inputSchema:{type:"object",...M[e]?{description:M[e]}:{},additionalProperties:!1,properties:t,required:a},execute:async(c,b)=>{for(let f of a)if(c[f]===void 0)throw new d(`Provide ${f} for ${e}.`);for(let[f,j]of Object.entries(c)){if(!Object.hasOwn(t,f))throw new d(`Unsupported ${e} parameter ${f}.`);q(j,t[f])}return o(c,p(b))}}}return{tools:[i("relay_chain_health",{chainId:{...u,description:"Chain ID."}},["chainId"],async e=>{let t=s(await r(`/chains/health?${y(e)}`));if(typeof t.healthy!="boolean")throw new d("Relay returned invalid chain health.");return{healthy:t.healthy,chainId:e.chainId}}),i("relay_token_details",{chainId:{...u,description:"Chain ID."},address:{...I,description:"Token address filter."}},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${p(e.address)}`));if(t.chainId!==e.chainId||p(t.address)!==p(e.address))throw new d("Relay returned another token.");return{token:A([t])[0],data:m(t)}}),i("relay_token_chart",{chainId:{...u,description:"Chain ID."},address:{...I,description:"Token address filter."},timeframe:{type:"string",enum:["5M","1H","4H","24H","7D","30D","MAX"],description:"Chart period: 5M = 5 minutes, 1H = 1 hour, 4H = 4 hours, 24H = 1 day, 7D = 7 days, 30D = 30 days, MAX = all history."}},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${p(e.address)}/chart?${y(e.timeframe===void 0?{}:{timeframe:e.timeframe})}`));return{chainId:e.chainId,address:R(p(e.address)),data:m(t),summary:"Relay historical market data. Chart prices and volumes are not token base-unit balances."}}),i("relay_trending",{chainId:{...u,description:"Chain ID."},limit:{...g,maximum:20,description:"Maximum number of results, from 1 to 20."},sortBy:{type:"string",enum:["relay24hBuyTxCount","relay24hBuyUsdVolume","coingecko6hTrending"],description:"Sort by 24-hour buy count, 24-hour USD volume, or six-hour CoinGecko trending."}},[],async e=>({currencies:A(await r(`/currencies/trending?${y(e)}`))})),i("relay_exchange_rates",{},[],async()=>({rates:m(s(await r("/prices/rates"))),summary:"Relay reference rates; timestamps are not supplied. These are prices, not token base-unit amounts."})),i("relay_protocol_execution",{id:{..._,description:"Protocol execution idempotency key as a 0x-prefixed 32-byte hex string."}},["id"],async e=>{let t=s(await r(`/protocol/executions/${e.id}`)),a=s(t.execution);if(!S(T(a.idempotencyKey),String(e.id)))throw new d("Relay returned another protocol execution.");return{data:m(t),summary:"Oracle execution status only; this does not prove a destination bridge fill."}}),i("relay_currencies",{chainIds:{type:"array",items:u,description:"Chain IDs to search."},term:{...l,maxLength:256,description:"Token search term."},address:{...l,description:"Token address filter."},currencyId:{...l,description:"Relay currency ID filter."},symbol:{...l,description:"Token symbol filter."},groupID:{...l,description:"Relay currency group ID filter."},tokens:{type:"array",items:l,description:"Token identifiers to filter."},verified:{type:"boolean",description:"Filter by Relay verification status."},defaultList:{type:"boolean",description:"Filter by Relay default-list status."},includeAllChains:{type:"boolean",description:"Include currencies on all chains."},useExternalSearch:{type:"boolean",description:"Include external search results."},depositAddressOnly:{type:"boolean",description:"Include only deposit-address currencies."},limit:{...g,description:"Maximum number of results."}},[],async e=>({currencies:A(await r("/currencies/v2",{chainIds:[$],...e})),summary:"Relay currency search. Provider verification is not an Oak token endorsement; obtain a quote to check route availability."})),i("relay_token_price",{chainId:{...u,description:"Chain ID."},address:{...I,description:"Token address filter."}},["chainId","address"],async e=>{let t=s(await r(`/currencies/token/price/v2?${y(e)}`));if(typeof t.price!="string"||!/^\d+(?:\.\d+)?$/.test(t.price))throw new d("Relay returned an invalid USD price.");return{chainId:e.chainId,address:R(p(e.address)),priceUsd:t.price,summary:"Relay USD price; freshness is not supplied by this endpoint."}}),i("relay_currency_classifications",{},[],async()=>{let e=s(await r("/currencies/classifications"));return{major:h(e.major).map(t=>w(t)??"unknown"),stable:h(e.stable).map(t=>w(t)??"unknown")}}),i("relay_liquidity",{chainId:{...u,description:"Chain ID."}},["chainId"],async e=>{let t=s(await r(`/chains/liquidity?${y(e)}`));return{liquidity:h(t.liquidity).map(a=>{let o=s(a);if(o.chainId!==e.chainId)throw new d("Relay liquidity chain does not match the request.");return{...A([o])[0],amount:C(o.balance)}}),summary:"Relay solver balances are indicative capacity, not a reserved route or user funds."}}),i("relay_swap_sources",{chainId:{...u,description:"Chain ID."}},[],async e=>({sources:h(s(await r(`/swap-sources?${y(e)}`)).sources).map(t=>w(t,"name")??"unknown")})),i("relay_requests",{...v,originChainId:{...u,description:"Origin chain ID filter."},destinationChainId:{...u,description:"Destination chain ID filter."},chainId:{...u,description:"Chain ID."},id:{..._,description:"Relay request ID as a 0x-prefixed 32-byte hex string."},orderId:{..._,description:"Relay order ID as a 0x-prefixed 32-byte hex string."},depositTxHash:{..._,description:"Deposit transaction hash as a 0x-prefixed 32-byte hex string."},fillTxHash:{..._,description:"Fill transaction hash as a 0x-prefixed 32-byte hex string."},refundTxHash:{..._,description:"Refund transaction hash as a 0x-prefixed 32-byte hex string."},status:{type:"string",enum:["success","failure","refund","pending","depositing"],description:"Filter by success, failure, refund, pending or depositing status."},includeChildRequests:{type:"boolean",description:"Include child requests."}},[],async(e,t)=>{let a=s(await r(`/requests/v3?${y({...e,user:t,includePendingRequests:!0})}`)),o=h(a.requests).map(s);for(let c of o){let b=k(c.depositAddress)?c.depositAddress.depositor:void 0;if(![c.user,c.sender,b].some(f=>typeof f=="string"&&f.toLowerCase()===t))throw new d("Relay returned a request for another wallet.");T(c.id)}return{requests:m(o),nextCursor:x(a.continuation),summary:"One page of this wallet\u2019s Relay requests, including pending requests. Pass nextCursor as cursor to resume; provider success is not destination receipt verification."}}),i("relay_app_fee_balance",{},[],async(e,t)=>{let a=s(await r(`/app-fees/${t}/balances`));return{balances:h(a.balances).map(o=>{let c=O(o);return{...c,token:{...c.token,address:R(c.token.address),symbol:w(c.token.symbol)??"unknown"}}}),summary:"Off-chain Relay app fee credits for this wallet. Claiming requires separate local signature integration."}}),i("relay_app_fee_claims",v,[],async(e,t)=>{let a=s(await r(`/app-fees/${t}/claims?${y(e)}`)),o=h(a.claims).map(s);for(let c of o)if(p(c.wallet)!==t)throw new d("Relay returned a fee claim for another wallet.");return{claims:m(o),nextCursor:x(a.continuation)}}),i("relay_balance_events",{...v,limit:{...g,maximum:50,description:"Maximum number of results, from 1 to 50."},requestId:{..._,description:"Relay request ID as a 0x-prefixed 32-byte hex string."},chainId:{...u,description:"Chain ID."},currency:{...I,description:"Token address filter."},startTimestamp:{type:"integer",minimum:0,description:"Start time in Unix seconds."},endTimestamp:{type:"integer",minimum:0,description:"End time in Unix seconds."},type:{...l,description:"Balance event type filter."}},[],async(e,t)=>{let a=s(await r(`/balance/${t}/events?${y(e)}`));if(p(a.wallet)!==t)throw new d("Relay returned balance events for another wallet.");let o=h(a.events).map(s);for(let c of o)if(p(c.wallet)!==t)throw new d("Relay returned a balance event for another wallet.");return{events:m(o),nextCursor:x(a.continuation)}}),i("relay_deposit_address",{address:{...l,description:"Deposit address to look up; supply this or depositAddressId."},depositAddressId:{...l,description:"Relay deposit address ID; supply this or address."},pageSize:{...g,maximum:50,description:"Maximum number of results, from 1 to 50."},pageToken:{...l,description:"Page token from a previous response."}},[],async e=>{if(e.address===void 0==(e.depositAddressId===void 0))throw new d("Provide exactly one deposit address or depositAddressId.");let t=s(await r(`/deposit-addresses/v2?${y(e)}`)),a=s(t.data),o=s(a.depositAddress);if(e.address!==void 0&&o.address!==e.address||e.depositAddressId!==void 0&&o.id!==e.depositAddressId)throw new d("Relay returned another deposit address.");return{data:m(a),nextPageToken:x(a.nextPageToken),summary:"Deposit address monitoring only. Reading an address does not create, change, fund or recover it."}}),i("relay_recovery_balances",{...v,limit:{...g,maximum:50,description:"Maximum number of results, from 1 to 50."},ownerChainId:{...u,description:"Recovery owner chain ID."}},["ownerChainId"],async(e,t)=>{let a=s(await r(`/withdrawals/balances?${y({...e,recoveryAddress:t})}`)),o=h(a.balances).map(c=>{let b=s(c);return C(b.amount),b});return{balances:m(o),nextCursor:x(a.continuation),summary:"Credited recovery balances only. Empty balances do not prove that an unattested deposit has no recoverable funds. Withdrawal signing remains a separate action."}}),i("relay_withdrawal_status",{id:{...l,description:"Relay withdrawal job ID."}},["id"],async e=>{let t=s(await r(`/withdrawals/status?${y(e)}`));if(typeof t.status!="string")throw new d("Relay returned an invalid withdrawal status.");return{status:w(t.status)??"unknown",data:m(t),summary:"Relay withdrawal job status; verify any reported transaction on its chain before treating funds as received."}})]}};export{B as a,X as b};
1
+ import{i as s,j as h,k as p,m as E,n as C,p as T,r as O,v as w,y as L}from"./Y64GFBTA.js";import{b as P,c as I,e as k,g as S}from"./NWNYJ26T.js";import{b as $}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{a as D}from"./JXOEJPJ4.js";import{getAddress as R}from"viem";var u={type:"integer",minimum:1},l={type:"string",minLength:1,maxLength:512},_={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},g={type:"integer",minimum:1,maximum:100},v={limit:{...g,description:"Maximum number of results."},cursor:{...l,description:"Continuation cursor from a previous page."}},M={relay_chain_health:"Read Relay service health. chainId is required.",relay_requests:"Page this wallet\u2019s requests. Requires server OAK_RELAY_API_KEY; the wallet filter is automatic. Optional id, chain and status filters narrow results.",relay_balance_events:"Page this wallet\u2019s balance events. Requires server OAK_RELAY_API_KEY with access to this resource.",relay_exchange_rates:"Read reference rates without a freshness guarantee. Relay may be unavailable; use relay_token_price for an individual token."};function q(n,r){if(r.type==="string"){if(typeof n!="string"||n.length<Number(r.minLength??0)||n.length>Number(r.maxLength??1024)||typeof r.pattern=="string"&&!new RegExp(r.pattern).test(n))throw new d("Provide a valid Relay search, address or cursor.")}else if(r.type==="integer"){if(typeof n!="number"||!Number.isSafeInteger(n)||n<Number(r.minimum??0)||n>Number(r.maximum??Number.MAX_SAFE_INTEGER))throw new d("Provide an integer within the Relay parameter bounds.")}else{if(r.type==="boolean"&&typeof n!="boolean")throw new d("Provide a boolean Relay filter.");if(r.type==="array"){if(!Array.isArray(n)||n.length>100)throw new d("Provide at most 100 Relay search values.");for(let i of n)q(i,s(r.items))}}if(Array.isArray(r.enum)&&!r.enum.includes(n))throw new d("Choose a supported Relay filter.")}function y(n){return new URLSearchParams(Object.entries(n).map(([r,i])=>[r==="cursor"?"continuation":r,String(i)])).toString()}function x(n){if(n!=null)return q(n,l),n}function m(n){return typeof n=="string"?P.test(n)?R(n.toLowerCase()):/^(?:0x[0-9a-fA-F]{64}|-?\d+(?:\.\d+)?)$/.test(n)?n:D(n):Array.isArray(n)?n.map(m):k(n)?Object.fromEntries(Object.entries(n).filter(([r])=>!/api.?key|signature|authorization|secret/i.test(r)).map(([r,i])=>[r,m(i)])):n}function A(n){return h(n).map(r=>{let i=s(r),e=i.decimals;if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255||typeof i.address!="string")throw new d("Relay returned invalid currency metadata.");let t=i.vmType===void 0||i.vmType==="evm";return{chainId:E(i.chainId),address:t?R(p(i.address)):D(i.address),symbol:w(i.symbol)??"unknown",decimals:e,vmType:w(i.vmType),verified:k(i.metadata)&&i.metadata.verified===!0}})}var B=["relay_vault_status","relay_currencies","relay_token_price","relay_currency_classifications","relay_liquidity","relay_swap_sources","relay_requests","relay_app_fee_balance","relay_app_fee_claims","relay_balance_events","relay_deposit_address","relay_recovery_balances","relay_withdrawal_status","relay_chain_health","relay_token_details","relay_token_chart","relay_trending","relay_exchange_rates","relay_protocol_execution"],X=n=>{let r=L(n);function i(e,t,a,o){return{name:e,inputSchema:{type:"object",...M[e]?{description:M[e]}:{},additionalProperties:!1,properties:t,required:a},execute:async(c,b)=>{for(let f of a)if(c[f]===void 0)throw new d(`Provide ${f} for ${e}.`);for(let[f,j]of Object.entries(c)){if(!Object.hasOwn(t,f))throw new d(`Unsupported ${e} parameter ${f}.`);q(j,t[f])}return o(c,p(b))}}}return{tools:[i("relay_chain_health",{chainId:{...u,description:"Chain ID."}},["chainId"],async e=>{let t=s(await r(`/chains/health?${y(e)}`));if(typeof t.healthy!="boolean")throw new d("Relay returned invalid chain health.");return{healthy:t.healthy,chainId:e.chainId}}),i("relay_token_details",{chainId:{...u,description:"Chain ID."},address:{...I,description:"Token address filter."}},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${p(e.address)}`));if(t.chainId!==e.chainId||p(t.address)!==p(e.address))throw new d("Relay returned another token.");return{token:A([t])[0],data:m(t)}}),i("relay_token_chart",{chainId:{...u,description:"Chain ID."},address:{...I,description:"Token address filter."},timeframe:{type:"string",enum:["5M","1H","4H","24H","7D","30D","MAX"],description:"Chart period: 5M = 5 minutes, 1H = 1 hour, 4H = 4 hours, 24H = 1 day, 7D = 7 days, 30D = 30 days, MAX = all history."}},["chainId","address"],async e=>{let t=s(await r(`/chains/${e.chainId}/currencies/${p(e.address)}/chart?${y(e.timeframe===void 0?{}:{timeframe:e.timeframe})}`));return{chainId:e.chainId,address:R(p(e.address)),data:m(t),summary:"Relay historical market data. Chart prices and volumes are not token base-unit balances."}}),i("relay_trending",{chainId:{...u,description:"Chain ID."},limit:{...g,maximum:20,description:"Maximum number of results, from 1 to 20."},sortBy:{type:"string",enum:["relay24hBuyTxCount","relay24hBuyUsdVolume","coingecko6hTrending"],description:"Sort by 24-hour buy count, 24-hour USD volume, or six-hour CoinGecko trending."}},[],async e=>({currencies:A(await r(`/currencies/trending?${y(e)}`))})),i("relay_exchange_rates",{},[],async()=>({rates:m(s(await r("/prices/rates"))),summary:"Relay reference rates; timestamps are not supplied. These are prices, not token base-unit amounts."})),i("relay_protocol_execution",{id:{..._,description:"Protocol execution idempotency key as a 0x-prefixed 32-byte hex string."}},["id"],async e=>{let t=s(await r(`/protocol/executions/${e.id}`)),a=s(t.execution);if(!S(T(a.idempotencyKey),String(e.id)))throw new d("Relay returned another protocol execution.");return{data:m(t),summary:"Oracle execution status only; this does not prove a destination bridge fill."}}),i("relay_currencies",{chainIds:{type:"array",items:u,description:"Chain IDs to search."},term:{...l,maxLength:256,description:"Token search term."},address:{...l,description:"Token address filter."},currencyId:{...l,description:"Relay currency ID filter."},symbol:{...l,description:"Token symbol filter."},groupID:{...l,description:"Relay currency group ID filter."},tokens:{type:"array",items:l,description:"Token identifiers to filter."},verified:{type:"boolean",description:"Filter by Relay verification status."},defaultList:{type:"boolean",description:"Filter by Relay default-list status."},includeAllChains:{type:"boolean",description:"Include currencies on all chains."},useExternalSearch:{type:"boolean",description:"Include external search results."},depositAddressOnly:{type:"boolean",description:"Include only deposit-address currencies."},limit:{...g,description:"Maximum number of results."}},[],async e=>({currencies:A(await r("/currencies/v2",{chainIds:[$],...e})),summary:"Relay currency search. Provider verification is not an Oak token endorsement; obtain a quote to check route availability."})),i("relay_token_price",{chainId:{...u,description:"Chain ID."},address:{...I,description:"Token address filter."}},["chainId","address"],async e=>{let t=s(await r(`/currencies/token/price/v2?${y(e)}`));if(typeof t.price!="string"||!/^\d+(?:\.\d+)?$/.test(t.price))throw new d("Relay returned an invalid USD price.");return{chainId:e.chainId,address:R(p(e.address)),priceUsd:t.price,summary:"Relay USD price; freshness is not supplied by this endpoint."}}),i("relay_currency_classifications",{},[],async()=>{let e=s(await r("/currencies/classifications"));return{major:h(e.major).map(t=>w(t)??"unknown"),stable:h(e.stable).map(t=>w(t)??"unknown")}}),i("relay_liquidity",{chainId:{...u,description:"Chain ID."}},["chainId"],async e=>{let t=s(await r(`/chains/liquidity?${y(e)}`));return{liquidity:h(t.liquidity).map(a=>{let o=s(a);if(o.chainId!==e.chainId)throw new d("Relay liquidity chain does not match the request.");return{...A([o])[0],amount:C(o.balance)}}),summary:"Relay solver balances are indicative capacity, not a reserved route or user funds."}}),i("relay_swap_sources",{chainId:{...u,description:"Chain ID."}},[],async e=>({sources:h(s(await r(`/swap-sources?${y(e)}`)).sources).map(t=>w(t,"name")??"unknown")})),i("relay_requests",{...v,originChainId:{...u,description:"Origin chain ID filter."},destinationChainId:{...u,description:"Destination chain ID filter."},chainId:{...u,description:"Chain ID."},id:{..._,description:"Relay request ID as a 0x-prefixed 32-byte hex string."},orderId:{..._,description:"Relay order ID as a 0x-prefixed 32-byte hex string."},depositTxHash:{..._,description:"Deposit transaction hash as a 0x-prefixed 32-byte hex string."},fillTxHash:{..._,description:"Fill transaction hash as a 0x-prefixed 32-byte hex string."},refundTxHash:{..._,description:"Refund transaction hash as a 0x-prefixed 32-byte hex string."},status:{type:"string",enum:["success","failure","refund","pending","depositing"],description:"Filter by success, failure, refund, pending or depositing status."},includeChildRequests:{type:"boolean",description:"Include child requests."}},[],async(e,t)=>{let a=s(await r(`/requests/v3?${y({...e,user:t,includePendingRequests:!0})}`)),o=h(a.requests).map(s);for(let c of o){let b=k(c.depositAddress)?c.depositAddress.depositor:void 0;if(![c.user,c.sender,b].some(f=>typeof f=="string"&&f.toLowerCase()===t))throw new d("Relay returned a request for another wallet.");T(c.id)}return{requests:m(o),nextCursor:x(a.continuation),summary:"One page of this wallet\u2019s Relay requests, including pending requests. Pass nextCursor as cursor to resume; provider success is not destination receipt verification."}}),i("relay_app_fee_balance",{},[],async(e,t)=>{let a=s(await r(`/app-fees/${t}/balances`));return{balances:h(a.balances).map(o=>{let c=O(o);return{...c,token:{...c.token,address:R(c.token.address),symbol:w(c.token.symbol)??"unknown"}}}),summary:"Off-chain Relay app fee credits for this wallet. Claiming requires separate local signature integration."}}),i("relay_app_fee_claims",v,[],async(e,t)=>{let a=s(await r(`/app-fees/${t}/claims?${y(e)}`)),o=h(a.claims).map(s);for(let c of o)if(p(c.wallet)!==t)throw new d("Relay returned a fee claim for another wallet.");return{claims:m(o),nextCursor:x(a.continuation)}}),i("relay_balance_events",{...v,limit:{...g,maximum:50,description:"Maximum number of results, from 1 to 50."},requestId:{..._,description:"Relay request ID as a 0x-prefixed 32-byte hex string."},chainId:{...u,description:"Chain ID."},currency:{...I,description:"Token address filter."},startTimestamp:{type:"integer",minimum:0,description:"Start time in Unix seconds."},endTimestamp:{type:"integer",minimum:0,description:"End time in Unix seconds."},type:{...l,description:"Balance event type filter."}},[],async(e,t)=>{let a=s(await r(`/balance/${t}/events?${y(e)}`));if(p(a.wallet)!==t)throw new d("Relay returned balance events for another wallet.");let o=h(a.events).map(s);for(let c of o)if(p(c.wallet)!==t)throw new d("Relay returned a balance event for another wallet.");return{events:m(o),nextCursor:x(a.continuation)}}),i("relay_deposit_address",{address:{...l,description:"Deposit address to look up; supply this or depositAddressId."},depositAddressId:{...l,description:"Relay deposit address ID; supply this or address."},pageSize:{...g,maximum:50,description:"Maximum number of results, from 1 to 50."},pageToken:{...l,description:"Page token from a previous response."}},[],async e=>{if(e.address===void 0==(e.depositAddressId===void 0))throw new d("Provide exactly one deposit address or depositAddressId.");let t=s(await r(`/deposit-addresses/v2?${y(e)}`)),a=s(t.data),o=s(a.depositAddress);if(e.address!==void 0&&o.address!==e.address||e.depositAddressId!==void 0&&o.id!==e.depositAddressId)throw new d("Relay returned another deposit address.");return{data:m(a),nextPageToken:x(a.nextPageToken),summary:"Deposit address monitoring only. Reading an address does not create, change, fund or recover it."}}),i("relay_recovery_balances",{...v,limit:{...g,maximum:50,description:"Maximum number of results, from 1 to 50."},ownerChainId:{...u,description:"Recovery owner chain ID."}},["ownerChainId"],async(e,t)=>{let a=s(await r(`/withdrawals/balances?${y({...e,recoveryAddress:t})}`)),o=h(a.balances).map(c=>{let b=s(c);return C(b.amount),b});return{balances:m(o),nextCursor:x(a.continuation),summary:"Credited recovery balances only. Empty balances do not prove that an unattested deposit has no recoverable funds. Withdrawal signing remains a separate action."}}),i("relay_withdrawal_status",{id:{...l,description:"Relay withdrawal job ID."}},["id"],async e=>{let t=s(await r(`/withdrawals/status?${y(e)}`));if(typeof t.status!="string")throw new d("Relay returned an invalid withdrawal status.");return{status:w(t.status)??"unknown",data:m(t),summary:"Relay withdrawal job status; verify any reported transaction on its chain before treating funds as received."}})]}};export{B as a,X as b};
@@ -1 +1 @@
1
- import{a as F,c as y,d as b,f as h,g as N}from"./SK2VBNAU.js";import{g as p}from"./NWNYJ26T.js";import{a as M,i as O,j as _}from"./FWD4L3CJ.js";import{a as A}from"./XSD5NL7J.js";import{getAddress as U,isAddress as W}from"viem";var j=O[M].pendle.marketFactory.address,q=O[M].pendle.router.address,J=600,Q=/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/,X=/^(usd.*|dai|w?eth|oak)$/i,ee=t=>X.test(t.replace(/[._-]/g,"")),te=/^PT-(.+)-\d{1,2}[A-Za-z]{3}\d{4}$/,s=t=>{throw new A(`${t} Oak won't use this market.`)},r=()=>s("Oak couldn't read this Pendle market from the chain.");function S(t){return typeof t!="number"||!Number.isInteger(t)||t<0||t>36?s("A token in this market reports unusual decimals."):t}function $(t){return!Array.isArray(t)||t.some(e=>typeof e!="string"||!W(e,{strict:!1}))?r():[...new Set(t.map(e=>U(e)))]}async function B(t,e,c={}){let g=c.now??Math.floor(Date.now()/1e3),[u,o,a,f,l,E,D,P,x,I,v]=await N(t,[{address:j,abi:F,functionName:"isValidMarket",args:[e.market]},{address:e.market,abi:y,functionName:"readTokens"},{address:e.market,abi:y,functionName:"expiry"},{address:e.market,abi:y,functionName:"isExpired"},{address:e.market,abi:y,functionName:"readState",args:[q]},{address:e.sy,abi:b,functionName:"getTokensIn"},{address:e.sy,abi:b,functionName:"getTokensOut"},{address:e.sy,abi:b,functionName:"decimals"},{address:e.sy,abi:b,functionName:"exchangeRate"},{address:e.pt,abi:h,functionName:"decimals"},{address:e.pt,abi:h,functionName:"symbol"}]);if(!u.ok)return r();if(u.value!==!0)return s("This isn't a market the Pendle factory created.");if(!o.ok||!Array.isArray(o.value)||o.value.length!==3)return r();let[z,Y,Z]=o.value;if(!p(z,e.sy)||!p(Y,e.pt)||!p(Z,e.yt))return s("The market's tokens don't match what Pendle's service listed.");if(!a.ok||typeof a.value!="bigint"||!f.ok||typeof f.value!="boolean")return r();if(a.value!==BigInt(e.expiry))return s("The market's end date doesn't match what Pendle's service listed.");let T=f.value;if(T!==g>=e.expiry&&Math.abs(g-e.expiry)>J)return s("The chain and Oak's clock disagree about whether this market has ended.");if(!l.ok||typeof l.value?.lastLnImpliedRate!="bigint"||!P.ok||!I.ok||!x.ok||typeof x.value!="bigint"||!v.ok||typeof v.value!="string"||!E.ok||!D.ok)return r();let i=$(E.value),V=$(D.value);if(i.length===0||V.length===0)return s("This market lists no token to put in or take out.");let H=S(P.value),G=S(I.value),R=i.find(n=>p(n,_)),L=await N(t,i.flatMap(n=>[{address:n,abi:h,functionName:"symbol"},{address:n,abi:h,functionName:"decimals"}])),w=new Map(i.map((n,k)=>[n,{symbol:L[k*2],decimals:L[k*2+1]}])),m;if(R)m=R;else if(i.length===1)m=i[0];else{let n=te.exec(v.value)?.[1],k=i.filter(K=>{let C=w.get(K).symbol;return C.ok&&C.value===n});k.length===1&&(m=k[0])}if(!m)return s("Oak can't tell which token this market takes as input.");let d=w.get(m);return!d.symbol.ok||typeof d.symbol.value!="string"||!d.decimals.ok?r():!Q.test(d.symbol.value)||!R&&ee(d.symbol.value)?s("The market's token name looks unusual."):{verified:{market:e.market,sy:e.sy,pt:e.pt,yt:e.yt,expiry:e.expiry,expired:T,kind:R?"stable":"stock",inputToken:m,inputSymbol:d.symbol.value,inputDecimals:S(d.decimals.value),ptDecimals:G,syDecimals:H,tokensIn:i,tokensOut:V},ptSymbol:v.value,lnImpliedRate:l.value.lastLnImpliedRate,syExchangeRate:x.value}}async function oe(t,e,c={}){return(await B(t,e,c)).verified}async function de(t,e,c={}){let g=await Promise.allSettled(e.map(a=>B(t,a,c))),u=[],o=[];return g.forEach((a,f)=>{let l=e[f];a.status==="fulfilled"?u.push({row:l,facts:a.value}):o.push(`${l.market}: ${a.reason instanceof A?a.reason.message:"Oak couldn't check this market."}`)}),{ok:u,dropped:o}}export{B as a,oe as b,de as c};
1
+ import{a as F,c as y,d as b,f as h,g as N}from"./SK2VBNAU.js";import{g as p}from"./NWNYJ26T.js";import{b as M,j as O,k as _}from"./TI727O2H.js";import{a as A}from"./XSD5NL7J.js";import{getAddress as U,isAddress as W}from"viem";var j=O[M].pendle.marketFactory.address,q=O[M].pendle.router.address,J=600,Q=/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/,X=/^(usd.*|dai|w?eth|oak)$/i,ee=t=>X.test(t.replace(/[._-]/g,"")),te=/^PT-(.+)-\d{1,2}[A-Za-z]{3}\d{4}$/,s=t=>{throw new A(`${t} Oak won't use this market.`)},r=()=>s("Oak couldn't read this Pendle market from the chain.");function S(t){return typeof t!="number"||!Number.isInteger(t)||t<0||t>36?s("A token in this market reports unusual decimals."):t}function $(t){return!Array.isArray(t)||t.some(e=>typeof e!="string"||!W(e,{strict:!1}))?r():[...new Set(t.map(e=>U(e)))]}async function B(t,e,c={}){let g=c.now??Math.floor(Date.now()/1e3),[u,o,a,f,l,E,D,P,x,I,v]=await N(t,[{address:j,abi:F,functionName:"isValidMarket",args:[e.market]},{address:e.market,abi:y,functionName:"readTokens"},{address:e.market,abi:y,functionName:"expiry"},{address:e.market,abi:y,functionName:"isExpired"},{address:e.market,abi:y,functionName:"readState",args:[q]},{address:e.sy,abi:b,functionName:"getTokensIn"},{address:e.sy,abi:b,functionName:"getTokensOut"},{address:e.sy,abi:b,functionName:"decimals"},{address:e.sy,abi:b,functionName:"exchangeRate"},{address:e.pt,abi:h,functionName:"decimals"},{address:e.pt,abi:h,functionName:"symbol"}]);if(!u.ok)return r();if(u.value!==!0)return s("This isn't a market the Pendle factory created.");if(!o.ok||!Array.isArray(o.value)||o.value.length!==3)return r();let[z,Y,Z]=o.value;if(!p(z,e.sy)||!p(Y,e.pt)||!p(Z,e.yt))return s("The market's tokens don't match what Pendle's service listed.");if(!a.ok||typeof a.value!="bigint"||!f.ok||typeof f.value!="boolean")return r();if(a.value!==BigInt(e.expiry))return s("The market's end date doesn't match what Pendle's service listed.");let T=f.value;if(T!==g>=e.expiry&&Math.abs(g-e.expiry)>J)return s("The chain and Oak's clock disagree about whether this market has ended.");if(!l.ok||typeof l.value?.lastLnImpliedRate!="bigint"||!P.ok||!I.ok||!x.ok||typeof x.value!="bigint"||!v.ok||typeof v.value!="string"||!E.ok||!D.ok)return r();let i=$(E.value),V=$(D.value);if(i.length===0||V.length===0)return s("This market lists no token to put in or take out.");let H=S(P.value),G=S(I.value),R=i.find(n=>p(n,_)),L=await N(t,i.flatMap(n=>[{address:n,abi:h,functionName:"symbol"},{address:n,abi:h,functionName:"decimals"}])),w=new Map(i.map((n,k)=>[n,{symbol:L[k*2],decimals:L[k*2+1]}])),m;if(R)m=R;else if(i.length===1)m=i[0];else{let n=te.exec(v.value)?.[1],k=i.filter(K=>{let C=w.get(K).symbol;return C.ok&&C.value===n});k.length===1&&(m=k[0])}if(!m)return s("Oak can't tell which token this market takes as input.");let d=w.get(m);return!d.symbol.ok||typeof d.symbol.value!="string"||!d.decimals.ok?r():!Q.test(d.symbol.value)||!R&&ee(d.symbol.value)?s("The market's token name looks unusual."):{verified:{market:e.market,sy:e.sy,pt:e.pt,yt:e.yt,expiry:e.expiry,expired:T,kind:R?"stable":"stock",inputToken:m,inputSymbol:d.symbol.value,inputDecimals:S(d.decimals.value),ptDecimals:G,syDecimals:H,tokensIn:i,tokensOut:V},ptSymbol:v.value,lnImpliedRate:l.value.lastLnImpliedRate,syExchangeRate:x.value}}async function oe(t,e,c={}){return(await B(t,e,c)).verified}async function de(t,e,c={}){let g=await Promise.allSettled(e.map(a=>B(t,a,c))),u=[],o=[];return g.forEach((a,f)=>{let l=e[f];a.status==="fulfilled"?u.push({row:l,facts:a.value}):o.push(`${l.market}: ${a.reason instanceof A?a.reason.message:"Oak couldn't check this market."}`)}),{ok:u,dropped:o}}export{B as a,oe as b,de as c};
@@ -0,0 +1 @@
1
+ var o="The Upoch Score measures recovery policy and checkpoint activity from on-chain facts; it does not rate trading performance or safety.",e={agent:"Read a Upoch workflow, roles, checkpoints, recovery history, and its on-chain Upoch Score on Robinhood Chain. Upoch is a project Oak reads from. The score measures recovery policy and checkpoint activity, not trading performance or safety.",explorer:"List a bounded set of Upoch workflows ranked by on-chain Upoch Score on Robinhood Chain. Upoch is a project Oak reads from. The score measures recovery policy and checkpoint activity, not trading performance or safety."};export{o as a,e as b};
@@ -1 +1 @@
1
- import{parseAbi as e}from"viem";var t=e(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256 shares)","function previewWithdraw(uint256 assets) view returns (uint256 shares)","function previewRedeem(uint256 shares) view returns (uint256 assets)","function convertToAssets(uint256 shares) view returns (uint256 assets)","function balanceOf(address account) view returns (uint256)","function approve(address spender,uint256 amount) returns (bool)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]);export{t as a};
1
+ import{parseAbi as s}from"viem";var r=s(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256 shares)","function previewWithdraw(uint256 assets) view returns (uint256 shares)","function previewRedeem(uint256 shares) view returns (uint256 assets)","function convertToAssets(uint256 shares) view returns (uint256 assets)","function balanceOf(address account) view returns (uint256)","function approve(address spender,uint256 amount) returns (bool)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),t=s(["function vaults(address vault) view returns (bool)","function builders(bytes32 code) view returns (address)","function deposit(address vault,uint256 assets,bytes32 code,uint256 minShares) returns (uint256 shares)","error TooFewShares(uint256 shares,uint256 minShares)"]);export{r as a,t as b};
@@ -1 +1 @@
1
- import{d as b,h as v,l as I,n as k,r as S}from"./V37L4DU4.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};
1
+ import{d as b,h as v,l as I,n as k,r as S}from"./3A2IKFTV.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};
@@ -1 +1 @@
1
- import{a as o,d as y,e as m}from"./JESMX2UC.js";import{a as l}from"./66F5ZH34.js";import{a as c}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{concatHex as x,encodeAbiParameters as P,encodeFunctionData as w,getAddress as u,keccak256 as f,parseAbi as k,stringToHex as I}from"viem";var g=k(["function ownerOf(uint256) view returns (address)","function tokenURI(uint256) view returns (string)","function setMetadata(uint256,string,bytes)","function approve(address,uint256)"]),v=k(["function listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))","function recordHash(uint256) view returns (bytes32)"]),C=(t,r)=>f(x(BigInt(t)<BigInt(r)?[t,r]:[r,t]));function _(t){if(!Array.isArray(t)||t.length<1||t.length>1e4)throw new d("Provide 1 to 10000 identity IDs.");let r=[...new Set(t.map(e=>m(e,"agentIds").toString()))].sort((e,a)=>BigInt(e)<BigInt(a)?-1:1),i=[r.map(e=>f(f(P([{type:"uint256"}],[BigInt(e)]))))];for(;i.at(-1).length>1;){let e=i.at(-1),a=[];for(let s=0;s<e.length;s+=2)a.push(e[s+1]?C(e[s],e[s+1]):e[s]);i.push(a)}return{root:i.at(-1)[0],ids:r,proofs:r.map((e,a)=>{let s=[],p=a;for(let b of i.slice(0,-1)){let h=b[p^1];h&&s.push(h),p=Math.floor(p/2)}return{agentId:e,proof:s}})}}function S(t){return{tools:[{name:"priors_market_origin",inputSchema:{type:"object",properties:{agentIds:{type:"array",minItems:1,maxItems:1e4,items:l(),description:"Exact ERC-8004 agent ID list (decimal strings, 1 to 10000) to commit in a bid_any Merkle root."}},required:["agentIds"],additionalProperties:!1},async execute(r){return{chainId:c,..._(r.agentIds),caveat:"Locally commits exactly these IDs. This does not verify third-party origin, quality, current owner or a seller claim."}}},{name:"priors_market_pins",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID whose listing pins to read, as a decimal string. Example: "437".')},required:["agentId"],additionalProperties:!1},async execute(r){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let n=m(r.agentId,"agentId"),i=t.clientFor(c),e=await i.getBlockNumber({cacheTime:0}),[a,s,p]=await Promise.all([i.readContract({address:o.market,abi:v,functionName:"listingOf",args:[n],blockNumber:e}),i.readContract({address:o.market,abi:v,functionName:"recordHash",args:[n],blockNumber:e}),i.readContract({address:o.registry,abi:g,functionName:"tokenURI",args:[n],blockNumber:e})]);return{chainId:c,blockNumber:e.toString(),listing:y(a),recordHash:s,currentUriHash:f(I(p)),caveat:"Pins bind identity file and credit state, not included code, servers or keys. Listing and current URI hashes may differ; preview refuses an altered listing."}}},{name:"priors_market_clear_bid_budget",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(r,n){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let i=[t.approval(o.usdg,o.bidSpender,"0",c)],e=await t.preview(i,u(n));return{txs:i,summary:`Clear all this wallet future bid spending allowance to ${o.bidSpender}. Existing bids cannot fill from it until approved again. ${e.summary}`}}},{name:"priors_market_revoke_nft",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID whose single-NFT market approval to clear, as a decimal string. Example: "437".')},required:["agentId"],additionalProperties:!1},async execute(r,n){let i=m(r.agentId,"agentId");if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");if(u(await t.clientFor(c).readContract({address:o.registry,abi:g,functionName:"ownerOf",args:[i]}))!==u(n))throw new d("Only current NFT owner may revoke this per-token approval.");let e=[t.unsignedTx({to:o.registry,data:w({abi:g,functionName:"approve",args:["0x0000000000000000000000000000000000000000",i]}),value:"0",chainId:c,description:`Revoke exact ERC-8004 NFT ${i} market approval.`})],a=await t.preview(e,n);return{txs:e,summary:`Clear this identity per-token transfer approval. Also cancel its listing before granting any new market approval. ${a.summary}`}}},{name:"priors_x_link",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID this wallet owns, as a decimal string. Example: "437".'),postUrl:{type:"string",maxLength:160,description:"Canonical https://x.com/<handle>/status/<id> owner proof post URL, or empty to unlink. Owner creates the public post themselves."}},required:["agentId","postUrl"],additionalProperties:!1},async execute(r,n){if(t.network==="testnet")throw new d("Priors X metadata is mainnet only.");let i=m(r.agentId,"agentId");if(u(await t.clientFor(c).readContract({address:o.registry,abi:g,functionName:"ownerOf",args:[i]}))!==u(n))throw new d("Only the identity owner can link or clear X metadata.");if(typeof r.postUrl!="string"||r.postUrl!==""&&!/^https:\/\/x\.com\/[A-Za-z0-9_]{1,15}\/status\/[0-9]{1,30}$/.test(r.postUrl))throw new d("Provide a canonical X status URL or empty string to unlink.");let e=[t.unsignedTx({to:o.registry,data:w({abi:g,functionName:"setMetadata",args:[i,"x",I(r.postUrl)]}),value:"0",chainId:c,description:"Set/clear the owner identity X proof-post metadata."})],a=await t.preview(e,n);return{txs:e,summary:`Publish ${r.postUrl?"the specified X post URL":"empty X metadata"} on public ERC-8004 identity ${i}. Priors independently verifies the post; metadata alone does not prove the X account or affect credit terms. ${a.summary}`}}}]}}export{_ as a,S as b};
1
+ import{a as o,d as y,e as m}from"./VXCGMALF.js";import{a as l}from"./66F5ZH34.js";import{b as c}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{concatHex as x,encodeAbiParameters as P,encodeFunctionData as w,getAddress as u,keccak256 as f,parseAbi as k,stringToHex as I}from"viem";var g=k(["function ownerOf(uint256) view returns (address)","function tokenURI(uint256) view returns (string)","function setMetadata(uint256,string,bytes)","function approve(address,uint256)"]),v=k(["function listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))","function recordHash(uint256) view returns (bytes32)"]),C=(t,r)=>f(x(BigInt(t)<BigInt(r)?[t,r]:[r,t]));function _(t){if(!Array.isArray(t)||t.length<1||t.length>1e4)throw new d("Provide 1 to 10000 identity IDs.");let r=[...new Set(t.map(e=>m(e,"agentIds").toString()))].sort((e,a)=>BigInt(e)<BigInt(a)?-1:1),i=[r.map(e=>f(f(P([{type:"uint256"}],[BigInt(e)]))))];for(;i.at(-1).length>1;){let e=i.at(-1),a=[];for(let s=0;s<e.length;s+=2)a.push(e[s+1]?C(e[s],e[s+1]):e[s]);i.push(a)}return{root:i.at(-1)[0],ids:r,proofs:r.map((e,a)=>{let s=[],p=a;for(let b of i.slice(0,-1)){let h=b[p^1];h&&s.push(h),p=Math.floor(p/2)}return{agentId:e,proof:s}})}}function S(t){return{tools:[{name:"priors_market_origin",inputSchema:{type:"object",properties:{agentIds:{type:"array",minItems:1,maxItems:1e4,items:l(),description:"Exact ERC-8004 agent ID list (decimal strings, 1 to 10000) to commit in a bid_any Merkle root."}},required:["agentIds"],additionalProperties:!1},async execute(r){return{chainId:c,..._(r.agentIds),caveat:"Locally commits exactly these IDs. This does not verify third-party origin, quality, current owner or a seller claim."}}},{name:"priors_market_pins",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID whose listing pins to read, as a decimal string. Example: "437".')},required:["agentId"],additionalProperties:!1},async execute(r){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let n=m(r.agentId,"agentId"),i=t.clientFor(c),e=await i.getBlockNumber({cacheTime:0}),[a,s,p]=await Promise.all([i.readContract({address:o.market,abi:v,functionName:"listingOf",args:[n],blockNumber:e}),i.readContract({address:o.market,abi:v,functionName:"recordHash",args:[n],blockNumber:e}),i.readContract({address:o.registry,abi:g,functionName:"tokenURI",args:[n],blockNumber:e})]);return{chainId:c,blockNumber:e.toString(),listing:y(a),recordHash:s,currentUriHash:f(I(p)),caveat:"Pins bind identity file and credit state, not included code, servers or keys. Listing and current URI hashes may differ; preview refuses an altered listing."}}},{name:"priors_market_clear_bid_budget",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(r,n){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let i=[t.approval(o.usdg,o.bidSpender,"0",c)],e=await t.preview(i,u(n));return{txs:i,summary:`Clear all this wallet future bid spending allowance to ${o.bidSpender}. Existing bids cannot fill from it until approved again. ${e.summary}`}}},{name:"priors_market_revoke_nft",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID whose single-NFT market approval to clear, as a decimal string. Example: "437".')},required:["agentId"],additionalProperties:!1},async execute(r,n){let i=m(r.agentId,"agentId");if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");if(u(await t.clientFor(c).readContract({address:o.registry,abi:g,functionName:"ownerOf",args:[i]}))!==u(n))throw new d("Only current NFT owner may revoke this per-token approval.");let e=[t.unsignedTx({to:o.registry,data:w({abi:g,functionName:"approve",args:["0x0000000000000000000000000000000000000000",i]}),value:"0",chainId:c,description:`Revoke exact ERC-8004 NFT ${i} market approval.`})],a=await t.preview(e,n);return{txs:e,summary:`Clear this identity per-token transfer approval. Also cancel its listing before granting any new market approval. ${a.summary}`}}},{name:"priors_x_link",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID this wallet owns, as a decimal string. Example: "437".'),postUrl:{type:"string",maxLength:160,description:"Canonical https://x.com/<handle>/status/<id> owner proof post URL, or empty to unlink. Owner creates the public post themselves."}},required:["agentId","postUrl"],additionalProperties:!1},async execute(r,n){if(t.network==="testnet")throw new d("Priors X metadata is mainnet only.");let i=m(r.agentId,"agentId");if(u(await t.clientFor(c).readContract({address:o.registry,abi:g,functionName:"ownerOf",args:[i]}))!==u(n))throw new d("Only the identity owner can link or clear X metadata.");if(typeof r.postUrl!="string"||r.postUrl!==""&&!/^https:\/\/x\.com\/[A-Za-z0-9_]{1,15}\/status\/[0-9]{1,30}$/.test(r.postUrl))throw new d("Provide a canonical X status URL or empty string to unlink.");let e=[t.unsignedTx({to:o.registry,data:w({abi:g,functionName:"setMetadata",args:[i,"x",I(r.postUrl)]}),value:"0",chainId:c,description:"Set/clear the owner identity X proof-post metadata."})],a=await t.preview(e,n);return{txs:e,summary:`Publish ${r.postUrl?"the specified X post URL":"empty X metadata"} on public ERC-8004 identity ${i}. Priors independently verifies the post; metadata alone does not prove the X account or affect credit terms. ${a.summary}`}}}]}}export{_ as a,S as b};
@@ -1 +1 @@
1
- import{d as N}from"./UNJJRQIU.js";import{b as W}from"./DNNFKDZR.js";import{c as K}from"./SCG5HWMN.js";import{g as S}from"./NWNYJ26T.js";import{a as j,b as M,c as O}from"./IX3GZMTM.js";import{a as q,i as z}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{a as $}from"./JXOEJPJ4.js";import{encodeAbiParameters as ce,encodeFunctionData as J,erc20Abi as V,getAddress as Z,isAddress as me,keccak256 as X,parseAbi as ue,parseAbiParameters as ye,zeroAddress as ee}from"viem";var x=q,C=Z(z[x].hoodlock.airdrop.address),oe="https://hoodlock.tech",P=25e4,ge=256,fe=604800n,pe=30n,Q=250000000000000000n,Y=0xffffffffn,be=(1n<<64n)-1n,ne=(1n<<128n)-1n,re="0x0000000000000000000000000000000000000000000000000000000000000000",xe="0x1111111111111111111111111111111111111111",Ae=ye("uint256, address, uint256"),T=ue(["function quote(uint32 maxClaims) view returns (uint256)","function create(address token, bytes32 merkleRoot, uint256 total, uint32 maxClaims, uint64 endTime, string uri) payable returns (uint256 id)","function claim(uint256 id, uint256 index, address account, uint256 amount, bytes32[] proof)","function getAirdrop(uint256 id) view returns (address creator, uint64 endTime, uint32 maxClaims, address token, uint32 claims, bool swept, bytes32 merkleRoot, uint128 total, uint128 remaining)","function isClaimed(uint256 id, uint256 index) view returns (bool)"]);function he(o,e,r){let n=e.trim();if(n.startsWith("-")){let t=n.slice(1);return`-${o.formatAmount(t,r)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,r)}function te(o,e){if(!e.changes.length)return e.summary;let r=e.changes.map(n=>`${he(o,n.amount,n.token.decimals)} ${$(n.token.symbol)}`).join(", ");return`${e.summary} (${r})`}async function we(o,e){try{let[r,n]=await Promise.all([o.readContract({address:e,abi:V,functionName:"symbol"}),o.readContract({address:e,abi:V,functionName:"decimals"})]),d=typeof r=="string"&&r.trim()?r.trim():"TOKEN",t=Number(n);return{symbol:d,decimals:Number.isInteger(t)&&t>=0&&t<=255?t:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,r){if(typeof e=="string"&&e.includes(".")){if(r?.decimals===void 0)throw new a(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=r.rounding!==void 0?O(e,r.decimals,r.rounding):o?o.parseAmount(e,r.decimals):O(e,r.decimals),t=M(d);if(t<=0n)throw new a("Airdrop entry amount must be positive.");return t}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=M(e.trim());else throw j()}catch(d){throw d instanceof a?d:new a(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new a("Airdrop entry amount must be strictly positive (> 0).");return n}function H(o,e){try{let r=typeof o=="bigint"?o:BigInt(String(o).trim());if(r<0n)throw new a(`${e} must be non-negative.`);return r}catch(r){throw r instanceof a?r:new a(`Invalid ${e}: ${String(o)}`,{cause:r})}}function A(o,e){if(typeof o!="string"||!me(o,{strict:!1}))throw new a(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return Z(o)}function L(o,e,r){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>Y)throw new a(`Airdrop leaf index must be in 0..${Y.toString()}.`);let d=A(e,"account"),t=w(void 0,r),s=ce(Ae,[n,d,t]);return X(X(s))}function ie(o,e){let r=o;for(let n of e)r=N(r,n);return r}function Ne(o){try{let e=L(o.index,o.account,o.amount),r=ie(e,o.proof);return S(r,o.root)}catch{return!1}}function U(o,e){if(!Array.isArray(o)||o.length===0)throw new a("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new a(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let r=[],n=0n;for(let i=0;i<o.length;i+=1){let l=o[i];if(!l)throw new a(`Missing airdrop entry at position ${i}.`);let c=l.index??i;if(!Number.isInteger(c)||c!==i)throw new a(`Airdrop entry index at position ${i} must be contiguous ${i} (got ${String(c)}).`);let u=A(l.account,`entries[${i}].account`),g=w(e?.context,l.amount,e);n+=g,r.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ne)throw new a("Airdrop total amount must be > 0 and fit in uint128.");let d=r.map(i=>L(i.index,i.account,i.amount)),t=[d];for(;t[t.length-1].length>1;){let i=t[t.length-1],l=[];for(let c=0;c<i.length;c+=2){let u=i[c],g=i[c+1];g===void 0?l.push(u):l.push(N(u,g))}t.push(l)}let s=t[t.length-1][0];if(s.toLowerCase()===re)throw new a("Computed Merkle root cannot be zero.");let f=t.length>1?t[1]:t[0],m=r.map((i,l)=>{let c=[],u=l;for(let g=0;g<t.length-1;g+=1){let y=t[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:i.index,account:i.account,amount:i.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:r.length,values:r.map(i=>[i.index,i.account,i.amount]),entries:r};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:r.length,entries:r,proofs:m,list:p}}function ke(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new a("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,t])=>({index:n,account:d,amount:t})),r=U(e);if(o.root&&!S(r.root,o.root))throw new a(`Rebuilt tree root ${r.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&r.maxClaims!==o.maxClaims)throw new a(`Rebuilt maxClaims (${r.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&r.totalAmount!==o.totalAmount)throw new a(`Rebuilt totalAmount (${r.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return r}async function ae(o,e){return K(o.http,e,{method:"GET"},r=>r!==null&&typeof r=="object")}async function $e(o,e,r){let n=A(e.token,"token");if(n===ee)throw new a("Airdrop token cannot be the zero address.");let d=U(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),t=e.maxClaims??d.maxClaims;if(!Number.isInteger(t)||t<1||t>P||t!==d.maxClaims)throw new a(`maxClaims (${String(t)}) must equal entries.length (${d.maxClaims}) and be in 1..${P}.`);let s=BigInt(d.totalAmount),f=e.total!==void 0?w(o,e.total,{decimals:e.decimals,rounding:e.rounding}):s;if(f<s)throw new a(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ne)throw new a("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ge)throw new a(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let i=e.endTime!==void 0?H(e.endTime,"endTime"):0n;if(i>be)throw new a("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new a(`Token ${n} has no contract code on chain ${x}.`);let u;if(i!==0n){let _=(await l.getBlock()).timestamp,B=e.inclusionMargin!==void 0?H(e.inclusionMargin,"inclusionMargin"):pe;if(B<=0n)throw new a("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let D=_+B,I=e.inclusionTime!==void 0?H(e.inclusionTime,"inclusionTime"):D;if(I<D)throw new a(`inclusionTime (${I.toString()}) must be after the already-mined block (${_.toString()}) with room for signing and inclusion (>= ${D.toString()}).`);u=I;let F=I+fe;if(i<F)throw new a(`endTime (${i.toString()}) is too short (window too short): must be 0 or at least inclusion time (${I.toString()}) + 604800 (7 days >= ${F.toString()}, after already-mined block.timestamp ${_.toString()}).`)}let g=await l.readContract({address:C,abi:T,functionName:"quote",args:[t]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>Q)throw new a(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${Q.toString()}).`);let b=o.formatAmount(y.toString(),W.decimals),h=o.approval(n,C,f.toString(),x),k=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"create",args:[n,d.root,f,t,i,m]}),value:y.toString(),description:`Create HoodLock airdrop (${t} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),v=[h,k],E=A(e.account??r??xe,"wallet"),R=await o.preview(v,E),le=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",se=`${te(o,R)}${le}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:t,endTime:i,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:v,preview:R,summary:se}}async function G(o,e,r,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==r)throw new a(`savedProof account (${m}) does not match claim account (${r}).`);return{index:n.savedProof.index,amount:w(o,n.savedProof.amount),proof:n.savedProof.proof}}if(n.proof!==void 0&&n.index!==void 0&&n.amount!==void 0){let m=Number(n.index);if(!Number.isInteger(m)||m<0)throw new a(`Invalid claim index: ${String(n.index)}`);return{index:m,amount:w(o,n.amount),proof:n.proof}}if(n.list||n.entries){let p=(n.list?ke(n.list):U(n.entries,{context:o})).proofs.find(i=>!(!S(i.account,r)||n.index!==void 0&&i.index!==Number(n.index)));if(!p)throw new a(`Account ${r} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${oe}/api/airdrop/${e.toString()}/proof?address=${r}`,t=await ae(o,d),s=t?.data??t;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new a(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${r}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new a(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function de(o,e){let r=o.clientFor(x),n=await r.readContract({address:C,abi:T,functionName:"getAirdrop",args:[e.id]}),[d,t,s,f,m,p,i,,l]=n,c=BigInt(t),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===ee||i.toLowerCase()===re)throw new a(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new a(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await r.getBlock()).timestamp>=c)throw new a(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new a(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([r.readContract({address:C,abi:T,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),we(r,b)]);if(h)throw new a(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new a(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let v=L(e.index,e.account,e.amount),E=ie(v,e.proof);if(!S(E,i))throw new a(`Computed Merkle root ${E} does not match on-chain airdrop root ${i} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:i,leaf:v}}async function Se(o,e){let{tokenAddress:r,tokenMeta:n,merkleRoot:d,leaf:t}=await de(o,e),s=e.caller??e.account,f=!S(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"claim",args:[e.id,BigInt(e.index),e.account,e.amount,[...e.proof]]}),value:"0",description:f?`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for recipient ${e.account} (caller ${s} pays gas only, token delta 0)`:`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for ${e.account}`}),i=[p],l=await o.preview(i,s),c,u,g=e.amount.toString(),y;if(f){let b=l.changes.filter(h=>h.amount.trim().startsWith("-"));c={...l,changes:b,summary:`${l.summary} Recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units); caller ${s} change is 0 (gas only).`},u=`Third-party claim from HoodLock airdrop #${e.id.toString()} (index ${e.index}): recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}); caller ${s} own token change is 0 (gas only). ${l.summary}`,y="0"}else c=l,u=`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${te(o,c)}`,y=e.amount.toString();return{kind:"hoodlock_airdrop_claim",chainId:x,id:e.id,index:e.index,account:e.account,recipient:e.account,caller:e.caller,token:r,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:t,merkleRoot:d,proof:[...e.proof],tx:p,txs:i,preview:c,summary:u}}async function Ce(o,e,r){let n=A(e.account??r??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):r!==void 0?A(r,"wallet"):void 0;if(e.id!==void 0){let l=H(e.id,"id"),c=await G(o,l,n,e);return Se(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let t=`${oe}/api/airdrop/eligible?address=${n}`,s=await ae(o,t),f=Array.isArray(s)?s:s?.claimable??s?.eligible??s?.airdrops??s?.claims??[],m=[];for(let l of f){let c=l.id??l.airdropId;if(c!==void 0)try{let u=H(c,"eligible.id"),g,y,b;if(l.index!==void 0&&l.amount!==void 0&&Array.isArray(l.proof))g=Number(l.index),y=w(o,l.amount),b=l.proof;else{let k=await G(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await de(o,{id:u,index:g,account:n,amount:y,proof:b});m.push({id:u.toString(),index:g,account:n,token:h.tokenAddress,amount:y.toString(),proof:[...b],merkleRoot:h.merkleRoot})}catch{continue}}let p=m.length===0?`No verified eligible HoodLock airdrops were returned by the index for ${n}. Discovery can lag after creation; this does not prove there are no claims. If you know the airdrop id, call hoodlock_airdrop_claim with id and account to resolve its list/proof and verify it on-chain.`:`Found ${m.length} eligible HoodLock airdrop(s) for ${n}: ${m.map(l=>`#${l.id}`).join(", ")}. Discovery can lag after creation. Choose an id, or pass a known new id, to hoodlock_airdrop_claim to verify and build a claim transaction.`;return{kind:"hoodlock_airdrop_eligible",chainId:x,account:n,recipient:n,caller:d,recipientDelta:"0",senderDelta:"0",eligible:m,claims:[],tx:void 0,txs:[],preview:{txs:[],changes:[],summary:p},summary:p}}var ve=o=>({tools:[{name:"hoodlock_airdrop_create",inputSchema:{type:"object",required:["token","entries"],additionalProperties:!1,properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663"},entries:{type:"array",description:"Ordered airdrop entries [{ index?, account, amount }] with base-unit integer string amounts"},total:{type:"string",description:"Optional total funded token amount as a base-unit integer string (>= sum of entries)"},maxClaims:{type:"number",description:"Optional claim count (must equal entries.length in 1..250000)"},endTime:{type:"number",description:"Unix timestamp in seconds (0 for non-sweepable or >= inclusion time + 604800)"},inclusionTime:{type:"number",description:"Optional expected transaction inclusion Unix timestamp in seconds (> already-mined block.timestamp)"},inclusionMargin:{type:"number",description:"Optional signing and inclusion margin in seconds above the already-mined block.timestamp (>= 1, default 30)"},uri:{type:"string",description:"Metadata URI (<= 256 UTF-8 bytes)"},decimals:{type:"number",description:"Optional token decimals when converting human decimal entry amounts via parseAmount"},rounding:{type:"string",enum:["floor","ceil"],description:"Optional rounding mode (floor or ceil) when converting decimal amounts"},account:{type:"string",description:"Optional creator wallet address for preview simulation"}}},execute:async(e,r)=>$e(o,e,r)},{name:"hoodlock_airdrop_claim",inputSchema:{type:"object",required:["account"],additionalProperties:!1,properties:{id:{type:"string",description:"Optional airdrop ID (omit to query eligible airdrops)"},account:{type:"string",description:"Leaf recipient address that receives the tokens"},caller:{type:"string",description:"Optional caller/relayer address submitting the tx (pays gas only, receives 0 tokens)"},index:{type:"number",description:"Optional leaf index when supplying proof directly or selecting from list/entries"},amount:{type:"string",description:"Optional leaf amount as a base-unit integer string"},proof:{type:"array",items:{type:"string"},description:"Optional Merkle sibling proof array of 32-byte hex strings"},savedProof:{type:"object",description:"Optional saved proof item ({ index, account, amount, leaf?, proof }) from hoodlock_airdrop_create"},list:{type:"object",description:"Optional saved airdrop list ({ format, leafEncoding, root, totalAmount, maxClaims, values, entries }) to rebuild proof locally"},entries:{type:"array",description:"Optional airdrop entries array ([{ index?, account, amount }]) to rebuild proof locally"}}},execute:async(e,r)=>Ce(o,e,r)}]}),Le=ve;export{V as a,x as b,C as c,oe as d,P as e,ge as f,fe as g,pe as h,Q as i,T as j,he as k,L as l,ie as m,Ne as n,U as o,ke as p,ve as q,Le as r};
1
+ import{d as N}from"./UNJJRQIU.js";import{b as W}from"./W7QNSNOH.js";import{c as K}from"./SCG5HWMN.js";import{g as S}from"./NWNYJ26T.js";import{a as j,b as M,c as O}from"./IX3GZMTM.js";import{b as q,j as z}from"./TI727O2H.js";import{a}from"./XSD5NL7J.js";import{a as $}from"./JXOEJPJ4.js";import{encodeAbiParameters as ce,encodeFunctionData as J,erc20Abi as V,getAddress as Z,isAddress as me,keccak256 as X,parseAbi as ue,parseAbiParameters as ye,zeroAddress as ee}from"viem";var x=q,C=Z(z[x].hoodlock.airdrop.address),oe="https://hoodlock.tech",P=25e4,ge=256,fe=604800n,pe=30n,Q=250000000000000000n,Y=0xffffffffn,be=(1n<<64n)-1n,ne=(1n<<128n)-1n,re="0x0000000000000000000000000000000000000000000000000000000000000000",xe="0x1111111111111111111111111111111111111111",Ae=ye("uint256, address, uint256"),T=ue(["function quote(uint32 maxClaims) view returns (uint256)","function create(address token, bytes32 merkleRoot, uint256 total, uint32 maxClaims, uint64 endTime, string uri) payable returns (uint256 id)","function claim(uint256 id, uint256 index, address account, uint256 amount, bytes32[] proof)","function getAirdrop(uint256 id) view returns (address creator, uint64 endTime, uint32 maxClaims, address token, uint32 claims, bool swept, bytes32 merkleRoot, uint128 total, uint128 remaining)","function isClaimed(uint256 id, uint256 index) view returns (bool)"]);function he(o,e,r){let n=e.trim();if(n.startsWith("-")){let t=n.slice(1);return`-${o.formatAmount(t,r)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,r)}function te(o,e){if(!e.changes.length)return e.summary;let r=e.changes.map(n=>`${he(o,n.amount,n.token.decimals)} ${$(n.token.symbol)}`).join(", ");return`${e.summary} (${r})`}async function we(o,e){try{let[r,n]=await Promise.all([o.readContract({address:e,abi:V,functionName:"symbol"}),o.readContract({address:e,abi:V,functionName:"decimals"})]),d=typeof r=="string"&&r.trim()?r.trim():"TOKEN",t=Number(n);return{symbol:d,decimals:Number.isInteger(t)&&t>=0&&t<=255?t:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,r){if(typeof e=="string"&&e.includes(".")){if(r?.decimals===void 0)throw new a(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=r.rounding!==void 0?O(e,r.decimals,r.rounding):o?o.parseAmount(e,r.decimals):O(e,r.decimals),t=M(d);if(t<=0n)throw new a("Airdrop entry amount must be positive.");return t}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=M(e.trim());else throw j()}catch(d){throw d instanceof a?d:new a(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new a("Airdrop entry amount must be strictly positive (> 0).");return n}function H(o,e){try{let r=typeof o=="bigint"?o:BigInt(String(o).trim());if(r<0n)throw new a(`${e} must be non-negative.`);return r}catch(r){throw r instanceof a?r:new a(`Invalid ${e}: ${String(o)}`,{cause:r})}}function A(o,e){if(typeof o!="string"||!me(o,{strict:!1}))throw new a(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return Z(o)}function L(o,e,r){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>Y)throw new a(`Airdrop leaf index must be in 0..${Y.toString()}.`);let d=A(e,"account"),t=w(void 0,r),s=ce(Ae,[n,d,t]);return X(X(s))}function ie(o,e){let r=o;for(let n of e)r=N(r,n);return r}function Ne(o){try{let e=L(o.index,o.account,o.amount),r=ie(e,o.proof);return S(r,o.root)}catch{return!1}}function U(o,e){if(!Array.isArray(o)||o.length===0)throw new a("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new a(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let r=[],n=0n;for(let i=0;i<o.length;i+=1){let l=o[i];if(!l)throw new a(`Missing airdrop entry at position ${i}.`);let c=l.index??i;if(!Number.isInteger(c)||c!==i)throw new a(`Airdrop entry index at position ${i} must be contiguous ${i} (got ${String(c)}).`);let u=A(l.account,`entries[${i}].account`),g=w(e?.context,l.amount,e);n+=g,r.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ne)throw new a("Airdrop total amount must be > 0 and fit in uint128.");let d=r.map(i=>L(i.index,i.account,i.amount)),t=[d];for(;t[t.length-1].length>1;){let i=t[t.length-1],l=[];for(let c=0;c<i.length;c+=2){let u=i[c],g=i[c+1];g===void 0?l.push(u):l.push(N(u,g))}t.push(l)}let s=t[t.length-1][0];if(s.toLowerCase()===re)throw new a("Computed Merkle root cannot be zero.");let f=t.length>1?t[1]:t[0],m=r.map((i,l)=>{let c=[],u=l;for(let g=0;g<t.length-1;g+=1){let y=t[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:i.index,account:i.account,amount:i.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:r.length,values:r.map(i=>[i.index,i.account,i.amount]),entries:r};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:r.length,entries:r,proofs:m,list:p}}function ke(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new a("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,t])=>({index:n,account:d,amount:t})),r=U(e);if(o.root&&!S(r.root,o.root))throw new a(`Rebuilt tree root ${r.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&r.maxClaims!==o.maxClaims)throw new a(`Rebuilt maxClaims (${r.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&r.totalAmount!==o.totalAmount)throw new a(`Rebuilt totalAmount (${r.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return r}async function ae(o,e){return K(o.http,e,{method:"GET"},r=>r!==null&&typeof r=="object")}async function $e(o,e,r){let n=A(e.token,"token");if(n===ee)throw new a("Airdrop token cannot be the zero address.");let d=U(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),t=e.maxClaims??d.maxClaims;if(!Number.isInteger(t)||t<1||t>P||t!==d.maxClaims)throw new a(`maxClaims (${String(t)}) must equal entries.length (${d.maxClaims}) and be in 1..${P}.`);let s=BigInt(d.totalAmount),f=e.total!==void 0?w(o,e.total,{decimals:e.decimals,rounding:e.rounding}):s;if(f<s)throw new a(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ne)throw new a("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ge)throw new a(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let i=e.endTime!==void 0?H(e.endTime,"endTime"):0n;if(i>be)throw new a("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new a(`Token ${n} has no contract code on chain ${x}.`);let u;if(i!==0n){let _=(await l.getBlock()).timestamp,B=e.inclusionMargin!==void 0?H(e.inclusionMargin,"inclusionMargin"):pe;if(B<=0n)throw new a("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let D=_+B,I=e.inclusionTime!==void 0?H(e.inclusionTime,"inclusionTime"):D;if(I<D)throw new a(`inclusionTime (${I.toString()}) must be after the already-mined block (${_.toString()}) with room for signing and inclusion (>= ${D.toString()}).`);u=I;let F=I+fe;if(i<F)throw new a(`endTime (${i.toString()}) is too short (window too short): must be 0 or at least inclusion time (${I.toString()}) + 604800 (7 days >= ${F.toString()}, after already-mined block.timestamp ${_.toString()}).`)}let g=await l.readContract({address:C,abi:T,functionName:"quote",args:[t]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>Q)throw new a(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${Q.toString()}).`);let b=o.formatAmount(y.toString(),W.decimals),h=o.approval(n,C,f.toString(),x),k=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"create",args:[n,d.root,f,t,i,m]}),value:y.toString(),description:`Create HoodLock airdrop (${t} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),v=[h,k],E=A(e.account??r??xe,"wallet"),R=await o.preview(v,E),le=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",se=`${te(o,R)}${le}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:t,endTime:i,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:v,preview:R,summary:se}}async function G(o,e,r,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==r)throw new a(`savedProof account (${m}) does not match claim account (${r}).`);return{index:n.savedProof.index,amount:w(o,n.savedProof.amount),proof:n.savedProof.proof}}if(n.proof!==void 0&&n.index!==void 0&&n.amount!==void 0){let m=Number(n.index);if(!Number.isInteger(m)||m<0)throw new a(`Invalid claim index: ${String(n.index)}`);return{index:m,amount:w(o,n.amount),proof:n.proof}}if(n.list||n.entries){let p=(n.list?ke(n.list):U(n.entries,{context:o})).proofs.find(i=>!(!S(i.account,r)||n.index!==void 0&&i.index!==Number(n.index)));if(!p)throw new a(`Account ${r} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${oe}/api/airdrop/${e.toString()}/proof?address=${r}`,t=await ae(o,d),s=t?.data??t;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new a(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${r}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new a(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function de(o,e){let r=o.clientFor(x),n=await r.readContract({address:C,abi:T,functionName:"getAirdrop",args:[e.id]}),[d,t,s,f,m,p,i,,l]=n,c=BigInt(t),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===ee||i.toLowerCase()===re)throw new a(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new a(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await r.getBlock()).timestamp>=c)throw new a(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new a(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([r.readContract({address:C,abi:T,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),we(r,b)]);if(h)throw new a(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new a(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let v=L(e.index,e.account,e.amount),E=ie(v,e.proof);if(!S(E,i))throw new a(`Computed Merkle root ${E} does not match on-chain airdrop root ${i} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:i,leaf:v}}async function Se(o,e){let{tokenAddress:r,tokenMeta:n,merkleRoot:d,leaf:t}=await de(o,e),s=e.caller??e.account,f=!S(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"claim",args:[e.id,BigInt(e.index),e.account,e.amount,[...e.proof]]}),value:"0",description:f?`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for recipient ${e.account} (caller ${s} pays gas only, token delta 0)`:`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for ${e.account}`}),i=[p],l=await o.preview(i,s),c,u,g=e.amount.toString(),y;if(f){let b=l.changes.filter(h=>h.amount.trim().startsWith("-"));c={...l,changes:b,summary:`${l.summary} Recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units); caller ${s} change is 0 (gas only).`},u=`Third-party claim from HoodLock airdrop #${e.id.toString()} (index ${e.index}): recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}); caller ${s} own token change is 0 (gas only). ${l.summary}`,y="0"}else c=l,u=`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${te(o,c)}`,y=e.amount.toString();return{kind:"hoodlock_airdrop_claim",chainId:x,id:e.id,index:e.index,account:e.account,recipient:e.account,caller:e.caller,token:r,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:t,merkleRoot:d,proof:[...e.proof],tx:p,txs:i,preview:c,summary:u}}async function Ce(o,e,r){let n=A(e.account??r??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):r!==void 0?A(r,"wallet"):void 0;if(e.id!==void 0){let l=H(e.id,"id"),c=await G(o,l,n,e);return Se(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let t=`${oe}/api/airdrop/eligible?address=${n}`,s=await ae(o,t),f=Array.isArray(s)?s:s?.claimable??s?.eligible??s?.airdrops??s?.claims??[],m=[];for(let l of f){let c=l.id??l.airdropId;if(c!==void 0)try{let u=H(c,"eligible.id"),g,y,b;if(l.index!==void 0&&l.amount!==void 0&&Array.isArray(l.proof))g=Number(l.index),y=w(o,l.amount),b=l.proof;else{let k=await G(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await de(o,{id:u,index:g,account:n,amount:y,proof:b});m.push({id:u.toString(),index:g,account:n,token:h.tokenAddress,amount:y.toString(),proof:[...b],merkleRoot:h.merkleRoot})}catch{continue}}let p=m.length===0?`No verified eligible HoodLock airdrops were returned by the index for ${n}. Discovery can lag after creation; this does not prove there are no claims. If you know the airdrop id, call hoodlock_airdrop_claim with id and account to resolve its list/proof and verify it on-chain.`:`Found ${m.length} eligible HoodLock airdrop(s) for ${n}: ${m.map(l=>`#${l.id}`).join(", ")}. Discovery can lag after creation. Choose an id, or pass a known new id, to hoodlock_airdrop_claim to verify and build a claim transaction.`;return{kind:"hoodlock_airdrop_eligible",chainId:x,account:n,recipient:n,caller:d,recipientDelta:"0",senderDelta:"0",eligible:m,claims:[],tx:void 0,txs:[],preview:{txs:[],changes:[],summary:p},summary:p}}var ve=o=>({tools:[{name:"hoodlock_airdrop_create",inputSchema:{type:"object",required:["token","entries"],additionalProperties:!1,properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663"},entries:{type:"array",description:"Ordered airdrop entries [{ index?, account, amount }] with base-unit integer string amounts"},total:{type:"string",description:"Optional total funded token amount as a base-unit integer string (>= sum of entries)"},maxClaims:{type:"number",description:"Optional claim count (must equal entries.length in 1..250000)"},endTime:{type:"number",description:"Unix timestamp in seconds (0 for non-sweepable or >= inclusion time + 604800)"},inclusionTime:{type:"number",description:"Optional expected transaction inclusion Unix timestamp in seconds (> already-mined block.timestamp)"},inclusionMargin:{type:"number",description:"Optional signing and inclusion margin in seconds above the already-mined block.timestamp (>= 1, default 30)"},uri:{type:"string",description:"Metadata URI (<= 256 UTF-8 bytes)"},decimals:{type:"number",description:"Optional token decimals when converting human decimal entry amounts via parseAmount"},rounding:{type:"string",enum:["floor","ceil"],description:"Optional rounding mode (floor or ceil) when converting decimal amounts"},account:{type:"string",description:"Optional creator wallet address for preview simulation"}}},execute:async(e,r)=>$e(o,e,r)},{name:"hoodlock_airdrop_claim",inputSchema:{type:"object",required:["account"],additionalProperties:!1,properties:{id:{type:"string",description:"Optional airdrop ID (omit to query eligible airdrops)"},account:{type:"string",description:"Leaf recipient address that receives the tokens"},caller:{type:"string",description:"Optional caller/relayer address submitting the tx (pays gas only, receives 0 tokens)"},index:{type:"number",description:"Optional leaf index when supplying proof directly or selecting from list/entries"},amount:{type:"string",description:"Optional leaf amount as a base-unit integer string"},proof:{type:"array",items:{type:"string"},description:"Optional Merkle sibling proof array of 32-byte hex strings"},savedProof:{type:"object",description:"Optional saved proof item ({ index, account, amount, leaf?, proof }) from hoodlock_airdrop_create"},list:{type:"object",description:"Optional saved airdrop list ({ format, leafEncoding, root, totalAmount, maxClaims, values, entries }) to rebuild proof locally"},entries:{type:"array",description:"Optional airdrop entries array ([{ index?, account, amount }]) to rebuild proof locally"}}},execute:async(e,r)=>Ce(o,e,r)}]}),Le=ve;export{V as a,x as b,C as c,oe as d,P as e,ge as f,fe as g,pe as h,Q as i,T as j,he as k,L as l,ie as m,Ne as n,U as o,ke as p,ve as q,Le as r};
@@ -0,0 +1 @@
1
+ import{g as k,h as A}from"./BSX4LFYI.js";import{g as i}from"./NWNYJ26T.js";import{b as l,j as m,n as y}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{decodeFunctionData as P,parseAbi as g}from"viem";var x=g(["function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]);function f(s){return k(s)}function K(s,e,o,t){let d=f(s),c=f(e),[p,n]=BigInt(d)<BigInt(c)?[d,c]:[c,d];return{currency0:p,currency1:n,fee:o,tickSpacing:t,hooks:m[l].pons.memeHook.address}}function h(s){let e=A(s,[y]),o=e.legs[0];if(e.permit||e.legs.length!==1||!o)throw new r("Pons router must contain one canonical v4 swap command.");return{swap:{poolKey:o.poolKey,zeroForOne:o.zeroForOne,amountIn:e.amountIn,amountOutMinimum:e.amountOutMinimum,minHopPriceX36:0n,hookData:"0x"},deadline:e.deadline}}function H(s,e){let o=(n,w,a)=>{if(!i(n,w))throw new r(`Built swap ${a} does not match the accepted quote.`)},t=e.ponsPoolToken??e.ponsCurveToken;if(!t||e.ponsPoolToken&&e.ponsCurveToken)throw new r("Pons quote must name exactly one curve or pool token.");let d=i(e.to,t);if(!d&&!i(e.from,t))throw new r("Pons quote must trade its launch token.");let c=d?e.from:e.to;if(i(f(c),t))throw new r("Pons quote pair must differ from its launch token.");if(e.ponsPoolToken){if(o(e.router,m[l].ponsTrade.universal_router.address,"Pons router"),o(e.spender??e.router,m[l].ponsTrade.permit2.address,"Pons spender"),!e.data)throw new r("Pons pool quote must include locally reconstructed calldata.");let{swap:n,deadline:w}=h(s.data),a=h(e.data),u=K(c,t,a.swap.poolKey.fee,a.swap.poolKey.tickSpacing);if(o(n.poolKey.currency0,u.currency0,"pool currency0"),o(n.poolKey.currency1,u.currency1,"pool currency1"),o(n.poolKey.hooks,u.hooks,"pool hook"),n.zeroForOne!==i(f(e.from),u.currency0)||n.poolKey.fee!==a.swap.poolKey.fee||n.poolKey.tickSpacing!==a.swap.poolKey.tickSpacing||w!==a.deadline)throw new r("Pons pool direction, parameters or deadline differ from the accepted quote.");return{from:e.from,to:e.to,wallet:e.wallet,amount:n.amountIn}}let p=P({abi:x,data:s.data});if(p.functionName!==(d?"buy":"sell"))throw new r("Pons curve direction does not match the accepted quote.");return o(e.spender??e.router,e.router,"curve spender"),{from:e.from,to:e.to,wallet:p.args[2],amount:p.args[0]}}export{x as a,f as b,K as c,h as d,H as e};
@@ -1 +1 @@
1
- import{c as i,d as T,e as O,f as C}from"./OUROA7XR.js";import{b as A}from"./43LI5NKJ.js";import{a as F,i as R}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{decodeFunctionData as U,encodeFunctionData as N,parseAbi as Q,zeroAddress as S}from"viem";var v=R[4663].pendle.router.address,I=Q(["struct SwapData { uint8 swapType; address extRouter; bytes extCalldata; bool needScale; }","struct TokenInput { address tokenIn; uint256 netTokenIn; address tokenMintSy; address pendleSwap; SwapData swapData; }","struct TokenOutput { address tokenOut; uint256 minTokenOut; address tokenRedeemSy; address pendleSwap; SwapData swapData; }","struct ApproxParams { uint256 guessMin; uint256 guessMax; uint256 guessOffchain; uint256 maxIteration; uint256 eps; }","struct Order { uint256 salt; uint256 expiry; uint256 nonce; uint8 orderType; address token; address YT; address maker; address receiver; uint256 makingAmount; uint256 lnImpliedRate; uint256 failSafeRate; bytes permit; }","struct FillOrderParams { Order order; bytes signature; uint256 makingAmount; }","struct LimitOrderData { address limitRouter; uint256 epsSkipMarket; FillOrderParams[] normalFills; FillOrderParams[] flashFills; bytes optData; }","function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,ApproxParams approx,TokenInput input,LimitOrderData limit) payable returns(uint256,uint256,uint256)","function swapExactPtForToken(address receiver,address market,uint256 netPtIn,TokenOutput output,LimitOrderData limit) returns(uint256,uint256,uint256)","function redeemPyToToken(address receiver,address YT,uint256 netPyIn,TokenOutput output) returns(uint256,uint256)"]);function e(n,t){if(!n)throw new y(`Pendle quote refused: ${t}. Nothing was signed.`)}function a(n,t){return typeof n=="string"&&n.toLowerCase()===t.toLowerCase()}function Y(n,t){return e(Number.isInteger(t)&&t>=0&&t<=1e4,"invalid slippage limit"),n*BigInt(1e4-t)/10000n}function M(n){e(a(n.pendleSwap,S),"unexpected swap contract"),e(n.swapData.swapType===0,"unexpected swap type"),e(a(n.swapData.extRouter,S),"unexpected external router"),e(n.swapData.extCalldata==="0x","unexpected external calldata"),e(n.swapData.needScale===!1,"unexpected swap scaling")}function V(n){e(a(n.limitRouter,S),"limit orders are not supported"),e(n.normalFills.length===0,"unexpected normal limit fills"),e(n.flashFills.length===0,"unexpected flash limit fills"),e(n.optData==="0x","unexpected limit order data"),e(n.epsSkipMarket===0n,"unexpected limit order tolerance")}function E(n,t,d){let g=C(n),s=i(g.tx);e(a(s.to,v),"wrong router"),e(s.value===void 0||s.value==="0","unexpected or malformed ETH value"),e(t.amount>0n&&t.amount<1n<<256n,"invalid requested amount");let P=g.outputs;e(P.length===1,"expected exactly one output token");let h=i(P[0]);e(a(O(h.token),d==="buy"?t.market.pt:t.market.inputToken),"wrong quoted output token");let w=T(h.amount);e(w>0n,"empty quoted output");let q=Y(w,t.slippageBps),D=i(n).requiredApprovals;e(D.length===1,"expected exactly one approval");let p=i(D[0]);e(a(O(p.token),d==="buy"?t.market.inputToken:t.market.pt),"wrong approval token"),e(T(p.amount)===t.amount,"wrong approval amount"),e(p.spender===void 0||a(p.spender,v),"wrong approval spender");let l=i(g.data),m=i(l.fee);e(typeof l.priceImpact=="number"&&Number.isFinite(l.priceImpact),"unreadable price impact"),e(typeof m.usd=="number"&&Number.isFinite(m.usd)&&m.usd>=0,"unreadable trading fee");let o;try{o=$(s.data)}catch{throw new y("Pendle quote refused: unknown or malformed router call. Nothing was signed.")}let c,k;if(d==="buy"){e(o.functionName==="swapExactTokenForPt","wrong buy selector");let[f,x,b,r,u,L]=o.args;e(a(f,t.wallet),"wrong receiver"),e(a(x,t.market.market),"wrong market"),e(a(u.tokenIn,t.market.inputToken),"wrong input token"),e(a(u.tokenMintSy,t.market.inputToken),"wrong SY mint token"),e(u.netTokenIn===t.amount,"wrong input amount"),M(u),V(L),e(r.guessMin<=r.guessOffchain,"invalid lower approximation guess"),e(r.guessOffchain<=r.guessMax,"invalid upper approximation guess"),e(r.maxIteration<=256n,"too many approximation iterations"),c=b,k=N({abi:I,functionName:o.functionName,args:o.args})}else{e(o.functionName==="swapExactPtForToken","wrong sell selector");let[f,x,b,r,u]=o.args;e(a(f,t.wallet),"wrong receiver"),e(a(x,t.market.market),"wrong market"),e(b===t.amount,"wrong PT input amount"),e(a(r.tokenOut,t.market.inputToken),"wrong output token"),e(a(r.tokenRedeemSy,t.market.inputToken),"wrong SY redeem token"),M(r),V(u),c=r.minTokenOut,k=N({abi:I,functionName:o.functionName,args:o.args})}return e(c>=q,"minimum output is below Oak\u2019s slippage floor"),e(k.toLowerCase()===s.data.toLowerCase(),"calldata does not match Oak\u2019s encoding"),{tx:A({to:v,data:k,value:"0",chainId:F,description:d==="buy"?"Buy Pendle PT with the exact input amount.":"Sell Pendle PT to the market input token."}),amountOut:w,minOut:c,feeUsd:m.usd,priceImpact:l.priceImpact}}function $(n){return U({abi:I,data:n})}function G(n,t){return E(n,t,"buy")}function J(n,t){return E(n,t,"sell")}export{v as a,I as b,e as c,a as d,Y as e,G as f,J as g};
1
+ import{c as i,d as T,e as O,f as C}from"./OUROA7XR.js";import{b as A}from"./43LI5NKJ.js";import{b as F,j as R}from"./TI727O2H.js";import{a as y}from"./XSD5NL7J.js";import{decodeFunctionData as U,encodeFunctionData as N,parseAbi as Q,zeroAddress as S}from"viem";var v=R[4663].pendle.router.address,I=Q(["struct SwapData { uint8 swapType; address extRouter; bytes extCalldata; bool needScale; }","struct TokenInput { address tokenIn; uint256 netTokenIn; address tokenMintSy; address pendleSwap; SwapData swapData; }","struct TokenOutput { address tokenOut; uint256 minTokenOut; address tokenRedeemSy; address pendleSwap; SwapData swapData; }","struct ApproxParams { uint256 guessMin; uint256 guessMax; uint256 guessOffchain; uint256 maxIteration; uint256 eps; }","struct Order { uint256 salt; uint256 expiry; uint256 nonce; uint8 orderType; address token; address YT; address maker; address receiver; uint256 makingAmount; uint256 lnImpliedRate; uint256 failSafeRate; bytes permit; }","struct FillOrderParams { Order order; bytes signature; uint256 makingAmount; }","struct LimitOrderData { address limitRouter; uint256 epsSkipMarket; FillOrderParams[] normalFills; FillOrderParams[] flashFills; bytes optData; }","function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,ApproxParams approx,TokenInput input,LimitOrderData limit) payable returns(uint256,uint256,uint256)","function swapExactPtForToken(address receiver,address market,uint256 netPtIn,TokenOutput output,LimitOrderData limit) returns(uint256,uint256,uint256)","function redeemPyToToken(address receiver,address YT,uint256 netPyIn,TokenOutput output) returns(uint256,uint256)"]);function e(n,t){if(!n)throw new y(`Pendle quote refused: ${t}. Nothing was signed.`)}function a(n,t){return typeof n=="string"&&n.toLowerCase()===t.toLowerCase()}function Y(n,t){return e(Number.isInteger(t)&&t>=0&&t<=1e4,"invalid slippage limit"),n*BigInt(1e4-t)/10000n}function M(n){e(a(n.pendleSwap,S),"unexpected swap contract"),e(n.swapData.swapType===0,"unexpected swap type"),e(a(n.swapData.extRouter,S),"unexpected external router"),e(n.swapData.extCalldata==="0x","unexpected external calldata"),e(n.swapData.needScale===!1,"unexpected swap scaling")}function V(n){e(a(n.limitRouter,S),"limit orders are not supported"),e(n.normalFills.length===0,"unexpected normal limit fills"),e(n.flashFills.length===0,"unexpected flash limit fills"),e(n.optData==="0x","unexpected limit order data"),e(n.epsSkipMarket===0n,"unexpected limit order tolerance")}function E(n,t,d){let g=C(n),s=i(g.tx);e(a(s.to,v),"wrong router"),e(s.value===void 0||s.value==="0","unexpected or malformed ETH value"),e(t.amount>0n&&t.amount<1n<<256n,"invalid requested amount");let P=g.outputs;e(P.length===1,"expected exactly one output token");let h=i(P[0]);e(a(O(h.token),d==="buy"?t.market.pt:t.market.inputToken),"wrong quoted output token");let w=T(h.amount);e(w>0n,"empty quoted output");let q=Y(w,t.slippageBps),D=i(n).requiredApprovals;e(D.length===1,"expected exactly one approval");let p=i(D[0]);e(a(O(p.token),d==="buy"?t.market.inputToken:t.market.pt),"wrong approval token"),e(T(p.amount)===t.amount,"wrong approval amount"),e(p.spender===void 0||a(p.spender,v),"wrong approval spender");let l=i(g.data),m=i(l.fee);e(typeof l.priceImpact=="number"&&Number.isFinite(l.priceImpact),"unreadable price impact"),e(typeof m.usd=="number"&&Number.isFinite(m.usd)&&m.usd>=0,"unreadable trading fee");let o;try{o=$(s.data)}catch{throw new y("Pendle quote refused: unknown or malformed router call. Nothing was signed.")}let c,k;if(d==="buy"){e(o.functionName==="swapExactTokenForPt","wrong buy selector");let[f,x,b,r,u,L]=o.args;e(a(f,t.wallet),"wrong receiver"),e(a(x,t.market.market),"wrong market"),e(a(u.tokenIn,t.market.inputToken),"wrong input token"),e(a(u.tokenMintSy,t.market.inputToken),"wrong SY mint token"),e(u.netTokenIn===t.amount,"wrong input amount"),M(u),V(L),e(r.guessMin<=r.guessOffchain,"invalid lower approximation guess"),e(r.guessOffchain<=r.guessMax,"invalid upper approximation guess"),e(r.maxIteration<=256n,"too many approximation iterations"),c=b,k=N({abi:I,functionName:o.functionName,args:o.args})}else{e(o.functionName==="swapExactPtForToken","wrong sell selector");let[f,x,b,r,u]=o.args;e(a(f,t.wallet),"wrong receiver"),e(a(x,t.market.market),"wrong market"),e(b===t.amount,"wrong PT input amount"),e(a(r.tokenOut,t.market.inputToken),"wrong output token"),e(a(r.tokenRedeemSy,t.market.inputToken),"wrong SY redeem token"),M(r),V(u),c=r.minTokenOut,k=N({abi:I,functionName:o.functionName,args:o.args})}return e(c>=q,"minimum output is below Oak\u2019s slippage floor"),e(k.toLowerCase()===s.data.toLowerCase(),"calldata does not match Oak\u2019s encoding"),{tx:A({to:v,data:k,value:"0",chainId:F,description:d==="buy"?"Buy Pendle PT with the exact input amount.":"Sell Pendle PT to the market input token."}),amountOut:w,minOut:c,feeUsd:m.usd,priceImpact:l.priceImpact}}function $(n){return U({abi:I,data:n})}function G(n,t){return E(n,t,"buy")}function J(n,t){return E(n,t,"sell")}export{v as a,I as b,e as c,a as d,Y as e,G as f,J as g};
@@ -0,0 +1 @@
1
+ import{b as N}from"./CQ5WRWV4.js";import{a as O,b as R,c as Z,d as ue}from"./IV4K7FMD.js";import{a as Ae,e as ge}from"./GK3D7OKG.js";import{d as he}from"./OIQTZOBN.js";import{b as x}from"./Z7FGEWO2.js";import{a as de,b as ce,d as le,f as V,g as J,h as M,j as me,k as pe,l as fe,m as we}from"./BSX4LFYI.js";import{a as f,b as X,c as ie}from"./43LI5NKJ.js";import{c as Y}from"./5TUXSOMI.js";import{g as G}from"./NWNYJ26T.js";import{b as r,e as ae}from"./IX3GZMTM.js";import{A as se,b as F,j as W,x as j,y as Q}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{decodeFunctionData as C,encodeFunctionData as U,parseAbi as Oe}from"viem";var Be=60,te=50,tt=200;var De="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",ne="0x0000000000000000000000000000000000000000",D=W[4663].routes.kyberswap.address,y=W[4663].routes.velora.address,oe=j[4663].kyberswap.toLowerCase(),Se=j[4663].velora.toLowerCase(),Te="0x0000000000000000000000000000000000000000000000000000000000000000",Re=[le.pons,...V],$=Oe(["function swap((address callTarget, address approveTarget, bytes targetData, (address srcToken, address dstToken, address[] srcReceivers, uint256[] srcAmounts, address[] feeReceivers, uint256[] feeAmounts, address dstReceiver, uint256 amount, uint256 minReturnAmount, uint256 flags, bytes permit) desc, bytes clientData) execution) payable returns (uint256 returnAmount, uint256 gasUsed)"]),H=Oe(["function swapExactAmountIn(address executor, (address srcToken, address destToken, uint256 fromAmount, uint256 toAmount, uint256 quotedAmount, bytes32 metadata, address beneficiary) swapData, uint256 partnerAndFee, bytes permit, bytes executorData) payable returns (uint256 receivedAmount, uint256 submittedAmount, uint256 augustusFeeAmount)"]),E=class extends o{name="NoRouteError";constructor(t="No swap route is available for this token pair and amount."){super(t)}},L=class extends o{name="ExpiredQuoteError";constructor(t="Quote has expired. Request a fresh quote."){super(t)}},Ce=1e3,I=new Map;function be(e){for(let[t,n]of I)BigInt(e)>=r(n.expiresAt)&&I.delete(t)}function ee(e){return{...e,...e.sourcePoolRoute!==void 0?{sourcePoolRoute:structuredClone(e.sourcePoolRoute)}:{},...e.txs?{txs:e.txs.map(t=>({...t}))}:{}}}function ve(e){let t=ee(e);return t.txs&&(t.txs.forEach(Object.freeze),Object.freeze(t.txs)),Object.freeze(t)}var ye=["router","from","to","wallet","amountIn","amountOut","minAmountOut","expiresAt","chainId","spender","value","ponsCurveToken","ponsPoolToken","blockNumber","calldataMinAmountOut","expectedSpend","expectedRefund","oakFee","oakFeeBps","oakFeeToken","grossAmountOut","venueFee","venueFeeBps"];function K(e,t,n=!1){for(let s of ye)if(!(s==="expiresAt"&&n&&r(e.expiresAt)<=r(t.expiresAt))&&e[s]!==void 0&&String(e[s]).toLowerCase()!==String(t[s]).toLowerCase())throw new o(`Quote ${s} does not match the accepted quote.`)}function z(e=Date.now){let t=e();if(!Number.isFinite(t)||t<0)throw new o("Clock must return a non-negative timestamp.");return t>1e11?Math.floor(t/1e3):Math.floor(t)}function _(e){let t=e.toLowerCase();return t===De.toLowerCase()||t===ne.toLowerCase()}function Le(e,t=te){if(!Number.isInteger(t)||t<0||t>=1e4)throw new o("Slippage must be an integer from 0 to 9999 bps.");return ae(e,String(1e4-t),"10000","floor")}var _e=200;function nt(e){if(typeof e!="number"||!Number.isFinite(e)||!/^\d+(?:\.\d{1,2})?$/.test(String(e)))throw new o("Velora returned an unsupported venue fee. Request a fresh quote.");let[t,n=""]=String(e).split("."),s=Number(t)*100+Number(n.padEnd(2,"0"));return re(s),s}function re(e){if(!Number.isInteger(e)||e<0||e>_e)throw new o("Velora returned an unsupported venue fee. Request a fresh quote.")}function ke(e,t=O.bps){return re(t),r(e)*10000n/BigInt(1e4-t)+1n}function Pe(e,t){if(re(t),t!==O.bps||e!==Z)throw new o("Velora partnerAndFee must match the pinned Oak fee, recipient and flags.")}function Ie(e){if(e.oakFeeBps===O.bps)return`${ue()} ${e.provider==="velora"?"Oak\u2019s share is paid to the Oak treasury.":"Paid to the Oak treasury."} Venue fee: ${e.venueFee} base units (${e.venueFeeBps} bps) retained by ${e.provider??"venue"}. Output and minimum are net.${e.provider==="velora"?" Velora retains 15% of the partner fee; Oak receives 85% (about 21.25 bps).":""}`;if(e.oakFee!==void 0&&r(e.oakFee)!==0n)throw new o("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");let t=e.provider??"venue";return`Venue fee: ${e.venueFee} base units (${e.venueFeeBps} bps) retained by ${t}; Oak swap fee: 0 (venue fee is never Oak income).`}function Qe(e){f(e.from),f(e.to),f(e.wallet);let t=e.callTarget??Q[F].kyberswap.address,n=e.approveTarget??ne;f(t),f(n);let s=r(e.amountIn),a=r(e.minAmountOut);return U({abi:$,functionName:"swap",args:[{callTarget:t,approveTarget:n,targetData:e.targetData??"0x",desc:{srcToken:e.from,dstToken:e.to,srcReceivers:_(e.from)?[]:[t],srcAmounts:_(e.from)?[]:[s-BigInt(R(e.amountIn))],feeReceivers:[O.recipient],feeAmounts:[BigInt(O.bps)],dstReceiver:e.wallet,amount:s,minReturnAmount:a,flags:640n,permit:"0x"},clientData:e.clientData??"0x"}]})}function Ne(e){f(e.from),f(e.to),f(e.wallet);let t=e.executor??Q[F].velora.address;return f(t),U({abi:H,functionName:"swapExactAmountIn",args:[t,{srcToken:e.from,destToken:e.to,fromAmount:r(e.amountIn),toAmount:r(e.minAmountOut),quotedAmount:r(e.amountOut),metadata:e.metadata??Te,beneficiary:e.wallet},e.partnerAndFee??Z,"0x",e.executorData??"0x"]})}function Ve(e){if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})+$/.test(e)||e.length<10)throw new o("Swap calldata must contain a 4-byte function selector.");let t=e.slice(0,10).toLowerCase();if(t===oe)return C({abi:$,data:e}).args[0].desc.minReturnAmount;if(t===Se)return C({abi:H,data:e}).args[1].toAmount;if(t==="0x3593564c")return M(e,Re).amountOutMinimum;let n=C({abi:Ae,data:e});if(n.functionName==="buy"||n.functionName==="sell")return n.args[1];throw new o(`Unsupported swap router selector ${t}.`)}function Fe(e,t,n=!1){let s=r(t),a=Ve(e);if(a<=0n||s<=0n||a!==s&&!(n&&(a>s||e.slice(0,10).toLowerCase()===oe&&a+1n===s)))throw new o(`Built swap calldata minimum output (${a}) does not match the accepted quote minimum (${s}).`);return a}function xe(e,t){let{from:n,to:s,wallet:a,amountIn:d}=t;if(!n||!s||!a||d===void 0)throw new o("Accepted quote must include input, output, amount and wallet.");for(let u of[n,s,a,t.router,e.to])f(u);let m=(u,l,w)=>{if(u.toLowerCase()!==l.toLowerCase())throw new o(`Built swap ${w} does not match the accepted quote.`)};if(m(e.to,t.router,"router"),e.chainId!==(t.chainId??F))throw new o("Built swap chain does not match the accepted quote.");let A=_(n)?r(d):0n;if(r(e.value)!==A||t.value!==void 0&&r(t.value)!==A)throw new o("Built swap value does not match the accepted quote input.");let g=e.data.slice(0,10).toLowerCase(),i=t.router.toLowerCase();if(i===D.toLowerCase()||i===y.toLowerCase()){let u=i===D.toLowerCase(),l=u?d:t.grossAmountOut,w=u?n:s;if(t.oakFeeBps!==O.bps||l===void 0||t.oakFee!==R(l)||t.oakFeeToken?.toLowerCase()!==x(w).toLowerCase())throw new o("Oak fee must match the pinned rate, token and amount.")}let c;if(i===D.toLowerCase()&&g===oe){m(t.spender??t.router,D,"spender");let u=C({abi:$,data:e.data});if(U({abi:$,...u}).toLowerCase()!==e.data.toLowerCase())throw new o("KyberSwap calldata must be canonically decodable.");let{callTarget:l,approveTarget:w,desc:p}=u.args[0];m(l,Q[F].kyberswap.address,"executor"),m(w,ne,"executor approval target");let S=_(n);if(p.srcReceivers.length!==p.srcAmounts.length||(S?p.srcReceivers.length!==0:p.srcReceivers.length===0||p.srcAmounts.some(h=>h<=0n)||p.srcAmounts.reduce((h,b)=>h+b,0n)!==r(d)-BigInt(R(d))))throw new o("KyberSwap source transfers must send the exact input less the pinned fee to the pinned executor or verified input pool.");for(let h of p.srcReceivers)if(h.toLowerCase()!==l.toLowerCase()&&!he(n,h,e.data))throw new o(`KyberSwap source transfers: receiver ${h} is not a verified input pool or the pinned executor.`);if(p.feeReceivers.length!==1||p.feeAmounts.length!==1||p.feeReceivers[0].toLowerCase()!==O.recipient.toLowerCase()||p.feeAmounts[0]!==BigInt(O.bps)||p.flags!==640n||p.permit!=="0x")throw new o("KyberSwap fee recipients, fee amounts, flags and permit must match the pinned Oak input-fee policy.");c={from:p.srcToken,to:p.dstToken,wallet:p.dstReceiver,amount:p.amount}}else if(i===y.toLowerCase()&&g===Se){m(t.spender??t.router,y,"spender");let u=C({abi:H,data:e.data});if(U({abi:H,...u}).toLowerCase()!==e.data.toLowerCase())throw new o("Velora calldata must be canonically decodable.");let[l,w,p,S]=u.args;if(!se.some(h=>h.toLowerCase()===l.toLowerCase()))throw new o("Built swap executor does not match the accepted quote.");if(S!=="0x")throw new o("Velora permit must match the pinned empty-permit policy.");if(Pe(p,t.oakFeeBps??O.bps),t.calldataMinAmountOut!==void 0&&r(t.calldataMinAmountOut)!==ke(t.minAmountOut,O.bps))throw new o("Velora calldata minimum must cover the accepted net output, venue fee and router dust.");if(t.calldataMinAmountOut!==void 0&&(w.quotedAmount!==r(t.grossAmountOut??"0")||w.quotedAmount<r(t.calldataMinAmountOut)))throw new o("Velora quoted gross output must match the accepted quote and cover its calldata minimum.");if(p!==0n&&t.calldataMinAmountOut===void 0)throw new o("Velora venue fee requires a fee-adjusted calldata minimum.");c={from:w.srcToken,to:w.destToken,wallet:w.beneficiary,amount:w.fromAmount}}else if(t.provider==="pons"&&(t.ponsPoolToken||t.ponsCurveToken))c=ge(e,{...t,from:n,to:s,wallet:a});else if(t.provider==="fobo")c=Ue(e,{...t,from:n,to:s,wallet:a});else throw new o("Built swap selector does not match the accepted router.");if(m(c.from,n,"input token"),m(c.to,s,"output token"),m(c.wallet,a,"recipient"),c.amount!==r(d))throw new o("Built swap input amount does not match the accepted quote.");Fe(e.data,t.calldataMinAmountOut??t.minAmountOut,i===D.toLowerCase())}var Me="FOBO route: the quoted output is already net of FOBO's pool taxes (2.5% per pool after a coin's first minute, higher during it). Oak swap fee: 0 on FOBO's route.";function Ue(e,t){let n=(d,m,A)=>{if(!G(d,m))throw new o(`Built swap ${A} does not match the accepted quote.`)};if(n(t.router,de,"FOBO router"),n(t.spender??t.router,ce,"FOBO spender"),t.oakFeeBps!==void 0||t.oakFee!==void 0&&r(t.oakFee)!==0n)throw new o("FOBO route trades carry no Oak fee.");let s=M(e.data,V);we(s),n(s.currencyIn,J(t.from),"input token"),n(s.currencyOut,J(t.to),"output token");let a=r(t.expiresAt);if(s.deadline>a+BigInt(pe))throw new o("FOBO swap deadline is more than 20 minutes past the accepted quote. Request a fresh quote.");if(s.permit&&(s.permit.amount!==s.amountIn||BigInt(s.permit.expiration)>s.permit.sigDeadline||s.permit.sigDeadline>a+BigInt(fe)))throw new o("FOBO permit must be for the exact swap input, expire no later than its signature deadline, and end within 30 minutes of the quote.");if(t.data!==void 0&&!G(t.data,e.data)&&!me(M(t.data,V).legs,s.legs))throw new o("Built swap FOBO pools or direction differ from the accepted quote.");return{from:t.from,to:t.to,wallet:t.wallet,amount:s.amountIn}}function q(e,t={}){if(!e||typeof e.quoteId!="string"||!e.quoteId.trim())throw new o("Quote must include a non-empty quoteId.");if(f(e.router),e.oakFeeBps!==void 0){let v=t.provider??e.provider,k=v==="kyberswap"?t.amountIn??e.amountIn:e.grossAmountOut,P=v==="kyberswap"?t.from??e.from:t.to??e.to;if(!["kyberswap","velora"].includes(v??"")||e.oakFeeBps!==O.bps||k===void 0||e.oakFee!==R(k)||!P||e.oakFeeToken?.toLowerCase()!==x(P).toLowerCase())throw new o("Oak fee must match the pinned rate, token and amount.")}else if(e.oakFee!==void 0&&r(e.oakFee)!==0n)throw new o("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");let n=r(e.amountOut),s=e.destAmountAfterFee??e.netAmountOut,a,d,m;if(s!==void 0){if(d=r(s),a=e.grossAmountOut!==void 0?r(e.grossAmountOut):n>=d?n:d,a<d)throw new o("Gross output cannot be less than net output.");m=e.venueFee!==void 0?r(e.venueFee):a-d}else if(e.grossAmountOut!==void 0){if(a=r(e.grossAmountOut),d=n,a<d)throw new o("Gross output cannot be less than net output.");m=e.venueFee!==void 0?r(e.venueFee):a-d}else e.venueFee!==void 0?(m=r(e.venueFee),d=n,a=d+m):(d=n,a=n,m=0n);if(d<=0n)throw new E("Quote output amount must be positive.");let A=t.slippageBps??e.slippageBps??te,g=e.minAmountOut!==void 0?r(e.minAmountOut):r(Le(d.toString(),A));if(g<=0n||g>a)throw new o("Quote minAmountOut must be positive and not exceed gross output.");if((t.provider??e.provider)==="velora"&&e.calldataMinAmountOut!==void 0){if(r(e.calldataMinAmountOut)!==ke(g.toString(),O.bps)||r(e.calldataMinAmountOut)>a)throw new o("Velora calldata minimum must cover the accepted net output, venue fee and router dust.")}else if(e.calldataMinAmountOut!==void 0||e.ponsCurveToken!==void 0){if((t.provider??e.provider)!=="pons"||!e.ponsCurveToken)throw new o("Curve minimum requires a Pons curve quote.");f(e.ponsCurveToken);let v=r(t.amountIn??e.amountIn??"0"),k=r(e.expectedSpend??"0"),P=r(e.expectedRefund??"0"),Ee=r(e.calldataMinAmountOut??"0");if(v<=0n||k<=0n||k+P!==v||Ee*k/v!==g)throw new o("Pons actual minimum and refund do not match the encoded minimum.")}let i=z(t.now),c=BigInt(i+Be),u=e.expiresAt!==void 0?r(e.expiresAt):c,l=(u>c?c:u).toString(),w=m.toString(),p=e.venueFeeBps??(a>0n&&m>0n?Number((m*10000n+a/2n)/a):0),S=t.provider??e.provider??(e.router.toLowerCase()===y.toLowerCase()?"velora":"kyberswap"),h=S==="fobo"?Me:S==="pons"&&e.feeDisclosure?e.feeDisclosure:Ie({provider:S,venueFee:w,venueFeeBps:p,oakFee:e.oakFee??"0",oakFeeBps:e.oakFeeBps}),b={...e,quoteId:e.quoteId,amountOut:d.toString(),minAmountOut:g.toString(),router:e.router,expiresAt:l,provider:S,grossAmountOut:a.toString(),destAmountAfterFee:d.toString(),netAmountOut:d.toString(),venueFee:w,venueFeeBps:p,oakFee:e.oakFee??"0",feeDisclosure:h,...t.from??e.from?{from:x(t.from??e.from)}:{},...t.to??e.to?{to:x(t.to??e.to)}:{},...t.amountIn??e.amountIn?{amountIn:t.amountIn??e.amountIn}:{},...t.wallet??e.wallet?{wallet:t.wallet??e.wallet}:{},slippageBps:A,chainId:t.chainId??e.chainId??F,spender:e.spender??e.router,...t.allowance??e.allowance?{allowance:t.allowance??e.allowance}:{}};if(BigInt(i)>=r(l))throw new L;if(t.cache===!1)return b;if(be(i),BigInt(i)>=r(l))throw new L;let T=I.get(b.quoteId);if(T){K(b,T,!0);let v=ve({...T,expiresAt:b.expiresAt});return I.set(v.quoteId,v),ee(v)}for(;I.size>=Ce;)I.delete(I.keys().next().value);let B=ve(b);return I.set(B.quoteId,B),ee(B)}async function ot(e,t,n={}){e={...e},f(e.from),f(e.to),f(e.wallet),e.from=x(e.from),e.to=x(e.to);let s=r(e.amountIn);if(s<=0n)throw new o("Swap amountIn must be greater than zero.");let a=e.slippageBps??te;if(!Number.isInteger(a)||a<0||a>=1e4)throw new o("Slippage must be an integer from 0 to 9999 bps.");if(!Array.isArray(t)||t.length===0)throw new E;let d={from:e.from,to:e.to,amountIn:s.toString(),slippageBps:a},m=await Promise.allSettled(t.map(async i=>{let c=await(i.quotePrices??i.quote).call(i,{...d},e.wallet);return{quote:q(c,{provider:i.name,from:e.from,to:e.to,amountIn:s.toString(),wallet:e.wallet,slippageBps:a,chainId:e.chainId??F,allowance:e.allowance,now:e.now,cache:!1}),provider:i}})),A,g=[];for(let i of m)i.status==="rejected"&&(A??=Y(i.reason)),i.status==="fulfilled"&&r(i.value.quote.expiresAt)>BigInt(z(e.now))&&g.push(i.value);if(g.length===0){let i=m.some(c=>c.status==="rejected"&&c.reason instanceof Error&&c.reason.message===N)&&m.every(c=>c.status==="rejected"&&(c.reason instanceof E||c.reason instanceof Error&&c.reason.message===N));throw A??new E(i?N:void 0)}g.sort((i,c)=>{let l=r(c.quote.amountOut)-r(i.quote.amountOut)||r(c.quote.minAmountOut)-r(i.quote.minAmountOut);return l>0n?1:l<0n?-1:0});for(let{quote:i,provider:c}of g)try{if(BigInt(z(e.now))>=r(i.expiresAt))continue;if(n.deferBuild||!c.prepareQuote)return q(i,{now:e.now});let u=await c.prepareQuote(i.quoteId,e.wallet);if(u.quoteId!==i.quoteId)throw new o("Prepared quote ID does not match the selected route.");if(K(u,i,!0),!u.data)throw new o("Selected route did not return swap calldata.");let l={...i,expiresAt:u.expiresAt,data:u.data,value:u.value,allowance:u.allowance??i.allowance};return xe(X({to:l.router,data:u.data,value:u.value??"0",chainId:l.chainId??F,description:"Selected swap route"}),l),q(l,{now:e.now})}catch(u){A??=Y(u);continue}throw A??new E}function rt(e,t={}){if(!e||typeof e.quoteId!="string"||!e.quoteId.trim())throw new o("Provide a valid quote to build a swap.");f(e.router);let n=I.get(e.quoteId),s=z(t.now);if(be(s),!n||BigInt(s)>=r(n.expiresAt))throw I.delete(e.quoteId),new L;if(e.oakFeeBps===void 0&&e.oakFee!==void 0&&r(e.oakFee)!==0n)throw new o("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");K(e,n),K({...n,...t},n);let a=n.from,d=n.to,m=n.amountIn,A=n.wallet;if(!a||!d||!A||m===void 0)throw new o("Accepted quote must include input, output, amount and wallet.");let g=n.chainId??F,i=n.spender??n.router,c=t.allowance??e.allowance??n?.allowance??"0";f(a),f(d),f(A),f(i);let u=r(m);if(u<=0n)throw new o("Swap amountIn must be greater than zero.");let l=r(n.minAmountOut);if(l<=0n)throw new o("Swap minAmountOut must be greater than zero.");let w=e.router.toLowerCase()===y.toLowerCase(),p=t.data??e.data??n?.data??(w?Ne({from:a,to:d,amountIn:u.toString(),amountOut:n.grossAmountOut??n.amountOut,minAmountOut:n.calldataMinAmountOut??l.toString(),wallet:A}):Qe({from:a,to:d,amountIn:u.toString(),minAmountOut:l.toString(),wallet:A}));Fe(p,n.calldataMinAmountOut??l.toString(),n.router.toLowerCase()===D.toLowerCase());let S=n.venueFee??"0",h=n.venueFeeBps??0,b=n.provider??(w?"velora":"kyberswap"),T=n.feeDisclosure??Ie({provider:b,venueFee:S,venueFeeBps:h,oakFee:n.oakFee??"0",oakFeeBps:n.oakFeeBps}),B=_(a),v=t.value??e.value??n?.value??(B?u.toString():"0"),k=X({to:e.router,data:p,value:v,chainId:g,description:`Swap ${u} base units of ${a} for at least ${l} base units of ${d} via ${b} (${e.router}). ${T}`});return xe(k,n),B||r(c)>=u?[k]:[ie(a,i,u.toString(),g),k]}export{Be as a,te as b,tt as c,De as d,ne as e,$ as f,E as g,L as h,Ce as i,ee as j,ve as k,K as l,z as m,_ as n,Le as o,_e as p,nt as q,ke as r,Pe as s,Ie as t,Qe as u,Ne as v,Ve as w,Fe as x,xe as y,Me as z,q as A,ot as B,rt as C};
@@ -0,0 +1 @@
1
+ var g=.25,f=30,p=30,S=.5,x=1e9;function U(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?{usd:e,estimatedHigh:!1}:{usd:.5,estimatedHigh:!0}}function D(e){let{gross:t,costs:n}=e,r=t-n,s=t<=n||n*4>t,o=s?d(e):void 0;return{tooSmall:s,grossUsd:t,costsUsd:n,netUsd:r,...o===void 0?{}:{suggestUsd:o}}}function d(e){let{gross:t,costs:n,amount:r}=e;if(![t,n,r].every(Number.isFinite)||!(t>0)||!(r>0)||!(n>=0))return;let s=t/r,o=i=>{let m=s*i;return n<=m*(1+1e-9)&&n*4<=m*(1+1e-9)},a=Math.ceil(n*4/s-1e-9);if(!Number.isFinite(a)||a>1e9)return;let u=Math.max(1,a);for(let i=0;i<4&&!o(u);i+=1)u+=1;if(o(u)){for(let i=0;i<4&&u>1&&o(u-1);i+=1)u-=1;return u}}function c(e){return e.amountUsd*e.ratePct/100*(e.days/365)}function A(e){let{amountUsd:t,baseRatePct:n,bonusRatePct:r,days:s}=e,o=Math.min(s,Math.max(0,Number.isFinite(e.bonusDays)?e.bonusDays:0));if(o>=s)return c({amountUsd:t,ratePct:n+r,days:s});let a=c({amountUsd:t,ratePct:n,days:s});return o===0?a:a+c({amountUsd:t,ratePct:r,days:o})}function y(e){let t=e.redeemOutBase-e.amountBase,n=t<0n,r=n?-t:t,s=10n**BigInt(e.decimals),o=Number(r/s)+Number(r%s)/Number(s);return n?-o:o}function h(e){return"none"}function _(e,t){return Math.max(0,(t-e)/86400)}function $(e){let t=e<0?"-":"",n=Math.abs(e);if(n===0)return"$0.00";if(n<.001&&(n=.001),n>=.9995)return`${t}$${n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`;let r=n.toFixed(3);return`${t}$${r.endsWith("0")?n.toFixed(2):r}`}function N(e){return e.toFixed(2)}var b=["January","February","March","April","May","June","July","August","September","October","November","December"];function M(e){let t=new Date(e*1e3);return`${b[t.getUTCMonth()]} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}var l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(e){let t=new Date(e*1e3);return`${l[t.getUTCMonth()]} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}function P(e){let t=Math.max(1,Math.round(e));return t===1?"1 day":`${t} days`}function R(e,t,n=4){let r=e<0n,s=r?-e:e,o=10n**BigInt(t),a=s/o,u=(s%o).toString().padStart(t,"0").slice(0,n).replace(/0+$/,"");return`${r?"-":""}${a.toString()}${u?`.${u}`:""}`}export{g as a,f as b,p as c,S as d,x as e,U as f,D as g,d as h,c as i,A as j,y as k,h as l,_ as m,$ as n,N as o,M as p,O as q,P as r,R as s};
@@ -1 +1 @@
1
- import{a as A}from"./523ZIR3J.js";import{a as i,b as w,c as b,e as C,f as x,g as h}from"./J73ATSEQ.js";import{a as o}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{a as f}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as g,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as B,parseAbiParameters as D,zeroAddress as R}from"viem";var L=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),N=D("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=B(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),O=B(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:{...y,description:"Address of the ERC-20 sale token to distribute in this auction."},amount:o('Amount of sale token in base units; use sale token decimals. Example: "1000000" = 1 sale token at 6 decimals.'),currency:{...y,description:"Payment currency address; the zero address means native ETH."},startBlock:o("Future block number at which auction bidding starts, as a decimal string."),endBlock:o("Block number at which auction bidding ends, as a decimal string."),claimBlock:o("First block number at which auction tokens can be claimed, as a decimal string."),tickSpacing:o("Auction price tick spacing in Q96 payment-currency base units per sale-token base unit."),floorPrice:o("Auction floor price in Q96 payment-currency base units per sale-token base unit."),requiredCurrencyRaised:o('Minimum amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),salt:{description:"Deployment salt as a 32-byte hex string; choose a fresh value for a new deployment.",type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{description:"Auction issuance steps; durations must cover endBlock minus startBlock and mps times duration must total 10000000.",type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:o("Issuance rate per block in MPS units; sum of mps times duration across steps must equal 10000000."),duration:o("Duration of this issuance step in blocks, as a decimal string.")}}}};function $(e,t){let r=i(e.startBlock,"startBlock",64),n=i(e.endBlock,"endBlock",64),c=i(e.claimBlock,"claimBlock",64);if(n<=r||c<n)throw new s("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new s("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new s("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let a=d,k=i(a.mps,"mps",24,!0),m=i(a.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(m)]).slice(2)}`,l+=k*m,p+=m}if(l!==10000000n||p!==n-r)throw new s("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S(N,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:r,endBlock:n,claimBlock:c,tickSpacing:i(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:i(e.floorPrice,"floorPrice"),requiredCurrencyRaised:i(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function z(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,r){h(t,Object.keys(v));let n=w(t.token),c=i(t.amount,"amount",128);if(n===R||n===b(t.currency))throw new s("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=$(t,r);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new s("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(f),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new s("Choose a future auction startBlock with time for confirmation and approvals.");let a=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[n,c,u,p,r]});if((await l.getCode({address:a})??"0x")!=="0x")throw new s("This auction already exists; choose a fresh salt or configuration.");let k=await C(e,n),m=[e.unsignedTx({to:A,data:g({abi:P,functionName:"create",args:[n,c,u,p]}),value:"0",chainId:f,description:`Create CCA ${a}; proceeds and unsold tokens go to ${r}.`}),e.unsignedTx({to:n,data:g({abi:I,functionName:"transfer",args:[a,c]}),value:"0",chainId:f,description:`Fund the factory-predicted auction ${a} with exactly ${c} base units of ${n}.`}),e.unsignedTx({to:a,data:g({abi:B(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:f,description:`Activate CCA ${a} after its sale tokens arrive.`})];return{...await x(e,m,r,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:a,sale:{token:k,amount:c.toString()}}}}]}}export{L as a,N as b,P as c,O as d,$ as e,z as f};
1
+ import{a as A}from"./ODV3XT5U.js";import{a as i,b as w,c as b,e as C,f as x,g as h}from"./QPY6UTLU.js";import{a as o}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{b as f}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as g,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as B,parseAbiParameters as D,zeroAddress as R}from"viem";var L=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),N=D("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=B(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),O=B(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:{...y,description:"Address of the ERC-20 sale token to distribute in this auction."},amount:o('Amount of sale token in base units; use sale token decimals. Example: "1000000" = 1 sale token at 6 decimals.'),currency:{...y,description:"Payment currency address; the zero address means native ETH."},startBlock:o("Future block number at which auction bidding starts, as a decimal string."),endBlock:o("Block number at which auction bidding ends, as a decimal string."),claimBlock:o("First block number at which auction tokens can be claimed, as a decimal string."),tickSpacing:o("Auction price tick spacing in Q96 payment-currency base units per sale-token base unit."),floorPrice:o("Auction floor price in Q96 payment-currency base units per sale-token base unit."),requiredCurrencyRaised:o('Minimum amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),salt:{description:"Deployment salt as a 32-byte hex string; choose a fresh value for a new deployment.",type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{description:"Auction issuance steps; durations must cover endBlock minus startBlock and mps times duration must total 10000000.",type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:o("Issuance rate per block in MPS units; sum of mps times duration across steps must equal 10000000."),duration:o("Duration of this issuance step in blocks, as a decimal string.")}}}};function $(e,t){let r=i(e.startBlock,"startBlock",64),n=i(e.endBlock,"endBlock",64),c=i(e.claimBlock,"claimBlock",64);if(n<=r||c<n)throw new s("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new s("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new s("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let a=d,k=i(a.mps,"mps",24,!0),m=i(a.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(m)]).slice(2)}`,l+=k*m,p+=m}if(l!==10000000n||p!==n-r)throw new s("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S(N,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:r,endBlock:n,claimBlock:c,tickSpacing:i(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:i(e.floorPrice,"floorPrice"),requiredCurrencyRaised:i(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function z(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,r){h(t,Object.keys(v));let n=w(t.token),c=i(t.amount,"amount",128);if(n===R||n===b(t.currency))throw new s("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=$(t,r);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new s("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(f),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new s("Choose a future auction startBlock with time for confirmation and approvals.");let a=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[n,c,u,p,r]});if((await l.getCode({address:a})??"0x")!=="0x")throw new s("This auction already exists; choose a fresh salt or configuration.");let k=await C(e,n),m=[e.unsignedTx({to:A,data:g({abi:P,functionName:"create",args:[n,c,u,p]}),value:"0",chainId:f,description:`Create CCA ${a}; proceeds and unsold tokens go to ${r}.`}),e.unsignedTx({to:n,data:g({abi:I,functionName:"transfer",args:[a,c]}),value:"0",chainId:f,description:`Fund the factory-predicted auction ${a} with exactly ${c} base units of ${n}.`}),e.unsignedTx({to:a,data:g({abi:B(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:f,description:`Activate CCA ${a} after its sale tokens arrive.`})];return{...await x(e,m,r,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:a,sale:{token:k,amount:c.toString()}}}}]}}export{L as a,N as b,P as c,O as d,$ as e,z as f};
@@ -0,0 +1 @@
1
+ import{a as u}from"./TRCP7X5P.js";import{t as o,u as y}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{getAddress as g,hashTypedData as l,isAddress as f,zeroAddress as k}from"viem";var w="Actions are paused until this wallet has an Oak identity (a one-time public on-chain profile). Registering costs a small ETH network fee and needs the person's OK. Run oak setup register, or oak setup link <agentId> for an existing ID. Reads still work.";function d(e,n,t){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78)throw new r(`Identity link ${t} must be a canonical decimal integer string.`);let i=BigInt(e);if(i>=1n<<BigInt(n))throw new r(`Identity link ${t} exceeds uint${n}.`);return i}function c(e,n){if(typeof e!="string"||!f(e,{strict:!1})||g(e)===k)throw new r(`Identity link ${n} must be a nonzero address.`);return g(e)}function m(e,n="mainnet"){d(e,256,"agentId");let{chainId:t,identityRegistry:i}=o[y(n)];return{chainId:t,registry:i,agentId:e}}function h(e){if(e===o.mainnet.chainId)return"mainnet";if(e===o.testnet.chainId)return"testnet";throw new r("Wrong identity network. Select mainnet or testnet and run oak setup again.")}function S(e,n="mainnet"){if(!e||typeof e!="object"||Array.isArray(e))throw new r(w);let t=e,i=m(t.agentId,n);if(Object.keys(t).some(s=>!["chainId","registry","agentId","linkId"].includes(s))||t.chainId!==i.chainId||t.registry!==i.registry||t.linkId!==void 0&&(typeof t.linkId!="string"||!/^0x[0-9a-f]{64}$/.test(t.linkId)))throw new r(`Wrong identity network or registry. Select chain ${i.chainId} and run oak setup again.`);return{...i,...t.linkId!==void 0?{linkId:t.linkId}:{}}}function p(e){let n=h(e.chainId),{chainId:t,registry:i}=m(e.agentId,n);if(c(e.registry,"registry")!==i)throw new r(`Identity link must use the pinned registry on chain ${t}.`);if(typeof e.audience!="string"||!e.audience.trim())throw new r("Identity link audience must be a nonempty string.");if(typeof e.challenge!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.challenge))throw new r("Identity link challenge must be a 32-byte hex string.");let s=d(e.issuedAt,64,"issuedAt"),a=d(e.expiresAt,64,"expiresAt");if(s>=a)throw new r("Identity link expiry must be after its issue time.");return{domain:{name:"Oak Identity Link",version:"1",chainId:t,verifyingContract:i},primaryType:"OakIdentityLink",types:{OakIdentityLink:[{name:"agentId",type:"uint256"},{name:"agentWallet",type:"address"},{name:"registry",type:"address"},{name:"chainId",type:"uint256"},{name:"audience",type:"string"},{name:"challenge",type:"bytes32"},{name:"issuedAt",type:"uint64"},{name:"expiresAt",type:"uint64"}]},message:{agentId:d(e.agentId,256,"agentId"),agentWallet:c(e.agentWallet,"agentWallet"),registry:i,chainId:BigInt(t),audience:e.audience,challenge:e.challenge,issuedAt:s,expiresAt:a}}}async function L(e,n){try{let t=p(e.link),i=p(n.expected),s=l(t);if(s!==l(i))return!1;let a=d(n.now,64,"now");if(a<t.message.issuedAt||a>=t.message.expiresAt)return!1;let I=c(n.currentOwner,"currentOwner");return typeof n.blockNumber!="bigint"||n.blockNumber<0n?!1:u({digest:s,signature:e.signature,owner:I,client:n.client,blockNumber:n.blockNumber,policy:"identity-link-legacy"})}catch{return!1}}export{w as a,m as b,h as c,S as d,p as e,L as f};
@@ -0,0 +1,21 @@
1
+ import{a as w,b as r}from"./V5YSJKRH.js";function o(e){return{text:e}}var h="borro.markets",R=o("Borro: lend your {symbol} to borrowers through Borro's vault."),k=o("Borro is an official Oak partner. Borro's own team runs its product and contracts; Oak didn't build them and doesn't run them."),E=o("Borro keeps {fee_pct}% of the interest as its fee."),x=o("Borro keeps part of the interest as its fee, and I couldn't read how much."),A=o("Reward: about {borro_rate}% a year today, which changes. {fee_clause} {comparison_clause}"),O=o("Reward: lending {symbol} pays about {borro_rate}% a year today, which changes. {fee_clause}"),S=o("Reward: lending {symbol} pays about {borro_rate}% a year today, which is close to nothing and changes. {fee_clause}"),_=o("I couldn't confirm Borro's rate in the last few minutes, so I can't tell you what this pays today. borro_list shows it when Borro's page is current."),T=o(`Reward: ${_.text} {fee_clause}`),g=o("The catch: you are lending {symbol}, a stock token, not dollars. If its price falls, what you get back is worth less in dollars, even though the {symbol} count is what you lent. The company that issues the token can also pause or restrict it."),N=o("LayerBank on Robinhood Chain pays about {lb_rate}% a year on USDG today, so LayerBank pays more."),B=o("LayerBank on Robinhood Chain pays about {lb_rate}% a year on USDG today, so Borro pays more."),C=o("LayerBank on Robinhood Chain pays about {lb_rate}% a year on USDG today, so they pay about the same."),v=o("I couldn't read {the_other} rate, so I can't compare them right now."),I=o("Borro is {age_phrase} old and has had no outside security check"),D=o("Borro's age couldn't be read, and it has had no outside security check"),L=o("A {threshold}-of-{owners} group wallet"),U=o("A wallet Oak could not inspect"),P=o("{age_clause}; its own page says only internal reviews were done. {controller_clause} controls the vault and can change where the money is lent. If Borro's code fails, or the people who control it make a harmful change, you could lose money."),F=o("Risk: {risk_clause}"),$=o(`Taking it out: you can take your money out when the vault has cash on hand. Right now about {ready} {symbol} of the {total} {symbol} lent in is ready; the rest is out with borrowers and can take time to come back. You can also take it out on ${h} with this wallet.`),K=o("Taking it out: you can take your money out when the vault has cash on hand. Right now all {total} {symbol} lent in is ready."),M=o(`Taking it out: you can take your money out when the vault has cash on hand. I couldn't read how much is ready to take out right now; money that is out with borrowers can take time to come back. You can also take it out on ${h} with this wallet.`),W=o("Cost: about {gas_in_usd} in network fees to put it in and about {gas_out_usd} to take it out."),Y=o("Cost: I couldn't read the network fees right now."),G=o("Cost: I couldn't price the network fees in dollars right now. The most you can pay, in ETH, is on the line below."),q=o("Rates shown leave out any $BORRO incentive."),H=o(`Lend {amount} {symbol} to Borro?
2
+
3
+ Borro is an official Oak partner. Borro's own team runs its product and contracts; Oak didn't build them and doesn't run them.
4
+ What you get: {reward_clause} {stock_catch_clause}
5
+ What happens: {amount} {symbol} leaves your wallet and becomes about {shares} "{vault_symbol}" tokens, your receipt for money lent through Borro. {floor_clause}
6
+ {route_clause}
7
+ The risk: {risk_clause}
8
+ Taking it out: {taking_out_clause}
9
+ {cost_line}
10
+
11
+ Lend {amount} {symbol}? [Yes] [No]`),V=o("Borro keeps 10% of the interest as its fee. On deposits using Oak's code, Borro pays Oak all of that fee for the first 12 months, then half. Borro pays monthly in USDG."),bt=o("You receive at least {minShares} vault shares, or the deposit will not go through."),j=o("Oak's referral is not available for this vault, so this deposit goes straight to the vault without Oak's referral code."),z=o("Oak's preview checks that you would get at least {min_shares}, but Borro's contract doesn't enforce a minimum, so the final amount can differ slightly."),Z=o("about {borro_rate}% a year at today's rate, which changes."),Q=o(`when the vault has cash on hand. Right now about {ready} {symbol} is ready of the {total} {symbol} lent in. Also possible on ${h} with this wallet.`),J=o(`when the vault has cash on hand. I couldn't read how much is ready right now. Also possible on ${h} with this wallet.`),X=o("Cost: about {gas_in_usd} in network fees now and about {gas_out_usd} to take it out."),tt=o(`Take {amount_or_all} {symbol} out of Borro?
12
+
13
+ You get back about {out} {symbol} for {shares} "{vault_symbol}" tokens (what you lent plus interest so far). Oak's preview checks the amount, but the contract doesn't enforce a minimum, so it can differ slightly.
14
+ {liquidity_note}
15
+ {drift_notice}
16
+ {cost_line}
17
+
18
+ Take it out? [Yes] [No]`),et=o("Borro's vault only has about {ready} {symbol} ready right now, so I can take out {max_now} {symbol} today. Say so if you want that smaller amount."),ot=o("Cost: about {gas_out_usd} in network fees."),nt=o("Borro's setup has changed since Oak checked it; the exit below was checked against the live contract."),rt=o("I could not verify {vault_label} on chain, so Oak won't offer it. Nothing was signed."),st=o("Borro's setup no longer matches what Oak checked. Nothing was signed."),at=o("Borro only has {ready} {symbol} ready to take out right now, and you asked for {requested} {symbol}. I can take out {max_now} {symbol} now, or you can wait for more to come back."),it=o("Borro only has {ready} {symbol} ready to take out right now, and you asked for {requested} {symbol}. None can be taken out today, so you can wait for more to come back."),lt=o("This wallet has nothing lent on Borro for {symbol}."),ut=o("Borro's vault wouldn't take this deposit right now (it may be full or paused). Nothing was signed."),ct=o("New on Borro: the {symbol} vault. Oak checked it on the chain just now and it passes Oak's checks."),dt=o(`If you also borrowed, shorted or used credit on ${h}, Oak's view doesn't include that.`),Tt={CARD_INTRO:R,INDEPENDENCE:k,FEE_CLAUSE:E,FEE_CLAUSE_UNREADABLE:x,REWARD_USDG:A,REWARD_STOCK:O,REWARD_STOCK_LOW:S,RATE_UNREADABLE:_,REWARD_UNREADABLE:T,STOCK_CATCH:g,COMPARE_LAYERBANK_HIGHER:N,COMPARE_BORRO_HIGHER:B,COMPARE_SAME:C,COMPARE_UNREADABLE:v,AGE_CLAUSE:I,AGE_CLAUSE_UNKNOWN:D,CONTROLLER_SAFE:L,CONTROLLER_UNKNOWN:U,RISK_CLAUSE:P,RISK_LINE:F,TAKING_OUT:$,TAKING_OUT_ALL_READY:K,TAKING_OUT_UNREADABLE:M,CARD_COST:W,CARD_COST_UNREADABLE:Y,COST_UNREADABLE:G,NOTES_INCENTIVE:q,BORRO_SHARE:V,BORRO_FALLBACK:j,BORRO_DIRECT_FLOOR:z,DEPOSIT_SCREEN:H,SCREEN_REWARD:Z,SCREEN_TAKING_OUT:Q,SCREEN_TAKING_OUT_UNREADABLE:J,DEPOSIT_COST:X,WITHDRAW_SCREEN:tt,LIQUIDITY_NOTE:et,WITHDRAW_COST:ot,DRIFT_NOTICE:nt,UNVERIFIED_REFUSAL:rt,SETUP_MISMATCH:st,TOO_LITTLE_READY:at,NOTHING_READY:it,NO_SHARES:lt,DEPOSIT_WOULD_REVERT:ut,NEW_VAULT_NOTICE:ct,POSITIONS_NOTE:dt},Nt=[/\bours?\b/i,/\bOak (?:owns?|runs?|operates?|built) Borro\b/i,/\bbuilt by\b/i,/\bOak's Borro\b/i,/\bour (?:vault|project)/i,/\bSafe\b/,/\bRobinhood\b(?! Chain)/,/\bfork\b/i,/\bpractice copy\b/i,/\banvil\b/i,/evm_increaseTime/i,/\bunlisted\b/i,/\bpinned\b/i];function y(e){return e.toFixed(2).replace(/\.?0+$/,"")}function l(e){return typeof e=="number"&&Number.isFinite(e)}var p=/^[A-Za-z0-9.$_-]{1,16}$/,_t=/^0x[0-9a-fA-F]{40}$/;function u(e){if(!p.test(e))throw new Error("Borro copy refused an asset symbol that is not a plain token symbol.");return e}function yt(e){return p.test(e)?e:"Borro vault shares"}function c(e,t){let n=t,s=[];for(let a of e.text.split(`
19
+ `)){let i=/^\{([a-z][a-z0-9_]*)\}$/.exec(a);i&&n[i[1]]===""||s.push(r(o(a),n).trimEnd())}return s.join(`
20
+ `)}var gt=86400,b=/^(\d+)(?:\.(\d+))?$/,pt=4;function d(e){let t=b.exec(e);if(!t)return e;let n=(t[2]??"").slice(0,pt).replace(/0+$/,"");return n?`${t[1]}.${n}`:t[1]}function ft(e,t){let n=b.exec(e),s=b.exec(t);if(!n||!s)return!1;let a=Math.max(n[2]?.length??0,s[2]?.length??0),i=m=>BigInt(m[1]+(m[2]??"").padEnd(a,"0"));return i(n)>=i(s)}function wt(e,t){if(!l(e)||!Number.isFinite(t)||e<=0)return;let n=(t-e)/gt;if(!(n<0)){if(n<1)return"under a day";if(n<14){let s=Math.floor(n);return s===1?"1 day":`${s} days`}return n<45?"about a month":`about ${Math.max(2,Math.round(n/30))} months`}}var Rt=.05;function kt(e,t){let n=l(e),s=l(t);if(!n||!s)return r(v,{the_other:!n&&!s?"either":n?"LayerBank's":"Borro's"});let a=y(t),i=e-t;return Math.abs(i)<Rt?r(C,{lb_rate:a}):r(i>0?B:N,{lb_rate:a})}function ht(e){let t=wt(e.deployedAtSeconds,e.nowSeconds),n=t===void 0?r(D,{}):r(I,{age_phrase:t}),a=Number.isInteger(e.threshold)&&Number.isInteger(e.owners)&&e.threshold>0&&e.owners>0&&e.threshold<=e.owners?r(L,{threshold:String(e.threshold),owners:String(e.owners)}):r(U,{});return r(P,{age_clause:n,controller_clause:a})}function Et(e){return l(e)?r(E,{fee_pct:y(e)}):r(x,{})}function f(e,t,n=G){let s={gas_in_usd:t.in,gas_out_usd:t.out};return w(e).some(i=>!s[i])?r(n,{}):r(e,s)}function xt(e){let t={...e,symbol:u(e.symbol)},n=l(t.borroRatePct),s=Et(t.feePct),a;n?t.kind==="usdg"?a=c(A,{borro_rate:y(t.borroRatePct),fee_clause:s,comparison_clause:kt(t.borroRatePct,t.layerbankRatePct)}):a=c(t.borroRatePct<1?S:O,{symbol:t.symbol,borro_rate:y(t.borroRatePct),fee_clause:s}):a=c(T,{fee_clause:s});let i;return t.readyAmount===void 0||t.totalAmount===void 0?i=r(M,{}):ft(t.readyAmount,t.totalAmount)?i=r(K,{total:d(t.totalAmount),symbol:t.symbol}):i=r($,{ready:d(t.readyAmount),total:d(t.totalAmount),symbol:t.symbol}),{intro:r(R,{symbol:t.symbol}),independence:r(k,{}),reward:a,...t.kind==="stock"?{catch:r(g,{symbol:t.symbol})}:{},risk:r(F,{risk_clause:ht(t)}),takingOut:i,cost:f(W,{in:t.gasInUsd,out:t.gasOutUsd},Y),notes:r(q,{})}}function Bt(e){let t=xt(e),{intro:n,independence:s,reward:a,risk:i,takingOut:m,cost:mt}=t;return[n,"",s,a,...t.catch?[t.catch]:[],i,m,mt].join(`
21
+ `)}function Ct(e){let t={...e,symbol:u(e.symbol),vaultSymbol:yt(e.vaultSymbol)},n=l(t.borroRatePct),s=t.readyAmount!==void 0&&t.totalAmount!==void 0;return c(H,{amount:t.amount,symbol:t.symbol,reward_clause:n?r(Z,{borro_rate:y(t.borroRatePct)}):r(_,{}),stock_catch_clause:t.kind==="stock"?r(g,{symbol:t.symbol}):"",shares:t.shares,vault_symbol:t.vaultSymbol,floor_clause:t.viaBuilder?bt.text.replace("{minShares}",t.sharesMin):r(z,{min_shares:t.sharesMin}),route_clause:r(t.viaBuilder?V:j,{}),risk_clause:ht(t),taking_out_clause:s?r(Q,{ready:d(t.readyAmount),total:d(t.totalAmount),symbol:t.symbol}):r(J,{}),cost_line:f(X,{in:t.gasInUsd,out:t.gasOutUsd})})}function vt(e){let t={...e,symbol:u(e.symbol),vaultSymbol:yt(e.vaultSymbol)};return c(tt,{amount_or_all:t.isAll?`all ${t.amount}`:t.amount,symbol:t.symbol,out:t.out,shares:t.shares,vault_symbol:t.vaultSymbol,liquidity_note:t.liquidity?r(et,{ready:t.liquidity.ready,symbol:t.symbol,max_now:t.liquidity.maxNow}):"",drift_notice:t.drift?r(nt,{}):"",cost_line:f(ot,{out:t.gasOutUsd})})}function It(e){return r(ct,{symbol:u(e)})}function Dt(){return r(dt,{})}function At(e){return e===void 0||/^[0.,\s]*$/.test(e)}function Lt(e,t){switch(e){case"unverified":{let n=t.vaultLabel,s=n&&_t.test(n)?`the vault at ${n}`:n&&p.test(n)?`the ${n} vault`:"this vault";return r(rt,{vault_label:s})}case"setup-mismatch":return r(st,{});case"too-little-ready":{let n=t,s=u(n.symbol);return At(n.maxNow)?r(it,{ready:n.ready,requested:n.requested,symbol:s}):r(at,{ready:n.ready,requested:n.requested,max_now:n.maxNow,symbol:s})}case"no-shares":return r(lt,{symbol:u(t.symbol)});case"deposit-would-revert":return r(ut,{});default:throw new Error(`Unknown Borro refusal kind: ${String(e)}`)}}export{h as a,R as b,k as c,E as d,x as e,A as f,O as g,S as h,_ as i,T as j,g as k,N as l,B as m,C as n,v as o,I as p,D as q,L as r,U as s,P as t,F as u,$ as v,K as w,M as x,W as y,Y as z,G as A,q as B,H as C,V as D,bt as E,j as F,z as G,Z as H,Q as I,J,X as K,tt as L,et as M,ot as N,nt as O,rt as P,st as Q,at as R,it as S,lt as T,ut as U,ct as V,dt as W,Tt as X,Nt as Y,y as Z,d as _,wt as $,Rt as aa,kt as ba,ht as ca,xt as da,Bt as ea,Ct as fa,vt as ga,It as ha,Dt as ia,Lt as ja};