@oakagentkit/core 0.2.4 → 0.2.6

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 (510) hide show
  1. package/build/dist/api/amounts.d.ts +2 -0
  2. package/build/dist/api/amounts.js +1 -1
  3. package/build/dist/api/args.js +1 -1
  4. package/build/dist/api/gas.js +1 -1
  5. package/build/dist/api/grandfather.js +1 -1
  6. package/build/dist/api/guards.js +1 -1
  7. package/build/dist/api/history.js +1 -1
  8. package/build/dist/api/http.js +1 -1
  9. package/build/dist/api/merkle.js +1 -1
  10. package/build/dist/api/module.js +1 -1
  11. package/build/dist/api/modules/beefy/boosts.js +1 -1
  12. package/build/dist/api/modules/beefy/clm.js +1 -1
  13. package/build/dist/api/modules/beefy/guard.js +1 -1
  14. package/build/dist/api/modules/beefy/index.js +1 -1
  15. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  16. package/build/dist/api/modules/beefy/management.js +1 -1
  17. package/build/dist/api/modules/beefy/vaults.js +1 -1
  18. package/build/dist/api/modules/borro/abi.d.ts +149 -0
  19. package/build/dist/api/modules/borro/abi.js +1 -0
  20. package/build/dist/api/modules/borro/actions.d.ts +2 -0
  21. package/build/dist/api/modules/borro/actions.js +1 -0
  22. package/build/dist/api/modules/borro/checks.d.ts +151 -0
  23. package/build/dist/api/modules/borro/checks.js +1 -0
  24. package/build/dist/api/modules/borro/copy.d.ts +174 -0
  25. package/build/dist/api/modules/borro/copy.js +1 -0
  26. package/build/dist/api/modules/borro/index.d.ts +13 -0
  27. package/build/dist/api/modules/borro/index.js +1 -0
  28. package/build/dist/api/modules/borro/liquidity.d.ts +4 -0
  29. package/build/dist/api/modules/borro/liquidity.js +1 -0
  30. package/build/dist/api/modules/borro/pins.d.ts +264 -0
  31. package/build/dist/api/modules/borro/pins.js +1 -0
  32. package/build/dist/api/modules/borro/positions.d.ts +8 -0
  33. package/build/dist/api/modules/borro/positions.js +1 -0
  34. package/build/dist/api/modules/borro/rates.d.ts +20 -0
  35. package/build/dist/api/modules/borro/rates.js +1 -0
  36. package/build/dist/api/modules/borro/reader.d.ts +36 -0
  37. package/build/dist/api/modules/borro/reader.js +1 -0
  38. package/build/dist/api/modules/borro/types.d.ts +126 -0
  39. package/build/dist/api/modules/borro/types.js +0 -0
  40. package/build/dist/api/modules/chop/abi.d.ts +527 -0
  41. package/build/dist/api/modules/chop/abi.js +1 -0
  42. package/build/dist/api/modules/chop/actions.d.ts +24 -0
  43. package/build/dist/api/modules/chop/actions.js +1 -0
  44. package/build/dist/api/modules/chop/checks.d.ts +26 -0
  45. package/build/dist/api/modules/chop/checks.js +1 -0
  46. package/build/dist/api/modules/chop/copy.d.ts +5 -0
  47. package/build/dist/api/modules/chop/copy.js +1 -0
  48. package/build/dist/api/modules/chop/guard.d.ts +13 -0
  49. package/build/dist/api/modules/chop/guard.js +1 -0
  50. package/build/dist/api/modules/chop/index.d.ts +3 -0
  51. package/build/dist/api/modules/chop/index.js +1 -0
  52. package/build/dist/api/modules/chop/pins.d.ts +53 -0
  53. package/build/dist/api/modules/chop/pins.js +1 -0
  54. package/build/dist/api/modules/chop/positions.d.ts +3 -0
  55. package/build/dist/api/modules/chop/positions.js +1 -0
  56. package/build/dist/api/modules/chop/reader.d.ts +70 -0
  57. package/build/dist/api/modules/chop/reader.js +1 -0
  58. package/build/dist/api/modules/chop/types.d.ts +32 -0
  59. package/build/dist/api/modules/chop/types.js +0 -0
  60. package/build/dist/api/modules/clanker/extensions.js +1 -1
  61. package/build/dist/api/modules/clanker/index.js +1 -1
  62. package/build/dist/api/modules/clanker/manage.js +1 -1
  63. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  64. package/build/dist/api/modules/clanker/protocol.js +1 -1
  65. package/build/dist/api/modules/clanker/state.js +1 -1
  66. package/build/dist/api/modules/earn/copy.d.ts +2 -2
  67. package/build/dist/api/modules/earn/copy.js +1 -1
  68. package/build/dist/api/modules/earn/index.js +1 -1
  69. package/build/dist/api/modules/earn/lp.js +1 -1
  70. package/build/dist/api/modules/earn/options.js +1 -1
  71. package/build/dist/api/modules/erc8004/common.js +1 -1
  72. package/build/dist/api/modules/erc8004/domain.js +1 -1
  73. package/build/dist/api/modules/erc8004/index.js +1 -1
  74. package/build/dist/api/modules/erc8004/management.js +1 -1
  75. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  76. package/build/dist/api/modules/erc8004/services.js +1 -1
  77. package/build/dist/api/modules/erc8004/validation.js +1 -1
  78. package/build/dist/api/modules/gloam/abi.d.ts +89 -0
  79. package/build/dist/api/modules/gloam/abi.js +1 -0
  80. package/build/dist/api/modules/gloam/actions.d.ts +5 -0
  81. package/build/dist/api/modules/gloam/actions.js +1 -0
  82. package/build/dist/api/modules/gloam/checks.d.ts +17 -0
  83. package/build/dist/api/modules/gloam/checks.js +1 -0
  84. package/build/dist/api/modules/gloam/copy.d.ts +22 -0
  85. package/build/dist/api/modules/gloam/copy.js +2 -0
  86. package/build/dist/api/modules/gloam/index.d.ts +6 -0
  87. package/build/dist/api/modules/gloam/index.js +1 -0
  88. package/build/dist/api/modules/gloam/pins.d.ts +41 -0
  89. package/build/dist/api/modules/gloam/pins.js +1 -0
  90. package/build/dist/api/modules/gloam/types.d.ts +308 -0
  91. package/build/dist/api/modules/gloam/types.js +1 -0
  92. package/build/dist/api/modules/grove/index.js +1 -1
  93. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  94. package/build/dist/api/modules/heyresearch/index.js +1 -1
  95. package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
  96. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  97. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  98. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  99. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  100. package/build/dist/api/modules/hoodag/index.js +1 -1
  101. package/build/dist/api/modules/hoodag/management.js +1 -1
  102. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  103. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  104. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  105. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  106. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  107. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  108. package/build/dist/api/modules/hoodlock/index.js +1 -1
  109. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  110. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  111. package/build/dist/api/modules/hoodlock/public.js +1 -1
  112. package/build/dist/api/modules/hookr/actions.js +1 -1
  113. package/build/dist/api/modules/hookr/addons.js +1 -1
  114. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  115. package/build/dist/api/modules/hookr/contracts.js +1 -1
  116. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  117. package/build/dist/api/modules/hookr/discovery.js +1 -1
  118. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  119. package/build/dist/api/modules/hookr/index.js +1 -1
  120. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  121. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  122. package/build/dist/api/modules/hookr/launch.js +1 -1
  123. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  124. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  125. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  126. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  127. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  128. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  129. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  130. package/build/dist/api/modules/hookr/relay.js +1 -1
  131. package/build/dist/api/modules/hookr/revenue.js +1 -1
  132. package/build/dist/api/modules/kyberswap/index.js +1 -1
  133. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  134. package/build/dist/api/modules/layerbank/actions.js +1 -1
  135. package/build/dist/api/modules/layerbank/checks.js +1 -1
  136. package/build/dist/api/modules/layerbank/index.js +1 -1
  137. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  138. package/build/dist/api/modules/layerbank/reader.js +1 -1
  139. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  140. package/build/dist/api/modules/lighter/index.js +1 -1
  141. package/build/dist/api/modules/longbow/administration.js +1 -1
  142. package/build/dist/api/modules/longbow/analytics.js +1 -1
  143. package/build/dist/api/modules/longbow/fixed.js +1 -1
  144. package/build/dist/api/modules/longbow/index.js +1 -1
  145. package/build/dist/api/modules/longbow/nft.js +1 -1
  146. package/build/dist/api/modules/longbow/rebates.js +1 -1
  147. package/build/dist/api/modules/longbow/staking.js +1 -1
  148. package/build/dist/api/modules/meridian/index.js +1 -1
  149. package/build/dist/api/modules/meridian/markets.js +1 -1
  150. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  151. package/build/dist/api/modules/meridian/perps-common.js +1 -1
  152. package/build/dist/api/modules/meridian/perps-guards.js +1 -1
  153. package/build/dist/api/modules/meridian/perps-intents.js +1 -1
  154. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  155. package/build/dist/api/modules/meridian/perps.d.ts +1 -0
  156. package/build/dist/api/modules/meridian/perps.js +1 -1
  157. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  158. package/build/dist/api/modules/meridian/rfq.js +1 -1
  159. package/build/dist/api/modules/merkl/discovery.js +1 -1
  160. package/build/dist/api/modules/merkl/index.js +1 -1
  161. package/build/dist/api/modules/merkl/manage.js +1 -1
  162. package/build/dist/api/modules/merkl/protocol.js +1 -1
  163. package/build/dist/api/modules/morpho/allocator.js +1 -1
  164. package/build/dist/api/modules/morpho/bundles.js +1 -1
  165. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  166. package/build/dist/api/modules/morpho/index.js +1 -1
  167. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  168. package/build/dist/api/modules/morpho/midnight.js +1 -1
  169. package/build/dist/api/modules/morpho/protocol.js +1 -1
  170. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  171. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  172. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  173. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  174. package/build/dist/api/modules/netnet/card-read.js +1 -1
  175. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  176. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  177. package/build/dist/api/modules/netnet/financial.js +1 -1
  178. package/build/dist/api/modules/netnet/index.js +1 -1
  179. package/build/dist/api/modules/netnet/staking.js +1 -1
  180. package/build/dist/api/modules/orbio/gateway.js +1 -1
  181. package/build/dist/api/modules/orbio/index.js +1 -1
  182. package/build/dist/api/modules/orbio/positions.js +1 -1
  183. package/build/dist/api/modules/pendle/convert.js +1 -1
  184. package/build/dist/api/modules/pendle/costs.js +1 -1
  185. package/build/dist/api/modules/pendle/index.js +1 -1
  186. package/build/dist/api/modules/pendle/markets.js +1 -1
  187. package/build/dist/api/modules/pendle/positions.js +1 -1
  188. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  189. package/build/dist/api/modules/pendle/reader.js +1 -1
  190. package/build/dist/api/modules/pendle/redeem.js +1 -1
  191. package/build/dist/api/modules/pendle/trade.js +1 -1
  192. package/build/dist/api/modules/pendle/types.d.ts +16 -1
  193. package/build/dist/api/modules/pendle/validate.js +1 -1
  194. package/build/dist/api/modules/pendle/verify.js +1 -1
  195. package/build/dist/api/modules/pons/claim.js +1 -1
  196. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  197. package/build/dist/api/modules/pons/index.js +1 -1
  198. package/build/dist/api/modules/pons/launch-status.d.ts +1 -0
  199. package/build/dist/api/modules/pons/launch-status.js +1 -1
  200. package/build/dist/api/modules/pons/prices.js +1 -1
  201. package/build/dist/api/modules/pons/reads.js +1 -1
  202. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  203. package/build/dist/api/modules/pons/trade.js +1 -1
  204. package/build/dist/api/modules/poolstrade/index.js +1 -1
  205. package/build/dist/api/modules/priors/coverage.js +1 -1
  206. package/build/dist/api/modules/priors/discovery.js +1 -1
  207. package/build/dist/api/modules/priors/features.js +1 -1
  208. package/build/dist/api/modules/priors/holdings.js +1 -1
  209. package/build/dist/api/modules/priors/index.js +1 -1
  210. package/build/dist/api/modules/priors/integration.js +1 -1
  211. package/build/dist/api/modules/priors/market.js +1 -1
  212. package/build/dist/api/modules/priors/pt.js +1 -1
  213. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  214. package/build/dist/api/modules/priors/starter-line.js +1 -1
  215. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  216. package/build/dist/api/modules/relay/api.js +1 -1
  217. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  218. package/build/dist/api/modules/relay/discovery.js +1 -1
  219. package/build/dist/api/modules/relay/inbound.d.ts +2 -0
  220. package/build/dist/api/modules/relay/inbound.js +1 -1
  221. package/build/dist/api/modules/relay/index.js +1 -1
  222. package/build/dist/api/modules/relay/order.js +1 -1
  223. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  224. package/build/dist/api/modules/relay/readiness.js +1 -1
  225. package/build/dist/api/modules/relay/reads.js +1 -1
  226. package/build/dist/api/modules/relay/vaults.js +1 -1
  227. package/build/dist/api/modules/spark/actions.js +1 -1
  228. package/build/dist/api/modules/spark/details.js +1 -1
  229. package/build/dist/api/modules/spark/index.js +1 -1
  230. package/build/dist/api/modules/spark/management.js +1 -1
  231. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  232. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  233. package/build/dist/api/modules/steakhouse/index.js +1 -1
  234. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  235. package/build/dist/api/modules/steakhouse/management.js +1 -1
  236. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  237. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  238. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  239. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  240. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  241. package/build/dist/api/modules/tickerspring/index.js +1 -1
  242. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  243. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  244. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  245. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  246. package/build/dist/api/modules/tickerspring/research.js +1 -1
  247. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  248. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  249. package/build/dist/api/modules/uniswap/auction.js +1 -1
  250. package/build/dist/api/modules/uniswap/batch.js +1 -1
  251. package/build/dist/api/modules/uniswap/common.js +1 -1
  252. package/build/dist/api/modules/uniswap/fees.js +1 -1
  253. package/build/dist/api/modules/uniswap/index.js +1 -1
  254. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  255. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  256. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  257. package/build/dist/api/modules/uniswap/pools.js +1 -1
  258. package/build/dist/api/modules/uniswap/position.js +1 -1
  259. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  260. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  261. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  262. package/build/dist/api/modules/uniswap/trade.js +1 -1
  263. package/build/dist/api/modules/uniswap/v2.js +1 -1
  264. package/build/dist/api/modules/uniswap/v3.d.ts +11 -1
  265. package/build/dist/api/modules/uniswap/v3.js +1 -1
  266. package/build/dist/api/modules/uniswap/v4.js +1 -1
  267. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  268. package/build/dist/api/modules/velora/claims.js +1 -1
  269. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  270. package/build/dist/api/modules/velora/index.js +1 -1
  271. package/build/dist/api/modules/wormhole/index.d.ts +3 -0
  272. package/build/dist/api/modules/wormhole/index.js +1 -1
  273. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  274. package/build/dist/api/modules/wormhole/swap-token-verdict.d.ts +11 -0
  275. package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -0
  276. package/build/dist/api/modules/wormhole/third-party-text.d.ts +13 -0
  277. package/build/dist/api/modules/wormhole/third-party-text.js +1 -0
  278. package/build/dist/api/modules/wormhole/token-check.d.ts +2 -0
  279. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  280. package/build/dist/api/modules/wormhole/x402-client.d.ts +36 -0
  281. package/build/dist/api/modules/wormhole/x402-client.js +1 -0
  282. package/build/dist/api/positions.js +1 -1
  283. package/build/dist/api/pricenote.js +1 -1
  284. package/build/dist/api/prices.js +1 -1
  285. package/build/dist/api/pricing.js +1 -1
  286. package/build/dist/api/routes.js +1 -1
  287. package/build/dist/api/send.js +1 -1
  288. package/build/dist/api/signing-registry.js +1 -1
  289. package/build/dist/api/simulate.js +1 -1
  290. package/build/dist/api/swap.js +1 -1
  291. package/build/dist/api/tokens.d.ts +1 -0
  292. package/build/dist/api/tokens.js +1 -1
  293. package/build/dist/api/tool-policy.js +1 -1
  294. package/build/dist/api/tx.js +1 -1
  295. package/build/dist/api/types.d.ts +6 -1
  296. package/build/dist/api/vendor-limits.js +1 -1
  297. package/build/dist/chunks/{ALRRW7SF.js → 2MT3G7YZ.js} +1 -1
  298. package/build/dist/chunks/{WPAF55SP.js → 2THSW4QN.js} +1 -1
  299. package/build/dist/chunks/{MKAPRRKF.js → 2TK3ETUO.js} +1 -1
  300. package/build/dist/chunks/{VVA72C6O.js → 2VXLVXIB.js} +1 -1
  301. package/build/dist/chunks/{ZE7EU2CS.js → 35KR3VSS.js} +1 -1
  302. package/build/dist/chunks/{ZYH4B2GR.js → 3GQ7A3VB.js} +1 -1
  303. package/build/dist/chunks/3VWVW7PX.js +1 -0
  304. package/build/dist/chunks/{WPFAEBE7.js → 3XNZUIRU.js} +1 -1
  305. package/build/dist/chunks/{PBQSJSZO.js → 43LI5NKJ.js} +1 -1
  306. package/build/dist/chunks/{QVYCJ6WV.js → 46KWRAYK.js} +1 -1
  307. package/build/dist/chunks/4DP2VPXR.js +3 -0
  308. package/build/dist/chunks/{47YN4OUI.js → 4EN6MQEI.js} +1 -1
  309. package/build/dist/chunks/{UHRCM7AG.js → 4HG6FRVH.js} +1 -1
  310. package/build/dist/chunks/{E6UU7DL2.js → 4I3OU56B.js} +1 -1
  311. package/build/dist/chunks/{WIVYKLQM.js → 52ELWNXJ.js} +1 -1
  312. package/build/dist/chunks/{5WUKOQIJ.js → 5AXWBSPG.js} +1 -1
  313. package/build/dist/chunks/{D6ZJPNK7.js → 5N3O42X6.js} +1 -1
  314. package/build/dist/chunks/{UA4O226F.js → 5SMVQCAP.js} +1 -1
  315. package/build/dist/chunks/{6L5KTE6Y.js → 5SZPNZG4.js} +1 -1
  316. package/build/dist/chunks/{6PY3IRDS.js → 64GOINYS.js} +1 -1
  317. package/build/dist/chunks/{5ZLOCQA4.js → 66F5ZH34.js} +1 -1
  318. package/build/dist/chunks/{XDZRO5JQ.js → 6I4NTKB2.js} +1 -1
  319. package/build/dist/chunks/{LVLVP5KQ.js → 6JAXZNZ3.js} +1 -1
  320. package/build/dist/chunks/{BXHNYCH2.js → 6O3Q5B6M.js} +1 -1
  321. package/build/dist/chunks/{MFCPL6LF.js → 6OGDTEGH.js} +1 -1
  322. package/build/dist/chunks/{43CSMYDO.js → 6WD4HHID.js} +1 -1
  323. package/build/dist/chunks/{XJEOEMDS.js → 6WZX7C4T.js} +1 -1
  324. package/build/dist/chunks/6YB3VOUL.js +1 -0
  325. package/build/dist/chunks/77CLMPM7.js +1 -0
  326. package/build/dist/chunks/{EKNSLLJK.js → 7GJ6SLEV.js} +1 -1
  327. package/build/dist/chunks/{S2TAJHHK.js → 7KWZ5QJU.js} +1 -1
  328. package/build/dist/chunks/{CTMA4BTM.js → 7QIO77VE.js} +1 -1
  329. package/build/dist/chunks/7QZOTRSA.js +2 -0
  330. package/build/dist/chunks/{IKEJCBYU.js → 7WSHW7KW.js} +1 -1
  331. package/build/dist/chunks/{PQC5635W.js → A7I4IWUB.js} +1 -1
  332. package/build/dist/chunks/ACW63WIL.js +20 -0
  333. package/build/dist/chunks/AEL62KCG.js +1 -0
  334. package/build/dist/chunks/{UPMGGK34.js → AFBEZXNV.js} +1 -1
  335. package/build/dist/chunks/{AUOXDNUO.js → AKYF5264.js} +1 -1
  336. package/build/dist/chunks/{HVM2EEXB.js → ALLLYOUG.js} +1 -1
  337. package/build/dist/chunks/APQYLJGS.js +1 -0
  338. package/build/dist/chunks/AW7AXQCZ.js +1 -0
  339. package/build/dist/chunks/{WOEKXQAH.js → AXRL3REN.js} +1 -1
  340. package/build/dist/chunks/{ECWGKLBW.js → BBTPRZ6T.js} +1 -1
  341. package/build/dist/chunks/{ALPYEM7B.js → BND2UFVW.js} +1 -1
  342. package/build/dist/chunks/{GHPREYQK.js → BOVMED7R.js} +1 -1
  343. package/build/dist/chunks/{57JFKIMK.js → BTPXJAUX.js} +1 -1
  344. package/build/dist/chunks/{ZGKVXFM5.js → C7AXJHBT.js} +1 -1
  345. package/build/dist/chunks/{5U7TCKX2.js → CBG5HARQ.js} +1 -1
  346. package/build/dist/chunks/{NA7R6J5N.js → CBLMQ5UU.js} +1 -1
  347. package/build/dist/chunks/CDPSMI3Z.js +1 -0
  348. package/build/dist/chunks/{5N4A5XAW.js → CHXBOXOD.js} +1 -1
  349. package/build/dist/chunks/{2ZUP7ZEV.js → CQEJSCFQ.js} +1 -1
  350. package/build/dist/chunks/{6AAARNZ3.js → DBNTZEAJ.js} +1 -1
  351. package/build/dist/chunks/{IQIWASRD.js → DHUDSOGR.js} +1 -1
  352. package/build/dist/chunks/{L7OQUHM5.js → DJN3JAWB.js} +1 -1
  353. package/build/dist/chunks/{YPM2UITD.js → DL6AEWEM.js} +1 -1
  354. package/build/dist/chunks/{CERNEJ2F.js → DW4V5PUY.js} +1 -1
  355. package/build/dist/chunks/E3RACZUY.js +1 -0
  356. package/build/dist/chunks/{MOPETB64.js → EGYVRQUR.js} +1 -1
  357. package/build/dist/chunks/{IQGY5FW7.js → ER47KGRM.js} +1 -1
  358. package/build/dist/chunks/{ZSQOMSOC.js → FEYAY6OZ.js} +1 -1
  359. package/build/dist/chunks/FIO6VC2J.js +1 -0
  360. package/build/dist/chunks/FJ4S4GHY.js +1 -0
  361. package/build/dist/chunks/{RPNAFUM5.js → FUDAXV5X.js} +1 -1
  362. package/build/dist/chunks/{I6KUORFT.js → GG6Y4OCJ.js} +1 -1
  363. package/build/dist/chunks/{3AXVB23N.js → GGHBFLRC.js} +1 -1
  364. package/build/dist/chunks/{4ALMYJJV.js → GGSAKCND.js} +1 -1
  365. package/build/dist/chunks/GNC6RXLT.js +1 -0
  366. package/build/dist/chunks/{3ESNHZT5.js → GRQYTVNT.js} +1 -1
  367. package/build/dist/chunks/{WVONJOWN.js → GSBIERZD.js} +1 -1
  368. package/build/dist/chunks/H43RNCX2.js +1 -0
  369. package/build/dist/chunks/{NYNJITCM.js → H6T5FXEX.js} +1 -1
  370. package/build/dist/chunks/HHXBUYHO.js +1 -0
  371. package/build/dist/chunks/{64WKYWZV.js → HKEMQBFA.js} +1 -1
  372. package/build/dist/chunks/{4YFVAYKR.js → HM72DH4V.js} +1 -1
  373. package/build/dist/chunks/{XFKVU46U.js → HQUVB7Z5.js} +1 -1
  374. package/build/dist/chunks/HS4DZPYT.js +1 -0
  375. package/build/dist/chunks/{OTIXQZ3X.js → HU7IMNBI.js} +1 -1
  376. package/build/dist/chunks/{ENX72ARB.js → HWX36XJI.js} +1 -1
  377. package/build/dist/chunks/{QRC4ZPDA.js → I26DMNJG.js} +1 -1
  378. package/build/dist/chunks/I55MURSJ.js +1 -0
  379. package/build/dist/chunks/I6PQW2JI.js +1 -0
  380. package/build/dist/chunks/{S3FPF537.js → IMO3GDA5.js} +1 -1
  381. package/build/dist/chunks/{BQICZFLR.js → IOYRL6AY.js} +1 -1
  382. package/build/dist/chunks/IPN6Z4JM.js +1 -0
  383. package/build/dist/chunks/{MKBNLGDD.js → IPRVIKYC.js} +1 -1
  384. package/build/dist/chunks/{EOQYLFXA.js → IVX4R5OL.js} +1 -1
  385. package/build/dist/chunks/IX3GZMTM.js +1 -0
  386. package/build/dist/chunks/JFYBH3DX.js +1 -0
  387. package/build/dist/chunks/{Y7RPSDD2.js → JKD2B6OX.js} +1 -1
  388. package/build/dist/chunks/JQOQMFWD.js +3 -0
  389. package/build/dist/chunks/{PSVOVZH7.js → JUZ5JU6D.js} +5 -5
  390. package/build/dist/chunks/{I4TGMF2C.js → JZS3E66E.js} +1 -1
  391. package/build/dist/chunks/{SSIENQVU.js → K3RDPI5J.js} +1 -1
  392. package/build/dist/chunks/{PADWZX7J.js → K4DHHQBI.js} +1 -1
  393. package/build/dist/chunks/{NB3LYS3G.js → KIFZ5ZSK.js} +1 -1
  394. package/build/dist/chunks/KVFZKPJT.js +1 -0
  395. package/build/dist/chunks/{EYFBVQ46.js → L5BLHY34.js} +1 -1
  396. package/build/dist/chunks/{GVPX5XCL.js → LKXO2BQS.js} +1 -1
  397. package/build/dist/chunks/{JPNYUEQP.js → LKZX4CAA.js} +1 -1
  398. package/build/dist/chunks/{LROVANUR.js → LYMNHO5T.js} +1 -1
  399. package/build/dist/chunks/{QSN6Y2K6.js → M2UXYCKH.js} +1 -1
  400. package/build/dist/chunks/{BNG2IWZL.js → M37654RL.js} +1 -1
  401. package/build/dist/chunks/{YAJYDD6C.js → M6LC6DRE.js} +1 -1
  402. package/build/dist/chunks/{AG67Z3SC.js → MOE3EVAL.js} +1 -1
  403. package/build/dist/chunks/{DVVFT42J.js → MRMR4QHA.js} +1 -1
  404. package/build/dist/chunks/{WWHCEMNB.js → N4Q6GN65.js} +1 -1
  405. package/build/dist/chunks/{S5WICHIS.js → NAZPDRIF.js} +1 -1
  406. package/build/dist/chunks/{HSFOWJ3Z.js → NKZKKCK2.js} +1 -1
  407. package/build/dist/chunks/{BAAXGB4K.js → NOFUKKP5.js} +1 -1
  408. package/build/dist/chunks/{5KUWLUPM.js → NWNYJ26T.js} +1 -1
  409. package/build/dist/chunks/{7UOOIDR3.js → O6ROOKY2.js} +1 -1
  410. package/build/dist/chunks/{KBXU7U6Q.js → O7HCEPQY.js} +1 -1
  411. package/build/dist/chunks/{LDT3QTSY.js → OJ4WJUPP.js} +1 -1
  412. package/build/dist/chunks/{WD37MEMZ.js → OLSP46ZD.js} +1 -1
  413. package/build/dist/chunks/{TPL4U3AQ.js → OOZSE2R7.js} +1 -1
  414. package/build/dist/chunks/OTXSKFUD.js +1 -0
  415. package/build/dist/chunks/{4TQQH7N6.js → P5AJSLZ7.js} +1 -1
  416. package/build/dist/chunks/{BK23XJXE.js → P5PYFK7L.js} +1 -1
  417. package/build/dist/chunks/{A6YQ5H24.js → PACN53TR.js} +1 -1
  418. package/build/dist/chunks/{K72EYD6R.js → PAHXBLCS.js} +1 -1
  419. package/build/dist/chunks/PAY5PD4H.js +1 -0
  420. package/build/dist/chunks/{SGEZIYJW.js → PIIHOXWF.js} +1 -1
  421. package/build/dist/chunks/{SQL6HD5E.js → PK66GCDT.js} +1 -1
  422. package/build/dist/chunks/PNA6UIE5.js +1 -0
  423. package/build/dist/chunks/{6FTYNYGF.js → PSBQWDYI.js} +1 -1
  424. package/build/dist/chunks/{W76QC2AW.js → PV5FDT6O.js} +1 -1
  425. package/build/dist/chunks/{42DQTKEO.js → PXT5YTWU.js} +1 -1
  426. package/build/dist/chunks/{4ISR2U72.js → PZGGE5D3.js} +1 -1
  427. package/build/dist/chunks/{IMRXZ7JB.js → Q42YI3EP.js} +1 -1
  428. package/build/dist/chunks/{F3BSEE52.js → QA2RRIES.js} +1 -1
  429. package/build/dist/chunks/{ZBFKKUNP.js → QA3UHEO3.js} +1 -1
  430. package/build/dist/chunks/{PWH464CJ.js → QBIY6FQN.js} +1 -1
  431. package/build/dist/chunks/QFNT73OF.js +1 -0
  432. package/build/dist/chunks/QHBS3PVU.js +1 -0
  433. package/build/dist/chunks/QQECG3WP.js +1 -0
  434. package/build/dist/chunks/{RVO3QK2B.js → QU5XKRGK.js} +1 -1
  435. package/build/dist/chunks/QW2OPEYJ.js +1 -0
  436. package/build/dist/chunks/{G7XSFUDL.js → QYVREJYC.js} +1 -1
  437. package/build/dist/chunks/{KA7BPBCV.js → ROFPXEQ5.js} +1 -1
  438. package/build/dist/chunks/{5MQ5KSSV.js → RTAHNWHN.js} +1 -1
  439. package/build/dist/chunks/{MDDHG34Y.js → RTGS7RIO.js} +1 -1
  440. package/build/dist/chunks/{3WXK2FUA.js → RUC7KH7A.js} +1 -1
  441. package/build/dist/chunks/{MBTARLZQ.js → RUX3RY7Y.js} +1 -1
  442. package/build/dist/chunks/{3VAJW6TQ.js → RVDUSNWW.js} +1 -1
  443. package/build/dist/chunks/{ET23SES4.js → S5CBVFHY.js} +1 -1
  444. package/build/dist/chunks/{WMNRP3YH.js → SIYUNOLI.js} +1 -1
  445. package/build/dist/chunks/{TNKVRVTH.js → SJJR4ZBZ.js} +1 -1
  446. package/build/dist/chunks/{UFVPMWPJ.js → SMYWWIE6.js} +1 -1
  447. package/build/dist/chunks/{Z4SRGAVL.js → SPJCSEKP.js} +1 -1
  448. package/build/dist/chunks/{YEXUSRIZ.js → T7TFUH5K.js} +1 -1
  449. package/build/dist/chunks/{SKMPKAZI.js → TAEZTP4L.js} +1 -1
  450. package/build/dist/chunks/{E3UBHTJO.js → TEJ7W534.js} +1 -1
  451. package/build/dist/chunks/{AWXJV2YH.js → TFDPEAVZ.js} +1 -1
  452. package/build/dist/chunks/{UOGHQLQX.js → TMVO2DAK.js} +1 -1
  453. package/build/dist/chunks/{QJFXLYZG.js → TPBAFS7K.js} +1 -1
  454. package/build/dist/chunks/{MXW2TP5P.js → TVWMTMEF.js} +1 -1
  455. package/build/dist/chunks/{GRIGSPD4.js → TX2EOIRS.js} +1 -1
  456. package/build/dist/chunks/{Y7PRJOIK.js → U2RMUVVY.js} +1 -1
  457. package/build/dist/chunks/{VV2HEIFI.js → U5PMVP56.js} +1 -1
  458. package/build/dist/chunks/{TBCSZDAF.js → UD2XMNIT.js} +1 -1
  459. package/build/dist/chunks/{F26FK47J.js → UNJJRQIU.js} +1 -1
  460. package/build/dist/chunks/V5JWGWXC.js +1 -0
  461. package/build/dist/chunks/V74F6IDY.js +1 -0
  462. package/build/dist/chunks/VCOTCVKN.js +1 -0
  463. package/build/dist/chunks/{MYFAKCQI.js → VEQBHI6O.js} +1 -1
  464. package/build/dist/chunks/VHV6WQ5F.js +1 -0
  465. package/build/dist/chunks/{7WQEPZJY.js → VNV6ZISN.js} +1 -1
  466. package/build/dist/chunks/{W2OJ57ZO.js → VYAJXLND.js} +1 -1
  467. package/build/dist/chunks/{MDV7GECM.js → VYYSL557.js} +1 -1
  468. package/build/dist/chunks/WCNHZYQQ.js +1 -0
  469. package/build/dist/chunks/{K22EXPWN.js → WIRBCS4W.js} +1 -1
  470. package/build/dist/chunks/{YRXT3HTW.js → WLMWWEP7.js} +1 -1
  471. package/build/dist/chunks/{NDW5DAFL.js → WP6RHXGN.js} +1 -1
  472. package/build/dist/chunks/{PLZKXQ76.js → WTXC3XKW.js} +1 -1
  473. package/build/dist/chunks/{WGL46F3S.js → WU7XIAXB.js} +1 -1
  474. package/build/dist/chunks/{5OKJEGBH.js → WV3A3OUU.js} +1 -1
  475. package/build/dist/chunks/{MGPHD4VV.js → X2P55AC3.js} +1 -1
  476. package/build/dist/chunks/{RNC463IM.js → XBE3B6Y2.js} +1 -1
  477. package/build/dist/chunks/XD6X3KTC.js +1 -0
  478. package/build/dist/chunks/{BIRMUW7Z.js → XKSVTN5X.js} +1 -1
  479. package/build/dist/chunks/XL3LLGIR.js +1 -0
  480. package/build/dist/chunks/XQA5LCL6.js +1 -0
  481. package/build/dist/chunks/{SDHPFXRM.js → XSKFKBDR.js} +1 -1
  482. package/build/dist/chunks/{TJWVY4VO.js → YCZPSMZ5.js} +1 -1
  483. package/build/dist/chunks/{JZXYLHI7.js → YDNTY67T.js} +1 -1
  484. package/build/dist/chunks/{2DUCTO5C.js → YN56C7PN.js} +1 -1
  485. package/build/dist/chunks/{E6RRXNV2.js → YRNXGQJC.js} +1 -1
  486. package/build/dist/chunks/YWRLY5EA.js +1 -0
  487. package/build/dist/chunks/YWSX6IE6.js +1 -0
  488. package/build/dist/chunks/{DP2NIYBP.js → YXTSWRV5.js} +1 -1
  489. package/build/dist/chunks/{MQYOG66Q.js → Z6LZGCVW.js} +1 -1
  490. package/build/dist/chunks/{OFI3Y55L.js → ZQAFFWDK.js} +1 -1
  491. package/build/dist/chunks/{NZXQWDGF.js → ZQWZGH7V.js} +1 -1
  492. package/build/dist/chunks/{TBIVTEP5.js → ZSN4IRI5.js} +1 -1
  493. package/build/dist/chunks/{ZET37EIG.js → ZV5HIQXC.js} +1 -1
  494. package/build/dist/chunks/{VHLINDDS.js → ZXJ24B4L.js} +1 -1
  495. package/package.json +1 -1
  496. package/build/dist/chunks/24CQ2SPB.js +0 -1
  497. package/build/dist/chunks/2OJAOVMG.js +0 -1
  498. package/build/dist/chunks/65EQECL3.js +0 -1
  499. package/build/dist/chunks/6YYCGUCU.js +0 -1
  500. package/build/dist/chunks/EU3OAJU2.js +0 -1
  501. package/build/dist/chunks/H4NYYJ3Z.js +0 -1
  502. package/build/dist/chunks/HTXKERNS.js +0 -1
  503. package/build/dist/chunks/JG27HM4P.js +0 -1
  504. package/build/dist/chunks/L6D26AMO.js +0 -1
  505. package/build/dist/chunks/O6L4BJP4.js +0 -1
  506. package/build/dist/chunks/SUFA2GKR.js +0 -1
  507. package/build/dist/chunks/UP7FBDMJ.js +0 -1
  508. package/build/dist/chunks/YHRUAQQK.js +0 -1
  509. package/build/dist/chunks/ZCOFMGPS.js +0 -1
  510. package/build/dist/chunks/ZCUXM52B.js +0 -1
@@ -1,2 +1,2 @@
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(`
1
+ import{g as c}from"./NWNYJ26T.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};
@@ -1 +1 @@
1
- import{e as m,h as t}from"./5KUWLUPM.js";import{b as E}from"./ABPL3ZZI.js";import{i as C}from"./FWD4L3CJ.js";import{a as v,b as g}from"./XSD5NL7J.js";import{keccak256 as j,parseAbi as D}from"viem";var A=Object.freeze({robinswapV2:Object.freeze({factory:"0xa95DA9b9fCef09A07F99444fE9304457d6ECdccA",kind:"v2",kyberswap:"robinswap-v2",velora:void 0}),uniswapV2:Object.freeze({factory:"0x8BcEAA40b9aCDfAedf85ADf4fF01f5ad6517937F",kind:"v2",kyberswap:"uniswap",velora:"uniswapv2"}),uniswapV3:Object.freeze({factory:C[4663].uniswap.v3_factory.address,kind:"v3",kyberswap:"uniswapv3",velora:"uniswapv3"})}),L=Object.freeze(Object.fromEntries(Object.entries(A).map(([r,n])=>[r,n.factory])));function V(r){return Object.values(A).flatMap(n=>n[r]??[])}var P=D(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function fee() view returns (uint24)"]),S=D(["function getPair(address,address) view returns (address)","function getPool(address,address,uint24) view returns (address)"]),a=new Map;function M(r,n,i){let d=a.get(j(i));return!!d&&d.expires>Date.now()&&t(d.token,r)&&d.pools.some(u=>t(u,n))}async function B(r,n,i,d,u,z){let w=[...new Set(d.filter(o=>!t(o,u)).map(o=>o.toLowerCase()))];if(!w.length)return;let k=j(z);a.delete(k);let f=await r.getBlockNumber();for(let o of w){let s=e=>new v(`KyberSwap source receiver ${o} is not a verified input pool: ${e}.`),l=Array.isArray(n)?n.map(e=>Array.isArray(e)?e[0]:void 0).find(e=>m(e)&&t(e.pool,o)&&t(e.tokenIn,i)):void 0;if(!m(l)||typeof l.tokenOut!="string")throw s("not named as an input hop in the accepted route");let O=await r.getCode({address:o,blockNumber:f});if(!O||O==="0x")throw s("no deployed code");try{let[e,p,y]=await Promise.all(["token0","token1","factory"].map(c=>r.readContract({address:o,abi:P,functionName:c,blockNumber:f}))),h=t(e,i)?p:t(p,i)?e:void 0;if(!h||!t(h,l.tokenOut))throw s("tokens do not match the input route");let x=Object.values(A).find(c=>t(y,c.factory));if(!x)throw s("factory is not pinned");let b;if(x.kind==="v2")b=await r.readContract({address:y,abi:S,functionName:"getPair",args:[e,p],blockNumber:f});else{let c=await r.readContract({address:o,abi:P,functionName:"fee",blockNumber:f});b=await r.readContract({address:y,abi:S,functionName:"getPool",args:[e,p,c],blockNumber:f})}if(!t(b,o))throw s("not registered by the pinned factory")}catch(e){throw e instanceof v||E(e)?e:g(e,3)?s("pool token or factory read reverted; this pool interface is not supported by Oak"):s("on-chain verification unavailable")}}for(let[o,s]of a)s.expires<=Date.now()&&a.delete(o);a.size>=1e3&&a.delete(a.keys().next().value),a.set(k,{token:i,pools:w,expires:Date.now()+6e4})}export{A as a,L as b,V as c,M as d,B as e};
1
+ import{e as m,h as t}from"./NWNYJ26T.js";import{b as E}from"./ABPL3ZZI.js";import{i as C}from"./FWD4L3CJ.js";import{a as v,b as g}from"./XSD5NL7J.js";import{keccak256 as j,parseAbi as D}from"viem";var A=Object.freeze({robinswapV2:Object.freeze({factory:"0xa95DA9b9fCef09A07F99444fE9304457d6ECdccA",kind:"v2",kyberswap:"robinswap-v2",velora:void 0}),uniswapV2:Object.freeze({factory:"0x8BcEAA40b9aCDfAedf85ADf4fF01f5ad6517937F",kind:"v2",kyberswap:"uniswap",velora:"uniswapv2"}),uniswapV3:Object.freeze({factory:C[4663].uniswap.v3_factory.address,kind:"v3",kyberswap:"uniswapv3",velora:"uniswapv3"})}),L=Object.freeze(Object.fromEntries(Object.entries(A).map(([r,n])=>[r,n.factory])));function V(r){return Object.values(A).flatMap(n=>n[r]??[])}var P=D(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function fee() view returns (uint24)"]),S=D(["function getPair(address,address) view returns (address)","function getPool(address,address,uint24) view returns (address)"]),a=new Map;function M(r,n,i){let d=a.get(j(i));return!!d&&d.expires>Date.now()&&t(d.token,r)&&d.pools.some(u=>t(u,n))}async function B(r,n,i,d,u,z){let w=[...new Set(d.filter(o=>!t(o,u)).map(o=>o.toLowerCase()))];if(!w.length)return;let k=j(z);a.delete(k);let f=await r.getBlockNumber();for(let o of w){let s=e=>new v(`KyberSwap source receiver ${o} is not a verified input pool: ${e}.`),l=Array.isArray(n)?n.map(e=>Array.isArray(e)?e[0]:void 0).find(e=>m(e)&&t(e.pool,o)&&t(e.tokenIn,i)):void 0;if(!m(l)||typeof l.tokenOut!="string")throw s("not named as an input hop in the accepted route");let O=await r.getCode({address:o,blockNumber:f});if(!O||O==="0x")throw s("no deployed code");try{let[e,p,y]=await Promise.all(["token0","token1","factory"].map(c=>r.readContract({address:o,abi:P,functionName:c,blockNumber:f}))),h=t(e,i)?p:t(p,i)?e:void 0;if(!h||!t(h,l.tokenOut))throw s("tokens do not match the input route");let x=Object.values(A).find(c=>t(y,c.factory));if(!x)throw s("factory is not pinned");let b;if(x.kind==="v2")b=await r.readContract({address:y,abi:S,functionName:"getPair",args:[e,p],blockNumber:f});else{let c=await r.readContract({address:o,abi:P,functionName:"fee",blockNumber:f});b=await r.readContract({address:y,abi:S,functionName:"getPool",args:[e,p,c],blockNumber:f})}if(!t(b,o))throw s("not registered by the pinned factory")}catch(e){throw e instanceof v||E(e)?e:g(e,3)?s("pool token or factory read reverted; this pool interface is not supported by Oak"):s("on-chain verification unavailable")}}for(let[o,s]of a)s.expires<=Date.now()&&a.delete(o);a.size>=1e3&&a.delete(a.keys().next().value),a.set(k,{token:i,pools:w,expires:Date.now()+6e4})}export{A as a,L as b,V as c,M as d,B as e};
@@ -1 +1 @@
1
- import{a as P}from"./DFM4T6ZE.js";import{a as n}from"./L7OQUHM5.js";import{g as $}from"./5KUWLUPM.js";import{a as s,d as v}from"./FWD4L3CJ.js";import{getAddress as T,parseAbi as b}from"viem";var m={address:n.priors,symbol:"PRIORS",decimals:18,chainId:s},w=8,E="0x0000000000000000000000000000000000000000",x=b(["function balanceOf(address) view returns (uint256)"]),_=b(["function balanceOf(address) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)"]),y=b(["function getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))","function assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)"]),A=b(["function latestGen(uint256) view returns (uint32)","function position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))"]);async function L(k,d,C,R){let e=k.clientFor(s),g=async(t,i,o,r)=>{try{return await r()}catch(a){return[{module:"priors",id:`priors:unreadable:${t}`,chainId:s,assets:[],incomplete:!0,description:`Priors ${i} read failed (${k.plainError(a)}). It is not zero: ${o}`}]}},l=(t,i)=>k.formatAmount(t.toString(),i),S=()=>g("savings","savings","check it with priors_savings_balance.",async()=>{let t=await e.readContract({address:n.savings,abi:_,functionName:"balanceOf",args:[d]});if(t===0n)return[];let i=await e.readContract({address:n.savings,abi:_,functionName:"previewRedeem",args:[t]});return[{module:"priors",id:`priors:savings:${d.toLowerCase()}`,chainId:s,assets:[{token:R,amount:i.toString()}],description:`Priors savings in the Morpho vault (${n.savings}): ${t} shares, ${l(i,v)} USDG redeemable now. Exit with priors_savings_withdraw or priors_savings_redeem; vault liquidity applies and no immediate exit is promised.`}]}),O=()=>g("priors-token","PRIORS token","check it with balances.",async()=>{let t=await e.readContract({address:n.priors,abi:x,functionName:"balanceOf",args:[d]});return t===0n?[]:[{module:"priors",id:`priors:token:${d.toLowerCase()}`,chainId:s,assets:[{token:m,amount:t.toString()}],description:`${l(t,m.decimals)} PRIORS held by this wallet (${n.priors}). Stock-collateral and backing stake are listed separately.`}]}),N=t=>g(`stock:${t}`,`stock (agent ${t})`,`check it with priors_stock_state {"agentId":"${t}"}.`,async()=>{let i=await e.readContract({address:n.stock,abi:y,functionName:"getPosition",args:[t]});if(i.amount===0n||i.token===E||!$(i.depositor,d))return[];let o=T(i.token),r=(await e.readContract({address:n.stock,abi:y,functionName:"assets",args:[o]}))[2],a=P.tokens.find(p=>$(p.token,o))?.symbol??"STOCK";return[{module:"priors",id:`priors:stock:${t}`,chainId:s,assets:[{token:{address:o,symbol:a,decimals:r,chainId:s},amount:i.amount.toString()}],description:`Priors stock collateral for agent ${t}: ${l(i.amount,r)} ${a} locked in the stock vault (${n.stock})${i.closing?"; the line is closing":""}. Close the line with priors_stock_close to return it, subject to any default or issuer shortfall.`}]}),I=t=>g(`backing:${t}`,`backing (agent ${t})`,`check it with priors_backing_position {"agentId":"${t}"}.`,async()=>{let i=BigInt(await e.readContract({address:n.backing,abi:A,functionName:"latestGen",args:[t]})),o=i>=BigInt(w)?i-BigInt(w-1):0n,r=[];for(let c=o;c<=i;c++)for(let u of[0,1,2])r.push(e.readContract({address:n.backing,abi:A,functionName:"position",args:[t,Number(c),u,d]}));let a=await Promise.all(r),p=a.reduce((c,u)=>c+u.counted,0n),f=a.reduce((c,u)=>c+u.a0+u.a1,0n),h=[];return o>0n&&h.push({module:"priors",id:`priors:unreadable:backing-generations:${t}`,chainId:s,assets:[],incomplete:!0,description:`Agent ${t} has ${i} backing generations; only the latest ${w} were read. Check older ones with priors_backing_position.`}),p+f>0n&&h.push({module:"priors",id:`priors:backing:${t}`,chainId:s,assets:[{token:m,amount:(p+f).toString()}],description:`Priors backing stake for agent ${t}: ${l(p,m.decimals)} PRIORS counted and ${l(f,m.decimals)} PRIORS pending. It is collateral that a default burns, not a return. Stake already leaving or settled is not included; check priors_backing_record and priors_backing_claimable.`}),h});return(await Promise.all([S(),O(),...C.flatMap(t=>[N(t),I(t)])])).flat()}export{m as a,L as b};
1
+ import{a as P}from"./DFM4T6ZE.js";import{a as n}from"./DJN3JAWB.js";import{g as $}from"./NWNYJ26T.js";import{a as s,d as v}from"./FWD4L3CJ.js";import{getAddress as T,parseAbi as b}from"viem";var m={address:n.priors,symbol:"PRIORS",decimals:18,chainId:s},w=8,E="0x0000000000000000000000000000000000000000",x=b(["function balanceOf(address) view returns (uint256)"]),_=b(["function balanceOf(address) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)"]),y=b(["function getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))","function assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)"]),A=b(["function latestGen(uint256) view returns (uint32)","function position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))"]);async function L(k,d,C,R){let e=k.clientFor(s),g=async(t,i,o,r)=>{try{return await r()}catch(a){return[{module:"priors",id:`priors:unreadable:${t}`,chainId:s,assets:[],incomplete:!0,description:`Priors ${i} read failed (${k.plainError(a)}). It is not zero: ${o}`}]}},l=(t,i)=>k.formatAmount(t.toString(),i),S=()=>g("savings","savings","check it with priors_savings_balance.",async()=>{let t=await e.readContract({address:n.savings,abi:_,functionName:"balanceOf",args:[d]});if(t===0n)return[];let i=await e.readContract({address:n.savings,abi:_,functionName:"previewRedeem",args:[t]});return[{module:"priors",id:`priors:savings:${d.toLowerCase()}`,chainId:s,assets:[{token:R,amount:i.toString()}],description:`Priors savings in the Morpho vault (${n.savings}): ${t} shares, ${l(i,v)} USDG redeemable now. Exit with priors_savings_withdraw or priors_savings_redeem; vault liquidity applies and no immediate exit is promised.`}]}),O=()=>g("priors-token","PRIORS token","check it with balances.",async()=>{let t=await e.readContract({address:n.priors,abi:x,functionName:"balanceOf",args:[d]});return t===0n?[]:[{module:"priors",id:`priors:token:${d.toLowerCase()}`,chainId:s,assets:[{token:m,amount:t.toString()}],description:`${l(t,m.decimals)} PRIORS held by this wallet (${n.priors}). Stock-collateral and backing stake are listed separately.`}]}),N=t=>g(`stock:${t}`,`stock (agent ${t})`,`check it with priors_stock_state {"agentId":"${t}"}.`,async()=>{let i=await e.readContract({address:n.stock,abi:y,functionName:"getPosition",args:[t]});if(i.amount===0n||i.token===E||!$(i.depositor,d))return[];let o=T(i.token),r=(await e.readContract({address:n.stock,abi:y,functionName:"assets",args:[o]}))[2],a=P.tokens.find(p=>$(p.token,o))?.symbol??"STOCK";return[{module:"priors",id:`priors:stock:${t}`,chainId:s,assets:[{token:{address:o,symbol:a,decimals:r,chainId:s},amount:i.amount.toString()}],description:`Priors stock collateral for agent ${t}: ${l(i.amount,r)} ${a} locked in the stock vault (${n.stock})${i.closing?"; the line is closing":""}. Close the line with priors_stock_close to return it, subject to any default or issuer shortfall.`}]}),I=t=>g(`backing:${t}`,`backing (agent ${t})`,`check it with priors_backing_position {"agentId":"${t}"}.`,async()=>{let i=BigInt(await e.readContract({address:n.backing,abi:A,functionName:"latestGen",args:[t]})),o=i>=BigInt(w)?i-BigInt(w-1):0n,r=[];for(let c=o;c<=i;c++)for(let u of[0,1,2])r.push(e.readContract({address:n.backing,abi:A,functionName:"position",args:[t,Number(c),u,d]}));let a=await Promise.all(r),p=a.reduce((c,u)=>c+u.counted,0n),f=a.reduce((c,u)=>c+u.a0+u.a1,0n),h=[];return o>0n&&h.push({module:"priors",id:`priors:unreadable:backing-generations:${t}`,chainId:s,assets:[],incomplete:!0,description:`Agent ${t} has ${i} backing generations; only the latest ${w} were read. Check older ones with priors_backing_position.`}),p+f>0n&&h.push({module:"priors",id:`priors:backing:${t}`,chainId:s,assets:[{token:m,amount:(p+f).toString()}],description:`Priors backing stake for agent ${t}: ${l(p,m.decimals)} PRIORS counted and ${l(f,m.decimals)} PRIORS pending. It is collateral that a default burns, not a return. Stake already leaving or settled is not included; check priors_backing_record and priors_backing_claimable.`}),h});return(await Promise.all([S(),O(),...C.flatMap(t=>[N(t),I(t)])])).flat()}export{m as a,L as b};
@@ -1 +1 @@
1
- import{a as q}from"./UP7FBDMJ.js";import{c as h}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";var Y="12333333",I=1800,N=9000n,O=9607n,C=150n,U=(1n<<256n)-1n,f=10000n,g=10n**18n,X=10n**30n,R=1n<<192n,D=20n*g,E=75n*g,_=100n*g,x=300n*g,P=100000n*g,S=500000n*g,w=1000000n*g,B=10000000n*g;function c(n){let t=typeof n=="bigint"?n:q(n);if(t<0n||t>U)throw new o("Amount must be within the uint256 range.");return t}function p(n){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o("Integer parameter must be a safe integer.");return BigInt(n)}if(typeof n!="string"||!/^-?\d+$/.test(n))throw new o("Value must be a signed integer decimal string.");return BigInt(n)}function A(n,t=77){let i=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):NaN;if(!Number.isInteger(i)||i<0||i>t)throw new o(`Token decimals must be an integer from 0 to ${t}.`);return i}function k(n){return 10n**BigInt(n)}function T(n,t="Result"){if(n<0n||n>U)throw new o(`${t} exceeds uint256 bounds.`);return n}function b(n,t,i="Factor"){return T(n*t,i)}function a(n,t,i,s="floor"){if(i<=0n)throw new o("The denominator must be positive.");let e=n*t;if(e===0n)return 0n;let r=s==="ceil"?e/i+(e%i===0n?0n:1n):e/i;return T(r,"Math.mulDiv result")}function $(n){let t=c(n);return t<P?D.toString():t<S?(D+a(t-P,E-D,S-P)).toString():t<w?(E+a(t-S,_-E,w-S)).toString():t<B?(_+a(t-w,x-_,B-w)).toString():x.toString()}function Q(n){let t=c(n);return T(9000000n+t/1000000000000n/6n,"noHoldPriceBase").toString()}function j(n){let t=c(n);return a(t,5n,100n,"ceil").toString()}function z(n,t){let i=c(n),s=c(t);if(s<=0n)throw new o("OAK-per-ETH price must be positive.");return a(i,g,s,"floor").toString()}function G(n,t,i=h){let s=c(n),e=c(t);if(e<=0n)throw new o("OAK USD price must be positive.");let r=k(A(i));return a(s,r,e,"ceil").toString()}function J(n,t,i=h){let s=c(n),e=c(t),r=k(A(i));return a(s,e,r,"floor").toString()}function Z(n,t){let i=c(n),s=c(t);if(i>f||s>f)throw new o("FeePolicyOutOfBounds: hook fee or creator tax exceeds 10000 bps.");let e=i+s+C;if(e>f-N)throw new o("FeePolicyOutOfBounds: fees and impact allowance exceed 1000 bps.");let r=f-e;return(r>O?O:r).toString()}function nn(n,t,i,s,e){let r=A(s,83);if(r<6)throw new o("OAK decimals must be at least 6 for burner conversion.");let u=c(e);if(u<N||u>O)throw new o("InvalidBurnerFloor: floor must be from 9000 to 9607 bps.");let m=c(n),d=c(t),l=c(i);if(l<=0n)throw new o("ETH USD price must be positive.");let v=k(r-6),y=b(m,v,"burnerMinOut usdgIn * decimalScale"),W=b(d,u,"burnerMinOut oakPerEthE18 * floorBps"),M=b(l,f,"burnerMinOut ethUsdE18 * 10000");return a(y,W,M,"floor").toString()}function tn(n,t,i=I){let s=p(n),e=p(t),r=p(i);if(r<=0n)throw new o("Observation window seconds must be positive.");let u=e-s,d=u/r-(u<0n&&u%r!==0n?1n:0n);return Number(d)}function en(n){let t=c(n);if(t<=0n)throw new o("sqrtRatioX96 must be positive.");let i=b(t,t,"sqrtRatioX96 squared");return a(i,X,R,"floor").toString()}function F(n){let t=c(n);if(t<=0n)throw new o("sqrtPriceX96 must be positive.");let i=b(t,t,"sqrtPriceX96 squared");return a(i,g,R,"floor").toString()}function L(n){let t="ethAmountWei"in n&&n.ethAmountWei!==void 0?n.ethAmountWei:"ethVolumeWei"in n?n.ethVolumeWei:void 0;if(t===void 0)throw new o("SwapTrade must provide ethAmountWei.");let i=p(t),s=i<0n?-i:i;if(s<=0n)throw new o("SwapTrade ETH volume must be positive.");let e;n.sqrtPriceX96!==void 0&&n.sqrtPriceX96!==""&&n.sqrtPriceX96!=="0"&&(e=BigInt(F(n.sqrtPriceX96)));let r;if(n.oakPerEthE18!==void 0&&n.oakPerEthE18!==""&&(r=c(n.oakPerEthE18)),e!==void 0&&r!==void 0&&e!==r)throw new o("SwapTrade oakPerEthE18 does not match post-swap sqrtPriceX96.");let u=e??r;if(u===void 0||u<=0n)throw new o("SwapTrade must provide a positive post-swap price.");let m=n.timestamp!==void 0&&n.timestamp!==""?c(n.timestamp):void 0;return{volumeWei:s,oakPerEth:u,timestamp:m}}function rn(n,t){if(!Array.isArray(n)||n.length===0)throw new o("At least one SwapTrade is required to compute the 30-minute average.");let i=t?.windowEnd!==void 0?c(BigInt(t.windowEnd)):t?.now!==void 0?c(BigInt(t.now)):void 0,s=t?.windowStart!==void 0?c(BigInt(t.windowStart)):i!==void 0?i-BigInt(I):void 0,e=0n,r=0n;for(let u of n){let{volumeWei:m,oakPerEth:d,timestamp:l}=L(u);s!==void 0&&i!==void 0&&l!==void 0&&(l<s||l>=i)||(e+=m*d,r+=m)}if(r<=0n)throw new o("No trades with positive ETH volume fell inside the 30-minute window.");return(e/r).toString()}export{Y as a,I as b,N as c,O as d,C as e,$ as f,Q as g,j as h,z as i,G as j,J as k,Z as l,nn as m,tn as n,en as o,F as p,rn as q};
1
+ import{b as q}from"./IX3GZMTM.js";import{c as h}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";var Y="12333333",I=1800,N=9000n,O=9607n,C=150n,U=(1n<<256n)-1n,f=10000n,g=10n**18n,X=10n**30n,R=1n<<192n,D=20n*g,E=75n*g,_=100n*g,x=300n*g,P=100000n*g,S=500000n*g,w=1000000n*g,B=10000000n*g;function c(n){let t=typeof n=="bigint"?n:q(n);if(t<0n||t>U)throw new o("Amount must be within the uint256 range.");return t}function p(n){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o("Integer parameter must be a safe integer.");return BigInt(n)}if(typeof n!="string"||!/^-?\d+$/.test(n))throw new o("Value must be a signed integer decimal string.");return BigInt(n)}function A(n,t=77){let i=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):NaN;if(!Number.isInteger(i)||i<0||i>t)throw new o(`Token decimals must be an integer from 0 to ${t}.`);return i}function k(n){return 10n**BigInt(n)}function T(n,t="Result"){if(n<0n||n>U)throw new o(`${t} exceeds uint256 bounds.`);return n}function b(n,t,i="Factor"){return T(n*t,i)}function a(n,t,i,s="floor"){if(i<=0n)throw new o("The denominator must be positive.");let e=n*t;if(e===0n)return 0n;let r=s==="ceil"?e/i+(e%i===0n?0n:1n):e/i;return T(r,"Math.mulDiv result")}function $(n){let t=c(n);return t<P?D.toString():t<S?(D+a(t-P,E-D,S-P)).toString():t<w?(E+a(t-S,_-E,w-S)).toString():t<B?(_+a(t-w,x-_,B-w)).toString():x.toString()}function Q(n){let t=c(n);return T(9000000n+t/1000000000000n/6n,"noHoldPriceBase").toString()}function j(n){let t=c(n);return a(t,5n,100n,"ceil").toString()}function z(n,t){let i=c(n),s=c(t);if(s<=0n)throw new o("OAK-per-ETH price must be positive.");return a(i,g,s,"floor").toString()}function G(n,t,i=h){let s=c(n),e=c(t);if(e<=0n)throw new o("OAK USD price must be positive.");let r=k(A(i));return a(s,r,e,"ceil").toString()}function J(n,t,i=h){let s=c(n),e=c(t),r=k(A(i));return a(s,e,r,"floor").toString()}function Z(n,t){let i=c(n),s=c(t);if(i>f||s>f)throw new o("FeePolicyOutOfBounds: hook fee or creator tax exceeds 10000 bps.");let e=i+s+C;if(e>f-N)throw new o("FeePolicyOutOfBounds: fees and impact allowance exceed 1000 bps.");let r=f-e;return(r>O?O:r).toString()}function nn(n,t,i,s,e){let r=A(s,83);if(r<6)throw new o("OAK decimals must be at least 6 for burner conversion.");let u=c(e);if(u<N||u>O)throw new o("InvalidBurnerFloor: floor must be from 9000 to 9607 bps.");let m=c(n),d=c(t),l=c(i);if(l<=0n)throw new o("ETH USD price must be positive.");let v=k(r-6),y=b(m,v,"burnerMinOut usdgIn * decimalScale"),W=b(d,u,"burnerMinOut oakPerEthE18 * floorBps"),M=b(l,f,"burnerMinOut ethUsdE18 * 10000");return a(y,W,M,"floor").toString()}function tn(n,t,i=I){let s=p(n),e=p(t),r=p(i);if(r<=0n)throw new o("Observation window seconds must be positive.");let u=e-s,d=u/r-(u<0n&&u%r!==0n?1n:0n);return Number(d)}function en(n){let t=c(n);if(t<=0n)throw new o("sqrtRatioX96 must be positive.");let i=b(t,t,"sqrtRatioX96 squared");return a(i,X,R,"floor").toString()}function F(n){let t=c(n);if(t<=0n)throw new o("sqrtPriceX96 must be positive.");let i=b(t,t,"sqrtPriceX96 squared");return a(i,g,R,"floor").toString()}function L(n){let t="ethAmountWei"in n&&n.ethAmountWei!==void 0?n.ethAmountWei:"ethVolumeWei"in n?n.ethVolumeWei:void 0;if(t===void 0)throw new o("SwapTrade must provide ethAmountWei.");let i=p(t),s=i<0n?-i:i;if(s<=0n)throw new o("SwapTrade ETH volume must be positive.");let e;n.sqrtPriceX96!==void 0&&n.sqrtPriceX96!==""&&n.sqrtPriceX96!=="0"&&(e=BigInt(F(n.sqrtPriceX96)));let r;if(n.oakPerEthE18!==void 0&&n.oakPerEthE18!==""&&(r=c(n.oakPerEthE18)),e!==void 0&&r!==void 0&&e!==r)throw new o("SwapTrade oakPerEthE18 does not match post-swap sqrtPriceX96.");let u=e??r;if(u===void 0||u<=0n)throw new o("SwapTrade must provide a positive post-swap price.");let m=n.timestamp!==void 0&&n.timestamp!==""?c(n.timestamp):void 0;return{volumeWei:s,oakPerEth:u,timestamp:m}}function rn(n,t){if(!Array.isArray(n)||n.length===0)throw new o("At least one SwapTrade is required to compute the 30-minute average.");let i=t?.windowEnd!==void 0?c(BigInt(t.windowEnd)):t?.now!==void 0?c(BigInt(t.now)):void 0,s=t?.windowStart!==void 0?c(BigInt(t.windowStart)):i!==void 0?i-BigInt(I):void 0,e=0n,r=0n;for(let u of n){let{volumeWei:m,oakPerEth:d,timestamp:l}=L(u);s!==void 0&&i!==void 0&&l!==void 0&&(l<s||l>=i)||(e+=m*d,r+=m)}if(r<=0n)throw new o("No trades with positive ETH volume fell inside the 30-minute window.");return(e/r).toString()}export{Y as a,I as b,N as c,O as d,C as e,$ as f,Q as g,j as h,z as i,G as j,J as k,Z as l,nn as m,tn as n,en as o,F as p,rn as q};
@@ -1 +1 @@
1
- import{a as d,b as f}from"./WMNRP3YH.js";import{a}from"./P4UQGWCP.js";import{g as s}from"./5KUWLUPM.js";import{a as n}from"./XSD5NL7J.js";import{getAddress as m,keccak256 as u}from"viem";var l=a.vaults;function c(t,o=!0){let e=l.find(r=>s(r.earnContractAddress,t));if(!e&&o)throw new n("This Beefy vault is not in the pinned chain 4663 standard-vault inventory.");return e}async function v(t,o,e){c(o);let[r,i]=await Promise.all([t.getCode({address:m(o),blockNumber:e}),t.getCode({address:d,blockNumber:e})]),p=`0x363d3d373d3d3d363d73${d.slice(2).toLowerCase()}5af43d82803e903d91602b57fd5bf3`;if(r?.toLowerCase()!==p||!i||u(i)!==f)throw new n("The Beefy standard vault or implementation no longer matches its verified code.")}export{l as a,c as b,v as c};
1
+ import{a as d,b as f}from"./SIYUNOLI.js";import{a}from"./P4UQGWCP.js";import{g as s}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{getAddress as m,keccak256 as u}from"viem";var l=a.vaults;function c(t,o=!0){let e=l.find(r=>s(r.earnContractAddress,t));if(!e&&o)throw new n("This Beefy vault is not in the pinned chain 4663 standard-vault inventory.");return e}async function v(t,o,e){c(o);let[r,i]=await Promise.all([t.getCode({address:m(o),blockNumber:e}),t.getCode({address:d,blockNumber:e})]),p=`0x363d3d373d3d3d363d73${d.slice(2).toLowerCase()}5af43d82803e903d91602b57fd5bf3`;if(r?.toLowerCase()!==p||!i||u(i)!==f)throw new n("The Beefy standard vault or implementation no longer matches its verified code.")}export{l as a,c as b,v as c};
@@ -1 +1 @@
1
- import{b as Ae,o as ce}from"./GHPREYQK.js";import{a as ae}from"./HTXKERNS.js";import{b as xe}from"./Z4SRGAVL.js";import{a as Ie}from"./BQICZFLR.js";import{a as Te}from"./5ZLOCQA4.js";import{e as W,g as p,i as be,n as ke}from"./5KUWLUPM.js";import{a as x,i as ye}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{a as re}from"./JXOEJPJ4.js";import{decodeErrorResult as He,decodeEventLog as ie,encodeAbiParameters as D,encodeFunctionData as N,erc20Abi as Q,parseAbi as Ce,parseAbiParameters as q,toHex as ve,zeroAddress as $}from"viem";var h=ye[x].poolsTrade,J=h.liquidityLauncher.address,C=h.uerc20BeneficiaryVault.address,de=h.universalRouter.address,ne=10n**27n,U=(1n<<128n)-1n,Ne=`0x${"00".repeat(32)}`,R=63127652n,ue=100000n,oe=10000000n,Re=2000n,le={address:ae,symbol:"ETH",decimals:18,chainId:x},m=Ce(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),z=Ce(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),j=[h.instantLaunchStrategyFeesOn.address,h.instantLaunchStrategyFeesOff.address];function se(l){if(l.status!=="success")throw new a("The launch receipt did not succeed.");let c=[];for(let y of l.logs){let O=j.findIndex(F=>p(F,y.address));if(O===-1||y.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let V=ie({abi:z,eventName:"TokenLaunched",data:y.data,topics:[...y.topics]}),{token:T,poolId:Y,poolKey:M,feeSplitter:Z}=V.args,_=O===0?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address;if(!p(Z,_)||!p(M.currency0,$)||!p(M.currency1,T)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,$))throw new a("The launch does not match the current native ETH strategy.");let ee=l.logs.filter(F=>p(F.address,h.v4PositionManager.address)).flatMap(F=>{if(F.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let P=ie({abi:z,eventName:"Transfer",data:F.data,topics:[...F.topics]}).args;return p(P.from,$)&&p(P.to,j[O])?[P.tokenId]:[]});if(ee.length!==1)throw new a("The launch receipt must identify one matching position mint.");c.push({token:T,poolId:Y,positionId:ee[0].toString(),creatorFees:O===0})}return c}function S(l){return be(l,"Provide a valid wallet or token address.")}function L(l,c,y=!1){return ke(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!y})}function X(l,c,y=!1){if(y&&l===void 0)return"";if(typeof l!="string"||!y&&!l.trim()||l.length>4096)throw new a(`Provide a valid ${c}.`);return l}function fe(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new a("Provide a valid launch transaction hash.");return l}function pe(l,c,y="minAmountOut"){let O=c.slippageBps??Ae;if(typeof O!="number")throw new a("Slippage must be an integer in basis points.");let V=ce(l.toString(),O),T=c[y]===void 0?BigInt(V):L(c[y],y,l===0n);if(T>l||l>0n&&T===0n||T>U)throw new a("The minimum output must be positive and no larger than the simulated output.");return T}var Me=l=>{let c=l.clientFor(x),y=(e,s,o,n)=>l.unsignedTx({to:e,data:s,value:o.toString(),chainId:x,description:n}),O=e=>{throw new a(l.plainError(e))};async function V(){if(await c.getChainId()!==x)throw new a("pools.trade requires Robinhood Chain 4663.")}async function T(e,s,o){let n=await l.preview(e,s),t=n.changes.map(({token:r,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,r.decimals)} ${re(r.symbol)} (${r.address}, chain ${r.chainId})`});return{txs:e,summary:[o,n.summary,...t].join(" ")}}async function Y(){return(await c.getBlock()).timestamp+600n}function M(e,s,o,n,t,r){let d=[$,e,2500,25,$],i=[D(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,s,o,n,0n,"0x"]]),D(q("address,uint256"),[s?$:e,o]),D(q("address,address,uint256"),[s?e:$,t,0n])],f=[D(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:f,encoded:D(q("bytes,bytes[],uint256"),["0x10",f,r])}}async function Z(e,s){let o=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:s,gas:ve(Ie),to:i.to,data:i.data,value:ve(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(o)||o.length!==1||!W(o[0])||!Array.isArray(o[0].calls)||o[0].calls.length!==e.length)throw new a("The output simulation returned a malformed response.");let n=o[0].calls;if(!n.slice(0,-1).every(i=>W(i)&&i.status==="0x1"&&!i.error))throw new a("A prerequisite failed during the output simulation.");let t=n.at(-1);if(!W(t)||t.status!=="0x0")throw new a("The output simulation did not return the expected minimum-output control.");let r=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:W(t.error)?t.error.data:void 0;if(typeof r!="string"||!/^0x[0-9a-fA-F]+$/.test(r))throw new a("The output simulation did not report an expected amount.");let d=He({abi:m,data:r});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==U||d.args[1]<=0n||d.args[1]>=U)throw new a("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ee=2e3;async function F(e,s,o,n=()=>!0){let t=await c.getBlockNumber(),r=t<R?0n:(t-R)/oe+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Re)throw new a("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(r*BigInt(j.length+(e&&!o?1:0)));let f=new Map,w=new Set;for(let u=R;u<=t&&n();u+=oe){let b=u+oe-1n>t?t:u+oe-1n,v=(await Promise.all(j.map(k=>c.getLogs({address:k,event:z[0],...s?{args:{token:s}}:{},fromBlock:u,toBlock:b,strict:!0})))).flat(),E=[...new Set(v.map(k=>k.transactionHash))].filter(k=>!k||!f.has(k));for(let k=0;k<E.length&&n();k+=8)await Promise.all(E.slice(k,k+8).map(async B=>{if(!B)throw new a("A launch log is missing its transaction hash.");let H=_.get(B);H||(i(),H=await c.getTransactionReceipt({hash:B}),_.size>=ee&&_.delete(_.keys().next().value),_.set(B,H)),f.set(B,H),n()&&await o?.(H)}));if(!n())break;if(e&&!o){let k=await c.getLogs({address:C,event:z[1],args:{to:e},fromBlock:u,toBlock:b,strict:!0});for(let B of k){let H=ie({abi:z,eventName:"Transfer",data:B.data,topics:B.topics}).args;w.add(H.tokenId.toString())}}}return{receipts:[...f.values()],feeIds:w}}async function P(e){let o=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:fe(e.launchTx)})]:(await F(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(se).filter(n=>e.positionId!==void 0?n.positionId===L(e.positionId,"positionId").toString():p(n.token,S(e.token)));if(o.length!==1)throw new a("No unique current-strategy launch was found. Older strategy generations are unsupported.");return o[0]}async function Se(e,s){if(typeof e.creatorFees!="boolean")throw new a("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),$)&&!p(S(e.pair),ae))throw new a("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new a("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&L(e.supply,"supply")!==ne)throw new a("Instant Launch requires a supply of one billion tokens.");let o=S(e.feeBeneficiary);if(p(o,$)||p(o,J))throw new a("The fee beneficiary must be a wallet other than the launcher or zero address.");let n=X(e.name,"name"),t=X(e.symbol,"symbol"),r=e.initialBuy===void 0?0n:L(e.initialBuy,"initialBuy",!0);if(r>U)throw new a("The initial buy exceeds uint128.");if(r===0n&&e.minAmountOut!==void 0)throw new a("A minimum output requires an initial buy.");let d=await c.readContract({address:J,abi:m,functionName:"getGraffiti",args:[s]}),i=S(await c.readContract({address:h.uerc20Factory.address,abi:m,functionName:"getUERC20Address",args:[n,t,18,J,d]})),f=await c.getCode({address:i});if(f&&f!=="0x")throw new a("This wallet already launched that name and symbol.");let w=D(q("(string,string,string,bytes)"),[[X(e.description,"description",!0),X(e.website,"website",!0),X(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?j[0]:j[1],b=[N({abi:m,functionName:"createToken",args:[h.uerc20Factory.address,n,t,18,ne,J,w]}),N({abi:m,functionName:"distributeToken",args:[i,{strategy:u,amount:ne,configData:D(q("address"),[o])},Ne]})],v=await Y(),G=k=>{let B=[...b];if(r>0n){let H=D(q("(address,address,bytes)"),[[de,s,M(i,!0,r,k,s,v).encoded]]);B.push(N({abi:m,functionName:"distributeWithNative",args:[h.universalRouterStrategyApp.address,H,Ne,r]}))}return y(J,N({abi:m,functionName:"multicall",args:[B]}),r,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${o}.`)},E=r>0n?pe(await Z([G(U)],s),e):0n;return T([G(E)],s,`Launch ${n} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${o}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${E} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Be(e,s,o){let n=L(e.amountIn,"amountIn");if(n>U)throw new a("The trade amount exceeds uint128.");let t=S(e.token);await P(e);let r=await Y(),d=[];o||(await c.readContract({address:t,abi:Q,functionName:"allowance",args:[s,h.permit2.address]})<n&&d.push(l.approval(t,h.permit2.address,n.toString(),x)),d.push(y(h.permit2.address,N({abi:m,functionName:"approve",args:[t,de,n,Number(r)]}),0n,`Permit the exact ${n} token base units until ${r}.`)));let i=u=>[...d,y(de,N({abi:m,functionName:"execute",args:["0x10",M(t,o,n,u,s,r).inputs,r]}),o?n:0n,`${o?"Buy":"Sell"} ${t} with minimum output ${u}.`)],f=await Z(i(U),s),w=pe(f,e);return T(i(w),s,`${o?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${n}, minimum output ${w} ${o?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function me(e,s,o){let n=await P(e),t=BigInt(n.positionId),r=n.creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,d=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[t]});if(!p(d,r))throw new a("The position is not locked in its current-strategy splitter.");if(!o)return T([y(r,N({abi:m,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],s,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!n.creatorFees)throw new a("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[t]});if(!p(i,s))throw new a("Only the current fee NFT holder is entitled to claim.");let f=await c.readContract({address:C,abi:m,functionName:"amounts",args:[t]}),w=pe(f[0],e,"minEth");if(f[1]!==0n)throw new a("The current buy-only creator fee configuration returned unexpected token fees.");return T([y(C,N({abi:m,functionName:"claim",args:[t,w,0n]}),0n,`Claim collected ETH fees for position ${t} to ${s}.`)],s,`Claim collected fees: ${f[0]} ETH base units (18 decimals), minimum ${w}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function $e(e,s){let o=await P(e),n=S(e.to);if(p(n,$))throw new a("The token recipient cannot be the zero address.");let t=L(e.amount,"amount"),r=await te(o.token,await c.getBlockNumber());return T([y(r.address,N({abi:Q,functionName:"transfer",args:[n,t]}),0n,`Transfer exactly ${t} ${re(r.symbol)} base units to ${n}.`)],s,`Transfer ${t} token base units (token ${r.address}, decimals ${r.decimals}, chain ${r.chainId}) to ${n}. No approval; no transaction sent.`)}async function Fe(e,s){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new a("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let o=e.positionIds.map(d=>L(d,"positionId").toString());if(new Set(o).size!==o.length)throw new a("Each position ID must appear once.");let n=e.launchTxs.map(fe),t=new Map;for(let[d,i]of o.entries()){let w=(await P({positionId:i,launchTx:n[d]})).creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,u=BigInt(i),b=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[u]});if(!p(b,w))throw new a("The position is not locked in its current-strategy splitter.");t.set(w,[...t.get(w)??[],u])}let r=[...t].map(([d,i])=>y(d,N({abi:m,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return T(r,s,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let K="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function te(e,s){let[o,n]=await Promise.all([c.readContract({address:e,abi:Q,functionName:"symbol",blockNumber:s}),c.readContract({address:e,abi:Q,functionName:"decimals",blockNumber:s})]);if(typeof o!="string"||!o||o.length>256||n!==18)throw new a("The current launch token returned invalid metadata.");return{address:e,symbol:o,decimals:n,chainId:x}}async function he(e,s,o,n){let t=n??await te(e.token,o),r=await c.readContract({address:t.address,abi:Q,functionName:"balanceOf",args:[s],blockNumber:o});return{token:t,amount:r.toString(),humanAmount:l.formatAmount(r.toString(),t.decimals)}}async function Pe(e,s){let o=await P(e),n=await c.getBlockNumber();return{wallet:s,...await he(o,s,n),blockNumber:n.toString(),coverage:K}}async function Le(e,s){let o=fe(e.launchTx),n=await c.getTransactionReceipt({hash:o}),t=se(n);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===L(e.positionId,"positionId").toString())),!t.length)throw new a("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let r=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let f=i.creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,w=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:r});if(!p(w,f))throw new a("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:r}),approved:await c.readContract({address:C,abi:m,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:r}),collected:await c.readContract({address:C,abi:m,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:r})}:void 0,b=await te(i.token,r);return{...i,token:b,custodian:w,holding:await he(i,s,r,b),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:le,amount:u.collected[0].toString()},{token:b,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:o,wallet:s,creator:n.from,blockNumber:r.toString(),launches:d,coverage:K}}async function Oe(e){let s=await c.getBlockNumber(),o=e.limit??20;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>50)throw new a("limit must be an integer from 1 to 50.");let n=e.fromBlock===void 0?s>=R+ue?s-ue+1n:R:L(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?s:L(e.toBlock,"toBlock",!0),r=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new a("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),b=BigInt(u[0]),v=BigInt(u[1]);if(e.fromBlock!==void 0&&n!==b||e.toBlock!==void 0&&t!==v)throw new a("The cursor does not match this block range.");n=b,t=v,r=Number(u[2])}if(s<R&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:R.toString(),toBlock:s.toString(),coverage:K,predeployment:!0};if(n<R||t<n||t>s||t-n>=ue)throw new a("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:j,event:z[0],fromBlock:n,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new a("The launch feed returned an incomplete log.");if(d.sort((u,b)=>u.blockNumber===b.blockNumber?b.logIndex-u.logIndex:u.blockNumber>b.blockNumber?-1:1),r>d.length)throw new a("The browse cursor is outside the launch feed.");let i=new Map,f=[];for(let u of d.slice(r,r+o)){let b=u.transactionHash,v=i.get(b);v||(v=await c.getTransactionReceipt({hash:b}),i.set(b,v));let G=ie({abi:z,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,E=se(v).filter(k=>p(k.token,G.token)&&p(k.poolId,G.poolId));if(E.length!==1)throw new a("The launch feed log does not match one verified receipt launch.");f.push({...E[0],launchTx:b,blockNumber:u.blockNumber.toString(),token:await te(E[0].token,t),creator:v.from})}let w=r+o;return{launches:f,cursor:w<d.length?`${n}:${t}:${w}`:null,fromBlock:n.toString(),toBlock:t.toString(),coverage:K,previousToBlock:n>R?(n-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ge(e,s,o){let n=await P(e);if(!n.creatorFees)throw new a("Creator fees are permanently disabled for this position.");let t=BigInt(n.positionId),r=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[t]});if(!p(r,h.feeSplitterFeesOn.address))throw new a("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[t]});if(!p(d,s))throw new a("Only the current fee NFT holder can change this entitlement.");let i=S(o?e.to:e.spender);if(p(i,C)||o&&p(i,$))throw new a("The fee NFT recipient cannot be the vault or zero address.");let f=o?N({abi:m,functionName:"safeTransferFrom",args:[s,i,t]}):N({abi:m,functionName:"approve",args:[i,t]});return T([y(C,f,0n,o?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],s,o?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function Ee(){return{chainId:x,instant:{supported:!0,supply:ne.toString(),decimals:18,currency:le,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:K}}let g={type:"string"},I=Te(),we={chainId:{type:"integer",const:x},slippageBps:{type:"integer",minimum:0,maximum:9999}};function A(e,s,o,n){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...we,...s},required:o},execute:async(t,r)=>{try{let d=new Set([...Object.keys(we),...Object.keys(s)]);if(Object.keys(t).some(i=>!d.has(i)))throw new a("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==x)throw new a("pools.trade requires chain 4663.");if(S(r),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new a("Slippage must be an integer in basis points.");ce("10000",t.slippageBps)}return await V(),await n(t,r)}catch(d){O(d)}}}}return{tools:[A("launch",{name:g,symbol:g,creatorFees:{type:"boolean",description:"Permanent choice; must be explicit."},feeBeneficiary:g,pair:g,decimals:{type:"integer",const:18},supply:I,initialBuy:I,minAmountOut:I,description:g,website:g,imageUri:g},["name","symbol","creatorFees","feeBeneficiary"],Se),...["buy","sell"].map(e=>A(e,{token:g,amountIn:I,minAmountOut:I,launchTx:g},["token","amountIn"],(s,o)=>Be(s,o,e==="buy"))),A("collect",{positionId:I,launchTx:g},["positionId"],(e,s)=>me(e,s,!1)),A("claim",{positionId:I,launchTx:g,minEth:I},["positionId"],(e,s)=>me(e,s,!0)),A("browse",{fromBlock:I,toBlock:I,limit:{type:"integer",minimum:1,maximum:50},cursor:g},[],Oe),A("balance",{token:g,launchTx:g},["token"],Pe),A("status",{launchTx:g,token:g,positionId:I},["launchTx"],Le),A("launch_options",{},[],Ee),A("fee_transfer",{positionId:I,launchTx:g,to:g},["positionId","to"],(e,s)=>ge(e,s,!0)),A("fee_approve",{positionId:I,launchTx:g,spender:g},["positionId","spender"],(e,s)=>ge(e,s,!1)),A("transfer",{token:g,amount:I,to:g,launchTx:g},["token","amount","to"],$e),A("collect_many",{positionIds:{type:"array",items:I,minItems:1,maxItems:20},launchTxs:{type:"array",items:g,minItems:1,maxItems:20}},["positionIds","launchTxs"],Fe)],positions:async e=>{S(e);let s=[],o=0,n=!0,t,r=i=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:x,assets:[],incomplete:!0,description:`${i} Checked ${o} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),d=async()=>{await V(),n&&await F(e,void 0,async i=>{o++;for(let f of se(i)){if(!n)return;let w=f.creatorFees&&p(await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[BigInt(f.positionId)]}),e);if(!n)return;if(!w&&!p(i.from,e))continue;let u=w?[{token:le,amount:(await c.readContract({address:C,abi:m,functionName:"amounts",args:[BigInt(f.positionId)]}))[0].toString()}]:[];n&&s.push({module:"poolstrade",id:f.positionId,chainId:x,assets:u,description:`Current Instant Launch ${f.token} (18 decimals, supply 1000000000), pool ${f.poolId}; creator fees ${f.creatorFees?"on":"off"} (permanent). ${w?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>n)};try{return await Promise.race([d().then(()=>!0),new Promise(f=>{t=setTimeout(()=>{n=!1,f(!1)},6e3)})])?s:[...s,r("Pools.trade global launch discovery reached its 6000 ms read budget; the historical scan is incomplete.")]}catch(i){return[...s,r(`Pools.trade discovery could not finish: ${l.plainError(i)}`)]}finally{n=!1,t!==void 0&&clearTimeout(t)}}}};function Qe(l){return xe("poolstrade",[Me(l)])}export{se as a,Me as b,Qe as c};
1
+ import{b as Ae,o as ce}from"./BOVMED7R.js";import{a as ae}from"./QHBS3PVU.js";import{b as xe}from"./SPJCSEKP.js";import{a as Ie}from"./IOYRL6AY.js";import{a as Te}from"./66F5ZH34.js";import{e as W,g as p,i as be,n as ke}from"./NWNYJ26T.js";import{a as x,i as ye}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{a as re}from"./JXOEJPJ4.js";import{decodeErrorResult as He,decodeEventLog as ie,encodeAbiParameters as D,encodeFunctionData as N,erc20Abi as Q,parseAbi as Ce,parseAbiParameters as q,toHex as ve,zeroAddress as $}from"viem";var h=ye[x].poolsTrade,J=h.liquidityLauncher.address,C=h.uerc20BeneficiaryVault.address,de=h.universalRouter.address,ne=10n**27n,U=(1n<<128n)-1n,Ne=`0x${"00".repeat(32)}`,R=63127652n,ue=100000n,oe=10000000n,Re=2000n,le={address:ae,symbol:"ETH",decimals:18,chainId:x},m=Ce(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),z=Ce(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),j=[h.instantLaunchStrategyFeesOn.address,h.instantLaunchStrategyFeesOff.address];function se(l){if(l.status!=="success")throw new a("The launch receipt did not succeed.");let c=[];for(let y of l.logs){let O=j.findIndex(F=>p(F,y.address));if(O===-1||y.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let V=ie({abi:z,eventName:"TokenLaunched",data:y.data,topics:[...y.topics]}),{token:T,poolId:Y,poolKey:M,feeSplitter:Z}=V.args,_=O===0?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address;if(!p(Z,_)||!p(M.currency0,$)||!p(M.currency1,T)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,$))throw new a("The launch does not match the current native ETH strategy.");let ee=l.logs.filter(F=>p(F.address,h.v4PositionManager.address)).flatMap(F=>{if(F.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let P=ie({abi:z,eventName:"Transfer",data:F.data,topics:[...F.topics]}).args;return p(P.from,$)&&p(P.to,j[O])?[P.tokenId]:[]});if(ee.length!==1)throw new a("The launch receipt must identify one matching position mint.");c.push({token:T,poolId:Y,positionId:ee[0].toString(),creatorFees:O===0})}return c}function S(l){return be(l,"Provide a valid wallet or token address.")}function L(l,c,y=!1){return ke(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!y})}function X(l,c,y=!1){if(y&&l===void 0)return"";if(typeof l!="string"||!y&&!l.trim()||l.length>4096)throw new a(`Provide a valid ${c}.`);return l}function fe(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new a("Provide a valid launch transaction hash.");return l}function pe(l,c,y="minAmountOut"){let O=c.slippageBps??Ae;if(typeof O!="number")throw new a("Slippage must be an integer in basis points.");let V=ce(l.toString(),O),T=c[y]===void 0?BigInt(V):L(c[y],y,l===0n);if(T>l||l>0n&&T===0n||T>U)throw new a("The minimum output must be positive and no larger than the simulated output.");return T}var Me=l=>{let c=l.clientFor(x),y=(e,s,o,n)=>l.unsignedTx({to:e,data:s,value:o.toString(),chainId:x,description:n}),O=e=>{throw new a(l.plainError(e))};async function V(){if(await c.getChainId()!==x)throw new a("pools.trade requires Robinhood Chain 4663.")}async function T(e,s,o){let n=await l.preview(e,s),t=n.changes.map(({token:r,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,r.decimals)} ${re(r.symbol)} (${r.address}, chain ${r.chainId})`});return{txs:e,summary:[o,n.summary,...t].join(" ")}}async function Y(){return(await c.getBlock()).timestamp+600n}function M(e,s,o,n,t,r){let d=[$,e,2500,25,$],i=[D(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,s,o,n,0n,"0x"]]),D(q("address,uint256"),[s?$:e,o]),D(q("address,address,uint256"),[s?e:$,t,0n])],f=[D(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:f,encoded:D(q("bytes,bytes[],uint256"),["0x10",f,r])}}async function Z(e,s){let o=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:s,gas:ve(Ie),to:i.to,data:i.data,value:ve(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(o)||o.length!==1||!W(o[0])||!Array.isArray(o[0].calls)||o[0].calls.length!==e.length)throw new a("The output simulation returned a malformed response.");let n=o[0].calls;if(!n.slice(0,-1).every(i=>W(i)&&i.status==="0x1"&&!i.error))throw new a("A prerequisite failed during the output simulation.");let t=n.at(-1);if(!W(t)||t.status!=="0x0")throw new a("The output simulation did not return the expected minimum-output control.");let r=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:W(t.error)?t.error.data:void 0;if(typeof r!="string"||!/^0x[0-9a-fA-F]+$/.test(r))throw new a("The output simulation did not report an expected amount.");let d=He({abi:m,data:r});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==U||d.args[1]<=0n||d.args[1]>=U)throw new a("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ee=2e3;async function F(e,s,o,n=()=>!0){let t=await c.getBlockNumber(),r=t<R?0n:(t-R)/oe+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Re)throw new a("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(r*BigInt(j.length+(e&&!o?1:0)));let f=new Map,w=new Set;for(let u=R;u<=t&&n();u+=oe){let b=u+oe-1n>t?t:u+oe-1n,v=(await Promise.all(j.map(k=>c.getLogs({address:k,event:z[0],...s?{args:{token:s}}:{},fromBlock:u,toBlock:b,strict:!0})))).flat(),E=[...new Set(v.map(k=>k.transactionHash))].filter(k=>!k||!f.has(k));for(let k=0;k<E.length&&n();k+=8)await Promise.all(E.slice(k,k+8).map(async B=>{if(!B)throw new a("A launch log is missing its transaction hash.");let H=_.get(B);H||(i(),H=await c.getTransactionReceipt({hash:B}),_.size>=ee&&_.delete(_.keys().next().value),_.set(B,H)),f.set(B,H),n()&&await o?.(H)}));if(!n())break;if(e&&!o){let k=await c.getLogs({address:C,event:z[1],args:{to:e},fromBlock:u,toBlock:b,strict:!0});for(let B of k){let H=ie({abi:z,eventName:"Transfer",data:B.data,topics:B.topics}).args;w.add(H.tokenId.toString())}}}return{receipts:[...f.values()],feeIds:w}}async function P(e){let o=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:fe(e.launchTx)})]:(await F(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(se).filter(n=>e.positionId!==void 0?n.positionId===L(e.positionId,"positionId").toString():p(n.token,S(e.token)));if(o.length!==1)throw new a("No unique current-strategy launch was found. Older strategy generations are unsupported.");return o[0]}async function Se(e,s){if(typeof e.creatorFees!="boolean")throw new a("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),$)&&!p(S(e.pair),ae))throw new a("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new a("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&L(e.supply,"supply")!==ne)throw new a("Instant Launch requires a supply of one billion tokens.");let o=S(e.feeBeneficiary);if(p(o,$)||p(o,J))throw new a("The fee beneficiary must be a wallet other than the launcher or zero address.");let n=X(e.name,"name"),t=X(e.symbol,"symbol"),r=e.initialBuy===void 0?0n:L(e.initialBuy,"initialBuy",!0);if(r>U)throw new a("The initial buy exceeds uint128.");if(r===0n&&e.minAmountOut!==void 0)throw new a("A minimum output requires an initial buy.");let d=await c.readContract({address:J,abi:m,functionName:"getGraffiti",args:[s]}),i=S(await c.readContract({address:h.uerc20Factory.address,abi:m,functionName:"getUERC20Address",args:[n,t,18,J,d]})),f=await c.getCode({address:i});if(f&&f!=="0x")throw new a("This wallet already launched that name and symbol.");let w=D(q("(string,string,string,bytes)"),[[X(e.description,"description",!0),X(e.website,"website",!0),X(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?j[0]:j[1],b=[N({abi:m,functionName:"createToken",args:[h.uerc20Factory.address,n,t,18,ne,J,w]}),N({abi:m,functionName:"distributeToken",args:[i,{strategy:u,amount:ne,configData:D(q("address"),[o])},Ne]})],v=await Y(),G=k=>{let B=[...b];if(r>0n){let H=D(q("(address,address,bytes)"),[[de,s,M(i,!0,r,k,s,v).encoded]]);B.push(N({abi:m,functionName:"distributeWithNative",args:[h.universalRouterStrategyApp.address,H,Ne,r]}))}return y(J,N({abi:m,functionName:"multicall",args:[B]}),r,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${o}.`)},E=r>0n?pe(await Z([G(U)],s),e):0n;return T([G(E)],s,`Launch ${n} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${o}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${E} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Be(e,s,o){let n=L(e.amountIn,"amountIn");if(n>U)throw new a("The trade amount exceeds uint128.");let t=S(e.token);await P(e);let r=await Y(),d=[];o||(await c.readContract({address:t,abi:Q,functionName:"allowance",args:[s,h.permit2.address]})<n&&d.push(l.approval(t,h.permit2.address,n.toString(),x)),d.push(y(h.permit2.address,N({abi:m,functionName:"approve",args:[t,de,n,Number(r)]}),0n,`Permit the exact ${n} token base units until ${r}.`)));let i=u=>[...d,y(de,N({abi:m,functionName:"execute",args:["0x10",M(t,o,n,u,s,r).inputs,r]}),o?n:0n,`${o?"Buy":"Sell"} ${t} with minimum output ${u}.`)],f=await Z(i(U),s),w=pe(f,e);return T(i(w),s,`${o?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${n}, minimum output ${w} ${o?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function me(e,s,o){let n=await P(e),t=BigInt(n.positionId),r=n.creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,d=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[t]});if(!p(d,r))throw new a("The position is not locked in its current-strategy splitter.");if(!o)return T([y(r,N({abi:m,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],s,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!n.creatorFees)throw new a("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[t]});if(!p(i,s))throw new a("Only the current fee NFT holder is entitled to claim.");let f=await c.readContract({address:C,abi:m,functionName:"amounts",args:[t]}),w=pe(f[0],e,"minEth");if(f[1]!==0n)throw new a("The current buy-only creator fee configuration returned unexpected token fees.");return T([y(C,N({abi:m,functionName:"claim",args:[t,w,0n]}),0n,`Claim collected ETH fees for position ${t} to ${s}.`)],s,`Claim collected fees: ${f[0]} ETH base units (18 decimals), minimum ${w}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function $e(e,s){let o=await P(e),n=S(e.to);if(p(n,$))throw new a("The token recipient cannot be the zero address.");let t=L(e.amount,"amount"),r=await te(o.token,await c.getBlockNumber());return T([y(r.address,N({abi:Q,functionName:"transfer",args:[n,t]}),0n,`Transfer exactly ${t} ${re(r.symbol)} base units to ${n}.`)],s,`Transfer ${t} token base units (token ${r.address}, decimals ${r.decimals}, chain ${r.chainId}) to ${n}. No approval; no transaction sent.`)}async function Fe(e,s){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new a("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let o=e.positionIds.map(d=>L(d,"positionId").toString());if(new Set(o).size!==o.length)throw new a("Each position ID must appear once.");let n=e.launchTxs.map(fe),t=new Map;for(let[d,i]of o.entries()){let w=(await P({positionId:i,launchTx:n[d]})).creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,u=BigInt(i),b=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[u]});if(!p(b,w))throw new a("The position is not locked in its current-strategy splitter.");t.set(w,[...t.get(w)??[],u])}let r=[...t].map(([d,i])=>y(d,N({abi:m,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return T(r,s,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let K="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function te(e,s){let[o,n]=await Promise.all([c.readContract({address:e,abi:Q,functionName:"symbol",blockNumber:s}),c.readContract({address:e,abi:Q,functionName:"decimals",blockNumber:s})]);if(typeof o!="string"||!o||o.length>256||n!==18)throw new a("The current launch token returned invalid metadata.");return{address:e,symbol:o,decimals:n,chainId:x}}async function he(e,s,o,n){let t=n??await te(e.token,o),r=await c.readContract({address:t.address,abi:Q,functionName:"balanceOf",args:[s],blockNumber:o});return{token:t,amount:r.toString(),humanAmount:l.formatAmount(r.toString(),t.decimals)}}async function Pe(e,s){let o=await P(e),n=await c.getBlockNumber();return{wallet:s,...await he(o,s,n),blockNumber:n.toString(),coverage:K}}async function Le(e,s){let o=fe(e.launchTx),n=await c.getTransactionReceipt({hash:o}),t=se(n);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===L(e.positionId,"positionId").toString())),!t.length)throw new a("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let r=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let f=i.creatorFees?h.feeSplitterFeesOn.address:h.feeSplitterFeesOff.address,w=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:r});if(!p(w,f))throw new a("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:r}),approved:await c.readContract({address:C,abi:m,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:r}),collected:await c.readContract({address:C,abi:m,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:r})}:void 0,b=await te(i.token,r);return{...i,token:b,custodian:w,holding:await he(i,s,r,b),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:le,amount:u.collected[0].toString()},{token:b,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:o,wallet:s,creator:n.from,blockNumber:r.toString(),launches:d,coverage:K}}async function Oe(e){let s=await c.getBlockNumber(),o=e.limit??20;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>50)throw new a("limit must be an integer from 1 to 50.");let n=e.fromBlock===void 0?s>=R+ue?s-ue+1n:R:L(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?s:L(e.toBlock,"toBlock",!0),r=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new a("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),b=BigInt(u[0]),v=BigInt(u[1]);if(e.fromBlock!==void 0&&n!==b||e.toBlock!==void 0&&t!==v)throw new a("The cursor does not match this block range.");n=b,t=v,r=Number(u[2])}if(s<R&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:R.toString(),toBlock:s.toString(),coverage:K,predeployment:!0};if(n<R||t<n||t>s||t-n>=ue)throw new a("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:j,event:z[0],fromBlock:n,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new a("The launch feed returned an incomplete log.");if(d.sort((u,b)=>u.blockNumber===b.blockNumber?b.logIndex-u.logIndex:u.blockNumber>b.blockNumber?-1:1),r>d.length)throw new a("The browse cursor is outside the launch feed.");let i=new Map,f=[];for(let u of d.slice(r,r+o)){let b=u.transactionHash,v=i.get(b);v||(v=await c.getTransactionReceipt({hash:b}),i.set(b,v));let G=ie({abi:z,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,E=se(v).filter(k=>p(k.token,G.token)&&p(k.poolId,G.poolId));if(E.length!==1)throw new a("The launch feed log does not match one verified receipt launch.");f.push({...E[0],launchTx:b,blockNumber:u.blockNumber.toString(),token:await te(E[0].token,t),creator:v.from})}let w=r+o;return{launches:f,cursor:w<d.length?`${n}:${t}:${w}`:null,fromBlock:n.toString(),toBlock:t.toString(),coverage:K,previousToBlock:n>R?(n-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ge(e,s,o){let n=await P(e);if(!n.creatorFees)throw new a("Creator fees are permanently disabled for this position.");let t=BigInt(n.positionId),r=await c.readContract({address:h.v4PositionManager.address,abi:m,functionName:"ownerOf",args:[t]});if(!p(r,h.feeSplitterFeesOn.address))throw new a("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[t]});if(!p(d,s))throw new a("Only the current fee NFT holder can change this entitlement.");let i=S(o?e.to:e.spender);if(p(i,C)||o&&p(i,$))throw new a("The fee NFT recipient cannot be the vault or zero address.");let f=o?N({abi:m,functionName:"safeTransferFrom",args:[s,i,t]}):N({abi:m,functionName:"approve",args:[i,t]});return T([y(C,f,0n,o?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],s,o?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function Ee(){return{chainId:x,instant:{supported:!0,supply:ne.toString(),decimals:18,currency:le,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:K}}let g={type:"string"},I=Te(),we={chainId:{type:"integer",const:x},slippageBps:{type:"integer",minimum:0,maximum:9999}};function A(e,s,o,n){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...we,...s},required:o},execute:async(t,r)=>{try{let d=new Set([...Object.keys(we),...Object.keys(s)]);if(Object.keys(t).some(i=>!d.has(i)))throw new a("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==x)throw new a("pools.trade requires chain 4663.");if(S(r),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new a("Slippage must be an integer in basis points.");ce("10000",t.slippageBps)}return await V(),await n(t,r)}catch(d){O(d)}}}}return{tools:[A("launch",{name:g,symbol:g,creatorFees:{type:"boolean",description:"Permanent choice; must be explicit."},feeBeneficiary:g,pair:g,decimals:{type:"integer",const:18},supply:I,initialBuy:I,minAmountOut:I,description:g,website:g,imageUri:g},["name","symbol","creatorFees","feeBeneficiary"],Se),...["buy","sell"].map(e=>A(e,{token:g,amountIn:I,minAmountOut:I,launchTx:g},["token","amountIn"],(s,o)=>Be(s,o,e==="buy"))),A("collect",{positionId:I,launchTx:g},["positionId"],(e,s)=>me(e,s,!1)),A("claim",{positionId:I,launchTx:g,minEth:I},["positionId"],(e,s)=>me(e,s,!0)),A("browse",{fromBlock:I,toBlock:I,limit:{type:"integer",minimum:1,maximum:50},cursor:g},[],Oe),A("balance",{token:g,launchTx:g},["token"],Pe),A("status",{launchTx:g,token:g,positionId:I},["launchTx"],Le),A("launch_options",{},[],Ee),A("fee_transfer",{positionId:I,launchTx:g,to:g},["positionId","to"],(e,s)=>ge(e,s,!0)),A("fee_approve",{positionId:I,launchTx:g,spender:g},["positionId","spender"],(e,s)=>ge(e,s,!1)),A("transfer",{token:g,amount:I,to:g,launchTx:g},["token","amount","to"],$e),A("collect_many",{positionIds:{type:"array",items:I,minItems:1,maxItems:20},launchTxs:{type:"array",items:g,minItems:1,maxItems:20}},["positionIds","launchTxs"],Fe)],positions:async e=>{S(e);let s=[],o=0,n=!0,t,r=i=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:x,assets:[],incomplete:!0,description:`${i} Checked ${o} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),d=async()=>{await V(),n&&await F(e,void 0,async i=>{o++;for(let f of se(i)){if(!n)return;let w=f.creatorFees&&p(await c.readContract({address:C,abi:m,functionName:"ownerOf",args:[BigInt(f.positionId)]}),e);if(!n)return;if(!w&&!p(i.from,e))continue;let u=w?[{token:le,amount:(await c.readContract({address:C,abi:m,functionName:"amounts",args:[BigInt(f.positionId)]}))[0].toString()}]:[];n&&s.push({module:"poolstrade",id:f.positionId,chainId:x,assets:u,description:`Current Instant Launch ${f.token} (18 decimals, supply 1000000000), pool ${f.poolId}; creator fees ${f.creatorFees?"on":"off"} (permanent). ${w?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>n)};try{return await Promise.race([d().then(()=>!0),new Promise(f=>{t=setTimeout(()=>{n=!1,f(!1)},6e3)})])?s:[...s,r("Pools.trade global launch discovery reached its 6000 ms read budget; the historical scan is incomplete.")]}catch(i){return[...s,r(`Pools.trade discovery could not finish: ${l.plainError(i)}`)]}finally{n=!1,t!==void 0&&clearTimeout(t)}}}};function Qe(l){return xe("poolstrade",[Me(l)])}export{se as a,Me as b,Qe as c};
@@ -1 +1 @@
1
- import{a as m,b as c,f as h,g as d,h as i,i as u}from"./W76QC2AW.js";import{c as T,e as a}from"./5KUWLUPM.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as y,parseAbiParameters as g,zeroAddress as B}from"viem";var C={type:"object",properties:{pairedToken:T,startingTick:{type:"integer",minimum:-887272,maximum:887272},tickSpacing:{type:"integer",minimum:1,maximum:32767},positions:{type:"array",minItems:1,maxItems:7,items:{type:"object",properties:{tickLower:{type:"integer"},tickUpper:{type:"integer"},bps:{type:"integer",minimum:1,maximum:1e4}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3},maxFeeBps:{type:"integer",minimum:25,maximum:1e3},referenceTickFilterPeriod:c,resetPeriod:c,resetTickFilter:{type:"integer",minimum:-887272,maximum:887272},feeControlNumerator:c,decayFilterBps:{type:"integer",minimum:0,maximum:3e4}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function _(l){let r=l.pool??{};if(!a(r))throw new o("Provide pool configuration as an object.");u(r,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=h(r.pairedToken??m.paired_weth.address),b=i(r.startingTick??-230400,-887272,887272),f=i(r.tickSpacing??200,1,32767),n=r.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new o("Provide one to seven liquidity positions.");let p=n.map(e=>{if(!a(e))throw new o("Provide liquidity position objects.");u(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<b||t%f||s%f)throw new o("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(p.reduce((e,t)=>e+t.bps,0)!==1e4)throw new o("Liquidity position allocations must total 10000 bps.");let k=i(l.feeBps??100,0,1e3)*100,F=m.fee_static_hook_v2.address,P=y(g("uint24,uint24"),[k,k]),w=`Static LP fee ${k/100} bps`;if(r.dynamicFee!==void 0){let e=r.dynamicFee;if(!a(e)||l.feeBps!==void 0)throw new o("Provide dynamic fee configuration without a static feeBps override.");u(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);F=m.fee_dynamic_hook_v2.address,P=y(g("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),w=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:w,poolConfig:{hook:F,pairedToken:x,tickIfToken0IsClanker:b,tickSpacing:f,poolData:y(g("(address,bytes,bytes)"),[[B,"0x",P]])},tickLower:p.map(e=>e.lower),tickUpper:p.map(e=>e.upper),positionBps:p.map(e=>e.bps)}}export{C as a,_ as b};
1
+ import{a as m,b as c,f as h,g as d,h as i,i as u}from"./PV5FDT6O.js";import{c as T,e as a}from"./NWNYJ26T.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as y,parseAbiParameters as g,zeroAddress as B}from"viem";var C={type:"object",properties:{pairedToken:T,startingTick:{type:"integer",minimum:-887272,maximum:887272},tickSpacing:{type:"integer",minimum:1,maximum:32767},positions:{type:"array",minItems:1,maxItems:7,items:{type:"object",properties:{tickLower:{type:"integer"},tickUpper:{type:"integer"},bps:{type:"integer",minimum:1,maximum:1e4}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3},maxFeeBps:{type:"integer",minimum:25,maximum:1e3},referenceTickFilterPeriod:c,resetPeriod:c,resetTickFilter:{type:"integer",minimum:-887272,maximum:887272},feeControlNumerator:c,decayFilterBps:{type:"integer",minimum:0,maximum:3e4}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function _(l){let r=l.pool??{};if(!a(r))throw new o("Provide pool configuration as an object.");u(r,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=h(r.pairedToken??m.paired_weth.address),b=i(r.startingTick??-230400,-887272,887272),f=i(r.tickSpacing??200,1,32767),n=r.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new o("Provide one to seven liquidity positions.");let p=n.map(e=>{if(!a(e))throw new o("Provide liquidity position objects.");u(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<b||t%f||s%f)throw new o("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(p.reduce((e,t)=>e+t.bps,0)!==1e4)throw new o("Liquidity position allocations must total 10000 bps.");let k=i(l.feeBps??100,0,1e3)*100,F=m.fee_static_hook_v2.address,P=y(g("uint24,uint24"),[k,k]),w=`Static LP fee ${k/100} bps`;if(r.dynamicFee!==void 0){let e=r.dynamicFee;if(!a(e)||l.feeBps!==void 0)throw new o("Provide dynamic fee configuration without a static feeBps override.");u(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);F=m.fee_dynamic_hook_v2.address,P=y(g("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),w=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:w,poolConfig:{hook:F,pairedToken:x,tickIfToken0IsClanker:b,tickSpacing:f,poolData:y(g("(address,bytes,bytes)"),[[B,"0x",P]])},tickLower:p.map(e=>e.lower),tickUpper:p.map(e=>e.upper),positionBps:p.map(e=>e.bps)}}export{C as a,_ as b};
@@ -0,0 +1 @@
1
+ import{a as p,c as s}from"./4DP2VPXR.js";import{a}from"./SPJCSEKP.js";import{a as i}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";async function u(e,n,t){if(!Object.prototype.hasOwnProperty.call(p,e.name))throw new o("Local Chop guard cannot rebuild this action; nothing was signed.");if(e.chainId!==void 0&&e.chainId!==i)throw new o("Local Chop guard requires chain 4663; nothing was signed.");let r=async()=>{throw new o("Local Chop guard does not use HTTP, swaps or a preview service.")},d=a({clientFor:c=>{if(c!==i)throw new o("Local Chop guard requires chain 4663; nothing was signed.");return t.client},http:r,quoteSwap:r,buildSwap:r,preview:r});return(await s(d,e.name,e.args,n)).built}function g(e){return(n,t)=>u(n,t,e)}export{u as a,g as b};
@@ -1 +1 @@
1
- import{e as h}from"./WD37MEMZ.js";import{c as k}from"./MYFAKCQI.js";import{a as p}from"./5ZLOCQA4.js";import{i as u}from"./5KUWLUPM.js";import{a as n}from"./XSD5NL7J.js";var _="hoodlock_public",t="https://hoodlock.tech",f=["lp_locks","lp_lock","airdrop_history","airdrop_list","airdrop_list_by_root","featured","feature_tiers","buyback_status","referral_available","links"];function x(c){return{tools:[{name:_,inputSchema:{type:"object",properties:{route:{type:"string",enum:[...f]},id:p(),account:{type:"string"},token:{type:"string"},root:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},code:{type:"string",minLength:1,maxLength:64}},required:["route"],additionalProperties:!1},async execute(e,b){try{let i=String(e.route);if(!f.includes(i))throw new n("Choose a published HoodLock public read route.");let m=e.account??b,s=r=>u(r,"Provide a checksummed wallet or token address."),a=()=>h(e.id,"id").toString(),o;switch(i){case"links":{let r=e.id===void 0?void 0:a();return{source:t,links:{lockChecker:`${t}/lock-checker`,liquidityChecker:`${t}/liquidity-lock-checker`,burnChecker:`${t}/burn-checker`,vestingChecker:`${t}/vesting-checker`,embedDocs:`${t}/docs/embed`,badgeDocs:`${t}/docs/badge`,...e.token===void 0?{}:{token:`${t}/token/${s(e.token)}`},...r===void 0?{}:Object.fromEntries(["lock","burn","vesting","position"].map(l=>[l,`${t}/proof/${l}/${r}`]))},summary:"HoodLock-only records and integration links. Empty HoodLock results do not establish that no external locks or burns exist."}}case"lp_locks":o="/api/lp/locks";break;case"lp_lock":o=`/api/lp/lock/${a()}`;break;case"airdrop_history":o=`/api/airdrop/history?address=${s(m)}`;break;case"airdrop_list":o=`/api/airdrop/${a()}/list.json`;break;case"airdrop_list_by_root":if(typeof e.root!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.root))throw new n("Provide a bytes32 Merkle root.");o=`/api/airdrop/list-by-root/${e.root}.json`;break;case"featured":o="/api/featured";break;case"feature_tiers":o="/api/feature/tiers";break;case"referral_available":if(typeof e.code!="string"||e.code.length<1||e.code.length>64)throw new n("Provide a referral code with 1 to 64 characters.");o=`/api/aff/available?code=${encodeURIComponent(e.code)}`;break;default:o="/api/revenue/pool"}let d=`${t}${o}`,y=await k(c.http,d,{method:"GET",redirect:"error",signal:AbortSignal.timeout(1e4)},r=>r!==null&&typeof r=="object");return{source:d,data:y,untrusted:!0,summary:"Public off-chain HoodLock data. Verify custody, proofs, balances and authority on chain; API labels and indexes may lag. No transaction, authentication, payment or publication was performed."}}catch(i){throw new n(c.plainError(i))}}}]}}export{_ as a,x as b};
1
+ import{e as h}from"./OLSP46ZD.js";import{c as k}from"./VEQBHI6O.js";import{a as p}from"./66F5ZH34.js";import{i as u}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";var _="hoodlock_public",t="https://hoodlock.tech",f=["lp_locks","lp_lock","airdrop_history","airdrop_list","airdrop_list_by_root","featured","feature_tiers","buyback_status","referral_available","links"];function x(c){return{tools:[{name:_,inputSchema:{type:"object",properties:{route:{type:"string",enum:[...f]},id:p(),account:{type:"string"},token:{type:"string"},root:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},code:{type:"string",minLength:1,maxLength:64}},required:["route"],additionalProperties:!1},async execute(e,b){try{let i=String(e.route);if(!f.includes(i))throw new n("Choose a published HoodLock public read route.");let m=e.account??b,s=r=>u(r,"Provide a checksummed wallet or token address."),a=()=>h(e.id,"id").toString(),o;switch(i){case"links":{let r=e.id===void 0?void 0:a();return{source:t,links:{lockChecker:`${t}/lock-checker`,liquidityChecker:`${t}/liquidity-lock-checker`,burnChecker:`${t}/burn-checker`,vestingChecker:`${t}/vesting-checker`,embedDocs:`${t}/docs/embed`,badgeDocs:`${t}/docs/badge`,...e.token===void 0?{}:{token:`${t}/token/${s(e.token)}`},...r===void 0?{}:Object.fromEntries(["lock","burn","vesting","position"].map(l=>[l,`${t}/proof/${l}/${r}`]))},summary:"HoodLock-only records and integration links. Empty HoodLock results do not establish that no external locks or burns exist."}}case"lp_locks":o="/api/lp/locks";break;case"lp_lock":o=`/api/lp/lock/${a()}`;break;case"airdrop_history":o=`/api/airdrop/history?address=${s(m)}`;break;case"airdrop_list":o=`/api/airdrop/${a()}/list.json`;break;case"airdrop_list_by_root":if(typeof e.root!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.root))throw new n("Provide a bytes32 Merkle root.");o=`/api/airdrop/list-by-root/${e.root}.json`;break;case"featured":o="/api/featured";break;case"feature_tiers":o="/api/feature/tiers";break;case"referral_available":if(typeof e.code!="string"||e.code.length<1||e.code.length>64)throw new n("Provide a referral code with 1 to 64 characters.");o=`/api/aff/available?code=${encodeURIComponent(e.code)}`;break;default:o="/api/revenue/pool"}let d=`${t}${o}`,y=await k(c.http,d,{method:"GET",redirect:"error",signal:AbortSignal.timeout(1e4)},r=>r!==null&&typeof r=="object");return{source:d,data:y,untrusted:!0,summary:"Public off-chain HoodLock data. Verify custody, proofs, balances and authority on chain; API labels and indexes may lag. No transaction, authentication, payment or publication was performed."}}catch(i){throw new n(c.plainError(i))}}}]}}export{_ as a,x as b};
@@ -0,0 +1 @@
1
+ import{b as W}from"./AEL62KCG.js";import{c as K}from"./VEQBHI6O.js";import{d as N}from"./UNJJRQIU.js";import{g as S}from"./NWNYJ26T.js";import{a as j,b as M,c as O}from"./IX3GZMTM.js";import{a as q,i as z}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{a as $}from"./JXOEJPJ4.js";import{encodeAbiParameters as ce,encodeFunctionData as J,erc20Abi as V,getAddress as Z,isAddress as me,keccak256 as X,parseAbi as ue,parseAbiParameters as ye,zeroAddress as ee}from"viem";var x=q,C=Z(z[x].hoodlock.airdrop.address),oe="https://hoodlock.tech",P=25e4,ge=256,fe=604800n,pe=30n,Q=250000000000000000n,Y=0xffffffffn,be=(1n<<64n)-1n,ne=(1n<<128n)-1n,re="0x0000000000000000000000000000000000000000000000000000000000000000",xe="0x1111111111111111111111111111111111111111",Ae=ye("uint256, address, uint256"),T=ue(["function quote(uint32 maxClaims) view returns (uint256)","function create(address token, bytes32 merkleRoot, uint256 total, uint32 maxClaims, uint64 endTime, string uri) payable returns (uint256 id)","function claim(uint256 id, uint256 index, address account, uint256 amount, bytes32[] proof)","function getAirdrop(uint256 id) view returns (address creator, uint64 endTime, uint32 maxClaims, address token, uint32 claims, bool swept, bytes32 merkleRoot, uint128 total, uint128 remaining)","function isClaimed(uint256 id, uint256 index) view returns (bool)"]);function he(o,e,r){let n=e.trim();if(n.startsWith("-")){let t=n.slice(1);return`-${o.formatAmount(t,r)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,r)}function te(o,e){if(!e.changes.length)return e.summary;let r=e.changes.map(n=>`${he(o,n.amount,n.token.decimals)} ${$(n.token.symbol)}`).join(", ");return`${e.summary} (${r})`}async function we(o,e){try{let[r,n]=await Promise.all([o.readContract({address:e,abi:V,functionName:"symbol"}),o.readContract({address:e,abi:V,functionName:"decimals"})]),d=typeof r=="string"&&r.trim()?r.trim():"TOKEN",t=Number(n);return{symbol:d,decimals:Number.isInteger(t)&&t>=0&&t<=255?t:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,r){if(typeof e=="string"&&e.includes(".")){if(r?.decimals===void 0)throw new a(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=r.rounding!==void 0?O(e,r.decimals,r.rounding):o?o.parseAmount(e,r.decimals):O(e,r.decimals),t=M(d);if(t<=0n)throw new a("Airdrop entry amount must be positive.");return t}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=M(e.trim());else throw j()}catch(d){throw d instanceof a?d:new a(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new a("Airdrop entry amount must be strictly positive (> 0).");return n}function H(o,e){try{let r=typeof o=="bigint"?o:BigInt(String(o).trim());if(r<0n)throw new a(`${e} must be non-negative.`);return r}catch(r){throw r instanceof a?r:new a(`Invalid ${e}: ${String(o)}`,{cause:r})}}function A(o,e){if(typeof o!="string"||!me(o,{strict:!1}))throw new a(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return Z(o)}function L(o,e,r){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>Y)throw new a(`Airdrop leaf index must be in 0..${Y.toString()}.`);let d=A(e,"account"),t=w(void 0,r),s=ce(Ae,[n,d,t]);return X(X(s))}function ie(o,e){let r=o;for(let n of e)r=N(r,n);return r}function Ne(o){try{let e=L(o.index,o.account,o.amount),r=ie(e,o.proof);return S(r,o.root)}catch{return!1}}function U(o,e){if(!Array.isArray(o)||o.length===0)throw new a("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new a(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let r=[],n=0n;for(let i=0;i<o.length;i+=1){let l=o[i];if(!l)throw new a(`Missing airdrop entry at position ${i}.`);let c=l.index??i;if(!Number.isInteger(c)||c!==i)throw new a(`Airdrop entry index at position ${i} must be contiguous ${i} (got ${String(c)}).`);let u=A(l.account,`entries[${i}].account`),g=w(e?.context,l.amount,e);n+=g,r.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ne)throw new a("Airdrop total amount must be > 0 and fit in uint128.");let d=r.map(i=>L(i.index,i.account,i.amount)),t=[d];for(;t[t.length-1].length>1;){let i=t[t.length-1],l=[];for(let c=0;c<i.length;c+=2){let u=i[c],g=i[c+1];g===void 0?l.push(u):l.push(N(u,g))}t.push(l)}let s=t[t.length-1][0];if(s.toLowerCase()===re)throw new a("Computed Merkle root cannot be zero.");let f=t.length>1?t[1]:t[0],m=r.map((i,l)=>{let c=[],u=l;for(let g=0;g<t.length-1;g+=1){let y=t[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:i.index,account:i.account,amount:i.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:r.length,values:r.map(i=>[i.index,i.account,i.amount]),entries:r};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:r.length,entries:r,proofs:m,list:p}}function ke(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new a("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,t])=>({index:n,account:d,amount:t})),r=U(e);if(o.root&&!S(r.root,o.root))throw new a(`Rebuilt tree root ${r.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&r.maxClaims!==o.maxClaims)throw new a(`Rebuilt maxClaims (${r.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&r.totalAmount!==o.totalAmount)throw new a(`Rebuilt totalAmount (${r.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return r}async function ae(o,e){return K(o.http,e,{method:"GET"},r=>r!==null&&typeof r=="object")}async function $e(o,e,r){let n=A(e.token,"token");if(n===ee)throw new a("Airdrop token cannot be the zero address.");let d=U(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),t=e.maxClaims??d.maxClaims;if(!Number.isInteger(t)||t<1||t>P||t!==d.maxClaims)throw new a(`maxClaims (${String(t)}) must equal entries.length (${d.maxClaims}) and be in 1..${P}.`);let s=BigInt(d.totalAmount),f=e.total!==void 0?w(o,e.total,{decimals:e.decimals,rounding:e.rounding}):s;if(f<s)throw new a(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ne)throw new a("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ge)throw new a(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let i=e.endTime!==void 0?H(e.endTime,"endTime"):0n;if(i>be)throw new a("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new a(`Token ${n} has no contract code on chain ${x}.`);let u;if(i!==0n){let _=(await l.getBlock()).timestamp,B=e.inclusionMargin!==void 0?H(e.inclusionMargin,"inclusionMargin"):pe;if(B<=0n)throw new a("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let D=_+B,I=e.inclusionTime!==void 0?H(e.inclusionTime,"inclusionTime"):D;if(I<D)throw new a(`inclusionTime (${I.toString()}) must be after the already-mined block (${_.toString()}) with room for signing and inclusion (>= ${D.toString()}).`);u=I;let F=I+fe;if(i<F)throw new a(`endTime (${i.toString()}) is too short (window too short): must be 0 or at least inclusion time (${I.toString()}) + 604800 (7 days >= ${F.toString()}, after already-mined block.timestamp ${_.toString()}).`)}let g=await l.readContract({address:C,abi:T,functionName:"quote",args:[t]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>Q)throw new a(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${Q.toString()}).`);let b=o.formatAmount(y.toString(),W.decimals),h=o.approval(n,C,f.toString(),x),k=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"create",args:[n,d.root,f,t,i,m]}),value:y.toString(),description:`Create HoodLock airdrop (${t} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),v=[h,k],E=A(e.account??r??xe,"wallet"),R=await o.preview(v,E),le=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",se=`${te(o,R)}${le}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:t,endTime:i,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:v,preview:R,summary:se}}async function G(o,e,r,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==r)throw new a(`savedProof account (${m}) does not match claim account (${r}).`);return{index:n.savedProof.index,amount:w(o,n.savedProof.amount),proof:n.savedProof.proof}}if(n.proof!==void 0&&n.index!==void 0&&n.amount!==void 0){let m=Number(n.index);if(!Number.isInteger(m)||m<0)throw new a(`Invalid claim index: ${String(n.index)}`);return{index:m,amount:w(o,n.amount),proof:n.proof}}if(n.list||n.entries){let p=(n.list?ke(n.list):U(n.entries,{context:o})).proofs.find(i=>!(!S(i.account,r)||n.index!==void 0&&i.index!==Number(n.index)));if(!p)throw new a(`Account ${r} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${oe}/api/airdrop/${e.toString()}/proof?address=${r}`,t=await ae(o,d),s=t?.data??t;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new a(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${r}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new a(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function de(o,e){let r=o.clientFor(x),n=await r.readContract({address:C,abi:T,functionName:"getAirdrop",args:[e.id]}),[d,t,s,f,m,p,i,,l]=n,c=BigInt(t),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===ee||i.toLowerCase()===re)throw new a(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new a(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await r.getBlock()).timestamp>=c)throw new a(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new a(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([r.readContract({address:C,abi:T,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),we(r,b)]);if(h)throw new a(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new a(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let v=L(e.index,e.account,e.amount),E=ie(v,e.proof);if(!S(E,i))throw new a(`Computed Merkle root ${E} does not match on-chain airdrop root ${i} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:i,leaf:v}}async function Se(o,e){let{tokenAddress:r,tokenMeta:n,merkleRoot:d,leaf:t}=await de(o,e),s=e.caller??e.account,f=!S(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"claim",args:[e.id,BigInt(e.index),e.account,e.amount,[...e.proof]]}),value:"0",description:f?`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for recipient ${e.account} (caller ${s} pays gas only, token delta 0)`:`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for ${e.account}`}),i=[p],l=await o.preview(i,s),c,u,g=e.amount.toString(),y;if(f){let b=l.changes.filter(h=>h.amount.trim().startsWith("-"));c={...l,changes:b,summary:`${l.summary} Recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units); caller ${s} change is 0 (gas only).`},u=`Third-party claim from HoodLock airdrop #${e.id.toString()} (index ${e.index}): recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}); caller ${s} own token change is 0 (gas only). ${l.summary}`,y="0"}else c=l,u=`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${te(o,c)}`,y=e.amount.toString();return{kind:"hoodlock_airdrop_claim",chainId:x,id:e.id,index:e.index,account:e.account,recipient:e.account,caller:e.caller,token:r,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:t,merkleRoot:d,proof:[...e.proof],tx:p,txs:i,preview:c,summary:u}}async function Ce(o,e,r){let n=A(e.account??r??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):r!==void 0?A(r,"wallet"):void 0;if(e.id!==void 0){let l=H(e.id,"id"),c=await G(o,l,n,e);return Se(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let t=`${oe}/api/airdrop/eligible?address=${n}`,s=await ae(o,t),f=Array.isArray(s)?s:s?.claimable??s?.eligible??s?.airdrops??s?.claims??[],m=[];for(let l of f){let c=l.id??l.airdropId;if(c!==void 0)try{let u=H(c,"eligible.id"),g,y,b;if(l.index!==void 0&&l.amount!==void 0&&Array.isArray(l.proof))g=Number(l.index),y=w(o,l.amount),b=l.proof;else{let k=await G(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await de(o,{id:u,index:g,account:n,amount:y,proof:b});m.push({id:u.toString(),index:g,account:n,token:h.tokenAddress,amount:y.toString(),proof:[...b],merkleRoot:h.merkleRoot})}catch{continue}}let p=m.length===0?`No verified eligible HoodLock airdrops were returned by the index for ${n}. Discovery can lag after creation; this does not prove there are no claims. If you know the airdrop id, call hoodlock_airdrop_claim with id and account to resolve its list/proof and verify it on-chain.`:`Found ${m.length} eligible HoodLock airdrop(s) for ${n}: ${m.map(l=>`#${l.id}`).join(", ")}. Discovery can lag after creation. Choose an id, or pass a known new id, to hoodlock_airdrop_claim to verify and build a claim transaction.`;return{kind:"hoodlock_airdrop_eligible",chainId:x,account:n,recipient:n,caller:d,recipientDelta:"0",senderDelta:"0",eligible:m,claims:[],tx:void 0,txs:[],preview:{txs:[],changes:[],summary:p},summary:p}}var ve=o=>({tools:[{name:"hoodlock_airdrop_create",inputSchema:{type:"object",required:["token","entries"],additionalProperties:!1,properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663"},entries:{type:"array",description:"Ordered airdrop entries [{ index?, account, amount }] with base-unit integer string amounts"},total:{type:"string",description:"Optional total funded token amount as a base-unit integer string (>= sum of entries)"},maxClaims:{type:"number",description:"Optional claim count (must equal entries.length in 1..250000)"},endTime:{type:"number",description:"Unix timestamp in seconds (0 for non-sweepable or >= inclusion time + 604800)"},inclusionTime:{type:"number",description:"Optional expected transaction inclusion Unix timestamp in seconds (> already-mined block.timestamp)"},inclusionMargin:{type:"number",description:"Optional signing and inclusion margin in seconds above the already-mined block.timestamp (>= 1, default 30)"},uri:{type:"string",description:"Metadata URI (<= 256 UTF-8 bytes)"},decimals:{type:"number",description:"Optional token decimals when converting human decimal entry amounts via parseAmount"},rounding:{type:"string",enum:["floor","ceil"],description:"Optional rounding mode (floor or ceil) when converting decimal amounts"},account:{type:"string",description:"Optional creator wallet address for preview simulation"}}},execute:async(e,r)=>$e(o,e,r)},{name:"hoodlock_airdrop_claim",inputSchema:{type:"object",required:["account"],additionalProperties:!1,properties:{id:{type:"string",description:"Optional airdrop ID (omit to query eligible airdrops)"},account:{type:"string",description:"Leaf recipient address that receives the tokens"},caller:{type:"string",description:"Optional caller/relayer address submitting the tx (pays gas only, receives 0 tokens)"},index:{type:"number",description:"Optional leaf index when supplying proof directly or selecting from list/entries"},amount:{type:"string",description:"Optional leaf amount as a base-unit integer string"},proof:{type:"array",items:{type:"string"},description:"Optional Merkle sibling proof array of 32-byte hex strings"},savedProof:{type:"object",description:"Optional saved proof item ({ index, account, amount, leaf?, proof }) from hoodlock_airdrop_create"},list:{type:"object",description:"Optional saved airdrop list ({ format, leafEncoding, root, totalAmount, maxClaims, values, entries }) to rebuild proof locally"},entries:{type:"array",description:"Optional airdrop entries array ([{ index?, account, amount }]) to rebuild proof locally"}}},execute:async(e,r)=>Ce(o,e,r)}]}),Le=ve;export{V as a,x as b,C as c,oe as d,P as e,ge as f,fe as g,pe as h,Q as i,T as j,he as k,L as l,ie as m,Ne as n,U as o,ke as p,ve as q,Le as r};
@@ -0,0 +1 @@
1
+ import{c as a}from"./PAY5PD4H.js";import{createHash as c}from"node:crypto";async function u(i,d){let e;try{e=await a(d,{token:i})}catch{e={status:"unchecked",reason:"unsupported_token"}}let n="reason"in e&&["invalid_signature","identity_or_scope_mismatch","bundle_mismatch","record_mismatch"].includes(e.reason),t=n||e.status==="verified"&&"verdict"in e&&e.verdict==="flagged"?"flagged":e.status==="verified"&&"verdict"in e&&e.verdict==="clean_by_rules"?"verified metadata":"no current verdict",r=`wormhole-token-${c("sha256").update(JSON.stringify({token:i,evidence:e})).digest("hex")}`;return{verdict:t,sentence:`Agent Wormhole: ${t} (${n?"metadata evidence failed verification":t==="flagged"?"the signed metadata snapshot was flagged":t==="verified metadata"?"signed snapshot checked; current displayed text is not bound":"a current signed snapshot could not be verified"}). This is not proof of safety.`,evidenceBlockId:r,evidence:e}}export{u as a};
@@ -1 +1 @@
1
- import{b as T}from"./WIVYKLQM.js";import{c as A}from"./DVVFT42J.js";import{i as b}from"./IMRXZ7JB.js";import{j as P}from"./S2TAJHHK.js";import{a as f,i as g}from"./FWD4L3CJ.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};
1
+ import{b as T}from"./52ELWNXJ.js";import{c as A}from"./MRMR4QHA.js";import{i as b}from"./Q42YI3EP.js";import{j as P}from"./7KWZ5QJU.js";import{a as f,i as g}from"./FWD4L3CJ.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};
@@ -1 +1 @@
1
- import{a as E}from"./PBQSJSZO.js";import{c as N}from"./MYFAKCQI.js";import{c as C,e as u,g as I}from"./5KUWLUPM.js";import{a as m}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{getAddress as k}from"viem";var D="https://api.velora.xyz/v2/delta",A=["PENDING","AWAITING_SIGNATURE","ACTIVE","SUSPENDED","CANCELLING","BRIDGING","COMPLETED","FAILED","EXPIRED","REFUNDING","CANCELLED","REFUNDED"],T=["Order","FillableOrder","ProductiveOrder","ExternalOrder","TWAPOrder","TWAPBuyOrder"],x="^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";function i(e){if(!e)throw new y("Velora Delta returned an unexpected response.")}function h(e){if(typeof e!="string")throw new y("Provide an address.");return E(e),k(e)}function O(e,p,o){if(e===void 0)return o;if(typeof e!="number"||!Number.isSafeInteger(e)||e<1||e>p)throw new y(`Provide an integer between 1 and ${p}.`);return e}function b(e,p){if(typeof e!="string"||!p.includes(e))throw new y(`Choose one of: ${p.join(", ")}.`);return e}function w(e){i(u(e)&&Number.isSafeInteger(e.chainId)&&Number(e.chainId)>0);let p=h(e.token);for(let o of["amount","expectedAmount","executedAmount"])i(e[o]===void 0||e[o]===null||typeof e[o]=="string"&&/^(0|[1-9][0-9]*)$/.test(e[o])&&BigInt(e[o])<1n<<256n);return i(typeof e.amount=="string"||typeof e.expectedAmount=="string"),{chainId:e.chainId,token:p,...Object.fromEntries(["amount","expectedAmount","executedAmount"].filter(o=>e[o]!==void 0).map(o=>[o,e[o]]))}}function P(e,p,o){i(u(e)&&typeof e.id=="string"&&new RegExp(x).test(e.id)),i(o===void 0||I(e.id,o));let l=h(e.owner);i(I(l,p)),i(typeof e.status=="string"&&A.includes(e.status)),i(e.side==="SELL"||e.side==="BUY"),i(e.type==="MARKET"||e.type==="LIMIT"),i(typeof e.onChainOrderType=="string"&&T.includes(e.onChainOrderType));let t=w(e.input);i(t.chainId===m);let a=w(e.output);i(typeof e.orderHash=="string"&&/^0x[0-9a-fA-F]{64}$/.test(e.orderHash)),i(Array.isArray(e.transactions)&&Array.isArray(e.refunds));for(let n of e.transactions){i(u(n)&&typeof n.originTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.originTx)),i(n.destinationTx===void 0||n.destinationTx===null||typeof n.destinationTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.destinationTx)),i(typeof n.filledPercent=="number"&&Number.isFinite(n.filledPercent)&&n.filledPercent>=0&&n.filledPercent<=100);for(let d of["spentAmount","receivedAmount"])i(n[d]===void 0||n[d]===null||typeof n[d]=="string"&&/^(0|[1-9][0-9]*)$/.test(n[d]))}let r=e.refunds.map(n=>(i(u(n)&&typeof n.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.tx)),{...w(n),tx:n.tx}));return{id:e.id,status:e.status,side:e.side,type:e.type,onChainOrderType:e.onChainOrderType,owner:l,beneficiary:h(e.beneficiary),orderHash:e.orderHash,input:t,output:a,transactions:structuredClone(e.transactions),refunds:r,...Object.fromEntries(["createdAt","updatedAt","expiresAt"].filter(n=>typeof e[n]=="string").map(n=>[n,e[n]]))}}function L(e){function p(t,a,r,n){return{name:t,inputSchema:{type:"object",additionalProperties:!1,properties:a,required:r},execute:async(d,s)=>{try{h(s);for(let c of Object.keys(d))if(!Object.hasOwn(a,c))throw new y(`Unsupported ${t} argument: ${c}.`);return await n(d,s)}catch(c){throw new y(e.plainError(c))}}}}let o=t=>N(e.http,`${D}/${t}`,{method:"GET"},u),l="Provider activity is not receipt proof. Token amounts are base units; resolve symbols and decimals with find_token. Delta signing and submission are not enabled in Oak.";return[p("velora_delta_token_support",{token:C},["token"],async t=>{let a=h(t.token),r=await o(`prices/is-token-supported?${new URLSearchParams({chainId:String(m),token:a})}`);return i(typeof r.supported=="boolean"),{token:a,chainId:m,supported:r.supported}}),p("velora_delta_orders",{page:{type:"integer",minimum:1},limit:{type:"integer",minimum:1,maximum:1e3},type:{type:"string",enum:["MARKET","LIMIT"]},status:{type:"array",minItems:1,maxItems:A.length,items:{type:"string",enum:A}},onChainOrderType:{type:"string",enum:T.filter(t=>t!=="FillableOrder")}},[],async(t,a)=>{let r=O(t.page,Number.MAX_SAFE_INTEGER,1),n=O(t.limit,1e3,100),d=new URLSearchParams({userAddress:a,chainId:String(m),page:String(r),limit:String(n)});if(t.type!==void 0&&d.set("type",b(t.type,["MARKET","LIMIT"])),t.onChainOrderType!==void 0&&d.set("onChainOrderType",b(t.onChainOrderType,T.filter(f=>f!=="FillableOrder"))),t.status!==void 0){if(!Array.isArray(t.status)||!t.status.length||t.status.length>A.length)throw new y("Provide a nonempty list of Delta statuses.");d.set("status",t.status.map(f=>b(f,A)).join(","))}let s=await o(`orders?${d}`);i(Array.isArray(s.data)&&s.data.length<=n),i(s.page===r&&s.limit===n&&Number.isSafeInteger(s.total)&&Number(s.total)>=0&&typeof s.hasMore=="boolean");let c=(r-1)*n+s.data.length;i(Number.isSafeInteger(c)&&c<=Math.max(Number(s.total),(r-1)*n)),i(s.hasMore===c<Number(s.total)&&(!s.hasMore||s.data.length>0));let g=s.data.map(f=>P(f,a));return i(new Set(g.map(f=>f.id.toLowerCase())).size===g.length),i(g.every(f=>(t.type===void 0||f.type===t.type)&&(t.onChainOrderType===void 0||f.onChainOrderType===t.onChainOrderType)&&(t.status===void 0||t.status.includes(f.status)))),{data:g,total:s.total,page:r,limit:n,hasMore:s.hasMore,notice:l}}),p("velora_delta_order",{orderId:{type:"string",pattern:x}},["orderId"],async(t,a)=>{if(typeof t.orderId!="string"||!new RegExp(x).test(t.orderId))throw new y("Provide a Delta order UUID.");let r=await o(`orders/${t.orderId}`);return{order:P(r,a,t.orderId),notice:l}}),p("velora_delta_bridge_routes",{},[],async()=>{let t=await o("prices/bridge-routes");i(Array.isArray(t.routes));let a=t.routes.map(r=>(i(u(r)&&Number.isSafeInteger(r.srcChainId)&&Number(r.srcChainId)>0&&Number.isSafeInteger(r.destChainId)&&Number(r.destChainId)>0&&Array.isArray(r.tokens)),{srcChainId:r.srcChainId,destChainId:r.destChainId,tokens:r.tokens.map(h)})).filter(r=>r.srcChainId===m||r.destChainId===m);return{chainId:m,routes:a,executionAvailable:!1}}),p("velora_delta_bridge_protocols",{},[],async()=>{let t=await o("prices/bridge-protocols");return i(Array.isArray(t.bridgeProtocols)),{bridgeProtocols:t.bridgeProtocols.map(r=>(i(u(r)&&typeof r.protocol=="string"&&typeof r.displayName=="string"),{protocol:r.protocol,displayName:r.displayName})),executionAvailable:!1}}),p("velora_delta_strategies",{},[],async()=>{let t=await o(`prices/strategies/${m}`),a=Object.entries(t).map(([r,n])=>(i(u(n)&&Array.isArray(n.strategies)),{underlying:h(r),address:h(n.address),strategies:n.strategies.map(d=>{i(u(d)&&typeof d.name=="string");let s=d.apr;return i(s===null||u(s)&&["gross","net"].every(c=>typeof s[c]=="string"&&/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(s[c]))),{vault:h(d.vault),name:d.name,apr:structuredClone(d.apr)}})}));return{chainId:m,strategies:a,executionAvailable:!1,notice:"APRs are provider estimates refreshed every three hours, not promised returns. Verify each vault and its exit before depositing."}})]}export{L as a};
1
+ import{a as E}from"./43LI5NKJ.js";import{c as N}from"./VEQBHI6O.js";import{c as C,e as u,g as I}from"./NWNYJ26T.js";import{a as m}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{getAddress as k}from"viem";var D="https://api.velora.xyz/v2/delta",A=["PENDING","AWAITING_SIGNATURE","ACTIVE","SUSPENDED","CANCELLING","BRIDGING","COMPLETED","FAILED","EXPIRED","REFUNDING","CANCELLED","REFUNDED"],T=["Order","FillableOrder","ProductiveOrder","ExternalOrder","TWAPOrder","TWAPBuyOrder"],x="^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";function i(e){if(!e)throw new y("Velora Delta returned an unexpected response.")}function h(e){if(typeof e!="string")throw new y("Provide an address.");return E(e),k(e)}function O(e,p,o){if(e===void 0)return o;if(typeof e!="number"||!Number.isSafeInteger(e)||e<1||e>p)throw new y(`Provide an integer between 1 and ${p}.`);return e}function b(e,p){if(typeof e!="string"||!p.includes(e))throw new y(`Choose one of: ${p.join(", ")}.`);return e}function w(e){i(u(e)&&Number.isSafeInteger(e.chainId)&&Number(e.chainId)>0);let p=h(e.token);for(let o of["amount","expectedAmount","executedAmount"])i(e[o]===void 0||e[o]===null||typeof e[o]=="string"&&/^(0|[1-9][0-9]*)$/.test(e[o])&&BigInt(e[o])<1n<<256n);return i(typeof e.amount=="string"||typeof e.expectedAmount=="string"),{chainId:e.chainId,token:p,...Object.fromEntries(["amount","expectedAmount","executedAmount"].filter(o=>e[o]!==void 0).map(o=>[o,e[o]]))}}function P(e,p,o){i(u(e)&&typeof e.id=="string"&&new RegExp(x).test(e.id)),i(o===void 0||I(e.id,o));let l=h(e.owner);i(I(l,p)),i(typeof e.status=="string"&&A.includes(e.status)),i(e.side==="SELL"||e.side==="BUY"),i(e.type==="MARKET"||e.type==="LIMIT"),i(typeof e.onChainOrderType=="string"&&T.includes(e.onChainOrderType));let t=w(e.input);i(t.chainId===m);let a=w(e.output);i(typeof e.orderHash=="string"&&/^0x[0-9a-fA-F]{64}$/.test(e.orderHash)),i(Array.isArray(e.transactions)&&Array.isArray(e.refunds));for(let n of e.transactions){i(u(n)&&typeof n.originTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.originTx)),i(n.destinationTx===void 0||n.destinationTx===null||typeof n.destinationTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.destinationTx)),i(typeof n.filledPercent=="number"&&Number.isFinite(n.filledPercent)&&n.filledPercent>=0&&n.filledPercent<=100);for(let d of["spentAmount","receivedAmount"])i(n[d]===void 0||n[d]===null||typeof n[d]=="string"&&/^(0|[1-9][0-9]*)$/.test(n[d]))}let r=e.refunds.map(n=>(i(u(n)&&typeof n.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.tx)),{...w(n),tx:n.tx}));return{id:e.id,status:e.status,side:e.side,type:e.type,onChainOrderType:e.onChainOrderType,owner:l,beneficiary:h(e.beneficiary),orderHash:e.orderHash,input:t,output:a,transactions:structuredClone(e.transactions),refunds:r,...Object.fromEntries(["createdAt","updatedAt","expiresAt"].filter(n=>typeof e[n]=="string").map(n=>[n,e[n]]))}}function L(e){function p(t,a,r,n){return{name:t,inputSchema:{type:"object",additionalProperties:!1,properties:a,required:r},execute:async(d,s)=>{try{h(s);for(let c of Object.keys(d))if(!Object.hasOwn(a,c))throw new y(`Unsupported ${t} argument: ${c}.`);return await n(d,s)}catch(c){throw new y(e.plainError(c))}}}}let o=t=>N(e.http,`${D}/${t}`,{method:"GET"},u),l="Provider activity is not receipt proof. Token amounts are base units; resolve symbols and decimals with find_token. Delta signing and submission are not enabled in Oak.";return[p("velora_delta_token_support",{token:C},["token"],async t=>{let a=h(t.token),r=await o(`prices/is-token-supported?${new URLSearchParams({chainId:String(m),token:a})}`);return i(typeof r.supported=="boolean"),{token:a,chainId:m,supported:r.supported}}),p("velora_delta_orders",{page:{type:"integer",minimum:1},limit:{type:"integer",minimum:1,maximum:1e3},type:{type:"string",enum:["MARKET","LIMIT"]},status:{type:"array",minItems:1,maxItems:A.length,items:{type:"string",enum:A}},onChainOrderType:{type:"string",enum:T.filter(t=>t!=="FillableOrder")}},[],async(t,a)=>{let r=O(t.page,Number.MAX_SAFE_INTEGER,1),n=O(t.limit,1e3,100),d=new URLSearchParams({userAddress:a,chainId:String(m),page:String(r),limit:String(n)});if(t.type!==void 0&&d.set("type",b(t.type,["MARKET","LIMIT"])),t.onChainOrderType!==void 0&&d.set("onChainOrderType",b(t.onChainOrderType,T.filter(f=>f!=="FillableOrder"))),t.status!==void 0){if(!Array.isArray(t.status)||!t.status.length||t.status.length>A.length)throw new y("Provide a nonempty list of Delta statuses.");d.set("status",t.status.map(f=>b(f,A)).join(","))}let s=await o(`orders?${d}`);i(Array.isArray(s.data)&&s.data.length<=n),i(s.page===r&&s.limit===n&&Number.isSafeInteger(s.total)&&Number(s.total)>=0&&typeof s.hasMore=="boolean");let c=(r-1)*n+s.data.length;i(Number.isSafeInteger(c)&&c<=Math.max(Number(s.total),(r-1)*n)),i(s.hasMore===c<Number(s.total)&&(!s.hasMore||s.data.length>0));let g=s.data.map(f=>P(f,a));return i(new Set(g.map(f=>f.id.toLowerCase())).size===g.length),i(g.every(f=>(t.type===void 0||f.type===t.type)&&(t.onChainOrderType===void 0||f.onChainOrderType===t.onChainOrderType)&&(t.status===void 0||t.status.includes(f.status)))),{data:g,total:s.total,page:r,limit:n,hasMore:s.hasMore,notice:l}}),p("velora_delta_order",{orderId:{type:"string",pattern:x}},["orderId"],async(t,a)=>{if(typeof t.orderId!="string"||!new RegExp(x).test(t.orderId))throw new y("Provide a Delta order UUID.");let r=await o(`orders/${t.orderId}`);return{order:P(r,a,t.orderId),notice:l}}),p("velora_delta_bridge_routes",{},[],async()=>{let t=await o("prices/bridge-routes");i(Array.isArray(t.routes));let a=t.routes.map(r=>(i(u(r)&&Number.isSafeInteger(r.srcChainId)&&Number(r.srcChainId)>0&&Number.isSafeInteger(r.destChainId)&&Number(r.destChainId)>0&&Array.isArray(r.tokens)),{srcChainId:r.srcChainId,destChainId:r.destChainId,tokens:r.tokens.map(h)})).filter(r=>r.srcChainId===m||r.destChainId===m);return{chainId:m,routes:a,executionAvailable:!1}}),p("velora_delta_bridge_protocols",{},[],async()=>{let t=await o("prices/bridge-protocols");return i(Array.isArray(t.bridgeProtocols)),{bridgeProtocols:t.bridgeProtocols.map(r=>(i(u(r)&&typeof r.protocol=="string"&&typeof r.displayName=="string"),{protocol:r.protocol,displayName:r.displayName})),executionAvailable:!1}}),p("velora_delta_strategies",{},[],async()=>{let t=await o(`prices/strategies/${m}`),a=Object.entries(t).map(([r,n])=>(i(u(n)&&Array.isArray(n.strategies)),{underlying:h(r),address:h(n.address),strategies:n.strategies.map(d=>{i(u(d)&&typeof d.name=="string");let s=d.apr;return i(s===null||u(s)&&["gross","net"].every(c=>typeof s[c]=="string"&&/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(s[c]))),{vault:h(d.vault),name:d.name,apr:structuredClone(d.apr)}})}));return{chainId:m,strategies:a,executionAvailable:!1,notice:"APRs are provider estimates refreshed every three hours, not promised returns. Verify each vault and its exit before depositing."}})]}export{L as a};
@@ -1 +1 @@
1
- import{a as k}from"./A3PN3PK3.js";import{g as P}from"./5KUWLUPM.js";import{a as b}from"./FWD4L3CJ.js";import{a as t}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{getAddress as w,parseAbi as L}from"viem";var v={one_hour:3600n,six_hours:21600n,one_day:86400n,seven_days:604800n,thirty_days:2592000n,ninety_days:7776000n,one_year:31536000n},g=L(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewRedeem(uint256) view returns (uint256)"]);async function C(u,o,i){let a=0n,s=i.number,e=await u.getBlock({blockNumber:a});if(e.timestamp>o)throw new t("Longbow has insufficient chain history for this window.");for(let n=0;a+1n<s&&n<64;n++){let r=(a+s)/2n,c=await u.getBlock({blockNumber:r});if(c.number!==r||c.timestamp<e.timestamp||c.timestamp>i.timestamp)throw new t("Longbow historical block response is inconsistent.");c.timestamp<=o?(a=r,e=c):s=r}if(a+1n<s||e.number!==a)throw new t("Longbow historical block search exceeded its bound.");return e}async function _(u,o,i,a="six_hours"){let s=v[a];if(!Object.hasOwn(v,a)||!s)throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let e=u.clientFor(b);if(await e.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let n=await e.getBlock({blockTag:"latest"});if(n.number===null||n.timestamp<s)throw new t("Longbow has insufficient chain history for this window.");let r=await C(e,n.timestamp-s,{number:n.number,timestamp:n.timestamp}),c=10n**27n,d=await Promise.all([r,n].map(async m=>{let[S,N,Y,f]=await Promise.all([e.readContract({address:o,abi:g,functionName:"asset",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:i.address,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"previewRedeem",args:[c],blockNumber:m.number})]);if(w(S)!==w(i.address)||N!==18||Y!==i.decimals||typeof f!="bigint"||f<0n||f>=1n<<256n)throw new t("Longbow historical share price or token metadata is unavailable or invalid. No zero rate was inferred.");return f})),h=n.timestamp-r.timestamp;if(h<=0n||h>s+300n)throw new t("Longbow historical blocks do not cover the requested APY window within 300 seconds.");if(d[0]===0n)throw new t("Longbow starting share price is zero; a realized APY cannot be calculated.");let l=Number(d[1]-d[0])/Number(d[0]),p=Math.expm1(Math.log1p(l)*31536e3/Number(h));if(!Number.isFinite(p))throw new t("Longbow annualized share-price change is outside the supported numeric range.");let y=await k(e,o,n.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},source:"Oak-computed on-chain",view:"apy",stale:!1,window:{lookback:a,requestedSeconds:s.toString(),elapsedSeconds:h.toString(),fromTimestamp:r.timestamp.toString(),toTimestamp:n.timestamp.toString(),fromBlock:r.number.toString(),toBlock:n.number.toString()},sharePrice:{shareUnits:c.toString(),startAssets:d[0].toString(),endAssets:d[1].toString(),assetDecimals:i.decimals},data:{annualYieldFraction:String(p),annualYieldPercent:String(p*100),lookback:a,basis:"Oak-computed realized APY: (end share price / start share price)^(31536000 / elapsed seconds) - 1, using ERC-4626 previewRedeem at two pinned blocks."},caveat:"Historical share-price change includes what the vault accounts for in previewRedeem, excludes external rewards and gas, and is not a promised return. Archive RPC history is required; missing history is not zero APY."}}async function I(u,o,i,a){if(Object.keys(a).some(d=>!["view","lookback"].includes(d)))throw new t("Longbow APY takes a lookback, not pagination.");let s=a.lookback??"six_hours";if(typeof s!="string"||!Object.hasOwn(v,s))throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let[e,n]=await Promise.allSettled([O(u,o,i,{view:"published_apy"}),_(u,o,i,s)]),r=e.status==="fulfilled"&&!e.value.stale?e.value:void 0;if(!r&&n.status==="rejected")throw new t(`Longbow APY is unavailable: the vendor figure is unavailable or stale, and the on-chain window could not be measured. ${u.plainError(n.reason)}`);return{...r??(n.status==="fulfilled"?n.value:void 0),view:"apy",shown:r?"Longbow vendor":"Oak-computed on-chain",realized:n.status==="fulfilled"?n.value:null,published:e.status==="fulfilled"?e.value:null,warnings:[...r?[]:["Longbow vendor APY is unavailable or stale; showing Oak-computed realized APY."],...n.status==="rejected"?["Oak-computed APY is unavailable: the archive RPC window could not be measured."]:[]]}}async function O(u,o,i,a){if(Object.keys(a).some(m=>m!=="view")||a.view!=="published_apy")throw new t("published_apy takes no historical lookback, cursor or limit.");let s=u.clientFor(b);if(await s.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let[e,n]=await Promise.all([s.getBlock(),s.readContract({address:o,abi:L(["function asset() view returns (address)"]),functionName:"asset"})]);if(w(n)!==w(i.address))throw new t("Longbow vault does not use the pinned asset.");let r="https://longbow.credit/api/v2/vaults",c=await u.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(15e3)});if(!c.ok)throw new t(`Longbow published APY HTTP ${c.status}; the rate is unavailable.`);let d=await c.json();if(!d||typeof d!="object"||!Number.isSafeInteger(d.asOf)||Number(d.asOf)<0||!Array.isArray(d.vaults)||d.vaults.length>100)throw new t("Longbow published APY response has an invalid timestamp or vault inventory.");let h=d.vaults.filter(m=>m&&typeof m=="object"&&typeof m.address=="string"&&P(String(m.address),o));if(h.length!==1)throw new t("Longbow published APY omitted or duplicated this vault; no zero rate is inferred.");let l=h[0];if(l.error||typeof l.asset!="string"||w(l.asset)!==w(i.address)||l.decimals!==i.decimals||typeof l.apy!="number"||!Number.isFinite(l.apy)||l.apy<-100||typeof l.apyBasis!="string"||l.apyBasis.length>64)throw new t("Longbow published APY asset, units, basis or rate is invalid.");let p=BigInt(Number(d.asOf)),y=await k(s,o,e.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},sourceUrl:r,view:"published_apy",asOf:p.toString(),stale:e.timestamp>p+900n||p>e.timestamp+60n,data:{annualYieldPercent:String(l.apy),annualYieldFraction:String(l.apy/100),basis:A(l.apyBasis)},caveat:"Longbow publisher quote, not a realized Morpho lookback series or a promised return. The app formats this field directly as percent (0.03 means 0.03%, not 3%). No bonus, future payout or fee inclusion is inferred. Onchain book and fees remain available through longbow_details."}}export{_ as a,I as b,O as c};
1
+ import{a as k}from"./A3PN3PK3.js";import{g as P}from"./NWNYJ26T.js";import{a as b}from"./FWD4L3CJ.js";import{a as t}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{getAddress as w,parseAbi as L}from"viem";var v={one_hour:3600n,six_hours:21600n,one_day:86400n,seven_days:604800n,thirty_days:2592000n,ninety_days:7776000n,one_year:31536000n},g=L(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewRedeem(uint256) view returns (uint256)"]);async function C(u,o,i){let a=0n,s=i.number,e=await u.getBlock({blockNumber:a});if(e.timestamp>o)throw new t("Longbow has insufficient chain history for this window.");for(let n=0;a+1n<s&&n<64;n++){let r=(a+s)/2n,c=await u.getBlock({blockNumber:r});if(c.number!==r||c.timestamp<e.timestamp||c.timestamp>i.timestamp)throw new t("Longbow historical block response is inconsistent.");c.timestamp<=o?(a=r,e=c):s=r}if(a+1n<s||e.number!==a)throw new t("Longbow historical block search exceeded its bound.");return e}async function _(u,o,i,a="six_hours"){let s=v[a];if(!Object.hasOwn(v,a)||!s)throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let e=u.clientFor(b);if(await e.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let n=await e.getBlock({blockTag:"latest"});if(n.number===null||n.timestamp<s)throw new t("Longbow has insufficient chain history for this window.");let r=await C(e,n.timestamp-s,{number:n.number,timestamp:n.timestamp}),c=10n**27n,d=await Promise.all([r,n].map(async m=>{let[S,N,Y,f]=await Promise.all([e.readContract({address:o,abi:g,functionName:"asset",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:i.address,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"previewRedeem",args:[c],blockNumber:m.number})]);if(w(S)!==w(i.address)||N!==18||Y!==i.decimals||typeof f!="bigint"||f<0n||f>=1n<<256n)throw new t("Longbow historical share price or token metadata is unavailable or invalid. No zero rate was inferred.");return f})),h=n.timestamp-r.timestamp;if(h<=0n||h>s+300n)throw new t("Longbow historical blocks do not cover the requested APY window within 300 seconds.");if(d[0]===0n)throw new t("Longbow starting share price is zero; a realized APY cannot be calculated.");let l=Number(d[1]-d[0])/Number(d[0]),p=Math.expm1(Math.log1p(l)*31536e3/Number(h));if(!Number.isFinite(p))throw new t("Longbow annualized share-price change is outside the supported numeric range.");let y=await k(e,o,n.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},source:"Oak-computed on-chain",view:"apy",stale:!1,window:{lookback:a,requestedSeconds:s.toString(),elapsedSeconds:h.toString(),fromTimestamp:r.timestamp.toString(),toTimestamp:n.timestamp.toString(),fromBlock:r.number.toString(),toBlock:n.number.toString()},sharePrice:{shareUnits:c.toString(),startAssets:d[0].toString(),endAssets:d[1].toString(),assetDecimals:i.decimals},data:{annualYieldFraction:String(p),annualYieldPercent:String(p*100),lookback:a,basis:"Oak-computed realized APY: (end share price / start share price)^(31536000 / elapsed seconds) - 1, using ERC-4626 previewRedeem at two pinned blocks."},caveat:"Historical share-price change includes what the vault accounts for in previewRedeem, excludes external rewards and gas, and is not a promised return. Archive RPC history is required; missing history is not zero APY."}}async function I(u,o,i,a){if(Object.keys(a).some(d=>!["view","lookback"].includes(d)))throw new t("Longbow APY takes a lookback, not pagination.");let s=a.lookback??"six_hours";if(typeof s!="string"||!Object.hasOwn(v,s))throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let[e,n]=await Promise.allSettled([O(u,o,i,{view:"published_apy"}),_(u,o,i,s)]),r=e.status==="fulfilled"&&!e.value.stale?e.value:void 0;if(!r&&n.status==="rejected")throw new t(`Longbow APY is unavailable: the vendor figure is unavailable or stale, and the on-chain window could not be measured. ${u.plainError(n.reason)}`);return{...r??(n.status==="fulfilled"?n.value:void 0),view:"apy",shown:r?"Longbow vendor":"Oak-computed on-chain",realized:n.status==="fulfilled"?n.value:null,published:e.status==="fulfilled"?e.value:null,warnings:[...r?[]:["Longbow vendor APY is unavailable or stale; showing Oak-computed realized APY."],...n.status==="rejected"?["Oak-computed APY is unavailable: the archive RPC window could not be measured."]:[]]}}async function O(u,o,i,a){if(Object.keys(a).some(m=>m!=="view")||a.view!=="published_apy")throw new t("published_apy takes no historical lookback, cursor or limit.");let s=u.clientFor(b);if(await s.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let[e,n]=await Promise.all([s.getBlock(),s.readContract({address:o,abi:L(["function asset() view returns (address)"]),functionName:"asset"})]);if(w(n)!==w(i.address))throw new t("Longbow vault does not use the pinned asset.");let r="https://longbow.credit/api/v2/vaults",c=await u.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(15e3)});if(!c.ok)throw new t(`Longbow published APY HTTP ${c.status}; the rate is unavailable.`);let d=await c.json();if(!d||typeof d!="object"||!Number.isSafeInteger(d.asOf)||Number(d.asOf)<0||!Array.isArray(d.vaults)||d.vaults.length>100)throw new t("Longbow published APY response has an invalid timestamp or vault inventory.");let h=d.vaults.filter(m=>m&&typeof m=="object"&&typeof m.address=="string"&&P(String(m.address),o));if(h.length!==1)throw new t("Longbow published APY omitted or duplicated this vault; no zero rate is inferred.");let l=h[0];if(l.error||typeof l.asset!="string"||w(l.asset)!==w(i.address)||l.decimals!==i.decimals||typeof l.apy!="number"||!Number.isFinite(l.apy)||l.apy<-100||typeof l.apyBasis!="string"||l.apyBasis.length>64)throw new t("Longbow published APY asset, units, basis or rate is invalid.");let p=BigInt(Number(d.asOf)),y=await k(s,o,e.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},sourceUrl:r,view:"published_apy",asOf:p.toString(),stale:e.timestamp>p+900n||p>e.timestamp+60n,data:{annualYieldPercent:String(l.apy),annualYieldFraction:String(l.apy/100),basis:A(l.apyBasis)},caveat:"Longbow publisher quote, not a realized Morpho lookback series or a promised return. The app formats this field directly as percent (0.03 means 0.03%, not 3%). No bonus, future payout or fee inclusion is inferred. Onchain book and fees remain available through longbow_details."}}export{_ as a,I as b,O as c};
@@ -1 +1 @@
1
- import{d as ee}from"./MKAPRRKF.js";import{e as ie}from"./BNG2IWZL.js";import{a as ne,h as re,k as se}from"./6YYCGUCU.js";import{a as ae,b as O,c as F}from"./5OKJEGBH.js";import{e as te}from"./WMNRP3YH.js";import{b as Z}from"./Z4SRGAVL.js";import{a as B}from"./PBQSJSZO.js";import{c as _}from"./MYFAKCQI.js";import{b as X}from"./5ZLOCQA4.js";import{c as A,d as z,e as b,g as D,j as J,m as Q,n as K}from"./5KUWLUPM.js";import{a as l,i as R}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=R[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function U(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function N(a){return D(a,V.address)}function P(a){return ne.some(f=>D(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(r){try{return await r()}catch(i){throw new u(a.plainError(i))}}function S(r,i){if(r.chainId!==void 0&&r.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(r))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let r=await _(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return r.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return _(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(r,i){let d=r[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let r=a.clientFor(l);if(await r.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await r.getBlockNumber()),d=(t,s)=>r.readContract({address:t,abi:q,functionName:s,blockNumber:i}),e=async(t,s)=>T(await r.readContract({address:t,abi:M,functionName:"balanceOf",args:[s],blockNumber:i}));async function n(t){let[s,p]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof s!="string"||!s.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:s,decimals:ue(p)}}async function o(t){let s=t.earnContractAddress,p=v(await d(s,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(s),d(s,"strategy"),d(s,"balance"),d(s,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let $=v(m),G=await d($,"paused");if(typeof G!="boolean")throw new u("The strategy returned an invalid pause flag.");let x=T(w);if(x===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:$,paused:G,managed:T(c),pricePerFullShare:x}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function W(r){let i=v(r.vault),d=O(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function Y(r,i,d,e){let n=j(await H(),e),o=await a.preview(r,i),t=o.changes.map(s=>{let p=s.amount.startsWith("-"),h=p?s.amount.slice(1):s.amount;return`${p?"-":"+"}${a.formatAmount(h,s.token.decimals)} ${g(s.token.symbol)} (${s.token.address}, chain ${s.token.chainId})`}).join("; ");return{txs:r,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l}},additionalProperties:!1},execute:(r,i)=>f(async()=>{S(r,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let s=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await re(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:s.want,shares:s.shares,vaultTotalWant:{token:s.want,amount:s.managed.toString()},pricePerFullShare:{token:s.want,amount:s.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:s.paused,source:"strategy.paused()",address:s.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:N(t.earnContractAddress),qualification:N(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:O(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!s.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:A,chainId:{const:l},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"]}},required:["vault"],additionalProperties:!1},execute:r=>f(async()=>{S(r,["vault","historyBucket"]);let i=r.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(r.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await _(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},$=>$!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,s,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...s,currency:"USD"},history:p,forkQualified:N(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:A,token:A,amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999},chainId:{const:l}},required:["vault","token","amount"],additionalProperties:!1},execute:(r,i)=>f(async()=>{if(S(r,["vault","token","amount","minSharesOut","slippageBps"]),B(i),r.slippageBps!==void 0&&(!Number.isInteger(r.slippageBps)||Number(r.slippageBps)<0||Number(r.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");r.minSharesOut!==void 0&&U(r.minSharesOut);let d=U(r.amount),e=v(r.token),n=await W(r),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let s=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await Y(s,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=r.minSharesOut===void 0?h*BigInt(1e4-Number(r.slippageBps??50))/10000n:U(r.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:R[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:A,shares:{anyOf:[E,{const:"all"}]},chainId:{const:l}},required:["vault","shares"],additionalProperties:!1},execute:(r,i)=>f(async()=>{S(r,["vault","shares"]),B(i);let d=r.shares==="all"?void 0:U(r.shares),e=await W(r),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let s=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return Y(s,i,"Withdraw from",e)})}],positions:r=>f(async()=>{B(r);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,r),t===0n)continue;let s=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:s.want,amount:(t*s.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),s.shares.decimals)} ${g(s.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${s.paused}. ${N(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(s){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(s)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),se(a),ee(a),te(a)])}export{he as a,Te as b};
1
+ import{d as ee}from"./2TK3ETUO.js";import{e as ie}from"./M37654RL.js";import{a as ne,h as re,k as se}from"./QQECG3WP.js";import{a as ae,b as O,c as F}from"./WV3A3OUU.js";import{e as te}from"./SIYUNOLI.js";import{b as Z}from"./SPJCSEKP.js";import{a as B}from"./43LI5NKJ.js";import{c as _}from"./VEQBHI6O.js";import{b as X}from"./66F5ZH34.js";import{c as A,d as z,e as b,g as D,j as J,m as Q,n as K}from"./NWNYJ26T.js";import{a as l,i as R}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=R[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function U(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function N(a){return D(a,V.address)}function P(a){return ne.some(f=>D(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(r){try{return await r()}catch(i){throw new u(a.plainError(i))}}function S(r,i){if(r.chainId!==void 0&&r.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(r))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let r=await _(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return r.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return _(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(r,i){let d=r[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let r=a.clientFor(l);if(await r.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await r.getBlockNumber()),d=(t,s)=>r.readContract({address:t,abi:q,functionName:s,blockNumber:i}),e=async(t,s)=>T(await r.readContract({address:t,abi:M,functionName:"balanceOf",args:[s],blockNumber:i}));async function n(t){let[s,p]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof s!="string"||!s.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:s,decimals:ue(p)}}async function o(t){let s=t.earnContractAddress,p=v(await d(s,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(s),d(s,"strategy"),d(s,"balance"),d(s,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let $=v(m),G=await d($,"paused");if(typeof G!="boolean")throw new u("The strategy returned an invalid pause flag.");let x=T(w);if(x===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:$,paused:G,managed:T(c),pricePerFullShare:x}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function W(r){let i=v(r.vault),d=O(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function Y(r,i,d,e){let n=j(await H(),e),o=await a.preview(r,i),t=o.changes.map(s=>{let p=s.amount.startsWith("-"),h=p?s.amount.slice(1):s.amount;return`${p?"-":"+"}${a.formatAmount(h,s.token.decimals)} ${g(s.token.symbol)} (${s.token.address}, chain ${s.token.chainId})`}).join("; ");return{txs:r,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l}},additionalProperties:!1},execute:(r,i)=>f(async()=>{S(r,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let s=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await re(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:s.want,shares:s.shares,vaultTotalWant:{token:s.want,amount:s.managed.toString()},pricePerFullShare:{token:s.want,amount:s.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:s.paused,source:"strategy.paused()",address:s.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:N(t.earnContractAddress),qualification:N(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:O(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!s.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:A,chainId:{const:l},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"]}},required:["vault"],additionalProperties:!1},execute:r=>f(async()=>{S(r,["vault","historyBucket"]);let i=r.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(r.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await _(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},$=>$!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,s,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...s,currency:"USD"},history:p,forkQualified:N(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:A,token:A,amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999},chainId:{const:l}},required:["vault","token","amount"],additionalProperties:!1},execute:(r,i)=>f(async()=>{if(S(r,["vault","token","amount","minSharesOut","slippageBps"]),B(i),r.slippageBps!==void 0&&(!Number.isInteger(r.slippageBps)||Number(r.slippageBps)<0||Number(r.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");r.minSharesOut!==void 0&&U(r.minSharesOut);let d=U(r.amount),e=v(r.token),n=await W(r),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let s=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await Y(s,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=r.minSharesOut===void 0?h*BigInt(1e4-Number(r.slippageBps??50))/10000n:U(r.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:R[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:A,shares:{anyOf:[E,{const:"all"}]},chainId:{const:l}},required:["vault","shares"],additionalProperties:!1},execute:(r,i)=>f(async()=>{S(r,["vault","shares"]),B(i);let d=r.shares==="all"?void 0:U(r.shares),e=await W(r),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let s=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return Y(s,i,"Withdraw from",e)})}],positions:r=>f(async()=>{B(r);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,r),t===0n)continue;let s=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:s.want,amount:(t*s.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),s.shares.decimals)} ${g(s.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${s.paused}. ${N(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(s){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(s)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),se(a),ee(a),te(a)])}export{he as a,Te as b};
@@ -1 +1 @@
1
- import{d as l,e as N,f as T}from"./2ZUP7ZEV.js";import{a as D}from"./Y7RPSDD2.js";import{a as w,c as n,d as u,e as y,g as b}from"./2MZXTOZU.js";import{a as U}from"./PBQSJSZO.js";import{b as A}from"./5ZLOCQA4.js";import{h as S,n as x}from"./5KUWLUPM.js";import{a as p}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as L}from"viem";function G(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new o("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new o("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=G(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new o("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new o("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new o("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:n,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new o("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new o("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new o("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(n,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new o("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new o("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),$=t?L({abi:b,functionName:"withdraw",args:[n.address,m==="max"?y:a,d]}):L({abi:b,functionName:"supply",args:[n.address,a,d,0]}),B=[...t?[]:[e.approval(n.address,w,a.toString(),p)],e.unsignedTx({to:w,data:$,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,n)<a:k(h,n)!==-a||k(h,u)<a-1n)throw new o("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(n,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new o(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A("Positive USDG amount in decimal base units (6 decimals).")},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"USDG decimal base units (6 decimals), or max for the full balance."}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
1
+ import{d as l,e as N,f as T}from"./CQEJSCFQ.js";import{a as D}from"./JKD2B6OX.js";import{a as w,c as n,d as u,e as y,g as b}from"./2MZXTOZU.js";import{a as U}from"./43LI5NKJ.js";import{b as A}from"./66F5ZH34.js";import{h as S,n as x}from"./NWNYJ26T.js";import{a as p}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as L}from"viem";function G(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new o("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new o("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=G(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new o("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new o("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new o("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:n,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new o("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new o("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new o("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(n,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new o("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new o("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),$=t?L({abi:b,functionName:"withdraw",args:[n.address,m==="max"?y:a,d]}):L({abi:b,functionName:"supply",args:[n.address,a,d,0]}),B=[...t?[]:[e.approval(n.address,w,a.toString(),p)],e.unsignedTx({to:w,data:$,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,n)<a:k(h,n)!==-a||k(h,u)<a-1n)throw new o("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(n,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new o(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A("Positive USDG amount in decimal base units (6 decimals).")},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"USDG decimal base units (6 decimals), or max for the full balance."}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
@@ -0,0 +1 @@
1
+ import{b}from"./I55MURSJ.js";import{c as p,f as A}from"./VCOTCVKN.js";import{a as v}from"./JQOQMFWD.js";import{b as h}from"./PNA6UIE5.js";import{c as u,i as y,l as w}from"./QFNT73OF.js";import{i as f}from"./AEL62KCG.js";import{b as m}from"./SPJCSEKP.js";import{a as n}from"./XSD5NL7J.js";var $={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; for multiple USDG vaults, select the largest only with at least 100 USDG and ten times the runner-up assets. Other ambiguous symbols require a vault address."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address to verify on chain; required for a rebuild without HTTP. If asset is also supplied, both must match."}};function M(e){return{type:"object",additionalProperties:!1,properties:{...$,...e?{amount:{type:"string",pattern:e==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:"Asset base-unit integer string; withdraw also accepts max to redeem all shares."}}:{}},...e?{required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}:{}}}function O(e,o){if(Object.keys(e).some(r=>!["asset","vault",...o?["amount"]:[]].includes(r)))throw new n("Unexpected Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)))throw new n("Provide an official asset symbol.");if(e.vault!==void 0&&u(e.vault),o&&(typeof e.amount!="string"||!(o==="withdraw"?/^(?:[0-9]+|max)$/:/^[0-9]+$/).test(e.amount)||!e.asset&&!e.vault))throw new n("Provide an asset symbol or vault address and a base-unit amount.")}function x(e,o={}){let r=p(e,o);if(o.resolveAllowedAsset||o.officialStockTokens)return r;let l=p(e,{...o,resolveAllowedAsset:(s,a,i)=>y(f())(s,a,i)}),t=(s,a,i,d)=>(a.vault?l:r).resolveVault(s,a,i,d);return{...l,discoverVaults:r.discoverVaults,resolveVault:t}}function P(e,o={}){let r=x(e,o),l=["deposit","withdraw"].map((t,s)=>({name:`borro_${t}`,inputSchema:M(t),execute:async(a,i)=>{O(a,t),u(i);let d=o.createActionTools??v,T=e.clientFor(4663),c=d({context:e,client:T,wallet:i,verifySetup:w,readLiquidity:h,...r})[s];if(!c||c.name!==`borro_${t}`)throw new n("Borro action wiring is unavailable.");return c.execute(a,i)}}));return{tools:[{name:"borro_list",inputSchema:M(),execute:async(t,s)=>(O(t),A(e,s,{...typeof t.asset=="string"?{asset:t.asset}:{},...t.vault?{vault:u(t.vault)}:{}},o,r))},...l],positions:(t,s)=>b(e,t,{...o,...s,discoverVaults:r.discoverVaults})}}var j=e=>m("borro",e.network==="testnet"?[]:[P(e)]);export{x as a,P as b,j as c};
@@ -0,0 +1 @@
1
+ import{a as H}from"./JFYBH3DX.js";import{a as i}from"./I6PQW2JI.js";import{g as l,i as U,l as K,m as _,n as z}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{isHex as oe,keccak256 as re}from"viem";var c=e=>K(U(e,"Provide a valid Chop address."),"Provide a nonzero Chop address."),C=e=>_(e,"Chop returned an invalid integer."),pe=e=>z(e,"Provide a positive Chop base-unit integer string within uint256.",{positive:!0});function $(e){if(typeof e!="string"||!oe(e,{strict:!0})||e.length<4||e.length%2)throw new r("Chop contract code is unavailable.");return re(e)}var V=(e,s,a,t,n,o)=>e.readContract({address:s,abi:H,functionName:a,args:t,blockNumber:n,...o?{account:o}:{}});async function I(e,s,a){let t=await e.multicall({allowFailure:!1,batchSize:0,blockNumber:a,contracts:s.map(n=>({address:n.target,abi:H,functionName:n.fn,args:n.args??[]}))});if(!Array.isArray(t)||t.length!==s.length)throw new r("Chop returned incomplete reads.");return t}async function se(e){if(await e.getChainId()!==i.chainId)throw new r("Chop requires chain 4663.");return C(await e.getBlockNumber({cacheTime:0}))}function y(e){if(!e||typeof e!="object"||Array.isArray(e))throw new r("Chop returned invalid log metadata.");return e}function L(e){if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255)throw new r("Chop token decimals are invalid.");return e}function O(e){return typeof e=="string"&&/^[A-Za-z0-9.$_-]{1,32}$/.test(e)?e:"token"}async function B(e,s,a){if(!l($(await e.getCode({address:s.address,blockNumber:a})),s.codeHash))throw new r("Chop trust-anchor code changed.")}async function S(e,s,a,t,n,o){await Promise.all([B(e,t,o),B(e,{address:s,codeHash:a},o)]);let m=c(await V(e,t.address,"implementation",[],o)),u=$(await e.getCode({address:m,blockNumber:o}));return{address:m,codeHash:u,changed:!l(u,n)}}function ae(e,s){let a=y(e);if(!l(c(a.index),s)||a.verified!==!0)throw new r("This is not a verified Chop registry log.")}async function me(e,s,a,t){let n=c(s),o=t??await se(e);await B(e,i.registry,o);let m=await V(e,i.registry.address,"getIndex",[n],o);if(ae(m,n),a==="enter"){if(y(m).makePublic!==!0)throw new r("This verified Chop log is not public for new deposits.");await V(e,i.registry.address,"validateIndex",[n],o)}let[u,P]=await Promise.all([I(e,["getAllAssets","PAIRED_LP_TOKEN","lpStakingPool","lpRewardsToken","v2Pool","fees","decimals","symbol","totalSupply","config"].map(d=>({target:n,fn:d})),o),S(e,n,i.proxy.codeHash,i.beacon,i.implementation.codeHash,o)]),[A,D,M,j,q,F,W,X,Z,G]=u;if(!Array.isArray(A)||A.length!==1||C(y(A[0]).weighting)!==10n**18n)throw new r("Only verified single-token Chop logs are supported.");let g=c(y(A[0]).token),f=c(D),p=c(M),b=c(q);if(!l(c(j),i.chop)||[n,g,f,p,b].some(d=>l(d,i.dormantOak))||new Set([n,g,f,p,b].map(d=>d.toLowerCase())).size!==5)throw new r("Chop log token identities do not match the supported setup.");let J=y(F),Q=Object.fromEntries(["burn","bond","debond","buy","sell","partner"].map(d=>{let h=J[d];if(typeof h!="number"||!Number.isInteger(h)||h<0||h>1e4)throw new r("Chop returned invalid fees.");return[d,h]})),R=y(G);if(R.hasTransferTax!==!1||R.blacklistTKNpTKNPoolV2!==!1)throw new r("Chop transfer-tax or blocked-pool logs are unsupported.");let w=await I(e,[{target:g,fn:"decimals"},{target:g,fn:"symbol"},{target:f,fn:"decimals"},{target:f,fn:"symbol"},{target:p,fn:"POOL_REWARDS"},{target:n,fn:"totalAssets",args:[g]}],o),k=c(w[4]);if([n,g,f,p,b].some(d=>l(d,k)))throw new r("Chop rewards identity is invalid.");let[Y,ee,ne]=await Promise.all([I(e,[{target:p,fn:"INDEX_FUND"},{target:p,fn:"stakingToken"},{target:k,fn:"indexFund"},{target:k,fn:"trackingToken"},{target:k,fn:"rewardsToken"}],o),S(e,p,i.staking.codeHash,i.stakingBeacon,i.stakingImplementation.codeHash,o),S(e,k,i.rewards.codeHash,i.rewardsBeacon,i.rewardsImplementation.codeHash,o)]);if(Y.some((d,h)=>!l(c(d),[n,b,n,p,i.chop][h])))throw new r("Chop staking or rewards links do not match this log.");let x={address:g,decimals:L(w[0]),symbol:l(g,i.oak)?"OAK":O(w[1]),chainId:4663};if(x.symbol.replace(/^\$/,"").toUpperCase()==="OAK"&&!l(g,i.oak))throw new r("Chop underlying OAK is not the canonical Oak token.");let te={address:f,decimals:L(w[2]),symbol:O(w[3]),chainId:4663},N={address:n,decimals:L(W),symbol:O(X),chainId:4663},v=[P.changed?"log implementation":"",ee.changed?"staking implementation":"",ne.changed?"rewards implementation":""].filter(Boolean);if(a==="enter"&&v.length)throw new r(`Chop implementation changed (${v.join(", ")}); wraps and farms are refused.`);let T=C(Z),E=C(w[5]);if(T===0n)throw new r("This Chop log has no issued supply.");return{log:N,underlying:x,paired:te,staking:{address:p,symbol:"Chop staked LP",decimals:18,chainId:4663},rewards:k,pool:b,fees:Q,totalSupply:T.toString(),managedUnderlying:E.toString(),backingPerLog:{token:x,amount:(E*10n**BigInt(N.decimals)/T).toString()},implementation:P.address,implementationHash:P.codeHash,drift:v,measuredAtBlock:o.toString()}}function he(e,s,a=!1){if(e.length!==s.length||e.some((t,n)=>!l(t.to,s[n].to)||t.data!==s[n].data||t.value!=="0"||t.chainId!==4663||t.gasLimit!==s[n].gasLimit&&!(a&&t.gasLimit===void 0)))throw new r("Chop transaction or exact approval does not match the requested action.")}function ue(e,s){let a=new Map;for(let t of e.changes){let n=s.find(u=>l(u.token.address,t.token.address));if(!n||t.token.chainId!==4663||t.token.decimals!==n.token.decimals||typeof t.amount!="string"||!/^-?\d+$/.test(t.amount))throw new r("Chop preview showed an unexpected token movement.");let o=BigInt(t.amount);if(C(o<0n?-o:o),n.min>=0n&&o<0n||n.max!==void 0&&n.max<=0n&&o>0n)throw new r("Chop preview showed a reversed token movement.");let m=n.token.address.toLowerCase();a.set(m,(a.get(m)??0n)+o)}for(let t of s){let n=a.get(t.token.address.toLowerCase())??0n;if(n<t.min||t.max!==void 0&&n>t.max)throw new r("Chop preview receipt does not meet the quoted amount.")}return a}export{c as a,C as b,pe as c,$ as d,V as e,I as f,se as g,B as h,ae as i,me as j,he as k,ue as l};