@oakagentkit/core 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (730) hide show
  1. package/build/dist/api/abort-scope.d.ts +2 -0
  2. package/build/dist/api/abort-scope.js +1 -0
  3. package/build/dist/api/addresses.d.ts +9 -0
  4. package/build/dist/api/addresses.js +1 -1
  5. package/build/dist/api/chain.d.ts +4 -0
  6. package/build/dist/api/chain.js +1 -1
  7. package/build/dist/api/history.js +1 -1
  8. package/build/dist/api/http.js +1 -1
  9. package/build/dist/api/identity-link.js +1 -1
  10. package/build/dist/api/metadata.js +1 -1
  11. package/build/dist/api/modules/beefy/boosts.js +1 -1
  12. package/build/dist/api/modules/beefy/clm.js +1 -1
  13. package/build/dist/api/modules/beefy/guard.js +1 -1
  14. package/build/dist/api/modules/beefy/index.js +1 -1
  15. package/build/dist/api/modules/beefy/liquidity.js +1 -1
  16. package/build/dist/api/modules/beefy/management.js +1 -1
  17. package/build/dist/api/modules/beefy/vaults.js +1 -1
  18. package/build/dist/api/modules/borro/abi.d.ts +54 -0
  19. package/build/dist/api/modules/borro/abi.js +1 -1
  20. package/build/dist/api/modules/borro/actions.d.ts +14 -1
  21. package/build/dist/api/modules/borro/actions.js +1 -1
  22. package/build/dist/api/modules/borro/checks.js +1 -1
  23. package/build/dist/api/modules/borro/copy.d.ts +23 -10
  24. package/build/dist/api/modules/borro/copy.js +1 -1
  25. package/build/dist/api/modules/borro/index.js +1 -1
  26. package/build/dist/api/modules/borro/liquidity.js +1 -1
  27. package/build/dist/api/modules/borro/pins.d.ts +30 -14
  28. package/build/dist/api/modules/borro/pins.js +1 -1
  29. package/build/dist/api/modules/borro/positions.js +1 -1
  30. package/build/dist/api/modules/borro/reader.js +1 -1
  31. package/build/dist/api/modules/borro/types.d.ts +1 -0
  32. package/build/dist/api/modules/chop/abi.d.ts +31 -0
  33. package/build/dist/api/modules/chop/abi.js +1 -1
  34. package/build/dist/api/modules/chop/actions.js +1 -1
  35. package/build/dist/api/modules/chop/checks.d.ts +13 -5
  36. package/build/dist/api/modules/chop/checks.js +1 -1
  37. package/build/dist/api/modules/chop/copy.d.ts +11 -1
  38. package/build/dist/api/modules/chop/copy.js +1 -1
  39. package/build/dist/api/modules/chop/guard.js +1 -1
  40. package/build/dist/api/modules/chop/index.js +1 -1
  41. package/build/dist/api/modules/chop/positions.js +1 -1
  42. package/build/dist/api/modules/chop/reader.d.ts +132 -7
  43. package/build/dist/api/modules/chop/reader.js +1 -1
  44. package/build/dist/api/modules/chop/types.d.ts +12 -0
  45. package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
  46. package/build/dist/api/modules/clanker/extensions.js +1 -1
  47. package/build/dist/api/modules/clanker/index.js +1 -1
  48. package/build/dist/api/modules/clanker/manage.js +1 -1
  49. package/build/dist/api/modules/clanker/pool-config.d.ts +15 -0
  50. package/build/dist/api/modules/clanker/pool-config.js +1 -1
  51. package/build/dist/api/modules/clanker/protocol.js +1 -1
  52. package/build/dist/api/modules/clanker/state.js +1 -1
  53. package/build/dist/api/modules/earn/copy.d.ts +36 -14
  54. package/build/dist/api/modules/earn/copy.js +1 -1
  55. package/build/dist/api/modules/earn/cost.d.ts +11 -1
  56. package/build/dist/api/modules/earn/cost.js +1 -1
  57. package/build/dist/api/modules/earn/index.js +1 -1
  58. package/build/dist/api/modules/earn/lp.d.ts +14 -1
  59. package/build/dist/api/modules/earn/lp.js +1 -1
  60. package/build/dist/api/modules/earn/options.d.ts +6 -4
  61. package/build/dist/api/modules/earn/options.js +1 -1
  62. package/build/dist/api/modules/erc8004/common.d.ts +1 -1
  63. package/build/dist/api/modules/erc8004/common.js +1 -1
  64. package/build/dist/api/modules/erc8004/domain.js +1 -1
  65. package/build/dist/api/modules/erc8004/index.js +1 -1
  66. package/build/dist/api/modules/erc8004/management.js +1 -1
  67. package/build/dist/api/modules/erc8004/reputation.js +1 -1
  68. package/build/dist/api/modules/erc8004/services.js +1 -1
  69. package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
  70. package/build/dist/api/modules/erc8004/thesis.js +1 -0
  71. package/build/dist/api/modules/erc8004/validation.js +1 -1
  72. package/build/dist/api/modules/factor/abi.d.ts +642 -0
  73. package/build/dist/api/modules/factor/abi.js +1 -0
  74. package/build/dist/api/modules/factor/actions.d.ts +15 -0
  75. package/build/dist/api/modules/factor/actions.js +1 -0
  76. package/build/dist/api/modules/factor/api.d.ts +7 -0
  77. package/build/dist/api/modules/factor/api.js +1 -0
  78. package/build/dist/api/modules/factor/checks.d.ts +11 -0
  79. package/build/dist/api/modules/factor/checks.js +1 -0
  80. package/build/dist/api/modules/factor/copy.d.ts +33 -0
  81. package/build/dist/api/modules/factor/copy.js +1 -0
  82. package/build/dist/api/modules/factor/guard.d.ts +12 -0
  83. package/build/dist/api/modules/factor/guard.js +1 -0
  84. package/build/dist/api/modules/factor/index.d.ts +16 -0
  85. package/build/dist/api/modules/factor/index.js +8 -0
  86. package/build/dist/api/modules/factor/messages.d.ts +46 -0
  87. package/build/dist/api/modules/factor/messages.js +1 -0
  88. package/build/dist/api/modules/factor/pins.d.ts +64 -0
  89. package/build/dist/api/modules/factor/pins.js +1 -0
  90. package/build/dist/api/modules/factor/reader.d.ts +17 -0
  91. package/build/dist/api/modules/factor/reader.js +1 -0
  92. package/build/dist/api/modules/factor/types.d.ts +18 -0
  93. package/build/dist/api/modules/factor/types.js +0 -0
  94. package/build/dist/api/modules/gloam/copy.d.ts +4 -3
  95. package/build/dist/api/modules/gloam/copy.js +2 -2
  96. package/build/dist/api/modules/gloam/index.js +1 -1
  97. package/build/dist/api/modules/grove/index.js +1 -1
  98. package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
  99. package/build/dist/api/modules/heyresearch/index.js +1 -1
  100. package/build/dist/api/modules/heyresearch/public-reads.d.ts +29 -1
  101. package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
  102. package/build/dist/api/modules/heyresearch/scan.js +1 -1
  103. package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
  104. package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
  105. package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
  106. package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
  107. package/build/dist/api/modules/hoodag/index.d.ts +12 -1
  108. package/build/dist/api/modules/hoodag/index.js +1 -1
  109. package/build/dist/api/modules/hoodag/management.js +1 -1
  110. package/build/dist/api/modules/hoodag/public-reads.js +1 -1
  111. package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
  112. package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
  113. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  114. package/build/dist/api/modules/hoodlock/buyback.js +1 -1
  115. package/build/dist/api/modules/hoodlock/commerce.js +1 -1
  116. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  117. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  118. package/build/dist/api/modules/hoodlock/index.js +1 -1
  119. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  120. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  121. package/build/dist/api/modules/hoodlock/public.js +1 -1
  122. package/build/dist/api/modules/hookr/actions.js +1 -1
  123. package/build/dist/api/modules/hookr/addons.js +1 -1
  124. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  125. package/build/dist/api/modules/hookr/contracts.d.ts +2 -1
  126. package/build/dist/api/modules/hookr/contracts.js +1 -1
  127. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  128. package/build/dist/api/modules/hookr/discovery.js +1 -1
  129. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  130. package/build/dist/api/modules/hookr/index.js +1 -1
  131. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  132. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  133. package/build/dist/api/modules/hookr/launch.js +1 -1
  134. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  135. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  136. package/build/dist/api/modules/hookr/lp-reads.d.ts +2 -0
  137. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  138. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  139. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  140. package/build/dist/api/modules/hookr/public-reads.js +1 -1
  141. package/build/dist/api/modules/hookr/read-utils.js +1 -1
  142. package/build/dist/api/modules/hookr/relay.js +1 -1
  143. package/build/dist/api/modules/hookr/revenue.js +1 -1
  144. package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
  145. package/build/dist/api/modules/kyberswap/index.js +1 -1
  146. package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
  147. package/build/dist/api/modules/layerbank/abi.js +1 -1
  148. package/build/dist/api/modules/layerbank/actions.js +1 -1
  149. package/build/dist/api/modules/layerbank/checks.js +1 -1
  150. package/build/dist/api/modules/layerbank/index.js +1 -1
  151. package/build/dist/api/modules/layerbank/merkl.js +1 -1
  152. package/build/dist/api/modules/layerbank/reader.js +1 -1
  153. package/build/dist/api/modules/layerbank/reserve.js +1 -1
  154. package/build/dist/api/modules/lighter/index.js +1 -1
  155. package/build/dist/api/modules/longbow/administration.js +1 -1
  156. package/build/dist/api/modules/longbow/analytics.js +1 -1
  157. package/build/dist/api/modules/longbow/fixed.js +1 -1
  158. package/build/dist/api/modules/longbow/index.js +1 -1
  159. package/build/dist/api/modules/longbow/nft.js +1 -1
  160. package/build/dist/api/modules/longbow/rebates.js +1 -1
  161. package/build/dist/api/modules/longbow/staking.js +1 -1
  162. package/build/dist/api/modules/meridian/index.js +1 -1
  163. package/build/dist/api/modules/meridian/markets.js +1 -1
  164. package/build/dist/api/modules/meridian/perps-batch.js +1 -1
  165. package/build/dist/api/modules/meridian/perps-stream.js +1 -1
  166. package/build/dist/api/modules/meridian/perps.js +1 -1
  167. package/build/dist/api/modules/meridian/predict-read.js +1 -1
  168. package/build/dist/api/modules/meridian/rfq.js +1 -1
  169. package/build/dist/api/modules/merkl/discovery.js +1 -1
  170. package/build/dist/api/modules/merkl/index.js +1 -1
  171. package/build/dist/api/modules/merkl/manage.js +1 -1
  172. package/build/dist/api/modules/merkl/protocol.js +1 -1
  173. package/build/dist/api/modules/morpho/allocator.js +1 -1
  174. package/build/dist/api/modules/morpho/bundles.js +1 -1
  175. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  176. package/build/dist/api/modules/morpho/index.js +1 -1
  177. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  178. package/build/dist/api/modules/morpho/midnight.js +1 -1
  179. package/build/dist/api/modules/morpho/protocol.js +1 -1
  180. package/build/dist/api/modules/morpho/vault-management.js +1 -1
  181. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  182. package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
  183. package/build/dist/api/modules/morpho/vault-v2.js +1 -1
  184. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  185. package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
  186. package/build/dist/api/modules/netnet/card-policy.js +1 -1
  187. package/build/dist/api/modules/netnet/card-read.js +1 -1
  188. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  189. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  190. package/build/dist/api/modules/netnet/desk-read.js +1 -1
  191. package/build/dist/api/modules/netnet/financial.js +1 -1
  192. package/build/dist/api/modules/netnet/index.js +1 -1
  193. package/build/dist/api/modules/netnet/staking.js +1 -1
  194. package/build/dist/api/modules/orbio/gateway.js +1 -1
  195. package/build/dist/api/modules/orbio/index.d.ts +6 -0
  196. package/build/dist/api/modules/orbio/index.js +1 -1
  197. package/build/dist/api/modules/orbio/positions.js +1 -1
  198. package/build/dist/api/modules/pendle/convert.js +1 -1
  199. package/build/dist/api/modules/pendle/costs.js +1 -1
  200. package/build/dist/api/modules/pendle/index.js +1 -1
  201. package/build/dist/api/modules/pendle/markets.js +1 -1
  202. package/build/dist/api/modules/pendle/positions.js +1 -1
  203. package/build/dist/api/modules/pendle/pricecheck.js +1 -1
  204. package/build/dist/api/modules/pendle/reader.js +1 -1
  205. package/build/dist/api/modules/pendle/redeem.js +1 -1
  206. package/build/dist/api/modules/pendle/trade.js +1 -1
  207. package/build/dist/api/modules/pendle/validate.js +1 -1
  208. package/build/dist/api/modules/pendle/verify.js +1 -1
  209. package/build/dist/api/modules/pons/claim.js +1 -1
  210. package/build/dist/api/modules/pons/holder-directory.js +1 -1
  211. package/build/dist/api/modules/pons/index.js +1 -1
  212. package/build/dist/api/modules/pons/launch-status.js +1 -1
  213. package/build/dist/api/modules/pons/prices.js +1 -1
  214. package/build/dist/api/modules/pons/reads.js +1 -1
  215. package/build/dist/api/modules/pons/swap-terms.js +1 -1
  216. package/build/dist/api/modules/pons/trade.d.ts +3 -2
  217. package/build/dist/api/modules/pons/trade.js +1 -1
  218. package/build/dist/api/modules/poolstrade/index.js +1 -1
  219. package/build/dist/api/modules/priors/coverage.js +1 -1
  220. package/build/dist/api/modules/priors/discovery.js +1 -1
  221. package/build/dist/api/modules/priors/features.js +1 -1
  222. package/build/dist/api/modules/priors/holdings.js +1 -1
  223. package/build/dist/api/modules/priors/index.js +1 -1
  224. package/build/dist/api/modules/priors/integration.d.ts +1 -0
  225. package/build/dist/api/modules/priors/integration.js +1 -1
  226. package/build/dist/api/modules/priors/market.js +1 -1
  227. package/build/dist/api/modules/priors/pt.js +1 -1
  228. package/build/dist/api/modules/priors/savings-exit.js +1 -1
  229. package/build/dist/api/modules/priors/starter-line.js +1 -1
  230. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  231. package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
  232. package/build/dist/api/modules/raeto/authorization.js +1 -0
  233. package/build/dist/api/modules/raeto/copy.d.ts +46 -0
  234. package/build/dist/api/modules/raeto/copy.js +1 -0
  235. package/build/dist/api/modules/raeto/errors.d.ts +4 -0
  236. package/build/dist/api/modules/raeto/errors.js +1 -0
  237. package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
  238. package/build/dist/api/modules/raeto/estimate.js +1 -0
  239. package/build/dist/api/modules/raeto/index.d.ts +16 -0
  240. package/build/dist/api/modules/raeto/index.js +1 -0
  241. package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
  242. package/build/dist/api/modules/raeto/pairing.js +1 -0
  243. package/build/dist/api/modules/raeto/pins.d.ts +24 -0
  244. package/build/dist/api/modules/raeto/pins.js +1 -0
  245. package/build/dist/api/modules/raeto/templates.d.ts +22 -0
  246. package/build/dist/api/modules/raeto/templates.js +1 -0
  247. package/build/dist/api/modules/raeto/terms.d.ts +8 -0
  248. package/build/dist/api/modules/raeto/terms.js +1 -0
  249. package/build/dist/api/modules/raeto/types.d.ts +64 -0
  250. package/build/dist/api/modules/raeto/types.js +0 -0
  251. package/build/dist/api/modules/relay/api.d.ts +16 -0
  252. package/build/dist/api/modules/relay/api.js +1 -1
  253. package/build/dist/api/modules/relay/bootstrap.js +1 -1
  254. package/build/dist/api/modules/relay/discovery.js +1 -1
  255. package/build/dist/api/modules/relay/inbound.js +1 -1
  256. package/build/dist/api/modules/relay/index.d.ts +1 -0
  257. package/build/dist/api/modules/relay/index.js +1 -1
  258. package/build/dist/api/modules/relay/order.js +1 -1
  259. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  260. package/build/dist/api/modules/relay/readiness.d.ts +1 -0
  261. package/build/dist/api/modules/relay/readiness.js +1 -1
  262. package/build/dist/api/modules/relay/reads.js +1 -1
  263. package/build/dist/api/modules/relay/vaults.js +1 -1
  264. package/build/dist/api/modules/spark/actions.js +1 -1
  265. package/build/dist/api/modules/spark/details.js +1 -1
  266. package/build/dist/api/modules/spark/index.js +1 -1
  267. package/build/dist/api/modules/spark/management.js +1 -1
  268. package/build/dist/api/modules/steakhouse/analytics.js +1 -1
  269. package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
  270. package/build/dist/api/modules/steakhouse/index.js +1 -1
  271. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  272. package/build/dist/api/modules/steakhouse/management.js +1 -1
  273. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  274. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  275. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  276. package/build/dist/api/modules/tickerspring/discovery.js +1 -1
  277. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  278. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  279. package/build/dist/api/modules/tickerspring/index.js +1 -1
  280. package/build/dist/api/modules/tickerspring/journeys.d.ts +1 -0
  281. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  282. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  283. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  284. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  285. package/build/dist/api/modules/tickerspring/research.js +1 -1
  286. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  287. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  288. package/build/dist/api/modules/uniswap/auction.js +1 -1
  289. package/build/dist/api/modules/uniswap/batch.js +1 -1
  290. package/build/dist/api/modules/uniswap/common.js +1 -1
  291. package/build/dist/api/modules/uniswap/fee-percent.d.ts +4 -0
  292. package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
  293. package/build/dist/api/modules/uniswap/fees.js +1 -1
  294. package/build/dist/api/modules/uniswap/index.js +1 -1
  295. package/build/dist/api/modules/uniswap/local-guard.d.ts +2 -0
  296. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  297. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  298. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  299. package/build/dist/api/modules/uniswap/pools.d.ts +2 -0
  300. package/build/dist/api/modules/uniswap/pools.js +1 -1
  301. package/build/dist/api/modules/uniswap/position.js +1 -1
  302. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  303. package/build/dist/api/modules/uniswap/quote-guard.d.ts +38 -0
  304. package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
  305. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  306. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  307. package/build/dist/api/modules/uniswap/trade.d.ts +10 -3
  308. package/build/dist/api/modules/uniswap/trade.js +1 -1
  309. package/build/dist/api/modules/uniswap/v2.js +1 -1
  310. package/build/dist/api/modules/uniswap/v3.js +1 -1
  311. package/build/dist/api/modules/uniswap/v4.d.ts +6 -0
  312. package/build/dist/api/modules/uniswap/v4.js +1 -1
  313. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  314. package/build/dist/api/modules/upoch/copy.d.ts +5 -0
  315. package/build/dist/api/modules/upoch/copy.js +1 -0
  316. package/build/dist/api/modules/upoch/index.d.ts +8 -0
  317. package/build/dist/api/modules/upoch/index.js +1 -0
  318. package/build/dist/api/modules/upoch/pins.d.ts +8 -0
  319. package/build/dist/api/modules/upoch/pins.js +1 -0
  320. package/build/dist/api/modules/upoch/reads.d.ts +509 -0
  321. package/build/dist/api/modules/upoch/reads.js +1 -0
  322. package/build/dist/api/modules/velora/claims.js +1 -1
  323. package/build/dist/api/modules/velora/delta-reads.js +1 -1
  324. package/build/dist/api/modules/velora/index.js +1 -1
  325. package/build/dist/api/modules/wormhole/index.js +1 -1
  326. package/build/dist/api/modules/wormhole/scan-text.js +1 -1
  327. package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -1
  328. package/build/dist/api/modules/wormhole/third-party-text.d.ts +14 -3
  329. package/build/dist/api/modules/wormhole/third-party-text.js +1 -1
  330. package/build/dist/api/modules/wormhole/token-check.js +1 -1
  331. package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
  332. package/build/dist/api/modules/wormhole/x402-client.js +1 -1
  333. package/build/dist/api/oak-fee.d.ts +12 -0
  334. package/build/dist/api/oak-fee.js +1 -0
  335. package/build/dist/api/param-text.d.ts +22 -0
  336. package/build/dist/api/param-text.js +1 -0
  337. package/build/dist/api/position-economics.d.ts +70 -0
  338. package/build/dist/api/position-economics.js +1 -0
  339. package/build/dist/api/positions.d.ts +8 -5
  340. package/build/dist/api/positions.js +1 -1
  341. package/build/dist/api/pricenote.js +1 -1
  342. package/build/dist/api/prices.d.ts +3 -0
  343. package/build/dist/api/prices.js +1 -1
  344. package/build/dist/api/pricing.js +1 -1
  345. package/build/dist/api/progress.d.ts +7 -0
  346. package/build/dist/api/progress.js +1 -0
  347. package/build/dist/api/read-budgets.d.ts +4 -0
  348. package/build/dist/api/read-budgets.js +1 -0
  349. package/build/dist/api/read-shape.d.ts +45 -0
  350. package/build/dist/api/read-shape.js +1 -0
  351. package/build/dist/api/revert.d.ts +23 -0
  352. package/build/dist/api/revert.js +1 -0
  353. package/build/dist/api/routes.js +1 -1
  354. package/build/dist/api/rpc.d.ts +1 -0
  355. package/build/dist/api/rpc.js +1 -1
  356. package/build/dist/api/secret-fields.d.ts +2 -0
  357. package/build/dist/api/secret-fields.js +1 -1
  358. package/build/dist/api/send.js +1 -1
  359. package/build/dist/api/signing-registry.d.ts +8 -0
  360. package/build/dist/api/signing-registry.js +1 -1
  361. package/build/dist/api/signing.js +1 -1
  362. package/build/dist/api/simulate.js +1 -1
  363. package/build/dist/api/swap.d.ts +4 -0
  364. package/build/dist/api/swap.js +1 -1
  365. package/build/dist/api/tokens.d.ts +1 -0
  366. package/build/dist/api/tokens.js +1 -1
  367. package/build/dist/api/tool-policy.d.ts +1 -0
  368. package/build/dist/api/tool-policy.js +1 -1
  369. package/build/dist/api/types.d.ts +3 -0
  370. package/build/dist/api/untrusted-unwrap.d.ts +1 -0
  371. package/build/dist/api/untrusted-unwrap.js +1 -0
  372. package/build/dist/api/usd-estimate.d.ts +23 -0
  373. package/build/dist/api/usd-estimate.js +1 -0
  374. package/build/dist/api/vendor-limits.js +1 -1
  375. package/build/dist/chunks/23HNDJ76.js +2 -0
  376. package/build/dist/chunks/24Q3FNGX.js +1 -0
  377. package/build/dist/chunks/25C4DTVA.js +1 -0
  378. package/build/dist/chunks/2GXHYI23.js +1 -0
  379. package/build/dist/chunks/2HN3U6OG.js +1 -0
  380. package/build/dist/chunks/{QU5XKRGK.js → 2OVJ2BTJ.js} +1 -1
  381. package/build/dist/chunks/{FUDAXV5X.js → 2QGLPY2D.js} +1 -1
  382. package/build/dist/chunks/2WRXH6BL.js +1 -0
  383. package/build/dist/chunks/2ZBSE2LD.js +2 -0
  384. package/build/dist/chunks/2ZQ7X223.js +1 -0
  385. package/build/dist/chunks/2ZWKIBJT.js +1 -0
  386. package/build/dist/chunks/3A2IKFTV.js +1 -0
  387. package/build/dist/chunks/3CH2IPQL.js +1 -0
  388. package/build/dist/chunks/3PU2SD3U.js +2 -0
  389. package/build/dist/chunks/{ER47KGRM.js → 3ZH5SOC2.js} +1 -1
  390. package/build/dist/chunks/4NBXBKOX.js +2 -0
  391. package/build/dist/chunks/{WV3A3OUU.js → 4PLLS6CT.js} +1 -1
  392. package/build/dist/chunks/4R3G3H42.js +1 -0
  393. package/build/dist/chunks/4TTDAF4B.js +1 -0
  394. package/build/dist/chunks/4Z3IGMU6.js +1 -0
  395. package/build/dist/chunks/5DPJQCKJ.js +68 -0
  396. package/build/dist/chunks/{SJJR4ZBZ.js → 5GQJVKVY.js} +1 -1
  397. package/build/dist/chunks/5R576SDB.js +1 -0
  398. package/build/dist/chunks/5RXALTDT.js +1 -0
  399. package/build/dist/chunks/5TUXSOMI.js +1 -0
  400. package/build/dist/chunks/5UAXLWJ2.js +1 -0
  401. package/build/dist/chunks/{QQECG3WP.js → 5W74Z4WZ.js} +1 -1
  402. package/build/dist/chunks/5XAXJEWM.js +5 -0
  403. package/build/dist/chunks/65356YKW.js +1 -0
  404. package/build/dist/chunks/65OITTDL.js +1 -0
  405. package/build/dist/chunks/6F527FLN.js +1 -0
  406. package/build/dist/chunks/6MDYKE2O.js +1 -0
  407. package/build/dist/chunks/6OCLWSMZ.js +1 -0
  408. package/build/dist/chunks/75SULXNT.js +1 -0
  409. package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
  410. package/build/dist/chunks/7U62MMUQ.js +1 -0
  411. package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
  412. package/build/dist/chunks/A2V4NFVA.js +1 -0
  413. package/build/dist/chunks/A3BJSQ23.js +1 -0
  414. package/build/dist/chunks/ACH4BSME.js +3 -0
  415. package/build/dist/chunks/ADIPEGNN.js +1 -0
  416. package/build/dist/chunks/AHUCYDBC.js +1 -0
  417. package/build/dist/chunks/ANIF3JMV.js +4 -0
  418. package/build/dist/chunks/{ALLLYOUG.js → ATEVAJ5Y.js} +1 -1
  419. package/build/dist/chunks/B2HSLY5F.js +1 -0
  420. package/build/dist/chunks/{WTXC3XKW.js → B7BNDW35.js} +1 -1
  421. package/build/dist/chunks/BE3A7677.js +1 -0
  422. package/build/dist/chunks/{PAY5PD4H.js → BX46C5ZP.js} +1 -1
  423. package/build/dist/chunks/C3WBHFLX.js +1 -0
  424. package/build/dist/chunks/C6VJAL5B.js +1 -0
  425. package/build/dist/chunks/C76D54YG.js +1 -0
  426. package/build/dist/chunks/CD2JQ32C.js +1 -0
  427. package/build/dist/chunks/CI5ENLYA.js +1 -0
  428. package/build/dist/chunks/CNLL4NCR.js +1 -0
  429. package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
  430. package/build/dist/chunks/CSOO4SW7.js +1 -0
  431. package/build/dist/chunks/CZL6T2ZQ.js +1 -0
  432. package/build/dist/chunks/CZQ2CGYV.js +1 -0
  433. package/build/dist/chunks/D2IYA4LP.js +1 -0
  434. package/build/dist/chunks/D7QXZM3S.js +1 -0
  435. package/build/dist/chunks/{GNC6RXLT.js → DBOGRUPS.js} +1 -1
  436. package/build/dist/chunks/DGCJZ3HO.js +1 -0
  437. package/build/dist/chunks/DGDMRATN.js +1 -0
  438. package/build/dist/chunks/DMB64UIN.js +1 -0
  439. package/build/dist/chunks/DMDOSHV7.js +1 -0
  440. package/build/dist/chunks/DRLBTB4E.js +1 -0
  441. package/build/dist/chunks/E76Z2TT4.js +1 -0
  442. package/build/dist/chunks/EFESPGA2.js +1 -0
  443. package/build/dist/chunks/EHK7CDTU.js +1 -0
  444. package/build/dist/chunks/ELHRXA5U.js +1 -0
  445. package/build/dist/chunks/F7MGYRPU.js +1 -0
  446. package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
  447. package/build/dist/chunks/{QBIY6FQN.js → FGEGJOAA.js} +1 -1
  448. package/build/dist/chunks/FHTNMGFR.js +1 -0
  449. package/build/dist/chunks/FN6GNTPR.js +1 -0
  450. package/build/dist/chunks/{EGYVRQUR.js → FTMA24EC.js} +1 -1
  451. package/build/dist/chunks/FXOFR432.js +1 -0
  452. package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
  453. package/build/dist/chunks/G2LAO23N.js +1 -0
  454. package/build/dist/chunks/{WIRBCS4W.js → GBIBRYOV.js} +1 -1
  455. package/build/dist/chunks/GDOHHXNH.js +1 -0
  456. package/build/dist/chunks/{GSBIERZD.js → GP6YO24Z.js} +1 -1
  457. package/build/dist/chunks/GQ3XZFRL.js +1 -0
  458. package/build/dist/chunks/{4HG6FRVH.js → GQITAJVF.js} +1 -1
  459. package/build/dist/chunks/H3E7UD2X.js +1 -0
  460. package/build/dist/chunks/HFVXNKA5.js +1 -0
  461. package/build/dist/chunks/HHYE42JG.js +21 -0
  462. package/build/dist/chunks/HRAHGYNK.js +1 -0
  463. package/build/dist/chunks/HS5HWBMU.js +1 -0
  464. package/build/dist/chunks/{BND2UFVW.js → HVFMIURK.js} +1 -1
  465. package/build/dist/chunks/IBL6TL2Q.js +1 -0
  466. package/build/dist/chunks/IT2JLILU.js +1 -0
  467. package/build/dist/chunks/IV4K7FMD.js +1 -0
  468. package/build/dist/chunks/{PNA6UIE5.js → JDSSYT6R.js} +1 -1
  469. package/build/dist/chunks/JFWJBZ7M.js +1 -0
  470. package/build/dist/chunks/JI5DXDMY.js +1 -0
  471. package/build/dist/chunks/JJGZ7W3V.js +1 -0
  472. package/build/dist/chunks/JPPQDELB.js +18 -0
  473. package/build/dist/chunks/{OLSP46ZD.js → K4P5VYDP.js} +1 -1
  474. package/build/dist/chunks/{JFYBH3DX.js → K6D6SDIG.js} +1 -1
  475. package/build/dist/chunks/K7HTDKAT.js +1 -0
  476. package/build/dist/chunks/KBU3PYP7.js +1 -0
  477. package/build/dist/chunks/KH4QFN72.js +3 -0
  478. package/build/dist/chunks/KMSAUFYV.js +1 -0
  479. package/build/dist/chunks/{RTAHNWHN.js → KOTGFD2V.js} +1 -1
  480. package/build/dist/chunks/KZA5GYZR.js +1 -0
  481. package/build/dist/chunks/LCH6F5HT.js +1 -0
  482. package/build/dist/chunks/LDJI2JAL.js +1 -0
  483. package/build/dist/chunks/LEV5SNNC.js +3 -0
  484. package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
  485. package/build/dist/chunks/{PIIHOXWF.js → LJJYYUEG.js} +1 -1
  486. package/build/dist/chunks/LKX5WDOQ.js +1 -0
  487. package/build/dist/chunks/LVFI74ST.js +1 -0
  488. package/build/dist/chunks/M7BUKZW2.js +1 -0
  489. package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
  490. package/build/dist/chunks/MMCM3GSM.js +1 -0
  491. package/build/dist/chunks/MQ5F2VOK.js +1 -0
  492. package/build/dist/chunks/MSMHS456.js +1 -0
  493. package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
  494. package/build/dist/chunks/{XSKFKBDR.js → N64JJN37.js} +1 -1
  495. package/build/dist/chunks/NAO7VWZF.js +1 -0
  496. package/build/dist/chunks/ND32LJWI.js +1 -0
  497. package/build/dist/chunks/{Q42YI3EP.js → NMJVQX5M.js} +1 -1
  498. package/build/dist/chunks/NMQBOBWJ.js +1 -0
  499. package/build/dist/chunks/NQ4MTIU3.js +1 -0
  500. package/build/dist/chunks/NWPAQER2.js +1 -0
  501. package/build/dist/chunks/O2J5I4VA.js +1 -0
  502. package/build/dist/chunks/O4S6XAYV.js +1 -0
  503. package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
  504. package/build/dist/chunks/{RUC7KH7A.js → OB7BFDOV.js} +1 -1
  505. package/build/dist/chunks/OEZ7FCLF.js +1 -0
  506. package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
  507. package/build/dist/chunks/{WP6RHXGN.js → OIQTZOBN.js} +1 -1
  508. package/build/dist/chunks/OODSXDIH.js +1 -0
  509. package/build/dist/chunks/OOPMZIG7.js +1 -0
  510. package/build/dist/chunks/OQFNUDMQ.js +1 -0
  511. package/build/dist/chunks/ORG6LVKJ.js +1 -0
  512. package/build/dist/chunks/{CBLMQ5UU.js → OSMOBKRQ.js} +1 -1
  513. package/build/dist/chunks/OTLUQWLF.js +1 -0
  514. package/build/dist/chunks/{2MT3G7YZ.js → OTYB6BHK.js} +1 -1
  515. package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
  516. package/build/dist/chunks/{SMYWWIE6.js → OVM4QIET.js} +1 -1
  517. package/build/dist/chunks/OYDKAIS2.js +1 -0
  518. package/build/dist/chunks/P6OB2AFW.js +1 -0
  519. package/build/dist/chunks/PDPTJMTJ.js +1 -0
  520. package/build/dist/chunks/PEHXHQVA.js +1 -0
  521. package/build/dist/chunks/PMFR47H3.js +1 -0
  522. package/build/dist/chunks/PQXYTOV5.js +1 -0
  523. package/build/dist/chunks/PSGRZWES.js +1 -0
  524. package/build/dist/chunks/PZEF5LBL.js +2 -0
  525. package/build/dist/chunks/Q7L3BX6U.js +1 -0
  526. package/build/dist/chunks/QBYV7NXH.js +1 -0
  527. package/build/dist/chunks/QIB6OMQV.js +1 -0
  528. package/build/dist/chunks/QLAOBULN.js +1 -0
  529. package/build/dist/chunks/QLFPAN6S.js +1 -0
  530. package/build/dist/chunks/QMEGAKLI.js +1 -0
  531. package/build/dist/chunks/QMNUB2GM.js +2 -0
  532. package/build/dist/chunks/QMZEGT5B.js +1 -0
  533. package/build/dist/chunks/R73R4KN3.js +1 -0
  534. package/build/dist/chunks/RN3WUJIO.js +1 -0
  535. package/build/dist/chunks/RNCMXKKS.js +1 -0
  536. package/build/dist/chunks/ROQQ62LP.js +1 -0
  537. package/build/dist/chunks/RUTSEGGD.js +1 -0
  538. package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
  539. package/build/dist/chunks/{2VXLVXIB.js → S4UJDZGN.js} +1 -1
  540. package/build/dist/chunks/SCG5HWMN.js +1 -0
  541. package/build/dist/chunks/{XQA5LCL6.js → SENOU5JR.js} +1 -1
  542. package/build/dist/chunks/SMSXZ3FN.js +1 -0
  543. package/build/dist/chunks/SUNTJ6IU.js +1 -0
  544. package/build/dist/chunks/SZ466I5X.js +1 -0
  545. package/build/dist/chunks/TGFQQCRY.js +1 -0
  546. package/build/dist/chunks/{K4DHHQBI.js → THL4TMQW.js} +2 -2
  547. package/build/dist/chunks/TI727O2H.js +1 -0
  548. package/build/dist/chunks/{UD2XMNIT.js → TMRAF2L2.js} +1 -1
  549. package/build/dist/chunks/TNJTET4G.js +1 -0
  550. package/build/dist/chunks/TVIMP5CK.js +1 -0
  551. package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
  552. package/build/dist/chunks/U243AWCH.js +1 -0
  553. package/build/dist/chunks/U762746N.js +1 -0
  554. package/build/dist/chunks/U7UPLF4F.js +1 -0
  555. package/build/dist/chunks/{7QIO77VE.js → UPKVD7WG.js} +1 -1
  556. package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
  557. package/build/dist/chunks/USEF3QKG.js +1 -0
  558. package/build/dist/chunks/UVAR6BHU.js +1 -0
  559. package/build/dist/chunks/V5YSJKRH.js +70 -0
  560. package/build/dist/chunks/VB36EHIR.js +1 -0
  561. package/build/dist/chunks/VMZYFO6I.js +1 -0
  562. package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
  563. package/build/dist/chunks/{U4JGEMKT.js → VVAM3EAK.js} +1 -1
  564. package/build/dist/chunks/VVJO6OYK.js +1 -0
  565. package/build/dist/chunks/VVWFB53Q.js +1 -0
  566. package/build/dist/chunks/VXCGMALF.js +1 -0
  567. package/build/dist/chunks/VZVW5J7J.js +1 -0
  568. package/build/dist/chunks/W32UECOL.js +1 -0
  569. package/build/dist/chunks/{XD6X3KTC.js → W4RYRLL5.js} +1 -1
  570. package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
  571. package/build/dist/chunks/WBNFRPAT.js +1 -0
  572. package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
  573. package/build/dist/chunks/{4DP2VPXR.js → WOGWLFAL.js} +1 -1
  574. package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
  575. package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
  576. package/build/dist/chunks/X24YTJST.js +1 -0
  577. package/build/dist/chunks/{IPN6Z4JM.js → X5AL3DUK.js} +1 -1
  578. package/build/dist/chunks/XBNZ7GTY.js +1 -0
  579. package/build/dist/chunks/{XL3LLGIR.js → XEBMS5KU.js} +1 -1
  580. package/build/dist/chunks/XEPCDGN2.js +1 -0
  581. package/build/dist/chunks/{KIFZ5ZSK.js → XL3W7DAQ.js} +1 -1
  582. package/build/dist/chunks/{DL6AEWEM.js → XPWGPZ2C.js} +1 -1
  583. package/build/dist/chunks/{T7TFUH5K.js → XRDLMTBJ.js} +1 -1
  584. package/build/dist/chunks/XTFRPI4G.js +1 -0
  585. package/build/dist/chunks/XV3YJ4P6.js +1 -0
  586. package/build/dist/chunks/XW3VGWXK.js +1 -0
  587. package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
  588. package/build/dist/chunks/Y64GFBTA.js +1 -0
  589. package/build/dist/chunks/YARZE7SJ.js +1 -0
  590. package/build/dist/chunks/YBLJ75U5.js +1 -0
  591. package/build/dist/chunks/YEIM6BZQ.js +1 -0
  592. package/build/dist/chunks/YRSAZTTC.js +7 -0
  593. package/build/dist/chunks/YXXK6EPI.js +1 -0
  594. package/build/dist/chunks/Z3IBPCY4.js +2 -0
  595. package/build/dist/chunks/{QHBS3PVU.js → Z7FGEWO2.js} +1 -1
  596. package/build/dist/chunks/ZNPVBNC5.js +1 -0
  597. package/build/dist/chunks/ZQ6AF3VX.js +1 -0
  598. package/build/dist/chunks/ZTKT3ZQK.js +1 -0
  599. package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
  600. package/package.json +1 -1
  601. package/build/dist/chunks/2THSW4QN.js +0 -1
  602. package/build/dist/chunks/2TK3ETUO.js +0 -1
  603. package/build/dist/chunks/35KR3VSS.js +0 -1
  604. package/build/dist/chunks/3GQ7A3VB.js +0 -1
  605. package/build/dist/chunks/3XNZUIRU.js +0 -1
  606. package/build/dist/chunks/46547QT3.js +0 -1
  607. package/build/dist/chunks/4EN6MQEI.js +0 -1
  608. package/build/dist/chunks/4I3OU56B.js +0 -1
  609. package/build/dist/chunks/52ELWNXJ.js +0 -2
  610. package/build/dist/chunks/5AXWBSPG.js +0 -1
  611. package/build/dist/chunks/5N3O42X6.js +0 -1
  612. package/build/dist/chunks/5SMVQCAP.js +0 -1
  613. package/build/dist/chunks/5SZPNZG4.js +0 -1
  614. package/build/dist/chunks/64GOINYS.js +0 -1
  615. package/build/dist/chunks/6I4NTKB2.js +0 -1
  616. package/build/dist/chunks/6JAXZNZ3.js +0 -1
  617. package/build/dist/chunks/6O3Q5B6M.js +0 -1
  618. package/build/dist/chunks/6OGDTEGH.js +0 -1
  619. package/build/dist/chunks/6WZX7C4T.js +0 -2
  620. package/build/dist/chunks/6YB3VOUL.js +0 -1
  621. package/build/dist/chunks/7GJ6SLEV.js +0 -1
  622. package/build/dist/chunks/7KWZ5QJU.js +0 -1
  623. package/build/dist/chunks/7QZOTRSA.js +0 -2
  624. package/build/dist/chunks/7WSHW7KW.js +0 -1
  625. package/build/dist/chunks/A7I4IWUB.js +0 -1
  626. package/build/dist/chunks/ABPL3ZZI.js +0 -1
  627. package/build/dist/chunks/ACW63WIL.js +0 -20
  628. package/build/dist/chunks/AEL62KCG.js +0 -1
  629. package/build/dist/chunks/AKYF5264.js +0 -7
  630. package/build/dist/chunks/AW7AXQCZ.js +0 -1
  631. package/build/dist/chunks/AXRL3REN.js +0 -1
  632. package/build/dist/chunks/BBTPRZ6T.js +0 -1
  633. package/build/dist/chunks/BOVMED7R.js +0 -1
  634. package/build/dist/chunks/BTPXJAUX.js +0 -1
  635. package/build/dist/chunks/C7AXJHBT.js +0 -1
  636. package/build/dist/chunks/CBG5HARQ.js +0 -2
  637. package/build/dist/chunks/CDPSMI3Z.js +0 -1
  638. package/build/dist/chunks/CHXBOXOD.js +0 -1
  639. package/build/dist/chunks/CQEJSCFQ.js +0 -1
  640. package/build/dist/chunks/DBNTZEAJ.js +0 -1
  641. package/build/dist/chunks/DHUDSOGR.js +0 -18
  642. package/build/dist/chunks/DJN3JAWB.js +0 -1
  643. package/build/dist/chunks/E3RACZUY.js +0 -1
  644. package/build/dist/chunks/FEYAY6OZ.js +0 -1
  645. package/build/dist/chunks/FJ4S4GHY.js +0 -1
  646. package/build/dist/chunks/FWD4L3CJ.js +0 -1
  647. package/build/dist/chunks/GG6Y4OCJ.js +0 -1
  648. package/build/dist/chunks/GGHBFLRC.js +0 -1
  649. package/build/dist/chunks/GGSAKCND.js +0 -1
  650. package/build/dist/chunks/GRQYTVNT.js +0 -1
  651. package/build/dist/chunks/H6T5FXEX.js +0 -1
  652. package/build/dist/chunks/HHXBUYHO.js +0 -1
  653. package/build/dist/chunks/HKEMQBFA.js +0 -1
  654. package/build/dist/chunks/HQUVB7Z5.js +0 -3
  655. package/build/dist/chunks/HU7IMNBI.js +0 -1
  656. package/build/dist/chunks/HWX36XJI.js +0 -1
  657. package/build/dist/chunks/I26DMNJG.js +0 -1
  658. package/build/dist/chunks/I55MURSJ.js +0 -1
  659. package/build/dist/chunks/IMO3GDA5.js +0 -1
  660. package/build/dist/chunks/IPRVIKYC.js +0 -1
  661. package/build/dist/chunks/IVX4R5OL.js +0 -1
  662. package/build/dist/chunks/JQOQMFWD.js +0 -3
  663. package/build/dist/chunks/JUZ5JU6D.js +0 -70
  664. package/build/dist/chunks/JZS3E66E.js +0 -1
  665. package/build/dist/chunks/K3RDPI5J.js +0 -1
  666. package/build/dist/chunks/KBKK7UNY.js +0 -1
  667. package/build/dist/chunks/KVFZKPJT.js +0 -1
  668. package/build/dist/chunks/L5BLHY34.js +0 -1
  669. package/build/dist/chunks/LKXO2BQS.js +0 -1
  670. package/build/dist/chunks/LKZX4CAA.js +0 -1
  671. package/build/dist/chunks/LYMNHO5T.js +0 -1
  672. package/build/dist/chunks/M2UXYCKH.js +0 -1
  673. package/build/dist/chunks/M37654RL.js +0 -1
  674. package/build/dist/chunks/M6LC6DRE.js +0 -1
  675. package/build/dist/chunks/MOE3EVAL.js +0 -1
  676. package/build/dist/chunks/N4Q6GN65.js +0 -1
  677. package/build/dist/chunks/NAZPDRIF.js +0 -1
  678. package/build/dist/chunks/NKX3FE34.js +0 -1
  679. package/build/dist/chunks/NKZKKCK2.js +0 -1
  680. package/build/dist/chunks/NOFUKKP5.js +0 -1
  681. package/build/dist/chunks/O6ROOKY2.js +0 -1
  682. package/build/dist/chunks/OJ4WJUPP.js +0 -1
  683. package/build/dist/chunks/OOZSE2R7.js +0 -1
  684. package/build/dist/chunks/OTXSKFUD.js +0 -1
  685. package/build/dist/chunks/P5AJSLZ7.js +0 -1
  686. package/build/dist/chunks/PACN53TR.js +0 -1
  687. package/build/dist/chunks/PAHXBLCS.js +0 -1
  688. package/build/dist/chunks/PK66GCDT.js +0 -1
  689. package/build/dist/chunks/PSBQWDYI.js +0 -1
  690. package/build/dist/chunks/PXT5YTWU.js +0 -1
  691. package/build/dist/chunks/PZGGE5D3.js +0 -1
  692. package/build/dist/chunks/QA2RRIES.js +0 -1
  693. package/build/dist/chunks/QA3UHEO3.js +0 -1
  694. package/build/dist/chunks/QFNT73OF.js +0 -1
  695. package/build/dist/chunks/QW2OPEYJ.js +0 -1
  696. package/build/dist/chunks/QYVREJYC.js +0 -1
  697. package/build/dist/chunks/ROFPXEQ5.js +0 -2
  698. package/build/dist/chunks/RTGS7RIO.js +0 -1
  699. package/build/dist/chunks/RUX3RY7Y.js +0 -1
  700. package/build/dist/chunks/RVDUSNWW.js +0 -1
  701. package/build/dist/chunks/S5CBVFHY.js +0 -1
  702. package/build/dist/chunks/SIYUNOLI.js +0 -1
  703. package/build/dist/chunks/TEJ7W534.js +0 -1
  704. package/build/dist/chunks/TPBAFS7K.js +0 -1
  705. package/build/dist/chunks/TVWMTMEF.js +0 -1
  706. package/build/dist/chunks/U2RMUVVY.js +0 -1
  707. package/build/dist/chunks/U5PMVP56.js +0 -1
  708. package/build/dist/chunks/V5JWGWXC.js +0 -1
  709. package/build/dist/chunks/VCOTCVKN.js +0 -1
  710. package/build/dist/chunks/VEQBHI6O.js +0 -1
  711. package/build/dist/chunks/VNV6ZISN.js +0 -1
  712. package/build/dist/chunks/VYAJXLND.js +0 -1
  713. package/build/dist/chunks/WCNHZYQQ.js +0 -1
  714. package/build/dist/chunks/WLMWWEP7.js +0 -2
  715. package/build/dist/chunks/X2P55AC3.js +0 -1
  716. package/build/dist/chunks/XBE3B6Y2.js +0 -1
  717. package/build/dist/chunks/XKSVTN5X.js +0 -1
  718. package/build/dist/chunks/XSRIJUFU.js +0 -1
  719. package/build/dist/chunks/YCZPSMZ5.js +0 -1
  720. package/build/dist/chunks/YDNTY67T.js +0 -1
  721. package/build/dist/chunks/YN56C7PN.js +0 -1
  722. package/build/dist/chunks/YRNXGQJC.js +0 -1
  723. package/build/dist/chunks/YWRLY5EA.js +0 -1
  724. package/build/dist/chunks/YWSX6IE6.js +0 -1
  725. package/build/dist/chunks/YXTSWRV5.js +0 -1
  726. package/build/dist/chunks/Z6LZGCVW.js +0 -1
  727. package/build/dist/chunks/ZQWZGH7V.js +0 -1
  728. package/build/dist/chunks/ZSN4IRI5.js +0 -1
  729. package/build/dist/chunks/ZV5HIQXC.js +0 -1
  730. package/build/dist/chunks/ZXJ24B4L.js +0 -1
@@ -1 +1 @@
1
- import{b as o,g as s}from"./NWNYJ26T.js";import{a as i,s as r}from"./FWD4L3CJ.js";var d=new Set(["0x0000000000000000000000000000000000000000","0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r.mainnet.usdg.toLowerCase()]);function a(f,e,n){if(f!=="relay_bridge_in"||e.swap!==void 0||typeof n!="string"||!o.test(n)||e.destinationChainId!==void 0&&e.destinationChainId!==i||e.recipient!==void 0&&(typeof e.recipient!="string"||!s(e.recipient,n)))return!1;let t=e.destinationCurrency??"0x0000000000000000000000000000000000000000";return typeof t=="string"&&d.has(t.toLowerCase())}export{a};
1
+ import{b as o,g as s}from"./NWNYJ26T.js";import{b as i,t as r}from"./TI727O2H.js";var d=new Set(["0x0000000000000000000000000000000000000000","0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r.mainnet.usdg.toLowerCase()]);function a(f,e,n){if(f!=="relay_bridge_in"||e.swap!==void 0||typeof n!="string"||!o.test(n)||e.destinationChainId!==void 0&&e.destinationChainId!==i||e.recipient!==void 0&&(typeof e.recipient!="string"||!s(e.recipient,n)))return!1;let t=e.destinationCurrency??"0x0000000000000000000000000000000000000000";return typeof t=="string"&&d.has(t.toLowerCase())}export{a};
@@ -1 +1 @@
1
- import{b as D}from"./IX3GZMTM.js";import{a as d}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{concat as B,encodeAbiParameters as k,getAddress as v,isAddress as F,keccak256 as g,parseAbiParameters as O,recoverAddress as q,toHex as N}from"viem";import{privateKeyToAccount as U}from"viem/accounts";var T="OakPriceNote",l="1",w=300,E="0x0000000000000000000000000000000000000000",W=g(N("PriceNote(address wallet,uint256 oakPerEthE18,uint64 timestamp,bytes32 nonce)")),L=g(N("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")),M=(1n<<64n)-1n,P=(1n<<256n)-1n,z=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,G=0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;function X(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=Number.parseInt(e.slice(130,132),16);return!(i!==27&&i!==28||n<=0n||n>=z||t<=0n||t>G)}function m(e,n){if(typeof e!="string"||!F(e,{strict:!1}))throw new c(`Invalid ${n} address.`);return v(e)}function p(e,n){let t;if(typeof e=="bigint")t=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new c(`Invalid ${n}.`);t=BigInt(e)}else t=D(e);if(t<0n||t>P)throw new c(`${n} exceeds uint256 bounds.`);return t}function h(e,n){let t=p(e,n);if(t>M)throw new c(`${n} exceeds uint64 bounds.`);return t}function Y(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new c(`${n} must be a 32-byte hex string.`);return e}function j(e){if(typeof e=="bigint"){if(e<=0n||e>P)throw new c("Private key must be a positive scalar.");return`0x${e.toString(16).padStart(64,"0")}`}if(typeof e=="string"&&/^0x[0-9a-fA-F]{1,64}$/.test(e))return`0x${e.slice(2).padStart(64,"0")}`;throw new c("Invalid private key format.")}function K(e){let n=p(e.chainId,"chainId"),t=m(e.verifyingContract,"verifyingContract");return g(k(O("bytes32, bytes32, bytes32, uint256, address"),[L,g(N(e.name)),g(N(e.version)),n,t]))}function ae(e,n=d,t=l){return{name:T,version:t,chainId:Number(p(n,"chainId")),verifyingContract:m(e,"consumer")}}function J(e,n=d,t=l){return K({name:T,version:t,chainId:n,verifyingContract:e})}function Q(e){let n=m(e.wallet,"wallet"),t=p(e.oakPerEthE18,"oakPerEthE18"),i=h(e.timestamp,"timestamp"),r=Y(e.nonce,"nonce");return g(k(O("bytes32, address, uint256, uint64, bytes32"),[W,n,t,i,r]))}function C(e,n,t=d,i=l){let r=J(n,t,i),o=Q(e);return g(B(["0x1901",r,o]))}async function ce(e,n,t,i=d,r=l){let o=C(e,n,i,r);return typeof t=="object"&&t!==null&&"sign"in t?t.sign({hash:o}):U(j(t)).sign({hash:o})}async function Z(e,n,t,i=d,r=l){if(!X(n))return E;try{let o=C(e,t,i,r),x=await q({hash:o,signature:n});return v(x)}catch{return E}}function ee(e,n){let t=p(e,"oakPerEthE18"),i=p(n,"spotOakPerEthE18");if(i<=0n||t<=0n)return!1;if(t>P/2n||i>P/3n)throw new c("Guard arithmetic overflow.");let r=t*2n;return r>=i&&r<=i*3n}function te(e,n,t,i){if("signature"in e&&"consumer"in e&&"note"in e&&!("average"in e))return e;if("note"in e&&"signature"in e&&"consumer"in e){let a=e,f=n??{};return{...f,note:a.note,signature:a.signature,consumer:f.consumer??a.consumer,expiresAt:f.expiresAt??a.expiresAt}}return{...i??{},note:e,signature:n,consumer:t}}async function fe(e,n,t,i){let r=te(e,n,t,i),{note:o,signature:x,consumer:S}=r,a=h(o.timestamp,"timestamp"),f=p(o.oakPerEthE18,"oakPerEthE18"),y=(a+BigInt(w)).toString(),s=(b,V,H)=>({valid:!1,ok:!1,...H?{signer:H}:{},oakPerEthE18:f.toString(),expiresAt:y,reason:b,error:V}),I=r.wallet??r.boundWallet;if(I===void 0)return s("wrong_wallet","Bound wallet context is required to verify a price note.");if(m(o.wallet,"wallet")!==m(I,"boundWallet"))return s("wrong_wallet","Price note wallet does not match the bound wallet.");if(r.now===void 0)return s("expired","Current time (now) is required to verify price note expiry.");let A=h(r.now,"now");if(a>A)return s("not_yet_valid","Price note timestamp is in the future.");if(A-a>BigInt(w))return s("expired","Price note has expired.");if(r.expiresAt!==void 0){let b=h(r.expiresAt,"expiresAt");if(b!==a+BigInt(w)||A>b)return s("expired","Price note has expired.")}let R=r.chainId??d,$=r.version??l,u=await Z(o,x,S,R,$);if(u===E)return s("bad_signature","Price note signature could not be recovered.");if(r.signer===void 0)return s("bad_signature","Expected oracle signer is required to verify a price note.",u);let _=m(r.signer,"signer");return _===E||u!==_?s("bad_signature","Price note signer does not match the oracle signer.",u):r.spotOakPerEthE18===void 0?s("outside_guard","Spot OAK/ETH price is required to verify the price note guard band.",u):ee(f,r.spotOakPerEthE18)?{valid:!0,ok:!0,signer:u,oakPerEthE18:f.toString(),expiresAt:y}:s("outside_guard","Price note is outside the 50% spot guard band.",u)}export{T as a,l as b,w as c,E as d,W as e,K as f,ae as g,J as h,Q as i,C as j,ce as k,Z as l,ee as m,fe as n};
1
+ import{b as D}from"./IX3GZMTM.js";import{b as d}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{concat as B,encodeAbiParameters as k,getAddress as v,isAddress as F,keccak256 as g,parseAbiParameters as O,recoverAddress as q,toHex as N}from"viem";import{privateKeyToAccount as U}from"viem/accounts";var T="OakPriceNote",l="1",w=300,E="0x0000000000000000000000000000000000000000",W=g(N("PriceNote(address wallet,uint256 oakPerEthE18,uint64 timestamp,bytes32 nonce)")),L=g(N("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")),M=(1n<<64n)-1n,P=(1n<<256n)-1n,z=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,G=0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;function X(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=Number.parseInt(e.slice(130,132),16);return!(i!==27&&i!==28||n<=0n||n>=z||t<=0n||t>G)}function m(e,n){if(typeof e!="string"||!F(e,{strict:!1}))throw new c(`Invalid ${n} address.`);return v(e)}function p(e,n){let t;if(typeof e=="bigint")t=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new c(`Invalid ${n}.`);t=BigInt(e)}else t=D(e);if(t<0n||t>P)throw new c(`${n} exceeds uint256 bounds.`);return t}function h(e,n){let t=p(e,n);if(t>M)throw new c(`${n} exceeds uint64 bounds.`);return t}function Y(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new c(`${n} must be a 32-byte hex string.`);return e}function j(e){if(typeof e=="bigint"){if(e<=0n||e>P)throw new c("Private key must be a positive scalar.");return`0x${e.toString(16).padStart(64,"0")}`}if(typeof e=="string"&&/^0x[0-9a-fA-F]{1,64}$/.test(e))return`0x${e.slice(2).padStart(64,"0")}`;throw new c("Invalid private key format.")}function K(e){let n=p(e.chainId,"chainId"),t=m(e.verifyingContract,"verifyingContract");return g(k(O("bytes32, bytes32, bytes32, uint256, address"),[L,g(N(e.name)),g(N(e.version)),n,t]))}function ae(e,n=d,t=l){return{name:T,version:t,chainId:Number(p(n,"chainId")),verifyingContract:m(e,"consumer")}}function J(e,n=d,t=l){return K({name:T,version:t,chainId:n,verifyingContract:e})}function Q(e){let n=m(e.wallet,"wallet"),t=p(e.oakPerEthE18,"oakPerEthE18"),i=h(e.timestamp,"timestamp"),r=Y(e.nonce,"nonce");return g(k(O("bytes32, address, uint256, uint64, bytes32"),[W,n,t,i,r]))}function C(e,n,t=d,i=l){let r=J(n,t,i),o=Q(e);return g(B(["0x1901",r,o]))}async function ce(e,n,t,i=d,r=l){let o=C(e,n,i,r);return typeof t=="object"&&t!==null&&"sign"in t?t.sign({hash:o}):U(j(t)).sign({hash:o})}async function Z(e,n,t,i=d,r=l){if(!X(n))return E;try{let o=C(e,t,i,r),x=await q({hash:o,signature:n});return v(x)}catch{return E}}function ee(e,n){let t=p(e,"oakPerEthE18"),i=p(n,"spotOakPerEthE18");if(i<=0n||t<=0n)return!1;if(t>P/2n||i>P/3n)throw new c("Guard arithmetic overflow.");let r=t*2n;return r>=i&&r<=i*3n}function te(e,n,t,i){if("signature"in e&&"consumer"in e&&"note"in e&&!("average"in e))return e;if("note"in e&&"signature"in e&&"consumer"in e){let a=e,f=n??{};return{...f,note:a.note,signature:a.signature,consumer:f.consumer??a.consumer,expiresAt:f.expiresAt??a.expiresAt}}return{...i??{},note:e,signature:n,consumer:t}}async function fe(e,n,t,i){let r=te(e,n,t,i),{note:o,signature:x,consumer:S}=r,a=h(o.timestamp,"timestamp"),f=p(o.oakPerEthE18,"oakPerEthE18"),y=(a+BigInt(w)).toString(),s=(b,V,H)=>({valid:!1,ok:!1,...H?{signer:H}:{},oakPerEthE18:f.toString(),expiresAt:y,reason:b,error:V}),I=r.wallet??r.boundWallet;if(I===void 0)return s("wrong_wallet","Bound wallet context is required to verify a price note.");if(m(o.wallet,"wallet")!==m(I,"boundWallet"))return s("wrong_wallet","Price note wallet does not match the bound wallet.");if(r.now===void 0)return s("expired","Current time (now) is required to verify price note expiry.");let A=h(r.now,"now");if(a>A)return s("not_yet_valid","Price note timestamp is in the future.");if(A-a>BigInt(w))return s("expired","Price note has expired.");if(r.expiresAt!==void 0){let b=h(r.expiresAt,"expiresAt");if(b!==a+BigInt(w)||A>b)return s("expired","Price note has expired.")}let R=r.chainId??d,$=r.version??l,u=await Z(o,x,S,R,$);if(u===E)return s("bad_signature","Price note signature could not be recovered.");if(r.signer===void 0)return s("bad_signature","Expected oracle signer is required to verify a price note.",u);let _=m(r.signer,"signer");return _===E||u!==_?s("bad_signature","Price note signer does not match the oracle signer.",u):r.spotOakPerEthE18===void 0?s("outside_guard","Spot OAK/ETH price is required to verify the price note guard band.",u):ee(f,r.spotOakPerEthE18)?{valid:!0,ok:!0,signer:u,oakPerEthE18:f.toString(),expiresAt:y}:s("outside_guard","Price note is outside the 50% spot guard band.",u)}export{T as a,l as b,w as c,E as d,W as e,K as f,ae as g,J as h,Q as i,C as j,ce as k,Z as l,ee as m,fe as n};
@@ -0,0 +1 @@
1
+ import{a as D}from"./43LI5NKJ.js";import{b as Q}from"./IX3GZMTM.js";import{b as x,j as J}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as se,encodeAbiParameters as Z,encodeFunctionData as F,erc20Abi as O,getAddress as g,keccak256 as ee,parseAbi as L,parseAbiParameters as oe,zeroAddress as te}from"viem";var I=10n**18n,$=(1n<<256n)-1n,q=g(J[x].morpho.morpho_blue.address),_=oe("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),w=L(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function forceDeallocatePenalty(address) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function owner() view returns (address)","function curator() view returns (address)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function forceDeallocate(address adapter,bytes data,uint256 assets,address onBehalf) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function multicall(bytes[] data)"]),v=L(["function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)"]),ne=L(["function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),M=(e,t)=>e<t?e:t,T=(e,t)=>(e+t-1n)/t;function p(e){if(typeof e!="bigint"||e<0n||e>$)throw new r("Invalid Morpho V2 integer read.");return e}function he(e){if(typeof e!="string")throw new r("Provide maxPenaltyAssets as a USDG base-unit integer string, including 0 for no penalty.");let t=Q(e);if(t>$)throw new r("Penalty limit exceeds uint256.");return t}function h(e){if(typeof e!="string")throw new r("Invalid Morpho V2 address read.");return D(e),g(e)}async function ae(e,t,n){if(await e.getChainId()!==x||n.chainId!==x)throw new r("Vault exit requires chain 4663.");let c=await e.getBlockNumber({cacheTime:0}),a=(m,y,k,S=[])=>e.readContract({address:m,abi:y,functionName:k,args:S,blockNumber:c}),[d,o,i,l,u]=await Promise.all([a(t,w,"adaptersLength"),a(t,w,"liquidityAdapter"),a(t,w,"liquidityData"),a(g(n.address),O,"balanceOf",[t]),a(g(n.address),O,"balanceOf",[q])]);if(p(d)!==1n)throw new r("Force exit requires exactly one verified MorphoMarketV1AdapterV2. This vault needs a separately qualified adapter plan.");let s=h(await a(t,w,"adapters",[0n])),C=h(o);if(C!==te&&C!==s)throw new r("The liquidity adapter is not the supported market adapter.");let[A,N,P,f,B]=await Promise.all([a(s,v,"parentVault"),a(s,v,"asset"),a(s,v,"morpho"),a(s,v,"marketIdsLength"),a(t,w,"forceDeallocatePenalty",[s])]);if(h(A)!==g(t)||h(N)!==g(n.address)||h(P)!==q)throw new r("The adapter does not match this vault and pinned Morpho Blue deployment.");let b=p(f);if(b>64n)throw new r("The adapter market inventory exceeds this reader\u2019s supported size.");let E=p(B);if(E>I/50n)throw new r("The force-deallocation penalty exceeds the documented 2% maximum.");let H;if(C!==te){if(typeof i!="string")throw new r("Invalid liquidity-market data.");let[m]=se(_,i);H=ee(Z(_,[m])).toLowerCase()}let V=await Promise.all(Array.from({length:Number(b)},(m,y)=>a(s,v,"marketIds",[BigInt(y)])));if(V.some(m=>typeof m!="string"||!/^0x[0-9a-f]{64}$/i.test(m))||new Set(V.map(m=>String(m).toLowerCase())).size!==V.length)throw new r("The adapter returned an invalid or duplicate market ID.");let R=await Promise.all(V.map(async m=>{let y=m,[k,S,ie]=await Promise.all([a(q,ne,"idToMarketParams",[y]),a(q,ne,"market",[y]),a(s,v,"expectedSupplyAssets",[y])]);if(!Array.isArray(k)||k.length!==5||!Array.isArray(S)||S.length!==6)throw new r("Invalid Morpho market state.");let z={loanToken:h(k[0]),collateralToken:h(k[1]),oracle:h(k[2]),irm:h(k[3]),lltv:p(k[4])},j=Z(_,[z]);if(ee(j).toLowerCase()!==y.toLowerCase()||z.loanToken!==g(n.address))throw new r("Morpho market identity or loan asset does not match the vault.");let G=p(S[0]),X=p(S[2]);if(X>G)throw new r("Invalid Morpho market liquidity.");let Y=p(ie),K=G-X;return{id:y,adapter:s,data:j,supplied:Y,liquidity:K,capacity:M(Y,K),penalty:E,normal:y.toLowerCase()===H}})),U=p(l),W=p(u),re=U+M(W,R.filter(m=>m.normal).reduce((m,y)=>m+y.capacity,0n));return{vault:t,blockNumber:c,idle:U,blueCash:W,normalCapacity:re,markets:R}}function de(e,t){if(t<=0n||t>$)throw new r("Force exit needs a positive position value.");let n=t>e.normalCapacity?t-e.normalCapacity:0n,c=[],a=e.blueCash-(e.normalCapacity-e.idle);for(let d of e.markets.filter(o=>!o.normal).sort((o,i)=>o.capacity===i.capacity?o.id.localeCompare(i.id):o.capacity>i.capacity?-1:1)){if(n===0n)break;let o=M(d.capacity,a);if(o===0n)continue;let i=s=>s+T(s*d.penalty,I),l=o;i(o)>=n&&(l=T(n*I,I+d.penalty),l>0n&&i(l-1n)>=n&&(l-=1n),l=M(o,l+(T(t,10000n)||1n)));let u=T(l*d.penalty,I);c.push({...d,amount:l,penaltyAssets:u}),a-=l,n=i(l)>=n?0n:n-i(l)}if(n>0n)throw new r("Underlying market liquidity cannot cover this force exit. Request a partial withdrawal or use a separately supported in-kind exit; force deallocation cannot create liquidity.");return{requestedAssets:t,normalCapacity:e.normalCapacity,legs:c,penaltyAssets:c.reduce((d,o)=>d+o.penaltyAssets,0n)}}async function we(e,t,n,c,a,d,o){let i=await ae(t,n,o),l=p(await t.readContract({address:n,abi:O,functionName:"balanceOf",args:[c],blockNumber:i.blockNumber}));if(a<=0n||a>l)throw new r("The fresh share balance cannot cover this exit.");let u=p(await t.readContract({address:n,abi:w,functionName:"previewRedeem",args:[a],blockNumber:i.blockNumber})),s=de(i,u);if(s.penaltyAssets>d)throw new r("The force-exit penalty exceeds maxPenaltyAssets. Inspect a fresh plan before authorizing a larger penalty.");let A=(await Promise.all(s.legs.map(b=>t.readContract({address:n,abi:w,functionName:"previewWithdraw",args:[b.penaltyAssets],blockNumber:i.blockNumber})))).reduce((b,E)=>b+p(E),0n);if(A>=a)throw new r("The penalty would consume the share balance.");let N=a-A,P=s.legs.map(b=>F({abi:w,functionName:"forceDeallocate",args:[b.adapter,b.data,b.amount,c]})),f=F({abi:w,functionName:"redeem",args:[N,c,c]});return P.push(f),{tx:e.unsignedTx({to:n,chainId:x,value:"0",data:s.legs.length?F({abi:w,functionName:"multicall",args:[P]}):f,description:`Exit this wallet\u2019s Morpho V2 shares; estimated penalty ${s.penaltyAssets} ${o.symbol} base units. No approvals.`}),plan:s,penaltyShares:A,redeemShares:N,blockNumber:i.blockNumber}}var ye="This vault lists no lending markets right now, and Morpho's index shows 0% over this window. On these numbers it earns nothing.";async function be(e,t){try{let n=p(await e.readContract({address:t,abi:w,functionName:"adaptersLength"}));if(n>8n)return;let c=await Promise.all(Array.from({length:Number(n)},(d,o)=>e.readContract({address:t,abi:w,functionName:"adapters",args:[BigInt(o)]})));return(await Promise.all(c.map(d=>e.readContract({address:h(d),abi:v,functionName:"marketIdsLength"})))).every(d=>p(d)===0n)}catch{return}}var ce="In-kind exits transfer supported market positions rather than cash; use the project in_kind_exit tool.";function ge(e,t,n,c,a=ce){return{name:t,inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(d,o)=>{try{if(D(o),Object.keys(d).length)throw new r("Vault details takes no arguments.");let i=e.clientFor(x);if(await i.getChainId()!==x)throw new r("Vault details requires chain 4663.");let l=await i.readContract({address:n,abi:L(["function asset() view returns (address)"]),functionName:"asset"});if(h(l)!==g(c.address))throw new r("The vault does not use the pinned underlying asset.");let u=await ae(i,n,c),[s,C,A,N]=await Promise.all(["performanceFee","managementFee","owner","curator"].map(f=>i.readContract({address:n,abi:w,functionName:f,blockNumber:u.blockNumber}))),P={...c,address:g(c.address)};return{vault:n,chainId:x,blockNumber:u.blockNumber.toString(),asset:P,owner:h(A),curator:h(N),idleAssets:u.idle.toString(),normalCapacityAssets:u.normalCapacity.toString(),markets:u.markets.map(f=>({marketId:f.id,adapter:f.adapter,suppliedAssets:f.supplied.toString(),marketLiquidityAssets:f.liquidity.toString(),capacityAssets:f.capacity.toString(),liquidityMarket:f.normal,penaltyWad:f.penalty.toString()})),fees:{performanceFeeWad:p(s).toString(),managementFeePerSecondWad:p(C).toString(),scale:I.toString()},apy:null,apyStatus:"This onchain snapshot does not include APY. Use the module analytics tool for indexed historical APY; maxRate is an accrual ceiling.",capacityCaveat:`Snapshot estimates; gates, price accrual, liquidity and penalties can change. Preview the exact action. Force exits may leave share rounding dust. ${a}`}}catch(i){throw new r(e.plainError(i))}}}}function ke(e,t){return`Force-exit estimate: position ${e.requestedAssets} ${t} base units; penalty ${e.penaltyAssets}; net estimate ${e.requestedAssets-e.penaltyAssets}; effective penalty ${T(e.penaltyAssets*10000n,e.requestedAssets)} bps (rounded up). Penalty limit is a local preview check, not a calldata bound. Re-preview before signing and recheck positions for rounding dust.`}function xe(e,t,n,c,a){let d=(i,l)=>e.filter(u=>u.token.chainId===x&&u.token.address.toLowerCase()===i.toLowerCase()).reduce((u,s)=>{if(s.token.decimals!==l||!/^-?\d+$/.test(s.amount))throw new r("Invalid force-exit preview metadata.");return u+BigInt(s.amount)},0n),o=-d(t,18);if(o<=0n||o>n||d(g(a.address),a.decimals)<c)throw new r("The force-exit preview exceeds the share balance or returns less than minAmountOut.")}export{w as a,p as b,he as c,ae as d,de as e,we as f,ye as g,be as h,ge as i,ke as j,xe as k};
@@ -1 +1 @@
1
- import{c as qe,d as $e,e as be,f as ie,i as ke,j as Me}from"./ALLLYOUG.js";import{b as ne,o as we}from"./BOVMED7R.js";import{a as F,b as ge}from"./43LI5NKJ.js";import{a as Te}from"./IOYRL6AY.js";import{b as z,d as Ue}from"./IX3GZMTM.js";import{a as y,i as O}from"./FWD4L3CJ.js";import{a,b as me,e as N}from"./XSD5NL7J.js";import{decodeFunctionResult as ve,encodeFunctionData as B,getAddress as m,parseAbi as J,zeroAddress as $}from"viem";var re=-887272,se=887272,G=(1n<<128n)-1n,je="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ke="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",Qe="0x3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f",oe=2000n,Ye=5,Le=64n,Ze=1800n,Be="^v3:(0x[0-9a-fA-F]{40}):(0|[1-9][0-9]{0,19}):(0|[1-9][0-9]{0,19})$",Je=new RegExp(Be),et=Object.freeze({type:"string",pattern:Be,description:"v3 only. Pass the nextCursor of the previous page to read the next 64 owner indices at the same block. Cannot be combined with tokenIds."}),w=Object.freeze({factory:m(O[4663].uniswap.v3_factory.address),positionManager:m(O[4663].uniswap.v3_position_manager.address),swapRouter02:m(O[4663].uniswap.swap_router02.address),permit2:m(O[4663].uniswap.permit2.address),weth:m(O[4663].uniswap.WETH.address),usdg:m(O[4663].uniswap.USDG.address),ethUsdgPool:m(O[4663].oracle.ethUsdgPool.address)}),Pe=Object.freeze({100:1,500:10,3e3:60,1e4:200}),Nt=Object.freeze([{fee:100,tickSpacing:1,address:m("0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"),token0:w.weth,token1:w.usdg,recordedLiquidity:"1957537485734736219",recordedSqrtPriceX96:"3839219776288481168641554",recordedTick:-198707,feeProtocol:68},{fee:500,tickSpacing:10,address:m("0x69bfaf19c9f377bb306a89aed9f6b07e2c1a8d9a"),token0:w.weth,token1:w.usdg,recordedLiquidity:"714542894544667104",recordedSqrtPriceX96:"3839644024453020182443671",recordedTick:-198705,feeProtocol:68},{fee:3e3,tickSpacing:60,address:m("0xa9188730fe85be88ad499d7d52b099e800fb0334"),token0:w.weth,token1:w.usdg,recordedLiquidity:"310559629687003603",recordedSqrtPriceX96:"3843235825752878635548672",recordedTick:-198686,feeProtocol:102},{fee:1e4,tickSpacing:200,address:m("0x5f009e071f07e92b6c624e83f52f17bbda34680d"),token0:w.weth,token1:w.usdg,recordedLiquidity:"5822966536584155",recordedSqrtPriceX96:"3853297838190389678059735",recordedTick:-198634,feeProtocol:102}]),P=J(["function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)","function ownerOf(uint256 tokenId) view returns (address)","function balanceOf(address owner) view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)","function mint((address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, address recipient, uint256 deadline) params) payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)","function increaseLiquidity((uint256 tokenId, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) payable returns (uint128 liquidity, uint256 amount0, uint256 amount1)","function decreaseLiquidity((uint256 tokenId, uint128 liquidity, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) payable returns (uint256 amount0, uint256 amount1)","function collect((uint256 tokenId, address recipient, uint128 amount0Max, uint128 amount1Max) params) payable returns (uint256 amount0, uint256 amount1)","function burn(uint256 tokenId) payable","function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96) payable returns (address pool)"]),Y=J(["function getPool(address tokenA, address tokenB, uint24 fee) view returns (address pool)","function feeAmountTickSpacing(uint24 fee) view returns (int24)"]),he=J(["function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)","function liquidity() view returns (uint128)","function tickSpacing() view returns (int24)","function fee() view returns (uint24)","function token0() view returns (address)","function token1() view returns (address)"]),tt=J(["function exactInputSingle((address tokenIn, address tokenOut, uint24 fee, address recipient, uint256 amountIn, uint256 amountOutMinimum, uint160 sqrtPriceLimitX96) params) payable returns (uint256 amountOut)"]),xe=J(["function decimals() view returns (uint8)","function symbol() view returns (string)","function allowance(address owner, address spender) view returns (uint256)"]),nt="0xd0e30db0";function it(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();return e===$||e===je||e==="eth"||e==="native"}function D(t,e){if(it(t))throw new a(`Uniswap v3 requires wrapped ERC-20 WETH (${w.weth}) rather than native ETH in ${e}.`);if(typeof t!="string")throw new a(`${e} must be a valid 20-byte hex address.`);return F(t),m(t)}function ot(t,e,n){let s=Number(t),o=Number(e),i=Number(n);if(!Number.isInteger(i)||i<=0)throw new a("Uniswap v3 tickSpacing must be a positive integer.");if(!Number.isInteger(s)||!Number.isInteger(o))throw new a("Uniswap v3 tickLower and tickUpper must be integers.");if(s<re||o>se||s>se||o<re)throw new a(`Uniswap v3 ticks are out of bounds [${re}, ${se}].`);if(s>=o)throw new a("Uniswap v3 tickLower must be strictly less than tickUpper.");if(s%i!==0||o%i!==0)throw new a(`Uniswap v3 tickLower (${s}) and tickUpper (${o}) must be divisible by tickSpacing (${i}).`);return{tickLower:s,tickUpper:o,tickSpacing:i}}function rt(t,e){let n=t.trim(),s=n.startsWith("-"),o=s||n.startsWith("+")?n.slice(1):n,i=Ue(z(o).toString(),e);return s&&i!=="0"?`-${i}`:i}function st(t){let e=typeof t=="string"?ve({abi:P,functionName:"positions",data:t}):t;return{nonce:BigInt(e[0]),operator:m(String(e[1])),token0:m(String(e[2])),token1:m(String(e[3])),fee:Number(e[4]),tickLower:Number(e[5]),tickUpper:Number(e[6]),liquidity:BigInt(e[7]),feeGrowthInside0LastX128:BigInt(e[8]),feeGrowthInside1LastX128:BigInt(e[9]),tokensOwed0:BigInt(e[10]),tokensOwed1:BigInt(e[11])}}function Re(t,e){if(!t||!Array.isArray(t.logs))return[];let n=e?m(e).toLowerCase():void 0,s=w.positionManager.toLowerCase(),o=new Set;for(let i of t.logs){if(!i||typeof i.address!="string"||i.address.toLowerCase()!==s)continue;let c=Array.isArray(i.topics)?i.topics.map(f=>String(f).toLowerCase()):[],r=c[0];if(r===Ke&&c.length>=4){let d=`0x${c[2].slice(-40)}`;if(!n||d===n){let u=BigInt(c[3]).toString();u!=="0"&&o.add(u)}}else if(r===Qe&&c.length>=2&&!n){let f=BigInt(c[1]).toString();f!=="0"&&o.add(f)}}return[...o]}function Ut(t){let e=n=>typeof n=="bigint"?n:z(n);return B({abi:tt,functionName:"exactInputSingle",args:[{tokenIn:m(t.tokenIn),tokenOut:m(t.tokenOut),fee:t.fee,recipient:m(t.recipient),amountIn:e(t.amountIn),amountOutMinimum:e(t.amountOutMinimum),sqrtPriceLimitX96:t.sqrtPriceLimitX96!==void 0?e(t.sqrtPriceLimitX96):0n}]})}var _e=1n<<96n;function Ee(t){let e=Math.abs(t),n=(e&1)!==0?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&2)!==0&&(n=n*0xfff97272373d413259a46990580e213an>>128n),(e&4)!==0&&(n=n*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&8)!==0&&(n=n*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&16)!==0&&(n=n*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&32)!==0&&(n=n*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&64)!==0&&(n=n*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&128)!==0&&(n=n*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&256)!==0&&(n=n*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&512)!==0&&(n=n*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&1024)!==0&&(n=n*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&2048)!==0&&(n=n*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&4096)!==0&&(n=n*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&8192)!==0&&(n=n*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&16384)!==0&&(n=n*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&32768)!==0&&(n=n*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&65536)!==0&&(n=n*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&131072)!==0&&(n=n*0x5d6af8dedb81196699c329225ee604n>>128n),(e&262144)!==0&&(n=n*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&524288)!==0&&(n=n*0x48a170391f7dc42444e8fa2n>>128n),t>0&&(n=((1n<<256n)-1n)/n),(n>>32n)+(n%(1n<<32n)===0n?0n:1n)}function at(t,e,n,s){if(s<=0n)return{amount0:0n,amount1:0n};let[o,i]=e<n?[e,n]:[n,e];if(t<=o)return{amount0:(s<<96n)*(i-o)/i/o,amount1:0n};if(t<i){let r=(s<<96n)*(i-t)/i/t,f=s*(t-o)/_e;return{amount0:r,amount1:f}}return{amount0:0n,amount1:s*(i-o)/_e}}async function M(t,e,n,s){let o=m(e),i,c;if(n===y&&o===w.weth?(i=18,c="WETH"):n===y&&o===w.usdg&&(i=6,c="USDG"),i===void 0){let r=await t.readContract({address:o,abi:xe,functionName:"decimals"});i=Number(r)}if(c===void 0)try{let r=await t.readContract({address:o,abi:xe,functionName:"symbol"});if(typeof r!="string"||!r.trim())throw new a("Token symbol is unavailable.");c=Me(r.trim(),o)}catch(r){throw new a(`Could not read token metadata. ${N(r)}`)}if(!Number.isInteger(i)||i<0||i>255)throw new a("Token decimals are invalid.");if(s!=null){let r=Number(s);if(!Number.isInteger(r)||r!==i)throw new a(`Token ${o} on chain ${n} has ${i} decimals, not ${String(s)}.`)}return{address:o,symbol:c,decimals:i,chainId:n}}async function ct(t){try{if(!t.getBlock)throw new a("Block timestamps are unavailable.");let e=await t.getBlock();if(typeof e.timestamp!="bigint")throw new a("Invalid block timestamp.");return e.timestamp}catch(e){throw new a(`Could not read the current block timestamp. ${N(e)}`)}}function ee(t,e){if(typeof t=="bigint"){if(t<0n)throw new a(`${e} must be a non-negative integer.`);return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<0)throw new a(`${e} must be a non-negative integer.`);return BigInt(t)}if(typeof t=="string")return z(t);throw new a(`${e} must be a non-negative integer.`)}async function Oe(t,e){let n=await ct(t);if(e==null)return n+Ze;let s=ee(e,"deadline");if(s<=n)throw new a(`Uniswap v3 deadline (${s.toString()}) has expired at timestamp ${n.toString()}.`);return s}function W(t,e){if(typeof t!="string"||!/^\d+$/.test(t))throw new a(`${e} must be a non-negative integer string in base units.`);return z(t)}function De(t){let e=t.slippageBps??ne;if(typeof e!="number")throw new a("Slippage must be an integer from 0 to 9999 bps.");return we("0",e),e}function ae(t,e,n,s){let o=t===void 0?z(we(e.toString(),n)):W(t,s);if(o<=1n)throw new a(`${s} must exceed 1 base unit; the simulated amount may be too small.`);return o}function H(t,e){return ge({to:w.positionManager,data:t,value:"0",chainId:y,description:e})}async function Z(t,e,n){try{if(!t.request)throw new a("Sequential transaction simulation is unavailable.");let o=await t.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:n,gas:`0x${Te.toString(16)}`,to:i.to,data:i.data,value:`0x${BigInt(i.value).toString(16)}`}))}],validation:!1,traceTransfers:!0},"latest"]},{retryCount:0});if(!Array.isArray(o)||o.length!==1||!Array.isArray(o[0]?.calls)||o[0].calls.length!==e.length)throw new a("Unexpected batch simulation response.");return o[0].calls.map((i,c)=>{if(i.status!=="0x1"||i.error||typeof i.returnData!="string"||!/^0x([a-fA-F0-9]{2})*$/.test(i.returnData))throw new a(`Simulation call ${c+1} failed. ${N(i.error)}`);return i.returnData})}catch(s){throw new a(`Uniswap v3 simulation failed. ${N(s)}`)}}function ce(t,e){try{return ve({abi:P,functionName:t,data:e})}catch{throw new a(`Uniswap v3 ${t} simulation returned invalid amounts.`)}}function Ve(t,e,n){if(t.initialPrice!==void 0&&t.sqrtPriceX96!==void 0)throw new a("Provide initialPrice or sqrtPriceX96, not both.");if(t.sqrtPriceX96!==void 0){if(typeof t.sqrtPriceX96!="string"||!/^\d+$/.test(t.sqrtPriceX96))throw new a("sqrtPriceX96 must be a non-negative integer string.");return $e(BigInt(t.sqrtPriceX96))}if(t.initialPrice===void 0)throw new a("A new pool needs initialPrice (token1 per 1 token0, human units) or sqrtPriceX96.");return qe(t.initialPrice,e,n)}async function Xe(t,e,n,s){let o=[];for(let i of Object.keys(Pe).map(Number)){if(i===s)continue;let c=m(String(await t.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[e,n,i]})));if(c===$||BigInt(await t.readContract({address:c,abi:he,functionName:"liquidity"}))===0n)continue;let f=await t.readContract({address:c,abi:he,functionName:"slot0"});o.push({label:`v3 fee ${i} pool ${c}`,sqrtPriceX96:BigInt(f[0])})}return o}function j(t,e={}){if(e.chainId!==void 0&&Number(e.chainId)!==y)throw new a(`Uniswap v3 is only supported on Robinhood Chain (${y}).`);if(e.version!==void 0&&e.version!=="v3")throw new a(`Uniswap v3 handler received unsupported version "${String(e.version)}".`);let n=t.clientFor(y);return{...n,readContract:async s=>{try{return await n.readContract(s)}catch(o){throw new a(`Could not read Uniswap v3 ${s.functionName}. ${N(o)}`,{cause:o})}}}}async function Ie(t,e,n){let s;try{s=await t.readContract({address:w.positionManager,abi:P,functionName:"ownerOf",args:[e]})}catch(c){throw new a(`Could not verify owner of Uniswap v3 position #${e}. ${N(c)}`)}let o=m(String(s)),i=m(n);if(o!==i)throw new a(`Wallet ${i} is not the owner of Uniswap v3 position #${e.toString()} (owned by ${o}).`);return o}async function de(t,e){let n=await t.readContract({address:w.positionManager,abi:P,functionName:"positions",args:[e]});return st(n)}function Se(t,e){if(!Array.isArray(e.changes)||!e.changes.length)return t;let n=e.changes.map(s=>`${rt(s.amount,s.token.decimals)} ${s.token.symbol}`);return`${t} (${n.join(", ")})`}async function dt(t,e,n){F(n);let s=m(n),o=j(t,e),i=await Oe(o,e.deadline),c=De(e),r=e.tokenId===void 0?void 0:ee(e.tokenId,"tokenId"),f;if(r!==void 0){if(r<=0n)throw new a("Uniswap v3 tokenId must be a positive integer.");await Ie(o,r,s),f=await de(o,r)}let d=f?.token0??D(e.token0,"token0"),u=f?.token1??D(e.token1,"token1");if(BigInt(d)>=BigInt(u))throw new a("Uniswap v3 requires distinct sorted token addresses.");let g=f?.fee??Number(e.fee??100),p=Pe[g];if(!p)throw new a("Unsupported Uniswap v3 fee tier.");let b=m(String(await o.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[d,u,g]}))),l=e.initialPrice!==void 0||e.sqrtPriceX96!==void 0;if(b===$&&!l)throw new a("No Uniswap v3 pool exists for these tokens and fee tier. To create it and add the first liquidity in one tool call with separately confirmed transactions, add initialPrice (token1 per 1 token0, human units) to this call; to create it without liquidity use uniswap_create_pool.");if(b!==$&&l)throw new a(`The Uniswap v3 pool already exists at ${b}; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);if(r!==void 0&&l)throw new a("initialPrice cannot be combined with tokenId.");if(e.fullRange!==void 0&&typeof e.fullRange!="boolean")throw new a("fullRange must be a boolean.");if(e.fullRange===!0&&(e.tickLower!==void 0||e.tickUpper!==void 0||f))throw new a("Use fullRange only for a new position, without explicit ticks. Existing position ticks cannot change.");let{tickLower:k,tickUpper:U,tickSpacing:A}=ot(f?.tickLower??(e.fullRange===!0?Math.ceil(re/p)*p:e.tickLower),f?.tickUpper??(e.fullRange===!0?Math.floor(se/p)*p:e.tickUpper),p),v=await M(o,d,y,e.token0Decimals),h=await M(o,u,y,e.token1Decimals),C;if(b===$){let q=Ve(e,v.decimals,h.decimals),E=ke(q,await Xe(o,d,u,g),e.acceptPriceDeviation===!0,v.decimals,h.decimals);C={sqrtPriceX96:q,note:E}}let I=W(e.amount0Desired,"amount0Desired"),S=W(e.amount1Desired,"amount1Desired");if(I===0n&&S===0n)throw new a("Liquidity addition requires a positive desired amount.");let x=e.recipient===void 0?s:D(e.recipient,"recipient");if(x!==s)throw new a("Uniswap recipient must be the signing wallet.");if(e.wrapNative===!0&&d!==w.weth&&u!==w.weth)throw new a("Wrapping requires a positive WETH desired amount.");let V=await Promise.all([d,u].map(async q=>BigInt(await o.readContract({address:q,abi:xe,functionName:"allowance",args:[s,w.positionManager]})))),X=(q,E)=>{let fe=[];if(e.wrapNative===!0){let Q=d===w.weth?q:E;Q>0n&&fe.push(ge({to:w.weth,data:nt,value:Q.toString(),chainId:y,description:"Wrap ETH into WETH."}))}for(let[Q,Ge]of[d,u].entries()){let pe=Q===0?q:E;pe>0n&&V[Q]<pe&&fe.push(t.approval(Ge,w.positionManager,pe.toString(),y))}return fe},L=r===void 0?"mint":"increaseLiquidity",R=(q,E)=>H(r===void 0?B({abi:P,functionName:"mint",args:[{token0:d,token1:u,fee:g,tickLower:k,tickUpper:U,amount0Desired:I,amount1Desired:S,amount0Min:q,amount1Min:E,recipient:x,deadline:i}]}):B({abi:P,functionName:"increaseLiquidity",args:[{tokenId:r,amount0Desired:I,amount1Desired:S,amount0Min:q,amount1Min:E,deadline:i}]}),`${L==="mint"?"Mint":"Increase"} Uniswap v3 ${v.symbol}/${h.symbol} liquidity.`),_=C&&H(B({abi:P,functionName:"createAndInitializePoolIfNecessary",args:[d,u,g,C.sqrtPriceX96]}),`Create and initialize the Uniswap v3 ${v.symbol}/${h.symbol} fee ${g} pool at ${ie(C.sqrtPriceX96,v.decimals,h.decimals)} ${h.symbol} per ${v.symbol}.`),K=_?[_]:[],Ae=await Z(o,[...K,...X(I,S),R(0n,0n)],s),T=ce(L,Ae[Ae.length-1]),We=T[T.length-2],ze=T[T.length-1];if(We>I||ze>S)throw new a("Simulated liquidity spend exceeds the desired amounts.");let te=[...K,...X(I,S)],ue=ae(e.amount0Min,T[T.length-2],c,"amount0Min"),le=ae(e.amount1Min,T[T.length-1],c,"amount1Min");if(ue>I||le>S)throw new a("Uniswap v3 minimum amount cannot exceed desired amount.");let Ce=R(ue,le);te.push(Ce);for(let[q,E]of[d,u].entries())(q===0?I:S)>0n&&te.push(t.approval(E,w.positionManager,"0",y));let Ne=await t.preview(te,s);return{txs:te,preview:Ne,summary:Se(Ce.description,Ne),details:{version:"v3",action:L,...r===void 0?{}:{tokenId:r.toString()},pool:b===$?null:b,fee:g,tickSpacing:A,tickLower:k,tickUpper:U,token0:v,token1:h,amount0Desired:I.toString(),amount1Desired:S.toString(),amount0Min:ue.toString(),amount1Min:le.toString(),deadline:i.toString(),recipient:x,expectedAmount0:T[T.length-2].toString(),expectedAmount1:T[T.length-1].toString(),...C?{poolCreated:!0,sqrtPriceX96:C.sqrtPriceX96.toString(),initialPrice:ie(C.sqrtPriceX96,v.decimals,h.decimals),initialTick:be(C.sqrtPriceX96),priceCheck:C.note}:{}}}}async function ut(t,e,n){F(n);let s=m(n),o=j(t,e),i=D(e.token0,"token0"),c=D(e.token1,"token1");if(BigInt(i)>=BigInt(c))throw new a(`Uniswap v3 requires sorted token addresses (token0 < token1). Use token0=${BigInt(i)<BigInt(c)?i:c}, token1=${BigInt(i)<BigInt(c)?c:i}; initialPrice is token1 per 1 token0 in that order.`);let r=Number(e.fee),f=Pe[r];if(!f){let h=Number(await o.readContract({address:w.factory,abi:Y,functionName:"feeAmountTickSpacing",args:[r]}));if(!Number.isInteger(r)||h<=0)throw new a("Unsupported Uniswap v3 fee tier. Enabled tiers: 100, 500, 3000, 10000.");f=h}let d=m(String(await o.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[i,c,r]})));if(d!==$)throw new a(`The Uniswap v3 pool already exists at ${d}. Use uniswap_add to provide liquidity.`);let u=await M(o,i,y,e.token0Decimals),g=await M(o,c,y,e.token1Decimals),p=Ve(e,u.decimals,g.decimals),b=ke(p,await Xe(o,i,c,r),e.acceptPriceDeviation===!0,u.decimals,g.decimals),l=ie(p,u.decimals,g.decimals),k=[H(B({abi:P,functionName:"createAndInitializePoolIfNecessary",args:[i,c,r,p]}),`Create and initialize the Uniswap v3 ${u.symbol}/${g.symbol} fee ${r} pool at ${l} ${g.symbol} per ${u.symbol}.`)],U=await Z(o,k,s),A;try{A=m(String(ve({abi:P,functionName:"createAndInitializePoolIfNecessary",data:U[0]})))}catch{throw new a("Uniswap v3 pool creation simulation returned an invalid pool address.")}if(A===$)throw new a("Uniswap v3 pool creation simulation returned no pool.");let v=await t.preview(k,s);return{txs:k,preview:v,summary:`${k[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add.`,details:{version:"v3",action:"createPool",pool:A,fee:r,tickSpacing:f,token0:u,token1:g,sqrtPriceX96:p.toString(),initialPrice:l,initialTick:be(p),priceCheck:b}}}async function lt(t,e,n){F(n);let s=m(n),o=j(t,e),i=ee(e.tokenId,"tokenId");if(i<=0n)throw new a("Uniswap v3 tokenId must be a positive integer.");await Ie(o,i,s);let c=await de(o,i),r=await M(o,c.token0,y),f=await M(o,c.token1,y),d=e.recipient===void 0?s:D(e.recipient,"recipient");if(d!==s)throw new a("Uniswap recipient must be the signing wallet.");let u=e.amount0Max===void 0?G:W(e.amount0Max,"amount0Max"),g=e.amount1Max===void 0?G:W(e.amount1Max,"amount1Max");if(u===0n&&g===0n||u>G||g>G)throw new a("Collect requires a positive amountMax within uint128.");let p=[H(B({abi:P,functionName:"collect",args:[{tokenId:i,recipient:d,amount0Max:u,amount1Max:g}]}),`Collect Uniswap v3 fees from position #${i}.`)],b=ce("collect",(await Z(o,p,s))[0]),l=await t.preview(p,s);return{txs:p,preview:l,summary:Se(p[0].description,l),details:{version:"v3",action:"collect",tokenId:i.toString(),recipient:d,token0:r,token1:f,amount0Max:u.toString(),amount1Max:g.toString(),expectedAmount0:b[0].toString(),expectedAmount1:b[1].toString()}}}async function ft(t,e,n){F(n);let s=m(n),o=j(t,e),i=ee(e.tokenId,"tokenId");if(i<=0n)throw new a("Uniswap v3 tokenId must be a positive integer.");await Ie(o,i,s);let c=await de(o,i),r=c.liquidity===0n&&e.burn===!0;if(c.liquidity<=0n&&!r)throw new a("Position has zero active liquidity to remove.");if(e.liquidity===void 0&&!r)throw new a('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let f=e.liquidity==="all"||e.liquidity===void 0?c.liquidity:W(e.liquidity,"liquidity");if(f<=0n&&!r)throw new a("Liquidity to remove must be positive.");if(f>c.liquidity)throw new a("Requested liquidity exceeds position liquidity.");let d=await Oe(o,e.deadline),u=De(e),g=await M(o,c.token0,y),p=await M(o,c.token1,y),b=e.recipient===void 0?s:D(e.recipient,"recipient");if(b!==s)throw new a("Uniswap recipient must be the signing wallet.");let l=(R,_)=>H(B({abi:P,functionName:"decreaseLiquidity",args:[{tokenId:i,liquidity:f,amount0Min:R,amount1Min:_,deadline:d}]}),`Decrease ${f} liquidity on Uniswap v3 position #${i}.`),k=r?[0n,0n]:ce("decreaseLiquidity",(await Z(o,[l(0n,0n)],s))[0]),U=(R,_)=>{if(R!==void 0&&W(R,_)!==0n)throw new a(`${_} must be zero for an empty position burn.`);return 0n},A=r?U(e.amount0Min,"amount0Min"):ae(e.amount0Min,k[0],u,"amount0Min"),v=r?U(e.amount1Min,"amount1Min"):ae(e.amount1Min,k[1],u,"amount1Min"),h=r?[]:[l(A,v)],C=h.length,I=!r||c.tokensOwed0>0n||c.tokensOwed1>0n;I&&h.push(H(B({abi:P,functionName:"collect",args:[{tokenId:i,recipient:b,amount0Max:G,amount1Max:G}]}),`Collect principal and fees from Uniswap v3 position #${i}.`));let S=f===c.liquidity,x=S&&e.burn===!0;x&&h.push(H(B({abi:P,functionName:"burn",args:[i]}),`Burn empty Uniswap v3 position #${i}.`));let V=await Z(o,h,s),X=I?ce("collect",V[C]):[0n,0n],L=await t.preview(h,s);return{txs:h,preview:L,summary:Se(`Remove Uniswap v3 liquidity from position #${i}${x?`; burns position #${i} at ${w.positionManager}`:""}`,L),details:{version:"v3",action:"remove",tokenId:i.toString(),recipient:b,token0:g,token1:p,liquidityRemoved:f.toString(),amount0Min:A.toString(),amount1Min:v.toString(),deadline:d.toString(),expectedAmount0:X[0].toString(),expectedAmount1:X[1].toString(),fullExit:S,burned:x}}}function pt(t,e){let n=typeof t=="string"?Je.exec(t):null;if(!n)throw new a('cursor is not a Uniswap v3 position cursor. Pass the nextCursor exactly as a previous uniswap_list_positions {"version":"v3"} page returned it.');if(m(n[1])!==e)throw new a("This cursor was issued for a different wallet. Start again without a cursor to page this wallet.");return{block:BigInt(n[2]),next:BigInt(n[3])}}function mt(t,e,n){return`v3:${t.toLowerCase()}:${e}:${n}`}function gt(t,e){return{...t,readContract:n=>t.readContract({...n,blockNumber:e})}}var ye=t=>me(t,3,-32601,-32004);async function wt(t,e,n={}){let s=m(e),o=new Set;if(Array.isArray(n.tokenIds))for(let d of n.tokenIds){let u=ee(d,"tokenId");u>0n&&o.add(u.toString())}if(Array.isArray(n.receipts))for(let d of n.receipts)for(let u of Re(d,s))o.add(u);if(Array.isArray(n.tokenIds)&&n.tokenIds.length>0)return[...o].map(d=>BigInt(d)).sort((d,u)=>d<u?-1:d>u?1:0);let i=n.cursor,c=()=>new a("This Uniswap v3 position manager cannot enumerate NFTs by owner, so there are no pages to continue. Pass tokenIds to check specific positions."),r=!1,f=!1;try{let d;try{d=BigInt(await t.readContract({address:w.positionManager,abi:P,functionName:"balanceOf",args:[s]}))}catch(l){throw ye(l)||!i?l:new a(`Could not read this wallet's Uniswap v3 holdings at the cursor's snapshot block ${i.block}; the node may no longer serve it. Start again without a cursor. ${N(l)}`)}let u=i?.next??0n;if(u>d)throw new a(`This cursor starts at owner index ${u}, but the wallet held ${d} Uniswap v3 NFTs at block ${i?.block}. Start again without a cursor.`);let g=d-u>Le?u+Le:d,p=[],b=!0;for(let l=u;l<g;l++)try{p.push(BigInt(await t.readContract({address:w.positionManager,abi:P,functionName:"tokenOfOwnerByIndex",args:[s,l]})))}catch(k){if(!ye(k))throw k;b=!1;break}if(b){r=!0,f=u===0n&&g===d;for(let k of p)k>0n&&o.add(k.toString());let l=n.blockNumber;n.onPage?.({balance:d,from:u,to:g,blockNumber:l,...g<d&&l!==void 0?{nextCursor:mt(s,l,g)}:{}})}}catch(d){if(!ye(d))throw d}if(i&&!r)throw c();if((!r||f)&&typeof t.getLogs=="function"&&typeof t.getBlockNumber=="function")try{let d=n.toBlock??await t.getBlockNumber(),u=n.maxChunks??Ye,g=n.fromBlock??(d>oe*BigInt(u)?d-oe*BigInt(u)+1n:0n),p=d,b=0;for(;p>=g&&b<u;){let l=p>=oe-1n?p-(oe-1n):0n,k=l<g?g:l,U=await t.getLogs({address:w.positionManager,fromBlock:k,toBlock:p});for(let A of Re({logs:U},s))o.add(A);if(b+=1,k===0n||k<=g)break;p=k-1n}}catch(d){throw new a(`Could not discover Uniswap v3 positions from logs. ${N(d)}`)}else if(!r&&n.tokenIds===void 0&&n.receipts===void 0)throw new a("Uniswap v3 position discovery is unavailable; supply candidate token IDs or receipts.");return[...o].map(d=>BigInt(d)).sort((d,u)=>d<u?-1:d>u?1:0)}async function Fe(t,e,n={}){F(e);let s=m(e),o=j(t),i=Array.isArray(n.tokenIds)&&n.tokenIds.length>0,c=Array.isArray(n.receipts)&&n.receipts.length>0;if(n.cursor!==void 0&&(i||c))throw new a(`${i?"tokenIds":"receipts"} and cursor cannot be combined: ${i?"tokenIds":"receipts"} inspects exactly those NFTs and has no pages. Send one or the other.`);let r=n.cursor===void 0?void 0:pt(n.cursor,s),f=o,d;if(!i){let p;if(typeof o.getBlockNumber=="function")try{p=await o.getBlockNumber()}catch(b){throw new a(`Could not read the latest block for the Uniswap v3 listing. ${N(b)}`)}if(r&&p!==void 0&&r.block>p)throw new a(`This cursor is from block ${r.block}, ahead of the chain's latest block ${p}. Start again without a cursor.`);d=r?.block??p,d!==void 0&&(f=gt(o,d))}let u=await wt(f,s,{...n,cursor:r,blockNumber:d}),g=[];for(let p of u){let b;try{let x=await f.readContract({address:w.positionManager,abi:P,functionName:"ownerOf",args:[p]});b=m(String(x))}catch(x){if(me(x,3))continue;throw new a(`Could not verify owner of position #${p}. ${N(x)}`)}if(b!==s)continue;let l;try{l=await de(f,p)}catch(x){throw new a(`Could not read position #${p}. ${N(x)}`)}if(l.liquidity===0n&&l.tokensOwed0===0n&&l.tokensOwed1===0n&&!n.includeEmpty)continue;let U=await M(f,l.token0,y),A=await M(f,l.token1,y),v=0n,h=0n;if(l.liquidity>0n)try{let x=await f.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[l.token0,l.token1,l.fee]}),V=m(String(x));if(V===$)throw new a("Position pool was not found.");if(V!==$){let X=await f.readContract({address:V,abi:he,functionName:"slot0"}),L=BigInt(X[0]);if(L<=0n)throw new a("Position pool has no initialized price.");let R=Ee(l.tickLower),_=Ee(l.tickUpper),K=at(L,R,_,l.liquidity);v=K.amount0,h=K.amount1}}catch(x){throw new a(`Could not value Uniswap v3 position #${p}. ${N(x)}`)}let C=v+l.tokensOwed0,I=h+l.tokensOwed1,S=[{token:U,amount:C.toString()},{token:A,amount:I.toString()}];g.push({module:"uniswap",id:`uniswap:v3:${p.toString()}`,chainId:y,assets:S,description:`Uniswap v3 LP position #${p.toString()} (${U.symbol}/${A.symbol} fee ${l.fee} ticks [${l.tickLower}, ${l.tickUpper}] liquidity ${l.liquidity.toString()})`})}return g}function bt(t){let e=t.nextCursor?`Pass cursor "${t.nextCursor}" to read the next page, or tokenIds to check specific positions.`:"Pass tokenIds to check specific positions.";return t.from===0n?`This wallet holds ${t.balance} Uniswap v3 position NFTs and only the first ${t.to} were checked, so later positions are not listed. ${e}`:`This page checked owner indices ${t.from}-${t.to-1n} of ${t.balance} Uniswap v3 position NFTs, so later positions are not listed. ${e}`}async function kt(t,e,n){j(t,e);let s=e.wallet!==void 0?D(e.wallet,"wallet"):m(n),o=Array.isArray(e.tokenIds)?e.tokenIds:void 0,i=Array.isArray(e.receipts)?e.receipts:void 0,c=e.includeZero===!0||e.includeEmpty===!0,r,f=await Fe(t,s,{tokenIds:o,receipts:i,includeEmpty:c,cursor:e.cursor,onPage:u=>{r=u}}),d=r!==void 0&&r.to<r.balance;return{positions:f,...r?.nextCursor?{nextCursor:r.nextCursor}:{},details:{version:"v3",wallet:s,count:f.length,positionManager:w.positionManager,...r?{balance:Number(r.balance),from:Number(r.from),to:Number(r.to),examined:Number(r.to-r.from),...r.blockNumber!==void 0?{blockNumber:r.blockNumber.toString()}:{}}:{},...r&&d?{truncated:!0,incomplete:!0,note:bt(r)}:{}}}}function yt(t){return[{name:"uniswap_add",inputSchema:{type:"object",description:"Mint a new Uniswap v3 concentrated liquidity position or increase liquidity on an existing v3 NFT position on Robinhood Chain (4663).",properties:{version:{type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:"Optional existing v3 NFT tokenId for increaseLiquidity."},token0:{type:"string",description:"Sorted ERC-20 token0 address (e.g. WETH)."},token1:{type:"string",description:"Sorted ERC-20 token1 address (e.g. USDG)."},fee:{type:"integer",enum:[100,500,3e3,1e4],default:100},fullRange:{type:"boolean",description:"For a new v3 position, use the widest ticks aligned to the pool fee tier; omit explicit ticks."},tickLower:{type:"integer",description:"Lower tick boundary divisible by tickSpacing."},tickUpper:{type:"integer",description:"Upper tick boundary divisible by tickSpacing."},amount0Desired:{type:"string",description:"Desired token0 amount in decimal base units."},amount1Desired:{type:"string",description:"Desired token1 amount in decimal base units."},amount0Min:{type:"string",description:"Minimum token0 amount in decimal base units."},amount1Min:{type:"string",description:"Minimum token1 amount in decimal base units."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:ne},deadline:{type:"integer",description:"Unix timestamp deadline (> current block timestamp)."},wrapNative:{type:"boolean",description:"Optional: wrap native ETH into WETH before minting."},initialPrice:{type:"string",description:"Only when the pool does not exist: starting price as token1 per 1 token0 in human units. The pool is created then liquidity is minted in separately confirmed transactions."},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},execute:(c,r)=>dt(t,c,r)},{name:"uniswap_collect",inputSchema:{type:"object",description:"Collect accrued Uniswap v3 LP fees for an owned NonfungiblePositionManager NFT.",properties:{version:{type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:"Uniswap v3 NFT tokenId."},recipient:{type:"string",description:"Optional fee recipient; must be the signing wallet."},amount0Max:{type:"string",description:"Max token0 to collect (defaults to uint128 max)."},amount1Max:{type:"string",description:"Max token1 to collect (defaults to uint128 max)."}},required:["tokenId"]},execute:(c,r)=>lt(t,c,r)},{name:"uniswap_remove",inputSchema:{type:"object",description:"Decrease liquidity on an owned Uniswap v3 NFT position, collect principal and fees, and optionally burn the empty NFT.",properties:{version:{type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:"Uniswap v3 NFT tokenId."},liquidity:{type:"string",description:"Positive base-unit liquidity amount, or all for a full exit."},amount0Min:{type:"string",description:"Minimum token0 principal in decimal base units."},amount1Min:{type:"string",description:"Minimum token1 principal in decimal base units."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:ne},deadline:{type:"integer",description:"Unix timestamp deadline (> current block timestamp)."},burn:{type:"boolean",description:"Whether to burn the NFT after removing 100% of liquidity, or burn an already-empty position."}},required:["tokenId"]},execute:(c,r)=>ft(t,c,r)},{name:"uniswap_list_positions",inputSchema:{type:"object",description:"List active Uniswap v3 LP positions owned by the wallet, 64 owner indices per page at one pinned block; follow nextCursor for more. Falls back to a bounded Transfer-log scan for managers that cannot enumerate by owner.",properties:{version:{type:"string",enum:["v3"],default:"v3"},wallet:{type:"string",description:"Optional wallet address override."},tokenIds:{type:"array",items:{type:"string"},description:"Optional candidate v3 NFT tokenIds to inspect. Inspects exactly these NFTs; there is no paging in this mode."},cursor:et}},execute:(c,r)=>kt(t,c,r)},{name:"uniswap_create_pool",inputSchema:{type:"object",description:"Create and initialize an empty Uniswap v3 pool on Robinhood Chain (4663). Add liquidity afterwards with uniswap_add.",properties:{version:{type:"string",enum:["v3"],default:"v3"},token0:{type:"string",description:"Sorted ERC-20 token0 address (WETH, not native ETH)."},token1:{type:"string",description:"Sorted ERC-20 token1 address."},fee:{type:"integer",enum:[100,500,3e3,1e4]},initialPrice:{type:"string",description:'Starting price as token1 per 1 token0 in human units, e.g. "3000" for 1 WETH = 3000 USDG.'},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}},required:["token0","token1","fee"]},execute:(c,r)=>ut(t,c,r)}]}var He=t=>({tools:yt(t),positions:async e=>{let n,s=await Fe(t,e,{onPage:o=>{o.to>=o.balance||(n={module:"uniswap",id:"uniswap-v3-discovery-truncated",chainId:y,assets:[],incomplete:!0,description:`This wallet holds ${o.balance} Uniswap v3 position NFTs and only the first ${o.to} were checked, so later positions may be missing. Pass tokenIds to uniswap_list_positions to check the others, or page through them with uniswap_list_positions {"version":"v3"} and each nextCursor.`})}});return n?[...s,n]:s}}),Tt=He,qt=He;export{re as a,se as b,G as c,et as d,w as e,Pe as f,Nt as g,P as h,Y as i,he as j,tt as k,ot as l,rt as m,st as n,Re as o,Ut as p,Ve as q,dt as r,ut as s,lt as t,ft as u,Fe as v,kt as w,yt as x,He as y,Tt as z,qt as A};
1
+ import{c as Te,d as $e,e as be,f as ie,i as ke,j as Me}from"./ATEVAJ5Y.js";import{b as ne,o as we}from"./LKX5WDOQ.js";import{a as F,b as ge}from"./43LI5NKJ.js";import{a as Ne}from"./IOYRL6AY.js";import{b as z,d as Ue}from"./IX3GZMTM.js";import{b as y,j as O}from"./TI727O2H.js";import{a,b as me,e as q}from"./XSD5NL7J.js";import{decodeFunctionResult as ve,encodeFunctionData as B,getAddress as m,parseAbi as J,zeroAddress as $}from"viem";var re=-887272,se=887272,G=(1n<<128n)-1n,je="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ke="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",Qe="0x3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f",oe=2000n,Ye=5,Le=64n,Ze=1800n,Be="^v3:(0x[0-9a-fA-F]{40}):(0|[1-9][0-9]{0,19}):(0|[1-9][0-9]{0,19})$",Je=new RegExp(Be),et=Object.freeze({type:"string",pattern:Be,description:"v3 only. Pass the nextCursor of the previous page to read the next 64 owner indices at the same block. Cannot be combined with tokenIds."}),w=Object.freeze({factory:m(O[4663].uniswap.v3_factory.address),positionManager:m(O[4663].uniswap.v3_position_manager.address),swapRouter02:m(O[4663].uniswap.swap_router02.address),permit2:m(O[4663].uniswap.permit2.address),weth:m(O[4663].uniswap.WETH.address),usdg:m(O[4663].uniswap.USDG.address),ethUsdgPool:m(O[4663].oracle.ethUsdgPool.address)}),Pe=Object.freeze({100:1,500:10,3e3:60,1e4:200}),qt=Object.freeze([{fee:100,tickSpacing:1,address:m("0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"),token0:w.weth,token1:w.usdg,recordedLiquidity:"1957537485734736219",recordedSqrtPriceX96:"3839219776288481168641554",recordedTick:-198707,feeProtocol:68},{fee:500,tickSpacing:10,address:m("0x69bfaf19c9f377bb306a89aed9f6b07e2c1a8d9a"),token0:w.weth,token1:w.usdg,recordedLiquidity:"714542894544667104",recordedSqrtPriceX96:"3839644024453020182443671",recordedTick:-198705,feeProtocol:68},{fee:3e3,tickSpacing:60,address:m("0xa9188730fe85be88ad499d7d52b099e800fb0334"),token0:w.weth,token1:w.usdg,recordedLiquidity:"310559629687003603",recordedSqrtPriceX96:"3843235825752878635548672",recordedTick:-198686,feeProtocol:102},{fee:1e4,tickSpacing:200,address:m("0x5f009e071f07e92b6c624e83f52f17bbda34680d"),token0:w.weth,token1:w.usdg,recordedLiquidity:"5822966536584155",recordedSqrtPriceX96:"3853297838190389678059735",recordedTick:-198634,feeProtocol:102}]),P=J(["function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)","function ownerOf(uint256 tokenId) view returns (address)","function balanceOf(address owner) view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)","function mint((address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, address recipient, uint256 deadline) params) payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)","function increaseLiquidity((uint256 tokenId, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) payable returns (uint128 liquidity, uint256 amount0, uint256 amount1)","function decreaseLiquidity((uint256 tokenId, uint128 liquidity, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) payable returns (uint256 amount0, uint256 amount1)","function collect((uint256 tokenId, address recipient, uint128 amount0Max, uint128 amount1Max) params) payable returns (uint256 amount0, uint256 amount1)","function burn(uint256 tokenId) payable","function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96) payable returns (address pool)"]),Y=J(["function getPool(address tokenA, address tokenB, uint24 fee) view returns (address pool)","function feeAmountTickSpacing(uint24 fee) view returns (int24)"]),he=J(["function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)","function liquidity() view returns (uint128)","function tickSpacing() view returns (int24)","function fee() view returns (uint24)","function token0() view returns (address)","function token1() view returns (address)"]),tt=J(["function exactInputSingle((address tokenIn, address tokenOut, uint24 fee, address recipient, uint256 amountIn, uint256 amountOutMinimum, uint160 sqrtPriceLimitX96) params) payable returns (uint256 amountOut)"]),xe=J(["function decimals() view returns (uint8)","function symbol() view returns (string)","function allowance(address owner, address spender) view returns (uint256)"]),nt="0xd0e30db0";function it(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();return e===$||e===je||e==="eth"||e==="native"}function D(t,e){if(it(t))throw new a(`Uniswap v3 requires wrapped ERC-20 WETH (${w.weth}) rather than native ETH in ${e}.`);if(typeof t!="string")throw new a(`${e} must be a valid 20-byte hex address.`);return F(t),m(t)}function ot(t,e,n){let s=Number(t),o=Number(e),i=Number(n);if(!Number.isInteger(i)||i<=0)throw new a("Uniswap v3 tickSpacing must be a positive integer.");if(!Number.isInteger(s)||!Number.isInteger(o))throw new a("Uniswap v3 tickLower and tickUpper must be integers.");if(s<re||o>se||s>se||o<re)throw new a(`Uniswap v3 ticks are out of bounds [${re}, ${se}].`);if(s>=o)throw new a("Uniswap v3 tickLower must be strictly less than tickUpper.");if(s%i!==0||o%i!==0)throw new a(`Uniswap v3 tickLower (${s}) and tickUpper (${o}) must be divisible by tickSpacing (${i}).`);return{tickLower:s,tickUpper:o,tickSpacing:i}}function rt(t,e){let n=t.trim(),s=n.startsWith("-"),o=s||n.startsWith("+")?n.slice(1):n,i=Ue(z(o).toString(),e);return s&&i!=="0"?`-${i}`:i}function st(t){let e=typeof t=="string"?ve({abi:P,functionName:"positions",data:t}):t;return{nonce:BigInt(e[0]),operator:m(String(e[1])),token0:m(String(e[2])),token1:m(String(e[3])),fee:Number(e[4]),tickLower:Number(e[5]),tickUpper:Number(e[6]),liquidity:BigInt(e[7]),feeGrowthInside0LastX128:BigInt(e[8]),feeGrowthInside1LastX128:BigInt(e[9]),tokensOwed0:BigInt(e[10]),tokensOwed1:BigInt(e[11])}}function Re(t,e){if(!t||!Array.isArray(t.logs))return[];let n=e?m(e).toLowerCase():void 0,s=w.positionManager.toLowerCase(),o=new Set;for(let i of t.logs){if(!i||typeof i.address!="string"||i.address.toLowerCase()!==s)continue;let c=Array.isArray(i.topics)?i.topics.map(p=>String(p).toLowerCase()):[],r=c[0];if(r===Ke&&c.length>=4){let d=`0x${c[2].slice(-40)}`;if(!n||d===n){let u=BigInt(c[3]).toString();u!=="0"&&o.add(u)}}else if(r===Qe&&c.length>=2&&!n){let p=BigInt(c[1]).toString();p!=="0"&&o.add(p)}}return[...o]}function Ut(t){let e=n=>typeof n=="bigint"?n:z(n);return B({abi:tt,functionName:"exactInputSingle",args:[{tokenIn:m(t.tokenIn),tokenOut:m(t.tokenOut),fee:t.fee,recipient:m(t.recipient),amountIn:e(t.amountIn),amountOutMinimum:e(t.amountOutMinimum),sqrtPriceLimitX96:t.sqrtPriceLimitX96!==void 0?e(t.sqrtPriceLimitX96):0n}]})}var Ee=1n<<96n;function _e(t){let e=Math.abs(t),n=(e&1)!==0?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&2)!==0&&(n=n*0xfff97272373d413259a46990580e213an>>128n),(e&4)!==0&&(n=n*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&8)!==0&&(n=n*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&16)!==0&&(n=n*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&32)!==0&&(n=n*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&64)!==0&&(n=n*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&128)!==0&&(n=n*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&256)!==0&&(n=n*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&512)!==0&&(n=n*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&1024)!==0&&(n=n*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&2048)!==0&&(n=n*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&4096)!==0&&(n=n*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&8192)!==0&&(n=n*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&16384)!==0&&(n=n*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&32768)!==0&&(n=n*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&65536)!==0&&(n=n*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&131072)!==0&&(n=n*0x5d6af8dedb81196699c329225ee604n>>128n),(e&262144)!==0&&(n=n*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&524288)!==0&&(n=n*0x48a170391f7dc42444e8fa2n>>128n),t>0&&(n=((1n<<256n)-1n)/n),(n>>32n)+(n%(1n<<32n)===0n?0n:1n)}function at(t,e,n,s){if(s<=0n)return{amount0:0n,amount1:0n};let[o,i]=e<n?[e,n]:[n,e];if(t<=o)return{amount0:(s<<96n)*(i-o)/i/o,amount1:0n};if(t<i){let r=(s<<96n)*(i-t)/i/t,p=s*(t-o)/Ee;return{amount0:r,amount1:p}}return{amount0:0n,amount1:s*(i-o)/Ee}}async function M(t,e,n,s){let o=m(e),i,c;if(n===y&&o===w.weth?(i=18,c="WETH"):n===y&&o===w.usdg&&(i=6,c="USDG"),i===void 0){let r=await t.readContract({address:o,abi:xe,functionName:"decimals"});i=Number(r)}if(c===void 0)try{let r=await t.readContract({address:o,abi:xe,functionName:"symbol"});if(typeof r!="string"||!r.trim())throw new a("Token symbol is unavailable.");c=Me(r.trim(),o)}catch(r){throw new a(`Could not read token metadata. ${q(r)}`)}if(!Number.isInteger(i)||i<0||i>255)throw new a("Token decimals are invalid.");if(s!=null){let r=Number(s);if(!Number.isInteger(r)||r!==i)throw new a(`Token ${o} on chain ${n} has ${i} decimals, not ${String(s)}.`)}return{address:o,symbol:c,decimals:i,chainId:n}}async function ct(t){try{if(!t.getBlock)throw new a("Block timestamps are unavailable.");let e=await t.getBlock();if(typeof e.timestamp!="bigint")throw new a("Invalid block timestamp.");return e.timestamp}catch(e){throw new a(`Could not read the current block timestamp. ${q(e)}`)}}function ee(t,e){if(typeof t=="bigint"){if(t<0n)throw new a(`${e} must be a non-negative integer.`);return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<0)throw new a(`${e} must be a non-negative integer.`);return BigInt(t)}if(typeof t=="string")return z(t);throw new a(`${e} must be a non-negative integer.`)}async function Oe(t,e){let n=await ct(t);if(e==null)return n+Ze;let s=ee(e,"deadline");if(s<=n)throw new a(`Uniswap v3 deadline (${s.toString()}) has expired at timestamp ${n.toString()}.`);return s}function W(t,e){if(typeof t!="string"||!/^\d+$/.test(t))throw new a(`${e} must be a non-negative integer string in base units.`);return z(t)}function De(t){let e=t.slippageBps??ne;if(typeof e!="number")throw new a("Slippage must be an integer from 0 to 9999 bps.");return we("0",e),e}function ae(t,e,n,s){let o=t===void 0?z(we(e.toString(),n)):W(t,s);if(o<=1n)throw new a(`${s} must exceed 1 base unit; the simulated amount may be too small.`);return o}function H(t,e){return ge({to:w.positionManager,data:t,value:"0",chainId:y,description:e})}async function Z(t,e,n){try{if(!t.request)throw new a("Sequential transaction simulation is unavailable.");let o=await t.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:n,gas:`0x${Ne.toString(16)}`,to:i.to,data:i.data,value:`0x${BigInt(i.value).toString(16)}`}))}],validation:!1,traceTransfers:!0},"latest"]},{retryCount:0});if(!Array.isArray(o)||o.length!==1||!Array.isArray(o[0]?.calls)||o[0].calls.length!==e.length)throw new a("Unexpected batch simulation response.");return o[0].calls.map((i,c)=>{if(i.status!=="0x1"||i.error||typeof i.returnData!="string"||!/^0x([a-fA-F0-9]{2})*$/.test(i.returnData))throw new a(`Simulation call ${c+1} failed. ${q(i.error)}`);return i.returnData})}catch(s){throw new a(`Uniswap v3 simulation failed. ${q(s)}`)}}function ce(t,e){try{return ve({abi:P,functionName:t,data:e})}catch{throw new a(`Uniswap v3 ${t} simulation returned invalid amounts.`)}}function Ve(t,e,n){if(t.initialPrice!==void 0&&t.sqrtPriceX96!==void 0)throw new a("Provide initialPrice or sqrtPriceX96, not both.");if(t.sqrtPriceX96!==void 0){if(typeof t.sqrtPriceX96!="string"||!/^\d+$/.test(t.sqrtPriceX96))throw new a("sqrtPriceX96 must be a non-negative integer string.");return $e(BigInt(t.sqrtPriceX96))}if(t.initialPrice===void 0)throw new a("A new pool needs initialPrice (token1 per 1 token0, human units) or sqrtPriceX96.");return Te(t.initialPrice,e,n)}async function Xe(t,e,n,s){let o=[];for(let i of Object.keys(Pe).map(Number)){if(i===s)continue;let c=m(String(await t.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[e,n,i]})));if(c===$||BigInt(await t.readContract({address:c,abi:he,functionName:"liquidity"}))===0n)continue;let p=await t.readContract({address:c,abi:he,functionName:"slot0"});o.push({label:`v3 fee ${i} pool ${c}`,sqrtPriceX96:BigInt(p[0])})}return o}function j(t,e={}){if(e.chainId!==void 0&&Number(e.chainId)!==y)throw new a(`Uniswap v3 is only supported on Robinhood Chain (${y}).`);if(e.version!==void 0&&e.version!=="v3")throw new a(`Uniswap v3 handler received unsupported version "${String(e.version)}".`);let n=t.clientFor(y);return{...n,readContract:async s=>{try{return await n.readContract(s)}catch(o){throw new a(`Could not read Uniswap v3 ${s.functionName}. ${q(o)}`,{cause:o})}}}}async function Ie(t,e,n){let s;try{s=await t.readContract({address:w.positionManager,abi:P,functionName:"ownerOf",args:[e]})}catch(c){throw new a(`Could not verify owner of Uniswap v3 position #${e}. ${q(c)}`)}let o=m(String(s)),i=m(n);if(o!==i)throw new a(`Wallet ${i} is not the owner of Uniswap v3 position #${e.toString()} (owned by ${o}).`);return o}async function de(t,e){let n=await t.readContract({address:w.positionManager,abi:P,functionName:"positions",args:[e]});return st(n)}function Se(t,e){if(!Array.isArray(e.changes)||!e.changes.length)return t;let n=e.changes.map(s=>`${rt(s.amount,s.token.decimals)} ${s.token.symbol}`);return`${t} (${n.join(", ")})`}async function dt(t,e,n){F(n);let s=m(n),o=j(t,e),i=await Oe(o,e.deadline),c=De(e),r=e.tokenId===void 0?void 0:ee(e.tokenId,"tokenId"),p;if(r!==void 0){if(r<=0n)throw new a("Uniswap v3 tokenId must be a positive integer.");await Ie(o,r,s),p=await de(o,r)}let d=p?.token0??D(e.token0,"token0"),u=p?.token1??D(e.token1,"token1");if(BigInt(d)>=BigInt(u))throw new a("Uniswap v3 requires distinct sorted token addresses.");let g=p?.fee??Number(e.fee??100),f=Pe[g];if(!f)throw new a("Unsupported Uniswap v3 fee tier.");let b=m(String(await o.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[d,u,g]}))),l=e.initialPrice!==void 0||e.sqrtPriceX96!==void 0;if(b===$&&!l)throw new a("No Uniswap v3 pool exists for these tokens and fee tier. To create it and add the first liquidity in one tool call with separately confirmed transactions, add initialPrice (token1 per 1 token0, human units) to this call; to create it without liquidity use uniswap_create_pool.");if(b!==$&&l)throw new a(`The Uniswap v3 pool already exists at ${b}; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);if(r!==void 0&&l)throw new a("initialPrice cannot be combined with tokenId.");if(e.fullRange!==void 0&&typeof e.fullRange!="boolean")throw new a("fullRange must be a boolean.");if(e.fullRange===!0&&(e.tickLower!==void 0||e.tickUpper!==void 0||p))throw new a("Use fullRange only for a new position, without explicit ticks. Existing position ticks cannot change.");let{tickLower:k,tickUpper:U,tickSpacing:A}=ot(p?.tickLower??(e.fullRange===!0?Math.ceil(re/f)*f:e.tickLower),p?.tickUpper??(e.fullRange===!0?Math.floor(se/f)*f:e.tickUpper),f),v=await M(o,d,y,e.token0Decimals),h=await M(o,u,y,e.token1Decimals),C;if(b===$){let T=Ve(e,v.decimals,h.decimals),_=ke(T,await Xe(o,d,u,g),e.acceptPriceDeviation===!0,v.decimals,h.decimals);C={sqrtPriceX96:T,note:_}}let I=W(e.amount0Desired,"amount0Desired"),S=W(e.amount1Desired,"amount1Desired");if(I===0n&&S===0n)throw new a("Liquidity addition requires a positive desired amount.");let x=e.recipient===void 0?s:D(e.recipient,"recipient");if(x!==s)throw new a("Uniswap recipient must be the signing wallet.");if(e.wrapNative===!0&&d!==w.weth&&u!==w.weth)throw new a("Wrapping requires a positive WETH desired amount.");let V=await Promise.all([d,u].map(async T=>BigInt(await o.readContract({address:T,abi:xe,functionName:"allowance",args:[s,w.positionManager]})))),X=(T,_)=>{let pe=[];if(e.wrapNative===!0){let Q=d===w.weth?T:_;Q>0n&&pe.push(ge({to:w.weth,data:nt,value:Q.toString(),chainId:y,description:"Wrap ETH into WETH."}))}for(let[Q,Ge]of[d,u].entries()){let fe=Q===0?T:_;fe>0n&&V[Q]<fe&&pe.push(t.approval(Ge,w.positionManager,fe.toString(),y))}return pe},L=r===void 0?"mint":"increaseLiquidity",R=(T,_)=>H(r===void 0?B({abi:P,functionName:"mint",args:[{token0:d,token1:u,fee:g,tickLower:k,tickUpper:U,amount0Desired:I,amount1Desired:S,amount0Min:T,amount1Min:_,recipient:x,deadline:i}]}):B({abi:P,functionName:"increaseLiquidity",args:[{tokenId:r,amount0Desired:I,amount1Desired:S,amount0Min:T,amount1Min:_,deadline:i}]}),`${L==="mint"?"Mint":"Increase"} Uniswap v3 ${v.symbol}/${h.symbol} liquidity.`),E=C&&H(B({abi:P,functionName:"createAndInitializePoolIfNecessary",args:[d,u,g,C.sqrtPriceX96]}),`Create and initialize the Uniswap v3 ${v.symbol}/${h.symbol} fee ${g} pool at ${ie(C.sqrtPriceX96,v.decimals,h.decimals)} ${h.symbol} per ${v.symbol}.`),K=E?[E]:[],Ae=await Z(o,[...K,...X(I,S),R(0n,0n)],s),N=ce(L,Ae[Ae.length-1]),We=N[N.length-2],ze=N[N.length-1];if(We>I||ze>S)throw new a("Simulated liquidity spend exceeds the desired amounts.");let te=[...K,...X(I,S)],ue=ae(e.amount0Min,N[N.length-2],c,"amount0Min"),le=ae(e.amount1Min,N[N.length-1],c,"amount1Min");if(ue>I||le>S)throw new a("Uniswap v3 minimum amount cannot exceed desired amount.");let Ce=R(ue,le);te.push(Ce);for(let[T,_]of[d,u].entries())(T===0?I:S)>0n&&te.push(t.approval(_,w.positionManager,"0",y));let qe=await t.preview(te,s);return{txs:te,preview:qe,summary:Se(Ce.description,qe),details:{version:"v3",action:L,...r===void 0?{}:{tokenId:r.toString()},pool:b===$?null:b,fee:g,tickSpacing:A,tickLower:k,tickUpper:U,token0:v,token1:h,amount0Desired:I.toString(),amount1Desired:S.toString(),amount0Min:ue.toString(),amount1Min:le.toString(),deadline:i.toString(),recipient:x,expectedAmount0:N[N.length-2].toString(),expectedAmount1:N[N.length-1].toString(),...C?{poolCreated:!0,sqrtPriceX96:C.sqrtPriceX96.toString(),initialPrice:ie(C.sqrtPriceX96,v.decimals,h.decimals),initialTick:be(C.sqrtPriceX96),priceCheck:C.note}:{}}}}async function ut(t,e,n){F(n);let s=m(n),o=j(t,e),i=D(e.token0,"token0"),c=D(e.token1,"token1");if(BigInt(i)>=BigInt(c))throw new a(`Uniswap v3 requires sorted token addresses (token0 < token1). Use token0=${BigInt(i)<BigInt(c)?i:c}, token1=${BigInt(i)<BigInt(c)?c:i}; initialPrice is token1 per 1 token0 in that order.`);let r=Number(e.fee),p=Pe[r];if(!p){let h=Number(await o.readContract({address:w.factory,abi:Y,functionName:"feeAmountTickSpacing",args:[r]}));if(!Number.isInteger(r)||h<=0)throw new a("Unsupported Uniswap v3 fee tier. Enabled tiers: 100, 500, 3000, 10000.");p=h}let d=m(String(await o.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[i,c,r]})));if(d!==$)throw new a(`The Uniswap v3 pool already exists at ${d}. Use uniswap_add to provide liquidity.`);let u=await M(o,i,y,e.token0Decimals),g=await M(o,c,y,e.token1Decimals),f=Ve(e,u.decimals,g.decimals),b=ke(f,await Xe(o,i,c,r),e.acceptPriceDeviation===!0,u.decimals,g.decimals),l=ie(f,u.decimals,g.decimals),k=[H(B({abi:P,functionName:"createAndInitializePoolIfNecessary",args:[i,c,r,f]}),`Create and initialize the Uniswap v3 ${u.symbol}/${g.symbol} fee ${r} pool at ${l} ${g.symbol} per ${u.symbol}.`)],U=await Z(o,k,s),A;try{A=m(String(ve({abi:P,functionName:"createAndInitializePoolIfNecessary",data:U[0]})))}catch{throw new a("Uniswap v3 pool creation simulation returned an invalid pool address.")}if(A===$)throw new a("Uniswap v3 pool creation simulation returned no pool.");let v=await t.preview(k,s);return{txs:k,preview:v,summary:`${k[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add.`,details:{version:"v3",action:"createPool",pool:A,fee:r,tickSpacing:p,token0:u,token1:g,sqrtPriceX96:f.toString(),initialPrice:l,initialTick:be(f),priceCheck:b}}}async function lt(t,e,n){F(n);let s=m(n),o=j(t,e),i=ee(e.tokenId,"tokenId");if(i<=0n)throw new a("Uniswap v3 tokenId must be a positive integer.");await Ie(o,i,s);let c=await de(o,i),r=await M(o,c.token0,y),p=await M(o,c.token1,y),d=e.recipient===void 0?s:D(e.recipient,"recipient");if(d!==s)throw new a("Uniswap recipient must be the signing wallet.");let u=e.amount0Max===void 0?G:W(e.amount0Max,"amount0Max"),g=e.amount1Max===void 0?G:W(e.amount1Max,"amount1Max");if(u===0n&&g===0n||u>G||g>G)throw new a("Collect requires a positive amountMax within uint128.");let f=[H(B({abi:P,functionName:"collect",args:[{tokenId:i,recipient:d,amount0Max:u,amount1Max:g}]}),`Collect Uniswap v3 fees from position #${i}.`)],b=ce("collect",(await Z(o,f,s))[0]),l=await t.preview(f,s);return{txs:f,preview:l,summary:Se(f[0].description,l),details:{version:"v3",action:"collect",tokenId:i.toString(),recipient:d,token0:r,token1:p,amount0Max:u.toString(),amount1Max:g.toString(),expectedAmount0:b[0].toString(),expectedAmount1:b[1].toString()}}}async function pt(t,e,n){F(n);let s=m(n),o=j(t,e),i=ee(e.tokenId,"tokenId");if(i<=0n)throw new a("Uniswap v3 tokenId must be a positive integer.");await Ie(o,i,s);let c=await de(o,i),r=c.liquidity===0n&&e.burn===!0;if(c.liquidity<=0n&&!r)throw new a("Position has zero active liquidity to remove.");if(e.liquidity===void 0&&!r)throw new a('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let p=e.liquidity==="all"||e.liquidity===void 0?c.liquidity:W(e.liquidity,"liquidity");if(p<=0n&&!r)throw new a("Liquidity to remove must be positive.");if(p>c.liquidity)throw new a("Requested liquidity exceeds position liquidity.");let d=await Oe(o,e.deadline),u=De(e),g=await M(o,c.token0,y),f=await M(o,c.token1,y),b=e.recipient===void 0?s:D(e.recipient,"recipient");if(b!==s)throw new a("Uniswap recipient must be the signing wallet.");let l=(R,E)=>H(B({abi:P,functionName:"decreaseLiquidity",args:[{tokenId:i,liquidity:p,amount0Min:R,amount1Min:E,deadline:d}]}),`Decrease ${p} liquidity on Uniswap v3 position #${i}.`),k=r?[0n,0n]:ce("decreaseLiquidity",(await Z(o,[l(0n,0n)],s))[0]),U=(R,E)=>{if(R!==void 0&&W(R,E)!==0n)throw new a(`${E} must be zero for an empty position burn.`);return 0n},A=r?U(e.amount0Min,"amount0Min"):ae(e.amount0Min,k[0],u,"amount0Min"),v=r?U(e.amount1Min,"amount1Min"):ae(e.amount1Min,k[1],u,"amount1Min"),h=r?[]:[l(A,v)],C=h.length,I=!r||c.tokensOwed0>0n||c.tokensOwed1>0n;I&&h.push(H(B({abi:P,functionName:"collect",args:[{tokenId:i,recipient:b,amount0Max:G,amount1Max:G}]}),`Collect principal and fees from Uniswap v3 position #${i}.`));let S=p===c.liquidity,x=S&&e.burn===!0;x&&h.push(H(B({abi:P,functionName:"burn",args:[i]}),`Burn empty Uniswap v3 position #${i}.`));let V=await Z(o,h,s),X=I?ce("collect",V[C]):[0n,0n],L=await t.preview(h,s);return{txs:h,preview:L,summary:Se(`Remove Uniswap v3 liquidity from position #${i}${x?`; burns position #${i} at ${w.positionManager}`:""}`,L),details:{version:"v3",action:"remove",tokenId:i.toString(),recipient:b,token0:g,token1:f,liquidityRemoved:p.toString(),amount0Min:A.toString(),amount1Min:v.toString(),deadline:d.toString(),expectedAmount0:X[0].toString(),expectedAmount1:X[1].toString(),fullExit:S,burned:x}}}function ft(t,e){let n=typeof t=="string"?Je.exec(t):null;if(!n)throw new a('cursor is not a Uniswap v3 position cursor. Pass the nextCursor exactly as a previous uniswap_list_positions {"version":"v3"} page returned it.');if(m(n[1])!==e)throw new a("This cursor was issued for a different wallet. Start again without a cursor to page this wallet.");return{block:BigInt(n[2]),next:BigInt(n[3])}}function mt(t,e,n){return`v3:${t.toLowerCase()}:${e}:${n}`}function gt(t,e){return{...t,readContract:n=>t.readContract({...n,blockNumber:e})}}var ye=t=>me(t,3,-32601,-32004);async function wt(t,e,n={}){let s=m(e),o=new Set;if(Array.isArray(n.tokenIds))for(let d of n.tokenIds){let u=ee(d,"tokenId");u>0n&&o.add(u.toString())}if(Array.isArray(n.receipts))for(let d of n.receipts)for(let u of Re(d,s))o.add(u);if(Array.isArray(n.tokenIds)&&n.tokenIds.length>0)return[...o].map(d=>BigInt(d)).sort((d,u)=>d<u?-1:d>u?1:0);let i=n.cursor,c=()=>new a("This Uniswap v3 position manager cannot enumerate NFTs by owner, so there are no pages to continue. Pass tokenIds to check specific positions."),r=!1,p=!1;try{let d;try{d=BigInt(await t.readContract({address:w.positionManager,abi:P,functionName:"balanceOf",args:[s]}))}catch(l){throw ye(l)||!i?l:new a(`Could not read this wallet's Uniswap v3 holdings at the cursor's snapshot block ${i.block}; the node may no longer serve it. Start again without a cursor. ${q(l)}`)}let u=i?.next??0n;if(u>d)throw new a(`This cursor starts at owner index ${u}, but the wallet held ${d} Uniswap v3 NFTs at block ${i?.block}. Start again without a cursor.`);let g=d-u>Le?u+Le:d,f=[],b=!0;for(let l=u;l<g;l++)try{f.push(BigInt(await t.readContract({address:w.positionManager,abi:P,functionName:"tokenOfOwnerByIndex",args:[s,l]})))}catch(k){if(!ye(k))throw k;b=!1;break}if(b){r=!0,p=u===0n&&g===d;for(let k of f)k>0n&&o.add(k.toString());let l=n.blockNumber;n.onPage?.({balance:d,from:u,to:g,blockNumber:l,...g<d&&l!==void 0?{nextCursor:mt(s,l,g)}:{}})}}catch(d){if(!ye(d))throw d}if(i&&!r)throw c();if((!r||p)&&typeof t.getLogs=="function"&&typeof t.getBlockNumber=="function")try{let d=n.toBlock??await t.getBlockNumber(),u=n.maxChunks??Ye,g=n.fromBlock??(d>oe*BigInt(u)?d-oe*BigInt(u)+1n:0n),f=d,b=0;for(;f>=g&&b<u;){let l=f>=oe-1n?f-(oe-1n):0n,k=l<g?g:l,U=await t.getLogs({address:w.positionManager,fromBlock:k,toBlock:f});for(let A of Re({logs:U},s))o.add(A);if(b+=1,k===0n||k<=g)break;f=k-1n}}catch(d){throw new a(`Could not discover Uniswap v3 positions from logs. ${q(d)}`)}else if(!r&&n.tokenIds===void 0&&n.receipts===void 0)throw new a("Uniswap v3 position discovery is unavailable; supply candidate token IDs or receipts.");return[...o].map(d=>BigInt(d)).sort((d,u)=>d<u?-1:d>u?1:0)}async function Fe(t,e,n={}){F(e);let s=m(e),o=j(t),i=Array.isArray(n.tokenIds)&&n.tokenIds.length>0,c=Array.isArray(n.receipts)&&n.receipts.length>0;if(n.cursor!==void 0&&(i||c))throw new a(`${i?"tokenIds":"receipts"} and cursor cannot be combined: ${i?"tokenIds":"receipts"} inspects exactly those NFTs and has no pages. Send one or the other.`);let r=n.cursor===void 0?void 0:ft(n.cursor,s),p=o,d;if(!i){let f;if(typeof o.getBlockNumber=="function")try{f=await o.getBlockNumber()}catch(b){throw new a(`Could not read the latest block for the Uniswap v3 listing. ${q(b)}`)}if(r&&f!==void 0&&r.block>f)throw new a(`This cursor is from block ${r.block}, ahead of the chain's latest block ${f}. Start again without a cursor.`);d=r?.block??f,d!==void 0&&(p=gt(o,d))}let u=await wt(p,s,{...n,cursor:r,blockNumber:d}),g=[];for(let f of u){let b;try{let x=await p.readContract({address:w.positionManager,abi:P,functionName:"ownerOf",args:[f]});b=m(String(x))}catch(x){if(me(x,3))continue;throw new a(`Could not verify owner of position #${f}. ${q(x)}`)}if(b!==s)continue;let l;try{l=await de(p,f)}catch(x){throw new a(`Could not read position #${f}. ${q(x)}`)}if(l.liquidity===0n&&l.tokensOwed0===0n&&l.tokensOwed1===0n&&!n.includeEmpty)continue;let U=await M(p,l.token0,y),A=await M(p,l.token1,y),v=0n,h=0n;if(l.liquidity>0n)try{let x=await p.readContract({address:w.factory,abi:Y,functionName:"getPool",args:[l.token0,l.token1,l.fee]}),V=m(String(x));if(V===$)throw new a("Position pool was not found.");if(V!==$){let X=await p.readContract({address:V,abi:he,functionName:"slot0"}),L=BigInt(X[0]);if(L<=0n)throw new a("Position pool has no initialized price.");let R=_e(l.tickLower),E=_e(l.tickUpper),K=at(L,R,E,l.liquidity);v=K.amount0,h=K.amount1}}catch(x){throw new a(`Could not value Uniswap v3 position #${f}. ${q(x)}`)}let C=v+l.tokensOwed0,I=h+l.tokensOwed1,S=[{token:U,amount:C.toString()},{token:A,amount:I.toString()}];g.push({module:"uniswap",id:`uniswap:v3:${f.toString()}`,chainId:y,assets:S,description:`Uniswap v3 LP position #${f.toString()} (${U.symbol}/${A.symbol} fee ${l.fee} ticks [${l.tickLower}, ${l.tickUpper}] liquidity ${l.liquidity.toString()})`})}return g}function bt(t){let e=t.nextCursor?`Pass cursor "${t.nextCursor}" to read the next page, or tokenIds to check specific positions.`:"Pass tokenIds to check specific positions.";return t.from===0n?`This wallet holds ${t.balance} Uniswap v3 position NFTs and only the first ${t.to} were checked, so later positions are not listed. ${e}`:`This page checked owner indices ${t.from}-${t.to-1n} of ${t.balance} Uniswap v3 position NFTs, so later positions are not listed. ${e}`}async function kt(t,e,n){j(t,e);let s=e.wallet!==void 0?D(e.wallet,"wallet"):m(n),o=Array.isArray(e.tokenIds)?e.tokenIds:void 0,i=Array.isArray(e.receipts)?e.receipts:void 0,c=e.includeZero===!0||e.includeEmpty===!0,r,p=await Fe(t,s,{tokenIds:o,receipts:i,includeEmpty:c,cursor:e.cursor,onPage:u=>{r=u}}),d=r!==void 0&&r.to<r.balance;return{positions:p,...r?.nextCursor?{nextCursor:r.nextCursor}:{},details:{version:"v3",wallet:s,count:p.length,positionManager:w.positionManager,...r?{balance:Number(r.balance),from:Number(r.from),to:Number(r.to),examined:Number(r.to-r.from),...r.blockNumber!==void 0?{blockNumber:r.blockNumber.toString()}:{}}:{},...r&&d?{truncated:!0,incomplete:!0,note:bt(r)}:{}}}}function yt(t){return[{name:"uniswap_add",inputSchema:{type:"object",description:"Mint a new Uniswap v3 concentrated liquidity position or increase liquidity on an existing v3 NFT position on Robinhood Chain (4663).",properties:{version:{description:"Uniswap v3 concentrated-liquidity version.",type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:'Optional existing v3 position NFT identifier to increase, as a decimal string; omit to mint. Example: "1".'},token0:{type:"string",description:"Sorted ERC-20 token0 address (e.g. WETH)."},token1:{type:"string",description:"Sorted ERC-20 token1 address (e.g. USDG)."},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"integer",enum:[100,500,3e3,1e4],default:100},fullRange:{type:"boolean",description:"For a new v3 position, use the widest ticks aligned to the pool fee tier; omit explicit ticks."},tickLower:{type:"integer",description:"Lower tick boundary divisible by tickSpacing."},tickUpper:{type:"integer",description:"Upper tick boundary divisible by tickSpacing."},amount0Desired:{type:"string",description:'Desired amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'},amount1Desired:{type:"string",description:'Desired amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'},amount0Min:{type:"string",description:'Minimum amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'},amount1Min:{type:"string",description:'Minimum amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999,default:ne},deadline:{type:"integer",description:"Transaction deadline in Unix seconds, after the current block timestamp. Example: 1800000000."},wrapNative:{type:"boolean",description:"Optional: wrap native ETH into WETH before minting."},initialPrice:{type:"string",description:"Starting price as token1 per one token0 in human units; used only for a new pool. Pool creation and the first liquidity add require separate confirmations."},sqrtPriceX96:{type:"string",description:"Alternative starting price: square root of the token1/token0 base-unit price ratio, multiplied by 2^96, as a decimal string."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 basis points (5%) from other live pools of the pair."}}},execute:(c,r)=>dt(t,c,r)},{name:"uniswap_collect",inputSchema:{type:"object",description:"Collect accrued Uniswap v3 LP fees for an owned NonfungiblePositionManager NFT.",properties:{version:{description:"Uniswap v3 concentrated-liquidity version.",type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:'Identifier of the position NFT, as a decimal string. Example: "1".'},recipient:{type:"string",description:"Optional fee recipient; must be the signing wallet."},amount0Max:{type:"string",description:'Maximum amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'},amount1Max:{type:"string",description:'Maximum amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'}},required:["tokenId"]},execute:(c,r)=>lt(t,c,r)},{name:"uniswap_remove",inputSchema:{type:"object",description:"Decrease liquidity on an owned Uniswap v3 NFT position, collect principal and fees, and optionally burn the empty NFT.",properties:{version:{description:"Uniswap v3 concentrated-liquidity version.",type:"string",enum:["v3"],default:"v3"},tokenId:{type:"string",description:'Identifier of the position NFT, as a decimal string. Example: "1".'},liquidity:{type:"string",description:'Liquidity in protocol base units, or "all" for a full exit where supported; not a token amount. Example: "1000" = 1000 liquidity units.'},amount0Min:{type:"string",description:'Minimum amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'},amount1Min:{type:"string",description:'Minimum amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999,default:ne},deadline:{type:"integer",description:"Transaction deadline in Unix seconds, after the current block timestamp. Example: 1800000000."},burn:{type:"boolean",description:"Whether to burn the NFT after removing 100% of liquidity, or burn an already-empty position."}},required:["tokenId"]},execute:(c,r)=>pt(t,c,r)},{name:"uniswap_list_positions",inputSchema:{type:"object",description:"List active Uniswap v3 LP positions owned by the wallet, 64 owner indices per page at one pinned block; follow nextCursor for more. Falls back to a bounded Transfer-log scan for managers that cannot enumerate by owner.",properties:{version:{description:"Uniswap v3 concentrated-liquidity version.",type:"string",enum:["v3"],default:"v3"},wallet:{type:"string",description:"Optional wallet address override."},tokenIds:{type:"array",items:{type:"string"},description:'Optional v3 NFT identifiers as decimal strings, e.g. ["1", "2"]. Inspects exactly these NFTs without paging.'},cursor:et}},execute:(c,r)=>kt(t,c,r)},{name:"uniswap_create_pool",inputSchema:{type:"object",description:"Create and initialize an empty Uniswap v3 pool on Robinhood Chain (4663). Add liquidity afterwards with uniswap_add.",properties:{version:{description:"Uniswap v3 concentrated-liquidity version.",type:"string",enum:["v3"],default:"v3"},token0:{type:"string",description:"Sorted ERC-20 token0 address (WETH, not native ETH)."},token1:{type:"string",description:"Sorted ERC-20 token1 address."},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"integer",enum:[100,500,3e3,1e4]},initialPrice:{type:"string",description:"Starting pool price as token1 per one token0 in human units. Add liquidity separately after initialization."},sqrtPriceX96:{type:"string",description:"Alternative starting price: square root of the token1/token0 base-unit price ratio, multiplied by 2^96, as a decimal string."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 basis points (5%) from other live pools of the pair."}},required:["token0","token1","fee"]},execute:(c,r)=>ut(t,c,r)}]}var He=t=>({tools:yt(t),positions:async e=>{let n,s=await Fe(t,e,{onPage:o=>{o.to>=o.balance||(n={module:"uniswap",id:"uniswap-v3-discovery-truncated",chainId:y,assets:[],incomplete:!0,description:`This wallet holds ${o.balance} Uniswap v3 position NFTs and only the first ${o.to} were checked, so later positions may be missing. Pass tokenIds to uniswap_list_positions to check the others, or page through them with uniswap_list_positions {"version":"v3"} and each nextCursor.`})}});return n?[...s,n]:s}}),Nt=He,Tt=He;export{re as a,se as b,G as c,et as d,w as e,Pe as f,qt as g,P as h,Y as i,he as j,tt as k,ot as l,rt as m,st as n,Re as o,Ut as p,Ve as q,dt as r,ut as s,lt as t,pt as u,Fe as v,kt as w,yt as x,He as y,Nt as z,Tt as A};
@@ -0,0 +1 @@
1
+ import{a as q}from"./NCQFWPAW.js";import{a as v}from"./RUTSEGGD.js";import{K as A}from"./JPPQDELB.js";import{c as k}from"./QLFPAN6S.js";import{a as $}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{d as M,g as F,i as G,m as U}from"./NWNYJ26T.js";import{b as y}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as L,erc20Abi as R,getAddress as N,zeroAddress as j}from"viem";var C={genesis:N("0x575b7B7c97Ef3E21C82DAeB427899d583e1E913f"),bond:N("0xff32a969A0c567129eECD926D04657728E1980C1"),inverse:N("0x92166e94Eea5B7799b761653881692f881dFC4C9"),treasury:N("0x04822Ea321A0DEE6F40656172F29312104855d66"),pteam:N("0x650F58079dAa17ee28928c2F92d22291d038B2B0"),rwa:N("0x99B6eE6eDe47d9a8a9bfd03F728a99B789df1961"),premium:N("0x346e1a31171A0f7aC73909010b5435768d3B5462"),tax:N("0x086C58400b8708Ef993f256E12e752dcF0AC918e")},z=N("0x59F95461E68e0c77605299791E1449f175165B54"),O={genesis:["purchase","finalize","refund","claim"],bond:["deposit","redeem"],inverse:["swap"],treasury:["rebalanceToMorpho","rebalanceFromMorpho","mintNet","spendUsdg"],pteam:["exercise"],rwa:["redeem","depositInventory","pokeHwm","setDiscount","setInventoryMax","setHalt","setMenu","skim"],premium:["execute"],tax:["convert"]},V={genesis:["wired","finalized","finalizeTime","saleStart","saleDeadline","raisedRaw","totalRaised","registryLength"],bond:["wired","enabled","startTime","marketCount"],inverse:["active","price","capacityRemaining","spreadBps"],treasury:["wired","rfv","backingPerToken","liquidUsdg","morphoAssets","polRfv","morphoCapBps","morphoVault","canonicalPair"],pteam:["wired","holder","vestedFraction","exercisableNow","exercised","strikeWad","capBps","circulatingSupply","excludedFromFloat"],rwa:["manager","halted","inventory","inventoryMax","owedNet","bHwm","deskDiscountBps","VEST","MAX_DISCOUNT_BPS","INVENTORY_HARD_CAP","menu","routerSource","sleeve"],premium:["active","clipSize","lastExecuteAt","premiumThresholdWad","router","pairContract"],tax:["wired","pendingNet","teamBps","treasuryBps","teamWallet","router","pairContract"]},T=h=>JSON.parse(JSON.stringify(h,(P,S)=>typeof S=="bigint"?S.toString():S));function g(h){return G(h,"Provide a checksummed address.",M)}var oe=h=>{async function P(t){if(typeof t!="string"||!Object.hasOwn(C,t))throw new o("Choose a published NetNet financial product.");let c=t,e=C[c],r=q[c],u=h.clientFor(y);if(await u.getChainId()!==y)throw new o("NetNet requires chain 4663.");let n=await u.getBlock(),a=(w,x=[])=>u.readContract({address:e,abi:r,functionName:w,args:x,blockNumber:n.number}),[i,s,l,p]=await Promise.all([a("net"),a("usdg"),u.readContract({address:v.address,abi:R,functionName:"decimals",blockNumber:n.number}),u.readContract({address:k.address,abi:R,functionName:"decimals",blockNumber:n.number})]);if(g(i)!==v.address||g(s)!==k.address||l!==v.decimals||p!==k.decimals)throw new o("NetNet financial token pins or decimals do not match the deployment.");return{product:c,contract:e,abi:r,rpc:u,block:n,read:a}}async function S(t){$(t);let c=(e,r)=>({module:"netnet",id:`4663:${C.bond.toLowerCase()}:${e}`,chainId:y,incomplete:!0,assets:[],description:`NetNet bond notes unreadable: ${h.plainError(r)} Use netnet_financial_status with product bond to inspect notes.`});try{let e=await P("bond"),r=U(await e.read("noteCount",[t]),"Invalid NetNet bond note count."),u=r<50n?Number(r):50,n=[];for(let a=0;a<u;a++)try{let i=await e.read("notes",[t,BigInt(a)]);if(!Array.isArray(i)||i.length!==4)throw new o("Invalid NetNet bond note.");let[s,l,p,w]=i.map(B=>U(B,"Invalid NetNet bond note amount or timestamp."));if(l>s||w<=p||w>=1n<<64n)throw new o("Invalid NetNet bond note vesting or claimed amount.");let x=s-l;if(x===0n)continue;let E=e.block.timestamp>=w?s:e.block.timestamp<=p?0n:s*(e.block.timestamp-p)/(w-p),D=E>l?E-l:0n;n.push({module:"netnet",id:`4663:${e.contract.toLowerCase()}:${a}`,chainId:y,matured:e.block.timestamp>=w,assets:[{token:v,amount:x.toString()}],description:`NetNet bond note ${a}: ${x} NET base units outstanding; ${D} claimable now, vesting ends at Unix ${w}. Redeem vested NET with netnet_financial_action product bond operation redeem. Payment cannot be withdrawn. Block ${e.block.number}.`})}catch(i){n.push(c(String(a),i))}return r>BigInt(u)&&n.push({module:"netnet",id:`4663:${e.contract.toLowerCase()}:coverage`,chainId:y,incomplete:!0,assets:[],description:`NetNet bond positions checked the first ${u} of ${r} notes. Use netnet_financial_status product bond offset ${u} to read the remaining notes.`}),n}catch(e){return[c("unreadable",e)]}}let _=(t,c,e,r)=>({name:t,inputSchema:{type:"object",properties:c,required:e,additionalProperties:!1},execute:async(u,n)=>{try{if($(n),Object.keys(u).some(a=>!Object.hasOwn(c,a)))throw new o("Unsupported NetNet financial argument.");return await r(u,n)}catch(a){throw new o(h.plainError(a))}}}),W={type:"string",enum:Object.keys(C),description:"NetNet financial product: genesis (founding sale), bond, inverse (NET buyback), treasury, pteam (team option), rwa (equity desk), premium (premium keeper) or tax (tax collector)."};return{positions:S,tools:[_("netnet_financial_status",{product:W,offset:{type:"integer",minimum:0,description:"Index of the first wallet note to return (bond and rwa products only). Default 0."},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum notes to return, 1 to 50 (default 20; bond and rwa products only)."}},["product"],async(t,c)=>{let e=await P(t.product),r=V[e.product],u=t.offset??0,n=t.limit??20;if(!Number.isSafeInteger(u)||Number(u)<0||!Number.isSafeInteger(n)||Number(n)<1||Number(n)>50)throw new o("Use a nonnegative offset and limit 1..50.");let a=await Promise.all(r.map(async s=>{try{return[s,{value:T(await e.read(s))}]}catch(l){return[s,{unavailable:h.plainError(l)}]}})),i={};if(e.product==="genesis")for(let s of["purchasedRaw","purchasedNetOf","claimedNet","claimableNetOf"])i[s]=T(await e.read(s,[c]));if(e.product==="bond"||e.product==="rwa"){i.pending=T(await e.read("pendingFor",[c]));let s=await e.read("noteCount",[c]);if(typeof s!="bigint"||s<0n)throw new o("Invalid NetNet note count.");let l=s<BigInt(Number(u)+Number(n))?s:BigInt(Number(u)+Number(n));i.noteCount=s.toString(),i.notes=await Promise.all(Array.from({length:Math.max(0,Number(l-BigInt(Number(u))))},async(p,w)=>({id:String(Number(u)+w),note:T(await e.read(e.product==="bond"?"notes":"noteAt",[c,BigInt(Number(u)+w)]))}))),i.nextOffset=l<s?l.toString():null,e.product==="bond"&&(i.markets=await Promise.all([0n,1n].map(async p=>{try{return{id:p.toString(),quoteToken:g(await e.read("quoteToken",[p])),priceWad:String(await e.read("bondPrice",[p]))}}catch(w){return{id:p.toString(),unavailable:h.plainError(w)}}})))}return e.product==="treasury"&&(i.isMinter=await e.read("isMinter",[c]),i.isSpender=await e.read("isSpender",[c])),{chainId:y,contract:e.contract,product:e.product,blockNumber:String(e.block.number),tokens:[v,k],metrics:Object.fromEntries(a),wallet:i,units:"Raw token amounts use each token\u2019s decimals. Prices, NAV, reserve values and capacityRemaining use 18-decimal USDG WAD. Note timestamps are Unix seconds.",operations:O[e.product],caveat:"An unavailable metric is not zero. Formulaic eligibility, oracle liveness, caps and vesting are checked by the action preview. RWA entry/router calldata and initial deployment wiring remain unsupported."}}),_("netnet_financial_action",{product:W,operation:{type:"string",enum:[...new Set(Object.values(O).flat())],description:"Action to run; it must be one the chosen product supports, for example bond deposit or redeem, genesis purchase or claim, inverse swap."},amount:I('Amount in base units of the token the operation spends or moves: USDG has 6 decimals, NET 9 ("1000000" = 1 USDG, "1000000000" = 1 NET).'),minAmountOut:I('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9). Example: "1000000" = 1 USDG.'),maxPriceWad:I("Highest bond price you accept, as an 18-decimal wad of USDG per NET in base units (1e18 = 1 USDG). Bond deposit only."),maxPayment:I('Most USDG you will pay to exercise, in USDG base units (6 decimals). Example: "1000000" = 1 USDG. pteam exercise only.'),marketId:{type:"integer",enum:[0,1],description:"Bond market: 0 pays with USDG, 1 pays with the canonical NET/USDG LP token. Bond deposit only."},recipient:{type:"string",description:"Address that receives the minted NET or spent USDG. Treasury mintNet and spendUsdg only; use the intended address."},halted:{type:"boolean",description:"rwa setHalt only: true halts the desk, false resumes it."},token:{type:"string",description:"Address of the stray token to sweep (0x + 40 hex digits). rwa skim only."},noteIds:{type:"array",maxItems:50,description:"Bond note ids to redeem, unique decimal strings (rwa redeem only); omit to redeem every vested note.",items:I('Note id (index of the wallet note), as a decimal string. Example: "0".')},menu:{type:"array",maxItems:32,description:"Complete replacement RWA equity menu (rwa setMenu only): up to 32 entries; target weights must sum to 10000 basis points.",items:{type:"object",description:"Menu entry with token and feed addresses, targetWeightBps (10000 = 100%) and active (boolean)."}}},["product","operation"],async(t,c)=>{let e=await P(t.product),r=t.operation;if(typeof r!="string"||!O[e.product].includes(r))throw new o("This operation is not supported by the selected financial product.");let u=new Set(["product","operation"]),n=[],a,i=0n,s="",l=(...d)=>d.forEach(m=>u.add(m)),p=()=>(l("amount"),A(t.amount)),w=()=>(l("minAmountOut"),A(t.minAmountOut));if(e.product==="genesis"){if(r==="purchase"&&(i=p(),a=k,n=[i],s="Founding subscription; NET is claimable only after successful finalization and vesting. A failed sale requires refund."),r==="claim"&&await e.read("claimableNetOf",[c])===0n)throw new o("No vested founding NET is claimable by this wallet.")}else if(e.product==="bond")if(r==="deposit"){if(l("marketId","maxPriceWad"),t.marketId!==0&&t.marketId!==1)throw new o("Bond marketId must be 0 (USDG) or 1 (canonical LP).");let d=BigInt(t.marketId);if(g(await e.read("quoteToken",[d]))!==(d===0n?k.address:z))throw new o("Bond quote token is not the pinned USDG or canonical LP.");i=p(),a=d===0n?k:{address:z,decimals:18,symbol:"NET/USDG LP",chainId:y};let f=A(t.maxPriceWad),b=await e.read("bondPrice",[d]);if(typeof b!="bigint"||b===0n||b>f)throw new o("Bond price exceeds maxPriceWad or is invalid.");n=[d,i,f,c],s="Payment is exchanged for a non-transferable NET note with two-day linear vesting. Redeem vested NET with the same product; payment cannot be withdrawn."}else n=[c];else if(e.product==="inverse"){if(i=p(),a=v,n=[i,w()],s="Purchased NET is burned permanently; USDG pays directly to this wallet. Capacity is denominated in USDG WAD, not raw USDG.",await e.read("active")!==!0)throw new o("NetNet buyback is inactive: oracle, finalization or capacity is unavailable.")}else if(e.product==="pteam"){if(g(await e.read("holder"))!==N(c))throw new o("This wallet is not the immutable pTEAM holder.");let d=p();if(l("maxPayment"),d>await e.read("exercisableNow"))throw new o("The NET exercise amount exceeds the vested cap.");let m=await e.read("strikeWad");if(i=(d*m/10n**BigInt(v.decimals)+10n**12n-1n)/10n**12n,i===0n||i>A(t.maxPayment))throw new o("The exercise payment exceeds maxPayment or rounds to zero.");a=k,n=[d],s=`Exercise pays ${i} USDG base units into treasury reserves and mints ${d} NET base units to the immutable holder. No withdrawal or exercise reversal exists.`}else if(e.product==="treasury"){let d=p();if(r==="mintNet"||r==="spendUsdg"){l("recipient");let m=g(t.recipient);if(await e.read(r==="mintNet"?"isMinter":"isSpender",[c])!==!0)throw new o("This wallet lacks the fixed NetNet treasury minter/spender role.");n=[m,d],s=`Protocol treasury operation sends ${d} base units to ${m}; it does not deposit into this wallet\u2019s savings.`}else n=[d],s="Permissionless protocol reserve rebalance; assets remain owned by the NetNet treasury. The deployed fraction is constrained by the immutable cap."}else if(e.product==="rwa"){if(["depositInventory","setDiscount","setInventoryMax","setHalt","setMenu"].includes(r)&&g(await e.read("manager"))!==N(c))throw new o("This wallet lacks the immutable RWA manager role.");if(r==="redeem")if(l("noteIds"),t.noteIds===void 0)n=[c];else{if(!Array.isArray(t.noteIds)||!t.noteIds.length||t.noteIds.length>50)throw new o("Provide 1..50 unique note IDs.");let m=t.noteIds.map(b=>A(b,!0));if(new Set(m.map(String)).size!==m.length)throw new o("Note IDs must be unique.");let f=await e.read("noteCount",[c]);if(m.some(b=>b>=f))throw new o("RWA note ID is out of range.");n=[c,m]}else if(r==="setHalt"){if(l("halted"),typeof t.halted!="boolean")throw new o("Provide halted as a boolean.");n=[t.halted]}else if(r==="setMenu"){if(l("menu"),!Array.isArray(t.menu)||!t.menu.length||t.menu.length>32)throw new o("Provide 1..32 explicit RWA menu entries.");let m=t.menu.map(f=>{if(!f||typeof f!="object"||Array.isArray(f)||Object.keys(f).some(H=>!["token","feed","targetWeightBps","active"].includes(H)))throw new o("Invalid RWA menu fields.");let b=f;if(typeof b.active!="boolean")throw new o("RWA active must be boolean.");return{token:g(b.token),feed:g(b.feed),targetWeightBps:A(b.targetWeightBps,!0),active:b.active}});if(new Set(m.map(f=>f.token)).size!==m.length||m.reduce((f,b)=>f+b.targetWeightBps,0n)!==10000n||m.some(f=>f.active&&(f.token===j||f.feed===j)))throw new o("RWA menu tokens must be unique, weights sum to 10000, active feeds/tokens nonzero.");n=[m],s=`Replace the complete RWA equity menu: ${JSON.stringify(T(m))}.`}else if(r==="skim")l("token"),n=[g(t.token)],s=`Sweep eligible stray assets to sleeve ${g(await e.read("sleeve"))}, not to this wallet.`;else if(r!=="pokeHwm"){let m=p();if(n=[m],r==="depositInventory"&&(a=v,i=m,s="Inventory funding is one-way. The manager cannot withdraw these NET; they are committed to bond obligations."),r==="setDiscount"&&m>await e.read("MAX_DISCOUNT_BPS")||r==="setInventoryMax"&&m>await e.read("INVENTORY_HARD_CAP"))throw new o("RWA setting exceeds its immutable maximum.")}}else e.product==="premium"?(n=[w()],s="Permissionless mint-and-sell keeper operation; all sale proceeds go to NetNet treasury. The caller receives no reward."):(n=[p(),w()],s="Convert NET already owned by the tax collector. Proceeds split to treasury and team; the caller receives no reward and supplies no NET.");if(Object.keys(t).some(d=>!u.has(d)))throw new o("Unexpected fields for this NetNet operation.");if(a&&await e.rpc.readContract({address:a.address,abi:R,functionName:"balanceOf",args:[c],blockNumber:e.block.number})<i)throw new o(`Top up ${a.symbol}: needs ${i} base units.`);let x=`NetNet ${e.product}.${r}, contract ${e.contract}, chain ${y}, values ${JSON.stringify(T(n))}. ${a?`Approve exactly ${i} ${a.symbol} base units (${a.address}, decimals ${a.decimals}). `:""}${s}`,E=[...a?[h.approval(a.address,e.contract,i.toString(),y)]:[],h.unsignedTx({to:e.contract,data:L({abi:e.abi,functionName:r,args:n}),value:"0",chainId:y,description:x})],D=await h.preview(E,c),B=0n;for(let d of D.changes){if(!/^-?\d+$/.test(d.amount))throw new o("Invalid NetNet preview amount.");if(BigInt(d.amount)<0n&&(B-=BigInt(d.amount)),BigInt(d.amount)<0n&&(!a||d.token.chainId!==y||!F(d.token.address,a.address)||d.token.decimals!==a.decimals||-BigInt(d.amount)>i))throw new o("NetNet preview spends outside the exact input budget.")}if(B>i)throw new o("NetNet preview exceeds the aggregate input budget.");return{txs:E,preview:D,summary:x}})]}};export{C as a,z as b,oe as c};
@@ -1 +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};
1
+ import{d as N}from"./UNJJRQIU.js";import{b as W}from"./QLFPAN6S.js";import{c as K}from"./SCG5HWMN.js";import{g as S}from"./NWNYJ26T.js";import{a as j,b as M,c as O}from"./IX3GZMTM.js";import{b as q,j as z}from"./TI727O2H.js";import{a}from"./XSD5NL7J.js";import{a as $}from"./JXOEJPJ4.js";import{encodeAbiParameters as ce,encodeFunctionData as J,erc20Abi as V,getAddress as Z,isAddress as me,keccak256 as X,parseAbi as ue,parseAbiParameters as ye,zeroAddress as ee}from"viem";var x=q,C=Z(z[x].hoodlock.airdrop.address),oe="https://hoodlock.tech",P=25e4,ge=256,fe=604800n,pe=30n,Q=250000000000000000n,Y=0xffffffffn,be=(1n<<64n)-1n,ne=(1n<<128n)-1n,re="0x0000000000000000000000000000000000000000000000000000000000000000",xe="0x1111111111111111111111111111111111111111",Ae=ye("uint256, address, uint256"),T=ue(["function quote(uint32 maxClaims) view returns (uint256)","function create(address token, bytes32 merkleRoot, uint256 total, uint32 maxClaims, uint64 endTime, string uri) payable returns (uint256 id)","function claim(uint256 id, uint256 index, address account, uint256 amount, bytes32[] proof)","function getAirdrop(uint256 id) view returns (address creator, uint64 endTime, uint32 maxClaims, address token, uint32 claims, bool swept, bytes32 merkleRoot, uint128 total, uint128 remaining)","function isClaimed(uint256 id, uint256 index) view returns (bool)"]);function he(o,e,r){let n=e.trim();if(n.startsWith("-")){let t=n.slice(1);return`-${o.formatAmount(t,r)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,r)}function te(o,e){if(!e.changes.length)return e.summary;let r=e.changes.map(n=>`${he(o,n.amount,n.token.decimals)} ${$(n.token.symbol)}`).join(", ");return`${e.summary} (${r})`}async function we(o,e){try{let[r,n]=await Promise.all([o.readContract({address:e,abi:V,functionName:"symbol"}),o.readContract({address:e,abi:V,functionName:"decimals"})]),d=typeof r=="string"&&r.trim()?r.trim():"TOKEN",t=Number(n);return{symbol:d,decimals:Number.isInteger(t)&&t>=0&&t<=255?t:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,r){if(typeof e=="string"&&e.includes(".")){if(r?.decimals===void 0)throw new a(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=r.rounding!==void 0?O(e,r.decimals,r.rounding):o?o.parseAmount(e,r.decimals):O(e,r.decimals),t=M(d);if(t<=0n)throw new a("Airdrop entry amount must be positive.");return t}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=M(e.trim());else throw j()}catch(d){throw d instanceof a?d:new a(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new a("Airdrop entry amount must be strictly positive (> 0).");return n}function H(o,e){try{let r=typeof o=="bigint"?o:BigInt(String(o).trim());if(r<0n)throw new a(`${e} must be non-negative.`);return r}catch(r){throw r instanceof a?r:new a(`Invalid ${e}: ${String(o)}`,{cause:r})}}function A(o,e){if(typeof o!="string"||!me(o,{strict:!1}))throw new a(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return Z(o)}function L(o,e,r){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>Y)throw new a(`Airdrop leaf index must be in 0..${Y.toString()}.`);let d=A(e,"account"),t=w(void 0,r),s=ce(Ae,[n,d,t]);return X(X(s))}function ie(o,e){let r=o;for(let n of e)r=N(r,n);return r}function Ne(o){try{let e=L(o.index,o.account,o.amount),r=ie(e,o.proof);return S(r,o.root)}catch{return!1}}function U(o,e){if(!Array.isArray(o)||o.length===0)throw new a("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new a(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let r=[],n=0n;for(let i=0;i<o.length;i+=1){let l=o[i];if(!l)throw new a(`Missing airdrop entry at position ${i}.`);let c=l.index??i;if(!Number.isInteger(c)||c!==i)throw new a(`Airdrop entry index at position ${i} must be contiguous ${i} (got ${String(c)}).`);let u=A(l.account,`entries[${i}].account`),g=w(e?.context,l.amount,e);n+=g,r.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ne)throw new a("Airdrop total amount must be > 0 and fit in uint128.");let d=r.map(i=>L(i.index,i.account,i.amount)),t=[d];for(;t[t.length-1].length>1;){let i=t[t.length-1],l=[];for(let c=0;c<i.length;c+=2){let u=i[c],g=i[c+1];g===void 0?l.push(u):l.push(N(u,g))}t.push(l)}let s=t[t.length-1][0];if(s.toLowerCase()===re)throw new a("Computed Merkle root cannot be zero.");let f=t.length>1?t[1]:t[0],m=r.map((i,l)=>{let c=[],u=l;for(let g=0;g<t.length-1;g+=1){let y=t[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:i.index,account:i.account,amount:i.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:r.length,values:r.map(i=>[i.index,i.account,i.amount]),entries:r};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:r.length,entries:r,proofs:m,list:p}}function ke(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new a("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,t])=>({index:n,account:d,amount:t})),r=U(e);if(o.root&&!S(r.root,o.root))throw new a(`Rebuilt tree root ${r.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&r.maxClaims!==o.maxClaims)throw new a(`Rebuilt maxClaims (${r.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&r.totalAmount!==o.totalAmount)throw new a(`Rebuilt totalAmount (${r.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return r}async function ae(o,e){return K(o.http,e,{method:"GET"},r=>r!==null&&typeof r=="object")}async function $e(o,e,r){let n=A(e.token,"token");if(n===ee)throw new a("Airdrop token cannot be the zero address.");let d=U(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),t=e.maxClaims??d.maxClaims;if(!Number.isInteger(t)||t<1||t>P||t!==d.maxClaims)throw new a(`maxClaims (${String(t)}) must equal entries.length (${d.maxClaims}) and be in 1..${P}.`);let s=BigInt(d.totalAmount),f=e.total!==void 0?w(o,e.total,{decimals:e.decimals,rounding:e.rounding}):s;if(f<s)throw new a(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ne)throw new a("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ge)throw new a(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let i=e.endTime!==void 0?H(e.endTime,"endTime"):0n;if(i>be)throw new a("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new a(`Token ${n} has no contract code on chain ${x}.`);let u;if(i!==0n){let _=(await l.getBlock()).timestamp,B=e.inclusionMargin!==void 0?H(e.inclusionMargin,"inclusionMargin"):pe;if(B<=0n)throw new a("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let D=_+B,I=e.inclusionTime!==void 0?H(e.inclusionTime,"inclusionTime"):D;if(I<D)throw new a(`inclusionTime (${I.toString()}) must be after the already-mined block (${_.toString()}) with room for signing and inclusion (>= ${D.toString()}).`);u=I;let F=I+fe;if(i<F)throw new a(`endTime (${i.toString()}) is too short (window too short): must be 0 or at least inclusion time (${I.toString()}) + 604800 (7 days >= ${F.toString()}, after already-mined block.timestamp ${_.toString()}).`)}let g=await l.readContract({address:C,abi:T,functionName:"quote",args:[t]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>Q)throw new a(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${Q.toString()}).`);let b=o.formatAmount(y.toString(),W.decimals),h=o.approval(n,C,f.toString(),x),k=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"create",args:[n,d.root,f,t,i,m]}),value:y.toString(),description:`Create HoodLock airdrop (${t} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),v=[h,k],E=A(e.account??r??xe,"wallet"),R=await o.preview(v,E),le=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",se=`${te(o,R)}${le}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:t,endTime:i,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:v,preview:R,summary:se}}async function G(o,e,r,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==r)throw new a(`savedProof account (${m}) does not match claim account (${r}).`);return{index:n.savedProof.index,amount:w(o,n.savedProof.amount),proof:n.savedProof.proof}}if(n.proof!==void 0&&n.index!==void 0&&n.amount!==void 0){let m=Number(n.index);if(!Number.isInteger(m)||m<0)throw new a(`Invalid claim index: ${String(n.index)}`);return{index:m,amount:w(o,n.amount),proof:n.proof}}if(n.list||n.entries){let p=(n.list?ke(n.list):U(n.entries,{context:o})).proofs.find(i=>!(!S(i.account,r)||n.index!==void 0&&i.index!==Number(n.index)));if(!p)throw new a(`Account ${r} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${oe}/api/airdrop/${e.toString()}/proof?address=${r}`,t=await ae(o,d),s=t?.data??t;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new a(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${r}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new a(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function de(o,e){let r=o.clientFor(x),n=await r.readContract({address:C,abi:T,functionName:"getAirdrop",args:[e.id]}),[d,t,s,f,m,p,i,,l]=n,c=BigInt(t),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===ee||i.toLowerCase()===re)throw new a(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new a(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await r.getBlock()).timestamp>=c)throw new a(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new a(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([r.readContract({address:C,abi:T,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),we(r,b)]);if(h)throw new a(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new a(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let v=L(e.index,e.account,e.amount),E=ie(v,e.proof);if(!S(E,i))throw new a(`Computed Merkle root ${E} does not match on-chain airdrop root ${i} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:i,leaf:v}}async function Se(o,e){let{tokenAddress:r,tokenMeta:n,merkleRoot:d,leaf:t}=await de(o,e),s=e.caller??e.account,f=!S(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:C,data:J({abi:T,functionName:"claim",args:[e.id,BigInt(e.index),e.account,e.amount,[...e.proof]]}),value:"0",description:f?`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for recipient ${e.account} (caller ${s} pays gas only, token delta 0)`:`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for ${e.account}`}),i=[p],l=await o.preview(i,s),c,u,g=e.amount.toString(),y;if(f){let b=l.changes.filter(h=>h.amount.trim().startsWith("-"));c={...l,changes:b,summary:`${l.summary} Recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units); caller ${s} change is 0 (gas only).`},u=`Third-party claim from HoodLock airdrop #${e.id.toString()} (index ${e.index}): recipient ${e.account} receives ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}); caller ${s} own token change is 0 (gas only). ${l.summary}`,y="0"}else c=l,u=`Claim ${m} ${$(n.symbol)} (${e.amount.toString()} base units of ${r}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${te(o,c)}`,y=e.amount.toString();return{kind:"hoodlock_airdrop_claim",chainId:x,id:e.id,index:e.index,account:e.account,recipient:e.account,caller:e.caller,token:r,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:t,merkleRoot:d,proof:[...e.proof],tx:p,txs:i,preview:c,summary:u}}async function Ce(o,e,r){let n=A(e.account??r??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):r!==void 0?A(r,"wallet"):void 0;if(e.id!==void 0){let l=H(e.id,"id"),c=await G(o,l,n,e);return Se(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let t=`${oe}/api/airdrop/eligible?address=${n}`,s=await ae(o,t),f=Array.isArray(s)?s:s?.claimable??s?.eligible??s?.airdrops??s?.claims??[],m=[];for(let l of f){let c=l.id??l.airdropId;if(c!==void 0)try{let u=H(c,"eligible.id"),g,y,b;if(l.index!==void 0&&l.amount!==void 0&&Array.isArray(l.proof))g=Number(l.index),y=w(o,l.amount),b=l.proof;else{let k=await G(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await de(o,{id:u,index:g,account:n,amount:y,proof:b});m.push({id:u.toString(),index:g,account:n,token:h.tokenAddress,amount:y.toString(),proof:[...b],merkleRoot:h.merkleRoot})}catch{continue}}let p=m.length===0?`No verified eligible HoodLock airdrops were returned by the index for ${n}. Discovery can lag after creation; this does not prove there are no claims. If you know the airdrop id, call hoodlock_airdrop_claim with id and account to resolve its list/proof and verify it on-chain.`:`Found ${m.length} eligible HoodLock airdrop(s) for ${n}: ${m.map(l=>`#${l.id}`).join(", ")}. Discovery can lag after creation. Choose an id, or pass a known new id, to hoodlock_airdrop_claim to verify and build a claim transaction.`;return{kind:"hoodlock_airdrop_eligible",chainId:x,account:n,recipient:n,caller:d,recipientDelta:"0",senderDelta:"0",eligible:m,claims:[],tx:void 0,txs:[],preview:{txs:[],changes:[],summary:p},summary:p}}var ve=o=>({tools:[{name:"hoodlock_airdrop_create",inputSchema:{type:"object",required:["token","entries"],additionalProperties:!1,properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663"},entries:{type:"array",description:"Ordered airdrop entries [{ index?, account, amount }] with base-unit integer string amounts"},total:{type:"string",description:"Optional total funded token amount as a base-unit integer string (>= sum of entries)"},maxClaims:{type:"number",description:"Optional claim count (must equal entries.length in 1..250000)"},endTime:{type:"number",description:"Unix timestamp in seconds (0 for non-sweepable or >= inclusion time + 604800)"},inclusionTime:{type:"number",description:"Optional expected transaction inclusion Unix timestamp in seconds (> already-mined block.timestamp)"},inclusionMargin:{type:"number",description:"Optional signing and inclusion margin in seconds above the already-mined block.timestamp (>= 1, default 30)"},uri:{type:"string",description:"Metadata URI (<= 256 UTF-8 bytes)"},decimals:{type:"number",description:"Optional token decimals when converting human decimal entry amounts via parseAmount"},rounding:{type:"string",enum:["floor","ceil"],description:"Optional rounding mode (floor or ceil) when converting decimal amounts"},account:{type:"string",description:"Optional creator wallet address for preview simulation"}}},execute:async(e,r)=>$e(o,e,r)},{name:"hoodlock_airdrop_claim",inputSchema:{type:"object",required:["account"],additionalProperties:!1,properties:{id:{type:"string",description:"Optional airdrop ID (omit to query eligible airdrops)"},account:{type:"string",description:"Leaf recipient address that receives the tokens"},caller:{type:"string",description:"Optional caller/relayer address submitting the tx (pays gas only, receives 0 tokens)"},index:{type:"number",description:"Optional leaf index when supplying proof directly or selecting from list/entries"},amount:{type:"string",description:"Optional leaf amount as a base-unit integer string"},proof:{type:"array",items:{type:"string"},description:"Optional Merkle sibling proof array of 32-byte hex strings"},savedProof:{type:"object",description:"Optional saved proof item ({ index, account, amount, leaf?, proof }) from hoodlock_airdrop_create"},list:{type:"object",description:"Optional saved airdrop list ({ format, leafEncoding, root, totalAmount, maxClaims, values, entries }) to rebuild proof locally"},entries:{type:"array",description:"Optional airdrop entries array ([{ index?, account, amount }]) to rebuild proof locally"}}},execute:async(e,r)=>Ce(o,e,r)}]}),Le=ve;export{V as a,x as b,C as c,oe as d,P as e,ge as f,fe as g,pe as h,Q as i,T as j,he as k,L as l,ie as m,Ne as n,U as o,ke as p,ve as q,Le as r};
@@ -0,0 +1 @@
1
+ import{a as r}from"./4TTDAF4B.js";import{a}from"./3CH2IPQL.js";import{isAddress as h}from"viem";function u(e){if(e===null||typeof e!="object"||Array.isArray(e))throw new r;return e}function w(e){if(typeof e!="string"||!e.length)throw new r;return e}function f(e){if(typeof e!="string"||!h(e,{strict:!1}))throw new r;return e}function p(e,o){let n=u(e);if(n.x402Version!==o||!Array.isArray(n.accepts)||n.accepts.length!==1)throw new r;let t=u(n.accepts[0]),i=u(t.extra);if(t.scheme!=="exact"||t.network!==(o===1?"robinhood":"eip155:4663"))throw new r;let c=w(o===1?t.maxAmountRequired:t.amount);if(!/^[1-9][0-9]*$/.test(c)||typeof t.maxTimeoutSeconds!="number"||!Number.isInteger(t.maxTimeoutSeconds))throw new r;return{x402Version:o,terms:{scheme:"exact",network:"eip155:4663",amount:c,asset:f(t.asset),payTo:f(t.payTo),maxTimeoutSeconds:t.maxTimeoutSeconds,resourceUrl:w(o===1?t.resource:u(n.resource).url),extra:{name:w(i.name),version:w(i.version)}}}}function d(e,o){try{if(typeof o!="string"||!o.length||o.length>32768||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o))throw new r;let n=Buffer.from(o,"base64"),t=n.toString("utf8");if(!Buffer.from(t,"utf8").equals(n))throw new r;let i=p(e,1),c=p(JSON.parse(t),2),s=i.terms,m=c.terms;if(s.scheme!==m.scheme||s.network!==m.network||s.amount!==m.amount||s.asset!==m.asset||s.payTo!==m.payTo||s.maxTimeoutSeconds!==m.maxTimeoutSeconds||s.resourceUrl!==m.resourceUrl||s.extra.name!==m.extra.name||s.extra.version!==m.extra.version)throw new r;return{v1:i,v2:c,terms:s}}catch{throw new r}}function x(e){if(typeof e!="number"||!Number.isInteger(e)||e<1||e>50)throw new Error("Use whole dollars from 1 to 50.");return(BigInt(e)*1000000n).toString()}function l(e,o){try{let n=x(o);if(e.scheme!=="exact"||e.network!=="eip155:4663"||e.amount!==n||f(e.asset).toLowerCase()!==a.usdg.toLowerCase()||f(e.payTo).toLowerCase()!==a.payTo.toLowerCase()||!Number.isInteger(e.maxTimeoutSeconds)||e.maxTimeoutSeconds<60||e.maxTimeoutSeconds>300||e.resourceUrl!==`${a.apiOrigin}${a.topupPath}?usd=${o}`||e.extra.name!==a.usdgDomain.name||e.extra.version!==a.usdgDomain.version)throw new r}catch{throw new r}}export{d as a,x as b,l as c};
@@ -1 +1 @@
1
- import{b as I,c as M}from"./QU5XKRGK.js";import{a as b,c as s,d as k,f as E}from"./4HG6FRVH.js";import{g}from"./H43RNCX2.js";import{a as N}from"./43LI5NKJ.js";import{a as C,i as D,j as i}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{erc20Abi as U,parseAbi as P}from"viem";var o=P(["function isValidMarket(address market) view returns(bool)","function readTokens() view returns(address sy,address pt,address yt)","function expiry() view returns(uint256)","function isExpired() view returns(bool)","function getTokensIn() view returns(address[])","function getTokensOut() view returns(address[])"]);async function H(u,r,d){if(N(r),I(d,!0),u.network==="testnet")throw new y("Pendle is available on chain 4663 only.");let e=u.clientFor(C),w=await e.getBlock(),t=w.number;s(await e.readContract({address:D[4663].pendle.marketFactory.address,abi:o,functionName:"isValidMarket",args:[r],blockNumber:t})===!0,"market is not verified by Pendle\u2019s factory");let[[c,m,O],p,h]=await Promise.all([e.readContract({address:r,abi:o,functionName:"readTokens",blockNumber:t}),e.readContract({address:r,abi:o,functionName:"expiry",blockNumber:t}),e.readContract({address:r,abi:o,functionName:"isExpired",blockNumber:t})]),[v,T]=await Promise.all([e.readContract({address:c,abi:o,functionName:"getTokensIn",blockNumber:t}),e.readContract({address:c,abi:o,functionName:"getTokensOut",blockNumber:t})]);s(v.some(n=>k(n,i)),"the earn cost comparison requires a USDG term"),s(T.some(n=>k(n,i)),"this term cannot cash out to USDG"),s(!h&&p>w.timestamp&&p<=BigInt(Number.MAX_SAFE_INTEGER),"this term has ended or its end date is unreadable");let l=n=>e.readContract({address:n,abi:U,functionName:"decimals",blockNumber:t}),[S,x,R]=await Promise.all([l(i),l(m),l(c)]),A={market:r,sy:c,pt:m,yt:O,expiry:Number(p),expired:h,kind:"stable",inputToken:i,inputSymbol:"USDG",inputDecimals:S,ptDecimals:x,syDecimals:R,tokensIn:[...v],tokensOut:[...T]},f=await g(u.http,{inputToken:i,outputToken:m,amount:d,wallet:b,slippageBps:50}),a=E(f.body,{market:A,wallet:b,amount:d,slippageBps:50});if(Math.abs(a.priceImpact)>.03)throw new y("This is a thin market and your size moves the price too much. Try a smaller amount.");return await M(e,A,"buy",d,a.amountOut,a.priceImpact),s(Date.now()-f.receivedAt>=0&&Date.now()-f.receivedAt<=3e4,"display quote is too old; try again"),{feeUsd:a.feeUsd,impactPct:Math.abs(a.priceImpact)*100,ptOutBase:a.amountOut}}export{H as a};
1
+ import{b as I,c as M}from"./2OVJ2BTJ.js";import{a as b,c as s,d as k,f as E}from"./GQITAJVF.js";import{g}from"./OUROA7XR.js";import{a as N}from"./43LI5NKJ.js";import{b as C,j as D,k as i}from"./TI727O2H.js";import{a as y}from"./XSD5NL7J.js";import{erc20Abi as U,parseAbi as P}from"viem";var o=P(["function isValidMarket(address market) view returns(bool)","function readTokens() view returns(address sy,address pt,address yt)","function expiry() view returns(uint256)","function isExpired() view returns(bool)","function getTokensIn() view returns(address[])","function getTokensOut() view returns(address[])"]);async function H(u,r,d){if(N(r),I(d,!0),u.network==="testnet")throw new y("Pendle is available on chain 4663 only.");let e=u.clientFor(C),w=await e.getBlock(),t=w.number;s(await e.readContract({address:D[4663].pendle.marketFactory.address,abi:o,functionName:"isValidMarket",args:[r],blockNumber:t})===!0,"market is not verified by Pendle\u2019s factory");let[[c,m,O],p,h]=await Promise.all([e.readContract({address:r,abi:o,functionName:"readTokens",blockNumber:t}),e.readContract({address:r,abi:o,functionName:"expiry",blockNumber:t}),e.readContract({address:r,abi:o,functionName:"isExpired",blockNumber:t})]),[v,T]=await Promise.all([e.readContract({address:c,abi:o,functionName:"getTokensIn",blockNumber:t}),e.readContract({address:c,abi:o,functionName:"getTokensOut",blockNumber:t})]);s(v.some(n=>k(n,i)),"the earn cost comparison requires a USDG term"),s(T.some(n=>k(n,i)),"this term cannot cash out to USDG"),s(!h&&p>w.timestamp&&p<=BigInt(Number.MAX_SAFE_INTEGER),"this term has ended or its end date is unreadable");let l=n=>e.readContract({address:n,abi:U,functionName:"decimals",blockNumber:t}),[S,x,R]=await Promise.all([l(i),l(m),l(c)]),A={market:r,sy:c,pt:m,yt:O,expiry:Number(p),expired:h,kind:"stable",inputToken:i,inputSymbol:"USDG",inputDecimals:S,ptDecimals:x,syDecimals:R,tokensIn:[...v],tokensOut:[...T]},f=await g(u.http,{inputToken:i,outputToken:m,amount:d,wallet:b,slippageBps:50}),a=E(f.body,{market:A,wallet:b,amount:d,slippageBps:50});if(Math.abs(a.priceImpact)>.03)throw new y("This is a thin market and your size moves the price too much. Try a smaller amount.");return await M(e,A,"buy",d,a.amountOut,a.priceImpact),s(Date.now()-f.receivedAt>=0&&Date.now()-f.receivedAt<=3e4,"display quote is too old; try again"),{feeUsd:a.feeUsd,impactPct:Math.abs(a.priceImpact)*100,ptOutBase:a.amountOut}}export{H as a};
@@ -1 +1 @@
1
- import{c as ee}from"./ZQAFFWDK.js";import{a as B}from"./QHBS3PVU.js";import{a as q}from"./IOYRL6AY.js";import{c as J,d as X,j as Y,l as Z}from"./NWNYJ26T.js";import{a as w,i as G}from"./FWD4L3CJ.js";import{a as f}from"./XSD5NL7J.js";import{a as Q}from"./JXOEJPJ4.js";import{encodeAbiParameters as de,encodeFunctionData as N,erc20Abi as ne,keccak256 as ue,parseAbi as oe,zeroAddress as le}from"viem";var s=oe(["function launchFactory() view returns (address)","function curve() view returns (address)","function factory() view returns (address)","function feeEscrow() view returns (address)","function memeHook() view returns (address)","function buybackVault() view returns (address)","function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function balanceOf(address) view returns (uint256)","function balanceOfToken(address account,address token) view returns (uint256)","function quoteFeeBalance() view returns (uint256)","function creatorTaxBalance() view returns (uint256)","function pendingFees(bytes32,address) view returns (uint256)","function pendingCreatorTax(bytes32,address) view returns (uint256)","function releasable(address token) view returns (uint256)","function vestedAmount(address token) view returns (uint256)"]),h=oe(["function sweepFees(uint256 minBuybackTokensOut)","function sweepPoolFees(bytes32 poolId,uint256 minConversionQuoteOut,uint256 minBuybackTokensOut)","function claim()","function claimToken(address token)","function release(address token)","error InternalSwapRequiresOperator()"]),ae={address:B,chainId:w,symbol:"ETH",decimals:18},te=G[w].pons;function c(o){let d=Y(o,"Provide a valid Pons coin address.",X);return Z(d,"Provide a nonzero Pons coin or contract address.")}function pe(o){let d=new Set;for(;o&&typeof o=="object"&&!d.has(o)&&d.size<16;){d.add(o);let l=o;if(l.data==="0x31cdb504"||l.data&&typeof l.data=="object"&&l.data.errorName==="InternalSwapRequiresOperator")return!0;o=l.cause}return!1}async function fe(o,d,l,k=!1,t){let i=c(d),b=c(l),e=o.clientFor(w);if(t===void 0&&await e.getChainId()!==w)throw new f(`Pons claims require chain ${w}.`);let n=t??await e.getBlockNumber(),[R,se]=await Promise.all([e.readContract({address:i,abi:s,functionName:"launchFactory",blockNumber:n}),e.readContract({address:i,abi:s,functionName:"curve",blockNumber:n})]),P=c(te.factory.address);if(c(R)!==P)throw new f("The coin must belong to the pinned Pons factory.");let y=c(se),[r,re,ie]=await Promise.all([e.readContract({address:P,abi:s,functionName:"getLaunchedToken",args:[i],blockNumber:n}),e.readContract({address:y,abi:s,functionName:"factory",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"feeEscrow",blockNumber:n})]);if(!r.exists||c(r.token)!==i||c(r.curve)!==y||c(re)!==P)throw new f("The coin does not resolve to a consistent Pons launch.");if(r.phase<0||r.phase>3)throw new f("This Pons launch phase is unsupported.");let H=c(r.creatorFeeRecipient),A=H===b;if(k&&!A)throw new f("Only the current creator fee recipient can claim these fees. Use the recipient wallet or Safe.");let g=r.pairToken.toLowerCase(),S=g===le,m=c(ie),M=async a=>{let[u,p]=await Promise.all([e.readContract({address:a,abi:ne,functionName:"symbol",blockNumber:n}),e.readContract({address:a,abi:ne,functionName:"decimals",blockNumber:n})]);return{address:a,chainId:w,symbol:Q(u),decimals:p}},[v,T,_,j,$]=await Promise.all([M(i),S?ae:M(g),e.readContract({address:m,abi:s,functionName:"balanceOf",args:[b],blockNumber:n}),S?0n:e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,g],blockNumber:n}),e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,i],blockNumber:n})]),x=[],F=[],E,C=(a,u,p)=>o.unsignedTx({to:a,data:u,value:"0",chainId:w,description:p});if(r.phase===0){let[a,u]=await Promise.all([e.readContract({address:y,abi:s,functionName:"quoteFeeBalance",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"creatorTaxBalance",blockNumber:n})]);a+u>0n&&(F.push({token:T,amount:(a+u).toString()}),r.buybackEnabled?E="buyback":A&&(await e.simulateContract({address:y,abi:h,functionName:"sweepFees",args:[0n],account:b,gas:q,blockNumber:n}),x.push(C(y,N({abi:h,functionName:"sweepFees",args:[0n]}),`Sweep ${T.symbol} curve fees into the recipient escrow.`))))}else if(r.phase===2){let a=c(await e.readContract({address:P,abi:s,functionName:"memeHook",blockNumber:n})),u=ee(g,i,r.poolFee,r.tickSpacing),p=ue(de([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[u.currency0,u.currency1,r.poolFee,r.tickSpacing,a])),[V,z,W,U]=await Promise.all([e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,i],blockNumber:n})]);if(V+z>0n&&F.push({token:T,amount:(V+z).toString()}),W+U>0n&&F.push({token:v,amount:(W+U).toString()}),F.length)if(r.buybackEnabled)E="buyback";else if(A)try{await e.simulateContract({address:a,abi:h,functionName:"sweepPoolFees",args:[p,0n,0n],account:b,gas:q,blockNumber:n}),x.push(C(a,N({abi:h,functionName:"sweepPoolFees",args:[p,0n,0n]}),`Sweep ${T.symbol} pool fees into the recipient escrow.`))}catch(K){if(!pe(K))throw K;E="conversion"}else W+U>0n&&(E="conversion")}let I=0n,L=0n,D;if(r.buybackEnabled||$>0n||A){let a=c(await e.readContract({address:P,abi:s,functionName:"buybackVault",blockNumber:n}));if(a===c(te.buybackVault.address)){let[u,p,V]=await Promise.all([e.readContract({address:a,abi:s,functionName:"feeEscrow",blockNumber:n}),e.readContract({address:a,abi:s,functionName:"releasable",args:[i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"vestedAmount",args:[i],blockNumber:n})]);if(c(u)!==m)throw new f("The Pons buyback vault credits a different escrow than this coin.");[D,I,L]=[a,p,V]}else if(k)throw new f("The Pons factory reports a buyback vault outside the pinned deployment.")}let O=[...x];if(k){I>0n&&O.push(C(D,N({abi:h,functionName:"release",args:[i]}),`Release the vested ${v.symbol} buyback into the recipient escrow.`));let a=S&&x.length>0,u=!S&&x.length>0;(_>0n||a)&&O.push(C(m,N({abi:h,functionName:"claim"}),"Claim the caller\u2019s full native ETH escrow balance across all coins.")),(j>0n||u)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[g]}),`Claim the caller\u2019s full ${T.symbol} escrow balance across all coins.`)),($>0n||I>0n)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[i]}),`Claim the caller\u2019s released ${v.symbol} escrow balance.`))}let ce=[{token:ae,amount:_.toString()},...S?[]:[{token:T,amount:j.toString()}],{token:v,amount:$.toString()}];return{coin:v,pair:T,phase:r.phase,recipient:H,holder:b,isRecipient:A,escrow:m,blockNumber:n.toString(),credited:ce,pendingBeforeSweep:F,operatorWait:E,txs:O,buybackVest:{enabled:r.buybackEnabled,vault:D??null,releasable:{token:v,amount:I.toString()},vested:{token:v,amount:L.toString()},note:"Releasable is the gross vested amount; the release splits it with the Pons protocol before crediting the recipient escrow, and the preview shows the net claim."}}}function be(o){return o==="buyback"?"Buyback-enabled fee sweeps are not built here; pending fees await Pons\u2019s operator.":o==="conversion"?"Pending token-side conversion is awaiting Pons\u2019s keeper; the hook sweep was skipped.":""}async function me(o,d,l){if(!d||Object.keys(d).some(R=>R!=="token"))throw new f("Unsupported input. Provide only the Pons coin token address.");let k=c(d.token),t=await fe(o,k,c(l),!0),{txs:i}=t,b=await o.preview(i,l),e=t.credited[t.pair.address===B?0:1],n=[i.length?`Unsigned Pons fee claim prepared for the current recipient. Claims withdraw every ${t.pair.address===B?"native ETH":`native ETH and ${t.pair.symbol}`} balance owed to this wallet on this escrow across its coins.`:"No claim is available from this escrow.",be(t.operatorWait),BigInt(t.buybackVest.releasable.amount)>0n?`The buyback vest has ${t.buybackVest.releasable.amount} ${t.coin.symbol} base units releasable (gross); the release credits the escrow and the claim withdraws it.`:"","Pending amounts are pre-sweep fee and tax totals, not a guaranteed creator payout. Preview excludes gas. No transaction was sent."].filter(Boolean).join(" ");return{txs:i,summary:n,preview:b,claimable:e,credited:t.credited,pendingBeforeSweep:t.pendingBeforeSweep,waitingForKeeper:t.operatorWait!==void 0,operatorWait:t.operatorWait??null,buybackVest:t.buybackVest,recipient:t.recipient,escrow:t.escrow,phase:t.phase,blockNumber:t.blockNumber}}var Ne=o=>({tools:[{name:"pons_claim",inputSchema:{type:"object",additionalProperties:!1,required:["token"],properties:{token:{...J,description:"Pons coin address on chain 4663."}}},execute:async(d,l)=>{try{return await me(o,d,l)}catch(k){throw new f(o.plainError(k))}}}]});export{fe as a,be as b,Ne as c};
1
+ import{c as ee}from"./URBEK2VV.js";import{a as B}from"./Z7FGEWO2.js";import{a as q}from"./IOYRL6AY.js";import{c as J,d as X,j as Y,l as Z}from"./NWNYJ26T.js";import{b as w,j as G}from"./TI727O2H.js";import{a as f}from"./XSD5NL7J.js";import{a as Q}from"./JXOEJPJ4.js";import{encodeAbiParameters as de,encodeFunctionData as N,erc20Abi as ne,keccak256 as ue,parseAbi as oe,zeroAddress as le}from"viem";var s=oe(["function launchFactory() view returns (address)","function curve() view returns (address)","function factory() view returns (address)","function feeEscrow() view returns (address)","function memeHook() view returns (address)","function buybackVault() view returns (address)","function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function balanceOf(address) view returns (uint256)","function balanceOfToken(address account,address token) view returns (uint256)","function quoteFeeBalance() view returns (uint256)","function creatorTaxBalance() view returns (uint256)","function pendingFees(bytes32,address) view returns (uint256)","function pendingCreatorTax(bytes32,address) view returns (uint256)","function releasable(address token) view returns (uint256)","function vestedAmount(address token) view returns (uint256)"]),h=oe(["function sweepFees(uint256 minBuybackTokensOut)","function sweepPoolFees(bytes32 poolId,uint256 minConversionQuoteOut,uint256 minBuybackTokensOut)","function claim()","function claimToken(address token)","function release(address token)","error InternalSwapRequiresOperator()"]),ae={address:B,chainId:w,symbol:"ETH",decimals:18},te=G[w].pons;function c(o){let d=Y(o,"Provide a valid Pons coin address.",X);return Z(d,"Provide a nonzero Pons coin or contract address.")}function pe(o){let d=new Set;for(;o&&typeof o=="object"&&!d.has(o)&&d.size<16;){d.add(o);let l=o;if(l.data==="0x31cdb504"||l.data&&typeof l.data=="object"&&l.data.errorName==="InternalSwapRequiresOperator")return!0;o=l.cause}return!1}async function fe(o,d,l,k=!1,t){let i=c(d),b=c(l),e=o.clientFor(w);if(t===void 0&&await e.getChainId()!==w)throw new f(`Pons claims require chain ${w}.`);let n=t??await e.getBlockNumber(),[R,se]=await Promise.all([e.readContract({address:i,abi:s,functionName:"launchFactory",blockNumber:n}),e.readContract({address:i,abi:s,functionName:"curve",blockNumber:n})]),P=c(te.factory.address);if(c(R)!==P)throw new f("The coin must belong to the pinned Pons factory.");let y=c(se),[r,re,ie]=await Promise.all([e.readContract({address:P,abi:s,functionName:"getLaunchedToken",args:[i],blockNumber:n}),e.readContract({address:y,abi:s,functionName:"factory",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"feeEscrow",blockNumber:n})]);if(!r.exists||c(r.token)!==i||c(r.curve)!==y||c(re)!==P)throw new f("The coin does not resolve to a consistent Pons launch.");if(r.phase<0||r.phase>3)throw new f("This Pons launch phase is unsupported.");let H=c(r.creatorFeeRecipient),A=H===b;if(k&&!A)throw new f("Only the current creator fee recipient can claim these fees. Use the recipient wallet or Safe.");let g=r.pairToken.toLowerCase(),S=g===le,m=c(ie),M=async a=>{let[u,p]=await Promise.all([e.readContract({address:a,abi:ne,functionName:"symbol",blockNumber:n}),e.readContract({address:a,abi:ne,functionName:"decimals",blockNumber:n})]);return{address:a,chainId:w,symbol:Q(u),decimals:p}},[v,T,_,j,$]=await Promise.all([M(i),S?ae:M(g),e.readContract({address:m,abi:s,functionName:"balanceOf",args:[b],blockNumber:n}),S?0n:e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,g],blockNumber:n}),e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,i],blockNumber:n})]),x=[],F=[],E,C=(a,u,p)=>o.unsignedTx({to:a,data:u,value:"0",chainId:w,description:p});if(r.phase===0){let[a,u]=await Promise.all([e.readContract({address:y,abi:s,functionName:"quoteFeeBalance",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"creatorTaxBalance",blockNumber:n})]);a+u>0n&&(F.push({token:T,amount:(a+u).toString()}),r.buybackEnabled?E="buyback":A&&(await e.simulateContract({address:y,abi:h,functionName:"sweepFees",args:[0n],account:b,gas:q,blockNumber:n}),x.push(C(y,N({abi:h,functionName:"sweepFees",args:[0n]}),`Sweep ${T.symbol} curve fees into the recipient escrow.`))))}else if(r.phase===2){let a=c(await e.readContract({address:P,abi:s,functionName:"memeHook",blockNumber:n})),u=ee(g,i,r.poolFee,r.tickSpacing),p=ue(de([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[u.currency0,u.currency1,r.poolFee,r.tickSpacing,a])),[V,z,W,U]=await Promise.all([e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,i],blockNumber:n})]);if(V+z>0n&&F.push({token:T,amount:(V+z).toString()}),W+U>0n&&F.push({token:v,amount:(W+U).toString()}),F.length)if(r.buybackEnabled)E="buyback";else if(A)try{await e.simulateContract({address:a,abi:h,functionName:"sweepPoolFees",args:[p,0n,0n],account:b,gas:q,blockNumber:n}),x.push(C(a,N({abi:h,functionName:"sweepPoolFees",args:[p,0n,0n]}),`Sweep ${T.symbol} pool fees into the recipient escrow.`))}catch(K){if(!pe(K))throw K;E="conversion"}else W+U>0n&&(E="conversion")}let I=0n,L=0n,D;if(r.buybackEnabled||$>0n||A){let a=c(await e.readContract({address:P,abi:s,functionName:"buybackVault",blockNumber:n}));if(a===c(te.buybackVault.address)){let[u,p,V]=await Promise.all([e.readContract({address:a,abi:s,functionName:"feeEscrow",blockNumber:n}),e.readContract({address:a,abi:s,functionName:"releasable",args:[i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"vestedAmount",args:[i],blockNumber:n})]);if(c(u)!==m)throw new f("The Pons buyback vault credits a different escrow than this coin.");[D,I,L]=[a,p,V]}else if(k)throw new f("The Pons factory reports a buyback vault outside the pinned deployment.")}let O=[...x];if(k){I>0n&&O.push(C(D,N({abi:h,functionName:"release",args:[i]}),`Release the vested ${v.symbol} buyback into the recipient escrow.`));let a=S&&x.length>0,u=!S&&x.length>0;(_>0n||a)&&O.push(C(m,N({abi:h,functionName:"claim"}),"Claim the caller\u2019s full native ETH escrow balance across all coins.")),(j>0n||u)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[g]}),`Claim the caller\u2019s full ${T.symbol} escrow balance across all coins.`)),($>0n||I>0n)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[i]}),`Claim the caller\u2019s released ${v.symbol} escrow balance.`))}let ce=[{token:ae,amount:_.toString()},...S?[]:[{token:T,amount:j.toString()}],{token:v,amount:$.toString()}];return{coin:v,pair:T,phase:r.phase,recipient:H,holder:b,isRecipient:A,escrow:m,blockNumber:n.toString(),credited:ce,pendingBeforeSweep:F,operatorWait:E,txs:O,buybackVest:{enabled:r.buybackEnabled,vault:D??null,releasable:{token:v,amount:I.toString()},vested:{token:v,amount:L.toString()},note:"Releasable is the gross vested amount; the release splits it with the Pons protocol before crediting the recipient escrow, and the preview shows the net claim."}}}function be(o){return o==="buyback"?"Buyback-enabled fee sweeps are not built here; pending fees await Pons\u2019s operator.":o==="conversion"?"Pending token-side conversion is awaiting Pons\u2019s keeper; the hook sweep was skipped.":""}async function me(o,d,l){if(!d||Object.keys(d).some(R=>R!=="token"))throw new f("Unsupported input. Provide only the Pons coin token address.");let k=c(d.token),t=await fe(o,k,c(l),!0),{txs:i}=t,b=await o.preview(i,l),e=t.credited[t.pair.address===B?0:1],n=[i.length?`Unsigned Pons fee claim prepared for the current recipient. Claims withdraw every ${t.pair.address===B?"native ETH":`native ETH and ${t.pair.symbol}`} balance owed to this wallet on this escrow across its coins.`:"No claim is available from this escrow.",be(t.operatorWait),BigInt(t.buybackVest.releasable.amount)>0n?`The buyback vest has ${t.buybackVest.releasable.amount} ${t.coin.symbol} base units releasable (gross); the release credits the escrow and the claim withdraws it.`:"","Pending amounts are pre-sweep fee and tax totals, not a guaranteed creator payout. Preview excludes gas. No transaction was sent."].filter(Boolean).join(" ");return{txs:i,summary:n,preview:b,claimable:e,credited:t.credited,pendingBeforeSweep:t.pendingBeforeSweep,waitingForKeeper:t.operatorWait!==void 0,operatorWait:t.operatorWait??null,buybackVest:t.buybackVest,recipient:t.recipient,escrow:t.escrow,phase:t.phase,blockNumber:t.blockNumber}}var Ne=o=>({tools:[{name:"pons_claim",inputSchema:{type:"object",additionalProperties:!1,required:["token"],properties:{token:{...J,description:"Pons coin address on chain 4663."}}},execute:async(d,l)=>{try{return await me(o,d,l)}catch(k){throw new f(o.plainError(k))}}}]});export{fe as a,be as b,Ne as c};
@@ -1 +1 @@
1
- import{b as s}from"./MQK6OP7S.js";import{a as p}from"./LT5P6PZW.js";import{a as u}from"./QHBS3PVU.js";import{f as a}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{erc20Abi as f,getAddress as i,parseAbi as g,zeroAddress as b}from"viem";var w={type:"string",pattern:"^(0|[1-9][0-9]*)$",maxLength:78},O={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R={blockNumber:{...w,description:"Optional named chain-4663 block; defaults to the head captured once for this read."}},T=g(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),k=p;function B(e,n,t=[]){let o=a(e,"Provide the documented Hookr object.");if(Object.keys(o).some(d=>!n.includes(d))||t.some(d=>!Object.hasOwn(o,d)))throw new r("Provide exactly the documented Hookr fields; wallet overrides are not accepted.");return o}function l(e,n=256){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<BigInt(n))throw new r(`Provide a decimal integer string within uint${n}.`);return BigInt(e)}function N(e){return e.blockNumber===void 0?void 0:l(e.blockNumber,64)}function S(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r("Provide an exact bytes32 Hookr ID.");return e.toLowerCase()}function $(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e)||i(e)!==e)throw new r("Provide an EIP-55 checksummed address.");return i(e)}function y(e,n=256){if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new r("Hookr integer read is incomplete. Retry the named-block read.");let t=BigInt(e);if(t<0n||t>=1n<<BigInt(n))throw new r("Hookr integer read is outside its ABI bounds.");return t}function E(e){if(typeof e!="boolean")throw new r("Hookr boolean read is incomplete.");return e}function j(e,n){if(!Array.isArray(e)||e.length!==n)throw new r("Hookr tuple read is incomplete.");return e}var C=e=>a(e,"Hookr struct read is incomplete.");function F(e){return JSON.parse(JSON.stringify(e,(n,t)=>typeof t=="bigint"||typeof t=="number"?String(t):t))}function V(e){return k[e].abi}function m(e,n,t,o,d,c){return e.readContract({address:n,abi:t,functionName:o,args:d,blockNumber:c})}var L=i(s.rootV1),_=i(s.registry),D=i(s.poolManager),J=i(s.agentGateV1);function K(e){if(e===i(s.rulesV1))return"rulesV1";if(e===i(s.rulesPrevious))return"rules";if(e===i(s.rulesLegacy))return"rulesLegacy";throw new r("Unknown Hookr core deployment. Review and pin it before reading this position.")}async function U(e,n,t){if(n===b)return{address:u,symbol:"ETH",decimals:18,chainId:4663};let[o,d]=await Promise.all([m(e,n,f,"symbol",[],t),m(e,n,f,"decimals",[],t)]),c=y(d,8);if(typeof o!="string"||o.length===0||new TextEncoder().encode(o).length>128)throw new r("Hookr token metadata is incomplete. Retry before valuing this currency.");return{address:n,symbol:o,decimals:Number(c),chainId:4663}}export{w as a,O as b,R as c,T as d,B as e,l as f,N as g,S as h,$ as i,y as j,E as k,j as l,C as m,F as n,V as o,m as p,L as q,_ as r,D as s,J as t,K as u,U as v};
1
+ import{b as s}from"./MQK6OP7S.js";import{a as p}from"./LT5P6PZW.js";import{a as u}from"./Z7FGEWO2.js";import{f as a}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{erc20Abi as f,getAddress as i,parseAbi as g,zeroAddress as b}from"viem";var w={type:"string",pattern:"^(0|[1-9][0-9]*)$",maxLength:78},O={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R={blockNumber:{...w,description:"Optional named chain-4663 block; defaults to the head captured once for this read."}},T=g(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),k=p;function B(e,n,t=[]){let o=a(e,"Provide the documented Hookr object.");if(Object.keys(o).some(d=>!n.includes(d))||t.some(d=>!Object.hasOwn(o,d)))throw new r("Provide exactly the documented Hookr fields; wallet overrides are not accepted.");return o}function l(e,n=256){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<BigInt(n))throw new r(`Provide a decimal integer string within uint${n}.`);return BigInt(e)}function N(e){return e.blockNumber===void 0?void 0:l(e.blockNumber,64)}function S(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r("Provide an exact bytes32 Hookr ID.");return e.toLowerCase()}function $(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e)||i(e)!==e)throw new r("Provide an EIP-55 checksummed address.");return i(e)}function y(e,n=256){if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new r("Hookr integer read is incomplete. Retry the named-block read.");let t=BigInt(e);if(t<0n||t>=1n<<BigInt(n))throw new r("Hookr integer read is outside its ABI bounds.");return t}function E(e){if(typeof e!="boolean")throw new r("Hookr boolean read is incomplete.");return e}function j(e,n){if(!Array.isArray(e)||e.length!==n)throw new r("Hookr tuple read is incomplete.");return e}var C=e=>a(e,"Hookr struct read is incomplete.");function F(e){return JSON.parse(JSON.stringify(e,(n,t)=>typeof t=="bigint"||typeof t=="number"?String(t):t))}function V(e){return k[e].abi}function m(e,n,t,o,d,c){return e.readContract({address:n,abi:t,functionName:o,args:d,blockNumber:c})}var L=i(s.rootV1),_=i(s.registry),D=i(s.poolManager),J=i(s.agentGateV1);function K(e){if(e===i(s.rulesV1))return"rulesV1";if(e===i(s.rulesPrevious))return"rules";if(e===i(s.rulesLegacy))return"rulesLegacy";throw new r("Unknown Hookr core deployment. Review and pin it before reading this position.")}async function U(e,n,t){if(n===b)return{address:u,symbol:"ETH",decimals:18,chainId:4663};let[o,d]=await Promise.all([m(e,n,f,"symbol",[],t),m(e,n,f,"decimals",[],t)]),c=y(d,8);if(typeof o!="string"||o.length===0||new TextEncoder().encode(o).length>128)throw new r("Hookr token metadata is incomplete. Retry before valuing this currency.");return{address:n,symbol:o,decimals:Number(c),chainId:4663}}export{w as a,O as b,R as c,T as d,B as e,l as f,N as g,S as h,$ as i,y as j,E as k,j as l,C as m,F as n,V as o,m as p,L as q,_ as r,D as s,J as t,K as u,U as v};
@@ -0,0 +1 @@
1
+ import{a as m}from"./TVIMP5CK.js";import{d as g}from"./M7U3A4EH.js";import{e as d}from"./NWNYJ26T.js";import{a as f}from"./XSD5NL7J.js";import{createHash as b}from"node:crypto";var p=32768,T="wormhole-x402@0.11.0/603aba277a626630d9b9463f713121dc4327325c";function j(r){if(!d(r)||Object.keys(r).length!==1||typeof r.text!="string")throw new f("Provide only text as a string for the local Wormhole scan.");let o=r.text,x=o.length>p||Buffer.byteLength(o,"utf8")>p,h={local:!0,scannerVersion:T,attribution:{provider:"Agent Wormhole",source:"https://github.com/runningoffcode/agent-wormhole"},limitation:"Evadable English instruction-shape rules. Allow is not proof of safety, intent, or coverage of unknown attacks."};if(x)return{...h,decision:"abstain",codes:[],findings:[],scannedPaths:[],charsScanned:0,inputHash:null,reason:"Text exceeds the 32768-byte local scan limit; no text was scanned or hashed."};let w=b("sha256").update(o,"utf8").digest("hex"),y={maxFieldChars:p,maxDecodeDepth:3,maxDepth:12},a=t=>{try{return g(t,y)}catch{return{decision:"abstain",findings:[],scanned:[],charsScanned:0}}},n=[{path:"text",verdict:a(o)}],c=[],l=t=>{let e=m(t);e!==void 0&&c.push(e)};l(o);try{let t=JSON.parse(o);if(typeof t=="string"||d(t)||Array.isArray(t)){n.push({path:"text.json",verdict:a(t)});let e=[t];for(;e.length;){let s=e.pop();if(typeof s=="string")l(s);else if(s!==null&&typeof s=="object")for(let v of Object.values(s))e.push(v)}}}catch{}c.length&&n.push({path:"text.unwrapped",verdict:a(c)});let i=n.flatMap(t=>t.verdict.findings.map(e=>({code:e.code,severity:e.severity,path:t.path,offset:e.offset}))),u=n.some(t=>t.verdict.decision==="refuse")?"refuse":n.some(t=>t.verdict.decision==="abstain")?"abstain":"allow";return{...h,decision:u,codes:[...new Set(i.map(t=>t.code))],findings:i.slice(0,64),findingsTruncated:i.length>64,scannedPaths:n.filter(t=>t.verdict.scanned.length).map(t=>t.path),charsScanned:n.reduce((t,e)=>t+e.verdict.charsScanned,0),inputHash:w,...u==="abstain"?{reason:"The local scanner could not cover all supplied text. Treat the result as unknown."}:{}}}export{p as a,T as b,j as c};
@@ -0,0 +1 @@
1
+ import{e as f}from"./K4P5VYDP.js";import{c as k}from"./SCG5HWMN.js";import{a as u}from"./66F5ZH34.js";import{i as p}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var _="hoodlock_public",r="https://hoodlock.tech",h=["lp_locks","lp_lock","airdrop_history","airdrop_list","airdrop_list_by_root","featured","feature_tiers","buyback_status","referral_available","links"];function v(c){return{tools:[{name:_,inputSchema:{type:"object",properties:{route:{type:"string",enum:[...h],description:"Public HoodLock page to read: LP lock list or one lock, airdrop history or list, featured and feature tiers, buyback status, referral code check, or links."},id:u("Record id as a decimal string, for lp_lock, airdrop_list and links."),account:{type:"string",description:"Wallet address for airdrop_history. Defaults to the connected wallet."},token:{type:"string",description:"Token address, for the links route to build its token page link."},root:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Airdrop Merkle root as 0x followed by 64 hex digits, for airdrop_list_by_root."},code:{type:"string",minLength:1,maxLength:64,description:"Referral code to check, for referral_available."}},required:["route"],additionalProperties:!1},async execute(e,b){try{let a=String(e.route);if(!h.includes(a))throw new i("Choose a published HoodLock public read route.");let m=e.account??b,s=t=>p(t,"Provide a checksummed wallet or token address."),n=()=>f(e.id,"id").toString(),o;switch(a){case"links":{let t=e.id===void 0?void 0:n();return{source:r,links:{lockChecker:`${r}/lock-checker`,liquidityChecker:`${r}/liquidity-lock-checker`,burnChecker:`${r}/burn-checker`,vestingChecker:`${r}/vesting-checker`,embedDocs:`${r}/docs/embed`,badgeDocs:`${r}/docs/badge`,...e.token===void 0?{}:{token:`${r}/token/${s(e.token)}`},...t===void 0?{}:Object.fromEntries(["lock","burn","vesting","position"].map(l=>[l,`${r}/proof/${l}/${t}`]))},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/${n()}`;break;case"airdrop_history":o=`/api/airdrop/history?address=${s(m)}`;break;case"airdrop_list":o=`/api/airdrop/${n()}/list.json`;break;case"airdrop_list_by_root":if(typeof e.root!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.root))throw new i("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 i("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=`${r}${o}`,y=await k(c.http,d,{method:"GET",redirect:"error",signal:AbortSignal.timeout(1e4)},t=>t!==null&&typeof t=="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(a){throw new i(c.plainError(a))}}}]}}export{_ as a,v as b};
@@ -0,0 +1 @@
1
+ import{a as g,b as p}from"./2OVJ2BTJ.js";import{a as y,b as D,c as m,d as T,e as I}from"./GQITAJVF.js";import{c as O,d as A,f as P,g as R}from"./OUROA7XR.js";import{b as k,c as x}from"./43LI5NKJ.js";import{b}from"./TI727O2H.js";import{a as f}from"./XSD5NL7J.js";import{encodeFunctionData as C,zeroAddress as N}from"viem";function v(t=10){if(!Number.isInteger(t)||t<0||t>50)throw new f("Oak won't accept a cash-out reduction that big. Use a whole number from 0 to 50 bps (0.5%).");return t}async function z(t,e,a,u=10,r){let l=v(u);p(a,!0),m(e.tokensOut.some(n=>T(n,e.inputToken)),"the market input token cannot be redeemed from SY");try{let n=await t.client.getBlock();m(e.expired&&n.timestamp>=BigInt(e.expiry),"this term has not ended; wait for its end date");let h=p((await t.client.simulateContract({address:e.yt,abi:g,functionName:"pyIndexCurrent",blockNumber:n.number})).result,!0);for(let o of[e.syDecimals,e.ptDecimals])m(Number.isInteger(o)&&o>=0&&o<=77,"unreadable token decimals");let d=a*10n**18n*10n**BigInt(e.syDecimals)/(h*10n**BigInt(e.ptDecimals));p(d,!0);let i=p(await t.client.readContract({address:e.sy,abi:g,functionName:"previewRedeem",args:[e.inputToken,d],blockNumber:n.number}),!0),s=I(i,l);if(m(s>0n,"this cash-out amount is too small"),r&&(r.apiAmountOut>i?r.apiAmountOut-i:i-r.apiAmountOut)*10000n>i*50n)try{r.note("Pendle\u2019s API cash-out estimate differs from the chain by over 0.5%. Oak kept the chain estimate.")}catch{}let c={tokenOut:e.inputToken,minTokenOut:s,tokenRedeemSy:e.inputToken,pendleSwap:N,swapData:{swapType:0,extRouter:N,extCalldata:"0x",needScale:!1}},w=k({to:y,data:C({abi:D,functionName:"redeemPyToToken",args:[t.wallet,e.yt,a,c]}),value:"0",chainId:b,description:"Cash out ended Pendle PT to its input token."});return{txs:[x(e.pt,y,a.toString(),b),w],expected:i,minOut:s,summary:"Approve the exact PT amount, then cash out the ended term to its input token."}}catch(n){throw n instanceof f?n:new f("Oak could not read the Pendle cash-out amount from the chain. Try again.")}}async function F(t,e,a,u,r){let l=new AbortController,n;try{let h=new Promise(o=>{n=setTimeout(()=>{l.abort(),o(void 0)},1500)}),d=await Promise.race([R((o,B)=>t.http(o,{...B,signal:l.signal}),{inputToken:e.pt,outputToken:e.inputToken,amount:a,wallet:t.wallet,slippageBps:r}),h]);if(!d)return;let i=P(d.body).outputs;if(i.length!==1)return;let s=O(i[0]);if(!T(s.token,e.inputToken))return;let c=A(s.amount);return(c>u?c-u:u-c)*10000n>u*50n?"Pendle\u2019s API cash-out estimate differs from the chain by over 0.5%. Oak kept the chain estimate.":void 0}catch{return}finally{n!==void 0&&clearTimeout(n)}}export{v as a,z as b,F as c};
@@ -1 +1 @@
1
- import{g as u}from"./NWNYJ26T.js";import{a as o,i as d}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as g,keccak256 as b,parseAbi as f,zeroAddress as h}from"viem";var p=d[o].pons,w=f(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function memeHook() view returns (address)"]),l=f(["function factory() view returns (address)","function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)"]),v=f(["function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]);async function A(t,r,n){if(t.chainId!==o||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new s("No supported Pons reference price on this chain or for these token decimals.");let e=await r.readContract({address:p.factory.address,abi:w,functionName:"getLaunchedToken",args:[t.address],blockNumber:n});if(!e.exists||!u(e.token,t.address)||e.pairToken.toLowerCase()!==h)throw new s("No supported native-ETH Pons launch reference price.");let m=10n**BigInt(t.decimals);if(e.phase===0){let[c,[a,i]]=await Promise.all([r.readContract({address:e.curve,abi:l,functionName:"factory",blockNumber:n}),r.readContract({address:e.curve,abi:l,functionName:"getReserves",blockNumber:n})]);if(!u(c,p.factory.address)||a<=0n||i<=0n)throw new s("The Pons curve reference price is unavailable.");return{numerator:a*m,denominator:i*10n**18n}}if(e.phase===2){let c=await r.readContract({address:p.factory.address,abi:w,functionName:"memeHook",blockNumber:n}),a=b(g([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[h,t.address,e.poolFee,e.tickSpacing,c])),[i,y]=await Promise.all([r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getSlot0",args:[a],blockNumber:n}),r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getLiquidity",args:[a],blockNumber:n})]);if(i[0]<=0n||y<=0n)throw new s("The graduated Pons pool reference price is unavailable.");return{numerator:(1n<<192n)*m,denominator:i[0]**2n*10n**18n}}throw new s("The Pons launch has no active reference price in this phase.")}export{A as a};
1
+ import{g as u}from"./NWNYJ26T.js";import{b as o,j as d}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as g,keccak256 as b,parseAbi as f,zeroAddress as h}from"viem";var p=d[o].pons,w=f(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function memeHook() view returns (address)"]),l=f(["function factory() view returns (address)","function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)"]),v=f(["function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]);async function A(t,r,n){if(t.chainId!==o||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new s("No supported Pons reference price on this chain or for these token decimals.");let e=await r.readContract({address:p.factory.address,abi:w,functionName:"getLaunchedToken",args:[t.address],blockNumber:n});if(!e.exists||!u(e.token,t.address)||e.pairToken.toLowerCase()!==h)throw new s("No supported native-ETH Pons launch reference price.");let m=10n**BigInt(t.decimals);if(e.phase===0){let[c,[a,i]]=await Promise.all([r.readContract({address:e.curve,abi:l,functionName:"factory",blockNumber:n}),r.readContract({address:e.curve,abi:l,functionName:"getReserves",blockNumber:n})]);if(!u(c,p.factory.address)||a<=0n||i<=0n)throw new s("The Pons curve reference price is unavailable.");return{numerator:a*m,denominator:i*10n**18n}}if(e.phase===2){let c=await r.readContract({address:p.factory.address,abi:w,functionName:"memeHook",blockNumber:n}),a=b(g([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[h,t.address,e.poolFee,e.tickSpacing,c])),[i,y]=await Promise.all([r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getSlot0",args:[a],blockNumber:n}),r.readContract({address:d[o].ponsTrade.state_view.address,abi:v,functionName:"getLiquidity",args:[a],blockNumber:n})]);if(i[0]<=0n||y<=0n)throw new s("The graduated Pons pool reference price is unavailable.");return{numerator:(1n<<192n)*m,denominator:i[0]**2n*10n**18n}}throw new s("The Pons launch has no active reference price in this phase.")}export{A as a};
@@ -0,0 +1 @@
1
+ import{a as R,c as I}from"./SCG5HWMN.js";import{d as g,e as A,f as b,j as x}from"./NWNYJ26T.js";import{a}from"./XSD5NL7J.js";import{a as y}from"./JXOEJPJ4.js";import{erc20Abi as D,parseAbi as P}from"viem";var T="https://api.relay.link",C="0x0000000000000000000000000000000000000000",d=Object.freeze({recipient:"0x856bb126188bDB5e425D3ac9D59E9ffBD12e6ECf",bps:25});function F(e){return{...i(e),includeProtocolData:!0,appFees:[{recipient:d.recipient,fee:String(d.bps)}]}}function f(){throw new a("Relay did not confirm the Oak fee of 0.25% to the treasury with matching amount and recipient. Request a fresh quote.")}function _(e){try{let n=i(e),r=l(i(n.details).currencyIn),t=i(i(n.fees).app),o=l(t),u=(BigInt(r.amount)*BigInt(d.bps)/10000n).toString();if((o.amount!==u||h(t.minimumAmount)!==u||o.token.address!==r.token.address||o.token.chainId!==r.token.chainId||o.token.decimals!==r.token.decimals||typeof t.amountUsd!="string"||!/^(0|[1-9]\d*)(?:\.\d+)?$/.test(t.amountUsd)||t.amountUsd.length>100)&&f(),(t.recipient!==void 0&&m(t.recipient)!==d.recipient.toLowerCase()||t.fee!==void 0&&t.fee!==String(d.bps))&&f(),n.appFees!==void 0){let p=w(n.appFees);(p.length!==1||m(i(p[0]).recipient)!==d.recipient.toLowerCase()||i(p[0]).fee!==String(d.bps))&&f()}let s=i(i(n.protocol).v2),c=w(i(s.orderData).fees);if(c.length>1&&f(),c.length===1){let p=i(c[0]),k=i(s.paymentDetails).chainId;(typeof k!="string"||p.currencyChainId!==k||typeof p.recipientChainId!="string"||m(p.recipient)!==d.recipient.toLowerCase()||m(p.currency)!==r.token.address||h(p.amount)!==u)&&f()}return{...o,recipient:d.recipient,bps:d.bps,amountUsd:t.amountUsd}}catch{return f()}}function $(e){return`Oak fee ${d.bps/100}% (\u2248 $${e.amountUsd})`}function z(e){let n=i(e),r=i(n.app),t={...l(r),recipient:d.recipient,bps:d.bps,amountUsd:String(r.amountUsd)};(!/^(0|[1-9]\d*)(?:\.\d+)?$/.test(t.amountUsd)||t.amountUsd.length>100)&&f();let o=l(n.relayer);return{oakFee:t,feeDisclosure:`Relay fee ${o.amount} base units of ${L(o.token.symbol)}; ${$(t)}. Output is already net of quoted fees; origin gas is separate.`}}var j=P(["function depositNative(address depositor, bytes32 id) payable","function depositErc20(address depositor, address token, uint256 amount, bytes32 id)"]),E=(1n<<256n)-1n;function i(e){return b(e,"Relay returned an unexpected response.")}function w(e){if(!Array.isArray(e))throw new a("Relay returned an unexpected list.");return e}function m(e){return x(e,"Provide a valid wallet or token address.",g)}function H(e){let n=m(e);return n==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"?C:n}function q(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new a("Provide a positive integer chain ID.");return e}function h(e){if(typeof e!="string"||!/^(0|[1-9]\d*)$/.test(e)||BigInt(e)>E)throw new a("Amounts must be decimal base-unit strings within the uint256 range.");return e}function J(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new a("Relay returned an invalid order or refund deadline. Request a fresh quote.");return e}function U(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new a("Provide a valid Relay request or order ID.");return e}function S(e){let n=i(e);if(typeof n.symbol!="string"||!n.symbol.trim()||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)throw new a("Relay returned invalid token metadata.");return{address:m(n.address),chainId:q(n.chainId),decimals:n.decimals,symbol:n.symbol}}function l(e){let n=i(e);return{token:S(n.currency),amount:h(n.amount)}}function K(e){if(!e)throw new a("Relay quote does not match the requested amount, chain, recipient, minimum or transaction.")}function v(e){return e===void 0?[]:w(e).map(U)}function Q(e){if(!(e==null||e==="N/A")){if(typeof e!="string")throw new a("Relay returned an invalid failure reason.");return y(e)}}function L(e,n="symbol"){if(!(typeof e!="string"||!e.trim()))return(n==="symbol"?/^[A-Za-z0-9._-]{1,32}$/:/^[A-Za-z0-9 ()+-]{1,32}$/).test(e)?e:y(e)}async function Z(e,n,r,t,o,u){let s=await e.clientFor(o).readContract({address:n,abi:D,functionName:"allowance",args:[u,r]});if(typeof s!="bigint"||s<0n||s>E)throw new a("Could not read the Relay token allowance.");return[...s>0n?[e.approval(n,r,"0",o)]:[],e.approval(n,r,t,o)]}function G(e){return async(n,r)=>i(await N(e)(n,r))}function N(e){return async(n,r)=>{let t=n.split("?")[0],o=t==="/quote/v2";try{let u=await I(e.http,`${T}${n}`,{method:o||r!==void 0?"POST":"GET",headers:{"Content-Type":"application/json","User-Agent":"oak-relay/1.0"},...r===void 0&&!o?{}:{body:JSON.stringify(o?F(r):r)}},s=>A(s)||Array.isArray(s));return o&&_(u),u}catch(u){let s=u instanceof R?u.response.status:void 0,c=e.plainError(u);throw s===401||s===403||/HTTP (401|403)\b/.test(c)?new a("Relay requires an authorized API key for this endpoint. Ask the operator to configure a valid OAK_RELAY_API_KEY on the server with access to this resource; never pass keys in tool arguments."):t==="/prices/rates"&&(s!==void 0&&s>=500||/HTTP 5\d\d\b/.test(c))?new a("Relay exchange rates are unavailable because the upstream service failed. Retry later; no rates were returned. Use relay_token_price with chainId and address for an individual token."):new a(c)}}}export{T as a,C as b,d as c,F as d,_ as e,$ as f,z as g,j as h,i,w as j,m as k,H as l,q as m,h as n,J as o,U as p,S as q,l as r,K as s,v as t,Q as u,L as v,Z as w,G as x,N as y};