@oakagentkit/core 0.3.6 → 0.3.7

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 (195) hide show
  1. package/build/dist/api/history.js +1 -1
  2. package/build/dist/api/modules/borro/index.js +1 -1
  3. package/build/dist/api/modules/borro/positions.js +1 -1
  4. package/build/dist/api/modules/borro/reader.js +1 -1
  5. package/build/dist/api/modules/chop/display.js +1 -1
  6. package/build/dist/api/modules/chop/index.js +1 -1
  7. package/build/dist/api/modules/earn/index.js +1 -1
  8. package/build/dist/api/modules/erc8004/index.js +1 -1
  9. package/build/dist/api/modules/grove/index.js +1 -1
  10. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  11. package/build/dist/api/modules/hoodlock/fee.js +1 -1
  12. package/build/dist/api/modules/hoodlock/guard.js +1 -1
  13. package/build/dist/api/modules/hoodlock/index.js +1 -1
  14. package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
  15. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  16. package/build/dist/api/modules/hoodlock/public.js +1 -1
  17. package/build/dist/api/modules/hookr/actions.js +1 -1
  18. package/build/dist/api/modules/hookr/agent-gate.js +1 -1
  19. package/build/dist/api/modules/hookr/blocks/pay-later.js +1 -1
  20. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  21. package/build/dist/api/modules/hookr/discovery.js +1 -1
  22. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  23. package/build/dist/api/modules/hookr/hook-blocks.js +1 -1
  24. package/build/dist/api/modules/hookr/index.js +1 -1
  25. package/build/dist/api/modules/hookr/launch-options.js +1 -1
  26. package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
  27. package/build/dist/api/modules/hookr/launch.js +1 -1
  28. package/build/dist/api/modules/hookr/liquidity.js +1 -1
  29. package/build/dist/api/modules/hookr/lp-positions.js +1 -1
  30. package/build/dist/api/modules/hookr/lp-reads.js +1 -1
  31. package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
  32. package/build/dist/api/modules/hookr/lp-state.js +1 -1
  33. package/build/dist/api/modules/hookr/pay-later-actions.js +1 -1
  34. package/build/dist/api/modules/hookr/pm-liquidity.js +1 -1
  35. package/build/dist/api/modules/hookr/relay.js +1 -1
  36. package/build/dist/api/modules/layerbank/actions.js +1 -1
  37. package/build/dist/api/modules/layerbank/index.js +1 -1
  38. package/build/dist/api/modules/layerbank/reader.js +1 -1
  39. package/build/dist/api/modules/longbow/administration.js +1 -1
  40. package/build/dist/api/modules/longbow/fixed.js +1 -1
  41. package/build/dist/api/modules/longbow/index.js +1 -1
  42. package/build/dist/api/modules/meridian/index.js +1 -1
  43. package/build/dist/api/modules/merkl/discovery.js +1 -1
  44. package/build/dist/api/modules/merkl/index.js +1 -1
  45. package/build/dist/api/modules/merkl/manage.js +1 -1
  46. package/build/dist/api/modules/merkl/stock-lp.d.ts +51 -0
  47. package/build/dist/api/modules/merkl/stock-lp.js +1 -0
  48. package/build/dist/api/modules/morpho/bundles.js +1 -1
  49. package/build/dist/api/modules/morpho/in-kind.js +1 -1
  50. package/build/dist/api/modules/morpho/index.js +1 -1
  51. package/build/dist/api/modules/morpho/local-guard.js +1 -1
  52. package/build/dist/api/modules/morpho/midnight.js +1 -1
  53. package/build/dist/api/modules/morpho/protocol.js +1 -1
  54. package/build/dist/api/modules/morpho/vault-tools.js +1 -1
  55. package/build/dist/api/modules/netnet/card-plan.js +1 -1
  56. package/build/dist/api/modules/netnet/card-read.js +1 -1
  57. package/build/dist/api/modules/netnet/card-recovery.js +1 -1
  58. package/build/dist/api/modules/netnet/desk-action.js +1 -1
  59. package/build/dist/api/modules/netnet/financial.js +1 -1
  60. package/build/dist/api/modules/netnet/index.js +1 -1
  61. package/build/dist/api/modules/pendle/index.js +1 -1
  62. package/build/dist/api/modules/pendle/reader.js +1 -1
  63. package/build/dist/api/modules/pendle/trade.js +1 -1
  64. package/build/dist/api/modules/priors/coverage.js +1 -1
  65. package/build/dist/api/modules/priors/discovery.js +1 -1
  66. package/build/dist/api/modules/priors/index.js +1 -1
  67. package/build/dist/api/modules/priors/integration.js +1 -1
  68. package/build/dist/api/modules/priors/stock-swap.js +1 -1
  69. package/build/dist/api/modules/raeto/index.js +1 -1
  70. package/build/dist/api/modules/relay/index.js +1 -1
  71. package/build/dist/api/modules/steakhouse/index.js +1 -1
  72. package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
  73. package/build/dist/api/modules/steakhouse/management.js +1 -1
  74. package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
  75. package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
  76. package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
  77. package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
  78. package/build/dist/api/modules/tickerspring/guards.js +1 -1
  79. package/build/dist/api/modules/tickerspring/index.js +1 -1
  80. package/build/dist/api/modules/tickerspring/journeys.js +1 -1
  81. package/build/dist/api/modules/tickerspring/ladder.js +1 -1
  82. package/build/dist/api/modules/tickerspring/maker.js +1 -1
  83. package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
  84. package/build/dist/api/modules/tickerspring/research.js +1 -1
  85. package/build/dist/api/modules/tickerspring/strategies.js +1 -1
  86. package/build/dist/api/modules/uniswap/auction-create.js +1 -1
  87. package/build/dist/api/modules/uniswap/auction.js +1 -1
  88. package/build/dist/api/modules/uniswap/batch.js +1 -1
  89. package/build/dist/api/modules/uniswap/common.js +1 -1
  90. package/build/dist/api/modules/uniswap/fees.js +1 -1
  91. package/build/dist/api/modules/uniswap/index.js +1 -1
  92. package/build/dist/api/modules/uniswap/local-guard.js +1 -1
  93. package/build/dist/api/modules/uniswap/oracle.js +1 -1
  94. package/build/dist/api/modules/uniswap/pool-math.js +1 -1
  95. package/build/dist/api/modules/uniswap/pools.js +1 -1
  96. package/build/dist/api/modules/uniswap/position.js +1 -1
  97. package/build/dist/api/modules/uniswap/protocol.js +1 -1
  98. package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
  99. package/build/dist/api/modules/uniswap/token-jar.js +1 -1
  100. package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
  101. package/build/dist/api/modules/uniswap/trade.js +1 -1
  102. package/build/dist/api/modules/uniswap/v2.js +1 -1
  103. package/build/dist/api/modules/uniswap/v3.js +1 -1
  104. package/build/dist/api/modules/uniswap/v4.js +1 -1
  105. package/build/dist/api/modules/uniswap/wrap.js +1 -1
  106. package/build/dist/api/modules/velora/index.js +1 -1
  107. package/build/dist/api/modules/wormhole/index.js +1 -1
  108. package/build/dist/api/prices.js +1 -1
  109. package/build/dist/api/send.js +1 -1
  110. package/build/dist/api/signing-registry.js +1 -1
  111. package/build/dist/api/tokens.js +1 -1
  112. package/build/dist/api/tool-policy.d.ts +1 -0
  113. package/build/dist/api/tool-policy.js +1 -1
  114. package/build/dist/api/usd-estimate.js +1 -1
  115. package/build/dist/chunks/{GBIL2I2K.js → 2GYL3N2O.js} +1 -1
  116. package/build/dist/chunks/{5677LZOV.js → 2ZYFBBOE.js} +1 -1
  117. package/build/dist/chunks/{X53QVHBC.js → 35DTANJW.js} +1 -1
  118. package/build/dist/chunks/{HRGLFGFL.js → 37UBQQWL.js} +1 -1
  119. package/build/dist/chunks/{5DWQUEBA.js → 4JU23O3Z.js} +1 -1
  120. package/build/dist/chunks/{C2H3BWN5.js → 4WYTIM4T.js} +1 -1
  121. package/build/dist/chunks/{FGGDAAHW.js → 52AEVHKJ.js} +1 -1
  122. package/build/dist/chunks/{5RAZFRO4.js → 5EQTOA5F.js} +1 -1
  123. package/build/dist/chunks/{SRYX65GZ.js → 5VA66LFF.js} +1 -1
  124. package/build/dist/chunks/{IM7ZF7XZ.js → 627SGCTU.js} +1 -1
  125. package/build/dist/chunks/{OIGTTRN5.js → 7KK3OC7Q.js} +1 -1
  126. package/build/dist/chunks/{RYEQIZ2H.js → 7PBCV7VS.js} +1 -1
  127. package/build/dist/chunks/{P6JE2NRA.js → AOTTQPK7.js} +1 -1
  128. package/build/dist/chunks/{EHQRAA3R.js → B4U43D5Z.js} +1 -1
  129. package/build/dist/chunks/B5B7U3NZ.js +1 -0
  130. package/build/dist/chunks/{XWZ5SL5Q.js → CITHH7NK.js} +1 -1
  131. package/build/dist/chunks/{L3IAEXQR.js → CLHA557R.js} +1 -1
  132. package/build/dist/chunks/{CVVNAFUE.js → DUTAMN3F.js} +1 -1
  133. package/build/dist/chunks/{DJRS3TR5.js → EKHNXPWO.js} +1 -1
  134. package/build/dist/chunks/EXKV6QJD.js +1 -0
  135. package/build/dist/chunks/{LKRAUTYI.js → FYWK3UK6.js} +1 -1
  136. package/build/dist/chunks/GV6FZ6UG.js +1 -0
  137. package/build/dist/chunks/{TZG7HTVM.js → H5J2LFPZ.js} +1 -1
  138. package/build/dist/chunks/{UGFRBJDQ.js → HN5RBTNE.js} +1 -1
  139. package/build/dist/chunks/{3HF6WE4L.js → HTOP2OKU.js} +1 -1
  140. package/build/dist/chunks/ILTGXU6G.js +1 -0
  141. package/build/dist/chunks/{B5BU645H.js → J5624CVF.js} +1 -1
  142. package/build/dist/chunks/JFYC2LVI.js +1 -0
  143. package/build/dist/chunks/{URTQNYWU.js → JUVY6PCR.js} +1 -1
  144. package/build/dist/chunks/{GX2RCAHG.js → JYED2PZ3.js} +1 -1
  145. package/build/dist/chunks/{HNBYPHTA.js → K3HCSCXE.js} +1 -1
  146. package/build/dist/chunks/{K4CYAWNL.js → KAXLZJU6.js} +1 -1
  147. package/build/dist/chunks/{6QXTL65K.js → KW5LJGNY.js} +1 -1
  148. package/build/dist/chunks/{XUDQYSPU.js → LHC2YV2U.js} +1 -1
  149. package/build/dist/chunks/{2BKZLF5A.js → LHVGWNMW.js} +1 -1
  150. package/build/dist/chunks/{6Y2546JA.js → LOH6LUVT.js} +1 -1
  151. package/build/dist/chunks/{GTJ6LBGB.js → MFRKZOU4.js} +1 -1
  152. package/build/dist/chunks/{QZ6V6J6W.js → MSIT5Q3M.js} +1 -1
  153. package/build/dist/chunks/{G4IX4CYN.js → NCCKCGKL.js} +1 -1
  154. package/build/dist/chunks/{N6YNJGEF.js → NGHRUNXO.js} +1 -1
  155. package/build/dist/chunks/{BSV65PCA.js → NIGRNLNM.js} +1 -1
  156. package/build/dist/chunks/{4SXRXNHG.js → NWW6GY5E.js} +1 -1
  157. package/build/dist/chunks/{CR7DPGI6.js → ORKXBYVC.js} +1 -1
  158. package/build/dist/chunks/{IR7KDBFU.js → OUXPOFY2.js} +1 -1
  159. package/build/dist/chunks/{XXLQDQEX.js → OWHXYE2G.js} +1 -1
  160. package/build/dist/chunks/{J2J73XYU.js → PLEJPTTK.js} +1 -1
  161. package/build/dist/chunks/{QP2B7AYX.js → PX2G2H6G.js} +1 -1
  162. package/build/dist/chunks/{7X5JVF3F.js → QCPJZBEO.js} +1 -1
  163. package/build/dist/chunks/{7JTXYMNP.js → QGO4EKXZ.js} +1 -1
  164. package/build/dist/chunks/{JTWJT2O3.js → QXBQ7WPB.js} +1 -1
  165. package/build/dist/chunks/{DPSFR3ZS.js → R5UOFPDO.js} +1 -1
  166. package/build/dist/chunks/{EJIP7RBG.js → REXGROOD.js} +1 -1
  167. package/build/dist/chunks/{PXVF2SHU.js → RWEA4SWP.js} +1 -1
  168. package/build/dist/chunks/{K6GECT3F.js → RWUF6T4I.js} +1 -1
  169. package/build/dist/chunks/{F74ARK4H.js → SDDYM2H3.js} +1 -1
  170. package/build/dist/chunks/{3M7RMROZ.js → TKJ4GFUP.js} +1 -1
  171. package/build/dist/chunks/{DV2HVFTM.js → UCMOQAVD.js} +1 -1
  172. package/build/dist/chunks/{WUONMIA2.js → UL4DY6GX.js} +1 -1
  173. package/build/dist/chunks/{GCFHKJIO.js → UYYYSFMQ.js} +1 -1
  174. package/build/dist/chunks/{F36IA5RI.js → V7P4PCLL.js} +1 -1
  175. package/build/dist/chunks/{TWVDWNTG.js → VMSGNN3D.js} +1 -1
  176. package/build/dist/chunks/VQMBPY2P.js +1 -0
  177. package/build/dist/chunks/{K5OXLIPK.js → W3M4KAPX.js} +1 -1
  178. package/build/dist/chunks/{Q43WPRYU.js → W7BTXU3F.js} +1 -1
  179. package/build/dist/chunks/{KB2JWQZ4.js → WADRRW3E.js} +1 -1
  180. package/build/dist/chunks/{QAVP3CWL.js → WG7PMGTJ.js} +1 -1
  181. package/build/dist/chunks/{IKVRFAUP.js → WRNPYW47.js} +1 -1
  182. package/build/dist/chunks/{4GAU3JLN.js → XD4JA43O.js} +1 -1
  183. package/build/dist/chunks/{6EWSLHXL.js → Y7SKGRWC.js} +1 -1
  184. package/build/dist/chunks/{HEQBTHFS.js → YDJHXSS7.js} +1 -1
  185. package/build/dist/chunks/{TMENUIBC.js → YLU5JVRI.js} +1 -1
  186. package/build/dist/chunks/{IYOWMW5B.js → YR6Y6UIR.js} +1 -1
  187. package/build/dist/chunks/{FN6XY6ET.js → Z5WRTISY.js} +1 -1
  188. package/build/dist/chunks/{45QP74CE.js → ZB67QDN2.js} +1 -1
  189. package/build/dist/chunks/{MXI7LX2F.js → ZRG34Y7Q.js} +1 -1
  190. package/package.json +1 -1
  191. package/build/dist/chunks/5PNFV7HH.js +0 -1
  192. package/build/dist/chunks/H5KU4DUU.js +0 -1
  193. package/build/dist/chunks/H7ZJ7LAB.js +0 -1
  194. package/build/dist/chunks/M267JEDO.js +0 -1
  195. package/build/dist/chunks/Y5T36EEU.js +0 -1
@@ -1 +1 @@
1
- import{a as C,b as O}from"./L3IAEXQR.js";import{a as f,b as k}from"./266VIESP.js";import{d as i}from"./XV6F3RET.js";import{a as y,c as w}from"./LFSJDFMY.js";import{b as d}from"./EWZFZUVF.js";import{a}from"./XSD5NL7J.js";var x=r=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(i),description:"Card program to read: turbo (card collection), blackjack or feed."},method:{type:"string",description:"Exact read-only ABI signature from the catalog. Omit to list all available reads."},values:{type:"array",maxItems:16,description:"Ordered inputs for the chosen method: decimal strings for integers, 0x addresses or hex bytes, booleans, or arrays/tuples of them."}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(i,t.program))throw new a("Choose turbo, blackjack or feed.");let o=i[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new a("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let n=u.find(e=>f(e)===t.method),m=t.values??[];if(!n||!Array.isArray(m)||m.length!==n.inputs.length)throw new a("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let l=r.clientFor(d);if(await l.getChainId()!==d)throw new a("NetNet cards require chain 4663.");let p=await l.getBlock(),c=n.inputs.map((e,s)=>k(e,m[s])),E=await l.readContract({address:o.address,abi:[n],functionName:n.name,args:c,blockNumber:p.number}),g=t.program==="turbo"&&n.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(n.name)?[c[0]]:n.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(g.length){let e=await l.readContract({address:i.turbo.address,abi:i.turbo.abi,functionName:"seriesCount",blockNumber:p.number});b=[...new Set(g)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:i.turbo.address,contract:o.address,blockNumber:String(p.number),blockHash:p.hash,method:t.method,outputs:n.outputs,...b?{seriesStatus:b}:{},data:h(E)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new a("Card capabilities takes no arguments.");return{chainId:d,collection:i.turbo.address,blackjack:i.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...y],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(r,t=0){if(t>12)throw new a("Card read result exceeds the supported nesting.");if(typeof r=="bigint")return r.toString();if(typeof r=="string"){if(r.length>8194)throw new a("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(r)?r:`untrusted ${JSON.stringify(r)}`}if(Array.isArray(r)){if(r.length>4096)throw new a("Choose a bounded card read.");return r.map(o=>h(o,t+1))}return r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,u])=>[o,h(u,t+1)])):r}export{x as a};
1
+ import{a as C,b as O}from"./CLHA557R.js";import{a as y,c as w}from"./LFSJDFMY.js";import{a as f,b as k}from"./266VIESP.js";import{d as i}from"./XV6F3RET.js";import{b as d}from"./EWZFZUVF.js";import{a}from"./XSD5NL7J.js";var x=r=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(i),description:"Card program to read: turbo (card collection), blackjack or feed."},method:{type:"string",description:"Exact read-only ABI signature from the catalog. Omit to list all available reads."},values:{type:"array",maxItems:16,description:"Ordered inputs for the chosen method: decimal strings for integers, 0x addresses or hex bytes, booleans, or arrays/tuples of them."}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(i,t.program))throw new a("Choose turbo, blackjack or feed.");let o=i[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new a("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let n=u.find(e=>f(e)===t.method),m=t.values??[];if(!n||!Array.isArray(m)||m.length!==n.inputs.length)throw new a("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let l=r.clientFor(d);if(await l.getChainId()!==d)throw new a("NetNet cards require chain 4663.");let p=await l.getBlock(),c=n.inputs.map((e,s)=>k(e,m[s])),E=await l.readContract({address:o.address,abi:[n],functionName:n.name,args:c,blockNumber:p.number}),g=t.program==="turbo"&&n.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(n.name)?[c[0]]:n.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(g.length){let e=await l.readContract({address:i.turbo.address,abi:i.turbo.abi,functionName:"seriesCount",blockNumber:p.number});b=[...new Set(g)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:i.turbo.address,contract:o.address,blockNumber:String(p.number),blockHash:p.hash,method:t.method,outputs:n.outputs,...b?{seriesStatus:b}:{},data:h(E)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new a("Card capabilities takes no arguments.");return{chainId:d,collection:i.turbo.address,blackjack:i.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...y],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(r,t=0){if(t>12)throw new a("Card read result exceeds the supported nesting.");if(typeof r=="bigint")return r.toString();if(typeof r=="string"){if(r.length>8194)throw new a("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(r)?r:`untrusted ${JSON.stringify(r)}`}if(Array.isArray(r)){if(r.length>4096)throw new a("Choose a bounded card read.");return r.map(o=>h(o,t+1))}return r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,u])=>[o,h(u,t+1)])):r}export{x as a};
@@ -1 +1 @@
1
- import{h as w}from"./2GXHYI23.js";import{c as A,d as B}from"./FN6XY6ET.js";import{a as g,c as v,d}from"./4CEV4FDG.js";import{ia as u}from"./HHYE42JG.js";import{h as y}from"./NWNYJ26T.js";import{a as c}from"./XSD5NL7J.js";import{erc20Abi as C}from"viem";async function I(a,n,o,l){if(!o.length)return[];let t=await a.multicall({allowFailure:!1,contracts:o.map(p=>({address:p,abi:C,functionName:"balanceOf",args:[n]})),blockNumber:l});if(!Array.isArray(t)||t.length!==o.length)throw new c("Borro share balances could not be read completely. Please try again.");return t.map(d)}async function T(a,n,o={}){v(n);let l=()=>{if(o.signal?.aborted)throw new c("Borro read was cancelled.")};l();let t=a.clientFor(4663),s=await(o.discoverVaults??A(a,o).discoverVaults)(t,{wallet:n,heldOnly:!0,...o.signal?{signal:o.signal}:{}});if(s.incomplete)throw new c("Borro discovery is incomplete, so these positions cannot be shown as complete. Please try again.");let h=s.shareBalances?.map(e=>e.vault)??[...new Set([...s.vaults.map(e=>e.vault),...s.refused.flatMap(e=>e.vault?[e.vault]:[])])],b=s.shareBalances?.map(e=>d(BigInt(e.amount)))??await I(t,n,h,BigInt(s.measuredAtBlock));l();let P=h.flatMap((e,i)=>b[i]>0n?[{vault:e,balance:b[i]}]:[]);return Promise.all(P.map(async({vault:e,balance:i})=>{let r=s.vaults.find(O=>y(O.vault,e));if(!r)throw new c("This wallet holds Borro shares whose vault could not be verified. Check the vault address before withdrawing.");let m=d(await t.readContract({address:e,abi:g,functionName:"convertToAssets",args:[i],blockNumber:BigInt(s.measuredAtBlock)}));l();let k={address:e,symbol:r.vaultSymbol,decimals:18,chainId:4663},f={address:r.asset,symbol:r.symbol,decimals:r.assetDecimals,chainId:4663};return{module:"borro",id:`4663:${e}`,chainId:4663,assets:[B(k,i)],oakNotice:u(),economics:{principal:m===0n?[]:[w("redeemable",{token:f,amount:m.toString(),source:"borro.convertToAssets",heldAs:e,measuredAtBlock:s.measuredAtBlock})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`${a.formatAmount(i.toString(),18)} ${r.vaultSymbol} = about ${a.formatAmount(m.toString(),r.assetDecimals)} ${f.symbol} lent through Borro. ${u()}`}}))}export{I as a,T as b};
1
+ import{h as w}from"./2GXHYI23.js";import{c as A,d as B}from"./Z5WRTISY.js";import{a as g,c as v,d}from"./4CEV4FDG.js";import{ia as u}from"./HHYE42JG.js";import{h as y}from"./NWNYJ26T.js";import{a as c}from"./XSD5NL7J.js";import{erc20Abi as C}from"viem";async function I(a,n,o,l){if(!o.length)return[];let t=await a.multicall({allowFailure:!1,contracts:o.map(p=>({address:p,abi:C,functionName:"balanceOf",args:[n]})),blockNumber:l});if(!Array.isArray(t)||t.length!==o.length)throw new c("Borro share balances could not be read completely. Please try again.");return t.map(d)}async function T(a,n,o={}){v(n);let l=()=>{if(o.signal?.aborted)throw new c("Borro read was cancelled.")};l();let t=a.clientFor(4663),s=await(o.discoverVaults??A(a,o).discoverVaults)(t,{wallet:n,heldOnly:!0,...o.signal?{signal:o.signal}:{}});if(s.incomplete)throw new c("Borro discovery is incomplete, so these positions cannot be shown as complete. Please try again.");let h=s.shareBalances?.map(e=>e.vault)??[...new Set([...s.vaults.map(e=>e.vault),...s.refused.flatMap(e=>e.vault?[e.vault]:[])])],b=s.shareBalances?.map(e=>d(BigInt(e.amount)))??await I(t,n,h,BigInt(s.measuredAtBlock));l();let P=h.flatMap((e,i)=>b[i]>0n?[{vault:e,balance:b[i]}]:[]);return Promise.all(P.map(async({vault:e,balance:i})=>{let r=s.vaults.find(O=>y(O.vault,e));if(!r)throw new c("This wallet holds Borro shares whose vault could not be verified. Check the vault address before withdrawing.");let m=d(await t.readContract({address:e,abi:g,functionName:"convertToAssets",args:[i],blockNumber:BigInt(s.measuredAtBlock)}));l();let k={address:e,symbol:r.vaultSymbol,decimals:18,chainId:4663},f={address:r.asset,symbol:r.symbol,decimals:r.assetDecimals,chainId:4663};return{module:"borro",id:`4663:${e}`,chainId:4663,assets:[B(k,i)],oakNotice:u(),economics:{principal:m===0n?[]:[w("redeemable",{token:f,amount:m.toString(),source:"borro.convertToAssets",heldAs:e,measuredAtBlock:s.measuredAtBlock})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`${a.formatAmount(i.toString(),18)} ${r.vaultSymbol} = about ${a.formatAmount(m.toString(),r.assetDecimals)} ${f.symbol} lent through Borro. ${u()}`}}))}export{I as a,T as b};
@@ -0,0 +1 @@
1
+ import{a as O}from"./35DTANJW.js";import{a as F}from"./S432S6NA.js";import{a as j}from"./JFYC2LVI.js";import{j as E}from"./2GXHYI23.js";import{b as D}from"./SPJCSEKP.js";import{a as R}from"./43LI5NKJ.js";import{c as H}from"./SCG5HWMN.js";import{c as b,e as h,g as v,i as _,l as B}from"./NWNYJ26T.js";import{b as L}from"./IX3GZMTM.js";import{b as u,j as M}from"./EWZFZUVF.js";import{a as p}from"./XSD5NL7J.js";import{a as z}from"./JXOEJPJ4.js";import{encodeFunctionData as S,parseAbi as oe,zeroAddress as P}from"viem";import{encodeAbiParameters as U,encodeFunctionData as Y,keccak256 as W,parseAbi as ee}from"viem";var I=M[u].merkl.distributor.address,A="Claim rewards on Merkl (Powered by Merkl \u2014 https://app.merkl.xyz)",Z=`${A}. No claimable rewards on Robinhood Chain. Pending rewards must settle into a Merkle root before they can be claimed.`,C=ee(["function claimed(address user,address token) view returns (uint208 amount,uint48 timestamp,bytes32 merkleRoot)","function getMerkleRoot() view returns (bytes32)","function claim(address[] users,address[] tokens,uint256[] amounts,bytes32[][] proofs)"]);function K(a){return typeof a=="string"&&/^0x[0-9a-fA-F]{64}$/.test(a)}function k(){throw new p("Merkl returned an unexpected response. Please refetch rewards.")}function T(a){typeof a!="string"&&k();let d=L(a);if(d>=1n<<256n)throw new p("The Merkl reward amount exceeds the uint256 range.");return d.toString()}function re(a){let d=[],m=new Set;for(let c of a)if((!h(c)||!h(c.chain)||!Number.isSafeInteger(c.chain.id))&&k(),c.chain.id===u){Array.isArray(c.rewards)||k();for(let r of c.rewards){if((!h(r)||typeof r.distributionLayer!="string"||!h(r.token))&&k(),r.distributionLayer!=="TREE"||(Number.isSafeInteger(r.token.chainId)||k(),r.token.chainId!==u)||(Array.isArray(r.proofs)||k(),!r.proofs.length))continue;(!r.proofs.every(K)||typeof r.token.address!="string"||typeof r.token.symbol!="string"||!r.token.symbol.trim()||typeof r.token.decimals!="number"||!Number.isInteger(r.token.decimals)||r.token.decimals<0||r.token.decimals>255)&&k(),R(r.token.address);let t=T(r.amount),n=T(r.pending);if(BigInt(t)===0n)continue;let e=r.token.address.toLowerCase();if(m.has(e))throw new p("Merkl returned duplicate token leaves. Please refetch rewards.");m.add(e),d.push({token:{address:r.token.address,chainId:u,decimals:r.token.decimals,symbol:r.token.symbol},amount:t,pending:n,proofs:r.proofs})}}return d}function te(a,d,m){let c=W(U([{type:"address"},{type:"address"},{type:"uint256"}],[a,d.token.address,BigInt(d.amount)]));for(let r of d.proofs){let t=BigInt(c)<BigInt(r)?[c,r]:[r,c];c=W(U([{type:"bytes32"},{type:"bytes32"}],t))}if(!v(c,m))throw new p("The Merkl proof does not match the active root. Please refetch rewards.")}function q(a){if(!h(a)||Object.keys(a).length)throw new p("This Merkl tool takes no arguments and uses the connected wallet.")}async function G(a,d){let m=await Q(a,d),c=new Map,r=[],t=new Set;for(let n of m)if((!h(n)||!h(n.chain)||!Number.isSafeInteger(n.chain.id))&&k(),n.chain.id===u){Array.isArray(n.rewards)||k();for(let e of n.rewards){if((!h(e)||typeof e.distributionLayer!="string"||!h(e.token)||!Number.isSafeInteger(e.token.chainId))&&k(),e.token.chainId!==u)continue;(typeof e.token.address!="string"||typeof e.token.symbol!="string"||!e.token.symbol.trim()||typeof e.token.decimals!="number"||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)&&k(),R(e.token.address);let s=T(e.amount),i=T(e.pending),o=`${e.distributionLayer}:${e.token.address.toLowerCase()}`;if(t.has(o))throw new p("Merkl returned duplicate earning rows. Please refetch rewards.");t.add(o);let l={address:e.token.address,symbol:e.token.symbol,decimals:e.token.decimals,chainId:u},f="0";if(e.distributionLayer==="TREE"){let g=await a.clientFor(u).readContract({address:I,abi:C,functionName:"claimed",args:[d,l.address]});(!Array.isArray(g)||typeof g[0]!="bigint"||g[0]<0n||g[0]>=1n<<208n)&&k(),f=g[0].toString(),c.set(l.address.toLowerCase(),f)}r.push({token:l,amount:s,pending:i,claimed:f,claimable:"0",distributionLayer:e.distributionLayer,status:e.distributionLayer!=="TREE"?"unsupported_distribution_layer":BigInt(s)>BigInt(f)?"awaiting_verified_proof":BigInt(i)>0n?"pending_settlement":"settled"})}}return{body:m,earnings:r,claimedSnapshot:c}}async function Q(a,d){return R(d),H(a.http,`https://api.merkl.xyz/v4/users/${d}/rewards/summary?chainId=${u}`,{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},m=>Array.isArray(m))}async function x(a,d,m){return N(a,d,m)}async function N(a,d,m,c){R(d);let r=re(m??await Q(a,d)),t=a.clientFor(u),n=[];for(let s of r){let i=c?.get(s.token.address.toLowerCase());if(i===void 0){let o=await t.readContract({address:I,abi:C,functionName:"claimed",args:[d,s.token.address]});if(!Array.isArray(o)||typeof o[0]!="bigint"||o[0]<0n||o[0]>=1n<<208n)throw new p("The Merkl claimed balance could not be read. Please try again.");i=o[0].toString()}BigInt(s.amount)<=BigInt(i)||n.push({...s,claimed:i,claimable:(BigInt(s.amount)-BigInt(i)).toString()})}if(!n.length)return[];let e=await t.readContract({address:I,abi:C,functionName:"getMerkleRoot"});if(!K(e))throw new p("The active Merkl root could not be read. Please try again.");for(let s of n)te(d,s,e);return n}var ne=a=>{async function d(t){try{return await t()}catch(n){throw new p(a.plainError(n))}}function m(t){let n=t.amount.startsWith("-"),e=n?t.amount.slice(1):t.amount;return`${n?"-":""}${a.formatAmount(e,t.token.decimals)} ${z(t.token.symbol)} (${t.token.address}, chain ${t.token.chainId}, ${t.token.decimals} decimals)`}let c=t=>x(a,t);return{tools:[{name:"merkl_rewards",description:"Read claimable rewards (Powered by Merkl \u2014 https://app.merkl.xyz).",inputSchema:{type:"object",properties:{},additionalProperties:!1,description:"Read rewards (Powered by Merkl \u2014 https://app.merkl.xyz)."},execute:(t,n)=>d(async()=>{q(t);let{body:e,earnings:s,claimedSnapshot:i}=await G(a,n),o=await N(a,n,e,i);for(let l of s){let f=o.find(g=>v(g.token.address,l.token.address)&&l.distributionLayer==="TREE");f&&(l.claimed=f.claimed,l.claimable=f.claimable,l.status="claimable")}return{earnings:s,rewards:o.map(({proofs:l,...f})=>f),summary:o.length?`${A}. Claimable reward leaves: ${o.map(l=>m({token:l.token,amount:l.claimable})).join("; ")}. Wrapped leaves may transfer underlying tokens; claim preview shows the received assets. Pending rewards appear separately in earnings and are excluded from claimable amounts.`:`${Z} Earnings include pending-only and unsupported distribution layers; an unverified amount is never presented as claimable.`}})},{name:"merkl_claim",description:A,inputSchema:{type:"object",properties:{},additionalProperties:!1,description:A},execute:(t,n)=>d(async()=>{q(t);let e=await c(n);if(!e.length)return{txs:[],summary:Z};let s=[a.unsignedTx({to:I,chainId:u,value:"0",description:A,data:Y({abi:C,functionName:"claim",args:[e.map(()=>n),e.map(o=>o.token.address),e.map(o=>BigInt(o.amount)),e.map(o=>o.proofs)]})})],i=await a.preview(s,n);return{txs:s,summary:`${A}. Prepared unsigned claim. Expected wallet changes: ${i.changes.length?i.changes.map(m).join("; "):"no token transfers in simulation"}. ${i.summary}`}})}],positions:t=>d(async()=>{let{body:n,earnings:e,claimedSnapshot:s}=await G(a,t),i=await N(a,t,n,s);return e.flatMap(o=>{let l=o.distributionLayer==="TREE"?i.find(X=>v(X.token.address,o.token.address)):void 0,f=BigInt(o.pending)>0n;if(!l&&!f)return[];let g="Merkl pending rewards are not yet claimable and are excluded from valuation.";return[{module:"merkl",id:`${u}:${o.token.address.toLowerCase()}${o.distributionLayer==="TREE"?"":`:${o.distributionLayer}`}`,chainId:u,assets:l?[{token:l.token,amount:l.claimable}]:[],economics:{principal:[],debt:[],backing:[],coverage:f?{complete:!1,reason:g}:{complete:!0},rewards:[...l?[E("claimable",{token:l.token,amount:l.claimable,source:"merkl.claimable",claim:{tool:"merkl_claim",args:{}}})]:[],...f?[E("unpaid",{token:o.token,amount:null,source:"merkl.pending",unknownReason:g})]:[]]},description:`${A}. Unclaimed reward leaf; wrapped rewards may transfer underlying assets. Pending rewards are excluded from valuation.`}]})})}},he=a=>D("merkl",[ne(a),O(a),j(a),J(a),F(a)]);var $=M[u].merkl.distributor.address,w=oe(["function operators(address,address) view returns (uint256)","function claimRecipient(address,address) view returns (address)","function toggleOperator(address,address)","function setClaimRecipient(address,address)","function claim(address[],address[],uint256[],bytes32[][])","function claimWithRecipient(address[],address[],uint256[],bytes32[][],address[],bytes[])"]),V="Provide a valid address.";function y(a,d=!1){let m=_(a,V);return d?m:B(m,V)}var J=a=>{let d=()=>a.clientFor(u),m=async(r,t,n)=>{let e=[a.unsignedTx({to:$,chainId:u,value:"0",data:r,description:t})],s=await a.preview(e,n);return{txs:e,preview:s,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${t} ${s.summary}`}},c=(r,t,n,e)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:t,required:n,additionalProperties:!1},execute:async(s,i)=>{try{let o=Object.keys(s).find(l=>!Object.hasOwn(t,l));if(o)throw new p(`Unsupported Merkl input: ${o}.`);return await e(s,y(i))}catch(o){throw new p(a.plainError(o))}}});return{tools:[c("claim_config",{token:{...b,description:"Reward token address; zero address selects the global setting where supported."},operator:{...b,description:"Address of the operator whose claim permission is read or changed."}},[],async(r,t)=>{let n=y(r.token??P,!0),e=y(await d().readContract({address:$,abi:w,functionName:"claimRecipient",args:[t,P]}),!0),s=y(await d().readContract({address:$,abi:w,functionName:"claimRecipient",args:[t,n]}),!0),i;if(r.operator!==void 0){let o=await d().readContract({address:$,abi:w,functionName:"operators",args:[t,y(r.operator,!0)]});if(o!==0n&&o!==1n)throw new p("Merkl returned invalid operator authorization.");i=o===1n}return{chainId:u,wallet:t,token:n,defaultRecipient:e,tokenRecipient:s,effectiveRecipient:s!==P?s:e!==P?e:t,...i===void 0?{}:{operatorEnabled:i},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Zero recipient restores self-claims. Token overrides take precedence over the global recipient."}}),c("set_operator",{operator:{...b,description:"Address of the operator whose claim permission is read or changed."},enabled:{type:"boolean",description:"true grants claim permission; false revokes it."}},["operator","enabled"],async(r,t)=>{let n=y(r.operator,!0);if(typeof r.enabled!="boolean")throw new p("Provide enabled as boolean.");let e=await d().readContract({address:$,abi:w,functionName:"operators",args:[t,n]});if(e!==0n&&e!==1n)throw new p("Merkl returned invalid operator authorization.");return e===1n===r.enabled?{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Operator already has the requested state; no transaction needed."}:m(S({abi:w,functionName:"toggleOperator",args:[t,n]}),`${r.enabled?"Authorize":"Revoke"} Merkl claims by ${n} for ${t}. Zero operator grants permissionless claiming; configured recipients still apply. The contract toggles the observed state; preview and confirmation must remain current.`,t)}),c("set_recipient",{recipient:{...b,description:"Address to receive rewards; zero restores the default where supported."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."}},["recipient"],async(r,t)=>{let n=y(r.recipient,!0),e=y(r.token??P,!0);return m(S({abi:w,functionName:"setClaimRecipient",args:[n,e]}),`Set Merkl reward recipient for ${e===P?"all tokens":e} to ${n===P?`self (${t})`:n}. This redirects future claims; token-specific overrides remain authoritative.`,t)}),c("claim_to",{recipient:{...b,description:"Address to receive rewards; zero restores the default where supported."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."},data:{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:16386,description:"Optional recipient callback data as 0x-prefixed hex bytes."}},["recipient"],async(r,t)=>{let n=y(r.recipient),e=r.token===void 0?void 0:y(r.token),s=r.data??"0x";if(typeof s!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(s)||s.length>16386)throw new p("Provide callback data as at most 8192 hexadecimal bytes.");let i=(await x(a,t)).filter(o=>!e||v(o.token.address,e));return i.length?m(S({abi:w,functionName:"claimWithRecipient",args:[i.map(()=>t),i.map(o=>o.token.address),i.map(o=>BigInt(o.amount)),i.map(o=>o.proofs),i.map(()=>n),i.map(()=>s)]}),`Claim ${i.map(o=>`${o.claimable} ${o.token.symbol} base units (token ${o.token.address}, decimals ${o.token.decimals})`).join("; ")} to ${n}, overriding saved claim recipients for this claim only. Callback data for each leaf: ${s}. Inspect all callback effects in preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for the selected token."}}),c("claim_for",{user:{...b,description:"Address of the user whose rewards are claimed."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."}},["user"],async(r,t)=>{let n=y(r.user),e=r.token===void 0?void 0:y(r.token),s=(await x(a,n)).filter(i=>!e||v(i.token.address,e));return s.length?m(S({abi:w,functionName:"claim",args:[s.map(()=>n),s.map(i=>i.token.address),s.map(i=>BigInt(i.amount)),s.map(i=>i.proofs)]}),`Claim Merkl rewards for ${n}; caller ${t} pays gas. The user's saved recipients control payment. Claim authorization and actual receipts must pass preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for this user."}})]}};export{J as a,x as b,ne as c,he as d};
@@ -1 +1 @@
1
- import{a as B}from"./QAVP3CWL.js";import{c as P}from"./5O67QQIY.js";import{b as M}from"./7X5JVF3F.js";import{c as V}from"./LKRAUTYI.js";import{c as x}from"./YBLJ2MCR.js";import{k as F}from"./QBHY2QRC.js";import{a as _}from"./A3PN3PK3.js";import{b as O,o as R}from"./TTBB6EFN.js";import{b as I}from"./SPJCSEKP.js";import{a as S}from"./43LI5NKJ.js";import{a as H}from"./66F5ZH34.js";import{g as A,m as N,n as W}from"./NWNYJ26T.js";import{b as m,j as G}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as L,getAddress as b,parseAbi as z}from"viem";var c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function balanceOf(address) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),Q=z(["function deposit() payable"]),p=G[m],T=[{key:"core",name:"Longbow Core USDG",vault:p.vaults.longbowCore.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"frontier",name:"Longbow Frontier USDG",vault:p.vaults.longbowFrontier.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"eth",name:"Longbow ETH",vault:p.vaults.longbowEth.address,asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}],D=[{key:"v1-usdg",name:"Longbow USDG Core V1 (legacy)",vault:b("0x8cb8AA35228c96C1C4E956E69AbAEBCc2aA7Dcfe"),asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"v1-weth",name:"Longbow WETH Core V1 (legacy)",vault:b("0x93777a9b917be3c8259c84456222f43a01dd6492"),asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}];function j(s,i){return W(s,`${i} must be positive and within the uint256 range.`,{notString:`${i} must be a positive integer string in base units.`,positive:!0})}function h(s){return N(s,"Longbow returned an invalid integer response.")}function q(s,i=!1){if(typeof s!="string")throw new u("Provide the address of a current Longbow vault.");let w=D.find(y=>A(y.vault,s));if(w&&!i)throw new u("Longbow V1 vaults are withdraw-only; deposit into a current V2 vault from longbow_list instead.");let g=w??T.find(y=>A(y.vault,s));if(!g)throw new u("Provide the address of a current Longbow vault, or a Longbow V1 vault to withdraw from. Other vaults are not supported.");return g}function C(s,i){if(Object.keys(s).some(w=>!i.includes(w)))throw new u("Unsupported Longbow input. Use the fields in the tool schema.")}var X=s=>{async function i(e){try{return await e()}catch(t){throw new u(s.plainError(t))}}async function w(){let e=s.clientFor(m);if(await e.getChainId()!==m)throw new u("Longbow requires a client on chain 4663.");return e}async function g(e,t){let[o,r,a,n]=await Promise.all([e.readContract({address:t.vault,abi:c,functionName:"asset"}),e.readContract({address:t.vault,abi:c,functionName:"decimals"}),e.readContract({address:t.asset,abi:c,functionName:"decimals"}),_(e,t.vault)]);if(typeof o!="string"||!A(o,t.asset))throw new u("Longbow vault asset does not match the recorded deployment.");if(r!==18||a!==t.decimals)throw new u("Longbow token decimals do not match the recorded deployment.");return{vault:t.vault,key:t.key,name:t.name,asset:{address:b(t.asset),symbol:t.symbol,decimals:a,chainId:m},share:{address:t.vault,symbol:n,decimals:r,chainId:m}}}async function y(e,t,o,r){let a=R(o.amount,O);if(BigInt(a)===0n)throw new u("The expected output is too small for a nonzero simulation minimum.");let n=await s.preview(e,t);if(n.changes.filter(l=>l.token.chainId===o.token.chainId&&A(l.token.address,o.token.address)&&l.token.decimals===o.token.decimals).reduce((l,v)=>l+BigInt(v.amount),0n)<BigInt(a))throw new u("Longbow simulated output is below the expected minimum.");let d=n.changes.map(({token:l,amount:v})=>{let U=v.startsWith("-");return`${U?"-":"+"}${s.formatAmount(U?v.slice(1):v,l.decimals)} ${l.symbol} (${l.address}, chain ${l.chainId})`}).join("; ");return{txs:e,preview:n,expectedOutput:o,minimumOutput:{token:o.token,amount:a},minimumEnforcedOnchain:!1,summary:`${r} ${d}. Simulation only; no on-chain minimum is enforced by these ERC-4626 calls. ${n.summary}`}}async function Y(e){C(e,[]);let t=await w();return Promise.all(T.map(async o=>{let[r,a,n,f]=await Promise.all([g(t,o),t.readContract({address:o.vault,abi:c,functionName:"totalAssets"}),t.readContract({address:o.vault,abi:c,functionName:"performanceFee"}),t.readContract({address:o.vault,abi:c,functionName:"managementFee"})]);return{...r,totalAssets:{token:r.asset,amount:h(a).toString()},fees:{performanceFeeE18:h(n).toString(),managementFeeE18:h(f).toString()},caveat:"Morpho V2 max views can be zero even when writes succeed. Simulate the requested action; listing does not prove availability."}}))}async function K(e,t){C(e,["vault","amount","wrapEth"]),S(t);let o=q(e.vault),r=j(e.amount,"Deposit amount");if(e.wrapEth!==void 0&&typeof e.wrapEth!="boolean")throw new u("wrapEth must be a boolean.");if(e.wrapEth&&!A(o.asset,p.tokens.WETH.address))throw new u("Only a WETH vault accepts explicit ETH wrapping.");let a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"previewDeposit",args:[r]})),d=[];return e.wrapEth&&d.push(s.unsignedTx({to:n.asset.address,data:L({abi:Q,functionName:"deposit"}),value:r.toString(),chainId:m,description:`Wrap ${s.formatAmount(r.toString(),18)} ETH into WETH for ${n.name}.`})),d.push(s.approval(n.asset.address,n.vault,r.toString(),m)),d.push(s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"deposit",args:[r,b(t)]}),value:"0",chainId:m,description:`Deposit ${s.formatAmount(r.toString(),n.asset.decimals)} ${n.asset.symbol} into ${n.name}.`})),y(d,t,{token:n.share,amount:f.toString()},`Deposit into ${n.name}.`)}async function J(e,t){C(e,["vault","shares"]),S(t);let o=q(e.vault,!0),r=e.shares==="all"?void 0:j(e.shares,"Redeem shares"),a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"balanceOf",args:[t]})),d=r??f;if(d===0n||d>f)throw new u("The wallet has insufficient Longbow shares for this redemption.");let l=h(await a.readContract({address:n.vault,abi:c,functionName:"previewRedeem",args:[d]})),v=[s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"redeem",args:[d,b(t),b(t)]}),value:"0",chainId:m,description:`Redeem ${s.formatAmount(d.toString(),n.share.decimals)} shares from ${n.name} into ${n.asset.symbol}.`})];return y(v,t,{token:n.asset,amount:l.toString()},`Redeem from ${n.name}.`)}let E={type:"string",enum:T.map(e=>e.vault),description:"Current vault address on chain 4663."},$=H('Positive amount of the vault asset in base units, never a human-unit decimal (USDG has 6 decimals, WETH 18). Example: "1000000" = 1 USDG.'),k=(e,t,o,r)=>({name:e,inputSchema:{type:"object",description:e==="longbow_deposit"?"Deposit the selected vault\u2019s USDG (6 decimals) or WETH (18 decimals) in base units for shares. Exit with longbow_withdraw; check positions after confirmation.":e==="longbow_withdraw"?"Redeem shares in 18-decimal base units, or shares all for a full exit. Returns USDG or WETH according to the selected vault.":"List current Longbow vault assets and shares; exit existing shares with longbow_withdraw.",properties:t,required:o,additionalProperties:!1},execute:(a,n)=>i(()=>r(a,n))});return{tools:[k("longbow_list",{},[],Y),k("longbow_deposit",{vault:E,amount:$,wrapEth:{type:"boolean",default:!1,description:"Explicitly wrap this amount of native ETH before depositing into the WETH vault."}},["vault","amount"],K),k("longbow_withdraw",{vault:{...E,enum:[...E.enum,...D.map(e=>e.vault)],description:"Current vault address, or a Longbow V1 vault (withdraw-only) on chain 4663."},shares:{anyOf:[$,{const:"all"}],description:"Share base units (18 decimals), or all for the fresh wallet share balance. Returns the underlying asset, including WETH."}},["vault","shares"],J)],positions:e=>i(async()=>{S(e);let t=await w();return(await Promise.all([...T,...D].map(async r=>{let a=await g(t,r),n=h(await t.readContract({address:a.vault,abi:c,functionName:"balanceOf",args:[e]}));if(n===0n)return[];let f=h(await t.readContract({address:a.vault,abi:c,functionName:"previewRedeem",args:[n]}));return[{module:"longbow",id:`${m}:${a.vault.toLowerCase()}`,chainId:m,assets:[{token:a.asset,amount:f.toString()}],description:`${a.name}: ${s.formatAmount(n.toString(),a.share.decimals)} shares (${a.share.address}, ${a.share.decimals} decimals). Underlying is a preview, not a guaranteed redemption.`}]}))).flat()})}};function he(s){return I("longbow",[X(s),P(s),F(s),x(s),M(s),V(s),{tools:B(s,"longbow",T.map(i=>({vault:i.vault,asset:{address:b(i.asset),symbol:i.symbol,decimals:i.decimals,chainId:m}})))}])}export{D as a,X as b,he as c};
1
+ import{a as B}from"./WG7PMGTJ.js";import{c as P}from"./5O67QQIY.js";import{b as M}from"./QCPJZBEO.js";import{c as V}from"./FYWK3UK6.js";import{c as x}from"./YBLJ2MCR.js";import{k as F}from"./QBHY2QRC.js";import{a as _}from"./A3PN3PK3.js";import{b as O,o as R}from"./TTBB6EFN.js";import{b as I}from"./SPJCSEKP.js";import{a as S}from"./43LI5NKJ.js";import{a as H}from"./66F5ZH34.js";import{g as A,m as N,n as W}from"./NWNYJ26T.js";import{b as m,j as G}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as L,getAddress as b,parseAbi as z}from"viem";var c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function balanceOf(address) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),Q=z(["function deposit() payable"]),p=G[m],T=[{key:"core",name:"Longbow Core USDG",vault:p.vaults.longbowCore.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"frontier",name:"Longbow Frontier USDG",vault:p.vaults.longbowFrontier.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"eth",name:"Longbow ETH",vault:p.vaults.longbowEth.address,asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}],D=[{key:"v1-usdg",name:"Longbow USDG Core V1 (legacy)",vault:b("0x8cb8AA35228c96C1C4E956E69AbAEBCc2aA7Dcfe"),asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"v1-weth",name:"Longbow WETH Core V1 (legacy)",vault:b("0x93777a9b917be3c8259c84456222f43a01dd6492"),asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}];function j(s,i){return W(s,`${i} must be positive and within the uint256 range.`,{notString:`${i} must be a positive integer string in base units.`,positive:!0})}function h(s){return N(s,"Longbow returned an invalid integer response.")}function q(s,i=!1){if(typeof s!="string")throw new u("Provide the address of a current Longbow vault.");let w=D.find(y=>A(y.vault,s));if(w&&!i)throw new u("Longbow V1 vaults are withdraw-only; deposit into a current V2 vault from longbow_list instead.");let g=w??T.find(y=>A(y.vault,s));if(!g)throw new u("Provide the address of a current Longbow vault, or a Longbow V1 vault to withdraw from. Other vaults are not supported.");return g}function C(s,i){if(Object.keys(s).some(w=>!i.includes(w)))throw new u("Unsupported Longbow input. Use the fields in the tool schema.")}var X=s=>{async function i(e){try{return await e()}catch(t){throw new u(s.plainError(t))}}async function w(){let e=s.clientFor(m);if(await e.getChainId()!==m)throw new u("Longbow requires a client on chain 4663.");return e}async function g(e,t){let[o,r,a,n]=await Promise.all([e.readContract({address:t.vault,abi:c,functionName:"asset"}),e.readContract({address:t.vault,abi:c,functionName:"decimals"}),e.readContract({address:t.asset,abi:c,functionName:"decimals"}),_(e,t.vault)]);if(typeof o!="string"||!A(o,t.asset))throw new u("Longbow vault asset does not match the recorded deployment.");if(r!==18||a!==t.decimals)throw new u("Longbow token decimals do not match the recorded deployment.");return{vault:t.vault,key:t.key,name:t.name,asset:{address:b(t.asset),symbol:t.symbol,decimals:a,chainId:m},share:{address:t.vault,symbol:n,decimals:r,chainId:m}}}async function y(e,t,o,r){let a=R(o.amount,O);if(BigInt(a)===0n)throw new u("The expected output is too small for a nonzero simulation minimum.");let n=await s.preview(e,t);if(n.changes.filter(l=>l.token.chainId===o.token.chainId&&A(l.token.address,o.token.address)&&l.token.decimals===o.token.decimals).reduce((l,v)=>l+BigInt(v.amount),0n)<BigInt(a))throw new u("Longbow simulated output is below the expected minimum.");let d=n.changes.map(({token:l,amount:v})=>{let U=v.startsWith("-");return`${U?"-":"+"}${s.formatAmount(U?v.slice(1):v,l.decimals)} ${l.symbol} (${l.address}, chain ${l.chainId})`}).join("; ");return{txs:e,preview:n,expectedOutput:o,minimumOutput:{token:o.token,amount:a},minimumEnforcedOnchain:!1,summary:`${r} ${d}. Simulation only; no on-chain minimum is enforced by these ERC-4626 calls. ${n.summary}`}}async function Y(e){C(e,[]);let t=await w();return Promise.all(T.map(async o=>{let[r,a,n,f]=await Promise.all([g(t,o),t.readContract({address:o.vault,abi:c,functionName:"totalAssets"}),t.readContract({address:o.vault,abi:c,functionName:"performanceFee"}),t.readContract({address:o.vault,abi:c,functionName:"managementFee"})]);return{...r,totalAssets:{token:r.asset,amount:h(a).toString()},fees:{performanceFeeE18:h(n).toString(),managementFeeE18:h(f).toString()},caveat:"Morpho V2 max views can be zero even when writes succeed. Simulate the requested action; listing does not prove availability."}}))}async function K(e,t){C(e,["vault","amount","wrapEth"]),S(t);let o=q(e.vault),r=j(e.amount,"Deposit amount");if(e.wrapEth!==void 0&&typeof e.wrapEth!="boolean")throw new u("wrapEth must be a boolean.");if(e.wrapEth&&!A(o.asset,p.tokens.WETH.address))throw new u("Only a WETH vault accepts explicit ETH wrapping.");let a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"previewDeposit",args:[r]})),d=[];return e.wrapEth&&d.push(s.unsignedTx({to:n.asset.address,data:L({abi:Q,functionName:"deposit"}),value:r.toString(),chainId:m,description:`Wrap ${s.formatAmount(r.toString(),18)} ETH into WETH for ${n.name}.`})),d.push(s.approval(n.asset.address,n.vault,r.toString(),m)),d.push(s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"deposit",args:[r,b(t)]}),value:"0",chainId:m,description:`Deposit ${s.formatAmount(r.toString(),n.asset.decimals)} ${n.asset.symbol} into ${n.name}.`})),y(d,t,{token:n.share,amount:f.toString()},`Deposit into ${n.name}.`)}async function J(e,t){C(e,["vault","shares"]),S(t);let o=q(e.vault,!0),r=e.shares==="all"?void 0:j(e.shares,"Redeem shares"),a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"balanceOf",args:[t]})),d=r??f;if(d===0n||d>f)throw new u("The wallet has insufficient Longbow shares for this redemption.");let l=h(await a.readContract({address:n.vault,abi:c,functionName:"previewRedeem",args:[d]})),v=[s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"redeem",args:[d,b(t),b(t)]}),value:"0",chainId:m,description:`Redeem ${s.formatAmount(d.toString(),n.share.decimals)} shares from ${n.name} into ${n.asset.symbol}.`})];return y(v,t,{token:n.asset,amount:l.toString()},`Redeem from ${n.name}.`)}let E={type:"string",enum:T.map(e=>e.vault),description:"Current vault address on chain 4663."},$=H('Positive amount of the vault asset in base units, never a human-unit decimal (USDG has 6 decimals, WETH 18). Example: "1000000" = 1 USDG.'),k=(e,t,o,r)=>({name:e,inputSchema:{type:"object",description:e==="longbow_deposit"?"Deposit the selected vault\u2019s USDG (6 decimals) or WETH (18 decimals) in base units for shares. Exit with longbow_withdraw; check positions after confirmation.":e==="longbow_withdraw"?"Redeem shares in 18-decimal base units, or shares all for a full exit. Returns USDG or WETH according to the selected vault.":"List current Longbow vault assets and shares; exit existing shares with longbow_withdraw.",properties:t,required:o,additionalProperties:!1},execute:(a,n)=>i(()=>r(a,n))});return{tools:[k("longbow_list",{},[],Y),k("longbow_deposit",{vault:E,amount:$,wrapEth:{type:"boolean",default:!1,description:"Explicitly wrap this amount of native ETH before depositing into the WETH vault."}},["vault","amount"],K),k("longbow_withdraw",{vault:{...E,enum:[...E.enum,...D.map(e=>e.vault)],description:"Current vault address, or a Longbow V1 vault (withdraw-only) on chain 4663."},shares:{anyOf:[$,{const:"all"}],description:"Share base units (18 decimals), or all for the fresh wallet share balance. Returns the underlying asset, including WETH."}},["vault","shares"],J)],positions:e=>i(async()=>{S(e);let t=await w();return(await Promise.all([...T,...D].map(async r=>{let a=await g(t,r),n=h(await t.readContract({address:a.vault,abi:c,functionName:"balanceOf",args:[e]}));if(n===0n)return[];let f=h(await t.readContract({address:a.vault,abi:c,functionName:"previewRedeem",args:[n]}));return[{module:"longbow",id:`${m}:${a.vault.toLowerCase()}`,chainId:m,assets:[{token:a.asset,amount:f.toString()}],description:`${a.name}: ${s.formatAmount(n.toString(),a.share.decimals)} shares (${a.share.address}, ${a.share.decimals} decimals). Underlying is a preview, not a guaranteed redemption.`}]}))).flat()})}};function he(s){return I("longbow",[X(s),P(s),F(s),x(s),M(s),V(s),{tools:B(s,"longbow",T.map(i=>({vault:i.vault,asset:{address:b(i.asset),symbol:i.symbol,decimals:i.decimals,chainId:m}})))}])}export{D as a,X as b,he as c};
@@ -0,0 +1 @@
1
+ import{k as $}from"./GV6FZ6UG.js";import{c as T}from"./SCG5HWMN.js";import{e as m,h as u}from"./NWNYJ26T.js";import{b as l,k as S}from"./EWZFZUVF.js";import{a as b}from"./XSD5NL7J.js";import{a as v}from"./JXOEJPJ4.js";import{getAddress as F,isAddress as N}from"viem";var R="https://api.merkl.xyz/v4/opportunities",w=100,O=10,y=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0,I=e=>y(e)&&Number.isSafeInteger(e)&&e<=253402300799,x=(e,p)=>typeof e=="string"&&e.trim()?e.slice(0,200):p;function C(e,p){if(!Array.isArray(e)||e.length!==2)return;let o=[];for(let n of e){if(!m(n)||n.chainId!==l||typeof n.address!="string"||!N(n.address,{strict:!1})||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)return;let a=p.find(d=>d.chainId===l&&u(d.address,n.address));o.push({address:F(n.address),chainId:l,decimals:a?.decimals??n.decimals,symbol:a?.symbol??x(n.symbol,n.address),...a?.name?{name:a.name}:{},verified:!!a})}return o.some(n=>n.verified)&&!u(o[0].address,o[1].address)?o:void 0}function L(e,p,o){if(e.chainId!==l||!m(e.protocol)||e.protocol.id!=="uniswap"||e.action!=="POOL"||e.status!=="LIVE"||e.type!=="UNISWAP_V4"&&e.type!=="UNISWAP_V3"||!y(e.tvl)||e.tvl===0||!Array.isArray(e.campaigns))return;let n=e.type==="UNISWAP_V4"?"v4":"v3";if(typeof e.identifier!="string"||!(n==="v4"?/^0x[\da-fA-F]{64}$/.test(e.identifier):N(e.identifier,{strict:!1})))return;let a=C(e.tokens,p);if(!a)return;let d=[],k=new Set,c;for(let t of e.campaigns){if(!m(t)||t.computeChainId!==l||t.distributionChainId!==l||t.type!==e.type||!m(t.rewardToken)||t.rewardToken.chainId!==l||t.rewardToken.decimals!==6||!u(t.rewardToken.address,S)||!I(t.startTimestamp)||!I(t.endTimestamp)||t.startTimestamp>o||t.endTimestamp<=o||!y(t.apr)||typeof t.id!="string"||!m(t.params))continue;let r=t.params;if(n==="v4"&&(!u(r.poolId,e.identifier)||!a.some(s=>u(s.address,r.currency0))||!a.some(s=>u(s.address,r.currency1))||u(r.currency0,r.currency1))||!y(r.lpFee)||!Number.isInteger(r.lpFee)||r.lpFee>8388608||r.lpFee>1e6&&r.lpFee!==8388608||n==="v3"&&r.lpFee>1e6)continue;let i=typeof t.campaignId=="string"?t.campaignId.toLowerCase():t.id;if(!k.has(i)){if(k.add(i),c!==void 0&&c!==r.lpFee)return;c=r.lpFee,d.push({id:t.id,onChainId:typeof t.campaignId=="string"?t.campaignId:null,rewardAprPercent:t.apr,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp,endsAt:new Date(t.endTimestamp*1e3).toISOString(),requiresInRange:typeof r.isOutOfRangeIncentivized=="boolean"?!r.isOutOfRangeIncentivized:null,feeWeightPercent:y(r.weightFees)&&r.weightFees<=1e4?r.weightFees/100:null,hasOverrides:typeof t.hasOverrides=="boolean"?t.hasOverrides:null,eligibility:"Not checked for this wallet. Inspect merkl_campaigns for whitelists, blacklists, hooks, forwarding and overrides before adding liquidity."})}}if(!d.length||c===void 0)return;let g=d.reduce((t,r)=>t+r.rewardAprPercent,0);if(!Number.isFinite(g))return;let f=m(e.aprRecord)?Number(e.aprRecord.timestamp):NaN;return{opportunityId:String(e.id),poolId:e.identifier,version:n,tokens:a,pair:a.map(t=>`${t.symbol}${t.verified?"":" (unverified)"}`).join("/"),feeTier:c===8388608?"dynamic":`${c/1e4}%`,feeTierPercent:c===8388608?null:c/1e4,rewardAprPercent:g,rewardUsdPer1000PerDay:g*(10/365),tvlUsd:e.tvl,endsAt:new Date(Math.min(...d.map(t=>t.endTimestamp))*1e3).toISOString(),campaigns:d,reportedAt:I(f)?new Date(f*1e3).toISOString():null,feeAprPercent:null,feeAprNote:"Separate pool trading-fee APR is unavailable from this source. Fee tier and campaign fee weight are not fee APR."}}var j=e=>({tools:[{name:"merkl_stock_lp_rewards",inputSchema:{type:"object",additionalProperties:!1,properties:{limit:{type:"integer",minimum:1,maximum:20,description:"Maximum ranked stock LP pools to return, 1 to 20; default 4."}}},execute:async p=>{if(Object.keys(p).some(i=>i!=="limit"))throw new b("Only limit is accepted for stock LP rewards.");let o=p.limit??4;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>20)throw new b("Choose limit as an integer from 1 to 20.");let n;try{n=await $({http:e.http,includeNames:!0})}catch{throw new b("Official stock list is unavailable. Retry when the issuer list is available; stock LP ranking was not checked.")}let a=new Map,d=!1;for(let i=0;i<O;i++){let s=new URL(R);s.search=new URLSearchParams({chainId:String(l),campaigns:"true",items:String(w),page:String(i)}).toString();let A=await T(e.http,s.toString(),{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},h=>Array.isArray(h)&&h.every(P=>m(P)&&typeof P.id=="string"&&Number.isSafeInteger(P.chainId)));for(let h of A)a.has(String(h.id))||a.set(String(h.id),h);if(A.length<w){d=!0;break}}let k=Math.floor(Date.now()/1e3),c=new Map;for(let i of a.values()){let s=L(i,n,k);s&&!c.has(`${s.version}:${s.poolId.toLowerCase()}`)&&c.set(`${s.version}:${s.poolId.toLowerCase()}`,s)}let g=[...c.values()].sort((i,s)=>s.rewardAprPercent-i.rewardAprPercent||i.poolId.localeCompare(s.poolId)),f=g.slice(0,o),t=["Pool-wide USDG reward APR is reported by Merkl, not a promise by Oak or an estimate for your chosen range. USD per $1,000 per day is APR / 100 / 365 \xD7 1,000, without compounding.","Merkl data can lag. Campaign eligibility is not checked for this wallet; inspect every campaign before preparing liquidity. Missing range rules mean unknown, not out-of-range eligibility.","Fee-weighted rewards depend on position activity. LP can lose value versus holding (impermanent loss); gas, trading costs and fees can exceed rewards.",...d?[]:[`Partial scan: stopped after ${O} pages of ${w}; these are the highest reported rates among scanned pools only.`]],r=`${d?"":"Partial ranking. "}${f.length?`Top ${f.length} of ${g.length} matched stock LP pools by active USDG reward APR reported by Merkl: ${f.map(i=>`${v(i.pair)} (${i.version}, fee ${i.feeTier}): ${i.rewardAprPercent.toFixed(2)}% APR, $${i.rewardUsdPer1000PerDay.toFixed(2)} per $1,000 per day; next campaign ends ${i.endsAt}; range requirement: ${i.campaigns.every(s=>s.requiresInRange===!0)?"in range":"see individual campaigns"}`).join("; ")}.`:"No matching active stock LP USDG campaigns with readable rates were reported by Merkl in the scanned data."} Not a promise by Oak. Pool fee APR is unavailable. Check campaign eligibility and range rules; LP can lose value versus holding.`;return{source:"reported by Merkl",endpoint:R,chainId:l,fetchedAt:new Date().toISOString(),complete:d,rankedPools:g.length,pools:f,warnings:t,summary:r}}}]});export{j as a};
@@ -1 +1 @@
1
- import{d as l,e as N,f as T}from"./WUONMIA2.js";import{a as D}from"./HPBTSJW7.js";import{a as w,c as o,d as u,e as y,g as b}from"./5KKAN7XQ.js";import{a as U}from"./43LI5NKJ.js";import{b as A}from"./66F5ZH34.js";import{h as S,n as x}from"./NWNYJ26T.js";import{b as p}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as G}from"viem";function $(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new n("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new n("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=$(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new n("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new n("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new n("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:o,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new n("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new n("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new n("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(o,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new n("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new n("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),L=t?G({abi:b,functionName:"withdraw",args:[o.address,m==="max"?y:a,d]}):G({abi:b,functionName:"supply",args:[o.address,a,d,0]}),B=[...t?[]:[e.approval(o.address,w,a.toString(),p)],e.unsignedTx({to:w,data:L,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,o)<a:k(h,o)!==-a||k(h,u)<a-1n)throw new n("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(o,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new n(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A('Positive USDG amount in base units (6 decimals): "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'USDG amount in base units (6 decimals): "1000000" = 1 USDG; max withdraws the full balance.'}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
1
+ import{d as l,e as N,f as T}from"./UL4DY6GX.js";import{a as D}from"./HPBTSJW7.js";import{a as w,c as o,d as u,e as y,g as b}from"./5KKAN7XQ.js";import{a as U}from"./43LI5NKJ.js";import{b as A}from"./66F5ZH34.js";import{h as S,n as x}from"./NWNYJ26T.js";import{b as p}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as G}from"viem";function $(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new n("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new n("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=$(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new n("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new n("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new n("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:o,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new n("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new n("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new n("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(o,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new n("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new n("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),L=t?G({abi:b,functionName:"withdraw",args:[o.address,m==="max"?y:a,d]}):G({abi:b,functionName:"supply",args:[o.address,a,d,0]}),B=[...t?[]:[e.approval(o.address,w,a.toString(),p)],e.unsignedTx({to:w,data:L,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,o)<a:k(h,o)!==-a||k(h,u)<a-1n)throw new n("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(o,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new n(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A('Positive USDG amount in base units (6 decimals): "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'USDG amount in base units (6 decimals): "1000000" = 1 USDG; max withdraws the full balance.'}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
@@ -1 +1 @@
1
- import{a as te,b as ie,i as ne,j as ae,l as re,m as se,p as ce,q as de}from"./G4IX4CYN.js";import{B as oe}from"./5677LZOV.js";import{a as m,e as C,f as q,h as I,i as E,j as n,k as ee,l as B,m as x,n as F,o as P,p as A,q as O,r as N}from"./UMY6SP7C.js";import{h as Y,k as Z}from"./CJMVRV34.js";import{a as J}from"./7WXAS54T.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as me,zeroAddress as $}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],ye=t=>le.includes(t),U=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=te.oneOf[0],ue={hookr_lp_add:{...U({target:{...U({position:j}),description:"Where to add liquidity: the existing Hookr family position."},liquidity:{...m,description:"Liquidity to add, in v4 liquidity base units (not a token amount); positive, and the position total stays below 2^127."},amount0Max:{...m,description:`Maximum of the pool's currency0 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Max:{...m,description:`Maximum of the pool's currency1 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})},hookr_lp_remove:U({position:j,liquidity:{...m,description:"Liquidity to remove, in v4 liquidity base units (not a token amount); positive and at most the position remaining liquidity."},amount0Min:{...m,description:`Minimum of the pool's currency0 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Min:{...m,description:`Minimum of the pool's currency1 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}}),hookr_lp_collect:U({position:j,deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})};function he(t,a){if(!ye(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=C(a,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=ie(e?C(i.target,["position"],["position"]).position:i.position),r=l?0n:q(i.liquidity,127);if(!l&&!r)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),h=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:r,bound0:v,bound1:h,deadline:q(i.deadline,64)}}async function fe(t,a,d){let{block:i,poolId:e,position:l,pc:o,core:r,role:v}=a,h=(p,L=[])=>A(t,r,P(v),p,L,i.number),[M,S,H,R]=await Promise.all([h("config",[e]),A(t,N,P("registry"),"admission",[O,r],i.number),h("configSchemaHash"),h("recaptureConfig",[e])]),k=x(M),y=x(S),u=x(y.caps),g=x(o.caps);if(y.implementation!==r||y.codeHash!==Y(r).codeHash||y.schemaHash!==I(H)||n(y.kind,8)!==0n||!n(y.gasLimit,32)||n(u.maxLpFeePips,24)>600000n||n(u.maxQuoteTakePips,24)>=1000000n||n(u.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let f=n(g.maxLpFeePips,24),T=n(g.maxQuoteTakePips,24),b=n(g.maxSubjectTakeBps,16),c=n(k.burnBps,16),w=n(k.lpBps,16),D=n(k.protocolShareBps,16);if(f>600000n||f>n(u.maxLpFeePips,24)||n(o.baseLpFeePips,24)>f||n(k.maxFeePips,24)>f||T>n(u.maxQuoteTakePips,24)||b>n(u.maxSubjectTakeBps,16)||c+w>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let _=E(o.advisory),z={gated:!1},G="";if(_!==$){if(o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");let p=await ce(t,i.number,d,e,_,o),L=await de(t,i.number,e,l.launcher,_,o);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let pe=x(L.terms),X=q(pe.tierPips,24);if(X>50000n||n(o.baseLpFeePips,24)+X>f||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L,G=` Gate ${_}; ${p.listed?"listed by Oak":"new gate, Oak has not read its code"}.`}let V=x(B(R,3)[0]);ee(V.on);let K=null,Q=BigInt(I(await t.getStorageAt({address:O,slot:ae(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(Q&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let W=(Q>>200n&255n)!==0n;if(W){let p=B(await A(t,N,P("registry"),"activeLaneOf",[O],i.number),4);if(E(p[0]),I(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");K=F({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return{terms:F({config:k,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:W,lane:K}),summary:G}}async function ke(t,a,d,i){let e=he(t,d);if(a.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=a.clientFor(4663),o=await re(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let r=oe({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!r.amount0&&!r.amount1||r.amount0>=1n<<127n||r.amount1>=1n<<127n||r.amount0>e.bound0||r.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let h=e.adding?await fe(l,o,i):null,M=h?.terms??null,S=null,H=null;try{S=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let R=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",k=`${o.key.currency0} / ${o.key.currency1}`,y=`${R} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${k} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${r.amount0}/${r.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${r.amount0}/${r.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.${h?.summary??""}`,u=[],g=[],f=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(f.push({token:c===$?J:c,amount:w,...c===$?{to:e.position.launcher}:{}}),c!==$&&(u.push(a.approval(c,e.position.launcher,"0",4663),a.approval(c,e.position.launcher,w.toString(),4663)),g.push(a.approval(c,e.position.launcher,"0",4663))))}let T=u.length;return u.push(a.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===$?e.bound0.toString():"0",description:y,data:me({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...g),await Z(l,o.block),{txs:u,inputs:f,summary:y,state:o,request:e,actionIndex:T,terms:F({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:r,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:S,coreCreditsReason:H,locks:v,entry:M,exactApprovals:u.filter((b,c)=>c!==T),refunds:e.adding?[e.bound0-r.amount0,e.bound1-r.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function ge(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let a of t)C(a,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function Ae(t,a){if(ge(t),t.length!==a.length||t.some((d,i)=>d.to!==a[i].to||d.data!==a[i].data||d.value!==a[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function $e(t){return le.map(a=>({name:a,inputSchema:ue[a],execute:async(d,i)=>{let e=await ke(a,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,ye as b,ue as c,he as d,ke as e,ge as f,Ae as g,$e as h};
1
+ import{a as te,b as ie,i as ne,j as ae,l as re,m as se,p as ce,q as de}from"./NCCKCGKL.js";import{B as oe}from"./2ZYFBBOE.js";import{a as m,e as C,f as q,h as I,i as E,j as n,k as ee,l as B,m as x,n as F,o as P,p as A,q as O,r as N}from"./UMY6SP7C.js";import{h as Y,k as Z}from"./CJMVRV34.js";import{a as J}from"./7WXAS54T.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as me,zeroAddress as $}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],ye=t=>le.includes(t),U=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=te.oneOf[0],ue={hookr_lp_add:{...U({target:{...U({position:j}),description:"Where to add liquidity: the existing Hookr family position."},liquidity:{...m,description:"Liquidity to add, in v4 liquidity base units (not a token amount); positive, and the position total stays below 2^127."},amount0Max:{...m,description:`Maximum of the pool's currency0 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Max:{...m,description:`Maximum of the pool's currency1 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})},hookr_lp_remove:U({position:j,liquidity:{...m,description:"Liquidity to remove, in v4 liquidity base units (not a token amount); positive and at most the position remaining liquidity."},amount0Min:{...m,description:`Minimum of the pool's currency0 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Min:{...m,description:`Minimum of the pool's currency1 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}}),hookr_lp_collect:U({position:j,deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})};function he(t,a){if(!ye(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=C(a,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=ie(e?C(i.target,["position"],["position"]).position:i.position),r=l?0n:q(i.liquidity,127);if(!l&&!r)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),h=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:r,bound0:v,bound1:h,deadline:q(i.deadline,64)}}async function fe(t,a,d){let{block:i,poolId:e,position:l,pc:o,core:r,role:v}=a,h=(p,L=[])=>A(t,r,P(v),p,L,i.number),[M,S,H,R]=await Promise.all([h("config",[e]),A(t,N,P("registry"),"admission",[O,r],i.number),h("configSchemaHash"),h("recaptureConfig",[e])]),k=x(M),y=x(S),u=x(y.caps),g=x(o.caps);if(y.implementation!==r||y.codeHash!==Y(r).codeHash||y.schemaHash!==I(H)||n(y.kind,8)!==0n||!n(y.gasLimit,32)||n(u.maxLpFeePips,24)>600000n||n(u.maxQuoteTakePips,24)>=1000000n||n(u.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let f=n(g.maxLpFeePips,24),T=n(g.maxQuoteTakePips,24),b=n(g.maxSubjectTakeBps,16),c=n(k.burnBps,16),w=n(k.lpBps,16),D=n(k.protocolShareBps,16);if(f>600000n||f>n(u.maxLpFeePips,24)||n(o.baseLpFeePips,24)>f||n(k.maxFeePips,24)>f||T>n(u.maxQuoteTakePips,24)||b>n(u.maxSubjectTakeBps,16)||c+w>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let _=E(o.advisory),z={gated:!1},G="";if(_!==$){if(o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");let p=await ce(t,i.number,d,e,_,o),L=await de(t,i.number,e,l.launcher,_,o);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let pe=x(L.terms),X=q(pe.tierPips,24);if(X>50000n||n(o.baseLpFeePips,24)+X>f||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L,G=` Gate ${_}; ${p.listed?"listed by Oak":"new gate, Oak has not read its code"}.`}let V=x(B(R,3)[0]);ee(V.on);let K=null,Q=BigInt(I(await t.getStorageAt({address:O,slot:ae(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(Q&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let W=(Q>>200n&255n)!==0n;if(W){let p=B(await A(t,N,P("registry"),"activeLaneOf",[O],i.number),4);if(E(p[0]),I(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");K=F({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return{terms:F({config:k,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:W,lane:K}),summary:G}}async function ke(t,a,d,i){let e=he(t,d);if(a.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=a.clientFor(4663),o=await re(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let r=oe({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!r.amount0&&!r.amount1||r.amount0>=1n<<127n||r.amount1>=1n<<127n||r.amount0>e.bound0||r.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let h=e.adding?await fe(l,o,i):null,M=h?.terms??null,S=null,H=null;try{S=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let R=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",k=`${o.key.currency0} / ${o.key.currency1}`,y=`${R} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${k} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${r.amount0}/${r.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${r.amount0}/${r.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.${h?.summary??""}`,u=[],g=[],f=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(f.push({token:c===$?J:c,amount:w,...c===$?{to:e.position.launcher}:{}}),c!==$&&(u.push(a.approval(c,e.position.launcher,"0",4663),a.approval(c,e.position.launcher,w.toString(),4663)),g.push(a.approval(c,e.position.launcher,"0",4663))))}let T=u.length;return u.push(a.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===$?e.bound0.toString():"0",description:y,data:me({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...g),await Z(l,o.block),{txs:u,inputs:f,summary:y,state:o,request:e,actionIndex:T,terms:F({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:r,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:S,coreCreditsReason:H,locks:v,entry:M,exactApprovals:u.filter((b,c)=>c!==T),refunds:e.adding?[e.bound0-r.amount0,e.bound1-r.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function ge(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let a of t)C(a,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function Ae(t,a){if(ge(t),t.length!==a.length||t.some((d,i)=>d.to!==a[i].to||d.data!==a[i].data||d.value!==a[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function $e(t){return le.map(a=>({name:a,inputSchema:ue[a],execute:async(d,i)=>{let e=await ke(a,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,ye as b,ue as c,he as d,ke as e,ge as f,Ae as g,$e as h};
@@ -1 +1 @@
1
- import{a as Q}from"./CEQNXF6A.js";import{b as Z}from"./C2H3BWN5.js";import{a as I,b as J,d as V}from"./OHZHQSCA.js";import{a as E}from"./QYKXWBZC.js";import{L as y}from"./DPSFR3ZS.js";import{c as $}from"./5PNFV7HH.js";import{a as H}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{d as M,g as O,i as K}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as Y,erc20Abi as X,getAddress as W,parseAbi as ee,zeroAddress as te}from"viem";var v={address:W("0xCeF73866b088766DeD46Ba71d9Bd7591B5e931d2"),symbol:"tNET",decimals:9,chainId:b},_={pair_oracle:["checkpoint"],futures:["open","close","marginCall","accrueCarry","sweepCarrySkim"],underwriting:["subscribe","redeem"],prize:["enter","enterWithNet","exit","exitToUsdg","lockTranche","earlyUnlock","pokeRebase"]},fe=x=>({tools:[{name:"netnet_desk_action",inputSchema:{type:"object",additionalProperties:!1,required:["program","operation"],properties:{program:{type:"string",enum:Object.keys(_),description:"Desk program: pair_oracle (price checkpoint), futures, underwriting or prize (WinNET)."},operation:{type:"string",enum:[...new Set(Object.values(_).flat())],description:"Action to run; it must be one the chosen program supports (see the program list in this tool)."},amount:N('Amount in base units of the token the operation spends or moves: tNET 9 decimals for futures and underwriting, USDG 6 or NET 9 for prize. Example: "1000000000" = 1 NET.'),minAmountOut:N('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9, underwriting shares). Example: "1000000" = 1 USDG.'),maxPayment:N('Most tNET you will pay for futures open (margin plus fee), in tNET base units (9 decimals). Example: "1000000000" = 1 tNET.'),sizeUsdWad:N('Futures position notional in USD as an 18-decimal wad in base units (1e18 = 1 USD). Example: "100000000000000000000" = 100 USD.'),isLong:{type:"boolean",description:"Futures open only: true for a long position, false for a short."},account:{type:"string",description:"Futures marginCall only: address of the trader to margin-call; they must be liquidatable."},referrer:{type:"string",description:"Prize enter only: optional referrer address recorded at the first deposit; cannot be your own wallet."},trancheIndex:N('Zero-based index of your WinNET tranche to lock or unlock early, as a decimal string. Example: "0".'),lockDraws:{enum:["7","30"],description:"Prize lockTranche only: commit the tranche for 7 or 30 draws."},maxPenaltyAssets:N('Prize earlyUnlock only: highest forfeited principal you accept, in NET base units (9 decimals). Example: "1000000000" = 1 NET.')}},execute:async(t,m)=>{try{if(H(m),typeof t.program!="string"||!Object.hasOwn(_,t.program)||typeof t.operation!="string"||!_[t.program].includes(t.operation))throw new e("Choose a supported finite NetNet desk operation.");let p=t.program,r=t.operation,P=E[p],z=Q[p],T=x.clientFor(b);if(await T.getChainId()!==b)throw new e("NetNet desk actions require chain 4663.");let D=await T.getBlock(),q=new Set(["program","operation"]),u=(n,s=[])=>T.readContract({address:P.address,abi:z,functionName:n,args:s,blockNumber:D.number}),h=(...n)=>n.forEach(s=>q.add(s)),A=()=>(h("amount"),y(t.amount)),S=()=>(h("minAmountOut"),y(t.minAmountOut)),d=n=>K(n,"Provide an explicit checksummed account.",M),l=[],a,c=0n,w="",g;if(p==="pair_oracle"){if(d(await u("pairContract"))!==Z)throw new e("The oracle does not use the pinned canonical pair.");w="Permissionless oracle checkpoint; it sends no reward to this wallet and may not yet produce a valid TWAP."}else if(p==="futures"||p==="underwriting"){if(d(await u("token"))!==v.address||await T.readContract({address:v.address,abi:X,functionName:"decimals",blockNumber:D.number})!==9)throw new e("This desk does not use the pinned valueless 9-decimal tNET test collateral.");let n=E.futures.address,s=E.underwriting.address;if(p==="futures"?d(await u("vault"))!==s:d(await u("clearinghouse"))!==n)throw new e("Futures and underwriting counterparties do not match the published pins.");if(w="Experimental tNET test program; tNET has no monetary value. Futures margin and underwriting capital can be lost. Utilization/ADL can prevent redemption. Prices and fees are read from the contract oracle; these calls encode no price floor.",r==="open"){if(h("isLong","sizeUsdWad","maxPayment"),typeof t.isLong!="boolean")throw new e("Provide isLong as a boolean.");let o=A(),f=y(t.sizeUsdWad);if(o>=1n<<128n||f>=1n<<128n)throw new e("Position margin and notional must fit uint128.");let k=d(await u("oracle"));if(k!==W("0xc8a11E8793F8714a159061369173dc86A0A5E23F"))throw new e("The futures oracle is not the published deployment.");let C=await T.readContract({address:k,abi:ee(["function marginPriceWad() view returns (uint256)"]),functionName:"marginPriceWad",blockNumber:D.number});if(C<=0n)throw new e("Futures margin price is unavailable.");let i=f*5n/10000n*1000000000n/C;if(c=o+i,a=v,c>y(t.maxPayment))throw new e("Margin plus taker fee exceeds maxPayment.");l=[t.isLong,f,o],w+=` Entry fee ${i} tNET base units; exact approval caps price drift and may require a fresh preview.`}else if(r==="marginCall"){h("account");let o=d(t.account);if(await u("liquidatable",[o])!==!0)throw new e("The selected futures trader is not liquidatable.");l=[o]}else if(r==="subscribe"){c=A(),a=v,l=[c];let[o,f]=await Promise.all([u("totalShares"),u("equityTokens")]);if(typeof o!="bigint"||typeof f!="bigint"||o>0n&&f===0n)throw new e("Underwriting share price is invalid.");let k=o===0n?c:c*o/f;if(k===0n||k<S())throw new e("Underwriting subscription rounds to zero or misses the local share minimum.");w+=` Current quote ${k} underwriting share units; the share minimum is a local check, not encoded calldata.`}else if(r==="redeem"){let o=A();if(o>await u("sharesOf",[m]))throw new e("The wallet has insufficient underwriting shares.");l=[o],g={token:v,amount:S()}}}else{let[n,s,o,f,k,C]=await Promise.all(["net","usdg","staking","sNet","controller","book"].map(i=>u(i)));if(d(n)!==I.address||d(s)!==$.address||d(o)!==V||d(f)!==J.address||d(k)!==E.draw.address||d(C)!==E.bonus.address)throw new e("WinNET token, staking, book or controller does not match its published pins.");if(w="WinNET principal is a fixed NET claim, exposed to NET price changes. Entry commits through three staking epochs; locks commit for 7 or 30 draws. Early unlock forfeits 1% of principal and cancels streak credits. Pair buys and sells each incur the NET trading tax; no prize or return is guaranteed.",r==="enter"||r==="enterWithNet"){h("referrer");let i=t.referrer===void 0?te:d(t.referrer);if(i===W(m))throw new e("WinNET does not permit self-referral.");c=A(),a=r==="enter"?$:I,l=r==="enter"?[c,S(),i]:[c,i],w+=` Referrer ${i} is recorded at the first deposit and cannot later be changed.`}else if(r==="exit"||r==="exitToUsdg"){let i=A();if(i>await u("principalOf",[m]))throw new e("WinNET exit exceeds this wallet\u2019s fixed principal.");l=r==="exit"?[i,m]:[i,S(),m],g={token:r==="exit"?I:$,amount:r==="exit"?i:y(t.minAmountOut)}}else if(r==="lockTranche"||r==="earlyUnlock"){h("trancheIndex");let i=y(t.trancheIndex,!0),U=await u("trancheAt",[m,i]);if(!Array.isArray(U)||typeof U[0]!="bigint"||U[0]===0n)throw new e("Choose a nonempty WinNET tranche.");if(r==="lockTranche"){if(h("lockDraws"),t.lockDraws!=="7"&&t.lockDraws!=="30")throw new e("Choose a 7- or 30-draw lock.");l=[i,BigInt(t.lockDraws)]}else{h("maxPenaltyAssets");let j=(U[0]+99n)/100n;if(j>y(t.maxPenaltyAssets,!0))throw new e("Early unlock exceeds maxPenaltyAssets in NET base units.");l=[i],w+=` Current irreversible forfeiture ${j} NET base units.`}}}if(Object.keys(t).some(n=>!q.has(n)))throw new e("Unexpected fields for this desk operation.");if(a&&await T.readContract({address:a.address,abi:X,functionName:"balanceOf",args:[m],blockNumber:D.number})<c)throw new e(`Top up ${a.symbol}; this action needs ${c} base units.`);let F=`NetNet ${p}.${r}, contract ${P.address}, chain ${b}, ordered values ${JSON.stringify(l,(n,s)=>typeof s=="bigint"?String(s):s)}. ${a?`Approve exactly ${c} ${a.symbol} base units (token ${a.address}, decimals ${a.decimals}). `:""}${w}`,L=[...a?[x.approval(a.address,P.address,c.toString(),b)]:[],x.unsignedTx({to:P.address,data:Y({abi:z,functionName:r,args:l}),value:"0",chainId:b,description:F})],R=await x.preview(L,m),B=0n,G=0n;for(let n of R.changes){if(n.token.chainId!==b||!/^-?\d+$/.test(n.amount))throw new e("Invalid desk preview metadata.");let s=BigInt(n.amount);if(s<0n){if(!a||!O(n.token.address,a.address)||n.token.decimals!==a.decimals)throw new e("Desk preview spends an unexpected wallet asset.");B-=s}if(g&&O(n.token.address,g.token.address)){if(n.token.decimals!==g.token.decimals)throw new e("Desk receipt decimals mismatch.");G+=s}}if(B>c||g&&G<g.amount)throw new e("Desk preview exceeds its input budget or misses the requested receipt minimum.");return{txs:L,preview:R,summary:F}}catch(p){throw new e(x.plainError(p))}}}]});export{v as a,fe as b};
1
+ import{b as Z}from"./4WYTIM4T.js";import{a as I,b as J,d as V}from"./OHZHQSCA.js";import{a as Q}from"./CEQNXF6A.js";import{a as E}from"./QYKXWBZC.js";import{L as y}from"./R5UOFPDO.js";import{c as $}from"./GV6FZ6UG.js";import{a as H}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{d as M,g as O,i as K}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as Y,erc20Abi as X,getAddress as W,parseAbi as ee,zeroAddress as te}from"viem";var v={address:W("0xCeF73866b088766DeD46Ba71d9Bd7591B5e931d2"),symbol:"tNET",decimals:9,chainId:b},_={pair_oracle:["checkpoint"],futures:["open","close","marginCall","accrueCarry","sweepCarrySkim"],underwriting:["subscribe","redeem"],prize:["enter","enterWithNet","exit","exitToUsdg","lockTranche","earlyUnlock","pokeRebase"]},fe=x=>({tools:[{name:"netnet_desk_action",inputSchema:{type:"object",additionalProperties:!1,required:["program","operation"],properties:{program:{type:"string",enum:Object.keys(_),description:"Desk program: pair_oracle (price checkpoint), futures, underwriting or prize (WinNET)."},operation:{type:"string",enum:[...new Set(Object.values(_).flat())],description:"Action to run; it must be one the chosen program supports (see the program list in this tool)."},amount:N('Amount in base units of the token the operation spends or moves: tNET 9 decimals for futures and underwriting, USDG 6 or NET 9 for prize. Example: "1000000000" = 1 NET.'),minAmountOut:N('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9, underwriting shares). Example: "1000000" = 1 USDG.'),maxPayment:N('Most tNET you will pay for futures open (margin plus fee), in tNET base units (9 decimals). Example: "1000000000" = 1 tNET.'),sizeUsdWad:N('Futures position notional in USD as an 18-decimal wad in base units (1e18 = 1 USD). Example: "100000000000000000000" = 100 USD.'),isLong:{type:"boolean",description:"Futures open only: true for a long position, false for a short."},account:{type:"string",description:"Futures marginCall only: address of the trader to margin-call; they must be liquidatable."},referrer:{type:"string",description:"Prize enter only: optional referrer address recorded at the first deposit; cannot be your own wallet."},trancheIndex:N('Zero-based index of your WinNET tranche to lock or unlock early, as a decimal string. Example: "0".'),lockDraws:{enum:["7","30"],description:"Prize lockTranche only: commit the tranche for 7 or 30 draws."},maxPenaltyAssets:N('Prize earlyUnlock only: highest forfeited principal you accept, in NET base units (9 decimals). Example: "1000000000" = 1 NET.')}},execute:async(t,m)=>{try{if(H(m),typeof t.program!="string"||!Object.hasOwn(_,t.program)||typeof t.operation!="string"||!_[t.program].includes(t.operation))throw new e("Choose a supported finite NetNet desk operation.");let p=t.program,r=t.operation,P=E[p],z=Q[p],T=x.clientFor(b);if(await T.getChainId()!==b)throw new e("NetNet desk actions require chain 4663.");let D=await T.getBlock(),q=new Set(["program","operation"]),u=(n,s=[])=>T.readContract({address:P.address,abi:z,functionName:n,args:s,blockNumber:D.number}),h=(...n)=>n.forEach(s=>q.add(s)),A=()=>(h("amount"),y(t.amount)),S=()=>(h("minAmountOut"),y(t.minAmountOut)),d=n=>K(n,"Provide an explicit checksummed account.",M),l=[],a,c=0n,w="",g;if(p==="pair_oracle"){if(d(await u("pairContract"))!==Z)throw new e("The oracle does not use the pinned canonical pair.");w="Permissionless oracle checkpoint; it sends no reward to this wallet and may not yet produce a valid TWAP."}else if(p==="futures"||p==="underwriting"){if(d(await u("token"))!==v.address||await T.readContract({address:v.address,abi:X,functionName:"decimals",blockNumber:D.number})!==9)throw new e("This desk does not use the pinned valueless 9-decimal tNET test collateral.");let n=E.futures.address,s=E.underwriting.address;if(p==="futures"?d(await u("vault"))!==s:d(await u("clearinghouse"))!==n)throw new e("Futures and underwriting counterparties do not match the published pins.");if(w="Experimental tNET test program; tNET has no monetary value. Futures margin and underwriting capital can be lost. Utilization/ADL can prevent redemption. Prices and fees are read from the contract oracle; these calls encode no price floor.",r==="open"){if(h("isLong","sizeUsdWad","maxPayment"),typeof t.isLong!="boolean")throw new e("Provide isLong as a boolean.");let o=A(),f=y(t.sizeUsdWad);if(o>=1n<<128n||f>=1n<<128n)throw new e("Position margin and notional must fit uint128.");let k=d(await u("oracle"));if(k!==W("0xc8a11E8793F8714a159061369173dc86A0A5E23F"))throw new e("The futures oracle is not the published deployment.");let C=await T.readContract({address:k,abi:ee(["function marginPriceWad() view returns (uint256)"]),functionName:"marginPriceWad",blockNumber:D.number});if(C<=0n)throw new e("Futures margin price is unavailable.");let i=f*5n/10000n*1000000000n/C;if(c=o+i,a=v,c>y(t.maxPayment))throw new e("Margin plus taker fee exceeds maxPayment.");l=[t.isLong,f,o],w+=` Entry fee ${i} tNET base units; exact approval caps price drift and may require a fresh preview.`}else if(r==="marginCall"){h("account");let o=d(t.account);if(await u("liquidatable",[o])!==!0)throw new e("The selected futures trader is not liquidatable.");l=[o]}else if(r==="subscribe"){c=A(),a=v,l=[c];let[o,f]=await Promise.all([u("totalShares"),u("equityTokens")]);if(typeof o!="bigint"||typeof f!="bigint"||o>0n&&f===0n)throw new e("Underwriting share price is invalid.");let k=o===0n?c:c*o/f;if(k===0n||k<S())throw new e("Underwriting subscription rounds to zero or misses the local share minimum.");w+=` Current quote ${k} underwriting share units; the share minimum is a local check, not encoded calldata.`}else if(r==="redeem"){let o=A();if(o>await u("sharesOf",[m]))throw new e("The wallet has insufficient underwriting shares.");l=[o],g={token:v,amount:S()}}}else{let[n,s,o,f,k,C]=await Promise.all(["net","usdg","staking","sNet","controller","book"].map(i=>u(i)));if(d(n)!==I.address||d(s)!==$.address||d(o)!==V||d(f)!==J.address||d(k)!==E.draw.address||d(C)!==E.bonus.address)throw new e("WinNET token, staking, book or controller does not match its published pins.");if(w="WinNET principal is a fixed NET claim, exposed to NET price changes. Entry commits through three staking epochs; locks commit for 7 or 30 draws. Early unlock forfeits 1% of principal and cancels streak credits. Pair buys and sells each incur the NET trading tax; no prize or return is guaranteed.",r==="enter"||r==="enterWithNet"){h("referrer");let i=t.referrer===void 0?te:d(t.referrer);if(i===W(m))throw new e("WinNET does not permit self-referral.");c=A(),a=r==="enter"?$:I,l=r==="enter"?[c,S(),i]:[c,i],w+=` Referrer ${i} is recorded at the first deposit and cannot later be changed.`}else if(r==="exit"||r==="exitToUsdg"){let i=A();if(i>await u("principalOf",[m]))throw new e("WinNET exit exceeds this wallet\u2019s fixed principal.");l=r==="exit"?[i,m]:[i,S(),m],g={token:r==="exit"?I:$,amount:r==="exit"?i:y(t.minAmountOut)}}else if(r==="lockTranche"||r==="earlyUnlock"){h("trancheIndex");let i=y(t.trancheIndex,!0),U=await u("trancheAt",[m,i]);if(!Array.isArray(U)||typeof U[0]!="bigint"||U[0]===0n)throw new e("Choose a nonempty WinNET tranche.");if(r==="lockTranche"){if(h("lockDraws"),t.lockDraws!=="7"&&t.lockDraws!=="30")throw new e("Choose a 7- or 30-draw lock.");l=[i,BigInt(t.lockDraws)]}else{h("maxPenaltyAssets");let j=(U[0]+99n)/100n;if(j>y(t.maxPenaltyAssets,!0))throw new e("Early unlock exceeds maxPenaltyAssets in NET base units.");l=[i],w+=` Current irreversible forfeiture ${j} NET base units.`}}}if(Object.keys(t).some(n=>!q.has(n)))throw new e("Unexpected fields for this desk operation.");if(a&&await T.readContract({address:a.address,abi:X,functionName:"balanceOf",args:[m],blockNumber:D.number})<c)throw new e(`Top up ${a.symbol}; this action needs ${c} base units.`);let F=`NetNet ${p}.${r}, contract ${P.address}, chain ${b}, ordered values ${JSON.stringify(l,(n,s)=>typeof s=="bigint"?String(s):s)}. ${a?`Approve exactly ${c} ${a.symbol} base units (token ${a.address}, decimals ${a.decimals}). `:""}${w}`,L=[...a?[x.approval(a.address,P.address,c.toString(),b)]:[],x.unsignedTx({to:P.address,data:Y({abi:z,functionName:r,args:l}),value:"0",chainId:b,description:F})],R=await x.preview(L,m),B=0n,G=0n;for(let n of R.changes){if(n.token.chainId!==b||!/^-?\d+$/.test(n.amount))throw new e("Invalid desk preview metadata.");let s=BigInt(n.amount);if(s<0n){if(!a||!O(n.token.address,a.address)||n.token.decimals!==a.decimals)throw new e("Desk preview spends an unexpected wallet asset.");B-=s}if(g&&O(n.token.address,g.token.address)){if(n.token.decimals!==g.token.decimals)throw new e("Desk receipt decimals mismatch.");G+=s}}if(B>c||g&&G<g.amount)throw new e("Desk preview exceeds its input budget or misses the requested receipt minimum.");return{txs:L,preview:R,summary:F}}catch(p){throw new e(x.plainError(p))}}}]});export{v as a,fe as b};
@@ -1 +1 @@
1
- import{a as k}from"./OIGTTRN5.js";import{e as P,i as O}from"./5DWQUEBA.js";import{a as g,b as f,f as E,g as S}from"./QP2B7AYX.js";import{a as h,w as M}from"./5677LZOV.js";import{a as y}from"./66F5ZH34.js";import{c as v,g as C}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as l}from"./XSD5NL7J.js";import{encodeFunctionData as c,parseAbi as H,zeroAddress as R}from"viem";var r=H(["function owner() view returns (address)","function feeTo() view returns (address)","function feeToSetter() view returns (address)","function protocolFeeController() view returns (address)","function setFeeTo(address)","function setFeeToSetter(address)","function setOwner(address)","function enableFeeAmount(uint24,int24)","function setFeeProtocol(uint8,uint8)","function collectProtocol(address,uint128,uint128) returns (uint128,uint128)","function transferOwnership(address)","function setProtocolFeeController(address)","function setProtocolFee((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks),uint24)","function collectProtocolFees(address recipient,address currency,uint256 amount) returns (uint256)"]),K=["set_fee_recipient","set_fee_setter","set_owner","enable_fee","set_pool_fee","collect_protocol","set_controller"],V={version:{description:'Uniswap version: "v2" for pairs, "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v2","v3","v4"]},operation:{description:"set_fee_recipient/set_fee_setter: v2 roles; set_owner: owner; enable_fee: v3 tier; set_pool_fee: protocol fees; collect_protocol: collect fees; set_controller: v4 controller.",type:"string",enum:K},target:{...v,description:"Intended fee recipient, fee setter, owner or controller address for the selected administrative operation."},token0:{...v,description:"Lower sorted ERC-20 token address; use WETH for native ETH in v3."},token1:{...v,description:"Higher sorted ERC-20 token address."},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"integer"},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},fee0:{description:"Token0 or zero-for-one protocol fee: v3 divisor 0 (off) or 4\u201310; v4 pips, hundredths of a basis point, from 0 to 1000 (1000 = 0.1%).",type:"integer"},fee1:{description:"Token1 or one-for-zero protocol fee: v3 divisor 0 (off) or 4\u201310; v4 pips, hundredths of a basis point, from 0 to 1000 (1000 = 0.1%).",type:"integer"},currency:{...v,description:"Address of the currency whose protocol fees are collected; the zero address means native ETH."},amount:y('Amount of currency in base units; use currency decimals. Example: "1000000" = 1 currency at 6 decimals.'),amount0Max:y('Maximum amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'),amount1Max:y('Maximum amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'),poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object"}};function G(_){let x=async e=>{let i=_.clientFor(b);if(e==="v2"){let[t,o]=await Promise.all([i.readContract({address:k,abi:r,functionName:"feeToSetter"}),i.readContract({address:k,abi:r,functionName:"feeTo"})]);return{version:e,contract:k,owner:t,feeRecipient:o}}if(e==="v3")return{version:e,contract:P.factory,owner:await i.readContract({address:P.factory,abi:r,functionName:"owner"})};if(e==="v4"){let[t,o]=await Promise.all([i.readContract({address:h,abi:r,functionName:"owner"}),i.readContract({address:h,abi:r,functionName:"protocolFeeController"})]);return{version:e,contract:h,owner:t,controller:o}}throw new l("Provide protocol version v2, v3 or v4.")};return{tools:[{name:"uniswap_protocol_status",inputSchema:{type:"object",additionalProperties:!1,required:["version"],properties:{version:V.version}},async execute(e){return S(e,["version"]),x(e.version)}},{name:"uniswap_protocol_admin",inputSchema:{type:"object",additionalProperties:!1,required:["version","operation"],properties:V},async execute(e,i){let{version:t,operation:o}=e,w=await x(t),I=_.clientFor(b),T=t==="v4"&&["set_pool_fee","collect_protocol"].includes(String(o))?"controller"in w?w.controller:void 0:w.owner;if(!T||!C(T,i))throw new l("The signing wallet does not hold the required Uniswap owner/controller role.");let N=w.contract,s,a,A=()=>{let n=f(e.target);if(n===R)throw new l("Administration target must be nonzero.");return n},d=(n,p,u,m)=>{if(typeof n!="number"||!Number.isInteger(n)||n<u||n>m)throw new l(`${p} must be an integer from ${u} to ${m}.`);return n};if(t==="v2"&&o==="set_fee_recipient")a=["target"],s=c({abi:r,functionName:"setFeeTo",args:[f(e.target)]});else if(t==="v2"&&o==="set_fee_setter")a=["target"],s=c({abi:r,functionName:"setFeeToSetter",args:[A()]});else if(t==="v3"&&o==="set_owner")a=["target"],s=c({abi:r,functionName:"setOwner",args:[A()]});else if(t==="v3"&&o==="enable_fee")a=["fee","tickSpacing"],s=c({abi:r,functionName:"enableFeeAmount",args:[d(e.fee,"fee",0,999999),d(e.tickSpacing,"tickSpacing",1,16383)]});else if(t==="v3"&&["set_pool_fee","collect_protocol"].includes(String(o))){a=["token0","token1","fee",...o==="set_pool_fee"?["fee0","fee1"]:["amount0Max","amount1Max"]];let n=f(e.token0),p=f(e.token1),u=d(e.fee,"fee",0,999999);if(N=await I.readContract({address:P.factory,abi:O,functionName:"getPool",args:[n,p,u]}),N===R)throw new l("No factory-verified v3 pool exists for these tokens and fee.");if(o==="set_pool_fee"){let m=z=>{let F=d(z,"fee divisor",0,10);if(F!==0&&F<4)throw new l("V3 protocol fee divisors must be zero or 4 through 10.");return F};s=c({abi:r,functionName:"setFeeProtocol",args:[m(e.fee0),m(e.fee1)]})}else s=c({abi:r,functionName:"collectProtocol",args:[i,g(e.amount0Max,"amount0Max",128,!0),g(e.amount1Max,"amount1Max",128,!0)]})}else if(t==="v4"&&o==="set_owner")a=["target"],s=c({abi:r,functionName:"transferOwnership",args:[A()]});else if(t==="v4"&&o==="set_controller")a=["target"],s=c({abi:r,functionName:"setProtocolFeeController",args:[f(e.target)]});else if(t==="v4"&&o==="set_pool_fee"){a=["poolKey","fee0","fee1"];let n=M(e.poolKey),p=d(e.fee0,"fee0 pips",0,1e3),u=d(e.fee1,"fee1 pips",0,1e3);s=c({abi:r,functionName:"setProtocolFee",args:[n,p+(u<<12)]})}else if(t==="v4"&&o==="collect_protocol")a=["currency","amount"],s=c({abi:r,functionName:"collectProtocolFees",args:[i,f(e.currency),g(e.amount,"amount",256,!0)]});else throw new l("This operation is not supported by the selected Uniswap protocol version.");return S(e,["version","operation",...a]),E(_,[_.unsignedTx({to:N,data:s,value:"0",chainId:b,description:`Uniswap ${t} protocol administration: ${o}. Role holder ${i}.`})],i,"Privileged protocol operation. Review the exact role/recipient/fee changes. Protocol fee collections pay the signing wallet; no wallet token approval is required.")}}]}}export{r as a,G as b};
1
+ import{a as k}from"./7KK3OC7Q.js";import{e as P,i as O}from"./4JU23O3Z.js";import{a as g,b as f,f as E,g as S}from"./PX2G2H6G.js";import{a as h,w as M}from"./2ZYFBBOE.js";import{a as y}from"./66F5ZH34.js";import{c as v,g as C}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as l}from"./XSD5NL7J.js";import{encodeFunctionData as c,parseAbi as H,zeroAddress as R}from"viem";var r=H(["function owner() view returns (address)","function feeTo() view returns (address)","function feeToSetter() view returns (address)","function protocolFeeController() view returns (address)","function setFeeTo(address)","function setFeeToSetter(address)","function setOwner(address)","function enableFeeAmount(uint24,int24)","function setFeeProtocol(uint8,uint8)","function collectProtocol(address,uint128,uint128) returns (uint128,uint128)","function transferOwnership(address)","function setProtocolFeeController(address)","function setProtocolFee((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks),uint24)","function collectProtocolFees(address recipient,address currency,uint256 amount) returns (uint256)"]),K=["set_fee_recipient","set_fee_setter","set_owner","enable_fee","set_pool_fee","collect_protocol","set_controller"],V={version:{description:'Uniswap version: "v2" for pairs, "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v2","v3","v4"]},operation:{description:"set_fee_recipient/set_fee_setter: v2 roles; set_owner: owner; enable_fee: v3 tier; set_pool_fee: protocol fees; collect_protocol: collect fees; set_controller: v4 controller.",type:"string",enum:K},target:{...v,description:"Intended fee recipient, fee setter, owner or controller address for the selected administrative operation."},token0:{...v,description:"Lower sorted ERC-20 token address; use WETH for native ETH in v3."},token1:{...v,description:"Higher sorted ERC-20 token address."},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"integer"},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},fee0:{description:"Token0 or zero-for-one protocol fee: v3 divisor 0 (off) or 4\u201310; v4 pips, hundredths of a basis point, from 0 to 1000 (1000 = 0.1%).",type:"integer"},fee1:{description:"Token1 or one-for-zero protocol fee: v3 divisor 0 (off) or 4\u201310; v4 pips, hundredths of a basis point, from 0 to 1000 (1000 = 0.1%).",type:"integer"},currency:{...v,description:"Address of the currency whose protocol fees are collected; the zero address means native ETH."},amount:y('Amount of currency in base units; use currency decimals. Example: "1000000" = 1 currency at 6 decimals.'),amount0Max:y('Maximum amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'),amount1Max:y('Maximum amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'),poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object"}};function G(_){let x=async e=>{let i=_.clientFor(b);if(e==="v2"){let[t,o]=await Promise.all([i.readContract({address:k,abi:r,functionName:"feeToSetter"}),i.readContract({address:k,abi:r,functionName:"feeTo"})]);return{version:e,contract:k,owner:t,feeRecipient:o}}if(e==="v3")return{version:e,contract:P.factory,owner:await i.readContract({address:P.factory,abi:r,functionName:"owner"})};if(e==="v4"){let[t,o]=await Promise.all([i.readContract({address:h,abi:r,functionName:"owner"}),i.readContract({address:h,abi:r,functionName:"protocolFeeController"})]);return{version:e,contract:h,owner:t,controller:o}}throw new l("Provide protocol version v2, v3 or v4.")};return{tools:[{name:"uniswap_protocol_status",inputSchema:{type:"object",additionalProperties:!1,required:["version"],properties:{version:V.version}},async execute(e){return S(e,["version"]),x(e.version)}},{name:"uniswap_protocol_admin",inputSchema:{type:"object",additionalProperties:!1,required:["version","operation"],properties:V},async execute(e,i){let{version:t,operation:o}=e,w=await x(t),I=_.clientFor(b),T=t==="v4"&&["set_pool_fee","collect_protocol"].includes(String(o))?"controller"in w?w.controller:void 0:w.owner;if(!T||!C(T,i))throw new l("The signing wallet does not hold the required Uniswap owner/controller role.");let N=w.contract,s,a,A=()=>{let n=f(e.target);if(n===R)throw new l("Administration target must be nonzero.");return n},d=(n,p,u,m)=>{if(typeof n!="number"||!Number.isInteger(n)||n<u||n>m)throw new l(`${p} must be an integer from ${u} to ${m}.`);return n};if(t==="v2"&&o==="set_fee_recipient")a=["target"],s=c({abi:r,functionName:"setFeeTo",args:[f(e.target)]});else if(t==="v2"&&o==="set_fee_setter")a=["target"],s=c({abi:r,functionName:"setFeeToSetter",args:[A()]});else if(t==="v3"&&o==="set_owner")a=["target"],s=c({abi:r,functionName:"setOwner",args:[A()]});else if(t==="v3"&&o==="enable_fee")a=["fee","tickSpacing"],s=c({abi:r,functionName:"enableFeeAmount",args:[d(e.fee,"fee",0,999999),d(e.tickSpacing,"tickSpacing",1,16383)]});else if(t==="v3"&&["set_pool_fee","collect_protocol"].includes(String(o))){a=["token0","token1","fee",...o==="set_pool_fee"?["fee0","fee1"]:["amount0Max","amount1Max"]];let n=f(e.token0),p=f(e.token1),u=d(e.fee,"fee",0,999999);if(N=await I.readContract({address:P.factory,abi:O,functionName:"getPool",args:[n,p,u]}),N===R)throw new l("No factory-verified v3 pool exists for these tokens and fee.");if(o==="set_pool_fee"){let m=z=>{let F=d(z,"fee divisor",0,10);if(F!==0&&F<4)throw new l("V3 protocol fee divisors must be zero or 4 through 10.");return F};s=c({abi:r,functionName:"setFeeProtocol",args:[m(e.fee0),m(e.fee1)]})}else s=c({abi:r,functionName:"collectProtocol",args:[i,g(e.amount0Max,"amount0Max",128,!0),g(e.amount1Max,"amount1Max",128,!0)]})}else if(t==="v4"&&o==="set_owner")a=["target"],s=c({abi:r,functionName:"transferOwnership",args:[A()]});else if(t==="v4"&&o==="set_controller")a=["target"],s=c({abi:r,functionName:"setProtocolFeeController",args:[f(e.target)]});else if(t==="v4"&&o==="set_pool_fee"){a=["poolKey","fee0","fee1"];let n=M(e.poolKey),p=d(e.fee0,"fee0 pips",0,1e3),u=d(e.fee1,"fee1 pips",0,1e3);s=c({abi:r,functionName:"setProtocolFee",args:[n,p+(u<<12)]})}else if(t==="v4"&&o==="collect_protocol")a=["currency","amount"],s=c({abi:r,functionName:"collectProtocolFees",args:[i,f(e.currency),g(e.amount,"amount",256,!0)]});else throw new l("This operation is not supported by the selected Uniswap protocol version.");return S(e,["version","operation",...a]),E(_,[_.unsignedTx({to:N,data:s,value:"0",chainId:b,description:`Uniswap ${t} protocol administration: ${o}. Role holder ${i}.`})],i,"Privileged protocol operation. Review the exact role/recipient/fee changes. Protocol fee collections pay the signing wallet; no wallet token approval is required.")}}]}}export{r as a,G as b};
@@ -1 +1 @@
1
- import{d as o}from"./L3IAEXQR.js";import{a as i}from"./LFSJDFMY.js";import{b as a}from"./EWZFZUVF.js";var m=s=>({tools:i.map(e=>{let t=e==="netnet_blackjack_claim"?"seriesId":"sessionId";return{name:e,inputSchema:{description:"Self-only recovery on chain 4663, available without an active identity or subscription; every action requires local human confirmation. Card counts use whole units.",type:"object",additionalProperties:!1,required:[t],properties:{[t]:{type:"string",pattern:"^[1-9][0-9]{0,77}$",description:t==="seriesId"?'Card series id holding your parked blackjack chips, as a decimal string. Example: "1".':'Blackjack session id to settle, as a decimal string. Example: "1".'}}},execute:async(n,c)=>{let r=await o(e,n,c,s.clientFor(a));return{txs:r.txs,summary:r.decision}}}})});export{m as a};
1
+ import{d as o}from"./CLHA557R.js";import{a as i}from"./LFSJDFMY.js";import{b as a}from"./EWZFZUVF.js";var m=s=>({tools:i.map(e=>{let t=e==="netnet_blackjack_claim"?"seriesId":"sessionId";return{name:e,inputSchema:{description:"Self-only recovery on chain 4663, available without an active identity or subscription; every action requires local human confirmation. Card counts use whole units.",type:"object",additionalProperties:!1,required:[t],properties:{[t]:{type:"string",pattern:"^[1-9][0-9]{0,77}$",description:t==="seriesId"?'Card series id holding your parked blackjack chips, as a decimal string. Example: "1".':'Blackjack session id to settle, as a decimal string. Example: "1".'}}},execute:async(n,c)=>{let r=await o(e,n,c,s.clientFor(a));return{txs:r.txs,summary:r.decision}}}})});export{m as a};
@@ -1 +1 @@
1
- import{m as R,s as S,t as B,u as U}from"./TZG7HTVM.js";import{a as f,b as P,e as x,f as H,h as C,n as O}from"./UMY6SP7C.js";import{b as I,j as w,k as v}from"./CJMVRV34.js";import{a as d}from"./XSD5NL7J.js";import{getAddress as L,toFunctionSelector as u,zeroAddress as j}from"viem";var E=["hookr_pay_later_create","hookr_pay_later_transfer","hookr_pay_later_cancel","hookr_pay_later_accept","hookr_pay_later_release","hookr_pay_later_accept_back","hookr_pay_later_withdraw_earnings","hookr_pay_later_withdraw_inventory"],V="hookr_pay_later_vault",D=e=>E.includes(e),Y="function createVault(bytes32 familyId, uint8 member, (uint16 premiumBps,uint16 strikeMarkupBps,uint32 tenor,uint16 priceWindowBlocks,uint16 maxBlockDepthBps,uint32 anchorDecayBlocks,uint16 topGuardBps,uint128 minOrderUnits,uint128 maxOrderUnits,uint128 maxUnitsPerBlock,uint128 maxActiveUnits,uint128 maxInventory,uint128 minPremium) terms)",b={hookr_pay_later_create:{step:"create",target:"factory",selector:u(Y),next:"The vault exists and holds nothing yet; next: hookr_pay_later_transfer."},hookr_pay_later_transfer:{step:"transfer",target:"launcher",selector:u("function transferFamily(bytes32,address,uint16)"),next:"The transfer is pending and nothing has moved; next: hookr_pay_later_accept, or hookr_pay_later_cancel to undo it."},hookr_pay_later_cancel:{step:"cancel",target:"launcher",selector:u("function transferFamily(bytes32,address,uint16)"),next:"No transfer is pending and this wallet keeps the family; next: hookr_pay_later_transfer to start again, or nothing."},hookr_pay_later_accept:{step:"accept",target:"vault",selector:u("function acceptFamily()"),next:"The vault owns the family; to take it back, next: hookr_pay_later_release, then hookr_pay_later_accept_back."},hookr_pay_later_release:{step:"release",target:"vault",selector:u("function releaseFamily()"),next:"The vault still owns the family until this wallet accepts it back; next: hookr_pay_later_accept_back."},hookr_pay_later_accept_back:{step:"accept-back",target:"launcher",selector:u("function acceptFamily(bytes32)"),next:"This wallet owns the family again; next: hookr_pay_later_vault to read what remains, then hookr_pay_later_withdraw_inventory or hookr_pay_later_withdraw_earnings."},hookr_pay_later_withdraw_earnings:{step:"withdraw-earnings",target:"vault",selector:u("function withdrawEarnings(address,address,uint256)"),next:"next: hookr_pay_later_vault to read what the vault still owes."},hookr_pay_later_withdraw_inventory:{step:"withdraw-inventory",target:"vault",selector:u("function withdrawInventory(address,uint128)"),next:"next: hookr_pay_later_vault to read the remaining free and reserved inventory."}},ae=e=>b[e].step,re=e=>b[e].target,M={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},A=e=>({type:"object",properties:e,required:Object.keys(e),additionalProperties:!1}),K={premiumBps:"Nonrefundable upfront premium rate in bps, 100 to 5000; the minimum premium can dominate.",strikeMarkupBps:"Strike markup in bps, 0 to 5000.",tenor:"Order lifetime in seconds, 300 to 604800; exercise must precede expiry.",priceWindowBlocks:"Price lookback in blocks, 1 to 64.",maxBlockDepthBps:"Maximum reference-band depth per block in bps, 1 to 100.",anchorDecayBlocks:"Anchor decay window in blocks, 300 to 50400.",topGuardBps:"Top price guard in bps, 0 to 5000 and at least the live factory floor.",minOrderUnits:"Minimum subject-token order size in base units, positive.",maxOrderUnits:"Maximum subject-token order size in base units, at least minOrderUnits.",maxUnitsPerBlock:"Maximum subject base units reserved per block, at least maxOrderUnits.",maxActiveUnits:"Maximum subject base units reserved by active orders, at least maxUnitsPerBlock.",maxInventory:"Maximum subject-token inventory in base units, at least maxActiveUnits and at most 10^36.",minPremium:"Minimum upfront quote-currency premium in base units."},m={...P,description:"Launcher family id, 0x plus 64 hex digits. The vault is the one the factory records for this family and the signing wallet; no vault address is accepted."},F={hookr_pay_later_create:{familyId:{...P,description:"Existing Launcher family id, 0x plus 64 hex digits; the signing wallet must own the whole family and becomes the vault beneficiary."},member:{...f,description:"Reference family member index as a decimal string, 0 to 7 and below the live member count."},terms:{...A(Object.fromEntries(Object.entries(K).map(([e,a])=>[e,{...f,description:a}]))),description:"All thirteen immutable Pay Later economic terms, each an explicit decimal string."},protocolRecipient:{...M,description:"Expected nonzero protocol premium recipient, checked against the reference Rules contract."},protocolShareBps:{...f,description:"Expected protocol premium share in bps, 2000 to 5000; checked against the factory and created vault."}},hookr_pay_later_transfer:{familyId:m,claims:{...f,description:'Decimal uint16 bit mask: bits 2i and 2i+1 select member i currency0 and currency1 fees as PoolManager claims that Oak cannot redeem; use "0" for tokens.'}},hookr_pay_later_cancel:{familyId:m},hookr_pay_later_accept:{familyId:m},hookr_pay_later_release:{familyId:m},hookr_pay_later_accept_back:{familyId:m},hookr_pay_later_withdraw_earnings:{familyId:m,currency:{...M,description:"Currency address to withdraw to the signing wallet; the zero address means native ETH."},amount:{...f,description:"Amount in base units, above zero and at most what the vault owes the beneficiary in this currency."}},hookr_pay_later_withdraw_inventory:{familyId:m,amount:{...f,description:"Subject-token amount in base units, above zero and at most the vault free inventory; reserved inventory cannot be withdrawn. The payout always goes to the signing wallet."}}},W=e=>A(F[e]),$=A({familyId:m});function q(e,a,n){let o=b[e],t=a.to.toLowerCase(),i={factory:R.toLowerCase(),launcher:I.launcherV1.toLowerCase()};if(!(o.target==="vault"?t!==i.factory&&t!==i.launcher&&t!==j&&(n===void 0||t===n.toLowerCase()):t===i[o.target])||a.data.slice(0,10).toLowerCase()!==o.selector)throw new d("Pay Later transaction is not the one reviewed call of this custody step.")}async function G(e,a,n,o){if(a.network==="testnet")throw new d("Pay Later requires Robinhood Chain 4663.");if(!D(e))throw new d("Choose a dedicated Pay Later custody action.");let t=Object.keys(F[e]),i=x(n,t,t),c=a.clientFor(4663),h=await w(c),r=await B(c,h.number,i,o,b[e].step),{summary:y}=r,p=C(r.familyId),l=L(r.vault),s=L(r.beneficiary);if(s!==L(o))throw new d("Pay Later beneficiary is not the signing wallet.");q(e,r.action,e==="hookr_pay_later_create"?void 0:l);let _=[a.unsignedTx({to:r.action.to,data:r.action.data,value:"0",chainId:4663,description:y})];return await v(c,h),{txs:_,inputs:[],summary:y,name:e,step:r.step,familyId:p,member:r.member,vault:l,beneficiary:s,...e==="hookr_pay_later_transfer"?{claims:Number(H(i.claims,16))}:{},terms:O({blockNumber:h.number,blockHash:h.hash,step:r.step,familyId:p,member:r.member,vault:l,beneficiary:s,to:r.action.to,data:r.action.data,summary:y})}}function J(e){if(!Array.isArray(e)||e.length!==1)throw new d("Pay Later requires exactly one separately confirmed custody call.");x(e[0],["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function oe(e,a,n){J(a);let o=a[0],t=n[0];if(!D(e)||!t||n.length!==1||o.chainId!==4663||o.value!=="0"||o.to.toLowerCase()!==t.to.toLowerCase()||o.data.toLowerCase()!==t.data.toLowerCase())throw new d("Pay Later transaction differs from the locally checked custody step.");q(e,o)}function ne(e){return[...E.map(a=>({name:a,inputSchema:W(a),execute:async(n,o)=>{let t=await G(a,e,n,o);return{txs:t.txs,summary:t.summary,terms:t.terms,step:t.step,familyId:t.familyId,vault:t.vault,beneficiary:t.beneficiary,preview:await e.preview(t.txs,o)}}})),{name:V,inputSchema:$,execute:async(a,n)=>{if(e.network==="testnet")throw new d("Pay Later requires Robinhood Chain 4663.");let o=x(a,["familyId"],["familyId"]),t=e.clientFor(4663),i=await w(t);return U(t,i.number,{familyId:o.familyId},n)}}]}async function ie(e,a,n,o){let t=()=>{throw new d("Pay Later mined but custody verification failed. Inspect this receipt; do not repeat the action.")},[i,c]=await Promise.all([e.getTransactionReceipt({hash:o}),e.getTransaction({hash:o})]),h=a.txs[0],r=(k,z)=>typeof k=="string"&&k.toLowerCase()===z.toLowerCase();(i.status!=="success"||!r(i.transactionHash,o)||!r(c.hash,o)||c.chainId!==4663||!r(c.from,n)||!r(c.to,h.to)||!r(c.input,h.data)||c.value!==0n)&&t();let y=await w(e,i.blockNumber);y.hash!==i.blockHash&&t();let p=await S(e,y.number,a.familyId,n).catch(t),{vault:l}=a,{step:s}=a,_=k=>r(p.familyOwner,k),g=k=>r(p.pendingOwner,k),N=s==="create"?!0:s==="transfer"?_(n)&&g(l)&&p.pendingClaims===a.claims:s==="cancel"?_(n)&&g(j):s==="accept"?_(l):s==="release"?_(l)&&g(n):s==="accept-back"?_(n):!0;(!r(p.vault,l)||!r(p.owner,n)||!N)&&t(),await v(e,y);let{next:T}=b[a.name];return{receiptStatus:"verified",step:s,familyId:a.familyId,vault:l,beneficiary:a.beneficiary,blockNumber:y.number.toString(),next:T,summary:`Pay Later ${s} receipt and vault verified. ${T}`}}export{E as a,V as b,D as c,ae as d,re as e,W as f,$ as g,G as h,J as i,oe as j,ne as k,ie as l};
1
+ import{m as R,s as S,t as B,u as U}from"./H5J2LFPZ.js";import{a as f,b as P,e as x,f as H,h as C,n as O}from"./UMY6SP7C.js";import{b as I,j as w,k as v}from"./CJMVRV34.js";import{a as d}from"./XSD5NL7J.js";import{getAddress as L,toFunctionSelector as u,zeroAddress as j}from"viem";var E=["hookr_pay_later_create","hookr_pay_later_transfer","hookr_pay_later_cancel","hookr_pay_later_accept","hookr_pay_later_release","hookr_pay_later_accept_back","hookr_pay_later_withdraw_earnings","hookr_pay_later_withdraw_inventory"],V="hookr_pay_later_vault",D=e=>E.includes(e),Y="function createVault(bytes32 familyId, uint8 member, (uint16 premiumBps,uint16 strikeMarkupBps,uint32 tenor,uint16 priceWindowBlocks,uint16 maxBlockDepthBps,uint32 anchorDecayBlocks,uint16 topGuardBps,uint128 minOrderUnits,uint128 maxOrderUnits,uint128 maxUnitsPerBlock,uint128 maxActiveUnits,uint128 maxInventory,uint128 minPremium) terms)",b={hookr_pay_later_create:{step:"create",target:"factory",selector:u(Y),next:"The vault exists and holds nothing yet; next: hookr_pay_later_transfer."},hookr_pay_later_transfer:{step:"transfer",target:"launcher",selector:u("function transferFamily(bytes32,address,uint16)"),next:"The transfer is pending and nothing has moved; next: hookr_pay_later_accept, or hookr_pay_later_cancel to undo it."},hookr_pay_later_cancel:{step:"cancel",target:"launcher",selector:u("function transferFamily(bytes32,address,uint16)"),next:"No transfer is pending and this wallet keeps the family; next: hookr_pay_later_transfer to start again, or nothing."},hookr_pay_later_accept:{step:"accept",target:"vault",selector:u("function acceptFamily()"),next:"The vault owns the family; to take it back, next: hookr_pay_later_release, then hookr_pay_later_accept_back."},hookr_pay_later_release:{step:"release",target:"vault",selector:u("function releaseFamily()"),next:"The vault still owns the family until this wallet accepts it back; next: hookr_pay_later_accept_back."},hookr_pay_later_accept_back:{step:"accept-back",target:"launcher",selector:u("function acceptFamily(bytes32)"),next:"This wallet owns the family again; next: hookr_pay_later_vault to read what remains, then hookr_pay_later_withdraw_inventory or hookr_pay_later_withdraw_earnings."},hookr_pay_later_withdraw_earnings:{step:"withdraw-earnings",target:"vault",selector:u("function withdrawEarnings(address,address,uint256)"),next:"next: hookr_pay_later_vault to read what the vault still owes."},hookr_pay_later_withdraw_inventory:{step:"withdraw-inventory",target:"vault",selector:u("function withdrawInventory(address,uint128)"),next:"next: hookr_pay_later_vault to read the remaining free and reserved inventory."}},ae=e=>b[e].step,re=e=>b[e].target,M={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},A=e=>({type:"object",properties:e,required:Object.keys(e),additionalProperties:!1}),K={premiumBps:"Nonrefundable upfront premium rate in bps, 100 to 5000; the minimum premium can dominate.",strikeMarkupBps:"Strike markup in bps, 0 to 5000.",tenor:"Order lifetime in seconds, 300 to 604800; exercise must precede expiry.",priceWindowBlocks:"Price lookback in blocks, 1 to 64.",maxBlockDepthBps:"Maximum reference-band depth per block in bps, 1 to 100.",anchorDecayBlocks:"Anchor decay window in blocks, 300 to 50400.",topGuardBps:"Top price guard in bps, 0 to 5000 and at least the live factory floor.",minOrderUnits:"Minimum subject-token order size in base units, positive.",maxOrderUnits:"Maximum subject-token order size in base units, at least minOrderUnits.",maxUnitsPerBlock:"Maximum subject base units reserved per block, at least maxOrderUnits.",maxActiveUnits:"Maximum subject base units reserved by active orders, at least maxUnitsPerBlock.",maxInventory:"Maximum subject-token inventory in base units, at least maxActiveUnits and at most 10^36.",minPremium:"Minimum upfront quote-currency premium in base units."},m={...P,description:"Launcher family id, 0x plus 64 hex digits. The vault is the one the factory records for this family and the signing wallet; no vault address is accepted."},F={hookr_pay_later_create:{familyId:{...P,description:"Existing Launcher family id, 0x plus 64 hex digits; the signing wallet must own the whole family and becomes the vault beneficiary."},member:{...f,description:"Reference family member index as a decimal string, 0 to 7 and below the live member count."},terms:{...A(Object.fromEntries(Object.entries(K).map(([e,a])=>[e,{...f,description:a}]))),description:"All thirteen immutable Pay Later economic terms, each an explicit decimal string."},protocolRecipient:{...M,description:"Expected nonzero protocol premium recipient, checked against the reference Rules contract."},protocolShareBps:{...f,description:"Expected protocol premium share in bps, 2000 to 5000; checked against the factory and created vault."}},hookr_pay_later_transfer:{familyId:m,claims:{...f,description:'Decimal uint16 bit mask: bits 2i and 2i+1 select member i currency0 and currency1 fees as PoolManager claims that Oak cannot redeem; use "0" for tokens.'}},hookr_pay_later_cancel:{familyId:m},hookr_pay_later_accept:{familyId:m},hookr_pay_later_release:{familyId:m},hookr_pay_later_accept_back:{familyId:m},hookr_pay_later_withdraw_earnings:{familyId:m,currency:{...M,description:"Currency address to withdraw to the signing wallet; the zero address means native ETH."},amount:{...f,description:"Amount in base units, above zero and at most what the vault owes the beneficiary in this currency."}},hookr_pay_later_withdraw_inventory:{familyId:m,amount:{...f,description:"Subject-token amount in base units, above zero and at most the vault free inventory; reserved inventory cannot be withdrawn. The payout always goes to the signing wallet."}}},W=e=>A(F[e]),$=A({familyId:m});function q(e,a,n){let o=b[e],t=a.to.toLowerCase(),i={factory:R.toLowerCase(),launcher:I.launcherV1.toLowerCase()};if(!(o.target==="vault"?t!==i.factory&&t!==i.launcher&&t!==j&&(n===void 0||t===n.toLowerCase()):t===i[o.target])||a.data.slice(0,10).toLowerCase()!==o.selector)throw new d("Pay Later transaction is not the one reviewed call of this custody step.")}async function G(e,a,n,o){if(a.network==="testnet")throw new d("Pay Later requires Robinhood Chain 4663.");if(!D(e))throw new d("Choose a dedicated Pay Later custody action.");let t=Object.keys(F[e]),i=x(n,t,t),c=a.clientFor(4663),h=await w(c),r=await B(c,h.number,i,o,b[e].step),{summary:y}=r,p=C(r.familyId),l=L(r.vault),s=L(r.beneficiary);if(s!==L(o))throw new d("Pay Later beneficiary is not the signing wallet.");q(e,r.action,e==="hookr_pay_later_create"?void 0:l);let _=[a.unsignedTx({to:r.action.to,data:r.action.data,value:"0",chainId:4663,description:y})];return await v(c,h),{txs:_,inputs:[],summary:y,name:e,step:r.step,familyId:p,member:r.member,vault:l,beneficiary:s,...e==="hookr_pay_later_transfer"?{claims:Number(H(i.claims,16))}:{},terms:O({blockNumber:h.number,blockHash:h.hash,step:r.step,familyId:p,member:r.member,vault:l,beneficiary:s,to:r.action.to,data:r.action.data,summary:y})}}function J(e){if(!Array.isArray(e)||e.length!==1)throw new d("Pay Later requires exactly one separately confirmed custody call.");x(e[0],["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function oe(e,a,n){J(a);let o=a[0],t=n[0];if(!D(e)||!t||n.length!==1||o.chainId!==4663||o.value!=="0"||o.to.toLowerCase()!==t.to.toLowerCase()||o.data.toLowerCase()!==t.data.toLowerCase())throw new d("Pay Later transaction differs from the locally checked custody step.");q(e,o)}function ne(e){return[...E.map(a=>({name:a,inputSchema:W(a),execute:async(n,o)=>{let t=await G(a,e,n,o);return{txs:t.txs,summary:t.summary,terms:t.terms,step:t.step,familyId:t.familyId,vault:t.vault,beneficiary:t.beneficiary,preview:await e.preview(t.txs,o)}}})),{name:V,inputSchema:$,execute:async(a,n)=>{if(e.network==="testnet")throw new d("Pay Later requires Robinhood Chain 4663.");let o=x(a,["familyId"],["familyId"]),t=e.clientFor(4663),i=await w(t);return U(t,i.number,{familyId:o.familyId},n)}}]}async function ie(e,a,n,o){let t=()=>{throw new d("Pay Later mined but custody verification failed. Inspect this receipt; do not repeat the action.")},[i,c]=await Promise.all([e.getTransactionReceipt({hash:o}),e.getTransaction({hash:o})]),h=a.txs[0],r=(k,z)=>typeof k=="string"&&k.toLowerCase()===z.toLowerCase();(i.status!=="success"||!r(i.transactionHash,o)||!r(c.hash,o)||c.chainId!==4663||!r(c.from,n)||!r(c.to,h.to)||!r(c.input,h.data)||c.value!==0n)&&t();let y=await w(e,i.blockNumber);y.hash!==i.blockHash&&t();let p=await S(e,y.number,a.familyId,n).catch(t),{vault:l}=a,{step:s}=a,_=k=>r(p.familyOwner,k),g=k=>r(p.pendingOwner,k),N=s==="create"?!0:s==="transfer"?_(n)&&g(l)&&p.pendingClaims===a.claims:s==="cancel"?_(n)&&g(j):s==="accept"?_(l):s==="release"?_(l)&&g(n):s==="accept-back"?_(n):!0;(!r(p.vault,l)||!r(p.owner,n)||!N)&&t(),await v(e,y);let{next:T}=b[a.name];return{receiptStatus:"verified",step:s,familyId:a.familyId,vault:l,beneficiary:a.beneficiary,blockNumber:y.number.toString(),next:T,summary:`Pay Later ${s} receipt and vault verified. ${T}`}}export{E as a,V as b,D as c,ae as d,re as e,W as f,$ as g,G as h,J as i,oe as j,ne as k,ie as l};
@@ -1 +1 @@
1
- import{a,b as o,d as r,e as i}from"./CR7DPGI6.js";import{c as s}from"./BWE5PXRE.js";import{b as t}from"./EWZFZUVF.js";var n=[{feature:"Ethos claim",source:"https://go.priors.trade/start-ethos.js",missing:"Public claim endpoint signs/sends the sponsor transaction remotely. No unsigned final transaction with a local preview/confirmation handoff is published. Use the owner Go Start workflow; Oak offers status and route discovery."},{feature:"x402 pay_url, paid reports, hire payments and pay_gateway",source:"https://github.com/priors-agents/priors/tree/02230282d8888e00794207ed271ee01b4ce30309/packages/x402",missing:"These hand EIP-3009 payment authorization to an external merchant/facilitator. The recipient settles remotely; no Oak-local unsigned transaction handoff is exposed. Oak discovery is supported; external payment-signature validation, recipient/invoice binding and preview semantics require a shared add-on protocol, beyond this module write scope. Gateway source also says its live 402 surface was not measured."},{feature:"Go Google/Privy account, gas sponsorship, recovery and agent001 approvals",source:"https://go.priors.trade/account",missing:"Authenticated smart-account/session and sponsored-operation APIs are not publicly specified as an unsigned plain-wallet contract. Owner uses Priors UI. Underlying pool, stock, savings and backing contracts are supported here."},{feature:"Publish merchant listings, job offers/results, board requests and signed public offers",source:"https://priors.trade/agent",missing:"Hosted MCP supplies discovery and signed board reads. A versioned authenticated mutation/withdrawal contract is not pinned from the inspected public SDK. Existing owner consent plus direct sponsor offer is supported on chain; creating external listings/messages remains an owner workflow."},{feature:"Create the X proof post",source:"https://go.priors.trade/xlink-core.js",missing:"Requires the human account owner to publish on X. Oak can set or clear the canonical proof URL as public ERC-8004 metadata, but does not publish posts or claim metadata alone verifies X ownership."}];function l(){return{tools:[{name:"priors_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(){return{chainId:t,sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309",reads:[...a],actions:[...r],localOwnerSignatures:[...o],core:[...i],ownerOnly:s.filter(e=>e.owner).map(e=>e.name),blocked:n.map(e=>({...e,status:"BLOCKED"})),integration:"The shared bridge/server diffs must be integrated for open reads, local signing continuations, exact calldata reconstruction, action destinations and human confirmation. New core builders fail closed in older add-ons; a core-only install does not establish end-to-end feature availability.",safety:"Every local action previews its exact unsigned transaction bundle. Approvals equal inputs or explicit finite future budgets; never unlimited. Persistent autopay and bids authorize later third-party execution within the stated budget. Token backing is collateral and provides no promised returns."}}}]}}export{n as a,l as b};
1
+ import{a,b as o,d as r,e as i}from"./ORKXBYVC.js";import{c as s}from"./BWE5PXRE.js";import{b as t}from"./EWZFZUVF.js";var n=[{feature:"Ethos claim",source:"https://go.priors.trade/start-ethos.js",missing:"Public claim endpoint signs/sends the sponsor transaction remotely. No unsigned final transaction with a local preview/confirmation handoff is published. Use the owner Go Start workflow; Oak offers status and route discovery."},{feature:"x402 pay_url, paid reports, hire payments and pay_gateway",source:"https://github.com/priors-agents/priors/tree/02230282d8888e00794207ed271ee01b4ce30309/packages/x402",missing:"These hand EIP-3009 payment authorization to an external merchant/facilitator. The recipient settles remotely; no Oak-local unsigned transaction handoff is exposed. Oak discovery is supported; external payment-signature validation, recipient/invoice binding and preview semantics require a shared add-on protocol, beyond this module write scope. Gateway source also says its live 402 surface was not measured."},{feature:"Go Google/Privy account, gas sponsorship, recovery and agent001 approvals",source:"https://go.priors.trade/account",missing:"Authenticated smart-account/session and sponsored-operation APIs are not publicly specified as an unsigned plain-wallet contract. Owner uses Priors UI. Underlying pool, stock, savings and backing contracts are supported here."},{feature:"Publish merchant listings, job offers/results, board requests and signed public offers",source:"https://priors.trade/agent",missing:"Hosted MCP supplies discovery and signed board reads. A versioned authenticated mutation/withdrawal contract is not pinned from the inspected public SDK. Existing owner consent plus direct sponsor offer is supported on chain; creating external listings/messages remains an owner workflow."},{feature:"Create the X proof post",source:"https://go.priors.trade/xlink-core.js",missing:"Requires the human account owner to publish on X. Oak can set or clear the canonical proof URL as public ERC-8004 metadata, but does not publish posts or claim metadata alone verifies X ownership."}];function l(){return{tools:[{name:"priors_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(){return{chainId:t,sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309",reads:[...a],actions:[...r],localOwnerSignatures:[...o],core:[...i],ownerOnly:s.filter(e=>e.owner).map(e=>e.name),blocked:n.map(e=>({...e,status:"BLOCKED"})),integration:"The shared bridge/server diffs must be integrated for open reads, local signing continuations, exact calldata reconstruction, action destinations and human confirmation. New core builders fail closed in older add-ons; a core-only install does not establish end-to-end feature availability.",safety:"Every local action previews its exact unsigned transaction bundle. Approvals equal inputs or explicit finite future budgets; never unlimited. Persistent autopay and bids authorize later third-party execution within the stated budget. Token backing is collateral and provides no promised returns."}}}]}}export{n as a,l as b};
@@ -1 +1 @@
1
- import{b}from"./3HF6WE4L.js";import{c as m,f as A}from"./FN6XY6ET.js";import{c as h}from"./6LDC5D2S.js";import{b as w}from"./XSQJOOEY.js";import{c as u,i as v,l as y}from"./4CEV4FDG.js";import{j as f}from"./5PNFV7HH.js";import{b as p}from"./SPJCSEKP.js";import{a as n}from"./XSD5NL7J.js";var $={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; for multiple USDG vaults, select the largest only with at least 100 USDG and ten times the runner-up assets. Other ambiguous symbols require a vault address."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address to verify on chain; required for a rebuild without HTTP. If asset is also supplied, both must match."}};function M(e){return{type:"object",additionalProperties:!1,properties:{...$,...e?{amount:{type:"string",pattern:e==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}}:{}},...e?{required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}:{}}}function O(e,o){if(Object.keys(e).some(s=>!["asset","vault",...o?["amount"]:[]].includes(s)))throw new n("Unexpected Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)))throw new n("Provide an official asset symbol.");if(e.vault!==void 0&&u(e.vault),o&&(typeof e.amount!="string"||!(o==="withdraw"?/^(?:[0-9]+|max)$/:/^[0-9]+$/).test(e.amount)||!e.asset&&!e.vault))throw new n("Provide an asset symbol or vault address and a base-unit amount.")}function x(e,o={}){let s=m(e,o);if(o.resolveAllowedAsset||o.officialStockTokens)return s;let l=m(e,{...o,resolveAllowedAsset:(r,a,i)=>v(f())(r,a,i)}),t=(r,a,i,d)=>(a.vault?l:s).resolveVault(r,a,i,d);return{...l,discoverVaults:s.discoverVaults,resolveVault:t}}function P(e,o={}){let s=x(e,o),l=["deposit","withdraw"].map((t,r)=>({name:`borro_${t}`,inputSchema:M(t),execute:async(a,i)=>{O(a,t),u(i);let d=o.createActionTools??h,T=e.clientFor(4663),c=d({context:e,client:T,wallet:i,verifySetup:y,readLiquidity:w,...s})[r];if(!c||c.name!==`borro_${t}`)throw new n("Borro action wiring is unavailable.");return c.execute(a,i)}}));return{tools:[{name:"borro_list",inputSchema:M(),execute:async(t,r)=>(O(t),A(e,r,{...typeof t.asset=="string"?{asset:t.asset}:{},...t.vault?{vault:u(t.vault)}:{}},o,s))},...l],positions:(t,r)=>b(e,t,{...o,...r,discoverVaults:s.discoverVaults})}}var _=e=>p("borro",e.network==="testnet"?[]:[P(e)]);export{x as a,P as b,_ as c};
1
+ import{b}from"./HTOP2OKU.js";import{c as m,f as A}from"./Z5WRTISY.js";import{c as h}from"./6LDC5D2S.js";import{b as w}from"./XSQJOOEY.js";import{c as u,i as v,l as y}from"./4CEV4FDG.js";import{j as f}from"./GV6FZ6UG.js";import{b as p}from"./SPJCSEKP.js";import{a as n}from"./XSD5NL7J.js";var $={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; for multiple USDG vaults, select the largest only with at least 100 USDG and ten times the runner-up assets. Other ambiguous symbols require a vault address."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address to verify on chain; required for a rebuild without HTTP. If asset is also supplied, both must match."}};function M(e){return{type:"object",additionalProperties:!1,properties:{...$,...e?{amount:{type:"string",pattern:e==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}}:{}},...e?{required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}:{}}}function O(e,o){if(Object.keys(e).some(s=>!["asset","vault",...o?["amount"]:[]].includes(s)))throw new n("Unexpected Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)))throw new n("Provide an official asset symbol.");if(e.vault!==void 0&&u(e.vault),o&&(typeof e.amount!="string"||!(o==="withdraw"?/^(?:[0-9]+|max)$/:/^[0-9]+$/).test(e.amount)||!e.asset&&!e.vault))throw new n("Provide an asset symbol or vault address and a base-unit amount.")}function x(e,o={}){let s=m(e,o);if(o.resolveAllowedAsset||o.officialStockTokens)return s;let l=m(e,{...o,resolveAllowedAsset:(r,a,i)=>v(f())(r,a,i)}),t=(r,a,i,d)=>(a.vault?l:s).resolveVault(r,a,i,d);return{...l,discoverVaults:s.discoverVaults,resolveVault:t}}function P(e,o={}){let s=x(e,o),l=["deposit","withdraw"].map((t,r)=>({name:`borro_${t}`,inputSchema:M(t),execute:async(a,i)=>{O(a,t),u(i);let d=o.createActionTools??h,T=e.clientFor(4663),c=d({context:e,client:T,wallet:i,verifySetup:y,readLiquidity:w,...s})[r];if(!c||c.name!==`borro_${t}`)throw new n("Borro action wiring is unavailable.");return c.execute(a,i)}}));return{tools:[{name:"borro_list",inputSchema:M(),execute:async(t,r)=>(O(t),A(e,r,{...typeof t.asset=="string"?{asset:t.asset}:{},...t.vault?{vault:u(t.vault)}:{}},o,s))},...l],positions:(t,r)=>b(e,t,{...o,...r,discoverVaults:s.discoverVaults})}}var _=e=>p("borro",e.network==="testnet"?[]:[P(e)]);export{x as a,P as b,_ as c};
@@ -1 +1 @@
1
- import{b as T,f as j}from"./G4IX4CYN.js";import{t as V,y as q}from"./5677LZOV.js";import{e as O,h as F,i as N,j as S,m as D,o as M,p as U}from"./UMY6SP7C.js";import{a as v,b as h,i as R,j as H,k as _}from"./CJMVRV34.js";import{a as n}from"./XSD5NL7J.js";import{randomUUID as Q}from"node:crypto";import{getAddress as k,parseAbiItem as E}from"viem";var Y=E("event FamilyLaunched(bytes32 indexed familyId,address indexed owner,address indexed subject,address root)"),Z=E("event FamilyTransferred(bytes32 indexed familyId,address indexed owner)"),z=100000n,ee=64,K=512,$=300*1e3;function le(P){let l=new Map,b=[k(h.launcherLegacy),k(h.launcherV1)],L=v.launcherDeployments,W=b.reduce((r,d)=>BigInt(L[d].blockNumber)<r?BigInt(L[d].blockNumber):r,BigInt(v.blockNumber));return{name:"hookr_lp_positions",inputSchema:{type:"object",additionalProperties:!1,properties:{cursor:{type:"string",minLength:1,maxLength:64,description:"Opaque, wallet-bound cursor from the preceding page; expires after five minutes. Restart without it if expired."},limit:{type:"integer",minimum:1,maximum:20,description:"Position summaries per page; defaults to 10. A page scans at most 100000 blocks and 32 family checks."}}},execute:async(r,d)=>{if(O(r,["cursor","limit"]),P.network==="testnet")throw new n("Hookr LP reads are configured only on mainnet, chain 4663.");let f=r.limit??10;if(typeof f!="number"||!Number.isInteger(f)||f<1||f>20)throw new n("Provide a Hookr position page limit from 1 to 20.");for(let[t,s]of l)s.expires<=Date.now()&&l.delete(t);let p=P.clientFor(4663),e;if(r.cursor!==void 0){if(typeof r.cursor!="string"||!l.has(r.cursor))throw new n("Hookr position cursor is unknown or expired. Restart without cursor; completeness has not been established.");let t=l.get(r.cursor);if(t.wallet!==d)throw new n("Hookr position cursor belongs to a different wallet. Restart without cursor.");if((await H(p,t.block.number)).hash!==t.block.hash)throw new n("Hookr position snapshot changed. Restart without cursor.");e={...t,candidates:[...t.candidates],seen:new Set(t.seen)}}else{let t=await H(p);e={wallet:d,block:t,nextBlock:t.number,firstBlock:W,candidates:[],member:0,seen:new Set,expires:Date.now()+$}}await R(p,e.block.number,[...b,h.rootV1]);let y=[],w=[],A=[],g=!1;if(e.candidates.length===0&&e.nextBlock>=e.firstBlock){let t=e.nextBlock,s=t-z+1n>e.firstBlock?t-z+1n:e.firstBlock;try{let i=(await Promise.all(b.flatMap(o=>[Y,Z].map(c=>p.getLogs({address:o,event:c,args:{owner:d},fromBlock:s,toBlock:t,strict:!0}))))).flat();if(i.length>K*2)throw new n("Hookr event page exceeds the bounded discovery limit. A dedicated position index is required.");let m=new Map;for(let o of i){let c=k(o.address),u=F(o.args.familyId);if(o.removed||!o.blockNumber||o.blockNumber<s||o.blockNumber>t||!b.includes(c)||o.args.owner!==d)throw new n("Hookr event page is incomplete or inconsistent with the requested wallet and block range.");let a=`${c}:${u}`;e.seen.has(a)||m.set(a,{launcher:c,familyId:u})}if(e.seen.size+m.size>K)throw new n("Hookr wallet history exceeds the bounded discovery limit. Completeness requires a dedicated position index.");e.candidates=[...m.values()];for(let o of m.keys())e.seen.add(o);e.nextBlock=s-1n}catch(i){g=!0,y.push(i instanceof n?i.message:"Hookr event history is unavailable for this block range. Retry this cursor; an empty page does not establish no positions.")}}let X=0;for(;!g&&e.candidates.length&&w.length<f&&X++<32;){let t=e.candidates[0],s=(i,m)=>U(p,t.launcher,M(t.launcher===k(h.launcherV1)?"launcherV1":"launcher"),i,m,e.block.number);try{let[i,m]=await Promise.all([s("familyOwner",[t.familyId]),s("memberCount",[t.familyId])]),o=N(i);if(BigInt(o)===0n)throw new n("Hookr family owner is unavailable for an indexed family.");if(o!==d){let u=t.launcher===k(h.launcherV1);A.push({launcher:t.launcher,familyId:t.familyId,owner:o,note:`This wallet launched or received this family but does not own it now, so it is not listed as a position.${u?` If it was moved into a Pay Later vault, read it with hookr_pay_later_vault {"familyId": "${t.familyId}"} (run_read_tool).`:""}`}),e.candidates.shift(),e.member=0;continue}let c=Number(S(m,8));if(c<1||c>8)throw new n("Hookr family member count is invalid.");for(;e.member<c&&w.length<f;){let u=e.member,a=D(await s("position",[t.familyId,u])),I=j(a.key);if(typeof a.tickLower!="number"||typeof a.tickUpper!="number")throw new n("Hookr family range is incomplete.");q(a.tickLower,a.tickUpper,I.tickSpacing);let G=S(a.liquidity,128),C=V(I);if(await s("poolFamily",[C])!==t.familyId)throw new n("Hookr position does not belong to this family.");let J=T({kind:"family",...t,member:String(u)});w.push({position:J,poolId:C,owner:d,liquidity:G.toString(),range:{tickLower:a.tickLower,tickUpper:a.tickUpper},poolKey:I}),e.member++}e.member===c&&(e.candidates.shift(),e.member=0)}catch(i){g=!0,y.push(i instanceof n?i.message:"Hookr family state is unavailable. Retry this cursor; no zero position is inferred.")}}await _(p,e.block);let x=!g&&e.nextBlock<e.firstBlock&&e.candidates.length===0;x||y.push("Discovery is incomplete. Continue nextCursor, including after an empty page. Current ownership is checked at the fixed snapshot; history gaps are not evidence of no positions.");let B=null;if(!x){for(;l.size>=ee;)l.delete(l.keys().next().value);B=Q(),e.expires=Date.now()+$,l.set(B,e)}return typeof r.cursor=="string"&&l.delete(r.cursor),{chainId:4663,blockNumber:e.block.number.toString(),blockHash:e.block.hash,positions:w,notOwned:A,nextCursor:B,complete:x,warnings:y,coverage:{custody:"reviewed Launcher families only",historyStartBlock:e.firstBlock.toString(),scannedFromBlock:e.nextBlock<e.block.number?(e.nextBlock+1n).toString():null,scannedThroughBlock:e.nextBlock<e.block.number?e.block.number.toString():null,snapshotBlock:e.block.number.toString()}}}}}export{le as a};
1
+ import{b as T,f as j}from"./NCCKCGKL.js";import{t as V,y as q}from"./2ZYFBBOE.js";import{e as O,h as F,i as N,j as S,m as D,o as M,p as U}from"./UMY6SP7C.js";import{a as v,b as h,i as R,j as H,k as _}from"./CJMVRV34.js";import{a as n}from"./XSD5NL7J.js";import{randomUUID as Q}from"node:crypto";import{getAddress as k,parseAbiItem as E}from"viem";var Y=E("event FamilyLaunched(bytes32 indexed familyId,address indexed owner,address indexed subject,address root)"),Z=E("event FamilyTransferred(bytes32 indexed familyId,address indexed owner)"),z=100000n,ee=64,K=512,$=300*1e3;function le(P){let l=new Map,b=[k(h.launcherLegacy),k(h.launcherV1)],L=v.launcherDeployments,W=b.reduce((r,d)=>BigInt(L[d].blockNumber)<r?BigInt(L[d].blockNumber):r,BigInt(v.blockNumber));return{name:"hookr_lp_positions",inputSchema:{type:"object",additionalProperties:!1,properties:{cursor:{type:"string",minLength:1,maxLength:64,description:"Opaque, wallet-bound cursor from the preceding page; expires after five minutes. Restart without it if expired."},limit:{type:"integer",minimum:1,maximum:20,description:"Position summaries per page; defaults to 10. A page scans at most 100000 blocks and 32 family checks."}}},execute:async(r,d)=>{if(O(r,["cursor","limit"]),P.network==="testnet")throw new n("Hookr LP reads are configured only on mainnet, chain 4663.");let f=r.limit??10;if(typeof f!="number"||!Number.isInteger(f)||f<1||f>20)throw new n("Provide a Hookr position page limit from 1 to 20.");for(let[t,s]of l)s.expires<=Date.now()&&l.delete(t);let p=P.clientFor(4663),e;if(r.cursor!==void 0){if(typeof r.cursor!="string"||!l.has(r.cursor))throw new n("Hookr position cursor is unknown or expired. Restart without cursor; completeness has not been established.");let t=l.get(r.cursor);if(t.wallet!==d)throw new n("Hookr position cursor belongs to a different wallet. Restart without cursor.");if((await H(p,t.block.number)).hash!==t.block.hash)throw new n("Hookr position snapshot changed. Restart without cursor.");e={...t,candidates:[...t.candidates],seen:new Set(t.seen)}}else{let t=await H(p);e={wallet:d,block:t,nextBlock:t.number,firstBlock:W,candidates:[],member:0,seen:new Set,expires:Date.now()+$}}await R(p,e.block.number,[...b,h.rootV1]);let y=[],w=[],A=[],g=!1;if(e.candidates.length===0&&e.nextBlock>=e.firstBlock){let t=e.nextBlock,s=t-z+1n>e.firstBlock?t-z+1n:e.firstBlock;try{let i=(await Promise.all(b.flatMap(o=>[Y,Z].map(c=>p.getLogs({address:o,event:c,args:{owner:d},fromBlock:s,toBlock:t,strict:!0}))))).flat();if(i.length>K*2)throw new n("Hookr event page exceeds the bounded discovery limit. A dedicated position index is required.");let m=new Map;for(let o of i){let c=k(o.address),u=F(o.args.familyId);if(o.removed||!o.blockNumber||o.blockNumber<s||o.blockNumber>t||!b.includes(c)||o.args.owner!==d)throw new n("Hookr event page is incomplete or inconsistent with the requested wallet and block range.");let a=`${c}:${u}`;e.seen.has(a)||m.set(a,{launcher:c,familyId:u})}if(e.seen.size+m.size>K)throw new n("Hookr wallet history exceeds the bounded discovery limit. Completeness requires a dedicated position index.");e.candidates=[...m.values()];for(let o of m.keys())e.seen.add(o);e.nextBlock=s-1n}catch(i){g=!0,y.push(i instanceof n?i.message:"Hookr event history is unavailable for this block range. Retry this cursor; an empty page does not establish no positions.")}}let X=0;for(;!g&&e.candidates.length&&w.length<f&&X++<32;){let t=e.candidates[0],s=(i,m)=>U(p,t.launcher,M(t.launcher===k(h.launcherV1)?"launcherV1":"launcher"),i,m,e.block.number);try{let[i,m]=await Promise.all([s("familyOwner",[t.familyId]),s("memberCount",[t.familyId])]),o=N(i);if(BigInt(o)===0n)throw new n("Hookr family owner is unavailable for an indexed family.");if(o!==d){let u=t.launcher===k(h.launcherV1);A.push({launcher:t.launcher,familyId:t.familyId,owner:o,note:`This wallet launched or received this family but does not own it now, so it is not listed as a position.${u?` If it was moved into a Pay Later vault, read it with hookr_pay_later_vault {"familyId": "${t.familyId}"} (run_read_tool).`:""}`}),e.candidates.shift(),e.member=0;continue}let c=Number(S(m,8));if(c<1||c>8)throw new n("Hookr family member count is invalid.");for(;e.member<c&&w.length<f;){let u=e.member,a=D(await s("position",[t.familyId,u])),I=j(a.key);if(typeof a.tickLower!="number"||typeof a.tickUpper!="number")throw new n("Hookr family range is incomplete.");q(a.tickLower,a.tickUpper,I.tickSpacing);let G=S(a.liquidity,128),C=V(I);if(await s("poolFamily",[C])!==t.familyId)throw new n("Hookr position does not belong to this family.");let J=T({kind:"family",...t,member:String(u)});w.push({position:J,poolId:C,owner:d,liquidity:G.toString(),range:{tickLower:a.tickLower,tickUpper:a.tickUpper},poolKey:I}),e.member++}e.member===c&&(e.candidates.shift(),e.member=0)}catch(i){g=!0,y.push(i instanceof n?i.message:"Hookr family state is unavailable. Retry this cursor; no zero position is inferred.")}}await _(p,e.block);let x=!g&&e.nextBlock<e.firstBlock&&e.candidates.length===0;x||y.push("Discovery is incomplete. Continue nextCursor, including after an empty page. Current ownership is checked at the fixed snapshot; history gaps are not evidence of no positions.");let B=null;if(!x){for(;l.size>=ee;)l.delete(l.keys().next().value);B=Q(),e.expires=Date.now()+$,l.set(B,e)}return typeof r.cursor=="string"&&l.delete(r.cursor),{chainId:4663,blockNumber:e.block.number.toString(),blockHash:e.block.hash,positions:w,notOwned:A,nextCursor:B,complete:x,warnings:y,coverage:{custody:"reviewed Launcher families only",historyStartBlock:e.firstBlock.toString(),scannedFromBlock:e.nextBlock<e.block.number?(e.nextBlock+1n).toString():null,scannedThroughBlock:e.nextBlock<e.block.number?e.block.number.toString():null,snapshotBlock:e.block.number.toString()}}}}}export{le as a};
@@ -1 +1 @@
1
- import{a as A}from"./Q43WPRYU.js";import{a as i,b as w,c as b,e as C,f as x,g as h}from"./QP2B7AYX.js";import{a as o}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{b as f}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as g,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as B,parseAbiParameters as D,zeroAddress as R}from"viem";var L=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),N=D("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=B(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),O=B(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:{...y,description:"Address of the ERC-20 sale token to distribute in this auction."},amount:o('Amount of sale token in base units; use sale token decimals. Example: "1000000" = 1 sale token at 6 decimals.'),currency:{...y,description:"Payment currency address; the zero address means native ETH."},startBlock:o("Future block number at which auction bidding starts, as a decimal string."),endBlock:o("Block number at which auction bidding ends, as a decimal string."),claimBlock:o("First block number at which auction tokens can be claimed, as a decimal string."),tickSpacing:o("Auction price tick spacing in Q96 payment-currency base units per sale-token base unit."),floorPrice:o("Auction floor price in Q96 payment-currency base units per sale-token base unit."),requiredCurrencyRaised:o('Minimum amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),salt:{description:"Deployment salt as a 32-byte hex string; choose a fresh value for a new deployment.",type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{description:"Auction issuance steps; durations must cover endBlock minus startBlock and mps times duration must total 10000000.",type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:o("Issuance rate per block in MPS units; sum of mps times duration across steps must equal 10000000."),duration:o("Duration of this issuance step in blocks, as a decimal string.")}}}};function $(e,t){let r=i(e.startBlock,"startBlock",64),n=i(e.endBlock,"endBlock",64),c=i(e.claimBlock,"claimBlock",64);if(n<=r||c<n)throw new s("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new s("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new s("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let a=d,k=i(a.mps,"mps",24,!0),m=i(a.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(m)]).slice(2)}`,l+=k*m,p+=m}if(l!==10000000n||p!==n-r)throw new s("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S(N,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:r,endBlock:n,claimBlock:c,tickSpacing:i(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:i(e.floorPrice,"floorPrice"),requiredCurrencyRaised:i(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function z(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,r){h(t,Object.keys(v));let n=w(t.token),c=i(t.amount,"amount",128);if(n===R||n===b(t.currency))throw new s("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=$(t,r);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new s("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(f),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new s("Choose a future auction startBlock with time for confirmation and approvals.");let a=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[n,c,u,p,r]});if((await l.getCode({address:a})??"0x")!=="0x")throw new s("This auction already exists; choose a fresh salt or configuration.");let k=await C(e,n),m=[e.unsignedTx({to:A,data:g({abi:P,functionName:"create",args:[n,c,u,p]}),value:"0",chainId:f,description:`Create CCA ${a}; proceeds and unsold tokens go to ${r}.`}),e.unsignedTx({to:n,data:g({abi:I,functionName:"transfer",args:[a,c]}),value:"0",chainId:f,description:`Fund the factory-predicted auction ${a} with exactly ${c} base units of ${n}.`}),e.unsignedTx({to:a,data:g({abi:B(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:f,description:`Activate CCA ${a} after its sale tokens arrive.`})];return{...await x(e,m,r,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:a,sale:{token:k,amount:c.toString()}}}}]}}export{L as a,N as b,P as c,O as d,$ as e,z as f};
1
+ import{a as A}from"./W7BTXU3F.js";import{a as i,b as w,c as b,e as C,f as x,g as h}from"./PX2G2H6G.js";import{a as o}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{b as f}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as g,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as B,parseAbiParameters as D,zeroAddress as R}from"viem";var L=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),N=D("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=B(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),O=B(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:{...y,description:"Address of the ERC-20 sale token to distribute in this auction."},amount:o('Amount of sale token in base units; use sale token decimals. Example: "1000000" = 1 sale token at 6 decimals.'),currency:{...y,description:"Payment currency address; the zero address means native ETH."},startBlock:o("Future block number at which auction bidding starts, as a decimal string."),endBlock:o("Block number at which auction bidding ends, as a decimal string."),claimBlock:o("First block number at which auction tokens can be claimed, as a decimal string."),tickSpacing:o("Auction price tick spacing in Q96 payment-currency base units per sale-token base unit."),floorPrice:o("Auction floor price in Q96 payment-currency base units per sale-token base unit."),requiredCurrencyRaised:o('Minimum amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),salt:{description:"Deployment salt as a 32-byte hex string; choose a fresh value for a new deployment.",type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{description:"Auction issuance steps; durations must cover endBlock minus startBlock and mps times duration must total 10000000.",type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:o("Issuance rate per block in MPS units; sum of mps times duration across steps must equal 10000000."),duration:o("Duration of this issuance step in blocks, as a decimal string.")}}}};function $(e,t){let r=i(e.startBlock,"startBlock",64),n=i(e.endBlock,"endBlock",64),c=i(e.claimBlock,"claimBlock",64);if(n<=r||c<n)throw new s("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new s("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new s("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let a=d,k=i(a.mps,"mps",24,!0),m=i(a.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(m)]).slice(2)}`,l+=k*m,p+=m}if(l!==10000000n||p!==n-r)throw new s("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S(N,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:r,endBlock:n,claimBlock:c,tickSpacing:i(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:i(e.floorPrice,"floorPrice"),requiredCurrencyRaised:i(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function z(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,r){h(t,Object.keys(v));let n=w(t.token),c=i(t.amount,"amount",128);if(n===R||n===b(t.currency))throw new s("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=$(t,r);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new s("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(f),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new s("Choose a future auction startBlock with time for confirmation and approvals.");let a=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[n,c,u,p,r]});if((await l.getCode({address:a})??"0x")!=="0x")throw new s("This auction already exists; choose a fresh salt or configuration.");let k=await C(e,n),m=[e.unsignedTx({to:A,data:g({abi:P,functionName:"create",args:[n,c,u,p]}),value:"0",chainId:f,description:`Create CCA ${a}; proceeds and unsold tokens go to ${r}.`}),e.unsignedTx({to:n,data:g({abi:I,functionName:"transfer",args:[a,c]}),value:"0",chainId:f,description:`Fund the factory-predicted auction ${a} with exactly ${c} base units of ${n}.`}),e.unsignedTx({to:a,data:g({abi:B(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:f,description:`Activate CCA ${a} after its sale tokens arrive.`})];return{...await x(e,m,r,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:a,sale:{token:k,amount:c.toString()}}}}]}}export{L as a,N as b,P as c,O as d,$ as e,z as f};