@oakagentkit/core 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (535) hide show
  1. package/build/dist/api/addresses.d.ts +112 -0
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/amounts.js +1 -1
  4. package/build/dist/api/args.js +1 -1
  5. package/build/dist/api/cache.js +1 -1
  6. package/build/dist/api/canonical.js +1 -1
  7. package/build/dist/api/chain.js +1 -1
  8. package/build/dist/api/deployments.js +1 -1
  9. package/build/dist/api/errors.d.ts +1 -0
  10. package/build/dist/api/errors.js +1 -1
  11. package/build/dist/api/gas.js +1 -1
  12. package/build/dist/api/grandfather.js +1 -1
  13. package/build/dist/api/guards.js +1 -1
  14. package/build/dist/api/history.js +1 -1
  15. package/build/dist/api/http.js +1 -1
  16. package/build/dist/api/identity-link.d.ts +1 -0
  17. package/build/dist/api/identity-link.js +1 -1
  18. package/build/dist/api/launch.js +1 -1
  19. package/build/dist/api/merkle.js +1 -1
  20. package/build/dist/api/metadata.js +1 -1
  21. package/build/dist/api/module.js +1 -1
  22. package/build/dist/api/modules/beefy/boosts.js +1 -1
  23. package/build/dist/api/modules/beefy/clm.js +1 -1
  24. package/build/dist/api/modules/beefy/guard.js +1 -1
  25. package/build/dist/api/modules/beefy/index.js +1 -1
  26. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  27. package/build/dist/api/modules/beefy/management.js +1 -1
  28. package/build/dist/api/modules/beefy/vaults.js +1 -1
  29. package/build/dist/api/modules/clanker/extensions.js +1 -1
  30. package/build/dist/api/modules/clanker/index.js +1 -1
  31. package/build/dist/api/modules/clanker/manage.js +1 -1
  32. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  33. package/build/dist/api/modules/clanker/protocol.js +1 -1
  34. package/build/dist/api/modules/clanker/state.js +1 -1
  35. package/build/dist/api/modules/earn/copy.d.ts +114 -0
  36. package/build/dist/api/modules/earn/copy.js +1 -0
  37. package/build/dist/api/modules/earn/cost.d.ts +47 -0
  38. package/build/dist/api/modules/earn/cost.js +1 -0
  39. package/build/dist/api/modules/earn/index.d.ts +8 -0
  40. package/build/dist/api/modules/earn/index.js +1 -0
  41. package/build/dist/api/modules/earn/lp.d.ts +17 -0
  42. package/build/dist/api/modules/earn/lp.js +1 -0
  43. package/build/dist/api/modules/earn/options.d.ts +36 -0
  44. package/build/dist/api/modules/earn/options.js +1 -0
  45. package/build/dist/api/modules/earn/types.d.ts +39 -0
  46. package/build/dist/api/modules/earn/types.js +0 -0
  47. package/build/dist/api/modules/erc8004/abi.js +1 -1
  48. package/build/dist/api/modules/erc8004/common.js +1 -1
  49. package/build/dist/api/modules/erc8004/domain.js +1 -1
  50. package/build/dist/api/modules/erc8004/index.js +1 -1
  51. package/build/dist/api/modules/erc8004/management.js +1 -1
  52. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  53. package/build/dist/api/modules/erc8004/services.js +1 -1
  54. package/build/dist/api/modules/erc8004/validation.js +1 -1
  55. package/build/dist/api/modules/grove/index.js +1 -1
  56. package/build/dist/api/modules/heyresearch/backoff.js +1 -1
  57. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  58. package/build/dist/api/modules/heyresearch/freshness.js +1 -1
  59. package/build/dist/api/modules/heyresearch/index.js +1 -1
  60. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  61. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  62. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  63. package/build/dist/api/modules/heyresearch/status-labels.d.ts +1 -1
  64. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  65. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  66. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  67. package/build/dist/api/modules/hoodag/index.js +1 -1
  68. package/build/dist/api/modules/hoodag/management.js +1 -1
  69. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  70. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  71. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  72. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  73. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  74. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  75. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  76. package/build/dist/api/modules/hoodlock/index.js +1 -1
  77. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  78. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  79. package/build/dist/api/modules/hoodlock/public.js +1 -1
  80. package/build/dist/api/modules/hookr/actions.js +1 -1
  81. package/build/dist/api/modules/hookr/addons.js +1 -1
  82. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  83. package/build/dist/api/modules/hookr/contracts.js +1 -1
  84. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  85. package/build/dist/api/modules/hookr/discovery.js +1 -1
  86. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  87. package/build/dist/api/modules/hookr/index.js +1 -1
  88. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  89. package/build/dist/api/modules/hookr/launch-profile.js +1 -1
  90. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  91. package/build/dist/api/modules/hookr/launch.js +1 -1
  92. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  93. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  94. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  95. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  96. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  97. package/build/dist/api/modules/hookr/pins.js +1 -1
  98. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  99. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  100. package/build/dist/api/modules/hookr/relay.js +1 -1
  101. package/build/dist/api/modules/hookr/revenue.js +1 -1
  102. package/build/dist/api/modules/kyberswap/index.js +1 -1
  103. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  104. package/build/dist/api/modules/layerbank/abi.d.ts +165 -0
  105. package/build/dist/api/modules/layerbank/abi.js +1 -0
  106. package/build/dist/api/modules/layerbank/actions.d.ts +2 -0
  107. package/build/dist/api/modules/layerbank/actions.js +1 -0
  108. package/build/dist/api/modules/layerbank/checks.d.ts +21 -0
  109. package/build/dist/api/modules/layerbank/checks.js +1 -0
  110. package/build/dist/api/modules/layerbank/index.d.ts +2 -0
  111. package/build/dist/api/modules/layerbank/index.js +1 -0
  112. package/build/dist/api/modules/layerbank/merkl.d.ts +6 -0
  113. package/build/dist/api/modules/layerbank/merkl.js +1 -0
  114. package/build/dist/api/modules/layerbank/reader.d.ts +15 -0
  115. package/build/dist/api/modules/layerbank/reader.js +1 -0
  116. package/build/dist/api/modules/layerbank/reserve.d.ts +13 -0
  117. package/build/dist/api/modules/layerbank/reserve.js +1 -0
  118. package/build/dist/api/modules/lighter/index.js +1 -1
  119. package/build/dist/api/modules/longbow/administration.js +1 -1
  120. package/build/dist/api/modules/longbow/analytics.js +1 -1
  121. package/build/dist/api/modules/longbow/fixed.js +1 -1
  122. package/build/dist/api/modules/longbow/index.js +1 -1
  123. package/build/dist/api/modules/longbow/nft.js +1 -1
  124. package/build/dist/api/modules/longbow/rebates.js +1 -1
  125. package/build/dist/api/modules/longbow/staking.js +1 -1
  126. package/build/dist/api/modules/meridian/index.js +1 -1
  127. package/build/dist/api/modules/meridian/markets.js +1 -1
  128. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  129. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  130. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  131. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  132. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  133. package/build/dist/api/modules/meridian/perps.js +1 -1
  134. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  135. package/build/dist/api/modules/meridian/rfq.js +1 -1
  136. package/build/dist/api/modules/merkl/discovery.js +1 -1
  137. package/build/dist/api/modules/merkl/index.js +1 -1
  138. package/build/dist/api/modules/merkl/manage.js +1 -1
  139. package/build/dist/api/modules/merkl/protocol.js +1 -1
  140. package/build/dist/api/modules/morpho/allocator.js +1 -1
  141. package/build/dist/api/modules/morpho/bundles-abi.js +1 -1
  142. package/build/dist/api/modules/morpho/bundles.js +1 -1
  143. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  144. package/build/dist/api/modules/morpho/index.js +1 -1
  145. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  146. package/build/dist/api/modules/morpho/midnight-abi.js +1 -1
  147. package/build/dist/api/modules/morpho/midnight.js +1 -1
  148. package/build/dist/api/modules/morpho/protocol.js +1 -1
  149. package/build/dist/api/modules/morpho/surface.js +1 -1
  150. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  151. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  152. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  153. package/build/dist/api/modules/netnet/blackjack-hashes.js +1 -1
  154. package/build/dist/api/modules/netnet/card-abi.js +1 -1
  155. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  156. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  157. package/build/dist/api/modules/netnet/card-read.js +1 -1
  158. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  159. package/build/dist/api/modules/netnet/desk-action-abi.js +1 -1
  160. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  161. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  162. package/build/dist/api/modules/netnet/desk-registry.js +1 -1
  163. package/build/dist/api/modules/netnet/financial-abi.js +1 -1
  164. package/build/dist/api/modules/netnet/financial.js +1 -1
  165. package/build/dist/api/modules/netnet/index.js +1 -1
  166. package/build/dist/api/modules/netnet/staking.js +1 -1
  167. package/build/dist/api/modules/orbio/gateway.js +1 -1
  168. package/build/dist/api/modules/orbio/index.js +1 -1
  169. package/build/dist/api/modules/orbio/pins.js +1 -1
  170. package/build/dist/api/modules/orbio/positions.d.ts +2 -0
  171. package/build/dist/api/modules/orbio/positions.js +1 -0
  172. package/build/dist/api/modules/pendle/abi.d.ts +205 -0
  173. package/build/dist/api/modules/pendle/abi.js +1 -0
  174. package/build/dist/api/modules/pendle/convert.d.ts +24 -0
  175. package/build/dist/api/modules/pendle/convert.js +1 -0
  176. package/build/dist/api/modules/pendle/costs.d.ts +3 -0
  177. package/build/dist/api/modules/pendle/costs.js +1 -0
  178. package/build/dist/api/modules/pendle/index.d.ts +11 -0
  179. package/build/dist/api/modules/pendle/index.js +1 -0
  180. package/build/dist/api/modules/pendle/markets.d.ts +37 -0
  181. package/build/dist/api/modules/pendle/markets.js +1 -0
  182. package/build/dist/api/modules/pendle/positions.d.ts +18 -0
  183. package/build/dist/api/modules/pendle/positions.js +1 -0
  184. package/build/dist/api/modules/pendle/pricecheck.d.ts +95 -0
  185. package/build/dist/api/modules/pendle/pricecheck.js +1 -0
  186. package/build/dist/api/modules/pendle/reader.d.ts +17 -0
  187. package/build/dist/api/modules/pendle/reader.js +1 -0
  188. package/build/dist/api/modules/pendle/redeem.d.ts +15 -0
  189. package/build/dist/api/modules/pendle/redeem.js +1 -0
  190. package/build/dist/api/modules/pendle/trade.d.ts +2 -0
  191. package/build/dist/api/modules/pendle/trade.js +1 -0
  192. package/build/dist/api/modules/pendle/types.d.ts +26 -0
  193. package/build/dist/api/modules/pendle/types.js +0 -0
  194. package/build/dist/api/modules/pendle/validate.d.ts +424 -0
  195. package/build/dist/api/modules/pendle/validate.js +1 -0
  196. package/build/dist/api/modules/pendle/verify.d.ts +22 -0
  197. package/build/dist/api/modules/pendle/verify.js +1 -0
  198. package/build/dist/api/modules/pons/claim.js +1 -1
  199. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  200. package/build/dist/api/modules/pons/index.js +1 -1
  201. package/build/dist/api/modules/pons/launch-status.js +1 -1
  202. package/build/dist/api/modules/pons/prices.js +1 -1
  203. package/build/dist/api/modules/pons/reads.d.ts +38 -2
  204. package/build/dist/api/modules/pons/reads.js +1 -1
  205. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  206. package/build/dist/api/modules/pons/trade.js +1 -1
  207. package/build/dist/api/modules/poolstrade/index.js +1 -1
  208. package/build/dist/api/modules/priors/coverage.js +1 -1
  209. package/build/dist/api/modules/priors/discovery.js +1 -1
  210. package/build/dist/api/modules/priors/features.js +1 -1
  211. package/build/dist/api/modules/priors/holdings.d.ts +4 -0
  212. package/build/dist/api/modules/priors/holdings.js +1 -0
  213. package/build/dist/api/modules/priors/index.js +1 -1
  214. package/build/dist/api/modules/priors/integration.js +1 -1
  215. package/build/dist/api/modules/priors/market.js +1 -1
  216. package/build/dist/api/modules/priors/pt.js +1 -1
  217. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  218. package/build/dist/api/modules/priors/starter-line.js +1 -1
  219. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  220. package/build/dist/api/modules/relay/api.js +1 -1
  221. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  222. package/build/dist/api/modules/relay/discovery.js +1 -1
  223. package/build/dist/api/modules/relay/inbound.js +1 -1
  224. package/build/dist/api/modules/relay/index.js +1 -1
  225. package/build/dist/api/modules/relay/order.js +1 -1
  226. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  227. package/build/dist/api/modules/relay/readiness.js +1 -1
  228. package/build/dist/api/modules/relay/reads.js +1 -1
  229. package/build/dist/api/modules/relay/vaults.js +1 -1
  230. package/build/dist/api/modules/spark/actions.js +1 -1
  231. package/build/dist/api/modules/spark/details.js +1 -1
  232. package/build/dist/api/modules/spark/index.js +1 -1
  233. package/build/dist/api/modules/spark/management.js +1 -1
  234. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  235. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  236. package/build/dist/api/modules/steakhouse/index.js +1 -1
  237. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  238. package/build/dist/api/modules/steakhouse/management.js +1 -1
  239. package/build/dist/api/modules/steakhouse/share-symbol.d.ts +3 -0
  240. package/build/dist/api/modules/steakhouse/share-symbol.js +1 -0
  241. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  242. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  243. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  244. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  245. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  246. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  247. package/build/dist/api/modules/tickerspring/index.js +1 -1
  248. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  249. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  250. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  251. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  252. package/build/dist/api/modules/tickerspring/research.js +1 -1
  253. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  254. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  255. package/build/dist/api/modules/uniswap/auction.js +1 -1
  256. package/build/dist/api/modules/uniswap/batch.js +1 -1
  257. package/build/dist/api/modules/uniswap/common.js +1 -1
  258. package/build/dist/api/modules/uniswap/fees.js +1 -1
  259. package/build/dist/api/modules/uniswap/index.js +1 -1
  260. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  261. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  262. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  263. package/build/dist/api/modules/uniswap/pools.js +1 -1
  264. package/build/dist/api/modules/uniswap/position.js +1 -1
  265. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  266. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  267. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  268. package/build/dist/api/modules/uniswap/trade.js +1 -1
  269. package/build/dist/api/modules/uniswap/v2.js +1 -1
  270. package/build/dist/api/modules/uniswap/v3.d.ts +1 -0
  271. package/build/dist/api/modules/uniswap/v3.js +1 -1
  272. package/build/dist/api/modules/uniswap/v4.js +1 -1
  273. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  274. package/build/dist/api/modules/velora/claims.js +1 -1
  275. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  276. package/build/dist/api/modules/velora/index.js +1 -1
  277. package/build/dist/api/modules/wormhole/index.js +1 -1
  278. package/build/dist/api/modules/wormhole/license.js +1 -1
  279. package/build/dist/api/modules/wormhole/quotetext.js +1 -1
  280. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  281. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  282. package/build/dist/api/owner-signature.js +1 -1
  283. package/build/dist/api/positions.d.ts +5 -5
  284. package/build/dist/api/positions.js +1 -1
  285. package/build/dist/api/pricenote.js +1 -1
  286. package/build/dist/api/prices.js +1 -1
  287. package/build/dist/api/pricing.js +1 -1
  288. package/build/dist/api/reads.js +1 -1
  289. package/build/dist/api/routes.js +1 -1
  290. package/build/dist/api/rpc.js +1 -1
  291. package/build/dist/api/secret-fields.js +1 -1
  292. package/build/dist/api/send.js +1 -1
  293. package/build/dist/api/signing-registry.js +1 -1
  294. package/build/dist/api/signing.js +1 -1
  295. package/build/dist/api/simulate.js +1 -1
  296. package/build/dist/api/swap.js +1 -1
  297. package/build/dist/api/token-output.js +1 -1
  298. package/build/dist/api/tokens.js +1 -1
  299. package/build/dist/api/tool-policy.js +1 -1
  300. package/build/dist/api/tx.js +1 -1
  301. package/build/dist/api/types.d.ts +7 -2
  302. package/build/dist/api/untrusted.js +1 -1
  303. package/build/dist/api/vendor-limits.js +1 -1
  304. package/build/dist/chunks/{7YU6DELJ.js → 24CQ2SPB.js} +1 -1
  305. package/build/dist/chunks/2DUCTO5C.js +1 -0
  306. package/build/dist/chunks/2MZXTOZU.js +1 -0
  307. package/build/dist/chunks/2OJAOVMG.js +1 -0
  308. package/build/dist/chunks/2ZUP7ZEV.js +1 -0
  309. package/build/dist/chunks/{DHOBTJRD.js → 3AXVB23N.js} +1 -1
  310. package/build/dist/chunks/3ESNHZT5.js +1 -0
  311. package/build/dist/chunks/{GIV5JMTE.js → 3VAJW6TQ.js} +1 -1
  312. package/build/dist/chunks/{ALK6NKFP.js → 3WXK2FUA.js} +1 -1
  313. package/build/dist/chunks/{TQL7UDFL.js → 42DQTKEO.js} +1 -1
  314. package/build/dist/chunks/{E7R3J4H7.js → 43CSMYDO.js} +1 -1
  315. package/build/dist/chunks/46547QT3.js +1 -0
  316. package/build/dist/chunks/{XV2HQKND.js → 47YN4OUI.js} +1 -1
  317. package/build/dist/chunks/{S3HNPTXA.js → 4ALMYJJV.js} +1 -1
  318. package/build/dist/chunks/{SOYQOE5P.js → 4BVP652W.js} +1 -1
  319. package/build/dist/chunks/{JNZZLA2A.js → 4ISR2U72.js} +1 -1
  320. package/build/dist/chunks/{AAGDMH54.js → 4TQQH7N6.js} +1 -1
  321. package/build/dist/chunks/{WTSMPDT5.js → 4YFVAYKR.js} +1 -1
  322. package/build/dist/chunks/{PTAWEHKB.js → 57JFKIMK.js} +1 -1
  323. package/build/dist/chunks/{3RFSGU2Y.js → 5CAAFU7R.js} +1 -1
  324. package/build/dist/chunks/{73N3TOJL.js → 5KUWLUPM.js} +1 -1
  325. package/build/dist/chunks/{SKQGLGES.js → 5MQ5KSSV.js} +1 -1
  326. package/build/dist/chunks/{AJP5LDM2.js → 5N4A5XAW.js} +1 -1
  327. package/build/dist/chunks/{OQVZVR2S.js → 5OKJEGBH.js} +1 -1
  328. package/build/dist/chunks/5U7TCKX2.js +2 -0
  329. package/build/dist/chunks/5WUKOQIJ.js +1 -0
  330. package/build/dist/chunks/5ZLOCQA4.js +1 -0
  331. package/build/dist/chunks/63YRSLDK.js +1 -0
  332. package/build/dist/chunks/64WKYWZV.js +1 -0
  333. package/build/dist/chunks/{JPOYTTTW.js → 65EQECL3.js} +1 -1
  334. package/build/dist/chunks/{57HAXNQV.js → 6AAARNZ3.js} +1 -1
  335. package/build/dist/chunks/6FTYNYGF.js +1 -0
  336. package/build/dist/chunks/{L7YBCMZU.js → 6L5KTE6Y.js} +1 -1
  337. package/build/dist/chunks/{53N7PNJH.js → 6PY3IRDS.js} +1 -1
  338. package/build/dist/chunks/{5VHH5PW3.js → 6YYCGUCU.js} +1 -1
  339. package/build/dist/chunks/{UNZRE3YU.js → 7UOOIDR3.js} +1 -1
  340. package/build/dist/chunks/{LQUDJCAR.js → 7WQEPZJY.js} +1 -1
  341. package/build/dist/chunks/A3PN3PK3.js +1 -0
  342. package/build/dist/chunks/A6YQ5H24.js +1 -0
  343. package/build/dist/chunks/{CXLEQCP3.js → ABPL3ZZI.js} +1 -1
  344. package/build/dist/chunks/{R7FXNZRM.js → AG67Z3SC.js} +1 -1
  345. package/build/dist/chunks/{BX7XQANB.js → ALPYEM7B.js} +1 -1
  346. package/build/dist/chunks/{OE3CLZHR.js → ALRRW7SF.js} +1 -1
  347. package/build/dist/chunks/AUOXDNUO.js +7 -0
  348. package/build/dist/chunks/AWXJV2YH.js +1 -0
  349. package/build/dist/chunks/{66VBACC2.js → BAAXGB4K.js} +1 -1
  350. package/build/dist/chunks/{R53P2K3C.js → BIRMUW7Z.js} +1 -1
  351. package/build/dist/chunks/{EA6IYKIB.js → BK23XJXE.js} +1 -1
  352. package/build/dist/chunks/{NATG6YA6.js → BNG2IWZL.js} +1 -1
  353. package/build/dist/chunks/BQICZFLR.js +1 -0
  354. package/build/dist/chunks/{Y2KH6DCE.js → BXHNYCH2.js} +1 -1
  355. package/build/dist/chunks/{L62M7LOB.js → C5ZZAYXD.js} +1 -1
  356. package/build/dist/chunks/{52DHGSG4.js → CERNEJ2F.js} +1 -1
  357. package/build/dist/chunks/{EPZ7SWKM.js → CTMA4BTM.js} +1 -1
  358. package/build/dist/chunks/{QXNPPCOU.js → D6ZJPNK7.js} +1 -1
  359. package/build/dist/chunks/DFM4T6ZE.js +1 -0
  360. package/build/dist/chunks/{SJPM5ST4.js → DP2NIYBP.js} +1 -1
  361. package/build/dist/chunks/DVVFT42J.js +1 -0
  362. package/build/dist/chunks/E3UBHTJO.js +1 -0
  363. package/build/dist/chunks/E6RRXNV2.js +1 -0
  364. package/build/dist/chunks/{ZT47KN7A.js → E6UU7DL2.js} +1 -1
  365. package/build/dist/chunks/ECWGKLBW.js +1 -0
  366. package/build/dist/chunks/EKNSLLJK.js +1 -0
  367. package/build/dist/chunks/{XWEFKXKA.js → ENX72ARB.js} +1 -1
  368. package/build/dist/chunks/{DRWWPBOQ.js → EOQYLFXA.js} +1 -1
  369. package/build/dist/chunks/{ELZNT5Q3.js → ET23SES4.js} +1 -1
  370. package/build/dist/chunks/EU3OAJU2.js +1 -0
  371. package/build/dist/chunks/{2W46IRX6.js → EYFBVQ46.js} +1 -1
  372. package/build/dist/chunks/{VXLJRRKV.js → F26FK47J.js} +1 -1
  373. package/build/dist/chunks/{MFNP4KOK.js → F3BSEE52.js} +1 -1
  374. package/build/dist/chunks/FWD4L3CJ.js +1 -0
  375. package/build/dist/chunks/G7XSFUDL.js +1 -0
  376. package/build/dist/chunks/{5O5ZE3ZV.js → GHPREYQK.js} +1 -1
  377. package/build/dist/chunks/{AFHHRDPJ.js → GRIGSPD4.js} +1 -1
  378. package/build/dist/chunks/{J2XAEVKC.js → GVPX5XCL.js} +1 -1
  379. package/build/dist/chunks/{TLJPVYRJ.js → GW5IXLKU.js} +1 -1
  380. package/build/dist/chunks/H4NYYJ3Z.js +1 -0
  381. package/build/dist/chunks/{J3GFCBZZ.js → HSFOWJ3Z.js} +1 -1
  382. package/build/dist/chunks/{CY75R4FK.js → HTXKERNS.js} +1 -1
  383. package/build/dist/chunks/{6ZYLNB2B.js → HVM2EEXB.js} +1 -1
  384. package/build/dist/chunks/{U3F6DDML.js → I4TGMF2C.js} +1 -1
  385. package/build/dist/chunks/I6KUORFT.js +1 -0
  386. package/build/dist/chunks/{AMICUXS6.js → IKEJCBYU.js} +1 -1
  387. package/build/dist/chunks/IMRXZ7JB.js +1 -0
  388. package/build/dist/chunks/IQGY5FW7.js +1 -0
  389. package/build/dist/chunks/{L3ZM77SJ.js → IQIWASRD.js} +1 -1
  390. package/build/dist/chunks/JG27HM4P.js +1 -0
  391. package/build/dist/chunks/{V5LTA42G.js → JPNYUEQP.js} +1 -1
  392. package/build/dist/chunks/JZXYLHI7.js +1 -0
  393. package/build/dist/chunks/{QYYFRAWY.js → K22EXPWN.js} +1 -1
  394. package/build/dist/chunks/K72EYD6R.js +1 -0
  395. package/build/dist/chunks/KA7BPBCV.js +2 -0
  396. package/build/dist/chunks/KBKK7UNY.js +1 -0
  397. package/build/dist/chunks/{LBEMCOND.js → KBXU7U6Q.js} +1 -1
  398. package/build/dist/chunks/L6D26AMO.js +1 -0
  399. package/build/dist/chunks/{GGUEKSR4.js → L7OQUHM5.js} +1 -1
  400. package/build/dist/chunks/{F6WBPPBN.js → LDT3QTSY.js} +1 -1
  401. package/build/dist/chunks/{ZUG6MG46.js → LROVANUR.js} +1 -1
  402. package/build/dist/chunks/{WWFOYZT2.js → LVLVP5KQ.js} +1 -1
  403. package/build/dist/chunks/MBTARLZQ.js +1 -0
  404. package/build/dist/chunks/{SSTROLQM.js → MDDHG34Y.js} +1 -1
  405. package/build/dist/chunks/{OVK4EEOD.js → MDV7GECM.js} +1 -1
  406. package/build/dist/chunks/{DCTUYDWF.js → MFCPL6LF.js} +1 -1
  407. package/build/dist/chunks/MGPHD4VV.js +1 -0
  408. package/build/dist/chunks/{VC2RCYQE.js → MKAPRRKF.js} +1 -1
  409. package/build/dist/chunks/{FBSUTF3B.js → MKBNLGDD.js} +1 -1
  410. package/build/dist/chunks/{NRBIXV7V.js → MOPETB64.js} +1 -1
  411. package/build/dist/chunks/{ACN2BFMA.js → MQK6OP7S.js} +1 -1
  412. package/build/dist/chunks/{TWCSCRFS.js → MQYOG66Q.js} +1 -1
  413. package/build/dist/chunks/{2UU5TBBB.js → MXW2TP5P.js} +1 -1
  414. package/build/dist/chunks/MYFAKCQI.js +1 -0
  415. package/build/dist/chunks/{MKQVS3IO.js → NA7R6J5N.js} +1 -1
  416. package/build/dist/chunks/NB3LYS3G.js +1 -0
  417. package/build/dist/chunks/{TNSKEHPC.js → NDW5DAFL.js} +1 -1
  418. package/build/dist/chunks/{MRWCFTMS.js → NKX3FE34.js} +1 -1
  419. package/build/dist/chunks/NYNJITCM.js +1 -0
  420. package/build/dist/chunks/{YZSTP2E6.js → NZXQWDGF.js} +1 -1
  421. package/build/dist/chunks/{Z7RL4NGX.js → O6L4BJP4.js} +1 -1
  422. package/build/dist/chunks/{KSZMMNXK.js → OFI3Y55L.js} +1 -1
  423. package/build/dist/chunks/{2LM7U4S7.js → OTIXQZ3X.js} +1 -1
  424. package/build/dist/chunks/{WCKMQFGS.js → PADWZX7J.js} +1 -1
  425. package/build/dist/chunks/{6IM6A5VA.js → PBQSJSZO.js} +1 -1
  426. package/build/dist/chunks/PLZKXQ76.js +1 -0
  427. package/build/dist/chunks/{TFVWAYHY.js → PQC5635W.js} +1 -1
  428. package/build/dist/chunks/PSVOVZH7.js +70 -0
  429. package/build/dist/chunks/{PWBL4WKB.js → PWH464CJ.js} +1 -1
  430. package/build/dist/chunks/QJFXLYZG.js +1 -0
  431. package/build/dist/chunks/{4KQZTPMS.js → QRC4ZPDA.js} +1 -1
  432. package/build/dist/chunks/{4AKIXLXH.js → QSN6Y2K6.js} +1 -1
  433. package/build/dist/chunks/{C3TJLARP.js → QVYCJ6WV.js} +1 -1
  434. package/build/dist/chunks/{WVXW6VL3.js → RNC463IM.js} +1 -1
  435. package/build/dist/chunks/RPNAFUM5.js +1 -0
  436. package/build/dist/chunks/RVO3QK2B.js +1 -0
  437. package/build/dist/chunks/{FUXT7GRK.js → S2TAJHHK.js} +1 -1
  438. package/build/dist/chunks/{YHPOXAKA.js → S3FPF537.js} +1 -1
  439. package/build/dist/chunks/{H4S2ZCWK.js → S5WICHIS.js} +1 -1
  440. package/build/dist/chunks/SDHPFXRM.js +1 -0
  441. package/build/dist/chunks/{3NDVXEBR.js → SGEZIYJW.js} +1 -1
  442. package/build/dist/chunks/SK2VBNAU.js +1 -0
  443. package/build/dist/chunks/SKMPKAZI.js +1 -0
  444. package/build/dist/chunks/{5IIR3GIN.js → SQL6HD5E.js} +1 -1
  445. package/build/dist/chunks/SSIENQVU.js +1 -0
  446. package/build/dist/chunks/{EXRKBBX2.js → SUFA2GKR.js} +1 -1
  447. package/build/dist/chunks/TBCSZDAF.js +1 -0
  448. package/build/dist/chunks/{LMVB3B6T.js → TBIVTEP5.js} +1 -1
  449. package/build/dist/chunks/{2FSX7MMR.js → TJWVY4VO.js} +1 -1
  450. package/build/dist/chunks/{7XLEYOZH.js → TNKVRVTH.js} +1 -1
  451. package/build/dist/chunks/{SI6GCOAS.js → TPL4U3AQ.js} +1 -1
  452. package/build/dist/chunks/{QRDDKA4I.js → U4JGEMKT.js} +1 -1
  453. package/build/dist/chunks/{6AWTAE4Q.js → UA4O226F.js} +1 -1
  454. package/build/dist/chunks/UFVPMWPJ.js +1 -0
  455. package/build/dist/chunks/UHRCM7AG.js +1 -0
  456. package/build/dist/chunks/{XQXLFF7Y.js → UOGHQLQX.js} +1 -1
  457. package/build/dist/chunks/UP7FBDMJ.js +1 -0
  458. package/build/dist/chunks/{YQUKU2LS.js → UPMGGK34.js} +1 -1
  459. package/build/dist/chunks/VHLINDDS.js +1 -0
  460. package/build/dist/chunks/{PARWLWXW.js → VV2HEIFI.js} +1 -1
  461. package/build/dist/chunks/{YA5WWDEW.js → VVA72C6O.js} +1 -1
  462. package/build/dist/chunks/{TCPPYBGQ.js → W2OJ57ZO.js} +1 -1
  463. package/build/dist/chunks/{WQ6H62DM.js → W76QC2AW.js} +1 -1
  464. package/build/dist/chunks/{VFSRRDLY.js → WD37MEMZ.js} +1 -1
  465. package/build/dist/chunks/{R7QPJQP6.js → WGL46F3S.js} +1 -1
  466. package/build/dist/chunks/WIVYKLQM.js +2 -0
  467. package/build/dist/chunks/{XQUPZ3GU.js → WMNRP3YH.js} +1 -1
  468. package/build/dist/chunks/WOEKXQAH.js +1 -0
  469. package/build/dist/chunks/WPAF55SP.js +1 -0
  470. package/build/dist/chunks/{EVANKNJV.js → WPFAEBE7.js} +1 -1
  471. package/build/dist/chunks/WVONJOWN.js +1 -0
  472. package/build/dist/chunks/{TWSTOFN3.js → WWHCEMNB.js} +1 -1
  473. package/build/dist/chunks/{DZGEQBO7.js → XDZRO5JQ.js} +1 -1
  474. package/build/dist/chunks/XFKVU46U.js +3 -0
  475. package/build/dist/chunks/{RAKUK5VR.js → XJEOEMDS.js} +1 -1
  476. package/build/dist/chunks/XSD5NL7J.js +1 -0
  477. package/build/dist/chunks/{NU4K3TEZ.js → XSRIJUFU.js} +1 -1
  478. package/build/dist/chunks/{JVI26KQO.js → Y7PRJOIK.js} +1 -1
  479. package/build/dist/chunks/Y7RPSDD2.js +1 -0
  480. package/build/dist/chunks/YAJYDD6C.js +1 -0
  481. package/build/dist/chunks/{5OEHZJ6X.js → YEXUSRIZ.js} +1 -1
  482. package/build/dist/chunks/YHRUAQQK.js +1 -0
  483. package/build/dist/chunks/{3EFV4FQF.js → YPM2UITD.js} +1 -1
  484. package/build/dist/chunks/{3WBDHUV2.js → YRXT3HTW.js} +1 -1
  485. package/build/dist/chunks/Z4SRGAVL.js +1 -0
  486. package/build/dist/chunks/{SQ5BNSXR.js → ZBFKKUNP.js} +1 -1
  487. package/build/dist/chunks/{NWSPC3NH.js → ZCOFMGPS.js} +1 -1
  488. package/build/dist/chunks/ZCUXM52B.js +1 -0
  489. package/build/dist/chunks/ZE7EU2CS.js +1 -0
  490. package/build/dist/chunks/{CQCVFRQ5.js → ZET37EIG.js} +1 -1
  491. package/build/dist/chunks/{VVEUJ36E.js → ZGKVXFM5.js} +1 -1
  492. package/build/dist/chunks/{WQQJ7UPJ.js → ZSQOMSOC.js} +1 -1
  493. package/build/dist/chunks/{JST5JGAP.js → ZYH4B2GR.js} +1 -1
  494. package/package.json +2 -2
  495. package/build/dist/chunks/2MSQ6JII.js +0 -1
  496. package/build/dist/chunks/3SC5UI35.js +0 -1
  497. package/build/dist/chunks/4GAWMCQC.js +0 -1
  498. package/build/dist/chunks/4GHVIBL5.js +0 -1
  499. package/build/dist/chunks/4X2JOQ2L.js +0 -1
  500. package/build/dist/chunks/5YS5V2LK.js +0 -1
  501. package/build/dist/chunks/6UPPUHCL.js +0 -1
  502. package/build/dist/chunks/AXYOJBX6.js +0 -1
  503. package/build/dist/chunks/CEIPDEXZ.js +0 -1
  504. package/build/dist/chunks/CUNQ5RG5.js +0 -1
  505. package/build/dist/chunks/EG6M6SSO.js +0 -1
  506. package/build/dist/chunks/EGUMOD3A.js +0 -1
  507. package/build/dist/chunks/G6HCV67X.js +0 -1
  508. package/build/dist/chunks/GJY3P6OG.js +0 -1
  509. package/build/dist/chunks/HIMVOTIU.js +0 -1
  510. package/build/dist/chunks/IBXYIN7Q.js +0 -1
  511. package/build/dist/chunks/IUE6RASI.js +0 -1
  512. package/build/dist/chunks/JWCOXLYA.js +0 -1
  513. package/build/dist/chunks/KHJFXJBU.js +0 -1
  514. package/build/dist/chunks/LQGPMOD2.js +0 -1
  515. package/build/dist/chunks/MLPWQTBS.js +0 -1
  516. package/build/dist/chunks/MYBDO5SA.js +0 -1
  517. package/build/dist/chunks/NAYRD43N.js +0 -1
  518. package/build/dist/chunks/NMYGNJIJ.js +0 -1
  519. package/build/dist/chunks/NSOEDRBU.js +0 -3
  520. package/build/dist/chunks/PZHR4ITH.js +0 -1
  521. package/build/dist/chunks/Q356HHCL.js +0 -1
  522. package/build/dist/chunks/R7SXC74O.js +0 -1
  523. package/build/dist/chunks/RETS2ZEK.js +0 -1
  524. package/build/dist/chunks/SJPYXNOK.js +0 -1
  525. package/build/dist/chunks/SQZRVIVF.js +0 -1
  526. package/build/dist/chunks/SXAIXD56.js +0 -1
  527. package/build/dist/chunks/SXX3VTBP.js +0 -1
  528. package/build/dist/chunks/TMGWXDCZ.js +0 -1
  529. package/build/dist/chunks/UFS2RVEZ.js +0 -1
  530. package/build/dist/chunks/USSOVTD5.js +0 -1
  531. package/build/dist/chunks/UWOFA6GV.js +0 -1
  532. package/build/dist/chunks/V2OOOV6B.js +0 -1
  533. package/build/dist/chunks/XMA25DXR.js +0 -1
  534. package/build/dist/chunks/XVFLT275.js +0 -1
  535. package/build/dist/chunks/YHB55C5T.js +0 -1
@@ -1 +1 @@
1
- import{b as s}from"./ACN2BFMA.js";import{a as p}from"./LT5P6PZW.js";import{a as u}from"./CY75R4FK.js";import{f as a}from"./73N3TOJL.js";import{a as r}from"./5YS5V2LK.js";import{erc20Abi as f,getAddress as i,parseAbi as g,zeroAddress as b}from"viem";var w={type:"string",pattern:"^(0|[1-9][0-9]*)$",maxLength:78},O={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R={blockNumber:{...w,description:"Optional named chain-4663 block; defaults to the head captured once for this read."}},T=g(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),k=p;function B(e,n,t=[]){let o=a(e,"Provide the documented Hookr object.");if(Object.keys(o).some(d=>!n.includes(d))||t.some(d=>!Object.hasOwn(o,d)))throw new r("Provide exactly the documented Hookr fields; wallet overrides are not accepted.");return o}function l(e,n=256){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<BigInt(n))throw new r(`Provide a decimal integer string within uint${n}.`);return BigInt(e)}function N(e){return e.blockNumber===void 0?void 0:l(e.blockNumber,64)}function S(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r("Provide an exact bytes32 Hookr ID.");return e.toLowerCase()}function $(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e)||i(e)!==e)throw new r("Provide an EIP-55 checksummed address.");return i(e)}function y(e,n=256){if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new r("Hookr integer read is incomplete. Retry the named-block read.");let t=BigInt(e);if(t<0n||t>=1n<<BigInt(n))throw new r("Hookr integer read is outside its ABI bounds.");return t}function E(e){if(typeof e!="boolean")throw new r("Hookr boolean read is incomplete.");return e}function j(e,n){if(!Array.isArray(e)||e.length!==n)throw new r("Hookr tuple read is incomplete.");return e}var C=e=>a(e,"Hookr struct read is incomplete.");function F(e){return JSON.parse(JSON.stringify(e,(n,t)=>typeof t=="bigint"||typeof t=="number"?String(t):t))}function V(e){return k[e].abi}function m(e,n,t,o,d,c){return e.readContract({address:n,abi:t,functionName:o,args:d,blockNumber:c})}var L=i(s.rootV1),_=i(s.registry),D=i(s.poolManager),J=i(s.agentGateV1);function K(e){if(e===i(s.rulesV1))return"rulesV1";if(e===i(s.rulesPrevious))return"rules";if(e===i(s.rulesLegacy))return"rulesLegacy";throw new r("Unknown Hookr core deployment. Review and pin it before reading this position.")}async function U(e,n,t){if(n===b)return{address:u,symbol:"ETH",decimals:18,chainId:4663};let[o,d]=await Promise.all([m(e,n,f,"symbol",[],t),m(e,n,f,"decimals",[],t)]),c=y(d,8);if(typeof o!="string"||o.length===0||new TextEncoder().encode(o).length>128)throw new r("Hookr token metadata is incomplete. Retry before valuing this currency.");return{address:n,symbol:o,decimals:Number(c),chainId:4663}}export{w as a,O as b,R as c,T as d,B as e,l as f,N as g,S as h,$ as i,y as j,E as k,j as l,C as m,F as n,V as o,m as p,L as q,_ as r,D as s,J as t,K as u,U as v};
1
+ import{b as s}from"./MQK6OP7S.js";import{a as p}from"./LT5P6PZW.js";import{a as u}from"./HTXKERNS.js";import{f as a}from"./5KUWLUPM.js";import{a as r}from"./XSD5NL7J.js";import{erc20Abi as f,getAddress as i,parseAbi as g,zeroAddress as b}from"viem";var w={type:"string",pattern:"^(0|[1-9][0-9]*)$",maxLength:78},O={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R={blockNumber:{...w,description:"Optional named chain-4663 block; defaults to the head captured once for this read."}},T=g(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),k=p;function B(e,n,t=[]){let o=a(e,"Provide the documented Hookr object.");if(Object.keys(o).some(d=>!n.includes(d))||t.some(d=>!Object.hasOwn(o,d)))throw new r("Provide exactly the documented Hookr fields; wallet overrides are not accepted.");return o}function l(e,n=256){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<BigInt(n))throw new r(`Provide a decimal integer string within uint${n}.`);return BigInt(e)}function N(e){return e.blockNumber===void 0?void 0:l(e.blockNumber,64)}function S(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r("Provide an exact bytes32 Hookr ID.");return e.toLowerCase()}function $(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e)||i(e)!==e)throw new r("Provide an EIP-55 checksummed address.");return i(e)}function y(e,n=256){if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new r("Hookr integer read is incomplete. Retry the named-block read.");let t=BigInt(e);if(t<0n||t>=1n<<BigInt(n))throw new r("Hookr integer read is outside its ABI bounds.");return t}function E(e){if(typeof e!="boolean")throw new r("Hookr boolean read is incomplete.");return e}function j(e,n){if(!Array.isArray(e)||e.length!==n)throw new r("Hookr tuple read is incomplete.");return e}var C=e=>a(e,"Hookr struct read is incomplete.");function F(e){return JSON.parse(JSON.stringify(e,(n,t)=>typeof t=="bigint"||typeof t=="number"?String(t):t))}function V(e){return k[e].abi}function m(e,n,t,o,d,c){return e.readContract({address:n,abi:t,functionName:o,args:d,blockNumber:c})}var L=i(s.rootV1),_=i(s.registry),D=i(s.poolManager),J=i(s.agentGateV1);function K(e){if(e===i(s.rulesV1))return"rulesV1";if(e===i(s.rulesPrevious))return"rules";if(e===i(s.rulesLegacy))return"rulesLegacy";throw new r("Unknown Hookr core deployment. Review and pin it before reading this position.")}async function U(e,n,t){if(n===b)return{address:u,symbol:"ETH",decimals:18,chainId:4663};let[o,d]=await Promise.all([m(e,n,f,"symbol",[],t),m(e,n,f,"decimals",[],t)]),c=y(d,8);if(typeof o!="string"||o.length===0||new TextEncoder().encode(o).length>128)throw new r("Hookr token metadata is incomplete. Retry before valuing this currency.");return{address:n,symbol:o,decimals:Number(c),chainId:4663}}export{w as a,O as b,R as c,T as d,B as e,l as f,N as g,S as h,$ as i,y as j,E as k,j as l,C as m,F as n,V as o,m as p,L as q,_ as r,D as s,J as t,K as u,U as v};
@@ -0,0 +1 @@
1
+ import{a as d}from"./XSD5NL7J.js";var i=class extends d{constructor(r,n){super(`${r} is busy; retry in ${Math.max(1,Math.ceil(n))} seconds.`);this.vendor=r;this.retryAfterSeconds=n}vendor;retryAfterSeconds},y=new WeakMap,b={"aggregator-api.kyberswap.com":{label:"KyberSwap",spacing:350},"api.velora.xyz":{label:"Velora",spacing:1050,daily:5e3},"api.relay.link":{label:"Relay",spacing:1250},"api-v2.pendle.finance":{label:"Pendle",spacing:2e3,daily:5e3}};function p(a,c){let r=new URL(c).hostname,n=b[r];if(!n)return;let s=y.get(a);s||(s=new Map,y.set(a,s));let e=s.get(r);return e||(e={next:0,blockedUntil:0,lastSent:-1/0,daily:[]},s.set(r,e)),{label:n.label,reserve(){let t=Date.now();if(e.daily=e.daily.filter(o=>o>t-864e5),n.daily&&e.daily.length>=n.daily)throw new i(n.label,(e.daily[0]+864e5-t)/1e3);let l=Math.max(t,e.next,e.blockedUntil,e.lastSent+n.spacing);if(l-t>2e3)throw new i(n.label,(l-t)/1e3);return e.next=l+n.spacing,l-t},dispatchDelay(){let t=Date.now();if(e.daily=e.daily.filter(o=>o>t-864e5),n.daily&&e.daily.length>=n.daily)throw new i(n.label,(e.daily[0]+864e5-t)/1e3);if(e.blockedUntil>t)throw new i(n.label,(e.blockedUntil-t)/1e3);let l=Math.max(0,e.lastSent+n.spacing-t);return l===0&&(e.lastSent=t,n.daily&&e.daily.push(t)),l},backoff(t){e.blockedUntil=Math.max(e.blockedUntil,Date.now()+t)}}}function f(a){return a instanceof d&&/^(KyberSwap|Velora|Relay|Pendle|The service) is busy; retry in [1-9]\d* seconds\.$/.test(a.message)?a:void 0}export{i as a,p as b,f as c};
@@ -1 +1 @@
1
- import{c as ee}from"./KSZMMNXK.js";import{a as B}from"./CY75R4FK.js";import{a as q}from"./EG6M6SSO.js";import{c as J,d as X,j as Y,l as Z}from"./73N3TOJL.js";import{a as w,i as G}from"./G6HCV67X.js";import{a as f}from"./5YS5V2LK.js";import{a as Q}from"./JXOEJPJ4.js";import{encodeAbiParameters as de,encodeFunctionData as N,erc20Abi as ne,keccak256 as ue,parseAbi as oe,zeroAddress as le}from"viem";var s=oe(["function launchFactory() view returns (address)","function curve() view returns (address)","function factory() view returns (address)","function feeEscrow() view returns (address)","function memeHook() view returns (address)","function buybackVault() view returns (address)","function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function balanceOf(address) view returns (uint256)","function balanceOfToken(address account,address token) view returns (uint256)","function quoteFeeBalance() view returns (uint256)","function creatorTaxBalance() view returns (uint256)","function pendingFees(bytes32,address) view returns (uint256)","function pendingCreatorTax(bytes32,address) view returns (uint256)","function releasable(address token) view returns (uint256)","function vestedAmount(address token) view returns (uint256)"]),h=oe(["function sweepFees(uint256 minBuybackTokensOut)","function sweepPoolFees(bytes32 poolId,uint256 minConversionQuoteOut,uint256 minBuybackTokensOut)","function claim()","function claimToken(address token)","function release(address token)","error InternalSwapRequiresOperator()"]),ae={address:B,chainId:w,symbol:"ETH",decimals:18},te=G[w].pons;function c(o){let d=Y(o,"Provide a valid Pons coin address.",X);return Z(d,"Provide a nonzero Pons coin or contract address.")}function pe(o){let d=new Set;for(;o&&typeof o=="object"&&!d.has(o)&&d.size<16;){d.add(o);let l=o;if(l.data==="0x31cdb504"||l.data&&typeof l.data=="object"&&l.data.errorName==="InternalSwapRequiresOperator")return!0;o=l.cause}return!1}async function fe(o,d,l,k=!1,t){let i=c(d),b=c(l),e=o.clientFor(w);if(t===void 0&&await e.getChainId()!==w)throw new f(`Pons claims require chain ${w}.`);let n=t??await e.getBlockNumber(),[R,se]=await Promise.all([e.readContract({address:i,abi:s,functionName:"launchFactory",blockNumber:n}),e.readContract({address:i,abi:s,functionName:"curve",blockNumber:n})]),P=c(te.factory.address);if(c(R)!==P)throw new f("The coin must belong to the pinned Pons factory.");let y=c(se),[r,re,ie]=await Promise.all([e.readContract({address:P,abi:s,functionName:"getLaunchedToken",args:[i],blockNumber:n}),e.readContract({address:y,abi:s,functionName:"factory",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"feeEscrow",blockNumber:n})]);if(!r.exists||c(r.token)!==i||c(r.curve)!==y||c(re)!==P)throw new f("The coin does not resolve to a consistent Pons launch.");if(r.phase<0||r.phase>3)throw new f("This Pons launch phase is unsupported.");let H=c(r.creatorFeeRecipient),A=H===b;if(k&&!A)throw new f("Only the current creator fee recipient can claim these fees. Use the recipient wallet or Safe.");let g=r.pairToken.toLowerCase(),S=g===le,m=c(ie),M=async a=>{let[u,p]=await Promise.all([e.readContract({address:a,abi:ne,functionName:"symbol",blockNumber:n}),e.readContract({address:a,abi:ne,functionName:"decimals",blockNumber:n})]);return{address:a,chainId:w,symbol:Q(u),decimals:p}},[v,T,_,j,$]=await Promise.all([M(i),S?ae:M(g),e.readContract({address:m,abi:s,functionName:"balanceOf",args:[b],blockNumber:n}),S?0n:e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,g],blockNumber:n}),e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,i],blockNumber:n})]),x=[],F=[],E,C=(a,u,p)=>o.unsignedTx({to:a,data:u,value:"0",chainId:w,description:p});if(r.phase===0){let[a,u]=await Promise.all([e.readContract({address:y,abi:s,functionName:"quoteFeeBalance",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"creatorTaxBalance",blockNumber:n})]);a+u>0n&&(F.push({token:T,amount:(a+u).toString()}),r.buybackEnabled?E="buyback":A&&(await e.simulateContract({address:y,abi:h,functionName:"sweepFees",args:[0n],account:b,gas:q,blockNumber:n}),x.push(C(y,N({abi:h,functionName:"sweepFees",args:[0n]}),`Sweep ${T.symbol} curve fees into the recipient escrow.`))))}else if(r.phase===2){let a=c(await e.readContract({address:P,abi:s,functionName:"memeHook",blockNumber:n})),u=ee(g,i,r.poolFee,r.tickSpacing),p=ue(de([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[u.currency0,u.currency1,r.poolFee,r.tickSpacing,a])),[V,z,W,U]=await Promise.all([e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,i],blockNumber:n})]);if(V+z>0n&&F.push({token:T,amount:(V+z).toString()}),W+U>0n&&F.push({token:v,amount:(W+U).toString()}),F.length)if(r.buybackEnabled)E="buyback";else if(A)try{await e.simulateContract({address:a,abi:h,functionName:"sweepPoolFees",args:[p,0n,0n],account:b,gas:q,blockNumber:n}),x.push(C(a,N({abi:h,functionName:"sweepPoolFees",args:[p,0n,0n]}),`Sweep ${T.symbol} pool fees into the recipient escrow.`))}catch(K){if(!pe(K))throw K;E="conversion"}else W+U>0n&&(E="conversion")}let I=0n,L=0n,D;if(r.buybackEnabled||$>0n||A){let a=c(await e.readContract({address:P,abi:s,functionName:"buybackVault",blockNumber:n}));if(a===c(te.buybackVault.address)){let[u,p,V]=await Promise.all([e.readContract({address:a,abi:s,functionName:"feeEscrow",blockNumber:n}),e.readContract({address:a,abi:s,functionName:"releasable",args:[i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"vestedAmount",args:[i],blockNumber:n})]);if(c(u)!==m)throw new f("The Pons buyback vault credits a different escrow than this coin.");[D,I,L]=[a,p,V]}else if(k)throw new f("The Pons factory reports a buyback vault outside the pinned deployment.")}let O=[...x];if(k){I>0n&&O.push(C(D,N({abi:h,functionName:"release",args:[i]}),`Release the vested ${v.symbol} buyback into the recipient escrow.`));let a=S&&x.length>0,u=!S&&x.length>0;(_>0n||a)&&O.push(C(m,N({abi:h,functionName:"claim"}),"Claim the caller\u2019s full native ETH escrow balance across all coins.")),(j>0n||u)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[g]}),`Claim the caller\u2019s full ${T.symbol} escrow balance across all coins.`)),($>0n||I>0n)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[i]}),`Claim the caller\u2019s released ${v.symbol} escrow balance.`))}let ce=[{token:ae,amount:_.toString()},...S?[]:[{token:T,amount:j.toString()}],{token:v,amount:$.toString()}];return{coin:v,pair:T,phase:r.phase,recipient:H,holder:b,isRecipient:A,escrow:m,blockNumber:n.toString(),credited:ce,pendingBeforeSweep:F,operatorWait:E,txs:O,buybackVest:{enabled:r.buybackEnabled,vault:D??null,releasable:{token:v,amount:I.toString()},vested:{token:v,amount:L.toString()},note:"Releasable is the gross vested amount; the release splits it with the Pons protocol before crediting the recipient escrow, and the preview shows the net claim."}}}function be(o){return o==="buyback"?"Buyback-enabled fee sweeps are not built here; pending fees await Pons\u2019s operator.":o==="conversion"?"Pending token-side conversion is awaiting Pons\u2019s keeper; the hook sweep was skipped.":""}async function me(o,d,l){if(!d||Object.keys(d).some(R=>R!=="token"))throw new f("Unsupported input. Provide only the Pons coin token address.");let k=c(d.token),t=await fe(o,k,c(l),!0),{txs:i}=t,b=await o.preview(i,l),e=t.credited[t.pair.address===B?0:1],n=[i.length?`Unsigned Pons fee claim prepared for the current recipient. Claims withdraw every ${t.pair.address===B?"native ETH":`native ETH and ${t.pair.symbol}`} balance owed to this wallet on this escrow across its coins.`:"No claim is available from this escrow.",be(t.operatorWait),BigInt(t.buybackVest.releasable.amount)>0n?`The buyback vest has ${t.buybackVest.releasable.amount} ${t.coin.symbol} base units releasable (gross); the release credits the escrow and the claim withdraws it.`:"","Pending amounts are pre-sweep fee and tax totals, not a guaranteed creator payout. Preview excludes gas. No transaction was sent."].filter(Boolean).join(" ");return{txs:i,summary:n,preview:b,claimable:e,credited:t.credited,pendingBeforeSweep:t.pendingBeforeSweep,waitingForKeeper:t.operatorWait!==void 0,operatorWait:t.operatorWait??null,buybackVest:t.buybackVest,recipient:t.recipient,escrow:t.escrow,phase:t.phase,blockNumber:t.blockNumber}}var Ne=o=>({tools:[{name:"pons_claim",inputSchema:{type:"object",additionalProperties:!1,required:["token"],properties:{token:{...J,description:"Pons coin address on chain 4663."}}},execute:async(d,l)=>{try{return await me(o,d,l)}catch(k){throw new f(o.plainError(k))}}}]});export{fe as a,be as b,Ne as c};
1
+ import{c as ee}from"./OFI3Y55L.js";import{a as B}from"./HTXKERNS.js";import{a as q}from"./BQICZFLR.js";import{c as J,d as X,j as Y,l as Z}from"./5KUWLUPM.js";import{a as w,i as G}from"./FWD4L3CJ.js";import{a as f}from"./XSD5NL7J.js";import{a as Q}from"./JXOEJPJ4.js";import{encodeAbiParameters as de,encodeFunctionData as N,erc20Abi as ne,keccak256 as ue,parseAbi as oe,zeroAddress as le}from"viem";var s=oe(["function launchFactory() view returns (address)","function curve() view returns (address)","function factory() view returns (address)","function feeEscrow() view returns (address)","function memeHook() view returns (address)","function buybackVault() view returns (address)","function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function balanceOf(address) view returns (uint256)","function balanceOfToken(address account,address token) view returns (uint256)","function quoteFeeBalance() view returns (uint256)","function creatorTaxBalance() view returns (uint256)","function pendingFees(bytes32,address) view returns (uint256)","function pendingCreatorTax(bytes32,address) view returns (uint256)","function releasable(address token) view returns (uint256)","function vestedAmount(address token) view returns (uint256)"]),h=oe(["function sweepFees(uint256 minBuybackTokensOut)","function sweepPoolFees(bytes32 poolId,uint256 minConversionQuoteOut,uint256 minBuybackTokensOut)","function claim()","function claimToken(address token)","function release(address token)","error InternalSwapRequiresOperator()"]),ae={address:B,chainId:w,symbol:"ETH",decimals:18},te=G[w].pons;function c(o){let d=Y(o,"Provide a valid Pons coin address.",X);return Z(d,"Provide a nonzero Pons coin or contract address.")}function pe(o){let d=new Set;for(;o&&typeof o=="object"&&!d.has(o)&&d.size<16;){d.add(o);let l=o;if(l.data==="0x31cdb504"||l.data&&typeof l.data=="object"&&l.data.errorName==="InternalSwapRequiresOperator")return!0;o=l.cause}return!1}async function fe(o,d,l,k=!1,t){let i=c(d),b=c(l),e=o.clientFor(w);if(t===void 0&&await e.getChainId()!==w)throw new f(`Pons claims require chain ${w}.`);let n=t??await e.getBlockNumber(),[R,se]=await Promise.all([e.readContract({address:i,abi:s,functionName:"launchFactory",blockNumber:n}),e.readContract({address:i,abi:s,functionName:"curve",blockNumber:n})]),P=c(te.factory.address);if(c(R)!==P)throw new f("The coin must belong to the pinned Pons factory.");let y=c(se),[r,re,ie]=await Promise.all([e.readContract({address:P,abi:s,functionName:"getLaunchedToken",args:[i],blockNumber:n}),e.readContract({address:y,abi:s,functionName:"factory",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"feeEscrow",blockNumber:n})]);if(!r.exists||c(r.token)!==i||c(r.curve)!==y||c(re)!==P)throw new f("The coin does not resolve to a consistent Pons launch.");if(r.phase<0||r.phase>3)throw new f("This Pons launch phase is unsupported.");let H=c(r.creatorFeeRecipient),A=H===b;if(k&&!A)throw new f("Only the current creator fee recipient can claim these fees. Use the recipient wallet or Safe.");let g=r.pairToken.toLowerCase(),S=g===le,m=c(ie),M=async a=>{let[u,p]=await Promise.all([e.readContract({address:a,abi:ne,functionName:"symbol",blockNumber:n}),e.readContract({address:a,abi:ne,functionName:"decimals",blockNumber:n})]);return{address:a,chainId:w,symbol:Q(u),decimals:p}},[v,T,_,j,$]=await Promise.all([M(i),S?ae:M(g),e.readContract({address:m,abi:s,functionName:"balanceOf",args:[b],blockNumber:n}),S?0n:e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,g],blockNumber:n}),e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,i],blockNumber:n})]),x=[],F=[],E,C=(a,u,p)=>o.unsignedTx({to:a,data:u,value:"0",chainId:w,description:p});if(r.phase===0){let[a,u]=await Promise.all([e.readContract({address:y,abi:s,functionName:"quoteFeeBalance",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"creatorTaxBalance",blockNumber:n})]);a+u>0n&&(F.push({token:T,amount:(a+u).toString()}),r.buybackEnabled?E="buyback":A&&(await e.simulateContract({address:y,abi:h,functionName:"sweepFees",args:[0n],account:b,gas:q,blockNumber:n}),x.push(C(y,N({abi:h,functionName:"sweepFees",args:[0n]}),`Sweep ${T.symbol} curve fees into the recipient escrow.`))))}else if(r.phase===2){let a=c(await e.readContract({address:P,abi:s,functionName:"memeHook",blockNumber:n})),u=ee(g,i,r.poolFee,r.tickSpacing),p=ue(de([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[u.currency0,u.currency1,r.poolFee,r.tickSpacing,a])),[V,z,W,U]=await Promise.all([e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,i],blockNumber:n})]);if(V+z>0n&&F.push({token:T,amount:(V+z).toString()}),W+U>0n&&F.push({token:v,amount:(W+U).toString()}),F.length)if(r.buybackEnabled)E="buyback";else if(A)try{await e.simulateContract({address:a,abi:h,functionName:"sweepPoolFees",args:[p,0n,0n],account:b,gas:q,blockNumber:n}),x.push(C(a,N({abi:h,functionName:"sweepPoolFees",args:[p,0n,0n]}),`Sweep ${T.symbol} pool fees into the recipient escrow.`))}catch(K){if(!pe(K))throw K;E="conversion"}else W+U>0n&&(E="conversion")}let I=0n,L=0n,D;if(r.buybackEnabled||$>0n||A){let a=c(await e.readContract({address:P,abi:s,functionName:"buybackVault",blockNumber:n}));if(a===c(te.buybackVault.address)){let[u,p,V]=await Promise.all([e.readContract({address:a,abi:s,functionName:"feeEscrow",blockNumber:n}),e.readContract({address:a,abi:s,functionName:"releasable",args:[i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"vestedAmount",args:[i],blockNumber:n})]);if(c(u)!==m)throw new f("The Pons buyback vault credits a different escrow than this coin.");[D,I,L]=[a,p,V]}else if(k)throw new f("The Pons factory reports a buyback vault outside the pinned deployment.")}let O=[...x];if(k){I>0n&&O.push(C(D,N({abi:h,functionName:"release",args:[i]}),`Release the vested ${v.symbol} buyback into the recipient escrow.`));let a=S&&x.length>0,u=!S&&x.length>0;(_>0n||a)&&O.push(C(m,N({abi:h,functionName:"claim"}),"Claim the caller\u2019s full native ETH escrow balance across all coins.")),(j>0n||u)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[g]}),`Claim the caller\u2019s full ${T.symbol} escrow balance across all coins.`)),($>0n||I>0n)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[i]}),`Claim the caller\u2019s released ${v.symbol} escrow balance.`))}let ce=[{token:ae,amount:_.toString()},...S?[]:[{token:T,amount:j.toString()}],{token:v,amount:$.toString()}];return{coin:v,pair:T,phase:r.phase,recipient:H,holder:b,isRecipient:A,escrow:m,blockNumber:n.toString(),credited:ce,pendingBeforeSweep:F,operatorWait:E,txs:O,buybackVest:{enabled:r.buybackEnabled,vault:D??null,releasable:{token:v,amount:I.toString()},vested:{token:v,amount:L.toString()},note:"Releasable is the gross vested amount; the release splits it with the Pons protocol before crediting the recipient escrow, and the preview shows the net claim."}}}function be(o){return o==="buyback"?"Buyback-enabled fee sweeps are not built here; pending fees await Pons\u2019s operator.":o==="conversion"?"Pending token-side conversion is awaiting Pons\u2019s keeper; the hook sweep was skipped.":""}async function me(o,d,l){if(!d||Object.keys(d).some(R=>R!=="token"))throw new f("Unsupported input. Provide only the Pons coin token address.");let k=c(d.token),t=await fe(o,k,c(l),!0),{txs:i}=t,b=await o.preview(i,l),e=t.credited[t.pair.address===B?0:1],n=[i.length?`Unsigned Pons fee claim prepared for the current recipient. Claims withdraw every ${t.pair.address===B?"native ETH":`native ETH and ${t.pair.symbol}`} balance owed to this wallet on this escrow across its coins.`:"No claim is available from this escrow.",be(t.operatorWait),BigInt(t.buybackVest.releasable.amount)>0n?`The buyback vest has ${t.buybackVest.releasable.amount} ${t.coin.symbol} base units releasable (gross); the release credits the escrow and the claim withdraws it.`:"","Pending amounts are pre-sweep fee and tax totals, not a guaranteed creator payout. Preview excludes gas. No transaction was sent."].filter(Boolean).join(" ");return{txs:i,summary:n,preview:b,claimable:e,credited:t.credited,pendingBeforeSweep:t.pendingBeforeSweep,waitingForKeeper:t.operatorWait!==void 0,operatorWait:t.operatorWait??null,buybackVest:t.buybackVest,recipient:t.recipient,escrow:t.escrow,phase:t.phase,blockNumber:t.blockNumber}}var Ne=o=>({tools:[{name:"pons_claim",inputSchema:{type:"object",additionalProperties:!1,required:["token"],properties:{token:{...J,description:"Pons coin address on chain 4663."}}},execute:async(d,l)=>{try{return await me(o,d,l)}catch(k){throw new f(o.plainError(k))}}}]});export{fe as a,be as b,Ne as c};
@@ -1,2 +1,2 @@
1
- import{g as c}from"./73N3TOJL.js";import{a,i as l}from"./G6HCV67X.js";import{a as f}from"./5YS5V2LK.js";import{formatUnits as b,getAddress as d,hashTypedData as w,parseAbi as I}from"viem";var p=d("0x8BE478c754D9124D11e78dB20F5bf4dA45403275"),h=d("0x0c5091235A25bBFD3F5a009cBe04120D0CBAD573"),x=6228n,_="https://priors.trade/prove",$="https://priors.trade/invite",m=1800,k=3600,S=/^[0-9a-f]{32}$/,A=/^priors-invite:(\d{1,10}):(\d{1,12}):(0x[0-9a-fA-F]{130})$/,g=I(["function amount() view returns (uint256)","function unusedAfter() view returns (uint64)","function bonds(uint256 agentId) view returns ((address depositor, uint64 at, uint256 amount, uint256 qualifiedAt))","function releasable(uint256 agentId) view returns (bool)","function unusedReleaseAt(uint256 agentId) view returns (uint256)","function progress(uint256 agentId) view returns (uint256 repaid, uint256 needed)","function deposit(uint256 agentId)","function release(uint256 agentId)","error AlreadyBonded(uint256 agentId)","error NotOwner(uint256 agentId)","error AgentDefaulted(uint256 agentId)","error NoBond(uint256 agentId)","error NotReleasable(uint256 agentId)"]);async function E(e,t){let r=e.clientFor(a),n=await r.getBlockNumber({cacheTime:0}),[i,o,s]=await Promise.all([r.readContract({address:p,abi:g,functionName:"amount",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedAfter",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedReleaseAt",args:[t],blockNumber:n})]);if(typeof i!="bigint"||i<0n||typeof o!="bigint"||o<0n||typeof s!="bigint"||s<0n)throw new f("Priors bond terms are unavailable. Read amount, unusedAfter and unusedReleaseAt again before posting a bond.");return{amount:i.toString(),unusedAfter:o.toString(),unusedReleaseAt:s.toString(),blockNumber:n.toString(),summary:`Bond first: the starter line requires ${b(i,6)} USDG locked for at least ${o} seconds (${Number(o)/86400} days) after posting${s?`; unusedReleaseAt(${t}) is ${s} Unix seconds`:"; the exact release time is read after posting"}. Release requires no line and no open loan; default can forfeit the bond. Invites are not guaranteed. The credit score can lag qualifying repayments.`}}var R="(uint256 agentId, uint256 sponsorId, address owner, uint256 maxPremiumBps, uint256 nonce, uint256 deadline)",B=I(["function agentId() view returns (uint256)","function firstLined(uint256 id) view returns (bool)","function inviteDigest(uint256 id, uint64 expiry) view returns (bytes32)","function inviters(address who) view returns (bool)","function inviteUsed(bytes32 digest) view returns (bool)","function epochRoom() view returns (uint256)","function rules() view returns (uint256 reserveBps, uint256 firstLine, uint256 secondLine, uint256 epochCap, uint64 epochLength, uint64 minSeasoning, uint256 minQualified, uint256 minScore, uint64 idleAfter)",`function firstLine(uint256 id, uint64 expiry, bytes invite, ${R} c, bytes consentSig)`,"error NotAdopted()","error AlreadyLined(uint256 agentId)","error OwnerDefaulted(address owner)","error EpochCapReached(uint256 wanted, uint256 left)","error NotInvited(uint256 agentId, address signer)","error InviteExpired(uint256 agentId, uint64 expiry)","error InviteUsed(uint256 agentId)","error BadConsent()","error ConsentExpired()","error PremiumTooHigh(uint256 bps, uint256 cap)","error InsufficientBacking(uint256 rootId, uint256 requested, uint256 free)","error AgentDefaulted(uint256 agentId)","error IsRoot(uint256 agentId)","error V1Busy(uint256 agentId)","error LoanOpen(uint256 agentId)","error InvalidAgent(uint256 id)","error Paused()","error ECDSAInvalidSignature()","error ECDSAInvalidSignatureLength(uint256 length)","error ECDSAInvalidSignatureS(bytes32 s)"]),v={Consent:[{name:"agentId",type:"uint256"},{name:"sponsorId",type:"uint256"},{name:"owner",type:"address"},{name:"maxPremiumBps",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]};function D(){return{name:"Priors Credit",version:"2",chainId:a,verifyingContract:d(l[4663].priors.pool.address)}}function q(e){return{domain:{...D()},types:{Consent:v.Consent.map(t=>({...t}))},primaryType:"Consent",message:{agentId:e.agentId,sponsorId:x.toString(),owner:d(e.owner),maxPremiumBps:"0",nonce:e.nonce,deadline:e.deadline}}}function L(e){return w(e)}function U(e,t){return w({domain:{name:"Priors Treasury",version:"4",chainId:a,verifyingContract:h},types:{Invite:[{name:"agentId",type:"uint256"},{name:"expiry",type:"uint64"}]},primaryType:"Invite",message:{agentId:e,expiry:t}})}function O(e,t,r){return["priors.trade seat request","",`I own agent #${e} on Robinhood Chain and I am asking for a seat.`,"Asked from the priors.trade start page","","This signature only proves ownership. It sends no transaction and moves no funds.","",`request: ${t}`,`expires: ${new Date(r*1e3).toISOString().replace(".000","")}`].join(`
1
+ import{g as c}from"./5KUWLUPM.js";import{a,i as l}from"./FWD4L3CJ.js";import{a as f}from"./XSD5NL7J.js";import{formatUnits as b,getAddress as d,hashTypedData as w,parseAbi as I}from"viem";var p=d("0x8BE478c754D9124D11e78dB20F5bf4dA45403275"),h=d("0x0c5091235A25bBFD3F5a009cBe04120D0CBAD573"),x=6228n,_="https://priors.trade/prove",$="https://priors.trade/invite",m=1800,k=3600,S=/^[0-9a-f]{32}$/,A=/^priors-invite:(\d{1,10}):(\d{1,12}):(0x[0-9a-fA-F]{130})$/,g=I(["function amount() view returns (uint256)","function unusedAfter() view returns (uint64)","function bonds(uint256 agentId) view returns ((address depositor, uint64 at, uint256 amount, uint256 qualifiedAt))","function releasable(uint256 agentId) view returns (bool)","function unusedReleaseAt(uint256 agentId) view returns (uint256)","function progress(uint256 agentId) view returns (uint256 repaid, uint256 needed)","function deposit(uint256 agentId)","function release(uint256 agentId)","error AlreadyBonded(uint256 agentId)","error NotOwner(uint256 agentId)","error AgentDefaulted(uint256 agentId)","error NoBond(uint256 agentId)","error NotReleasable(uint256 agentId)"]);async function E(e,t){let r=e.clientFor(a),n=await r.getBlockNumber({cacheTime:0}),[i,o,s]=await Promise.all([r.readContract({address:p,abi:g,functionName:"amount",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedAfter",blockNumber:n}),r.readContract({address:p,abi:g,functionName:"unusedReleaseAt",args:[t],blockNumber:n})]);if(typeof i!="bigint"||i<0n||typeof o!="bigint"||o<0n||typeof s!="bigint"||s<0n)throw new f("Priors bond terms are unavailable. Read amount, unusedAfter and unusedReleaseAt again before posting a bond.");return{amount:i.toString(),unusedAfter:o.toString(),unusedReleaseAt:s.toString(),blockNumber:n.toString(),summary:`Bond first: the starter line requires ${b(i,6)} USDG locked for at least ${o} seconds (${Number(o)/86400} days) after posting${s?`; unusedReleaseAt(${t}) is ${s} Unix seconds`:"; the exact release time is read after posting"}. Release requires no line and no open loan; default can forfeit the bond. Invites are not guaranteed. The credit score can lag qualifying repayments.`}}var R="(uint256 agentId, uint256 sponsorId, address owner, uint256 maxPremiumBps, uint256 nonce, uint256 deadline)",B=I(["function agentId() view returns (uint256)","function firstLined(uint256 id) view returns (bool)","function inviteDigest(uint256 id, uint64 expiry) view returns (bytes32)","function inviters(address who) view returns (bool)","function inviteUsed(bytes32 digest) view returns (bool)","function epochRoom() view returns (uint256)","function rules() view returns (uint256 reserveBps, uint256 firstLine, uint256 secondLine, uint256 epochCap, uint64 epochLength, uint64 minSeasoning, uint256 minQualified, uint256 minScore, uint64 idleAfter)",`function firstLine(uint256 id, uint64 expiry, bytes invite, ${R} c, bytes consentSig)`,"error NotAdopted()","error AlreadyLined(uint256 agentId)","error OwnerDefaulted(address owner)","error EpochCapReached(uint256 wanted, uint256 left)","error NotInvited(uint256 agentId, address signer)","error InviteExpired(uint256 agentId, uint64 expiry)","error InviteUsed(uint256 agentId)","error BadConsent()","error ConsentExpired()","error PremiumTooHigh(uint256 bps, uint256 cap)","error InsufficientBacking(uint256 rootId, uint256 requested, uint256 free)","error AgentDefaulted(uint256 agentId)","error IsRoot(uint256 agentId)","error V1Busy(uint256 agentId)","error LoanOpen(uint256 agentId)","error InvalidAgent(uint256 id)","error Paused()","error ECDSAInvalidSignature()","error ECDSAInvalidSignatureLength(uint256 length)","error ECDSAInvalidSignatureS(bytes32 s)"]),v={Consent:[{name:"agentId",type:"uint256"},{name:"sponsorId",type:"uint256"},{name:"owner",type:"address"},{name:"maxPremiumBps",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]};function D(){return{name:"Priors Credit",version:"2",chainId:a,verifyingContract:d(l[4663].priors.pool.address)}}function q(e){return{domain:{...D()},types:{Consent:v.Consent.map(t=>({...t}))},primaryType:"Consent",message:{agentId:e.agentId,sponsorId:x.toString(),owner:d(e.owner),maxPremiumBps:"0",nonce:e.nonce,deadline:e.deadline}}}function L(e){return w(e)}function U(e,t){return w({domain:{name:"Priors Treasury",version:"4",chainId:a,verifyingContract:h},types:{Invite:[{name:"agentId",type:"uint256"},{name:"expiry",type:"uint64"}]},primaryType:"Invite",message:{agentId:e,expiry:t}})}function O(e,t,r){return["priors.trade seat request","",`I own agent #${e} on Robinhood Chain and I am asking for a seat.`,"Asked from the priors.trade start page","","This signature only proves ownership. It sends no transaction and moves no funds.","",`request: ${t}`,`expires: ${new Date(r*1e3).toISOString().replace(".000","")}`].join(`
2
2
  `)}var u=e=>typeof e=="string"?JSON.stringify(e.length>80?`${e.slice(0,80)}...`:e):typeof e=="number"?String(e):e===null?"null":typeof e;function V(e,t){let r=o=>({ok:!1,why:o});if(!e||typeof e!="object"||Array.isArray(e))return r("its answer is not the bot's form");let n=e;if(n.ok!==!0)return{ok:!1,refused:!0,why:typeof n.error=="string"&&n.error?n.error:"it answered no, with no reason"};if(typeof n.agentId!="string"&&typeof n.agentId!="number"||String(n.agentId)!==t.agentId)return r(`it is for agent ${u(n.agentId)}, not agent #${t.agentId}`);if(typeof n.owner!="string"||!c(n.owner,t.owner))return r(`it names ${u(n.owner)} as the agent's owner, not this wallet (${t.owner})`);if(typeof n.n!="string"||!S.test(n.n))return r(`its request ${u(n.n)} is not the bot's form (32 hex digits)`);if(typeof n.exp!="number"||!Number.isSafeInteger(n.exp))return r(`its expiry ${u(n.exp)} is not a time`);if(n.exp<=t.now)return r(`its expiry (${new Date(n.exp*1e3).toISOString()}) has already passed`);if(n.exp>t.now+m+300)return r(`its expiry (${new Date(n.exp*1e3).toISOString()}) is further away than the bot's ${m/60} minutes`);let i=O(t.agentId,n.n,n.exp);if(typeof n.message!="string")return r("it carries no message");if(n.message!==i){let o=0;for(;o<i.length&&n.message[o]===i[o];)o++;return r(`its message is not the bot's own form for agent #${t.agentId}, request ${n.n} and that expiry: the two first differ at character ${o+1} of ${i.length}`)}return{ok:!0,n:n.n,exp:n.exp,message:i}}function H(e,t,r){let n=A.exec(typeof e=="string"?e:"");if(!n)return{ok:!1,why:"it is not an invite code (priors-invite:<id>:<expiry>:<signature>)"};if(n[1]!==t)return{ok:!1,why:`it is for agent #${n[1]}, not agent #${t}`};let i=Number(n[2]);return i<=r?{ok:!1,why:`it expired at ${new Date(i*1e3).toISOString()}`}:{ok:!0,expiry:BigInt(n[2]),signature:n[3]}}var y=e=>`${new Date(e*1e3).toISOString().slice(0,16).replace("T"," ")} UTC`;function F(e){let t=typeof e.reopensAt=="number"&&Number.isSafeInteger(e.reopensAt)&&e.reopensAt>0?e.reopensAt:null;switch(e.reason){case"default":return"A default on this wallet's record stops new lines for its agents, so a bond would bring no invite.";case"day":return"Today's automatic invites are taken. New ones open at 00:00 UTC: call priors_starter_line again after that.";case"room":return e.held===!0&&t?`This week's first lines are held by invites that haven't been used yet. One may be free after ${y(t)}: call priors_starter_line again then.`:`This week's first lines are taken.${t?` New ones open after ${y(t)}: call priors_starter_line again then.`:" Come back next week."}`;case"owner":return`This wallet already used its ${typeof e.perOwner=="number"&&Number.isSafeInteger(e.perOwner)&&e.perOwner>0?e.perOwner:2} automatic invites, so a bond would bring no invite.`;case"waiting":return"Another agent of this wallet has an invite waiting. Use it, or let it expire, before asking for this one.";case"backing":return"The treasury can't back a new line right now. Try again later.";default:return"Automatic invites aren't open right now, so a bond would bring no invite. Try again later."}}export{p as a,h as b,x as c,_ as d,$ as e,m as f,k as g,S as h,A as i,g as j,E as k,B as l,v as m,D as n,q as o,L as p,U as q,O as r,V as s,H as t,F as u};
@@ -0,0 +1 @@
1
+ import{a as w}from"./Z25UKUJF.js";import{b as v,c as A}from"./PBQSJSZO.js";import{h as S,j as x}from"./5ZLOCQA4.js";import{b as M,c as g}from"./UP7FBDMJ.js";import{a as i,e as h}from"./XSD5NL7J.js";function N(o){return{...o,unsignedTx:v,approval:A,parseAmount:M,formatAmount:g,plainError:h}}function y(o,s,t){let a=new Set(s);if(!Array.isArray(o))throw new i("A module must provide a tools array.");for(let e of o){if(!e||typeof e.name!="string"||!/^[a-z][a-z0-9_]*$/.test(e.name)||t&&(!e.name.startsWith(`${t}_`)||e.name.length<=t.length+1))throw new i("A tool must have a valid name with its module prefix.");if(a.has(e.name))throw new i(`Tool ${e.name} is already registered.`);if(!e.inputSchema||typeof e.inputSchema!="object"||Array.isArray(e.inputSchema)||e.inputSchema.type!=="object"||typeof e.execute!="function")throw new i(`Tool ${e.name} must provide an object input schema and an execute function.`);a.add(e.name)}}var $=new WeakSet;function T(o){if($.has(o))return;let s=o.inputSchema,t=o.execute;o.inputSchema=S(s),o.execute=async(a,e)=>{try{return await t(x(s,a),e)}catch(n){if(n instanceof i&&/^(Unsupported|Unexpected)\b.* argument\.$/.test(n.message)){let u=Object.keys(s.properties??{});throw new i(`${n.message} Accepted fields for ${o.name}: ${u.join(", ")||"(none)"}.`)}throw n}},$.add(o)}function P(o,s,t){if(typeof o!="string"||!/^[a-z][a-z0-9]*$/.test(o))throw new i("Provide a valid module name.");let a=[],e=[];for(let n of s){if(!n||!Array.isArray(n.tools))throw new i(`Module ${o} has an invalid part.`);if(a.push(...n.tools),n.positions!==void 0){if(typeof n.positions!="function")throw new i(`Module ${o} has an invalid positions reader.`);e.push(n.positions.bind(n))}}if(y(a,new Set,o),t&&(typeof t.name!="string"||!t.name||typeof t.quote!="function"||typeof t.build!="function"))throw new i(`Module ${o} has an invalid swap provider.`);return{name:o,tools:a,...e.length?{positions:async(n,u)=>(await Promise.all(e.map(d=>d(n,u)))).flat()}:{},...t?{swapProvider:t}:{}}}function O(o,s,t=[]){y(t,new Set);let a=[...t],e=[],n=[],u=new Set,d=new Set(t.map(p=>p.name));for(let[p,b]of s.entries())try{let l=b(o),r=P(l.name,[l],l.swapProvider);if(u.has(r.name))throw new i(`Module ${r.name} is already registered.`);y(r.tools,d,r.name);for(let c of r.tools){T(c);let f=c.execute;c.execute=async(m,j)=>w(await f(m,j))}if(r.positions){let c=r.positions;r.positions=async(f,m)=>w(await c(f,m))}a.push(...r.tools),e.push(r),u.add(r.name),r.tools.forEach(c=>d.add(c.name))}catch(l){n.push({index:p,error:h(l)})}return{tools:a,modules:e,errors:n}}export{N as a,P as b,O as c};
@@ -1 +1 @@
1
- import{h as l}from"./73N3TOJL.js";import{a as i}from"./5YS5V2LK.js";async function m(a,e,t,r){let n=`OAK_RPC_URL_${e}`;try{let s=a(e);if(await s.getChainId()!==e)throw new Error("Wrong chain");let o=await s.request({method:"debug_traceCall",params:[{from:t,to:t,data:"0x",value:"0x0",gas:"0x5208"},"latest",{tracer:"callTracer"}]});if(o?.type!=="CALL"||!l(o.to,t)||o.error)throw new Error("Invalid trace")}catch{throw new i(`Relay return path is unavailable on the ${r} for chain ${e}. Set ${n} in both the Oak server and local add-on environments to an RPC for chain ${e} that supports debug_traceCall with callTracer, then restart both and retry bridge-out. Nothing was submitted.`)}return`Relay return path checked on the ${r}: chain ${e} RPC and debug_traceCall with callTracer are available. This checks setup now; it does not guarantee future RPC availability or Relay settlement. Keep destination ETH for return gas.`}var h=500;function d(a,e){let t=BigInt(a),r=BigInt(e),n=((t-r)*10000n+t-1n)/t;return new i(`Relay order minimum is below the allowed slippage minimum. This quote needs slippageBps at least ${n} (maximum 9999), or explicit minAmountOut "${e}". Review that minimum before retrying; a new quote alone may have the same floor.`)}export{m as a,h as b,d as c};
1
+ import{h as l}from"./5KUWLUPM.js";import{a as i}from"./XSD5NL7J.js";async function m(a,e,t,r){let n=`OAK_RPC_URL_${e}`;try{let s=a(e);if(await s.getChainId()!==e)throw new Error("Wrong chain");let o=await s.request({method:"debug_traceCall",params:[{from:t,to:t,data:"0x",value:"0x0",gas:"0x5208"},"latest",{tracer:"callTracer"}]});if(o?.type!=="CALL"||!l(o.to,t)||o.error)throw new Error("Invalid trace")}catch{throw new i(`Relay return path is unavailable on the ${r} for chain ${e}. Set ${n} in both the Oak server and local add-on environments to an RPC for chain ${e} that supports debug_traceCall with callTracer, then restart both and retry bridge-out. Nothing was submitted.`)}return`Relay return path checked on the ${r}: chain ${e} RPC and debug_traceCall with callTracer are available. This checks setup now; it does not guarantee future RPC availability or Relay settlement. Keep destination ETH for return gas.`}var h=500;function d(a,e){let t=BigInt(a),r=BigInt(e),n=((t-r)*10000n+t-1n)/t;return new i(`Relay order minimum is below the allowed slippage minimum. This quote needs slippageBps at least ${n} (maximum 9999), or explicit minAmountOut "${e}". Review that minimum before retrying; a new quote alone may have the same floor.`)}export{m as a,h as b,d as c};
@@ -1 +1 @@
1
- import{a as E}from"./MYBDO5SA.js";import{e as f}from"./73N3TOJL.js";import{a as k}from"./5YS5V2LK.js";import{createHash as N,createPublicKey as I,verify as x}from"node:crypto";import{getAddress as R,isAddress as C}from"viem";var v="https://dashboard.agentwormhole.com",h=4663,$="name,symbol,description,logo",L="wormhole-x402@0.11.0",D=5e3,A=65536,O="MCowBQYDK2VwAyEAgzc6812eT397nvzP/off3M93Z+yM5/BmEefSnRnS7o0=",B=I({key:Buffer.from(O,"base64"),format:"der",type:"spki"}),P=N("sha256").update(Buffer.from(O,"base64")).digest("hex"),S=/^[0-9a-f]{64}$/,H=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/,b=["v","metadata_hash","scope","chain_id","token","bundle_hash","verdict","codes","ruleset","issued_at","expires_at"];function z(e){return JSON.stringify(Object.fromEntries(b.map(t=>[t,e[t]])))}function J(e){return f(e)&&Object.keys(e).length===b.length&&b.every(t=>Object.hasOwn(e,t))&&e.v===2&&typeof e.metadata_hash=="string"&&S.test(e.metadata_hash)&&typeof e.bundle_hash=="string"&&S.test(e.bundle_hash)&&typeof e.scope=="string"&&Number.isSafeInteger(e.chain_id)&&typeof e.token=="string"&&/^0x[0-9a-f]{40}$/.test(e.token)&&["clean_by_rules","flagged"].includes(String(e.verdict))&&Array.isArray(e.codes)&&e.codes.length<=100&&e.codes.every(t=>typeof t=="string"&&/^[A-Z0-9_-]{1,40}$/.test(t))&&typeof e.ruleset=="string"&&/^wormhole-x402@\d+\.\d+\.\d+$/.test(e.ruleset)&&[e.issued_at,e.expires_at].every(t=>typeof t=="string"&&H.test(t)&&Number.isFinite(Date.parse(t))&&new Date(t).toISOString()===t)}async function K(e,t){let i=e.headers.get("content-length");if(i&&(!/^\d+$/.test(i)||Number(i)>A))throw e.body?.cancel().catch(()=>{}),new Error("oversized_response");let a=e.body?.getReader();if(!a)throw new Error("invalid_response");let d=[],s=0,c=()=>{a.cancel().catch(()=>{})};t.addEventListener("abort",c,{once:!0});try{for(;;){if(t.aborted)throw new Error("timeout");let{value:u,done:l}=await a.read();if(l)break;if(s+=u.byteLength,s>A)throw new Error("oversized_response");d.push(u)}if(t.aborted)throw new Error("timeout");return JSON.parse(Buffer.concat(d).toString("utf8"))}finally{t.removeEventListener("abort",c),a.cancel().catch(()=>{}),a.releaseLock()}}async function F(e,t){if(!f(t)||Object.keys(t).length!==1||typeof t.token!="string"||!C(t.token,{strict:!0})||t.token.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")throw new k("Provide only token: a valid ERC-20 contract address on Robinhood Chain 4663.");let i=R(t.token),a=`${v}/api/v1/token/${h}/${i.toLowerCase()}`,d={token:{address:i,chainId:h},contentBound:!1,mutationCountAuthenticated:!1,attribution:{provider:"Agent Wormhole",source:a,page:`${v}/t/${h}/${i.toLowerCase()}`},keyId:P,unknowns:["Fresh full metadata is not available in the free response; description/logo and current displayed bytes are not bound.","The key was bootstrapped from the same origin, not independently authenticated; key rotation policy is unknown.","No contract code, economics, sellability, linked pages or image bytes were checked. Rules are evadable."]},s=(o,n=!1)=>({...d,status:"unchecked",verdict:null,signatureValid:n,codes:[],reason:o}),c=new AbortController,u,l=new Promise((o,n)=>{u=setTimeout(()=>{c.abort(),n(new Error("timeout"))},D)});try{return await Promise.race([l,(async()=>{let o=await e(a,{method:"GET",redirect:"error",credentials:"omit",headers:{accept:"application/json"},signal:c.signal}).catch(y=>{if(y instanceof E)return y.response;throw y});if(c.signal.aborted)throw new Error("timeout");if(o.redirected)return o.body?.cancel().catch(()=>{}),s("redirect_refused");if(!o.ok)return o.body?.cancel().catch(()=>{}),o.status===404?{...d,status:"unobserved",verdict:null,signatureValid:!1,codes:[],reason:"No attestation. Absence is not a verdict."}:s(o.status===429?"rate_limited":`http_${o.status}`);let n=await K(o,c.signal);if(!f(n)||!J(n.attestation)||typeof n.signature!="string"||!/^[A-Za-z0-9+/]{86}==$/.test(n.signature))return s("invalid_attestation");let r=n.attestation,m=Buffer.from(n.signature,"base64");if(m.length!==64||m.toString("base64")!==n.signature||!x(null,Buffer.from(z(r)),B,m))return s("invalid_signature");if(r.chain_id!==h||r.token!==i.toLowerCase()||r.scope!==$)return s("identity_or_scope_mismatch",!0);if(N("sha256").update(JSON.stringify({v:2,chainId:h,address:r.token,metadataHash:r.metadata_hash})).digest("hex")!==r.bundle_hash)return s("bundle_mismatch",!0);if(n.observed!==!0||n.chain_id!==h||typeof n.token!="string"||n.token.toLowerCase()!==r.token||n.bundle_hash!==r.bundle_hash||n.verdict!==r.verdict||JSON.stringify(n.codes)!==JSON.stringify(r.codes))return s("record_mismatch",!0);let p=Date.parse(r.issued_at),g=Date.parse(r.expires_at),w=Date.now();if(p>w||g<=p||g-p>864e5)return s("invalid_time_window",!0);let _=[...w>=g?["expired"]:[],...r.ruleset!==L?["unrecognized_ruleset"]:[],...n.attestation_current!==!0||n.re_attestation!=="current"?["service_reports_not_current"]:[]],T={attestation:r,signature:n.signature,scope:r.scope,metadataHash:r.metadata_hash,bundleHash:r.bundle_hash,ruleset:r.ruleset,issuedAt:r.issued_at,expiresAt:r.expires_at,bundleIdentityValid:!0};return{...d,status:_.length?"stale":"verified",verdict:_.length?null:r.verdict,signatureValid:!0,codes:r.codes,evidence:T,staleReasons:_,mutationCount:Number.isSafeInteger(n.mutations)&&Number(n.mutations)>=0?n.mutations:null,notice:"A verified metadata snapshot is not a safety certificate. Unsigned service history and freshness do not prove no mutation since the scan."}})()])}catch(o){return s(c.signal.aborted||o instanceof Error&&o.message==="timeout"?"timeout":"unavailable_or_malformed_response")}finally{u!==void 0&&clearTimeout(u)}}export{D as a,F as b};
1
+ import{a as E}from"./MYFAKCQI.js";import{e as f}from"./5KUWLUPM.js";import{a as k}from"./XSD5NL7J.js";import{createHash as N,createPublicKey as I,verify as x}from"node:crypto";import{getAddress as R,isAddress as C}from"viem";var v="https://dashboard.agentwormhole.com",h=4663,$="name,symbol,description,logo",L="wormhole-x402@0.11.0",D=5e3,A=65536,O="MCowBQYDK2VwAyEAgzc6812eT397nvzP/off3M93Z+yM5/BmEefSnRnS7o0=",B=I({key:Buffer.from(O,"base64"),format:"der",type:"spki"}),P=N("sha256").update(Buffer.from(O,"base64")).digest("hex"),S=/^[0-9a-f]{64}$/,H=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/,b=["v","metadata_hash","scope","chain_id","token","bundle_hash","verdict","codes","ruleset","issued_at","expires_at"];function z(e){return JSON.stringify(Object.fromEntries(b.map(t=>[t,e[t]])))}function J(e){return f(e)&&Object.keys(e).length===b.length&&b.every(t=>Object.hasOwn(e,t))&&e.v===2&&typeof e.metadata_hash=="string"&&S.test(e.metadata_hash)&&typeof e.bundle_hash=="string"&&S.test(e.bundle_hash)&&typeof e.scope=="string"&&Number.isSafeInteger(e.chain_id)&&typeof e.token=="string"&&/^0x[0-9a-f]{40}$/.test(e.token)&&["clean_by_rules","flagged"].includes(String(e.verdict))&&Array.isArray(e.codes)&&e.codes.length<=100&&e.codes.every(t=>typeof t=="string"&&/^[A-Z0-9_-]{1,40}$/.test(t))&&typeof e.ruleset=="string"&&/^wormhole-x402@\d+\.\d+\.\d+$/.test(e.ruleset)&&[e.issued_at,e.expires_at].every(t=>typeof t=="string"&&H.test(t)&&Number.isFinite(Date.parse(t))&&new Date(t).toISOString()===t)}async function K(e,t){let i=e.headers.get("content-length");if(i&&(!/^\d+$/.test(i)||Number(i)>A))throw e.body?.cancel().catch(()=>{}),new Error("oversized_response");let a=e.body?.getReader();if(!a)throw new Error("invalid_response");let d=[],s=0,c=()=>{a.cancel().catch(()=>{})};t.addEventListener("abort",c,{once:!0});try{for(;;){if(t.aborted)throw new Error("timeout");let{value:u,done:l}=await a.read();if(l)break;if(s+=u.byteLength,s>A)throw new Error("oversized_response");d.push(u)}if(t.aborted)throw new Error("timeout");return JSON.parse(Buffer.concat(d).toString("utf8"))}finally{t.removeEventListener("abort",c),a.cancel().catch(()=>{}),a.releaseLock()}}async function F(e,t){if(!f(t)||Object.keys(t).length!==1||typeof t.token!="string"||!C(t.token,{strict:!0})||t.token.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")throw new k("Provide only token: a valid ERC-20 contract address on Robinhood Chain 4663.");let i=R(t.token),a=`${v}/api/v1/token/${h}/${i.toLowerCase()}`,d={token:{address:i,chainId:h},contentBound:!1,mutationCountAuthenticated:!1,attribution:{provider:"Agent Wormhole",source:a,page:`${v}/t/${h}/${i.toLowerCase()}`},keyId:P,unknowns:["Fresh full metadata is not available in the free response; description/logo and current displayed bytes are not bound.","The key was bootstrapped from the same origin, not independently authenticated; key rotation policy is unknown.","No contract code, economics, sellability, linked pages or image bytes were checked. Rules are evadable."]},s=(o,n=!1)=>({...d,status:"unchecked",verdict:null,signatureValid:n,codes:[],reason:o}),c=new AbortController,u,l=new Promise((o,n)=>{u=setTimeout(()=>{c.abort(),n(new Error("timeout"))},D)});try{return await Promise.race([l,(async()=>{let o=await e(a,{method:"GET",redirect:"error",credentials:"omit",headers:{accept:"application/json"},signal:c.signal}).catch(y=>{if(y instanceof E)return y.response;throw y});if(c.signal.aborted)throw new Error("timeout");if(o.redirected)return o.body?.cancel().catch(()=>{}),s("redirect_refused");if(!o.ok)return o.body?.cancel().catch(()=>{}),o.status===404?{...d,status:"unobserved",verdict:null,signatureValid:!1,codes:[],reason:"No attestation. Absence is not a verdict."}:s(o.status===429?"rate_limited":`http_${o.status}`);let n=await K(o,c.signal);if(!f(n)||!J(n.attestation)||typeof n.signature!="string"||!/^[A-Za-z0-9+/]{86}==$/.test(n.signature))return s("invalid_attestation");let r=n.attestation,m=Buffer.from(n.signature,"base64");if(m.length!==64||m.toString("base64")!==n.signature||!x(null,Buffer.from(z(r)),B,m))return s("invalid_signature");if(r.chain_id!==h||r.token!==i.toLowerCase()||r.scope!==$)return s("identity_or_scope_mismatch",!0);if(N("sha256").update(JSON.stringify({v:2,chainId:h,address:r.token,metadataHash:r.metadata_hash})).digest("hex")!==r.bundle_hash)return s("bundle_mismatch",!0);if(n.observed!==!0||n.chain_id!==h||typeof n.token!="string"||n.token.toLowerCase()!==r.token||n.bundle_hash!==r.bundle_hash||n.verdict!==r.verdict||JSON.stringify(n.codes)!==JSON.stringify(r.codes))return s("record_mismatch",!0);let p=Date.parse(r.issued_at),g=Date.parse(r.expires_at),w=Date.now();if(p>w||g<=p||g-p>864e5)return s("invalid_time_window",!0);let _=[...w>=g?["expired"]:[],...r.ruleset!==L?["unrecognized_ruleset"]:[],...n.attestation_current!==!0||n.re_attestation!=="current"?["service_reports_not_current"]:[]],T={attestation:r,signature:n.signature,scope:r.scope,metadataHash:r.metadata_hash,bundleHash:r.bundle_hash,ruleset:r.ruleset,issuedAt:r.issued_at,expiresAt:r.expires_at,bundleIdentityValid:!0};return{...d,status:_.length?"stale":"verified",verdict:_.length?null:r.verdict,signatureValid:!0,codes:r.codes,evidence:T,staleReasons:_,mutationCount:Number.isSafeInteger(n.mutations)&&Number(n.mutations)>=0?n.mutations:null,notice:"A verified metadata snapshot is not a safety certificate. Unsigned service history and freshness do not prove no mutation since the scan."}})()])}catch(o){return s(c.signal.aborted||o instanceof Error&&o.message==="timeout"?"timeout":"unavailable_or_malformed_response")}finally{u!==void 0&&clearTimeout(u)}}export{D as a,F as b};
@@ -0,0 +1 @@
1
+ import{b as K}from"./65EQECL3.js";import{c as j}from"./MYFAKCQI.js";import{d as N}from"./F26FK47J.js";import{g as S}from"./5KUWLUPM.js";import{a as M,b as O}from"./UP7FBDMJ.js";import{a as q,i as z}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{a as $}from"./JXOEJPJ4.js";import{encodeAbiParameters as se,encodeFunctionData as G,erc20Abi as W,getAddress as J,isAddress as ce,keccak256 as V,parseAbi as me,parseAbiParameters as ue,zeroAddress as Z}from"viem";var x=q,C=J(z[x].hoodlock.airdrop.address),ee="https://hoodlock.tech",E=25e4,ye=256,ge=604800n,fe=30n,X=250000000000000000n,Q=0xffffffffn,pe=(1n<<64n)-1n,oe=(1n<<128n)-1n,ne="0x0000000000000000000000000000000000000000000000000000000000000000",be="0x1111111111111111111111111111111111111111",xe=ue("uint256, address, uint256"),T=me(["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 Ae(o,e,t){let n=e.trim();if(n.startsWith("-")){let r=n.slice(1);return`-${o.formatAmount(r,t)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,t)}function te(o,e){if(!e.changes.length)return e.summary;let t=e.changes.map(n=>`${Ae(o,n.amount,n.token.decimals)} ${$(n.token.symbol)}`).join(", ");return`${e.summary} (${t})`}async function he(o,e){try{let[t,n]=await Promise.all([o.readContract({address:e,abi:W,functionName:"symbol"}),o.readContract({address:e,abi:W,functionName:"decimals"})]),d=typeof t=="string"&&t.trim()?t.trim():"TOKEN",r=Number(n);return{symbol:d,decimals:Number.isInteger(r)&&r>=0&&r<=255?r:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,t){if(typeof e=="string"&&e.includes(".")){if(t?.decimals===void 0)throw new i(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=t.rounding!==void 0?O(e,t.decimals,t.rounding):o?o.parseAmount(e,t.decimals):O(e,t.decimals),r=M(d);if(r<=0n)throw new i("Airdrop entry amount must be positive.");return r}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=M(e.trim());else throw new i("Amount must be a non-negative integer string in base units.")}catch(d){throw d instanceof i?d:new i(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new i("Airdrop entry amount must be strictly positive (> 0).");return n}function H(o,e){try{let t=typeof o=="bigint"?o:BigInt(String(o).trim());if(t<0n)throw new i(`${e} must be non-negative.`);return t}catch(t){throw t instanceof i?t:new i(`Invalid ${e}: ${String(o)}`,{cause:t})}}function A(o,e){if(typeof o!="string"||!ce(o,{strict:!1}))throw new i(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return J(o)}function L(o,e,t){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>Q)throw new i(`Airdrop leaf index must be in 0..${Q.toString()}.`);let d=A(e,"account"),r=w(void 0,t),s=se(xe,[n,d,r]);return V(V(s))}function re(o,e){let t=o;for(let n of e)t=N(t,n);return t}function Oe(o){try{let e=L(o.index,o.account,o.amount),t=re(e,o.proof);return S(t,o.root)}catch{return!1}}function U(o,e){if(!Array.isArray(o)||o.length===0)throw new i("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>E)throw new i(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${E}.`);let t=[],n=0n;for(let a=0;a<o.length;a+=1){let l=o[a];if(!l)throw new i(`Missing airdrop entry at position ${a}.`);let c=l.index??a;if(!Number.isInteger(c)||c!==a)throw new i(`Airdrop entry index at position ${a} must be contiguous ${a} (got ${String(c)}).`);let u=A(l.account,`entries[${a}].account`),g=w(e?.context,l.amount,e);n+=g,t.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>oe)throw new i("Airdrop total amount must be > 0 and fit in uint128.");let d=t.map(a=>L(a.index,a.account,a.amount)),r=[d];for(;r[r.length-1].length>1;){let a=r[r.length-1],l=[];for(let c=0;c<a.length;c+=2){let u=a[c],g=a[c+1];g===void 0?l.push(u):l.push(N(u,g))}r.push(l)}let s=r[r.length-1][0];if(s.toLowerCase()===ne)throw new i("Computed Merkle root cannot be zero.");let f=r.length>1?r[1]:r[0],m=t.map((a,l)=>{let c=[],u=l;for(let g=0;g<r.length-1;g+=1){let y=r[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:a.index,account:a.account,amount:a.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:t.length,values:t.map(a=>[a.index,a.account,a.amount]),entries:t};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:t.length,entries:t,proofs:m,list:p}}function we(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new i("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,r])=>({index:n,account:d,amount:r})),t=U(e);if(o.root&&!S(t.root,o.root))throw new i(`Rebuilt tree root ${t.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&t.maxClaims!==o.maxClaims)throw new i(`Rebuilt maxClaims (${t.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&t.totalAmount!==o.totalAmount)throw new i(`Rebuilt totalAmount (${t.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return t}async function ie(o,e){return j(o.http,e,{method:"GET"},t=>t!==null&&typeof t=="object")}async function ke(o,e,t){let n=A(e.token,"token");if(n===Z)throw new i("Airdrop token cannot be the zero address.");let d=U(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),r=e.maxClaims??d.maxClaims;if(!Number.isInteger(r)||r<1||r>E||r!==d.maxClaims)throw new i(`maxClaims (${String(r)}) must equal entries.length (${d.maxClaims}) and be in 1..${E}.`);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 i(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>oe)throw new i("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ye)throw new i(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let a=e.endTime!==void 0?H(e.endTime,"endTime"):0n;if(a>pe)throw new i("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new i(`Token ${n} has no contract code on chain ${x}.`);let u;if(a!==0n){let _=(await l.getBlock()).timestamp,B=e.inclusionMargin!==void 0?H(e.inclusionMargin,"inclusionMargin"):fe;if(B<=0n)throw new i("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 i(`inclusionTime (${I.toString()}) must be after the already-mined block (${_.toString()}) with room for signing and inclusion (>= ${D.toString()}).`);u=I;let F=I+ge;if(a<F)throw new i(`endTime (${a.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:[r]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>X)throw new i(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${X.toString()}).`);let b=o.formatAmount(y.toString(),K.decimals),h=o.approval(n,C,f.toString(),x),k=o.unsignedTx({chainId:x,to:C,data:G({abi:T,functionName:"create",args:[n,d.root,f,r,a,m]}),value:y.toString(),description:`Create HoodLock airdrop (${r} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),v=[h,k],P=A(e.account??t??be,"wallet"),R=await o.preview(v,P),de=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",le=`${te(o,R)}${de}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:r,endTime:a,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:v,preview:R,summary:le}}async function Y(o,e,t,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==t)throw new i(`savedProof account (${m}) does not match claim account (${t}).`);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 i(`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?we(n.list):U(n.entries,{context:o})).proofs.find(a=>!(!S(a.account,t)||n.index!==void 0&&a.index!==Number(n.index)));if(!p)throw new i(`Account ${t} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${ee}/api/airdrop/${e.toString()}/proof?address=${t}`,r=await ie(o,d),s=r?.data??r;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new i(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${t}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new i(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function ae(o,e){let t=o.clientFor(x),n=await t.readContract({address:C,abi:T,functionName:"getAirdrop",args:[e.id]}),[d,r,s,f,m,p,a,,l]=n,c=BigInt(r),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===Z||a.toLowerCase()===ne)throw new i(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new i(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await t.getBlock()).timestamp>=c)throw new i(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new i(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([t.readContract({address:C,abi:T,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),he(t,b)]);if(h)throw new i(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new i(`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),P=re(v,e.proof);if(!S(P,a))throw new i(`Computed Merkle root ${P} does not match on-chain airdrop root ${a} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:a,leaf:v}}async function $e(o,e){let{tokenAddress:t,tokenMeta:n,merkleRoot:d,leaf:r}=await ae(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:G({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}`}),a=[p],l=await o.preview(a,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 ${t}); 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 ${t}) 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:t,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:r,merkleRoot:d,proof:[...e.proof],tx:p,txs:a,preview:c,summary:u}}async function Se(o,e,t){let n=A(e.account??t??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):t!==void 0?A(t,"wallet"):void 0;if(e.id!==void 0){let l=H(e.id,"id"),c=await Y(o,l,n,e);return $e(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let r=`${ee}/api/airdrop/eligible?address=${n}`,s=await ie(o,r),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 Y(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await ae(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 Ce=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,t)=>ke(o,e,t)},{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,t)=>Se(o,e,t)}]}),Ne=Ce;export{W as a,x as b,C as c,ee as d,E as e,ye as f,ge as g,fe as h,X as i,T as j,Ae as k,L as l,re as m,Oe as n,U as o,we as p,Ce as q,Ne as r};
@@ -0,0 +1 @@
1
+ import{a as ie,b as le,c as de,d as Z}from"./GRIGSPD4.js";import{a as E,b as Y}from"./XFKVU46U.js";import{c as ae}from"./MYFAKCQI.js";import{a as X}from"./5ZLOCQA4.js";import{b as C,c as P,d as se,e as h,g,i as oe}from"./5KUWLUPM.js";import{a as v,i as ne,l as D,n as re}from"./FWD4L3CJ.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as M,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),ye=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),be=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,se)}function j(e,t,o){let r=e??t;if(typeof r!="number"||!Number.isInteger(r)||r<1||r>o)throw new T(`Choose a limit from 1 to ${o}.`);return r}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(r=>O(r,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([r])=>/^[A-Za-z0-9_]{1,40}$/.test(r)).slice(0,40).map(([r,d])=>[r,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function J(e,t,o){let r=e.clientFor(v),[d,a]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:o}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),r=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),s=e.clientFor(v),m=await s.getBlockNumber({cacheTime:0}),k=await E(e,o,m),i=await le(e,o),n=await s.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(re),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([J(e,o,n),s.readContract({address:o,abi:M,functionName:"totalSupply",blockNumber:n})]),W=c=>1+R.filter(y=>BigInt(y.balance)>BigInt(c)).length,B=async(c,y)=>{let F=await s.readContract({address:o,abi:M,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:y,indexedRank:y===null||_.has(c)?null:W(y),indexedShareOfSupply:y===null?null:Z(y,u.supply),shareOfSupply:Z(F.toString(),q.toString()),balance:{token:G,amount:F.toString()},matchesIndex:y===null?null:F.toString()===y}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=r?i.rows.find(c=>g(c.wallet,r)):void 0,H=r?{...await B(r,V?.balance??null),excluded:_.get(r)??null,rankStatus:_.has(r)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(y=>g(y.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(y=>g(y.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let r=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${r.toLowerCase()}?view=positions`,ve),s=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await E(e,u,s);let[w,_]=await Promise.all([J(e,u,s),a.readContract({address:u,abi:M,functionName:"balanceOf",args:[r],blockNumber:s})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:r,statusBlock:s.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),r=await U(e,`${x}/launches/trending`,Ae),d=r.items.filter(s=>g(s.launch.factory,D)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async s=>({status:await Y(e,f(s.launch.address),a),index:{volumeUsd:p(s.volumeUsd),trades:p(s.trades),traders:p(s.traders),change:p(s.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:r.items.length-r.items.filter(s=>g(s.launch.factory,D)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let r=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(r.series)?r.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(r.generatedAt),latestDay:p(r.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(r.today),earnings:O(r.earnings),indexer:O(r.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(r,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let r=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${r.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:r,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(s=>({kind:$(s.kind,24),block:p(s.block),time:p(s.time),tx:typeof s.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(s.tx)?s.tx:null,token:typeof s.token=="string"&&C.test(s.token)?f(s.token):null,symbol:$(s.symbol,24),amount:typeof s.amount=="string"&&ke.test(s.amount)?s.amount:null,decimals:p(s.decimals),usd:p(s.usd),counterparty:typeof s.counterparty=="string"&&C.test(s.counterparty)?f(s.counterparty):null,counterpartyLabel:$(s.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let r=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${r.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},s=await U(e,`${x}/launches?deployer=${r.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=s.items.filter(i=>g(i.factory,D)&&g(i.deployer,r)).slice(0,d);return{address:r,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let r=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),s=await E(e,r,l),m=ne[v].pons.buybackVault.address,k=[],i=async(b,K)=>{try{return await K()}catch{return k.push(b),null}},n=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),u=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),w=b=>i(b,()=>a.readContract({address:m,abi:ue,functionName:b,args:[r],blockNumber:l})),[_,R,G,q,W,B,A,V,H,c,y,F,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:s.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:r,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:D,abi:be,functionName:"pendingCreatorFeeRecipient",args:[r],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),J(e,r,l)]),S=b=>b===null?null:b.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:s.phase,statusBlock:l.toString(),curve:s.curve,creatorFeeRecipient:s.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(W),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((b,K)=>[b,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:s.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(y),vestingStart:S(F),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),r=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await E(e,o,a),s=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?s>=pe?s-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>s||s>a||s-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:ye,fromBlock:m,toBlock:s,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await J(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:s.toString(),statusBlock:a.toString(),truncated:i.length>r,total:i.length,trades:i.slice(0,r).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,r,d){return{name:o,inputSchema:{type:"object",properties:r,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let s of Object.keys(a))if(!(s in r))throw new T(`Unknown ${o} input: ${s}.`);return await d(a,l)}catch(s){throw new T(e.plainError(s))}}}}return{tools:[t("pons_holders",{token:P,holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:P,limit:{type:"integer",minimum:1,maximum:40}},(o,r)=>xe(e,o,r)),t("pons_trending",{limit:{type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:P,cursor:{type:"string",maxLength:32}},(o,r)=>Pe(e,o,r)),t("pons_launch_info",{token:P,holder:P},(o,r)=>_e(e,o,r)),t("pons_trades",{token:P,fromBlock:X(),toBlock:X(),limit:{type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:P,limit:{type:"integer",minimum:1,maximum:20}},(o,r)=>Ne(e,o,r))]}};export{O as a,xe as b,Le as c};
@@ -1 +1 @@
1
- import{a as y,b as T,c as S,f as d,g as b,h as O,i as E,j as R,k,l as V}from"./WQ6H62DM.js";import{c as M}from"./MYBDO5SA.js";import{c as f,e as C,g as A}from"./73N3TOJL.js";import{a as D}from"./G6HCV67X.js";import{a as r}from"./5YS5V2LK.js";import{concat as z,encodeAbiParameters as _,encodeFunctionData as P,keccak256 as B,parseAbi as U,parseAbiParameters as j}from"viem";var I=U(["function allocation(address) view returns (address token,uint256 amountTotal,uint256 amountClaimed,uint256 lockupEndTime,uint256 vestingEndTime,address admin)","function amountAvailableToClaim(address) view returns (uint256)","function claim(address)","function editAllocationAdmin(address,address)"]),$=U(["function airdrops(address) view returns (address admin,bytes32 merkleRoot,uint256 totalSupply,uint256 totalClaimed,uint256 lockupEndTime,uint256 vestingEndTime,uint256 adminClaimTime,bool adminClaimed)","function amountAvailableToClaim(address,address,uint256) view returns (uint256)","function claim(address,address,uint256,bytes32[])","function updateAdmin(address,address)","function updateMerkleRoot(address,bytes32)","function adminClaim(address,address)"]),F={bps:{type:"integer",minimum:1,maximum:9e3},admin:f,lockupDuration:T,vestingDuration:T},X={vault:{type:"object",properties:F,required:["bps","lockupDuration","vestingDuration"],additionalProperties:!1},airdrop:{type:"object",properties:{...F,merkleRoot:S},required:["bps","lockupDuration","vestingDuration","merkleRoot"],additionalProperties:!1}};function Y(u,h){let g=[];for(let p of["vault","airdrop"]){let l=u[p];if(l===void 0)continue;if(!C(l))throw new r(`Provide ${p} configuration as an object.`);E(l,["bps","admin","lockupDuration","vestingDuration",...p==="airdrop"?["merkleRoot"]:[]]);let w=d(l.admin??h),v=b(l.lockupDuration),e=b(l.vestingDuration);if(v<BigInt(p==="vault"?604800:86400))throw new r(`${p} lockup is below the contract minimum.`);if(v+e+1209600n>=1n<<256n)throw new r("Extension duration exceeds uint256.");g.push({extension:y[p].address,msgValue:0n,extensionBps:O(l.bps,1,9e3),extensionData:p==="vault"?_(j("(address,uint256,uint256)"),[[w,v,e]]):_(j("(address,bytes32,uint256,uint256)"),[[w,R(l.merkleRoot),v,e]])})}if(g.reduce((p,l)=>p+l.extensionBps,0)>9e3)throw new r("Extensions must leave at least 10% of supply for liquidity.");return g}function H(u,h){return B(B(_(j("address,uint256"),[u,h])))}function N(u,h){return B(z(BigInt(u)<BigInt(h)?[u,h]:[h,u]))}var Z=u=>{let h=()=>u.clientFor(D),g=async(e,t)=>{if(!(await V(u,e)).extensions.some(a=>A(a,y[t].address)))throw new r(`This token has no verified Clanker ${t} extension.`)},p=async e=>{await g(e,"vault");let t=await h().readContract({address:y.vault.address,abi:I,functionName:"allocation",args:[e]});if(!Array.isArray(t)||t.length!==6||!A(d(t[0]),e))throw new r("Clanker returned an invalid vault allocation.");return{token:e,amountTotal:k(t[1]),amountClaimed:k(t[2]),lockupEndTime:k(t[3]),vestingEndTime:k(t[4]),admin:d(t[5]),claimable:k(await h().readContract({address:y.vault.address,abi:I,functionName:"amountAvailableToClaim",args:[e]}))}},l=async e=>{await g(e,"airdrop");let t=await h().readContract({address:y.airdrop.address,abi:$,functionName:"airdrops",args:[e]});if(!Array.isArray(t)||t.length!==8||typeof t[7]!="boolean")throw new r("Clanker returned invalid airdrop state.");return{token:e,admin:d(t[0]),merkleRoot:R(t[1]),totalSupply:k(t[2]),totalClaimed:k(t[3]),lockupEndTime:k(t[4]),vestingEndTime:k(t[5]),adminClaimTime:k(t[6]),adminClaimed:t[7]}},w=(e,t,n,a)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:n,additionalProperties:!1},execute:async(s,o)=>{try{return E(s,Object.keys(t)),await a(s,d(o))}catch(i){throw new r(u.plainError(i))}}}),v=async(e,t,n,a)=>{let s=[u.unsignedTx({to:e,data:t,chainId:D,value:"0",description:n})],o=await u.preview(s,a);return{txs:s,preview:o,summary:`${n} ${o.summary}`}};return{tools:[w("airdrop_proofs",{token:f},["token"],async(e,t)=>{let n=d(e.token),a=await l(n),s=new URL("https://www.clanker.world/api/airdrops/claim");s.searchParams.set("tokenAddress",n),s.searchParams.set("claimerAddress",t);let i=(await M(u.http,s.toString(),{method:"GET"},m=>C(m)&&Array.isArray(m.proofs))).proofs;if(i.length>200)throw new r("Clanker returned too many airdrop proofs.");let c=i.map(m=>{if(!C(m)||!C(m.entry)||!Array.isArray(m.proof)||m.proof.length>64||!A(d(m.entry.account),t))throw new r("Clanker returned invalid airdrop proofs.");let x=b(m.entry.amount),q=m.proof.map(R);if(!x||!A(q.reduce(N,H(t,x)),a.merkleRoot))throw new r("The indexed airdrop proof does not match the active onchain root.");return{allocatedAmount:x.toString(),proof:q}});return{token:n,chainId:D,recipient:t,proofs:c,summary:"Verified against the onchain airdrop root. An empty indexer response does not prove ineligibility; use saved allocation proofs if the tree was not published."}}),w("vault_status",{token:f},["token"],e=>p(d(e.token))),w("vault_claim",{token:f},["token"],async(e,t)=>{let n=d(e.token),a=await p(n);if(a.claimable==="0")throw new r("No vested Clanker tokens are available to claim.");return v(y.vault.address,P({abi:I,functionName:"claim",args:[n]}),`Claim ${a.claimable} base units of ${n} (18 decimals) to vault admin ${a.admin}.`,t)}),w("vault_update_admin",{token:f,admin:f},["token","admin"],async(e,t)=>{let n=d(e.token),a=await p(n);if(!A(a.admin,t))throw new r("Only the vault administrator can transfer its allocation.");return v(y.vault.address,P({abi:I,functionName:"editAllocationAdmin",args:[n,d(e.admin)]}),`Transfer all future Clanker vault claims for ${n} to ${d(e.admin)}.`,t)}),w("airdrop_tree",{allocations:{type:"array",minItems:1,maxItems:200,items:{type:"object",properties:{recipient:f,amount:T},required:["recipient","amount"],additionalProperties:!1}}},["allocations"],async e=>{if(!Array.isArray(e.allocations)||!e.allocations.length||e.allocations.length>200)throw new r("Provide 1 to 200 airdrop allocations.");let t=new Set,n=e.allocations.map(o=>{if(!C(o))throw new r("Provide allocation objects.");E(o,["recipient","amount"]);let i=d(o.recipient),c=b(o.amount);if(!c||t.has(i))throw new r("Airdrop allocations require positive amounts and unique recipients.");return t.add(i),{recipient:i,amount:c.toString(),hash:H(i,c)}}).sort((o,i)=>o.hash.localeCompare(i.hash)),a=[n.map(o=>o.hash)];for(;a.at(-1).length>1;){let o=a.at(-1),i=[];for(let c=0;c<o.length;c+=2)i.push(c+1<o.length?N(o[c],o[c+1]):o[c]);a.push(i)}let s=n.reduce((o,i)=>o+BigInt(i.amount),0n);if(s>=1n<<256n)throw new r("Airdrop total exceeds uint256.");return{merkleRoot:a.at(-1)[0],total:s.toString(),allocations:n.map((o,i)=>{let c=[],m=i;for(let x of a.slice(0,-1))x[m^1]&&c.push(x[m^1]),m=Math.floor(m/2);return{recipient:o.recipient,amount:o.amount,proof:c}}),summary:"Double-hashed ABI(address,uint256) leaves; sorted hash pairs. Save these public proofs. Allocations are token base units, 18 decimals; match their total to the launch extension supply."}}),w("airdrop_status",{token:f,allocatedAmount:T},["token"],async(e,t)=>{let n=d(e.token);return{...await l(n),...e.allocatedAmount===void 0?{}:{claimable:k(await h().readContract({address:y.airdrop.address,abi:$,functionName:"amountAvailableToClaim",args:[n,t,b(e.allocatedAmount)]}))}}}),w("airdrop_claim",{token:f,allocatedAmount:T,proof:{type:"array",maxItems:64,items:S}},["token","allocatedAmount","proof"],async(e,t)=>{let n=d(e.token),a=await l(n),s=b(e.allocatedAmount);if(!s||!Array.isArray(e.proof)||e.proof.length>64)throw new r("Provide a positive allocation and Merkle proof.");let o=e.proof.map(R),i=o.reduce(N,H(t,s));if(!A(i,a.merkleRoot))throw new r("The airdrop proof does not match the active root for this wallet and allocation.");return v(y.airdrop.address,P({abi:$,functionName:"claim",args:[n,t,s,o]}),`Claim vested allocation of ${s} base units of ${n} (18 decimals) to ${t}. Preview determines currently unlocked receipts.`,t)}),w("airdrop_manage",{token:f,operation:{enum:["admin","root","reclaim"]},admin:f,merkleRoot:S,recipient:f},["token","operation"],async(e,t)=>{let n=d(e.token),a=await l(n);if(!A(a.admin,t))throw new r("Only the airdrop administrator may manage it.");let s=e.operation==="admin"?"admin":e.operation==="root"?"merkleRoot":"recipient";for(let i of["admin","merkleRoot","recipient"])if(e[i]!==void 0&&i!==s)throw new r(`Input ${i} does not match this airdrop operation.`);let o;if(e.operation==="admin")o=P({abi:$,functionName:"updateAdmin",args:[n,d(e.admin)]});else if(e.operation==="root")o=P({abi:$,functionName:"updateMerkleRoot",args:[n,R(e.merkleRoot)]});else if(e.operation==="reclaim")o=P({abi:$,functionName:"adminClaim",args:[n,d(e.recipient)]});else throw new r("Choose admin, root or reclaim.");return v(y.airdrop.address,o,`Clanker airdrop ${String(e.operation)} for ${n}; ${String(e.admin??e.merkleRoot??e.recipient)}. Reclaim permanently closes recipient claims; contract timing and zero-claim guards apply.`,t)})]}};export{X as a,Y as b,Z as c};
1
+ import{a as y,b as T,c as S,f as d,g as b,h as O,i as E,j as R,k,l as V}from"./W76QC2AW.js";import{c as M}from"./MYFAKCQI.js";import{c as f,e as C,g as A}from"./5KUWLUPM.js";import{a as D}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{concat as z,encodeAbiParameters as _,encodeFunctionData as P,keccak256 as B,parseAbi as U,parseAbiParameters as j}from"viem";var I=U(["function allocation(address) view returns (address token,uint256 amountTotal,uint256 amountClaimed,uint256 lockupEndTime,uint256 vestingEndTime,address admin)","function amountAvailableToClaim(address) view returns (uint256)","function claim(address)","function editAllocationAdmin(address,address)"]),$=U(["function airdrops(address) view returns (address admin,bytes32 merkleRoot,uint256 totalSupply,uint256 totalClaimed,uint256 lockupEndTime,uint256 vestingEndTime,uint256 adminClaimTime,bool adminClaimed)","function amountAvailableToClaim(address,address,uint256) view returns (uint256)","function claim(address,address,uint256,bytes32[])","function updateAdmin(address,address)","function updateMerkleRoot(address,bytes32)","function adminClaim(address,address)"]),F={bps:{type:"integer",minimum:1,maximum:9e3},admin:f,lockupDuration:T,vestingDuration:T},X={vault:{type:"object",properties:F,required:["bps","lockupDuration","vestingDuration"],additionalProperties:!1},airdrop:{type:"object",properties:{...F,merkleRoot:S},required:["bps","lockupDuration","vestingDuration","merkleRoot"],additionalProperties:!1}};function Y(u,h){let g=[];for(let p of["vault","airdrop"]){let l=u[p];if(l===void 0)continue;if(!C(l))throw new r(`Provide ${p} configuration as an object.`);E(l,["bps","admin","lockupDuration","vestingDuration",...p==="airdrop"?["merkleRoot"]:[]]);let w=d(l.admin??h),v=b(l.lockupDuration),e=b(l.vestingDuration);if(v<BigInt(p==="vault"?604800:86400))throw new r(`${p} lockup is below the contract minimum.`);if(v+e+1209600n>=1n<<256n)throw new r("Extension duration exceeds uint256.");g.push({extension:y[p].address,msgValue:0n,extensionBps:O(l.bps,1,9e3),extensionData:p==="vault"?_(j("(address,uint256,uint256)"),[[w,v,e]]):_(j("(address,bytes32,uint256,uint256)"),[[w,R(l.merkleRoot),v,e]])})}if(g.reduce((p,l)=>p+l.extensionBps,0)>9e3)throw new r("Extensions must leave at least 10% of supply for liquidity.");return g}function H(u,h){return B(B(_(j("address,uint256"),[u,h])))}function N(u,h){return B(z(BigInt(u)<BigInt(h)?[u,h]:[h,u]))}var Z=u=>{let h=()=>u.clientFor(D),g=async(e,t)=>{if(!(await V(u,e)).extensions.some(a=>A(a,y[t].address)))throw new r(`This token has no verified Clanker ${t} extension.`)},p=async e=>{await g(e,"vault");let t=await h().readContract({address:y.vault.address,abi:I,functionName:"allocation",args:[e]});if(!Array.isArray(t)||t.length!==6||!A(d(t[0]),e))throw new r("Clanker returned an invalid vault allocation.");return{token:e,amountTotal:k(t[1]),amountClaimed:k(t[2]),lockupEndTime:k(t[3]),vestingEndTime:k(t[4]),admin:d(t[5]),claimable:k(await h().readContract({address:y.vault.address,abi:I,functionName:"amountAvailableToClaim",args:[e]}))}},l=async e=>{await g(e,"airdrop");let t=await h().readContract({address:y.airdrop.address,abi:$,functionName:"airdrops",args:[e]});if(!Array.isArray(t)||t.length!==8||typeof t[7]!="boolean")throw new r("Clanker returned invalid airdrop state.");return{token:e,admin:d(t[0]),merkleRoot:R(t[1]),totalSupply:k(t[2]),totalClaimed:k(t[3]),lockupEndTime:k(t[4]),vestingEndTime:k(t[5]),adminClaimTime:k(t[6]),adminClaimed:t[7]}},w=(e,t,n,a)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:n,additionalProperties:!1},execute:async(s,o)=>{try{return E(s,Object.keys(t)),await a(s,d(o))}catch(i){throw new r(u.plainError(i))}}}),v=async(e,t,n,a)=>{let s=[u.unsignedTx({to:e,data:t,chainId:D,value:"0",description:n})],o=await u.preview(s,a);return{txs:s,preview:o,summary:`${n} ${o.summary}`}};return{tools:[w("airdrop_proofs",{token:f},["token"],async(e,t)=>{let n=d(e.token),a=await l(n),s=new URL("https://www.clanker.world/api/airdrops/claim");s.searchParams.set("tokenAddress",n),s.searchParams.set("claimerAddress",t);let i=(await M(u.http,s.toString(),{method:"GET"},m=>C(m)&&Array.isArray(m.proofs))).proofs;if(i.length>200)throw new r("Clanker returned too many airdrop proofs.");let c=i.map(m=>{if(!C(m)||!C(m.entry)||!Array.isArray(m.proof)||m.proof.length>64||!A(d(m.entry.account),t))throw new r("Clanker returned invalid airdrop proofs.");let x=b(m.entry.amount),q=m.proof.map(R);if(!x||!A(q.reduce(N,H(t,x)),a.merkleRoot))throw new r("The indexed airdrop proof does not match the active onchain root.");return{allocatedAmount:x.toString(),proof:q}});return{token:n,chainId:D,recipient:t,proofs:c,summary:"Verified against the onchain airdrop root. An empty indexer response does not prove ineligibility; use saved allocation proofs if the tree was not published."}}),w("vault_status",{token:f},["token"],e=>p(d(e.token))),w("vault_claim",{token:f},["token"],async(e,t)=>{let n=d(e.token),a=await p(n);if(a.claimable==="0")throw new r("No vested Clanker tokens are available to claim.");return v(y.vault.address,P({abi:I,functionName:"claim",args:[n]}),`Claim ${a.claimable} base units of ${n} (18 decimals) to vault admin ${a.admin}.`,t)}),w("vault_update_admin",{token:f,admin:f},["token","admin"],async(e,t)=>{let n=d(e.token),a=await p(n);if(!A(a.admin,t))throw new r("Only the vault administrator can transfer its allocation.");return v(y.vault.address,P({abi:I,functionName:"editAllocationAdmin",args:[n,d(e.admin)]}),`Transfer all future Clanker vault claims for ${n} to ${d(e.admin)}.`,t)}),w("airdrop_tree",{allocations:{type:"array",minItems:1,maxItems:200,items:{type:"object",properties:{recipient:f,amount:T},required:["recipient","amount"],additionalProperties:!1}}},["allocations"],async e=>{if(!Array.isArray(e.allocations)||!e.allocations.length||e.allocations.length>200)throw new r("Provide 1 to 200 airdrop allocations.");let t=new Set,n=e.allocations.map(o=>{if(!C(o))throw new r("Provide allocation objects.");E(o,["recipient","amount"]);let i=d(o.recipient),c=b(o.amount);if(!c||t.has(i))throw new r("Airdrop allocations require positive amounts and unique recipients.");return t.add(i),{recipient:i,amount:c.toString(),hash:H(i,c)}}).sort((o,i)=>o.hash.localeCompare(i.hash)),a=[n.map(o=>o.hash)];for(;a.at(-1).length>1;){let o=a.at(-1),i=[];for(let c=0;c<o.length;c+=2)i.push(c+1<o.length?N(o[c],o[c+1]):o[c]);a.push(i)}let s=n.reduce((o,i)=>o+BigInt(i.amount),0n);if(s>=1n<<256n)throw new r("Airdrop total exceeds uint256.");return{merkleRoot:a.at(-1)[0],total:s.toString(),allocations:n.map((o,i)=>{let c=[],m=i;for(let x of a.slice(0,-1))x[m^1]&&c.push(x[m^1]),m=Math.floor(m/2);return{recipient:o.recipient,amount:o.amount,proof:c}}),summary:"Double-hashed ABI(address,uint256) leaves; sorted hash pairs. Save these public proofs. Allocations are token base units, 18 decimals; match their total to the launch extension supply."}}),w("airdrop_status",{token:f,allocatedAmount:T},["token"],async(e,t)=>{let n=d(e.token);return{...await l(n),...e.allocatedAmount===void 0?{}:{claimable:k(await h().readContract({address:y.airdrop.address,abi:$,functionName:"amountAvailableToClaim",args:[n,t,b(e.allocatedAmount)]}))}}}),w("airdrop_claim",{token:f,allocatedAmount:T,proof:{type:"array",maxItems:64,items:S}},["token","allocatedAmount","proof"],async(e,t)=>{let n=d(e.token),a=await l(n),s=b(e.allocatedAmount);if(!s||!Array.isArray(e.proof)||e.proof.length>64)throw new r("Provide a positive allocation and Merkle proof.");let o=e.proof.map(R),i=o.reduce(N,H(t,s));if(!A(i,a.merkleRoot))throw new r("The airdrop proof does not match the active root for this wallet and allocation.");return v(y.airdrop.address,P({abi:$,functionName:"claim",args:[n,t,s,o]}),`Claim vested allocation of ${s} base units of ${n} (18 decimals) to ${t}. Preview determines currently unlocked receipts.`,t)}),w("airdrop_manage",{token:f,operation:{enum:["admin","root","reclaim"]},admin:f,merkleRoot:S,recipient:f},["token","operation"],async(e,t)=>{let n=d(e.token),a=await l(n);if(!A(a.admin,t))throw new r("Only the airdrop administrator may manage it.");let s=e.operation==="admin"?"admin":e.operation==="root"?"merkleRoot":"recipient";for(let i of["admin","merkleRoot","recipient"])if(e[i]!==void 0&&i!==s)throw new r(`Input ${i} does not match this airdrop operation.`);let o;if(e.operation==="admin")o=P({abi:$,functionName:"updateAdmin",args:[n,d(e.admin)]});else if(e.operation==="root")o=P({abi:$,functionName:"updateMerkleRoot",args:[n,R(e.merkleRoot)]});else if(e.operation==="reclaim")o=P({abi:$,functionName:"adminClaim",args:[n,d(e.recipient)]});else throw new r("Choose admin, root or reclaim.");return v(y.airdrop.address,o,`Clanker airdrop ${String(e.operation)} for ${n}; ${String(e.admin??e.merkleRoot??e.recipient)}. Reclaim permanently closes recipient claims; contract timing and zero-claim guards apply.`,t)})]}};export{X as a,Y as b,Z as c};
@@ -1 +1 @@
1
- import{a as S}from"./6IM6A5VA.js";import{a as N}from"./RETS2ZEK.js";import{a,j as p}from"./G6HCV67X.js";import{a as t}from"./5YS5V2LK.js";import{encodeFunctionData as $,erc20Abi as U,getAddress as m,parseAbi as _}from"viem";var f=_(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256)"]);function M(e){if(typeof e!="string")throw new t("Amount must be a positive base-unit integer string.");let s=N(e);if(s<=0n||s>=1n<<256n)throw new t("Amount must be positive and fit uint256.");return s}function G(e){if(typeof e!="bigint"||e<0n||e>=1n<<256n)throw new t("Invalid vault amount read.");return e}function H(e,s,o){return["mint",s==="steakhouse"?"redeem":"withdraw_assets"].map(l=>{let n=l==="mint",w=l==="redeem",h=n||w?"shares":"amount",C={type:"string",pattern:"^[0-9]+$"};return{name:`${s}_${l}`,inputSchema:{type:"object",additionalProperties:!1,required:n?["shares","maxAssets"]:[h],properties:{[h]:C,...n?{maxAssets:C}:{}}},execute:async(y,r)=>{try{if(S(r),Object.keys(y).some(b=>![h,...n?["maxAssets"]:[]].includes(b)))throw new t("Unexpected vault amount argument.");let i=M(y[h]),E=n?M(y.maxAssets):void 0,u=e.clientFor(a);if(await u.getChainId()!==a)throw new t("Vault amount actions require chain 4663.");let[T,O,P]=await Promise.all([u.readContract({address:o,abi:f,functionName:"asset"}),u.readContract({address:o,abi:f,functionName:"decimals"}),u.readContract({address:m(p),abi:U,functionName:"decimals"})]);if(typeof T!="string"||m(T)!==m(p)||O!==18||P!==6)throw new t("Vault amount actions require canonical USDG and the evidenced 18-decimal shares.");let c=G(await u.readContract({address:o,abi:f,functionName:n?"previewMint":w?"previewRedeem":"previewWithdraw",args:[i]}));if(c===0n)throw new t("The vault returned a zero amount quote.");if(n&&c>E)throw new t("The mint quote exceeds maxAssets.");let D=n?void 0:G(await u.readContract({address:o,abi:U,functionName:"balanceOf",args:[r]}));if(!n&&(w?i:c)>D)throw new t("The wallet share balance cannot cover this exit.");let R=n?$({abi:f,functionName:"mint",args:[i,r]}):w?$({abi:f,functionName:"redeem",args:[i,r,r]}):$({abi:f,functionName:"withdraw",args:[i,r,r]}),I=`${l} ${i} ${h==="shares"?"18-decimal share":"6-decimal USDG"} base units from ${s}; beneficiary ${r}.`,k=[...n?[e.approval(m(p),o,c.toString(),a)]:[],e.unsignedTx({to:o,data:R,value:"0",chainId:a,description:I})],x=await e.preview(k,r),A={address:m(p),chainId:a,symbol:"USDG",decimals:6},v={address:m(o),chainId:a,symbol:`${s} shares`,decimals:18},d=b=>x.changes.filter(g=>g.token.chainId===a&&g.token.address.toLowerCase()===b.address.toLowerCase()).reduce((g,q)=>{if(q.token.decimals!==b.decimals||!/^-?\d+$/.test(q.amount))throw new t("Invalid vault preview metadata.");return g+BigInt(q.amount)},0n);if(n?d(A)!==-c||d(v)!==i:w?d(v)!==-i||d(A)<=0n:d(A)!==i||-d(v)<=0n||-d(v)>D)throw new t("The preview does not match the requested vault amount and share balance.");return{txs:k,preview:x,summary:`${I} Quoted counterpart ${c} base units. ${x.summary} Standard ERC-4626 encodes no receipt minimum. Mint approvals use the exact current quote; accrual can require a new quote. Plain exits depend on available liquidity; use a separately previewed full force exit if required.`}}catch(i){throw new t(e.plainError(i))}}}})}export{H as a};
1
+ import{a as S}from"./PBQSJSZO.js";import{a as N}from"./UP7FBDMJ.js";import{a,j as p}from"./FWD4L3CJ.js";import{a as t}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as U,getAddress as m,parseAbi as _}from"viem";var f=_(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256)"]);function M(e){if(typeof e!="string")throw new t("Amount must be a positive base-unit integer string.");let s=N(e);if(s<=0n||s>=1n<<256n)throw new t("Amount must be positive and fit uint256.");return s}function G(e){if(typeof e!="bigint"||e<0n||e>=1n<<256n)throw new t("Invalid vault amount read.");return e}function H(e,s,o){return["mint",s==="steakhouse"?"redeem":"withdraw_assets"].map(l=>{let n=l==="mint",w=l==="redeem",h=n||w?"shares":"amount",C={type:"string",pattern:"^[0-9]+$"};return{name:`${s}_${l}`,inputSchema:{type:"object",additionalProperties:!1,required:n?["shares","maxAssets"]:[h],properties:{[h]:C,...n?{maxAssets:C}:{}}},execute:async(y,r)=>{try{if(S(r),Object.keys(y).some(b=>![h,...n?["maxAssets"]:[]].includes(b)))throw new t("Unexpected vault amount argument.");let i=M(y[h]),E=n?M(y.maxAssets):void 0,u=e.clientFor(a);if(await u.getChainId()!==a)throw new t("Vault amount actions require chain 4663.");let[T,O,P]=await Promise.all([u.readContract({address:o,abi:f,functionName:"asset"}),u.readContract({address:o,abi:f,functionName:"decimals"}),u.readContract({address:m(p),abi:U,functionName:"decimals"})]);if(typeof T!="string"||m(T)!==m(p)||O!==18||P!==6)throw new t("Vault amount actions require canonical USDG and the evidenced 18-decimal shares.");let c=G(await u.readContract({address:o,abi:f,functionName:n?"previewMint":w?"previewRedeem":"previewWithdraw",args:[i]}));if(c===0n)throw new t("The vault returned a zero amount quote.");if(n&&c>E)throw new t("The mint quote exceeds maxAssets.");let D=n?void 0:G(await u.readContract({address:o,abi:U,functionName:"balanceOf",args:[r]}));if(!n&&(w?i:c)>D)throw new t("The wallet share balance cannot cover this exit.");let R=n?$({abi:f,functionName:"mint",args:[i,r]}):w?$({abi:f,functionName:"redeem",args:[i,r,r]}):$({abi:f,functionName:"withdraw",args:[i,r,r]}),I=`${l} ${i} ${h==="shares"?"18-decimal share":"6-decimal USDG"} base units from ${s}; beneficiary ${r}.`,k=[...n?[e.approval(m(p),o,c.toString(),a)]:[],e.unsignedTx({to:o,data:R,value:"0",chainId:a,description:I})],x=await e.preview(k,r),A={address:m(p),chainId:a,symbol:"USDG",decimals:6},v={address:m(o),chainId:a,symbol:`${s} shares`,decimals:18},d=b=>x.changes.filter(g=>g.token.chainId===a&&g.token.address.toLowerCase()===b.address.toLowerCase()).reduce((g,q)=>{if(q.token.decimals!==b.decimals||!/^-?\d+$/.test(q.amount))throw new t("Invalid vault preview metadata.");return g+BigInt(q.amount)},0n);if(n?d(A)!==-c||d(v)!==i:w?d(v)!==-i||d(A)<=0n:d(A)!==i||-d(v)<=0n||-d(v)>D)throw new t("The preview does not match the requested vault amount and share balance.");return{txs:k,preview:x,summary:`${I} Quoted counterpart ${c} base units. ${x.summary} Standard ERC-4626 encodes no receipt minimum. Mint approvals use the exact current quote; accrual can require a new quote. Plain exits depend on available liquidity; use a separately previewed full force exit if required.`}}catch(i){throw new t(e.plainError(i))}}}})}export{H as a};
@@ -1 +1 @@
1
- import{a as k,b as P,d as R,e as x,f as U,g as $}from"./3NDVXEBR.js";import{a as w}from"./UWOFA6GV.js";import{c as y,g as D}from"./73N3TOJL.js";import{a as f}from"./G6HCV67X.js";import{a as p}from"./5YS5V2LK.js";import{encodeFunctionData as O,erc20Abi as L,getAddress as E,parseAbi as I,zeroAddress as h}from"viem";var _=E("0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f"),g=E("0x89e5db8b5aa49aa85ac63f691524311aeb649eba"),F=I(["function getPair(address,address) view returns (address)"]),S=I(["function token0() view returns (address)","function token1() view returns (address)","function getReserves() view returns (uint112,uint112,uint32)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)"]),C=I(["function factory() view returns (address)","function addLiquidity(address tokenA,address tokenB,uint256 amountADesired,uint256 amountBDesired,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256,uint256)","function removeLiquidity(address tokenA,address tokenB,uint256 liquidity,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256)","function getAmountsOut(uint256 amountIn,address[] path) view returns (uint256[] amounts)","function getAmountsIn(uint256 amountOut,address[] path) view returns (uint256[] amounts)"]);async function z(s,c,t,n){if(c===h||t===h||c===t)throw new p("Provide two different ERC-20 tokens; use WETH for native ETH.");let o=s.clientFor(f),i=await o.getBlockNumber(),a=await o.readContract({address:_,abi:F,functionName:"getPair",args:[c,t],blockNumber:i}),[e,v]=await Promise.all([x(s,c,i),x(s,t,i)]);if(a===h)return{pair:a,tokenA:e,tokenB:v,reserveA:0n,reserveB:0n,supply:0n,balance:0n,blockNumber:i};let[M,l,A,B]=await Promise.all([o.readContract({address:a,abi:S,functionName:"token0",blockNumber:i}),o.readContract({address:a,abi:S,functionName:"getReserves",blockNumber:i}),o.readContract({address:a,abi:S,functionName:"totalSupply",blockNumber:i}),o.readContract({address:a,abi:L,functionName:"balanceOf",args:[n],blockNumber:i})]),[b,r]=D(M,c)?l:[l[1],l[0]];return{pair:a,tokenA:e,tokenB:v,reserveA:b,reserveB:r,supply:A,balance:B,blockNumber:i}}var H={tokenA:y,tokenB:y,amountADesired:w(),amountBDesired:w(),liquidity:{type:"string",pattern:"^(?:[0-9]+|all)$"},slippageBps:{type:"integer",minimum:0,maximum:9999},amountAMin:w(),amountBMin:w()};function J(s){let c=async(t,n,o)=>{$(n,t==="pool"?["tokenA","tokenB"]:["tokenA","tokenB","slippageBps","amountAMin","amountBMin",...t==="add"?["amountADesired","amountBDesired"]:["liquidity"]]);let i=P(n.tokenA),a=P(n.tokenB),e=await z(s,i,a,o);if(t==="pool")return{pair:e.pair,tokenA:e.tokenA,tokenB:e.tokenB,reserveA:e.reserveA.toString(),reserveB:e.reserveB.toString(),totalSupply:e.supply.toString(),balance:e.balance.toString(),blockNumber:e.blockNumber.toString(),initialized:e.pair!==h};let v=s.clientFor(f),M=R(n.slippageBps);if(!D(await v.readContract({address:g,abi:C,functionName:"factory"}),_))throw new p("Uniswap v2 router factory differs from its pinned deployment.");let l=(await v.getBlock()).timestamp+300n,A=[],B=(r,u,m)=>{let d=r===void 0?u*BigInt(1e4-M)/10000n:k(r,m,256,!0);if(d>u||u>0n&&d===0n)throw new p(`${m} must be positive and no more than the reserve-ratio estimate.`);return d},b;if(t==="add"){let r=k(n.amountADesired,"amountADesired"),u=k(n.amountBDesired,"amountBDesired");if(e.reserveA===0n!=(e.reserveB===0n))throw new p("Uniswap v2 pair reserves are inconsistent.");let m=r,d=u;if(e.reserveA>0n&&e.reserveB>0n){let T=r*e.reserveB/e.reserveA;T<=u?d=T:m=u*e.reserveA/e.reserveB}if(m===0n||d===0n)throw new p("Liquidity amounts round to zero at the pool reserve ratio.");let q=B(n.amountAMin,m,"amountAMin"),N=B(n.amountBMin,d,"amountBMin");A.push(s.approval(i,g,r.toString(),f),s.approval(a,g,u.toString(),f)),b=O({abi:C,functionName:"addLiquidity",args:[i,a,r,u,q,N,o,l]})}else{if(e.pair===h||e.supply===0n)throw new p("No Uniswap v2 liquidity exists for this pair.");let r=n.liquidity==="all"?e.balance:k(n.liquidity,"liquidity");if(r===0n||r>e.balance)throw new p("Removal exceeds the wallet LP token balance or is zero.");let[u,m]=await Promise.all([i,a].map(N=>v.readContract({address:N,abi:L,functionName:"balanceOf",args:[e.pair]}))),d=B(n.amountAMin,r*u/e.supply,"amountAMin"),q=B(n.amountBMin,r*m/e.supply,"amountBMin");A.push(s.approval(e.pair,g,r.toString(),f)),b=O({abi:C,functionName:"removeLiquidity",args:[i,a,r,d,q,o,l]})}return A.push(s.unsignedTx({to:g,data:b,value:"0",chainId:f,description:`${t} Uniswap v2 liquidity for ${i}/${a}; recipient ${o}; deadline ${l}.`})),U(s,A,o,`${t==="add"?"Add":"Remove"} v2 liquidity. Review exact approvals, token minimums and wallet recipient. The first deposit sets the price; v2 locks MINIMUM_LIQUIDITY permanently.`)};return{tools:["pool","add","remove"].map(t=>({name:`uniswap_v2_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["tokenA","tokenB",...t==="add"?["amountADesired","amountBDesired"]:t==="remove"?["liquidity"]:[]],properties:t==="pool"?{tokenA:y,tokenB:y}:H},execute:(n,o)=>c(t,n,o)}))}}export{_ as a,g as b,F as c,S as d,C as e,z as f,J as g};
1
+ import{a as k,b as P,d as R,e as x,f as U,g as $}from"./SGEZIYJW.js";import{a as w}from"./5ZLOCQA4.js";import{c as y,g as D}from"./5KUWLUPM.js";import{a as f}from"./FWD4L3CJ.js";import{a as p}from"./XSD5NL7J.js";import{encodeFunctionData as O,erc20Abi as L,getAddress as E,parseAbi as I,zeroAddress as h}from"viem";var _=E("0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f"),g=E("0x89e5db8b5aa49aa85ac63f691524311aeb649eba"),F=I(["function getPair(address,address) view returns (address)"]),S=I(["function token0() view returns (address)","function token1() view returns (address)","function getReserves() view returns (uint112,uint112,uint32)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)"]),C=I(["function factory() view returns (address)","function addLiquidity(address tokenA,address tokenB,uint256 amountADesired,uint256 amountBDesired,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256,uint256)","function removeLiquidity(address tokenA,address tokenB,uint256 liquidity,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256)","function getAmountsOut(uint256 amountIn,address[] path) view returns (uint256[] amounts)","function getAmountsIn(uint256 amountOut,address[] path) view returns (uint256[] amounts)"]);async function z(s,c,t,n){if(c===h||t===h||c===t)throw new p("Provide two different ERC-20 tokens; use WETH for native ETH.");let o=s.clientFor(f),i=await o.getBlockNumber(),a=await o.readContract({address:_,abi:F,functionName:"getPair",args:[c,t],blockNumber:i}),[e,v]=await Promise.all([x(s,c,i),x(s,t,i)]);if(a===h)return{pair:a,tokenA:e,tokenB:v,reserveA:0n,reserveB:0n,supply:0n,balance:0n,blockNumber:i};let[M,l,A,B]=await Promise.all([o.readContract({address:a,abi:S,functionName:"token0",blockNumber:i}),o.readContract({address:a,abi:S,functionName:"getReserves",blockNumber:i}),o.readContract({address:a,abi:S,functionName:"totalSupply",blockNumber:i}),o.readContract({address:a,abi:L,functionName:"balanceOf",args:[n],blockNumber:i})]),[b,r]=D(M,c)?l:[l[1],l[0]];return{pair:a,tokenA:e,tokenB:v,reserveA:b,reserveB:r,supply:A,balance:B,blockNumber:i}}var H={tokenA:y,tokenB:y,amountADesired:w(),amountBDesired:w(),liquidity:{type:"string",pattern:"^(?:[0-9]+|all)$"},slippageBps:{type:"integer",minimum:0,maximum:9999},amountAMin:w(),amountBMin:w()};function J(s){let c=async(t,n,o)=>{$(n,t==="pool"?["tokenA","tokenB"]:["tokenA","tokenB","slippageBps","amountAMin","amountBMin",...t==="add"?["amountADesired","amountBDesired"]:["liquidity"]]);let i=P(n.tokenA),a=P(n.tokenB),e=await z(s,i,a,o);if(t==="pool")return{pair:e.pair,tokenA:e.tokenA,tokenB:e.tokenB,reserveA:e.reserveA.toString(),reserveB:e.reserveB.toString(),totalSupply:e.supply.toString(),balance:e.balance.toString(),blockNumber:e.blockNumber.toString(),initialized:e.pair!==h};let v=s.clientFor(f),M=R(n.slippageBps);if(!D(await v.readContract({address:g,abi:C,functionName:"factory"}),_))throw new p("Uniswap v2 router factory differs from its pinned deployment.");let l=(await v.getBlock()).timestamp+300n,A=[],B=(r,u,m)=>{let d=r===void 0?u*BigInt(1e4-M)/10000n:k(r,m,256,!0);if(d>u||u>0n&&d===0n)throw new p(`${m} must be positive and no more than the reserve-ratio estimate.`);return d},b;if(t==="add"){let r=k(n.amountADesired,"amountADesired"),u=k(n.amountBDesired,"amountBDesired");if(e.reserveA===0n!=(e.reserveB===0n))throw new p("Uniswap v2 pair reserves are inconsistent.");let m=r,d=u;if(e.reserveA>0n&&e.reserveB>0n){let T=r*e.reserveB/e.reserveA;T<=u?d=T:m=u*e.reserveA/e.reserveB}if(m===0n||d===0n)throw new p("Liquidity amounts round to zero at the pool reserve ratio.");let q=B(n.amountAMin,m,"amountAMin"),N=B(n.amountBMin,d,"amountBMin");A.push(s.approval(i,g,r.toString(),f),s.approval(a,g,u.toString(),f)),b=O({abi:C,functionName:"addLiquidity",args:[i,a,r,u,q,N,o,l]})}else{if(e.pair===h||e.supply===0n)throw new p("No Uniswap v2 liquidity exists for this pair.");let r=n.liquidity==="all"?e.balance:k(n.liquidity,"liquidity");if(r===0n||r>e.balance)throw new p("Removal exceeds the wallet LP token balance or is zero.");let[u,m]=await Promise.all([i,a].map(N=>v.readContract({address:N,abi:L,functionName:"balanceOf",args:[e.pair]}))),d=B(n.amountAMin,r*u/e.supply,"amountAMin"),q=B(n.amountBMin,r*m/e.supply,"amountBMin");A.push(s.approval(e.pair,g,r.toString(),f)),b=O({abi:C,functionName:"removeLiquidity",args:[i,a,r,d,q,o,l]})}return A.push(s.unsignedTx({to:g,data:b,value:"0",chainId:f,description:`${t} Uniswap v2 liquidity for ${i}/${a}; recipient ${o}; deadline ${l}.`})),U(s,A,o,`${t==="add"?"Add":"Remove"} v2 liquidity. Review exact approvals, token minimums and wallet recipient. The first deposit sets the price; v2 locks MINIMUM_LIQUIDITY permanently.`)};return{tools:["pool","add","remove"].map(t=>({name:`uniswap_v2_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["tokenA","tokenB",...t==="add"?["amountADesired","amountBDesired"]:t==="remove"?["liquidity"]:[]],properties:t==="pool"?{tokenA:y,tokenB:y}:H},execute:(n,o)=>c(t,n,o)}))}}export{_ as a,g as b,F as c,S as d,C as e,z as f,J as g};
@@ -1 +1 @@
1
- import{a as b,b as w,e as R,f as N,g as S}from"./3NDVXEBR.js";import{a as h}from"./UWOFA6GV.js";import{c as g,g as E}from"./73N3TOJL.js";import{a as d}from"./G6HCV67X.js";import{a as r}from"./5YS5V2LK.js";import{encodeFunctionData as v,erc20Abi as I,getAddress as _,parseAbi as O,zeroAddress as C}from"viem";var k=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),a=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=O(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),B={assets:{type:"array",minItems:1,maxItems:20,items:g},nonce:h(),maxResourceAmount:h()};function F(n){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:B},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(w);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=n.clientFor(d),e=await s.getBlockNumber(),[x,P,u,f]=await Promise.all([s.readContract({address:a,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(P),k)||x===C)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await R(n,w(x),e),T=await Promise.all(c.map(async l=>({token:await R(n,l,e),amount:(l===C?await s.getBalance({address:k,blockNumber:e}):await s.readContract({address:l,abi:I,functionName:"balanceOf",args:[k],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:T,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let J=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>J)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[n.approval(p.address,a,String(u),d),n.unsignedTx({to:a,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(n,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{k as a,a as b,o as c,F as d};
1
+ import{a as b,b as w,e as R,f as N,g as S}from"./SGEZIYJW.js";import{a as h}from"./5ZLOCQA4.js";import{c as g,g as E}from"./5KUWLUPM.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as v,erc20Abi as I,getAddress as _,parseAbi as O,zeroAddress as C}from"viem";var k=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),a=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=O(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),B={assets:{type:"array",minItems:1,maxItems:20,items:g},nonce:h(),maxResourceAmount:h()};function F(n){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:B},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(w);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=n.clientFor(d),e=await s.getBlockNumber(),[x,P,u,f]=await Promise.all([s.readContract({address:a,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(P),k)||x===C)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await R(n,w(x),e),T=await Promise.all(c.map(async l=>({token:await R(n,l,e),amount:(l===C?await s.getBalance({address:k,blockNumber:e}):await s.readContract({address:l,abi:I,functionName:"balanceOf",args:[k],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:T,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let J=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>J)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[n.approval(p.address,a,String(u),d),n.unsignedTx({to:a,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(n,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{k as a,a as b,o as c,F as d};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oakagentkit/core",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "engines": {
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "tsx": "4.23.15"
37
37
  },
38
- "description": "Oak shared public API and protocol modules.",
38
+ "description": "Shared API and project modules for Oak on Robinhood Chain.",
39
39
  "keywords": [
40
40
  "oak",
41
41
  "mcp",
@@ -1 +0,0 @@
1
- import{b as j}from"./JPOYTTTW.js";import{c as z}from"./MYBDO5SA.js";import{d as O}from"./VXLJRRKV.js";import{g as $}from"./73N3TOJL.js";import{a as D,b as M}from"./RETS2ZEK.js";import{a as F,i as q}from"./G6HCV67X.js";import{a as i}from"./5YS5V2LK.js";import{encodeAbiParameters as le,encodeFunctionData as Y,erc20Abi as K,getAddress as G,isAddress as se,keccak256 as W,parseAbi as ce,parseAbiParameters as me,zeroAddress as J}from"viem";var x=F,S=G(q[x].hoodlock.airdrop.address),Z="https://hoodlock.tech",P=25e4,ue=256,ye=604800n,ge=30n,V=250000000000000000n,X=0xffffffffn,fe=(1n<<64n)-1n,ee=(1n<<128n)-1n,oe="0x0000000000000000000000000000000000000000000000000000000000000000",pe="0x1111111111111111111111111111111111111111",be=me("uint256, address, uint256"),H=ce(["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 xe(o,e,t){let n=e.trim();if(n.startsWith("-")){let r=n.slice(1);return`-${o.formatAmount(r,t)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,t)}function ne(o,e){if(!e.changes.length)return e.summary;let t=e.changes.map(n=>`${xe(o,n.amount,n.token.decimals)} ${n.token.symbol}`).join(", ");return`${e.summary} (${t})`}async function Ae(o,e){try{let[t,n]=await Promise.all([o.readContract({address:e,abi:K,functionName:"symbol"}),o.readContract({address:e,abi:K,functionName:"decimals"})]),d=typeof t=="string"&&t.trim()?t.trim():"TOKEN",r=Number(n);return{symbol:d,decimals:Number.isInteger(r)&&r>=0&&r<=255?r:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,t){if(typeof e=="string"&&e.includes(".")){if(t?.decimals===void 0)throw new i(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=t.rounding!==void 0?M(e,t.decimals,t.rounding):o?o.parseAmount(e,t.decimals):M(e,t.decimals),r=D(d);if(r<=0n)throw new i("Airdrop entry amount must be positive.");return r}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=D(e.trim());else throw new i("Amount must be a non-negative integer string in base units.")}catch(d){throw d instanceof i?d:new i(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new i("Airdrop entry amount must be strictly positive (> 0).");return n}function I(o,e){try{let t=typeof o=="bigint"?o:BigInt(String(o).trim());if(t<0n)throw new i(`${e} must be non-negative.`);return t}catch(t){throw t instanceof i?t:new i(`Invalid ${e}: ${String(o)}`,{cause:t})}}function A(o,e){if(typeof o!="string"||!se(o,{strict:!1}))throw new i(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return G(o)}function N(o,e,t){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>X)throw new i(`Airdrop leaf index must be in 0..${X.toString()}.`);let d=A(e,"account"),r=w(void 0,t),s=le(be,[n,d,r]);return W(W(s))}function te(o,e){let t=o;for(let n of e)t=O(t,n);return t}function De(o){try{let e=N(o.index,o.account,o.amount),t=te(e,o.proof);return $(t,o.root)}catch{return!1}}function L(o,e){if(!Array.isArray(o)||o.length===0)throw new i("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new i(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let t=[],n=0n;for(let a=0;a<o.length;a+=1){let l=o[a];if(!l)throw new i(`Missing airdrop entry at position ${a}.`);let c=l.index??a;if(!Number.isInteger(c)||c!==a)throw new i(`Airdrop entry index at position ${a} must be contiguous ${a} (got ${String(c)}).`);let u=A(l.account,`entries[${a}].account`),g=w(e?.context,l.amount,e);n+=g,t.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ee)throw new i("Airdrop total amount must be > 0 and fit in uint128.");let d=t.map(a=>N(a.index,a.account,a.amount)),r=[d];for(;r[r.length-1].length>1;){let a=r[r.length-1],l=[];for(let c=0;c<a.length;c+=2){let u=a[c],g=a[c+1];g===void 0?l.push(u):l.push(O(u,g))}r.push(l)}let s=r[r.length-1][0];if(s.toLowerCase()===oe)throw new i("Computed Merkle root cannot be zero.");let f=r.length>1?r[1]:r[0],m=t.map((a,l)=>{let c=[],u=l;for(let g=0;g<r.length-1;g+=1){let y=r[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:a.index,account:a.account,amount:a.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:t.length,values:t.map(a=>[a.index,a.account,a.amount]),entries:t};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:t.length,entries:t,proofs:m,list:p}}function he(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new i("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,r])=>({index:n,account:d,amount:r})),t=L(e);if(o.root&&!$(t.root,o.root))throw new i(`Rebuilt tree root ${t.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&t.maxClaims!==o.maxClaims)throw new i(`Rebuilt maxClaims (${t.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&t.totalAmount!==o.totalAmount)throw new i(`Rebuilt totalAmount (${t.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return t}async function re(o,e){return z(o.http,e,{method:"GET"},t=>t!==null&&typeof t=="object")}async function we(o,e,t){let n=A(e.token,"token");if(n===J)throw new i("Airdrop token cannot be the zero address.");let d=L(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),r=e.maxClaims??d.maxClaims;if(!Number.isInteger(r)||r<1||r>P||r!==d.maxClaims)throw new i(`maxClaims (${String(r)}) 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 i(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ee)throw new i("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ue)throw new i(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let a=e.endTime!==void 0?I(e.endTime,"endTime"):0n;if(a>fe)throw new i("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new i(`Token ${n} has no contract code on chain ${x}.`);let u;if(a!==0n){let R=(await l.getBlock()).timestamp,U=e.inclusionMargin!==void 0?I(e.inclusionMargin,"inclusionMargin"):ge;if(U<=0n)throw new i("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let _=R+U,v=e.inclusionTime!==void 0?I(e.inclusionTime,"inclusionTime"):_;if(v<_)throw new i(`inclusionTime (${v.toString()}) must be after the already-mined block (${R.toString()}) with room for signing and inclusion (>= ${_.toString()}).`);u=v;let B=v+ye;if(a<B)throw new i(`endTime (${a.toString()}) is too short (window too short): must be 0 or at least inclusion time (${v.toString()}) + 604800 (7 days >= ${B.toString()}, after already-mined block.timestamp ${R.toString()}).`)}let g=await l.readContract({address:S,abi:H,functionName:"quote",args:[r]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>V)throw new i(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${V.toString()}).`);let b=o.formatAmount(y.toString(),j.decimals),h=o.approval(n,S,f.toString(),x),k=o.unsignedTx({chainId:x,to:S,data:Y({abi:H,functionName:"create",args:[n,d.root,f,r,a,m]}),value:y.toString(),description:`Create HoodLock airdrop (${r} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),C=[h,k],T=A(e.account??t??pe,"wallet"),E=await o.preview(C,T),ae=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",de=`${ne(o,E)}${ae}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:r,endTime:a,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:C,preview:E,summary:de}}async function Q(o,e,t,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==t)throw new i(`savedProof account (${m}) does not match claim account (${t}).`);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 i(`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?he(n.list):L(n.entries,{context:o})).proofs.find(a=>!(!$(a.account,t)||n.index!==void 0&&a.index!==Number(n.index)));if(!p)throw new i(`Account ${t} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${Z}/api/airdrop/${e.toString()}/proof?address=${t}`,r=await re(o,d),s=r?.data??r;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new i(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${t}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new i(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function ie(o,e){let t=o.clientFor(x),n=await t.readContract({address:S,abi:H,functionName:"getAirdrop",args:[e.id]}),[d,r,s,f,m,p,a,,l]=n,c=BigInt(r),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===J||a.toLowerCase()===oe)throw new i(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new i(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await t.getBlock()).timestamp>=c)throw new i(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new i(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([t.readContract({address:S,abi:H,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),Ae(t,b)]);if(h)throw new i(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new i(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let C=N(e.index,e.account,e.amount),T=te(C,e.proof);if(!$(T,a))throw new i(`Computed Merkle root ${T} does not match on-chain airdrop root ${a} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:a,leaf:C}}async function ke(o,e){let{tokenAddress:t,tokenMeta:n,merkleRoot:d,leaf:r}=await ie(o,e),s=e.caller??e.account,f=!$(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:S,data:Y({abi:H,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}`}),a=[p],l=await o.preview(a,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 ${t}); 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 ${t}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${ne(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:t,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:r,merkleRoot:d,proof:[...e.proof],tx:p,txs:a,preview:c,summary:u}}async function $e(o,e,t){let n=A(e.account??t??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):t!==void 0?A(t,"wallet"):void 0;if(e.id!==void 0){let l=I(e.id,"id"),c=await Q(o,l,n,e);return ke(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let r=`${Z}/api/airdrop/eligible?address=${n}`,s=await re(o,r),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=I(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 Q(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await ie(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 Se=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,t)=>we(o,e,t)},{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,t)=>$e(o,e,t)}]}),Me=Se;export{K as a,x as b,S as c,Z as d,P as e,ue as f,ye as g,ge as h,V as i,H as j,xe as k,N as l,te as m,De as n,L as o,he as p,Se as q,Me as r};
@@ -1 +0,0 @@
1
- function p(r,s){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(s,"id")}var h=new Map([]),_="find_tool",l="run_tool",a=["oak_setup","oak_identity_unlink","oak_subscribe","oak_renew","oak_redeem","send","hoodlock_feature_buy","hoodlock_feature_claim","hoodlock_referral_register","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_unfollow","heyresearch_position_context"],c={oak:["account","balances","find_token","price","quote","swap","positions","send","oak_setup","oak_subscribe","oak_renew","oak_identity_unlink","oak_redeem"],kyberswap:[],velora:[],steakhouse:["steakhouse_deposit","steakhouse_withdraw"],spark:["spark_deposit","spark_withdraw"],netnet:["netnet_deposit","netnet_withdraw"],longbow:["longbow_list","longbow_deposit","longbow_withdraw"],grove:["grove_deposit","grove_withdraw"],beefy:["beefy_list","beefy_deposit","beefy_withdraw"],pons:["pons_browse","pons_buy","pons_sell","pons_launch"],orbio:["orbio_credit_status","orbio_buy_credit"],hoodlock:["hoodlock_list_locks","hoodlock_lock","hoodlock_withdraw"],merkl:["merkl_rewards","merkl_claim"],relay:["relay_bridge_in","relay_bridge_out","relay_status"],lighter:["lighter_funding"],wormhole:[],erc8004:["erc8004_identity"],hoodag:["hoodag_resolve","hoodag_register"],heyresearch:["heyresearch_research_project","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_position_context"],priors:["priors_status","priors_lend","priors_withdraw","priors_borrow","priors_repay"],morpho:["morpho_status","morpho_supply","morpho_withdraw","morpho_supply_collateral","morpho_withdraw_collateral","morpho_borrow","morpho_repay"],uniswap:["uniswap_list_positions","uniswap_add","uniswap_remove","uniswap_collect"],hookr:["hookr_orders","hookr_create","hookr_cancel"],meridian:["meridian_browse","meridian_positions","meridian_sell","meridian_redeem"],tickerspring:["tickerspring_account","tickerspring_create","tickerspring_cancel","tickerspring_claim"],clanker:["clanker_browse","clanker_launch"],poolstrade:["poolstrade_status","poolstrade_buy","poolstrade_sell","poolstrade_launch"]};function w(r,s){let i=new Set(r),t=new Set;for(let[o,n]of Object.entries(c))for(let e of n){if(t.has(e))throw new Error(`Visible tool ${e} is listed twice.`);if(o!=="oak"&&!e.startsWith(`${o}_`))throw new Error(`Visible tool ${e} is filed under ${o}.`);if(a.includes(e)||i.has(e))t.add(e);else if(s==="mainnet")throw new Error(`Visible tool ${e} is not registered.`)}for(let o of[_,l,...a])if(i.has(o))throw new Error(`Tool name ${o} is reserved for the add-on.`);return t}export{p as a,h as b,_ as c,l as d,a as e,c as f,w as g};
@@ -1 +0,0 @@
1
- import{c as k}from"./MYBDO5SA.js";import{e as h}from"./73N3TOJL.js";import{a as c}from"./G6HCV67X.js";import{a}from"./5YS5V2LK.js";import{getAddress as A,isAddress as b}from"viem";function f(o){if(typeof o!="string"||!o.trim()||o.length>200)throw new a("Provide nonempty filter text of at most 200 characters.");return o}function x(o,m){if(typeof o!="number"||!Number.isSafeInteger(o)||o<0||o>m)throw new a(`Choose a pagination integer from 0 to ${m}.`);return o}var _={morpho:{assess:"morpho_status",enter:"morpho_supply",exit:"morpho_withdraw"},steakhouse:{assess:"steakhouse_list",enter:"steakhouse_deposit",exit:"steakhouse_withdraw"},spark:{assess:"spark_list",enter:"spark_deposit",exit:"spark_withdraw"},netnet:{assess:"netnet_list",enter:"netnet_deposit",exit:"netnet_withdraw"},longbow:{assess:"longbow_list",enter:"longbow_deposit",exit:"longbow_withdraw"},grove:{assess:"grove_list",enter:"grove_deposit",exit:"grove_withdraw"},beefy:{assess:"beefy_list",enter:"beefy_deposit",exit:"beefy_withdraw"},uniswap:{assess:"uniswap_list_positions",enter:"uniswap_add",exit:"uniswap_remove"}},R=o=>{let m=(e,t,i)=>({name:`merkl_${e}`,inputSchema:{type:"object",properties:t,additionalProperties:!1},execute:async(n,r)=>{try{let s=Object.keys(n).find(p=>!Object.hasOwn(t,p));if(s)throw new a(`Unsupported Merkl input: ${s}.`);return await i(n,r)}catch(s){throw new a(o.plainError(s))}}}),w={page:{type:"integer",minimum:0,maximum:1e4},items:{type:"integer",minimum:1,maximum:100}},g=async(e,t)=>{let i=new URL(`https://api.merkl.xyz/v4/${e}`);for(let[n,r]of Object.entries(t))i.searchParams.set(n,r);return k(o.http,i.toString(),{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},n=>Array.isArray(n)||h(n))},u=e=>{let t=x(e.items??20,100);if(!t)throw new a("Choose at least one item per page.");return{page:String(x(e.page??0,1e4)),items:String(t)}};return{tools:[m("opportunities",{...w,protocol:{type:"string"},name:{type:"string"},explorerAddress:{type:"string"}},async e=>{let t={chainId:String(c),campaigns:"true",...u(e)};if(e.protocol!==void 0&&(t.mainProtocolId=f(e.protocol)),e.name!==void 0&&(t.name=f(e.name)),e.explorerAddress!==void 0){if(typeof e.explorerAddress!="string"||!b(e.explorerAddress,{strict:!1}))throw new a("Provide a pool or market explorer address.");t.explorerAddress=A(e.explorerAddress)}let i=await g("opportunities",t);if(!Array.isArray(i)||!i.every(r=>h(r)&&typeof r.id=="string"&&Number.isSafeInteger(r.chainId)))throw new a("Merkl returned unexpected opportunities.");return{opportunities:i.filter(r=>r.chainId===c).map(r=>{let s=r.mainProtocolId??r.mainProtocol,p=typeof s=="string"?s.toLowerCase():"",d=p==="morpho"?r.action==="LEND":p==="uniswap"?r.action==="POOL":r.action==="LEND"||r.action==="STAKE";return{...r,oak:{...Object.hasOwn(_,p)&&d?{candidateTools:_[p]}:{},destinationVerificationRequired:!0,eligibility:"Read campaign conditions; no wallet eligibility has been verified."}}}),...u(e),hasMore:i.length===Number(t.items),summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Public, untrusted campaign data includes conditions and destinations. Candidate Oak tools require a matching verified market/vault and a supported entry AND exit. APR is indicative; no rewards are promised."}}),m("campaigns",{...w,creator:{type:"string"},tokenSymbol:{type:"string"},opportunityId:{type:"string"}},async e=>{let t={chainId:String(c),withOpportunity:"true",...u(e)};if(e.creator!==void 0){if(typeof e.creator!="string"||!b(e.creator,{strict:!1}))throw new a("Provide a creator address.");t.creatorAddress=A(e.creator)}e.tokenSymbol!==void 0&&(t.tokenSymbol=f(e.tokenSymbol));let i=e.opportunityId===void 0?"campaigns":`opportunities/${encodeURIComponent(f(e.opportunityId))}/campaigns`,n=await g(i,t);if(!Array.isArray(n)||!n.every(r=>h(r)&&(typeof r.id=="string"||typeof r.id=="number")))throw new a("Merkl returned unexpected campaigns.");return{campaigns:n,chainId:c,...u(e),hasMore:n.length===Number(t.items),summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Campaign rules, budgets, timing, exclusions and configuration are public API data; verify the reward distribution chain and destination before entering."}}),m("earning_status",{view:{enum:["active","breakdowns","stats","claims"]},...w},async(e,t)=>{if(!b(t,{strict:!1}))throw new a("Provide a valid connected wallet address.");let i=e.view??"active";if(!["active","breakdowns","stats","claims"].includes(String(i)))throw new a("Choose active, breakdowns, stats or claims.");let n=i==="claims"?"claims":i==="breakdowns"?`users/${t}/rewards/chains/${c}/breakdowns`:`users/${t}/rewards/${i==="active"?"active-opportunities":"stats"}`,{page:r,items:s}=u(e),p=i==="breakdowns"?{}:{chainId:String(c)};i==="claims"&&(p.recipient=t);let d=await g(n,p),l=Number(r)*Number(s),y=Array.isArray(d)?d:i==="breakdowns"&&h(d)&&Array.isArray(d.opportunities)?d.opportunities:void 0,v=y?Array.isArray(d)?y.slice(l,l+Number(s)):{...d,opportunities:y.slice(l,l+Number(s))}:d;return{view:i,chainId:c,wallet:t,data:v,...y?{page:r,items:s,hasMore:l+Number(s)<y.length}:{},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. API earning attribution and history can lag onchain state; pending earnings are not claimable. Private or restricted attribution may be omitted by Merkl. Recheck merkl_rewards before a claim."}})]}};export{R as a};
@@ -1 +0,0 @@
1
- import{a as ie,b as le,c as ce,d as Z}from"./AFHHRDPJ.js";import{a as E,b as Y}from"./NSOEDRBU.js";import{c as ae}from"./MYBDO5SA.js";import{a as X}from"./UWOFA6GV.js";import{b as B,c as C,d as se,e as h,g as v,i as oe}from"./73N3TOJL.js";import{a as w,i as ne,l as F,n as re}from"./G6HCV67X.js";import{a as T}from"./5YS5V2LK.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as M,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",de="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,me=2000n,ke=/^[0-9]{1,78}$/,m=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function P(e,t="address"){return oe(e,`Provide a ${t}.`,se)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=3?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(o=>O(o,t+1))}:h(e)?Object.fromEntries(Object.entries(e).filter(([o])=>/^[A-Za-z0-9_]{1,40}$/.test(o)).slice(0,40).map(([o,s])=>[o,O(s,t+1)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function J(e,t,o){let s=e.clientFor(w),[c,a]=await Promise.all([s.readContract({address:t,abi:M,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:M,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:w,symbol:I(c),decimals:a}}async function we(e,t){let o=P(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:P(t.holder,"holder address"),c=j(t.limit,20,50),{offset:a,fingerprint:l}=ce(t.cursor),r=e.clientFor(w),p=await r.getBlockNumber({cacheTime:0}),g=await E(e,o,p),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,k=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(g.curve),reason:"Pons bonding curve"},{wallet:f(re),reason:"Uniswap v4 pool manager (shared pool custody)"}],N=new Map(k.map(d=>[d.wallet,d.reason])),R=i.rows.filter(d=>!N.has(f(d.wallet))),[G,q]=await Promise.all([J(e,o,n),r.readContract({address:o,abi:M,functionName:"totalSupply",blockNumber:n})]),W=d=>1+R.filter(b=>BigInt(b.balance)>BigInt(d)).length,_=async(d,b)=>{let D=await r.readContract({address:o,abi:M,functionName:"balanceOf",args:[d],blockNumber:n});return{wallet:d,indexedBalance:b,indexedRank:b===null||N.has(d)?null:W(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(D.toString(),q.toString()),balance:{token:G,amount:D.toString()},matchesIndex:b===null?null:D.toString()===b}},A=await Promise.all(R.slice(a,a+c).map(async d=>({...await _(f(d.wallet),d.balance),share:m(d.share),label:$(d.label,40)}))),V=s?i.rows.find(d=>v(d.wallet,s)):void 0,H=s?{...await _(s,V?.balance??null),excluded:N.get(s)??null,rankStatus:N.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+c<R.length?`holders_${a+c}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:k.map(d=>({...d,indexedBalance:i.rows.find(b=>v(b.wallet,d.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>v(b.wallet,d.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&B.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=P(t.holder??o,"holder address"),c=j(t.limit,20,40),a=e.clientFor(w),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),p=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],g=await Promise.all(p.slice(0,c).map(async n=>{let u=f(n.token);try{await E(e,u,r);let[k,N]=await Promise.all([J(e,u,r),a.readContract({address:u,abi:M,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:k,balance:N,item:n}}catch{return{ok:!1}}})),i=g.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:m(n.item.valueUsd),investedUsd:m(n.item.investedUsd),totalPnlUsd:m(n.item.totalPnlUsd),totalPnlPct:m(n.item.totalPnlPct),buys:m(n.item.buys),sells:m(n.item.sells),lastTradeAt:m(n.item.lastTradeAt)}})),excludedUnverified:g.length-i.length,truncated:p.length>c,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&B.test(t.launch.address)&&typeof t.launch.factory=="string"&&B.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),c=s.items.filter(r=>v(r.launch.factory,F)).slice(0,o),a=await e.clientFor(w).getBlockNumber({cacheTime:0});return{items:await Promise.all(c.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:m(r.volumeUsd),trades:m(r.trades),traders:m(r.traders),change:m(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>v(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let c=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:m(s.generatedAt),latestDay:m(s.latestDay),latest:O(c.at(-1)),seriesDays:c.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=P(t.wallet??o,"wallet address"),c=`${de}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");c+=`/before/${t.cursor}`}let a=await U(e,c,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${de}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:m(r.block),time:m(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&B.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:m(r.decimals),usd:m(r.usd),counterparty:typeof r.counterparty=="string"&&B.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=P(t.address??o,"wallet address"),c=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${c}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&B.test(n.address)&&typeof n.factory=="string"&&B.test(n.factory))),p=await e.clientFor(w).getBlockNumber({cacheTime:0}),g=r.items.filter(i=>v(i.factory,F)).slice(0,c);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:m(l.joinedAt)},launches:await Promise.all(g.map(i=>Y(e,f(i.address),p))),statusBlock:p.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=P(t.token,"Pons launch token address"),c=P(t.holder??o,"holder address"),a=e.clientFor(w),l=await a.getBlockNumber({cacheTime:0}),r=await E(e,s,l),p=ne[w].pons.buybackVault.address,g=[],i=async(y,K)=>{try{return await K()}catch{return g.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),k=y=>i(y,()=>a.readContract({address:p,abi:ue,functionName:y,args:[s],blockNumber:l})),[N,R,G,q,W,_,A,V,H,d,b,D,pe,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[c],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),k("totalLocked"),k("totalReleased"),k("vestedAmount"),k("releasable"),k("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:p,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),J(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!v(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(N),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:c,current:S(W),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:_?{deployer:f(_[0]),logo:I(_[1].slice(0,300)),description:I(_[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(_[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:p,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(d),releasable:S(b),vestingStart:S(D),vestingDurationSeconds:S(pe),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:g}}async function Be(e,t){let o=P(t.token,"Pons launch token address"),s=j(t.limit,25,100),c=e.clientFor(w),a=await c.getBlockNumber({cacheTime:0}),l=await E(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),p=t.fromBlock===void 0?r>=me?r-me+1n:0n:BigInt(String(t.fromBlock));if(p<0n||p>r||r>a||r-p+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await c.getLogs({address:l.curve,events:be,fromBlock:p,toBlock:r,strict:!0})).filter(n=>v(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await J(e,o,a),curve:l.curve,fromBlock:p.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,c){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!P(l)||v(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await c(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:C,holder:{...C,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:C,limit:{type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:C,cursor:{type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:C,holder:C},(o,s)=>_e(e,o,s)),t("pons_trades",{token:C,fromBlock:X(),toBlock:X(),limit:{type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:C,limit:{type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,Le as b};
@@ -1 +0,0 @@
1
- import{c as k,i as T,l as S,m as O,n as R}from"./73N3TOJL.js";import{a as f,i as P}from"./G6HCV67X.js";import{a as c}from"./5YS5V2LK.js";import{encodeFunctionData as $,erc20Abi as x,parseAbi as N,zeroAddress as U}from"viem";var g=P[f].merkl.distributor.address,j=["function accessControlManager() view returns (address)","function isGovernor(address) view returns (bool)","function isGovernorOrGuardian(address) view returns (bool)","function canUpdateMerkleRoot(address) view returns (uint256)","function mainOperators(address,address) view returns (uint256)","function disputeToken() view returns (address)","function disputeAmount() view returns (uint256)","function disputer() view returns (address)","function endOfDisputePeriod() view returns (uint48)","function getMerkleRoot() view returns (bytes32)","function getEpochDuration() view returns (uint32)","function disputePeriod() view returns (uint48)","function upgradeabilityDeactivated() view returns (uint256)","function disputeTree(string)","function updateTree((bytes32 merkleRoot,bytes32 ipfsHash))","function toggleTrusted(address)","function toggleMainOperatorStatus(address,address)","function revokeUpgradeability()","function setEpochDuration(uint32)","function resolveDispute(bool)","function revokeTree()","function recoverERC20(address,address,uint256)","function setDisputePeriod(uint48)","function setDisputeToken(address)","function setDisputeAmount(uint256)"],y=N(j),H={type:"string",pattern:"^\\d+$"},E={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},C="Provide a valid address.";function m(o,l=!1){let n=T(o,C);return l?n:S(n,C)}function F(o,l=256){return R(o,`Value exceeds uint${l}.`,{bits:l})}function b(o){return O(o,"Merkl returned invalid protocol state.")}function G(o){return typeof o=="number"&&Number.isSafeInteger(o)&&o>=0?String(o):b(o).toString()}var D={updateTree:["merkleRoot","ipfsHash"],toggleTrusted:["target","enabled"],toggleMainOperatorStatus:["target","token","enabled"],revokeUpgradeability:[],setEpochDuration:["amount"],resolveDispute:["valid"],revokeTree:[],recoverERC20:["token","recipient","amount"],setDisputePeriod:["amount"],setDisputeToken:["token"],setDisputeAmount:["amount"]},J=o=>{let l=()=>o.clientFor(f),n=(r,i=[],e=g)=>l().readContract({address:e,abi:y,functionName:r,args:i}),h=(r,i,e,p)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:i,required:e,additionalProperties:!1},execute:async(u,s)=>{try{let a=Object.keys(u).find(d=>!Object.hasOwn(i,d));if(a)throw new c(`Unsupported Merkl input: ${a}.`);return await p(u,m(s))}catch(a){throw new c(o.plainError(a))}}}),I=async(r,i,e,p)=>{let u=[o.unsignedTx({to:g,data:$({abi:y,functionName:r,args:i}),value:"0",chainId:f,description:e})],s=await o.preview(u,p);return{txs:u,preview:s,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${e} ${s.summary}`}};return{tools:[h("distributor_status",{},[],async(r,i)=>{let[e,p,u,s,a,d,t,w,z]=await Promise.all([n("getMerkleRoot"),n("disputeToken"),n("disputeAmount"),n("disputer"),n("endOfDisputePeriod"),n("getEpochDuration"),n("disputePeriod"),n("upgradeabilityDeactivated"),n("accessControlManager")]);if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e)||typeof d!="number"||!Number.isInteger(d)||d<0||d>4294967295)throw new c("Merkl returned invalid Distributor state.");let v=m(z),[M,A]=await Promise.all([n("isGovernor",[i],v),n("isGovernorOrGuardian",[i],v)]);if(typeof M!="boolean"||typeof A!="boolean")throw new c("Merkl returned invalid governance roles.");return{chainId:f,distributor:g,root:e,disputeToken:m(p,!0),disputeAmount:b(u).toString(),disputer:m(s,!0),endOfDisputePeriod:G(a),epochDuration:String(d),disputePeriod:G(t),upgradeabilityDeactivated:b(w).toString(),accessControlManager:v,governor:M,governorOrGuardian:A,summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Dispute amounts are token base units. Opening a dispute locks collateral until governor resolution; a rejected dispute forfeits it."}}),h("dispute",{reason:{type:"string",minLength:1,maxLength:2e3}},["reason"],async(r,i)=>{if(typeof r.reason!="string"||!r.reason.trim()||r.reason.length>2e3)throw new c("Provide a public dispute reason of 1 to 2000 characters.");let e=m(await n("disputeToken")),p=b(await n("disputeAmount")),[u,s]=await Promise.all([l().readContract({address:e,abi:x,functionName:"symbol"}),l().readContract({address:e,abi:x,functionName:"decimals"})]);if(typeof u!="string"||!u.trim()||typeof s!="number"||!Number.isInteger(s)||s<0||s>255)throw new c("Merkl dispute token metadata is invalid.");let a=`Dispute Merkl's tree: ${r.reason}. Lock ${p} ${u} base units (token ${e}, decimals ${s}) until governor resolution; rejection forfeits the deposit. There is no unilateral withdrawal.`,d=[...p?[o.approval(e,g,p.toString(),f)]:[],o.unsignedTx({to:g,data:$({abi:y,functionName:"disputeTree",args:[r.reason]}),value:"0",chainId:f,description:a})],t=await o.preview(d,i);return{txs:d,preview:t,deposit:{token:{address:e,symbol:u,decimals:s,chainId:f},amount:p.toString()},summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${a} ${t.summary}`}}),h("distributor_admin",{operation:{enum:Object.keys(D)},target:k,token:k,recipient:k,amount:H,enabled:{type:"boolean"},valid:{type:"boolean"},merkleRoot:E,ipfsHash:E},["operation"],async(r,i)=>{let e=String(r.operation);if(!Object.hasOwn(D,e))throw new c("Choose a supported Distributor operation.");let p=D[e];for(let t of Object.keys(r))if(t!=="operation"&&!p.includes(t))throw new c(`Input ${t} does not match this Distributor operation.`);let u=m(await n("accessControlManager")),s=await n("isGovernor",[i],u);if(typeof s!="boolean")throw new c("Merkl returned invalid governor status.");if(!s&&!(e==="updateTree"?await n("canUpdateMerkleRoot",[i])===1n:e==="toggleMainOperatorStatus"&&r.token!==U?await n("isGovernorOrGuardian",[i],u)===!0:!1))throw new c("The connected wallet lacks the required Merkl governance role.");let a=p.map(t=>{if(t==="enabled"||t==="valid"){if(typeof r[t]!="boolean")throw new c(`Provide ${t} as boolean.`);return r[t]}if(t==="amount"){let w=F(r[t],e==="setEpochDuration"?32:e==="setDisputePeriod"?48:256);return e==="setEpochDuration"?Number(w):w}if(t==="merkleRoot"||t==="ipfsHash"){if(typeof r[t]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r[t]))throw new c("Provide a bytes32 root and IPFS hash.");return r[t]}return m(r[t],t==="token"&&e==="toggleMainOperatorStatus")}),d=a;if(e==="updateTree"&&(d=[{merkleRoot:a[0],ipfsHash:a[1]}]),e==="toggleTrusted"||e==="toggleMainOperatorStatus"){let t=await n(e==="toggleTrusted"?"canUpdateMerkleRoot":"mainOperators",e==="toggleTrusted"?[a[0]]:a.slice(0,2));if(t!==0n&&t!==1n)throw new c("Merkl returned invalid authorization state.");if(t===1n===r.enabled)return{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Authorization already has the requested state."};d=a.slice(0,-1)}return I(e,d,`Merkl Distributor ${e} ${JSON.stringify(r)}. Governance affects every claimant. Upgradeability revocation is permanent; dispute resolution returns or forfeits collateral. Authorization operations toggle the observed state; re-preview if state changes.`,i)})]}};export{J as a};
@@ -1 +0,0 @@
1
- import{a as r,b as c}from"./JXOEJPJ4.js";var a=class extends Error{name="OakError"};function u(e){let n=[],t=new Set;for(;e&&typeof e=="object"&&!t.has(e)&&n.length<16;){t.add(e);let o=e;n.push(o),e=o.cause}return n}function i(e,...n){return u(e).some(t=>typeof t.code=="number"&&n.includes(t.code))}function f(e){return u(e).some(n=>typeof n.message=="string"&&/insufficient funds for gas \* price \+ value/i.test(n.message))}function l(e){let n=u(e),t=n.find(s=>s instanceof a);if(t)return c(t.message)||t.message.length>1024?r(t.message):t.message;if(n.some(s=>s.name==="TimeoutError"))return"The request timed out. Please try again.";if(n.some(s=>s.name==="AbortError"))return"The request was cancelled.";if(i(e,4001))return"The request was declined.";if(i(e,-32601,-32004))return"This endpoint does not support the requested operation.";let o=n.map(s=>typeof s.message=="string"?s.message:"").join(" ");return n.some(s=>s.status===429||s.code===429)||/too many requests|rate limit/i.test(o)?"The RPC endpoint is busy; retry in 1 seconds.":f(e)?"Insufficient funds for the simulation gas budget. Check wallet ETH and the endpoint or fork block gas limit; no transaction was sent.":/revert/i.test(o)||i(e,3)?"The contract call reverted.":/fetch failed|ECONNREFUSED|ENOTFOUND|network/i.test(o)?"The service could not be reached. Please try again.":"The request failed. Please try again."}export{a,i as b,f as c,l as d};
@@ -1 +0,0 @@
1
- import{a as P}from"./6IM6A5VA.js";import{a as c,j as x}from"./G6HCV67X.js";import{a as n}from"./5YS5V2LK.js";import{getAddress as d}from"viem";var M=["one_hour","six_hours","one_day","seven_days","thirty_days","ninety_days","one_year","inception"],g={apy:["v1","apy-averages"],allocations:["v0","allocations"],history:["v0","state/history"],pending_governance:["v0","pending-governance-actions"]};function y(t){if(!t||typeof t!="object"||Array.isArray(t))throw new n("Morpho analytics returned an invalid object.");return t}function A(t){if(typeof t!="string"||!/^\d+$/.test(t)||BigInt(t)>=1n<<256n)throw new n("Morpho analytics returned an invalid decimal base-unit amount.");return t}function Y(t,s){let o=y(t);if(![c,String(c)].includes(o.chain_id)||typeof o.vault_address!="string"||d(o.vault_address)!==d(s))throw new n("Morpho analytics returned another chain or vault.")}function b(t,s=0){if(s>12)throw new n("Morpho analytics response is too deeply nested.");if(Array.isArray(t))return t.map(o=>b(o,s+1));if(t&&typeof t=="object")return Object.fromEntries(Object.entries(t).map(([o,e])=>{if(e!==null&&/(?:_assets|_shares|_supply|_cap|_wad|_ray)$/.test(o)&&typeof e!="object")return[o,A(e)];if(e!==null&&/_address$/.test(o)){if(typeof e!="string")throw new n("Morpho analytics returned an invalid address.");return[o,d(e)]}return[o,b(e,s+1)]}));if(typeof t=="number"&&!Number.isFinite(t))throw new n("Morpho analytics returned a non-finite value.");return t}function T(t,s,o){return{name:s,inputSchema:{type:"object",additionalProperties:!1,required:["view"],properties:{view:{type:"string",enum:Object.keys(g)},lookback:{type:"string",enum:M,description:"APY/history window; defaults to six_hours for APY or seven_days for history."},cursor:{type:"string",maxLength:4096,description:"Opaque cursor from pending_governance only."},limit:{type:"integer",minimum:1,maximum:100}}},execute:async(e,I)=>{try{if(P(I),Object.keys(e).some(r=>!["view","lookback","cursor","limit"].includes(r))||typeof e.view!="string"||!Object.hasOwn(g,e.view))throw new n("Choose a documented Morpho analytics view.");let a=e.view,h=a==="history",f=a==="apy",k=a==="pending_governance";if(e.lookback!==void 0&&(!h&&!f||typeof e.lookback!="string"||!M.includes(e.lookback)))throw new n("lookback is available only for APY/history with a documented window.");if(!k&&(e.cursor!==void 0||e.limit!==void 0))throw new n("Pagination applies only to pending_governance.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||e.cursor.length>4096))throw new n("Provide the opaque pending-governance cursor string.");let l=e.limit??100;if(typeof l!="number"||!Number.isInteger(l)||l<1||l>100)throw new n("Pagination limit must be an integer from 1 to 100.");let[j,S]=g[a],p=new URL(`https://api.morpho.org/${j}/vaults-v2/${c}:${d(o)}/${S}`);(h||f)&&p.searchParams.set("lookback",String(e.lookback??(h?"seven_days":"six_hours"))),k&&(p.searchParams.set("limit",String(l)),e.cursor!==void 0&&p.searchParams.set("cursor",e.cursor));let _=await t.http(p.toString(),{headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!_.ok)throw new n(`Morpho analytics HTTP ${_.status}. Retry when the service is reachable; no zero APY or empty book was inferred.`);let i=y(await _.json());Y(f||a==="allocations"?i.data:i.params,o);let w,u=i.last_indexed_block,v=null;if(f){let r=y(i.data);if(typeof r.apy!="number"||!Number.isFinite(r.apy)||r.apy<-1||r.lookback!==(e.lookback??"six_hours"))throw new n("Morpho analytics returned an invalid APY or lookback.");w={annualYieldFraction:String(r.apy),lookback:r.lookback,basis:"Realized post-fee share-price APY, excluding rewards; historical observation, not a promised return."},u=r.last_indexed_block}else if(a==="allocations"){let r=y(i.data);if(!Array.isArray(r.allocations))throw new n("Morpho analytics omitted adapter allocations.");w=b(r.allocations),u=r.last_indexed_block}else{if(!Array.isArray(i.data))throw new n("Morpho analytics omitted its record array.");if(h)for(let r of i.data){let m=y(r);if(typeof m.timestamp!="number"||!Number.isSafeInteger(m.timestamp)||m.timestamp<0)throw new n("Morpho history returned an invalid timestamp.");for(let O of["total_assets","total_supply","withdrawable_assets","allocated_assets","idle_assets","share_price_ray"])A(m[O])}if(k){if(i.cursor!==null&&typeof i.cursor!="string")throw new n("Morpho analytics returned an invalid pagination cursor.");v=i.cursor}w=b(i.data)}return u!==void 0&&A(u),{vault:d(o),chainId:c,sourceUrl:p.toString(),view:a,lastIndexedBlock:u??null,cursor:v,data:w,asset:{address:d(x),symbol:"USDG",decimals:6,chainId:c},shareToken:{address:d(o),symbol:"vault shares",decimals:18,chainId:c},scales:{sharePriceRay:"1000000000000000000000000000",capWad:"1000000000000000000"},caveat:"Indexer data may lag the chain. APY excludes rewards; empty records describe only this API window/page. Re-read onchain state and preview before any action. API book data is never executed as calldata automatically."}}catch(a){throw new n(t.plainError(a))}}}}export{T as a};
@@ -1 +0,0 @@
1
- import{a as f}from"./Z25UKUJF.js";import{b as g,c as v}from"./6IM6A5VA.js";import{h as S,j as x}from"./UWOFA6GV.js";import{b as w,c as M}from"./RETS2ZEK.js";import{a,d as m}from"./5YS5V2LK.js";function N(o){return{...o,unsignedTx:g,approval:v,parseAmount:w,formatAmount:M,plainError:m}}function h(o,s,t){let i=new Set(s);if(!Array.isArray(o))throw new a("A module must provide a tools array.");for(let e of o){if(!e||typeof e.name!="string"||!/^[a-z][a-z0-9_]*$/.test(e.name)||t&&(!e.name.startsWith(`${t}_`)||e.name.length<=t.length+1))throw new a("A tool must have a valid name with its module prefix.");if(i.has(e.name))throw new a(`Tool ${e.name} is already registered.`);if(!e.inputSchema||typeof e.inputSchema!="object"||Array.isArray(e.inputSchema)||e.inputSchema.type!=="object"||typeof e.execute!="function")throw new a(`Tool ${e.name} must provide an object input schema and an execute function.`);i.add(e.name)}}var A=new WeakSet;function j(o){if(A.has(o))return;let s=o.inputSchema,t=o.execute;o.inputSchema=S(s),o.execute=async(i,e)=>t(x(s,i),e),A.add(o)}function $(o,s,t){if(typeof o!="string"||!/^[a-z][a-z0-9]*$/.test(o))throw new a("Provide a valid module name.");let i=[],e=[];for(let n of s){if(!n||!Array.isArray(n.tools))throw new a(`Module ${o} has an invalid part.`);if(i.push(...n.tools),n.positions!==void 0){if(typeof n.positions!="function")throw new a(`Module ${o} has an invalid positions reader.`);e.push(n.positions.bind(n))}}if(h(i,new Set,o),t&&(typeof t.name!="string"||!t.name||typeof t.quote!="function"||typeof t.build!="function"))throw new a(`Module ${o} has an invalid swap provider.`);return{name:o,tools:i,...e.length?{positions:async n=>(await Promise.all(e.map(l=>l(n)))).flat()}:{},...t?{swapProvider:t}:{}}}function q(o,s,t=[]){h(t,new Set);let i=[...t],e=[],n=[],l=new Set,y=new Set(t.map(d=>d.name));for(let[d,T]of s.entries())try{let u=T(o),r=$(u.name,[u],u.swapProvider);if(l.has(r.name))throw new a(`Module ${r.name} is already registered.`);h(r.tools,y,r.name);for(let c of r.tools){j(c);let p=c.execute;c.execute=async(P,b)=>f(await p(P,b))}if(r.positions){let c=r.positions;r.positions=async p=>f(await c(p))}i.push(...r.tools),e.push(r),l.add(r.name),r.tools.forEach(c=>y.add(c.name))}catch(u){n.push({index:d,error:m(u)})}return{tools:i,modules:e,errors:n}}export{N as a,$ as b,q as c};