@oakagentkit/core 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/build/dist/api/addresses.d.ts +1 -1
  2. package/build/dist/api/addresses.js +1 -1
  3. package/build/dist/api/amounts.js +1 -1
  4. package/build/dist/api/canonical.js +1 -1
  5. package/build/dist/api/chain.js +1 -1
  6. package/build/dist/api/errors.d.ts +1 -0
  7. package/build/dist/api/errors.js +1 -1
  8. package/build/dist/api/gas.d.ts +5 -0
  9. package/build/dist/api/gas.js +1 -0
  10. package/build/dist/api/grandfather.js +1 -1
  11. package/build/dist/api/history.js +1 -1
  12. package/build/dist/api/http.js +1 -1
  13. package/build/dist/api/identity-link.js +1 -1
  14. package/build/dist/api/merkle.js +1 -1
  15. package/build/dist/api/metadata.js +1 -1
  16. package/build/dist/api/module.js +1 -1
  17. package/build/dist/api/modules/beefy/index.js +1 -1
  18. package/build/dist/api/modules/clanker/index.js +1 -1
  19. package/build/dist/api/modules/erc8004/index.d.ts +11 -0
  20. package/build/dist/api/modules/erc8004/index.js +1 -1
  21. package/build/dist/api/modules/grove/index.js +1 -1
  22. package/build/dist/api/modules/heyresearch/index.js +1 -1
  23. package/build/dist/api/modules/hoodag/index.js +1 -1
  24. package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
  25. package/build/dist/api/modules/hoodlock/index.js +1 -1
  26. package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
  27. package/build/dist/api/modules/hookr/create-cancel.js +1 -1
  28. package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
  29. package/build/dist/api/modules/hookr/index.js +1 -1
  30. package/build/dist/api/modules/kyberswap/index.js +1 -1
  31. package/build/dist/api/modules/lighter/index.js +1 -1
  32. package/build/dist/api/modules/longbow/index.js +1 -1
  33. package/build/dist/api/modules/meridian/index.js +1 -1
  34. package/build/dist/api/modules/meridian/markets.js +1 -1
  35. package/build/dist/api/modules/meridian/rfq.js +1 -1
  36. package/build/dist/api/modules/merkl/index.js +1 -1
  37. package/build/dist/api/modules/morpho/index.js +1 -1
  38. package/build/dist/api/modules/netnet/index.js +1 -1
  39. package/build/dist/api/modules/orbio/index.js +1 -1
  40. package/build/dist/api/modules/pons/claim.js +1 -1
  41. package/build/dist/api/modules/pons/index.js +1 -1
  42. package/build/dist/api/modules/pons/launch-status.js +1 -1
  43. package/build/dist/api/modules/pons/prices.js +1 -1
  44. package/build/dist/api/modules/pons/trade.js +1 -1
  45. package/build/dist/api/modules/poolstrade/index.js +1 -1
  46. package/build/dist/api/modules/priors/index.js +1 -1
  47. package/build/dist/api/modules/relay/inbound.d.ts +2 -0
  48. package/build/dist/api/modules/relay/inbound.js +1 -1
  49. package/build/dist/api/modules/relay/index.js +1 -1
  50. package/build/dist/api/modules/relay/outbound-status.js +1 -1
  51. package/build/dist/api/modules/spark/index.js +1 -1
  52. package/build/dist/api/modules/steakhouse/index.js +1 -1
  53. package/build/dist/api/modules/tickerspring/index.js +1 -1
  54. package/build/dist/api/modules/uniswap/index.js +1 -1
  55. package/build/dist/api/modules/uniswap/v3.js +1 -1
  56. package/build/dist/api/modules/uniswap/v4.js +1 -1
  57. package/build/dist/api/modules/velora/index.js +1 -1
  58. package/build/dist/api/positions.js +1 -1
  59. package/build/dist/api/pricenote.js +1 -1
  60. package/build/dist/api/prices.js +1 -1
  61. package/build/dist/api/pricing.js +1 -1
  62. package/build/dist/api/routes.js +1 -1
  63. package/build/dist/api/secret-fields.js +1 -1
  64. package/build/dist/api/simulate.js +1 -1
  65. package/build/dist/api/swap.d.ts +5 -1
  66. package/build/dist/api/swap.js +1 -1
  67. package/build/dist/api/tokens.js +1 -1
  68. package/build/dist/api/tx.js +1 -1
  69. package/build/dist/api/types.d.ts +3 -0
  70. package/build/dist/api/vendor-limits.js +1 -1
  71. package/build/dist/chunks/{OOSNTGDJ.js → 5B3UVWMV.js} +1 -1
  72. package/build/dist/chunks/5BP72XOA.js +1 -0
  73. package/build/dist/chunks/5SH3C7XP.js +1 -0
  74. package/build/dist/chunks/{YEE3KKTA.js → 6YQ2RX5I.js} +1 -1
  75. package/build/dist/chunks/{64EN6Y7E.js → 74X7PXPR.js} +1 -1
  76. package/build/dist/chunks/{B5RZYFQC.js → 7I6TXFXR.js} +1 -1
  77. package/build/dist/chunks/A5O3SRHY.js +1 -0
  78. package/build/dist/chunks/{D45AODDL.js → B2LA6VVF.js} +1 -1
  79. package/build/dist/chunks/{ZERWRK6X.js → CWQ5WXZQ.js} +1 -1
  80. package/build/dist/chunks/{YTHDLCHL.js → F3TOOLFQ.js} +1 -1
  81. package/build/dist/chunks/GOIVHR4B.js +1 -0
  82. package/build/dist/chunks/{47PKSOXA.js → M643PYHO.js} +1 -1
  83. package/build/dist/chunks/{P7Q6MJZH.js → MEZH7RPA.js} +1 -1
  84. package/build/dist/chunks/{AE6YEEZP.js → NDHEJGWR.js} +1 -1
  85. package/build/dist/chunks/NNJLMS7F.js +1 -0
  86. package/build/dist/chunks/{ZKOMJGNH.js → PQHU5A3U.js} +1 -1
  87. package/build/dist/chunks/{UL2L7NHO.js → R5CBH2CR.js} +1 -1
  88. package/build/dist/chunks/{VZPFBWVH.js → RYOVSHKO.js} +1 -1
  89. package/build/dist/chunks/{75D6Q7L3.js → SUQ6PIAV.js} +1 -1
  90. package/build/dist/chunks/{KFMNCJXJ.js → SXBGOGYQ.js} +1 -1
  91. package/build/dist/chunks/{LZK6C5LT.js → T4IYMYZD.js} +1 -1
  92. package/build/dist/chunks/{IABIXUNX.js → TFYLOWFO.js} +1 -1
  93. package/build/dist/chunks/{ZUAXW2ZD.js → TU3KHOZK.js} +1 -1
  94. package/build/dist/chunks/{SGDWO7XI.js → UB5U6SI2.js} +1 -1
  95. package/build/dist/chunks/UIJWIFGV.js +1 -0
  96. package/build/dist/chunks/{VZWOWR6G.js → VBWJOG3N.js} +1 -1
  97. package/build/dist/chunks/{KP7VSXIQ.js → WFE3NXBF.js} +1 -1
  98. package/build/dist/chunks/XAB4OIE3.js +1 -0
  99. package/build/dist/chunks/XEN45QST.js +1 -0
  100. package/build/dist/chunks/{MGEJPRXP.js → XKZOMGC3.js} +1 -1
  101. package/build/dist/chunks/{JMPOXXNJ.js → XTUXR43N.js} +1 -1
  102. package/build/dist/chunks/{UZH4FQEL.js → Y2SGXWFM.js} +1 -1
  103. package/build/dist/chunks/Z3FZWNAJ.js +1 -0
  104. package/build/dist/chunks/Z53DADZ4.js +1 -0
  105. package/build/dist/chunks/ZJUNO5N7.js +1 -0
  106. package/build/dist/chunks/ZZLHDHOT.js +1 -0
  107. package/package.json +9 -13
  108. package/build/dist/chunks/24JYIH53.js +0 -1
  109. package/build/dist/chunks/25EOXUBI.js +0 -1
  110. package/build/dist/chunks/4P6XI564.js +0 -1
  111. package/build/dist/chunks/6YU3JLQQ.js +0 -1
  112. package/build/dist/chunks/BH3CI6WO.js +0 -1
  113. package/build/dist/chunks/CUBRTOMA.js +0 -1
  114. package/build/dist/chunks/FSSCJNAQ.js +0 -1
  115. package/build/dist/chunks/S3YSJ7XH.js +0 -1
  116. package/build/dist/chunks/T5E4OJEU.js +0 -1
  117. package/build/dist/chunks/VBV366XQ.js +0 -1
  118. package/build/dist/chunks/XUL6NKAK.js +0 -1
@@ -3,7 +3,7 @@ export declare const CHAIN_ID: 4663;
3
3
  export declare const TESTNET_CHAIN_ID: 46630;
4
4
  export declare const OAK_DECIMALS: 18;
5
5
  export declare const USDG_DECIMALS: 6;
6
- export declare const OAK_FINALITY: "finalized";
6
+ export declare const OAK_FINALITY: 30;
7
7
  export declare const recipientAuthority: "recipient";
8
8
  export declare const feeMode: "direct";
9
9
  export declare const supplyNetRule: "totalSupply";
@@ -1 +1 @@
1
- import{A,B,C,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunks/25EOXUBI.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{i as ADDRESSES,a as CHAIN_ID,p as ETH_USDG_POOL,o as FEE_ESCROW,y as MODULE_CALL_SOURCES,t as NETWORKS,c as OAK_DECIMALS,e as OAK_FINALITY,l as PONS_FACTORY,m as PONS_HOOK,n as POOL_MANAGER,x as RECORDED_CALLS,A as ROUTE_EXECUTORS,z as ROUTE_SELECTORS,b as TESTNET_CHAIN_ID,k as TEST_USDG,s as TEST_USDG_CONFIG,r as TEST_USDG_DOMAIN,j as USDG,d as USDG_DECIMALS,q as USDG_DOMAIN,B as VELORA_ANON_PARTNER_AND_FEE,C as VELORA_EXECUTORS,w as assertNetworkRpc,v as assertNetworkUsdg,g as feeMode,f as recipientAuthority,u as resolveNetwork,h as supplyNetRule};
1
+ import{A,B,C,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunks/5BP72XOA.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{i as ADDRESSES,a as CHAIN_ID,p as ETH_USDG_POOL,o as FEE_ESCROW,y as MODULE_CALL_SOURCES,t as NETWORKS,c as OAK_DECIMALS,e as OAK_FINALITY,l as PONS_FACTORY,m as PONS_HOOK,n as POOL_MANAGER,x as RECORDED_CALLS,A as ROUTE_EXECUTORS,z as ROUTE_SELECTORS,b as TESTNET_CHAIN_ID,k as TEST_USDG,s as TEST_USDG_CONFIG,r as TEST_USDG_DOMAIN,j as USDG,d as USDG_DECIMALS,q as USDG_DOMAIN,B as VELORA_ANON_PARTNER_AND_FEE,C as VELORA_EXECUTORS,w as assertNetworkRpc,v as assertNetworkUsdg,g as feeMode,f as recipientAuthority,u as resolveNetwork,h as supplyNetRule};
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"../chunks/B5RZYFQC.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{a as baseUnits,e as convertAmount,c as formatAmount,d as mulDiv,b as parseAmount};
1
+ import{a,b,c,d,e}from"../chunks/7I6TXFXR.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{a as baseUnits,e as convertAmount,c as formatAmount,d as mulDiv,b as parseAmount};
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunks/KP7VSXIQ.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{a as canonicalJson,b as canonicalJsonBytes,c as canonicalJsonSha256,d as isCanonical};
1
+ import{a,b,c,d}from"../chunks/WFE3NXBF.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{a as canonicalJson,b as canonicalJsonBytes,c as canonicalJsonSha256,d as isCanonical};
@@ -1 +1 @@
1
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j}from"../chunks/UL2L7NHO.js";import"../chunks/25EOXUBI.js";import{c as a}from"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{b as DEFAULT_RPC_URL,c as DEFAULT_USER_AGENT,d as MULTICALL3_ADDRESS,g as RPC_TIMEOUT_MS,j as createClientFor,e as getChainDefinition,i as getClient,f as getMulticall3Address,a as plainError,h as withRpcTimeout};
1
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j}from"../chunks/R5CBH2CR.js";import"../chunks/5BP72XOA.js";import{d as a}from"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{b as DEFAULT_RPC_URL,c as DEFAULT_USER_AGENT,d as MULTICALL3_ADDRESS,g as RPC_TIMEOUT_MS,j as createClientFor,e as getChainDefinition,i as getClient,f as getMulticall3Address,a as plainError,h as withRpcTimeout};
@@ -3,4 +3,5 @@ export declare class OakError extends Error {
3
3
  name: string;
4
4
  }
5
5
  export declare function hasErrorCode(error: unknown, ...codes: number[]): boolean;
6
+ export declare function hasInsufficientFunds(error: unknown): boolean;
6
7
  export declare function plainError(error: unknown): string;
@@ -1 +1 @@
1
- import{a as b,b as c,c as d}from"../chunks/T5E4OJEU.js";import{a}from"../chunks/XN4WDN3O.js";export{b as OakError,c as hasErrorCode,d as plainError,a as untrustedText};
1
+ import{a as b,b as c,c as d,d as e}from"../chunks/Z3FZWNAJ.js";import{a}from"../chunks/XN4WDN3O.js";export{b as OakError,c as hasErrorCode,d as hasInsufficientFunds,e as plainError,a as untrustedText};
@@ -0,0 +1,5 @@
1
+ import type { Address } from './types.js';
2
+ export declare const SIMULATION_GAS_CAP = 10000000n;
3
+ export declare function simulationGasLimit(blockGasLimit?: bigint, estimate?: bigint): bigint;
4
+ export declare function gasShortage(address: Address, chainId: number, needed: bigint, held: bigint): string;
5
+ export declare function affordableSimulationGas(gas: bigint, balance: bigint, value: bigint, price: bigint, wallet: Address, chainId: number): bigint;
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"../chunks/XAB4OIE3.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{a as SIMULATION_GAS_CAP,d as affordableSimulationGas,c as gasShortage,b as simulationGasLimit};
@@ -1 +1 @@
1
- import{a as P,b as y,c as m,e as v,f as R,h as I}from"../chunks/YEE3KKTA.js";import"../chunks/KP7VSXIQ.js";import{a as x}from"../chunks/B5RZYFQC.js";import{a as i}from"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";import{createHash as H}from"node:crypto";import{getAddress as L,isAddress as k}from"viem";var E=0,T=1,N=2,V=120,X=10368e3,W="0x0000000000000000000000000000000000000000",_=(1n<<256n)-1n;function $(e,r){if(typeof e!="string"||!k(e,{strict:!1}))throw new i(`Invalid ${r} address.`);return L(e)}function h(e,r){return $(e,r).toLowerCase()}function M(e,r="count"){let s=typeof e=="bigint"?e:x(e);if(s<0n||s>_)throw new i(`${r} exceeds uint256 bounds.`);return s}function C(e,r){if(r)return"none";if(e==="holder"||e===T)return"holder";if(e==="nohold"||e===N)return"nohold";if(e==="none"||e===E)return"none";throw new i(`Invalid or missing subscription plan: ${String(e)}`)}function O(e){if(!e||typeof e!="object")return!1;let r=e;return Array.isArray(r.records)||"deployBlock"in r&&("address"in r||"contract"in r)||"previous"in r&&("address"in r||"contract"in r)&&!("wallet"in r)}function D(e,r=!0){if(e.length<=1)return[...e];let s=new Map,c=e.some(n=>n.previous!==void 0&&n.previous!==null);for(let n of e){let a=n.address??n.contract;if(!a)throw new i("Each ancestor in the lineage must specify an address.");let d=h(a,"ancestor");if(s.has(d))throw new i(`Duplicate ancestor contract in lineage: ${d}`);s.set(d,n)}if(!c)return r?[...e].reverse():[...e];let l=new Map,u=new Map;for(let[n,a]of s.entries()){let d=a.previous;if(d===void 0)throw new i(`Ancestor ${n} is missing its previous() pointer in a linked lineage.`);if(d===null||h(d,"previous")===W)l.set(n,null);else{let f=h(d,"previous");if(f===n)throw new i(`Ancestor ${n} cannot reference itself as previous.`);if(l.set(n,f),s.has(f)){if(u.has(f))throw new i(`Multiple ancestors claim ${f} as previous.`);u.set(f,n)}}}let p=[...s.keys()].filter(n=>{let a=l.get(n);return a==null||!s.has(a)});if(p.length!==1)throw new i("Lineage ancestors must form a single unbroken previous() chain.");let w=[],t=new Set,o=p[0];for(;o!==void 0;){if(t.has(o))throw new i("Cycle detected in subscription ancestor lineage.");t.add(o),w.push(s.get(o)),o=u.get(o)}if(w.length!==e.length)throw new i("Disconnected ancestor detected in subscription lineage.");return w}function F(e){if(e.hasRecord===!1||C(e.plan,e.cancelled)!=="holder")return null;let s=e.count??e.signupOakCount;if(s===void 0)throw new i(`Holder record for wallet ${e.wallet} is missing count.`);let c=M(s,"count");if(c<=0n)return null;let l=e.source??e.contract??e.ancestor;if(!l)throw new i(`Record for wallet ${e.wallet} is missing source contract address.`);let u=h(l,"source");return{count:c.toString(),source:u}}function b(e,r){if(e===null||typeof e!="object")throw new i("Grandfather records input must be an array or lineage object.");if(!Array.isArray(e)){let t=e;if(Array.isArray(t.ancestors))return b(t.ancestors,{...r,newestFirst:r?.newestFirst??t.newestFirst});if(Array.isArray(t.records))return b(t.records,{...r,lineage:r?.lineage??t.lineage,newestFirst:r?.newestFirst??t.newestFirst});throw new i("Grandfather lineage object must contain ancestors or records.")}if(e.length===0)return[];if(e.every(O)){let t=D(e,r?.newestFirst??!0),o=new Map;for(let a of t){let d=h(a.address??a.contract,"ancestor"),f=a.records??[],A=new Set;for(let g of f){let G=h(g.wallet,"wallet");if(A.has(G))throw new i(`Duplicate wallet record ${G} within ancestor ${d}.`);A.add(G),g.hasRecord!==!1&&o.set(G,{...g,wallet:G,source:d})}}let n=[];for(let[a,d]of o.entries()){let f=F(d);f&&n.push({wallet:a,count:f.count,source:f.source})}return n}let s=e,c=r?.lineage??r?.ancestors,l=r?.newestFirst??!0,u=new Map;if(c&&c.length>0)if(c.every(t=>typeof t=="string")){let t=c.map(n=>h(n,"lineage"));(l?[...t].reverse():[...t]).forEach((n,a)=>u.set(n,a))}else D(c,l).forEach((o,n)=>{let a=h(o.address??o.contract,"ancestor");u.set(a,n)});let p=new Map;for(let t=0;t<s.length;t++){let o=s[t],n=h(o.wallet,"wallet");if(o.hasRecord===!1)continue;let a=o.source??o.contract??o.ancestor;if(!a)throw new i(`Grandfather record for wallet ${n} requires a source address.`);let d=h(a,"source"),f=u.get(d);if(u.size>0&&f===void 0)throw new i(`Record source ${d} is not in the subscription lineage.`);let A=f??t,g=p.get(n);if(g){if(g.source===d)throw new i(`Duplicate wallet in grandfather entries: ${n}`);A>=g.rank&&p.set(n,{record:{...o,wallet:n,source:d},rank:A,source:d})}else p.set(n,{record:{...o,wallet:n,source:d},rank:A,source:d})}let w=[];for(let[t,{record:o}]of p.entries()){let n=F(o);n&&w.push({wallet:t,count:n.count,source:n.source})}return w}function S(e,r){let s=b(e,r),c=R(s),l=new TextEncoder().encode(c.canonicalJson),u=`0x${H("sha256").update(l).digest("hex")}`;return{...c,bytes:l,canonicalJsonSha256:u}}var Y=S;function j(e,r){return e&&typeof e=="object"&&!Array.isArray(e)&&"schema"in e&&e.schema===y&&"root"in e&&"entries"in e?e:S(e,r)}function Z(e,r,s){let c=h(r,"wallet"),l=j(e,s);return l.entries.some(p=>p.wallet.toLowerCase()===c)?I(l,c):null}function K(e,r,s){let c=typeof e=="string"?e:e.root,l=typeof r=="string"?r:m(r);return v(c,l,s)}export{y as GRANDFATHER_SCHEMA,V as GRANDFATHER_WINDOW_DAYS,X as GRANDFATHER_WINDOW_SECONDS,P as LEAF_GRANDFATHER,T as PLAN_HOLDER,E as PLAN_NONE,N as PLAN_NO_HOLD,R as buildGrandfatherTree,m as grandfatherLeaf,Z as grandfatherProofFor,C as normalizePlan,D as orderAncestorsOldestFirst,b as resolveAuthoritativeEntries,S as resolveGrandfatherLineage,Y as resolveGrandfatherList,K as verifyGrandfatherProof};
1
+ import{a as P,b as y,c as m,e as v,f as R,h as I}from"../chunks/6YQ2RX5I.js";import{a as x}from"../chunks/7I6TXFXR.js";import"../chunks/WFE3NXBF.js";import{a as i}from"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";import{createHash as H}from"node:crypto";import{getAddress as L,isAddress as k}from"viem";var E=0,T=1,N=2,V=120,X=10368e3,W="0x0000000000000000000000000000000000000000",_=(1n<<256n)-1n;function $(e,r){if(typeof e!="string"||!k(e,{strict:!1}))throw new i(`Invalid ${r} address.`);return L(e)}function h(e,r){return $(e,r).toLowerCase()}function M(e,r="count"){let s=typeof e=="bigint"?e:x(e);if(s<0n||s>_)throw new i(`${r} exceeds uint256 bounds.`);return s}function C(e,r){if(r)return"none";if(e==="holder"||e===T)return"holder";if(e==="nohold"||e===N)return"nohold";if(e==="none"||e===E)return"none";throw new i(`Invalid or missing subscription plan: ${String(e)}`)}function O(e){if(!e||typeof e!="object")return!1;let r=e;return Array.isArray(r.records)||"deployBlock"in r&&("address"in r||"contract"in r)||"previous"in r&&("address"in r||"contract"in r)&&!("wallet"in r)}function D(e,r=!0){if(e.length<=1)return[...e];let s=new Map,c=e.some(n=>n.previous!==void 0&&n.previous!==null);for(let n of e){let a=n.address??n.contract;if(!a)throw new i("Each ancestor in the lineage must specify an address.");let d=h(a,"ancestor");if(s.has(d))throw new i(`Duplicate ancestor contract in lineage: ${d}`);s.set(d,n)}if(!c)return r?[...e].reverse():[...e];let l=new Map,u=new Map;for(let[n,a]of s.entries()){let d=a.previous;if(d===void 0)throw new i(`Ancestor ${n} is missing its previous() pointer in a linked lineage.`);if(d===null||h(d,"previous")===W)l.set(n,null);else{let f=h(d,"previous");if(f===n)throw new i(`Ancestor ${n} cannot reference itself as previous.`);if(l.set(n,f),s.has(f)){if(u.has(f))throw new i(`Multiple ancestors claim ${f} as previous.`);u.set(f,n)}}}let p=[...s.keys()].filter(n=>{let a=l.get(n);return a==null||!s.has(a)});if(p.length!==1)throw new i("Lineage ancestors must form a single unbroken previous() chain.");let w=[],t=new Set,o=p[0];for(;o!==void 0;){if(t.has(o))throw new i("Cycle detected in subscription ancestor lineage.");t.add(o),w.push(s.get(o)),o=u.get(o)}if(w.length!==e.length)throw new i("Disconnected ancestor detected in subscription lineage.");return w}function F(e){if(e.hasRecord===!1||C(e.plan,e.cancelled)!=="holder")return null;let s=e.count??e.signupOakCount;if(s===void 0)throw new i(`Holder record for wallet ${e.wallet} is missing count.`);let c=M(s,"count");if(c<=0n)return null;let l=e.source??e.contract??e.ancestor;if(!l)throw new i(`Record for wallet ${e.wallet} is missing source contract address.`);let u=h(l,"source");return{count:c.toString(),source:u}}function b(e,r){if(e===null||typeof e!="object")throw new i("Grandfather records input must be an array or lineage object.");if(!Array.isArray(e)){let t=e;if(Array.isArray(t.ancestors))return b(t.ancestors,{...r,newestFirst:r?.newestFirst??t.newestFirst});if(Array.isArray(t.records))return b(t.records,{...r,lineage:r?.lineage??t.lineage,newestFirst:r?.newestFirst??t.newestFirst});throw new i("Grandfather lineage object must contain ancestors or records.")}if(e.length===0)return[];if(e.every(O)){let t=D(e,r?.newestFirst??!0),o=new Map;for(let a of t){let d=h(a.address??a.contract,"ancestor"),f=a.records??[],A=new Set;for(let g of f){let G=h(g.wallet,"wallet");if(A.has(G))throw new i(`Duplicate wallet record ${G} within ancestor ${d}.`);A.add(G),g.hasRecord!==!1&&o.set(G,{...g,wallet:G,source:d})}}let n=[];for(let[a,d]of o.entries()){let f=F(d);f&&n.push({wallet:a,count:f.count,source:f.source})}return n}let s=e,c=r?.lineage??r?.ancestors,l=r?.newestFirst??!0,u=new Map;if(c&&c.length>0)if(c.every(t=>typeof t=="string")){let t=c.map(n=>h(n,"lineage"));(l?[...t].reverse():[...t]).forEach((n,a)=>u.set(n,a))}else D(c,l).forEach((o,n)=>{let a=h(o.address??o.contract,"ancestor");u.set(a,n)});let p=new Map;for(let t=0;t<s.length;t++){let o=s[t],n=h(o.wallet,"wallet");if(o.hasRecord===!1)continue;let a=o.source??o.contract??o.ancestor;if(!a)throw new i(`Grandfather record for wallet ${n} requires a source address.`);let d=h(a,"source"),f=u.get(d);if(u.size>0&&f===void 0)throw new i(`Record source ${d} is not in the subscription lineage.`);let A=f??t,g=p.get(n);if(g){if(g.source===d)throw new i(`Duplicate wallet in grandfather entries: ${n}`);A>=g.rank&&p.set(n,{record:{...o,wallet:n,source:d},rank:A,source:d})}else p.set(n,{record:{...o,wallet:n,source:d},rank:A,source:d})}let w=[];for(let[t,{record:o}]of p.entries()){let n=F(o);n&&w.push({wallet:t,count:n.count,source:n.source})}return w}function S(e,r){let s=b(e,r),c=R(s),l=new TextEncoder().encode(c.canonicalJson),u=`0x${H("sha256").update(l).digest("hex")}`;return{...c,bytes:l,canonicalJsonSha256:u}}var Y=S;function j(e,r){return e&&typeof e=="object"&&!Array.isArray(e)&&"schema"in e&&e.schema===y&&"root"in e&&"entries"in e?e:S(e,r)}function Z(e,r,s){let c=h(r,"wallet"),l=j(e,s);return l.entries.some(p=>p.wallet.toLowerCase()===c)?I(l,c):null}function K(e,r,s){let c=typeof e=="string"?e:e.root,l=typeof r=="string"?r:m(r);return v(c,l,s)}export{y as GRANDFATHER_SCHEMA,V as GRANDFATHER_WINDOW_DAYS,X as GRANDFATHER_WINDOW_SECONDS,P as LEAF_GRANDFATHER,T as PLAN_HOLDER,E as PLAN_NONE,N as PLAN_NO_HOLD,R as buildGrandfatherTree,m as grandfatherLeaf,Z as grandfatherProofFor,C as normalizePlan,D as orderAncestorsOldestFirst,b as resolveAuthoritativeEntries,S as resolveGrandfatherLineage,Y as resolveGrandfatherList,K as verifyGrandfatherProof};
@@ -1 +1 @@
1
- import{a as Y}from"../chunks/XUL6NKAK.js";import{A as Q}from"../chunks/47PKSOXA.js";import"../chunks/VZPFBWVH.js";import"../chunks/MGEJPRXP.js";import"../chunks/ZKOMJGNH.js";import"../chunks/YTHDLCHL.js";import"../chunks/KFMNCJXJ.js";import"../chunks/6YU3JLQQ.js";import"../chunks/D45AODDL.js";import"../chunks/24JYIH53.js";import"../chunks/VBV366XQ.js";import"../chunks/S3YSJ7XH.js";import"../chunks/LIUXNOLP.js";import"../chunks/P7Q6MJZH.js";import"../chunks/ZUAXW2ZD.js";import"../chunks/64EN6Y7E.js";import"../chunks/SGDWO7XI.js";import"../chunks/Z25UKUJF.js";import{a as F}from"../chunks/VZWOWR6G.js";import"../chunks/5HCXZWUH.js";import{h as J}from"../chunks/UL2L7NHO.js";import{a as N,i as q,t as z}from"../chunks/25EOXUBI.js";import"../chunks/B5RZYFQC.js";import{a as L,c as V}from"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";import{decodeEventLog as _,erc20Abi as ie,getAddress as x,isAddress as O,pad as ae,parseAbi as Z}from"viem";var X=[{inputs:[],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"expiresAt",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"grandfathered",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"hasRecord",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"holderOpen",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],name:"noteUsed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"paidUntil",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"plan",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"previous",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"quoteHolder",outputs:[{internalType:"uint256",name:"count",type:"uint256"},{internalType:"uint256",name:"burn",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"quoteNoHold",outputs:[{internalType:"uint256",name:"price",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renew",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"maxPrice",type:"uint256"},{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"renewNoHold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"usdgAuth",type:"bytes"}],name:"renewWithAuthorization",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"retire",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"retired",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"root",type:"bytes32"},{internalType:"uint64",name:"deadline",type:"uint64"}],name:"setGrandfatherRoot",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"burner",type:"address"},{internalType:"address",name:"treasury",type:"address"}],name:"setPayees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"signupOakCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint8",name:"plan",type:"uint8"},{internalType:"uint256",name:"maxCount",type:"uint256"},{internalType:"uint256",name:"maxPrice",type:"uint256"},{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"subscribe",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count",type:"uint256"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}],name:"subscribeGrandfathered",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count",type:"uint256"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"},{internalType:"bytes",name:"usdgAuth",type:"bytes"}],name:"subscribeGrandfatheredWithAuthorization",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"maxCount",type:"uint256"},{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"bytes",name:"usdgAuth",type:"bytes"}],name:"subscribeWithAuthorization",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"sweepToTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint64",name:"at",type:"uint64"}],name:"Cancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"root",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"deadline",type:"uint64"}],name:"GrandfatherRootSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint8",name:"plan",type:"uint8"},{indexed:!1,internalType:"uint64",name:"paidUntil",type:"uint64"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"Renewed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"at",type:"uint64"}],name:"Retired",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint8",name:"plan",type:"uint8"},{indexed:!1,internalType:"uint64",name:"paidUntil",type:"uint64"},{indexed:!1,internalType:"uint256",name:"signupOakCount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oakBurned",type:"uint256"},{indexed:!1,internalType:"bool",name:"grandfathered",type:"bool"}],name:"Subscribed",type:"event"},{inputs:[],name:"HolderClosed",type:"error"},{inputs:[],name:"NoteUsed",type:"error"}];var oe=50,Ae=10000n;function He(e){let t=Object.values(z).find(s=>s.chainId===e);if(!t)throw new L("History modules are not configured for this chain.");let n=[{module:"erc8004",contracts:[t.identityRegistry],abi:Y}];if(e!==N)return n;let r=q[N],u=Z(["event Deposit(address indexed sender,address indexed owner,uint256 assets,uint256 shares)","event Withdraw(address indexed sender,address indexed receiver,address indexed owner,uint256 assets,uint256 shares)"]);for(let[s,g]of Object.entries(r.vaults)){if(s==="morphoV2Factory"||s==="beefyTestedLpVault")continue;let h=s.startsWith("longbow")?"longbow":s==="groveAlm"?"grove":s;n.push({module:h,contracts:[g.address],abi:u})}return n.push({module:"hookr",contracts:[r.hookr.HookrLimitOrders.address],abi:Q},{module:"orbio",contracts:[r.orbio.credit.address],abi:Z(["event Activated(uint256 indexed activationId,address indexed by,bytes32 indexed ref,uint256 amount)"])}),n}var ue=X,ee=new WeakMap;function E(e){if(e==null)return null;if(typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(typeof e=="bigint")return e.toString();if(Array.isArray(e))return e.map(E);if(typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=E(r);return t}return String(e)}function k(e,t="0"){return e===void 0?t:typeof e=="bigint"?e.toString():typeof e=="number"?BigInt(Math.trunc(e)).toString():BigInt(e).toString()}function le(e){let t=[];e.subscriptionAddress&&t.push(e.subscriptionAddress),e.retiredSubscriptionAddresses&&t.push(...e.retiredSubscriptionAddresses),e.subscriptionAddresses&&t.push(...e.subscriptionAddresses),process.env.OAK_SUBSCRIPTION_ADDRESS&&t.push(process.env.OAK_SUBSCRIPTION_ADDRESS),process.env.OAK_RETIRED_SUBSCRIPTION_ADDRESSES&&t.push(...process.env.OAK_RETIRED_SUBSCRIPTION_ADDRESSES.split(",").map(r=>r.trim()).filter(Boolean));let n=new Set;for(let r of t)O(r,{strict:!1})&&n.add(r.toLowerCase());return n}function te(e){let t=Number(e);return t===1?"holder":t===2?"nohold":t===0?"none":String(e)}function de(e,t,n,r){if(!e.topics.length)return null;try{let u=_({abi:ue,data:e.data,topics:e.topics}),s=u.args??{},g=x(e.address),h=k(e.blockNumber),o=t.toLowerCase();if(u.eventName==="Subscribed"){let m=typeof s.wallet=="string"?x(s.wallet):void 0;if(!m||m.toLowerCase()!==o)return null;let p=te(s.plan),A=k(s.paidUntil),H=k(s.signupOakCount),C=k(s.oakBurned),S=!!s.grandfathered;return{transactionHash:e.transactionHash,blockNumber:h,logIndex:e.logIndex,timestamp:r,chainId:n,contract:g,module:"subscription",event:"Subscribed",args:{wallet:m,plan:p,paidUntil:A,signupOakCount:H,oakBurned:C,grandfathered:S},description:S?`Grandfathered ${p} subscription until ${A}.`:`Subscribed to ${p} plan until ${A}.`}}if(u.eventName==="Renewed"){let m=typeof s.wallet=="string"?x(s.wallet):void 0;if(!m||m.toLowerCase()!==o)return null;let p=te(s.plan),A=k(s.paidUntil),H=k(s.amountPaid);return{transactionHash:e.transactionHash,blockNumber:h,logIndex:e.logIndex,timestamp:r,chainId:n,contract:g,module:"subscription",event:"Renewed",args:{wallet:m,plan:p,paidUntil:A,amountPaid:H},description:`Renewed ${p} subscription until ${A} for ${H} USDG base units.`}}if(u.eventName==="Cancelled"){let m=typeof s.wallet=="string"?x(s.wallet):void 0;if(!m||m.toLowerCase()!==o)return null;let p=k(s.at);return{transactionHash:e.transactionHash,blockNumber:h,logIndex:e.logIndex,timestamp:r,chainId:n,contract:g,module:"subscription",event:"Cancelled",args:{wallet:m,at:p},description:`Cancelled subscription at ${p}.`}}return null}catch{return null}}function v(e,t){return typeof e=="string"?O(e,{strict:!1})&&e.toLowerCase()===t:Array.isArray(e)?e.some(n=>v(n,t)):e!==null&&typeof e=="object"?Object.values(e).some(n=>v(n,t)):!1}function D(e){return typeof e=="string"?O(e,{strict:!1}):Array.isArray(e)?e.some(t=>D(t)):e!==null&&typeof e=="object"?Object.values(e).some(t=>D(t)):!1}function ne(e,t){if(e.length<=1)return!1;let n=ae(t).toLowerCase(),r=t.slice(2).toLowerCase();return e.slice(1).some(u=>{let s=u.toLowerCase();return s===n||s.length===66&&s.startsWith("0x000000000000000000000000")&&s.endsWith(r)})}function ce(e,t){if(!e||e==="0x")return!1;let n=e.slice(2).toLowerCase(),r=`000000000000000000000000${t.slice(2).toLowerCase()}`;for(let u=0;u+64<=n.length;u+=64)if(n.slice(u,u+64)===r)return!0;return!1}function W(e,t){return e.module||e.name||`module_${t}`}function se(e,t,n,r,u,s){let g=W(t,n),h=r.toLowerCase();if(t.contracts&&t.contracts.length>0){let o=e.address.toLowerCase();if(!t.contracts.some(p=>p.toLowerCase()===o))return null}if(t.decodeLog){let o=t.decodeLog(e,{wallet:r,chainId:u,timestamp:s});if(!o||t.filterWallet&&!t.filterWallet(o.args,r))return null;if(D(o.args)){if(!v(o.args,h))return null}else if(!ne(e.topics,r)&&!ce(e.data,r)&&!o.description.toLowerCase().includes(h))return null;return{...o,timestamp:o.timestamp&&o.timestamp!=="0"?o.timestamp:s,module:o.module||g}}if(!t.abi||!e.topics.length)return null;try{let o=_({abi:t.abi,data:e.data,topics:e.topics}),m=o.args??{},p={};for(let[C,S]of Object.entries(m))/^\d+$/.test(C)||(p[C]=typeof S=="string"&&O(S,{strict:!1})?x(S):E(S));if(!(t.filterWallet?t.filterWallet(p,r):v(m,h)||ne(e.topics,r)))return null;let H=o.eventName??"Event";return{transactionHash:e.transactionHash,blockNumber:k(e.blockNumber),logIndex:e.logIndex,timestamp:s,chainId:u,contract:x(e.address),module:g,event:H,args:p,description:`${g} ${H} on ${x(e.address)}.`}}catch{return null}}function pe(e,t,n,r){if(e.topics.length!==3)return null;try{let u=_({abi:ie,data:e.data,topics:e.topics});if(u.eventName!=="Transfer")return null;let s=u.args,g=x(s.from),h=x(s.to),o=t.toLowerCase();if(g.toLowerCase()!==o&&h.toLowerCase()!==o)return null;let m=s.value.toString(),p=x(e.address);return{transactionHash:e.transactionHash,blockNumber:k(e.blockNumber),logIndex:e.logIndex,timestamp:r,chainId:n,contract:p,module:"token",event:"Transfer",args:{from:g,to:h,value:m},description:`Transferred ${m} token base units from ${g} to ${h}.`}}catch{return null}}function me(e,t){let n=BigInt(e.blockNumber),r=BigInt(t.blockNumber);return n<r?-1:n>r?1:e.logIndex-t.logIndex}function P(e,t,n,r){let u=V(t);return{transactionHash:"0x"+"0".repeat(64),blockNumber:"0",logIndex:0,timestamp:"0",chainId:n,contract:r?x(r):"0x"+"0".repeat(40),module:e,event:"error",args:{error:u},description:`${e}: ${u}`}}async function Se(e,t=oe,n={}){if(F(e),!Number.isInteger(t)||t<=0)throw new L("History limit must be a positive integer.");let r=x(e),u=r.toLowerCase(),s=n.chainId??N,g=le(n),h=n.readers??[],o=h.filter(i=>typeof i=="object"&&i!==null),m=h.filter(i=>typeof i=="function"),p=n.client,A=()=>(p||(p=J(n.rpcUrl,s)),p),H=n.logs??[];if(!n.logs){let i=[...new Set([...g,...o.flatMap(a=>a.contracts??[]).map(a=>a.toLowerCase())])].map(a=>x(a));if(i.length>0||o.some(a=>!!(a.contracts?.length||a.abi||a.decodeLog))||h.length===0||n.client!==void 0||n.rpcUrl!==void 0||n.fromBlock!==void 0||n.toBlock!==void 0){let a=A();if(typeof a.getLogs=="function"){let d=i.filter(b=>g.has(b.toLowerCase())),f=i.filter(b=>!g.has(b.toLowerCase())),T=[d,f].filter(b=>b.length);T.length||T.push([]);let w=[];if(n.fromBlock!==void 0&&n.toBlock!==void 0){if(n.fromBlock<0n||n.fromBlock>n.toBlock)throw new L("History block range is invalid.");for(let b=n.fromBlock;b<=n.toBlock;b+=10000n){let c=b+9999n;w.push({fromBlock:b,toBlock:c<n.toBlock?c:n.toBlock})}}else w.push({fromBlock:n.fromBlock,toBlock:n.toBlock});let R=[];for(let b of w)for(let c of T)R.push(...await a.getLogs({...c.length?{address:c}:{},...b}));H=R.map(b=>{let c=b;return{address:c.address,topics:c.topics??[],data:c.data,blockNumber:c.blockNumber??0n,logIndex:Number(c.logIndex??0),transactionHash:c.transactionHash??"0x"+"0".repeat(64),...c.timestamp!==void 0?{timestamp:c.timestamp}:c.blockTimestamp!==void 0?{timestamp:BigInt(c.blockTimestamp)}:{}}})}}}let C=new Map;if(n.blockTimestamps)for(let[i,l]of Object.entries(n.blockTimestamps)){let y=k(i),a=k(l,"0");BigInt(a)>0n&&C.set(y,a)}let S=new Map,M=async i=>{if(i.timestamp!==void 0){let w=k(i.timestamp,"0");if(BigInt(w)>0n)return w}let l=k(i.blockNumber),y=C.get(l);if(y&&BigInt(y)>0n)return y;let a=A(),d=ee.get(a);d||(d=new Map,ee.set(a,d));let f=d.get(l);if(f&&BigInt(f)>0n)return C.set(l,f),f;let T=S.get(l);return T||(T=(async()=>{let w=BigInt(l),R;if(typeof a.getBlock=="function")try{R=(await a.getBlock({blockNumber:w}))?.timestamp}catch(c){if(typeof a.request=="function"){let G=await a.request({method:"eth_getBlockByNumber",params:[`0x${w.toString(16)}`,!1]});if(G?.timestamp!==void 0)R=BigInt(G.timestamp);else throw c}else throw c}else if(typeof a.request=="function"){let c=await a.request({method:"eth_getBlockByNumber",params:[`0x${w.toString(16)}`,!1]});c?.timestamp!==void 0&&(R=BigInt(c.timestamp))}let b=k(R,"0");if(BigInt(b)<=0n)throw new L(`Could not resolve a positive timestamp for block ${l}.`);return C.set(l,b),d.set(l,b),b})(),S.set(l,T)),T},I=[],B=[],$=new Set;for(let i of H){let l=i.address.toLowerCase();if(g.has(l)){let d=de(i,r,s,"1");if(d){let f=await M(i);I.push({...d,timestamp:f});continue}}let y=!1;for(let d=0;d<o.length;d++){if($.has(d))continue;let f=o[d];if(!(f.contracts&&f.contracts.length>0&&!f.contracts.some(w=>w.toLowerCase()===l)))try{if(f.decodeLog){let T=await M(i),w=se(i,f,d,r,s,T);if(w){I.push(w),y=!0;break}}else{let T=se(i,f,d,r,s,"1");if(T){let w=await M(i);I.push({...T,timestamp:w}),y=!0;break}}}catch(T){$.add(d),B.push(P(W(f,d),T,s,f.contracts?.[0]))}}if(y)continue;let a=pe(i,r,s,"1");if(a){let d=await M(i);I.push({...a,timestamp:d})}}let U=[...m.map((i,l)=>({name:i.name||`reader_${l}`,run:()=>i(r,t)})),...o.flatMap((i,l)=>{let y=i.readHistory??i.history;if(typeof y!="function")return[];let a=W(i,l);return[{name:a,contract:i.contracts?.[0],run:async()=>{let d=await y.call(i,r,t);if(!Array.isArray(d))throw new L(`Module ${a} did not return a history list.`);return d.map(f=>({...f,module:f.module||a}))}}]})],j=await Promise.allSettled(U.map(i=>i.run()));for(let i=0;i<j.length;i++){let l=j[i],y=U[i];if(l.status==="fulfilled"){if(!Array.isArray(l.value)){B.push(P(y.name,new L(`Module ${y.name} did not return a history list.`),s,y.contract));continue}for(let a of l.value)D(a.args)&&!v(a.args,u)||I.push({...a,module:a.module||y.name})}else B.push(P(y.name,l.reason,s,y.contract))}if(I.sort(me),B.length===0)return I.slice(-t);let K=Math.max(0,t-B.length);return[...K?I.slice(-K):[],...B].slice(0,t)}export{oe as DEFAULT_HISTORY_LIMIT,Ae as HISTORY_LOOKBACK_BLOCKS,Se as getHistory,He as moduleHistoryReaders};
1
+ import{A as Q}from"../chunks/M643PYHO.js";import"../chunks/RYOVSHKO.js";import"../chunks/XKZOMGC3.js";import"../chunks/PQHU5A3U.js";import"../chunks/F3TOOLFQ.js";import{a as Y}from"../chunks/A5O3SRHY.js";import"../chunks/SXBGOGYQ.js";import"../chunks/UIJWIFGV.js";import"../chunks/B2LA6VVF.js";import"../chunks/NNJLMS7F.js";import"../chunks/XEN45QST.js";import"../chunks/Z53DADZ4.js";import"../chunks/LIUXNOLP.js";import"../chunks/MEZH7RPA.js";import"../chunks/TU3KHOZK.js";import"../chunks/74X7PXPR.js";import"../chunks/UB5U6SI2.js";import"../chunks/Z25UKUJF.js";import{a as F}from"../chunks/VBWJOG3N.js";import"../chunks/5HCXZWUH.js";import{h as J}from"../chunks/R5CBH2CR.js";import{a as N,i as q,t as z}from"../chunks/5BP72XOA.js";import"../chunks/XAB4OIE3.js";import"../chunks/7I6TXFXR.js";import{a as L,d as V}from"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";import{decodeEventLog as _,erc20Abi as ie,getAddress as x,isAddress as O,pad as ae,parseAbi as Z}from"viem";var X=[{inputs:[],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"expiresAt",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"grandfathered",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"hasRecord",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"holderOpen",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],name:"noteUsed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"paidUntil",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"plan",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"previous",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"quoteHolder",outputs:[{internalType:"uint256",name:"count",type:"uint256"},{internalType:"uint256",name:"burn",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"quoteNoHold",outputs:[{internalType:"uint256",name:"price",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renew",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"maxPrice",type:"uint256"},{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"renewNoHold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"usdgAuth",type:"bytes"}],name:"renewWithAuthorization",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"retire",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"retired",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"root",type:"bytes32"},{internalType:"uint64",name:"deadline",type:"uint64"}],name:"setGrandfatherRoot",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"burner",type:"address"},{internalType:"address",name:"treasury",type:"address"}],name:"setPayees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"signupOakCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint8",name:"plan",type:"uint8"},{internalType:"uint256",name:"maxCount",type:"uint256"},{internalType:"uint256",name:"maxPrice",type:"uint256"},{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"}],name:"subscribe",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count",type:"uint256"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}],name:"subscribeGrandfathered",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count",type:"uint256"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"},{internalType:"bytes",name:"usdgAuth",type:"bytes"}],name:"subscribeGrandfatheredWithAuthorization",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"maxCount",type:"uint256"},{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"bytes",name:"usdgAuth",type:"bytes"}],name:"subscribeWithAuthorization",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"sweepToTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint64",name:"at",type:"uint64"}],name:"Cancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"root",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"deadline",type:"uint64"}],name:"GrandfatherRootSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint8",name:"plan",type:"uint8"},{indexed:!1,internalType:"uint64",name:"paidUntil",type:"uint64"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"Renewed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"at",type:"uint64"}],name:"Retired",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint8",name:"plan",type:"uint8"},{indexed:!1,internalType:"uint64",name:"paidUntil",type:"uint64"},{indexed:!1,internalType:"uint256",name:"signupOakCount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oakBurned",type:"uint256"},{indexed:!1,internalType:"bool",name:"grandfathered",type:"bool"}],name:"Subscribed",type:"event"},{inputs:[],name:"HolderClosed",type:"error"},{inputs:[],name:"NoteUsed",type:"error"}];var oe=50,Ae=10000n;function He(e){let t=Object.values(z).find(s=>s.chainId===e);if(!t)throw new L("History modules are not configured for this chain.");let n=[{module:"erc8004",contracts:[t.identityRegistry],abi:Y}];if(e!==N)return n;let r=q[N],u=Z(["event Deposit(address indexed sender,address indexed owner,uint256 assets,uint256 shares)","event Withdraw(address indexed sender,address indexed receiver,address indexed owner,uint256 assets,uint256 shares)"]);for(let[s,g]of Object.entries(r.vaults)){if(s==="morphoV2Factory"||s==="beefyTestedLpVault")continue;let h=s.startsWith("longbow")?"longbow":s==="groveAlm"?"grove":s;n.push({module:h,contracts:[g.address],abi:u})}return n.push({module:"hookr",contracts:[r.hookr.HookrLimitOrders.address],abi:Q},{module:"orbio",contracts:[r.orbio.credit.address],abi:Z(["event Activated(uint256 indexed activationId,address indexed by,bytes32 indexed ref,uint256 amount)"])}),n}var ue=X,ee=new WeakMap;function E(e){if(e==null)return null;if(typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(typeof e=="bigint")return e.toString();if(Array.isArray(e))return e.map(E);if(typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=E(r);return t}return String(e)}function k(e,t="0"){return e===void 0?t:typeof e=="bigint"?e.toString():typeof e=="number"?BigInt(Math.trunc(e)).toString():BigInt(e).toString()}function le(e){let t=[];e.subscriptionAddress&&t.push(e.subscriptionAddress),e.retiredSubscriptionAddresses&&t.push(...e.retiredSubscriptionAddresses),e.subscriptionAddresses&&t.push(...e.subscriptionAddresses),process.env.OAK_SUBSCRIPTION_ADDRESS&&t.push(process.env.OAK_SUBSCRIPTION_ADDRESS),process.env.OAK_RETIRED_SUBSCRIPTION_ADDRESSES&&t.push(...process.env.OAK_RETIRED_SUBSCRIPTION_ADDRESSES.split(",").map(r=>r.trim()).filter(Boolean));let n=new Set;for(let r of t)O(r,{strict:!1})&&n.add(r.toLowerCase());return n}function te(e){let t=Number(e);return t===1?"holder":t===2?"nohold":t===0?"none":String(e)}function de(e,t,n,r){if(!e.topics.length)return null;try{let u=_({abi:ue,data:e.data,topics:e.topics}),s=u.args??{},g=x(e.address),h=k(e.blockNumber),o=t.toLowerCase();if(u.eventName==="Subscribed"){let m=typeof s.wallet=="string"?x(s.wallet):void 0;if(!m||m.toLowerCase()!==o)return null;let p=te(s.plan),A=k(s.paidUntil),H=k(s.signupOakCount),C=k(s.oakBurned),S=!!s.grandfathered;return{transactionHash:e.transactionHash,blockNumber:h,logIndex:e.logIndex,timestamp:r,chainId:n,contract:g,module:"subscription",event:"Subscribed",args:{wallet:m,plan:p,paidUntil:A,signupOakCount:H,oakBurned:C,grandfathered:S},description:S?`Grandfathered ${p} subscription until ${A}.`:`Subscribed to ${p} plan until ${A}.`}}if(u.eventName==="Renewed"){let m=typeof s.wallet=="string"?x(s.wallet):void 0;if(!m||m.toLowerCase()!==o)return null;let p=te(s.plan),A=k(s.paidUntil),H=k(s.amountPaid);return{transactionHash:e.transactionHash,blockNumber:h,logIndex:e.logIndex,timestamp:r,chainId:n,contract:g,module:"subscription",event:"Renewed",args:{wallet:m,plan:p,paidUntil:A,amountPaid:H},description:`Renewed ${p} subscription until ${A} for ${H} USDG base units.`}}if(u.eventName==="Cancelled"){let m=typeof s.wallet=="string"?x(s.wallet):void 0;if(!m||m.toLowerCase()!==o)return null;let p=k(s.at);return{transactionHash:e.transactionHash,blockNumber:h,logIndex:e.logIndex,timestamp:r,chainId:n,contract:g,module:"subscription",event:"Cancelled",args:{wallet:m,at:p},description:`Cancelled subscription at ${p}.`}}return null}catch{return null}}function v(e,t){return typeof e=="string"?O(e,{strict:!1})&&e.toLowerCase()===t:Array.isArray(e)?e.some(n=>v(n,t)):e!==null&&typeof e=="object"?Object.values(e).some(n=>v(n,t)):!1}function D(e){return typeof e=="string"?O(e,{strict:!1}):Array.isArray(e)?e.some(t=>D(t)):e!==null&&typeof e=="object"?Object.values(e).some(t=>D(t)):!1}function ne(e,t){if(e.length<=1)return!1;let n=ae(t).toLowerCase(),r=t.slice(2).toLowerCase();return e.slice(1).some(u=>{let s=u.toLowerCase();return s===n||s.length===66&&s.startsWith("0x000000000000000000000000")&&s.endsWith(r)})}function ce(e,t){if(!e||e==="0x")return!1;let n=e.slice(2).toLowerCase(),r=`000000000000000000000000${t.slice(2).toLowerCase()}`;for(let u=0;u+64<=n.length;u+=64)if(n.slice(u,u+64)===r)return!0;return!1}function W(e,t){return e.module||e.name||`module_${t}`}function se(e,t,n,r,u,s){let g=W(t,n),h=r.toLowerCase();if(t.contracts&&t.contracts.length>0){let o=e.address.toLowerCase();if(!t.contracts.some(p=>p.toLowerCase()===o))return null}if(t.decodeLog){let o=t.decodeLog(e,{wallet:r,chainId:u,timestamp:s});if(!o||t.filterWallet&&!t.filterWallet(o.args,r))return null;if(D(o.args)){if(!v(o.args,h))return null}else if(!ne(e.topics,r)&&!ce(e.data,r)&&!o.description.toLowerCase().includes(h))return null;return{...o,timestamp:o.timestamp&&o.timestamp!=="0"?o.timestamp:s,module:o.module||g}}if(!t.abi||!e.topics.length)return null;try{let o=_({abi:t.abi,data:e.data,topics:e.topics}),m=o.args??{},p={};for(let[C,S]of Object.entries(m))/^\d+$/.test(C)||(p[C]=typeof S=="string"&&O(S,{strict:!1})?x(S):E(S));if(!(t.filterWallet?t.filterWallet(p,r):v(m,h)||ne(e.topics,r)))return null;let H=o.eventName??"Event";return{transactionHash:e.transactionHash,blockNumber:k(e.blockNumber),logIndex:e.logIndex,timestamp:s,chainId:u,contract:x(e.address),module:g,event:H,args:p,description:`${g} ${H} on ${x(e.address)}.`}}catch{return null}}function pe(e,t,n,r){if(e.topics.length!==3)return null;try{let u=_({abi:ie,data:e.data,topics:e.topics});if(u.eventName!=="Transfer")return null;let s=u.args,g=x(s.from),h=x(s.to),o=t.toLowerCase();if(g.toLowerCase()!==o&&h.toLowerCase()!==o)return null;let m=s.value.toString(),p=x(e.address);return{transactionHash:e.transactionHash,blockNumber:k(e.blockNumber),logIndex:e.logIndex,timestamp:r,chainId:n,contract:p,module:"token",event:"Transfer",args:{from:g,to:h,value:m},description:`Transferred ${m} token base units from ${g} to ${h}.`}}catch{return null}}function me(e,t){let n=BigInt(e.blockNumber),r=BigInt(t.blockNumber);return n<r?-1:n>r?1:e.logIndex-t.logIndex}function P(e,t,n,r){let u=V(t);return{transactionHash:"0x"+"0".repeat(64),blockNumber:"0",logIndex:0,timestamp:"0",chainId:n,contract:r?x(r):"0x"+"0".repeat(40),module:e,event:"error",args:{error:u},description:`${e}: ${u}`}}async function Se(e,t=oe,n={}){if(F(e),!Number.isInteger(t)||t<=0)throw new L("History limit must be a positive integer.");let r=x(e),u=r.toLowerCase(),s=n.chainId??N,g=le(n),h=n.readers??[],o=h.filter(i=>typeof i=="object"&&i!==null),m=h.filter(i=>typeof i=="function"),p=n.client,A=()=>(p||(p=J(n.rpcUrl,s)),p),H=n.logs??[];if(!n.logs){let i=[...new Set([...g,...o.flatMap(a=>a.contracts??[]).map(a=>a.toLowerCase())])].map(a=>x(a));if(i.length>0||o.some(a=>!!(a.contracts?.length||a.abi||a.decodeLog))||h.length===0||n.client!==void 0||n.rpcUrl!==void 0||n.fromBlock!==void 0||n.toBlock!==void 0){let a=A();if(typeof a.getLogs=="function"){let d=i.filter(b=>g.has(b.toLowerCase())),f=i.filter(b=>!g.has(b.toLowerCase())),T=[d,f].filter(b=>b.length);T.length||T.push([]);let w=[];if(n.fromBlock!==void 0&&n.toBlock!==void 0){if(n.fromBlock<0n||n.fromBlock>n.toBlock)throw new L("History block range is invalid.");for(let b=n.fromBlock;b<=n.toBlock;b+=10000n){let c=b+9999n;w.push({fromBlock:b,toBlock:c<n.toBlock?c:n.toBlock})}}else w.push({fromBlock:n.fromBlock,toBlock:n.toBlock});let R=[];for(let b of w)for(let c of T)R.push(...await a.getLogs({...c.length?{address:c}:{},...b}));H=R.map(b=>{let c=b;return{address:c.address,topics:c.topics??[],data:c.data,blockNumber:c.blockNumber??0n,logIndex:Number(c.logIndex??0),transactionHash:c.transactionHash??"0x"+"0".repeat(64),...c.timestamp!==void 0?{timestamp:c.timestamp}:c.blockTimestamp!==void 0?{timestamp:BigInt(c.blockTimestamp)}:{}}})}}}let C=new Map;if(n.blockTimestamps)for(let[i,l]of Object.entries(n.blockTimestamps)){let y=k(i),a=k(l,"0");BigInt(a)>0n&&C.set(y,a)}let S=new Map,M=async i=>{if(i.timestamp!==void 0){let w=k(i.timestamp,"0");if(BigInt(w)>0n)return w}let l=k(i.blockNumber),y=C.get(l);if(y&&BigInt(y)>0n)return y;let a=A(),d=ee.get(a);d||(d=new Map,ee.set(a,d));let f=d.get(l);if(f&&BigInt(f)>0n)return C.set(l,f),f;let T=S.get(l);return T||(T=(async()=>{let w=BigInt(l),R;if(typeof a.getBlock=="function")try{R=(await a.getBlock({blockNumber:w}))?.timestamp}catch(c){if(typeof a.request=="function"){let G=await a.request({method:"eth_getBlockByNumber",params:[`0x${w.toString(16)}`,!1]});if(G?.timestamp!==void 0)R=BigInt(G.timestamp);else throw c}else throw c}else if(typeof a.request=="function"){let c=await a.request({method:"eth_getBlockByNumber",params:[`0x${w.toString(16)}`,!1]});c?.timestamp!==void 0&&(R=BigInt(c.timestamp))}let b=k(R,"0");if(BigInt(b)<=0n)throw new L(`Could not resolve a positive timestamp for block ${l}.`);return C.set(l,b),d.set(l,b),b})(),S.set(l,T)),T},I=[],B=[],$=new Set;for(let i of H){let l=i.address.toLowerCase();if(g.has(l)){let d=de(i,r,s,"1");if(d){let f=await M(i);I.push({...d,timestamp:f});continue}}let y=!1;for(let d=0;d<o.length;d++){if($.has(d))continue;let f=o[d];if(!(f.contracts&&f.contracts.length>0&&!f.contracts.some(w=>w.toLowerCase()===l)))try{if(f.decodeLog){let T=await M(i),w=se(i,f,d,r,s,T);if(w){I.push(w),y=!0;break}}else{let T=se(i,f,d,r,s,"1");if(T){let w=await M(i);I.push({...T,timestamp:w}),y=!0;break}}}catch(T){$.add(d),B.push(P(W(f,d),T,s,f.contracts?.[0]))}}if(y)continue;let a=pe(i,r,s,"1");if(a){let d=await M(i);I.push({...a,timestamp:d})}}let U=[...m.map((i,l)=>({name:i.name||`reader_${l}`,run:()=>i(r,t)})),...o.flatMap((i,l)=>{let y=i.readHistory??i.history;if(typeof y!="function")return[];let a=W(i,l);return[{name:a,contract:i.contracts?.[0],run:async()=>{let d=await y.call(i,r,t);if(!Array.isArray(d))throw new L(`Module ${a} did not return a history list.`);return d.map(f=>({...f,module:f.module||a}))}}]})],j=await Promise.allSettled(U.map(i=>i.run()));for(let i=0;i<j.length;i++){let l=j[i],y=U[i];if(l.status==="fulfilled"){if(!Array.isArray(l.value)){B.push(P(y.name,new L(`Module ${y.name} did not return a history list.`),s,y.contract));continue}for(let a of l.value)D(a.args)&&!v(a.args,u)||I.push({...a,module:a.module||y.name})}else B.push(P(y.name,l.reason,s,y.contract))}if(I.sort(me),B.length===0)return I.slice(-t);let K=Math.max(0,t-B.length);return[...K?I.slice(-K):[],...B].slice(0,t)}export{oe as DEFAULT_HISTORY_LIMIT,Ae as HISTORY_LOOKBACK_BLOCKS,Se as getHistory,He as moduleHistoryReaders};
@@ -1 +1 @@
1
- import{a,b,c}from"../chunks/ZUAXW2ZD.js";import"../chunks/64EN6Y7E.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{a as HttpResponseError,b as createHttpClient,c as httpJson};
1
+ import{a,b,c}from"../chunks/TU3KHOZK.js";import"../chunks/74X7PXPR.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{a as HttpResponseError,b as createHttpClient,c as httpJson};
@@ -1 +1 @@
1
- import{t as c,u as p}from"../chunks/25EOXUBI.js";import{a as r}from"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";import{decodeFunctionResult as x,encodeFunctionData as A,getAddress as g,hashTypedData as I,isAddress as S,parseAbi as O,recoverTypedDataAddress as $,toHex as L,zeroAddress as N}from"viem";var k=O(["function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"]),T="0x1626ba7e",w=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;function o(e,n,t){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78)throw new r(`Identity link ${t} must be a canonical decimal integer string.`);let i=BigInt(e);if(i>=1n<<BigInt(n))throw new r(`Identity link ${t} exceeds uint${n}.`);return i}function l(e,n){if(typeof e!="string"||!S(e,{strict:!1})||g(e)===N)throw new r(`Identity link ${n} must be a nonzero address.`);return g(e)}function b(e,n="mainnet"){o(e,256,"agentId");let{chainId:t,identityRegistry:i}=c[p(n)];return{chainId:t,registry:i,agentId:e}}function D(e){if(e===c.mainnet.chainId)return"mainnet";if(e===c.testnet.chainId)return"testnet";throw new r("Wrong identity network. Select mainnet or testnet and run oak setup again.")}function B(e,n="mainnet"){if(!e||typeof e!="object"||Array.isArray(e))throw new r("Run oak setup to register or link an identity.");let t=e,i=b(t.agentId,n);if(Object.keys(t).some(s=>!["chainId","registry","agentId","linkId"].includes(s))||t.chainId!==i.chainId||t.registry!==i.registry||t.linkId!==void 0&&(typeof t.linkId!="string"||!/^0x[0-9a-f]{64}$/.test(t.linkId)))throw new r(`Wrong identity network or registry. Select chain ${i.chainId} and run oak setup again.`);return{...i,...t.linkId!==void 0?{linkId:t.linkId}:{}}}function h(e){let n=D(e.chainId),{chainId:t,registry:i}=b(e.agentId,n);if(l(e.registry,"registry")!==i)throw new r(`Identity link must use the pinned registry on chain ${t}.`);if(typeof e.audience!="string"||!e.audience.trim())throw new r("Identity link audience must be a nonempty string.");if(typeof e.challenge!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.challenge))throw new r("Identity link challenge must be a 32-byte hex string.");let s=o(e.issuedAt,64,"issuedAt"),a=o(e.expiresAt,64,"expiresAt");if(s>=a)throw new r("Identity link expiry must be after its issue time.");return{domain:{name:"Oak Identity Link",version:"1",chainId:t,verifyingContract:i},primaryType:"OakIdentityLink",types:{OakIdentityLink:[{name:"agentId",type:"uint256"},{name:"agentWallet",type:"address"},{name:"registry",type:"address"},{name:"chainId",type:"uint256"},{name:"audience",type:"string"},{name:"challenge",type:"bytes32"},{name:"issuedAt",type:"uint64"},{name:"expiresAt",type:"uint64"}]},message:{agentId:o(e.agentId,256,"agentId"),agentWallet:l(e.agentWallet,"agentWallet"),registry:i,chainId:BigInt(t),audience:e.audience,challenge:e.challenge,issuedAt:s,expiresAt:a}}}function F(e){if(!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=e.slice(130).toLowerCase();return n>0n&&n<w&&t>0n&&t<=w/2n&&(i==="1b"||i==="1c")}async function H(e,n){try{let t=h(e.link),i=h(n.expected),s=I(t);if(s!==I(i))return!1;let a=o(n.now,64,"now");if(a<t.message.issuedAt||a>=t.message.expiresAt)return!1;let f=l(n.currentOwner,"currentOwner");if(typeof n.blockNumber!="bigint"||n.blockNumber<0n)return!1;let m=L(n.blockNumber),d=e.signature;if(typeof d!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(d))return!1;let y=await n.client.request({method:"eth_getCode",params:[f,m]});if(typeof y!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(y))return!1;if(y==="0x")return F(d)?g(await $({...t,signature:d}))===f:!1;let u=await n.client.request({method:"eth_call",params:[{to:f,data:A({abi:k,functionName:"isValidSignature",args:[s,d]})},m]});return typeof u!="string"||!/^0x[0-9a-fA-F]{8}0{56}$/.test(u)?!1:x({abi:k,functionName:"isValidSignature",data:u}).toLowerCase()===T}catch{return!1}}export{h as buildIdentityLinkTypedData,b as buildIdentityTuple,B as canonicalSessionIdentity,D as identityNetwork,H as verifyIdentityLink};
1
+ import{t as c,u as p}from"../chunks/5BP72XOA.js";import{a as r}from"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";import{decodeFunctionResult as x,encodeFunctionData as A,getAddress as g,hashTypedData as I,isAddress as S,parseAbi as O,recoverTypedDataAddress as $,toHex as L,zeroAddress as N}from"viem";var k=O(["function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"]),T="0x1626ba7e",w=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;function o(e,n,t){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78)throw new r(`Identity link ${t} must be a canonical decimal integer string.`);let i=BigInt(e);if(i>=1n<<BigInt(n))throw new r(`Identity link ${t} exceeds uint${n}.`);return i}function l(e,n){if(typeof e!="string"||!S(e,{strict:!1})||g(e)===N)throw new r(`Identity link ${n} must be a nonzero address.`);return g(e)}function b(e,n="mainnet"){o(e,256,"agentId");let{chainId:t,identityRegistry:i}=c[p(n)];return{chainId:t,registry:i,agentId:e}}function D(e){if(e===c.mainnet.chainId)return"mainnet";if(e===c.testnet.chainId)return"testnet";throw new r("Wrong identity network. Select mainnet or testnet and run oak setup again.")}function B(e,n="mainnet"){if(!e||typeof e!="object"||Array.isArray(e))throw new r("Run oak setup to register or link an identity.");let t=e,i=b(t.agentId,n);if(Object.keys(t).some(s=>!["chainId","registry","agentId","linkId"].includes(s))||t.chainId!==i.chainId||t.registry!==i.registry||t.linkId!==void 0&&(typeof t.linkId!="string"||!/^0x[0-9a-f]{64}$/.test(t.linkId)))throw new r(`Wrong identity network or registry. Select chain ${i.chainId} and run oak setup again.`);return{...i,...t.linkId!==void 0?{linkId:t.linkId}:{}}}function h(e){let n=D(e.chainId),{chainId:t,registry:i}=b(e.agentId,n);if(l(e.registry,"registry")!==i)throw new r(`Identity link must use the pinned registry on chain ${t}.`);if(typeof e.audience!="string"||!e.audience.trim())throw new r("Identity link audience must be a nonempty string.");if(typeof e.challenge!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e.challenge))throw new r("Identity link challenge must be a 32-byte hex string.");let s=o(e.issuedAt,64,"issuedAt"),a=o(e.expiresAt,64,"expiresAt");if(s>=a)throw new r("Identity link expiry must be after its issue time.");return{domain:{name:"Oak Identity Link",version:"1",chainId:t,verifyingContract:i},primaryType:"OakIdentityLink",types:{OakIdentityLink:[{name:"agentId",type:"uint256"},{name:"agentWallet",type:"address"},{name:"registry",type:"address"},{name:"chainId",type:"uint256"},{name:"audience",type:"string"},{name:"challenge",type:"bytes32"},{name:"issuedAt",type:"uint64"},{name:"expiresAt",type:"uint64"}]},message:{agentId:o(e.agentId,256,"agentId"),agentWallet:l(e.agentWallet,"agentWallet"),registry:i,chainId:BigInt(t),audience:e.audience,challenge:e.challenge,issuedAt:s,expiresAt:a}}}function F(e){if(!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=e.slice(130).toLowerCase();return n>0n&&n<w&&t>0n&&t<=w/2n&&(i==="1b"||i==="1c")}async function H(e,n){try{let t=h(e.link),i=h(n.expected),s=I(t);if(s!==I(i))return!1;let a=o(n.now,64,"now");if(a<t.message.issuedAt||a>=t.message.expiresAt)return!1;let f=l(n.currentOwner,"currentOwner");if(typeof n.blockNumber!="bigint"||n.blockNumber<0n)return!1;let m=L(n.blockNumber),d=e.signature;if(typeof d!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(d))return!1;let y=await n.client.request({method:"eth_getCode",params:[f,m]});if(typeof y!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(y))return!1;if(y==="0x")return F(d)?g(await $({...t,signature:d}))===f:!1;let u=await n.client.request({method:"eth_call",params:[{to:f,data:A({abi:k,functionName:"isValidSignature",args:[s,d]})},m]});return typeof u!="string"||!/^0x[0-9a-fA-F]{8}0{56}$/.test(u)?!1:x({abi:k,functionName:"isValidSignature",data:u}).toLowerCase()===T}catch{return!1}}export{h as buildIdentityLinkTypedData,b as buildIdentityTuple,B as canonicalSessionIdentity,D as identityNetwork,H as verifyIdentityLink};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h}from"../chunks/YEE3KKTA.js";import"../chunks/KP7VSXIQ.js";import"../chunks/B5RZYFQC.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{b as GRANDFATHER_SCHEMA,a as LEAF_GRANDFATHER,g as buildGrandfatherList,f as buildGrandfatherTree,c as grandfatherLeaf,h as grandfatherProofFor,d as hashSortedPair,e as verifyGrandfatherProof};
1
+ import{a,b,c,d,e,f,g,h}from"../chunks/6YQ2RX5I.js";import"../chunks/7I6TXFXR.js";import"../chunks/WFE3NXBF.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{b as GRANDFATHER_SCHEMA,a as LEAF_GRANDFATHER,g as buildGrandfatherList,f as buildGrandfatherTree,c as grandfatherLeaf,h as grandfatherProofFor,d as hashSortedPair,e as verifyGrandfatherProof};
@@ -1 +1 @@
1
- import{a}from"../chunks/P7Q6MJZH.js";import"../chunks/5HCXZWUH.js";import"../chunks/UL2L7NHO.js";import"../chunks/25EOXUBI.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{a as readTokenField};
1
+ import{a}from"../chunks/MEZH7RPA.js";import"../chunks/5HCXZWUH.js";import"../chunks/R5CBH2CR.js";import"../chunks/5BP72XOA.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{a as readTokenField};
@@ -1 +1 @@
1
- import{a,b,c}from"../chunks/SGDWO7XI.js";import"../chunks/Z25UKUJF.js";import"../chunks/VZWOWR6G.js";import"../chunks/B5RZYFQC.js";import"../chunks/T5E4OJEU.js";import"../chunks/XN4WDN3O.js";export{b as combineModule,a as createModuleContext,c as createModuleRegistry};
1
+ import{a,b,c}from"../chunks/UB5U6SI2.js";import"../chunks/Z25UKUJF.js";import"../chunks/VBWJOG3N.js";import"../chunks/7I6TXFXR.js";import"../chunks/Z3FZWNAJ.js";import"../chunks/XN4WDN3O.js";export{b as combineModule,a as createModuleContext,c as createModuleRegistry};
@@ -1 +1 @@
1
- import{c as v}from"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import{b as q}from"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import{a as p}from"../../../chunks/VZWOWR6G.js";import{a as c,i as D}from"../../../chunks/25EOXUBI.js";import{a as O}from"../../../chunks/B5RZYFQC.js";import{a as u}from"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";import{encodeFunctionData as M,erc20Abi as P,parseAbi as J}from"viem";var j="https://api.beefy.finance/vaults",V="https://api.beefy.finance/fees",C=D[c].vaults.beefyTestedLpVault,S=J(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),_=(1n<<256n)-1n,$={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},x={type:"string",pattern:"^[0-9]+$",description:"Positive integer in base units."};function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function m(e){if(typeof e!="string")throw new u("Provide a valid contract or wallet address.");return p(e),e.toLowerCase()}function b(e){if(typeof e!="bigint"||e<0n||e>_)throw new u("The contract returned an invalid integer.");return e}function L(e){if(typeof e!="string")throw new u("Amount must be a positive integer string in base units.");let l=O(e);if(l<=0n||l>_)throw new u("Amount must be positive and fit in uint256.");return l}function E(e){if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255)throw new u("Invalid token decimals.");return e}function w(e){return e.toLowerCase()===C.address.toLowerCase()}function Q(e){return!g(e)||!g(e.performance)?!1:[e.deposit,e.withdraw,e.performance.total].every(l=>typeof l=="number"&&Number.isFinite(l)&&l>=0&&l<=1)&&typeof e.lastUpdated=="number"&&Number.isSafeInteger(e.lastUpdated)&&e.lastUpdated>=0}var K=e=>{async function l(r){try{return await r()}catch(s){throw new u(e.plainError(s))}}function A(r,s){if(r.chainId!==void 0&&r.chainId!==c)throw new u("Beefy requires chain 4663.");for(let o of Object.keys(r))if(!["chainId",...s].includes(o))throw new u(`Unsupported Beefy input: ${o}.`)}async function k(){let r=await v(e.http,j,{headers:{"User-Agent":"Oak-Beefy/1.0"}},n=>Array.isArray(n)&&n.every(a=>g(a)&&typeof a.chain=="string")),s=new Set,o=new Set;return r.filter(n=>n.chain==="robinhood").map(n=>{if(typeof n.id!="string"||!n.id||typeof n.name!="string"||!n.name||n.type!=="standard"||!["active","paused","eol"].includes(String(n.status)))throw new u("The Beefy API returned an unexpected vault record.");let a=m(n.earnContractAddress);if(s.has(n.id)||o.has(a))throw new u("The Beefy API returned duplicate vault records.");return s.add(n.id),o.add(a),{id:n.id,name:n.name,type:"standard",chain:"robinhood",status:n.status,tokenAddress:m(n.tokenAddress),tokenDecimals:E(n.tokenDecimals),earnContractAddress:a}})}async function T(){return v(e.http,V,{headers:{"User-Agent":"Oak-Beefy/1.0"}},g)}function I(r,s){let o=r[s.id];if(!Q(o))throw new u(`Beefy fees are unavailable for ${s.id}.`);return o}async function h(){let r=e.clientFor(c);if(await r.getChainId()!==c)throw new u("The Beefy endpoint must report chain 4663.");let s=b(await r.getBlockNumber()),o=(t,d)=>r.readContract({address:t,abi:S,functionName:d,blockNumber:s}),n=async(t,d)=>b(await r.readContract({address:t,abi:P,functionName:"balanceOf",args:[d],blockNumber:s}));async function a(t){let[d,f]=await Promise.all([r.readContract({address:t,abi:P,functionName:"symbol",blockNumber:s}),r.readContract({address:t,abi:P,functionName:"decimals",blockNumber:s})]);if(typeof d!="string"||!d.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:c,symbol:d,decimals:E(f)}}async function i(t){let d=t.earnContractAddress,f=m(await o(d,"want"));if(f!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[y,G,W,z,H]=await Promise.all([a(f),a(d),o(d,"strategy"),o(d,"balance"),o(d,"getPricePerFullShare")]);if(y.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let U=m(W),N=await o(U,"paused");if(typeof N!="boolean")throw new u("The strategy returned an invalid pause flag.");let R=b(H);if(R===0n)throw new u("The Beefy share price is zero.");return{want:y,shares:G,strategy:U,paused:N,managed:b(z),pricePerFullShare:R}}return{blockNumber:s,balanceOf:n,vaultState:i}}async function B(r){let s=m(r.vault);if(!w(s))throw new u("Only the measured up33-weth-up vault is supported for Beefy actions; other inventory is not fork-qualified.");let n=(await k()).find(a=>a.earnContractAddress===s);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");return n}async function F(r,s,o,n){let a=I(await T(),n),i=await e.preview(r,s),t=i.changes.map(d=>{let f=d.amount.startsWith("-"),y=f?d.amount.slice(1):d.amount;return`${f?"-":"+"}${e.formatAmount(y,d.token.decimals)} ${d.token.symbol} (${d.token.address}, chain ${d.token.chainId})`}).join("; ");return{txs:r,preview:i,summary:`${o} ${n.name}. ${t}. ${i.summary} Beefy API fees: deposit ${a.deposit*100}%, withdrawal ${a.withdraw*100}%, performance ${a.performance.total*100}% (updated ${a.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:c}},additionalProperties:!1},execute:r=>l(async()=>{A(r,[]);let[s,o,n]=await Promise.all([k(),T(),h()]),a=[];for(let i of s){let t=await n.vaultState(i);a.push({id:i.id,name:i.name,vault:i.earnContractAddress,chainId:c,want:t.want,shares:t.shares,balance:{token:t.want,amount:t.managed.toString()},pricePerFullShare:{token:t.want,amount:t.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:i.status,source:j},strategyPaused:{value:t.paused,source:"strategy.paused()",address:t.strategy,block:n.blockNumber.toString()},fees:{...I(o,i),source:V},forkQualified:w(i.earnContractAddress),qualification:w(i.earnContractAddress)?{source:C.source,block:C.block}:null,depositAvailable:w(i.earnContractAddress)&&i.status==="active"&&!t.paused,block:n.blockNumber.toString()})}return{vaults:a,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Only up33-weth-up has recorded fork write qualification; API status and strategy pause are separate observations."}})},{name:"beefy_deposit",inputSchema:{type:"object",properties:{vault:$,token:$,amount:x,chainId:{const:c}},required:["vault","token","amount"],additionalProperties:!1},execute:(r,s)=>l(async()=>{A(r,["vault","token","amount"]),p(s);let o=L(r.amount),n=m(r.token),a=await B(r),i=await h(),t=await i.vaultState(a);if(n!==t.want.address)throw new u(`This vault needs ${t.want.symbol} (${t.want.address}, chain 4663), not the supplied token. No USDG zap is provided.`);if(a.status!=="active")throw new u(`The Beefy API marks this vault ${a.status}; deposits are unavailable.`);if(t.paused)throw new u("The Beefy strategy is paused; deposits are unavailable.");if(await i.balanceOf(t.want.address,s)<o)throw new u(`Insufficient ${t.want.symbol} want balance.`);let d=[e.approval(t.want.address,a.earnContractAddress,o.toString(),c),e.unsignedTx({to:a.earnContractAddress,data:M({abi:S,functionName:"deposit",args:[o]}),value:"0",chainId:c,description:`Deposit ${o} want base units into ${a.name}.`})];return F(d,s,"Deposit into",a)})},{name:"beefy_withdraw",inputSchema:{type:"object",properties:{vault:$,shares:{anyOf:[x,{const:"all"}]},chainId:{const:c}},required:["vault","shares"],additionalProperties:!1},execute:(r,s)=>l(async()=>{A(r,["vault","shares"]),p(s);let o=r.shares==="all"?void 0:L(r.shares),n=await B(r),a=await h();await a.vaultState(n);let i=await a.balanceOf(n.earnContractAddress,s),t=o??i;if(t===0n||t>i)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let d=[e.unsignedTx({to:n.earnContractAddress,data:M({abi:S,functionName:"withdraw",args:[t]}),value:"0",chainId:c,description:`Withdraw ${t} share base units from ${n.name} to the calling wallet.`})];return F(d,s,"Withdraw from",n)})}],positions:r=>l(async()=>{p(r);let[s,o]=await Promise.all([k(),h()]),n=[];for(let a of s){let i=await o.balanceOf(a.earnContractAddress,r);if(i===0n)continue;let t=await o.vaultState(a);n.push({module:"beefy",id:a.earnContractAddress,chainId:c,assets:[{token:t.want,amount:(i*t.pricePerFullShare/10n**18n).toString()}],description:`${a.name}: ${e.formatAmount(i.toString(),t.shares.decimals)} ${t.shares.symbol} shares (${a.earnContractAddress}); want estimate before withdrawal fees at block ${o.blockNumber}. API ${a.status}; strategy paused ${t.paused}. ${w(a.earnContractAddress)?"Recorded fork-qualified vault.":"Inventory only; writes are not fork-qualified."}`})}return n})}};function se(e){return q("beefy",[K(e)])}export{se as createModule,K as createModulePart};
1
+ import{c as v}from"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import{b as q}from"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import{a as p}from"../../../chunks/VBWJOG3N.js";import{a as c,i as D}from"../../../chunks/5BP72XOA.js";import{a as O}from"../../../chunks/7I6TXFXR.js";import{a as u}from"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";import{encodeFunctionData as M,erc20Abi as P,parseAbi as J}from"viem";var j="https://api.beefy.finance/vaults",V="https://api.beefy.finance/fees",C=D[c].vaults.beefyTestedLpVault,S=J(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),_=(1n<<256n)-1n,$={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},x={type:"string",pattern:"^[0-9]+$",description:"Positive integer in base units."};function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function m(e){if(typeof e!="string")throw new u("Provide a valid contract or wallet address.");return p(e),e.toLowerCase()}function b(e){if(typeof e!="bigint"||e<0n||e>_)throw new u("The contract returned an invalid integer.");return e}function L(e){if(typeof e!="string")throw new u("Amount must be a positive integer string in base units.");let l=O(e);if(l<=0n||l>_)throw new u("Amount must be positive and fit in uint256.");return l}function E(e){if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255)throw new u("Invalid token decimals.");return e}function w(e){return e.toLowerCase()===C.address.toLowerCase()}function Q(e){return!g(e)||!g(e.performance)?!1:[e.deposit,e.withdraw,e.performance.total].every(l=>typeof l=="number"&&Number.isFinite(l)&&l>=0&&l<=1)&&typeof e.lastUpdated=="number"&&Number.isSafeInteger(e.lastUpdated)&&e.lastUpdated>=0}var K=e=>{async function l(r){try{return await r()}catch(s){throw new u(e.plainError(s))}}function A(r,s){if(r.chainId!==void 0&&r.chainId!==c)throw new u("Beefy requires chain 4663.");for(let o of Object.keys(r))if(!["chainId",...s].includes(o))throw new u(`Unsupported Beefy input: ${o}.`)}async function k(){let r=await v(e.http,j,{headers:{"User-Agent":"Oak-Beefy/1.0"}},n=>Array.isArray(n)&&n.every(a=>g(a)&&typeof a.chain=="string")),s=new Set,o=new Set;return r.filter(n=>n.chain==="robinhood").map(n=>{if(typeof n.id!="string"||!n.id||typeof n.name!="string"||!n.name||n.type!=="standard"||!["active","paused","eol"].includes(String(n.status)))throw new u("The Beefy API returned an unexpected vault record.");let a=m(n.earnContractAddress);if(s.has(n.id)||o.has(a))throw new u("The Beefy API returned duplicate vault records.");return s.add(n.id),o.add(a),{id:n.id,name:n.name,type:"standard",chain:"robinhood",status:n.status,tokenAddress:m(n.tokenAddress),tokenDecimals:E(n.tokenDecimals),earnContractAddress:a}})}async function T(){return v(e.http,V,{headers:{"User-Agent":"Oak-Beefy/1.0"}},g)}function I(r,s){let o=r[s.id];if(!Q(o))throw new u(`Beefy fees are unavailable for ${s.id}.`);return o}async function h(){let r=e.clientFor(c);if(await r.getChainId()!==c)throw new u("The Beefy endpoint must report chain 4663.");let s=b(await r.getBlockNumber()),o=(t,d)=>r.readContract({address:t,abi:S,functionName:d,blockNumber:s}),n=async(t,d)=>b(await r.readContract({address:t,abi:P,functionName:"balanceOf",args:[d],blockNumber:s}));async function a(t){let[d,f]=await Promise.all([r.readContract({address:t,abi:P,functionName:"symbol",blockNumber:s}),r.readContract({address:t,abi:P,functionName:"decimals",blockNumber:s})]);if(typeof d!="string"||!d.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:c,symbol:d,decimals:E(f)}}async function i(t){let d=t.earnContractAddress,f=m(await o(d,"want"));if(f!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[y,G,W,z,H]=await Promise.all([a(f),a(d),o(d,"strategy"),o(d,"balance"),o(d,"getPricePerFullShare")]);if(y.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let U=m(W),N=await o(U,"paused");if(typeof N!="boolean")throw new u("The strategy returned an invalid pause flag.");let R=b(H);if(R===0n)throw new u("The Beefy share price is zero.");return{want:y,shares:G,strategy:U,paused:N,managed:b(z),pricePerFullShare:R}}return{blockNumber:s,balanceOf:n,vaultState:i}}async function B(r){let s=m(r.vault);if(!w(s))throw new u("Only the measured up33-weth-up vault is supported for Beefy actions; other inventory is not fork-qualified.");let n=(await k()).find(a=>a.earnContractAddress===s);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");return n}async function F(r,s,o,n){let a=I(await T(),n),i=await e.preview(r,s),t=i.changes.map(d=>{let f=d.amount.startsWith("-"),y=f?d.amount.slice(1):d.amount;return`${f?"-":"+"}${e.formatAmount(y,d.token.decimals)} ${d.token.symbol} (${d.token.address}, chain ${d.token.chainId})`}).join("; ");return{txs:r,preview:i,summary:`${o} ${n.name}. ${t}. ${i.summary} Beefy API fees: deposit ${a.deposit*100}%, withdrawal ${a.withdraw*100}%, performance ${a.performance.total*100}% (updated ${a.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:c}},additionalProperties:!1},execute:r=>l(async()=>{A(r,[]);let[s,o,n]=await Promise.all([k(),T(),h()]),a=[];for(let i of s){let t=await n.vaultState(i);a.push({id:i.id,name:i.name,vault:i.earnContractAddress,chainId:c,want:t.want,shares:t.shares,balance:{token:t.want,amount:t.managed.toString()},pricePerFullShare:{token:t.want,amount:t.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:i.status,source:j},strategyPaused:{value:t.paused,source:"strategy.paused()",address:t.strategy,block:n.blockNumber.toString()},fees:{...I(o,i),source:V},forkQualified:w(i.earnContractAddress),qualification:w(i.earnContractAddress)?{source:C.source,block:C.block}:null,depositAvailable:w(i.earnContractAddress)&&i.status==="active"&&!t.paused,block:n.blockNumber.toString()})}return{vaults:a,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Only up33-weth-up has recorded fork write qualification; API status and strategy pause are separate observations."}})},{name:"beefy_deposit",inputSchema:{type:"object",properties:{vault:$,token:$,amount:x,chainId:{const:c}},required:["vault","token","amount"],additionalProperties:!1},execute:(r,s)=>l(async()=>{A(r,["vault","token","amount"]),p(s);let o=L(r.amount),n=m(r.token),a=await B(r),i=await h(),t=await i.vaultState(a);if(n!==t.want.address)throw new u(`This vault needs ${t.want.symbol} (${t.want.address}, chain 4663), not the supplied token. No USDG zap is provided.`);if(a.status!=="active")throw new u(`The Beefy API marks this vault ${a.status}; deposits are unavailable.`);if(t.paused)throw new u("The Beefy strategy is paused; deposits are unavailable.");if(await i.balanceOf(t.want.address,s)<o)throw new u(`Insufficient ${t.want.symbol} want balance.`);let d=[e.approval(t.want.address,a.earnContractAddress,o.toString(),c),e.unsignedTx({to:a.earnContractAddress,data:M({abi:S,functionName:"deposit",args:[o]}),value:"0",chainId:c,description:`Deposit ${o} want base units into ${a.name}.`})];return F(d,s,"Deposit into",a)})},{name:"beefy_withdraw",inputSchema:{type:"object",properties:{vault:$,shares:{anyOf:[x,{const:"all"}]},chainId:{const:c}},required:["vault","shares"],additionalProperties:!1},execute:(r,s)=>l(async()=>{A(r,["vault","shares"]),p(s);let o=r.shares==="all"?void 0:L(r.shares),n=await B(r),a=await h();await a.vaultState(n);let i=await a.balanceOf(n.earnContractAddress,s),t=o??i;if(t===0n||t>i)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let d=[e.unsignedTx({to:n.earnContractAddress,data:M({abi:S,functionName:"withdraw",args:[t]}),value:"0",chainId:c,description:`Withdraw ${t} share base units from ${n.name} to the calling wallet.`})];return F(d,s,"Withdraw from",n)})}],positions:r=>l(async()=>{p(r);let[s,o]=await Promise.all([k(),h()]),n=[];for(let a of s){let i=await o.balanceOf(a.earnContractAddress,r);if(i===0n)continue;let t=await o.vaultState(a);n.push({module:"beefy",id:a.earnContractAddress,chainId:c,assets:[{token:t.want,amount:(i*t.pricePerFullShare/10n**18n).toString()}],description:`${a.name}: ${e.formatAmount(i.toString(),t.shares.decimals)} ${t.shares.symbol} shares (${a.earnContractAddress}); want estimate before withdrawal fees at block ${o.blockNumber}. API ${a.status}; strategy paused ${t.paused}. ${w(a.earnContractAddress)?"Recorded fork-qualified vault.":"Inventory only; writes are not fork-qualified."}`})}return n})}};function se(e){return q("beefy",[K(e)])}export{se as createModule,K as createModulePart};
@@ -1 +1 @@
1
- import{a,b,c}from"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";export{c as createModule,b as createModulePart,a as readClankerTokens};
1
+ import{a,b,c}from"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";export{c as createModule,b as createModulePart,a as readClankerTokens};
@@ -56,6 +56,17 @@ export declare const identityAbi: readonly [{
56
56
  readonly name: "newURI";
57
57
  }];
58
58
  readonly outputs: readonly [];
59
+ }, {
60
+ readonly name: "balanceOf";
61
+ readonly type: "function";
62
+ readonly stateMutability: "view";
63
+ readonly inputs: readonly [{
64
+ readonly type: "address";
65
+ readonly name: "owner";
66
+ }];
67
+ readonly outputs: readonly [{
68
+ readonly type: "uint256";
69
+ }];
59
70
  }, {
60
71
  readonly name: "ownerOf";
61
72
  readonly type: "function";
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"../../../chunks/XUL6NKAK.js";import"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";export{b as CLI_ALIASES,e as createModule,d as createModulePart,a as identityAbi,c as readAgentIdentity};
1
+ import{a,b,c,d,e}from"../../../chunks/A5O3SRHY.js";import"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";export{b as CLI_ALIASES,e as createModule,d as createModulePart,a as identityAbi,c as readAgentIdentity};
@@ -1 +1 @@
1
- import{b as T,o as O}from"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/64EN6Y7E.js";import{b as L}from"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import{a as C,d as N,e as I}from"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import{a as h,d as P,i as $,j as y}from"../../../chunks/25EOXUBI.js";import{a as M}from"../../../chunks/B5RZYFQC.js";import{a as s}from"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";import{getAddress as G,parseAbi as _}from"viem";var a=G($[4663].vaults.groveAlm.address),q="0x29626c2d8ca49a51e4deceec5499e52983c42bd5",F=(1n<<256n)-1n,c=_(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function maxWithdraw(address) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)"]),A={type:"string",pattern:"^[0-9]+$",description:"Positive integer in token base units."},k={type:"string",description:`Public Grove vault only: ${a}. Defaults to this vault.`},U={type:"integer",minimum:0,maximum:9999,default:T};function D(e){if(typeof e!="string")throw new s("Amount must be a positive integer string in base units.");let o=M(e);if(o===0n||o>F)throw new s("Amount must be positive and within the uint256 range.");return o}function w(e){if(typeof e!="bigint"||e<0n||e>F)throw new s("Grove returned an invalid integer read.");return e}function x(e,o,m){if(C(o),Object.keys(e).some(d=>!["vault",...m].includes(d)))throw new s("Unsupported Grove argument.");if(e.vault!==void 0){if(typeof e.vault!="string")throw new s("Provide the public Grove vault address.");if(e.vault.toLowerCase()===q)throw new s("The Grove ALM proxy is allocator infrastructure, not the public ERC-4626 vault.");if(C(e.vault),e.vault.toLowerCase()!==a.toLowerCase())throw new s("Only the public Grove ERC-4626 vault is supported.")}}function R(e,o,m){let d=m===void 0?T:m;if(typeof d!="number")throw new s("Slippage must be an integer from 0 to 9999 bps.");let t=BigInt(O(e.toString(),d)),n=o===void 0?t:D(o);if(n<=0n||n>e)throw new s("The minimum output must be positive and no greater than the quoted output.");return n}function E(e,o){let m=0n;for(let d of e.changes)if(!(d.token.chainId!==o.chainId||d.token.address.toLowerCase()!==o.address.toLowerCase())){if(d.token.decimals!==o.decimals||typeof d.amount!="string"||!/^-?\d+$/.test(d.amount))throw new s("Grove preview returned invalid token metadata or amounts.");m+=BigInt(d.amount)}return m}var j=e=>{async function o(t){try{return await t()}catch(n){throw new s(e.plainError(n))}}async function m(){let t=e.clientFor(h);if(await t.getChainId()!==h)throw new s("Grove requires an RPC endpoint on chain 4663.");let n=await t.readContract({address:a,abi:c,functionName:"asset"});if(typeof n!="string"||n.toLowerCase()!==y.toLowerCase())throw new s("The public Grove vault must use canonical USDG on chain 4663.");let[i,u]=await Promise.all([t.readContract({address:G(y),abi:c,functionName:"decimals"}),t.readContract({address:a,abi:c,functionName:"decimals"})]);if(i!==P||u!==18)throw new s("Grove token decimals differ from the evidenced USDG/share interface.");let r={address:G(y),chainId:h,decimals:i,symbol:"USDG"};return{client:t,asset:r,shareToken:{address:a,chainId:h,decimals:u,symbol:"Grove shares"}}}async function d(t,n,i,u,r,l){let f=await e.preview(t,n);if(E(f,i)!==-u)throw new s("Grove simulation did not show the exact requested token outflow.");if(E(f,r)<l)throw new s("Grove simulated output is below the minimum.");let g=f.changes.map(({token:v,amount:b})=>{let S=b.startsWith("-");return`${S?"-":"+"}${e.formatAmount(S?b.slice(1):b,v.decimals)} ${v.symbol} (${v.address}, chain ${v.chainId})`}).join("; ");return{txs:t,summary:`${f.summary} ${g}. Minimum ${l} base units of ${r.address} is a preview check, not enforced on-chain by standard ERC-4626. Re-preview before signing; execution output can change.`}}return{tools:[{name:"grove_list",inputSchema:{type:"object",properties:{vault:k},additionalProperties:!1},execute:(t,n)=>o(async()=>{x(t,n,[]);let{client:i,asset:u,shareToken:r}=await m(),[l,f,p,g,v,b]=await Promise.all([i.readContract({address:a,abi:c,functionName:"totalAssets"}),i.readContract({address:a,abi:c,functionName:"totalSupply"}),i.readContract({address:a,abi:c,functionName:"maxDeposit",args:[n]}),i.readContract({address:a,abi:c,functionName:"maxWithdraw",args:[n]}),i.readContract({address:a,abi:c,functionName:"performanceFee"}),i.readContract({address:a,abi:c,functionName:"managementFee"})]);return[{vault:a,chainId:h,name:"Grove x Steakhouse USDG",asset:u,shareToken:r,totalAssets:{token:u,amount:w(l).toString()},totalSupply:{token:r,amount:w(f).toString()},maxDeposit:w(p)===0n?null:p.toString(),maxWithdraw:w(g)===0n?null:g.toString(),maxViewCaveat:"Zero Morpho V2 maximum views mean unknown capacity. Simulate the requested action; full exits use the fresh share balance.",fees:{performanceFeeRaw:w(v).toString(),managementFeeRaw:w(b).toString()}}]})},{name:"grove_deposit",inputSchema:{type:"object",properties:{vault:k,amount:A,minSharesOut:A,slippageBps:U},required:["amount"],additionalProperties:!1},execute:(t,n)=>o(async()=>{x(t,n,["amount","minSharesOut","slippageBps"]);let i=D(t.amount),{client:u,asset:r,shareToken:l}=await m(),f=w(await u.readContract({address:a,abi:c,functionName:"previewDeposit",args:[i]})),p=R(f,t.minSharesOut,t.slippageBps),g=N(a,r.address,i.toString(),n,h),v=[e.approval(r.address,a,i.toString(),h),e.unsignedTx(g.txs[1])];return d(v,n,r,i,l,p)})},{name:"grove_withdraw",inputSchema:{type:"object",properties:{vault:k,shares:{oneOf:[A,{const:"all",description:"Redeem the fresh full share balance."}]},minAmountOut:A,slippageBps:U},required:["shares"],additionalProperties:!1},execute:(t,n)=>o(async()=>{x(t,n,["shares","minAmountOut","slippageBps"]);let i=t.shares==="all"?void 0:D(t.shares),{client:u,asset:r,shareToken:l}=await m(),f=w(await u.readContract({address:a,abi:c,functionName:"balanceOf",args:[n]})),p=i??f;if(p===0n||p>f)throw new s("The Grove share balance is insufficient for this withdrawal.");let g=w(await u.readContract({address:a,abi:c,functionName:"previewRedeem",args:[p]})),v=R(g,t.minAmountOut,t.slippageBps),S=I(a,p.toString(),n,h).txs.map(B=>e.unsignedTx({...B,description:`Redeem ${p} Grove share base units to the wallet.`}));return d(S,n,l,p,r,v)})}],positions:t=>o(async()=>{C(t);let{client:n,asset:i,shareToken:u}=await m(),r=w(await n.readContract({address:a,abi:c,functionName:"balanceOf",args:[t]}));if(r===0n)return[];let l=w(await n.readContract({address:a,abi:c,functionName:"previewRedeem",args:[r]}));return[{module:"grove",id:`${h}:${a.toLowerCase()}`,chainId:h,assets:[{token:i,amount:l.toString()}],description:`${e.formatAmount(r.toString(),u.decimals)} Grove shares (${r} base units, ${u.decimals} decimals, ${a}); estimated USDG redemption, subject to simulation.`}]})}},K=e=>L("grove",[j(e)]);export{K as createModule,j as createModulePart};
1
+ import{b as T,o as O}from"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/74X7PXPR.js";import{b as L}from"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import{a as C,d as N,e as I}from"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import{a as h,d as P,i as $,j as y}from"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import{a as M}from"../../../chunks/7I6TXFXR.js";import{a as s}from"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";import{getAddress as G,parseAbi as _}from"viem";var a=G($[4663].vaults.groveAlm.address),q="0x29626c2d8ca49a51e4deceec5499e52983c42bd5",F=(1n<<256n)-1n,c=_(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function maxWithdraw(address) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)"]),A={type:"string",pattern:"^[0-9]+$",description:"Positive integer in token base units."},k={type:"string",description:`Public Grove vault only: ${a}. Defaults to this vault.`},U={type:"integer",minimum:0,maximum:9999,default:T};function D(e){if(typeof e!="string")throw new s("Amount must be a positive integer string in base units.");let o=M(e);if(o===0n||o>F)throw new s("Amount must be positive and within the uint256 range.");return o}function w(e){if(typeof e!="bigint"||e<0n||e>F)throw new s("Grove returned an invalid integer read.");return e}function x(e,o,m){if(C(o),Object.keys(e).some(d=>!["vault",...m].includes(d)))throw new s("Unsupported Grove argument.");if(e.vault!==void 0){if(typeof e.vault!="string")throw new s("Provide the public Grove vault address.");if(e.vault.toLowerCase()===q)throw new s("The Grove ALM proxy is allocator infrastructure, not the public ERC-4626 vault.");if(C(e.vault),e.vault.toLowerCase()!==a.toLowerCase())throw new s("Only the public Grove ERC-4626 vault is supported.")}}function R(e,o,m){let d=m===void 0?T:m;if(typeof d!="number")throw new s("Slippage must be an integer from 0 to 9999 bps.");let t=BigInt(O(e.toString(),d)),n=o===void 0?t:D(o);if(n<=0n||n>e)throw new s("The minimum output must be positive and no greater than the quoted output.");return n}function E(e,o){let m=0n;for(let d of e.changes)if(!(d.token.chainId!==o.chainId||d.token.address.toLowerCase()!==o.address.toLowerCase())){if(d.token.decimals!==o.decimals||typeof d.amount!="string"||!/^-?\d+$/.test(d.amount))throw new s("Grove preview returned invalid token metadata or amounts.");m+=BigInt(d.amount)}return m}var j=e=>{async function o(t){try{return await t()}catch(n){throw new s(e.plainError(n))}}async function m(){let t=e.clientFor(h);if(await t.getChainId()!==h)throw new s("Grove requires an RPC endpoint on chain 4663.");let n=await t.readContract({address:a,abi:c,functionName:"asset"});if(typeof n!="string"||n.toLowerCase()!==y.toLowerCase())throw new s("The public Grove vault must use canonical USDG on chain 4663.");let[i,u]=await Promise.all([t.readContract({address:G(y),abi:c,functionName:"decimals"}),t.readContract({address:a,abi:c,functionName:"decimals"})]);if(i!==P||u!==18)throw new s("Grove token decimals differ from the evidenced USDG/share interface.");let r={address:G(y),chainId:h,decimals:i,symbol:"USDG"};return{client:t,asset:r,shareToken:{address:a,chainId:h,decimals:u,symbol:"Grove shares"}}}async function d(t,n,i,u,r,l){let f=await e.preview(t,n);if(E(f,i)!==-u)throw new s("Grove simulation did not show the exact requested token outflow.");if(E(f,r)<l)throw new s("Grove simulated output is below the minimum.");let g=f.changes.map(({token:v,amount:b})=>{let S=b.startsWith("-");return`${S?"-":"+"}${e.formatAmount(S?b.slice(1):b,v.decimals)} ${v.symbol} (${v.address}, chain ${v.chainId})`}).join("; ");return{txs:t,summary:`${f.summary} ${g}. Minimum ${l} base units of ${r.address} is a preview check, not enforced on-chain by standard ERC-4626. Re-preview before signing; execution output can change.`}}return{tools:[{name:"grove_list",inputSchema:{type:"object",properties:{vault:k},additionalProperties:!1},execute:(t,n)=>o(async()=>{x(t,n,[]);let{client:i,asset:u,shareToken:r}=await m(),[l,f,p,g,v,b]=await Promise.all([i.readContract({address:a,abi:c,functionName:"totalAssets"}),i.readContract({address:a,abi:c,functionName:"totalSupply"}),i.readContract({address:a,abi:c,functionName:"maxDeposit",args:[n]}),i.readContract({address:a,abi:c,functionName:"maxWithdraw",args:[n]}),i.readContract({address:a,abi:c,functionName:"performanceFee"}),i.readContract({address:a,abi:c,functionName:"managementFee"})]);return[{vault:a,chainId:h,name:"Grove x Steakhouse USDG",asset:u,shareToken:r,totalAssets:{token:u,amount:w(l).toString()},totalSupply:{token:r,amount:w(f).toString()},maxDeposit:w(p)===0n?null:p.toString(),maxWithdraw:w(g)===0n?null:g.toString(),maxViewCaveat:"Zero Morpho V2 maximum views mean unknown capacity. Simulate the requested action; full exits use the fresh share balance.",fees:{performanceFeeRaw:w(v).toString(),managementFeeRaw:w(b).toString()}}]})},{name:"grove_deposit",inputSchema:{type:"object",properties:{vault:k,amount:A,minSharesOut:A,slippageBps:U},required:["amount"],additionalProperties:!1},execute:(t,n)=>o(async()=>{x(t,n,["amount","minSharesOut","slippageBps"]);let i=D(t.amount),{client:u,asset:r,shareToken:l}=await m(),f=w(await u.readContract({address:a,abi:c,functionName:"previewDeposit",args:[i]})),p=R(f,t.minSharesOut,t.slippageBps),g=N(a,r.address,i.toString(),n,h),v=[e.approval(r.address,a,i.toString(),h),e.unsignedTx(g.txs[1])];return d(v,n,r,i,l,p)})},{name:"grove_withdraw",inputSchema:{type:"object",properties:{vault:k,shares:{oneOf:[A,{const:"all",description:"Redeem the fresh full share balance."}]},minAmountOut:A,slippageBps:U},required:["shares"],additionalProperties:!1},execute:(t,n)=>o(async()=>{x(t,n,["shares","minAmountOut","slippageBps"]);let i=t.shares==="all"?void 0:D(t.shares),{client:u,asset:r,shareToken:l}=await m(),f=w(await u.readContract({address:a,abi:c,functionName:"balanceOf",args:[n]})),p=i??f;if(p===0n||p>f)throw new s("The Grove share balance is insufficient for this withdrawal.");let g=w(await u.readContract({address:a,abi:c,functionName:"previewRedeem",args:[p]})),v=R(g,t.minAmountOut,t.slippageBps),S=I(a,p.toString(),n,h).txs.map(B=>e.unsignedTx({...B,description:`Redeem ${p} Grove share base units to the wallet.`}));return d(S,n,l,p,r,v)})}],positions:t=>o(async()=>{C(t);let{client:n,asset:i,shareToken:u}=await m(),r=w(await n.readContract({address:a,abi:c,functionName:"balanceOf",args:[t]}));if(r===0n)return[];let l=w(await n.readContract({address:a,abi:c,functionName:"previewRedeem",args:[r]}));return[{module:"grove",id:`${h}:${a.toLowerCase()}`,chainId:h,assets:[{token:i,amount:l.toString()}],description:`${e.formatAmount(r.toString(),u.decimals)} Grove shares (${r} base units, ${u.decimals} decimals, ${a}); estimated USDG redemption, subject to simulation.`}]})}},K=e=>L("grove",[j(e)]);export{K as createModule,j as createModulePart};
@@ -1 +1 @@
1
- import{a as E}from"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import{b as x}from"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import{a as m}from"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import{a as d,c as M}from"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";var D="https://heyresearch.xyz",v=6e4,N=120,A=/^0x[0-9a-fA-F]{40}$/,H=/^[a-z0-9][a-z0-9-]{0,79}$/,S="HEY records public activity. These records are not investment advice, a buy or sell signal, or a safety verdict. Null means not measured.",b=new WeakMap;function i(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function p(e){return typeof e=="string"&&e.trim().length>0}function w(e){return p(e)&&Number.isFinite(Date.parse(e))}function k(e){return e===null||typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function C(e){if(!p(e))return!1;try{let t=new URL(e);return t.origin===D&&!t.username&&!t.password}catch{return!1}}function g(){throw new d("HEY returned an unexpected response. Please try again.")}function $(e,t){if((e.schema!=="hey.agent-intelligence-response"||e.schemaVersion!=="1"||e.capability!==t||e.status!=="ok"||!i(e.chain)||e.chain.chainId!==m||!i(e.data)||!i(e.links)||!C(e.links.page)||!i(e.citation)||!p(e.citation.text)||!w(e.citation.asOf)||!w(e.asOf))&&g(),t==="research_project"){(!i(e.subject)||!i(e.subject.project)||!p(e.subject.project.slug)||!i(e.data.builderState)||!p(e.data.builderState.activityStatus)||typeof e.data.builderState.activityMeasured!="boolean"||!k(e.data.builderState.meaningfulEvents30d))&&g();let n=e.subject.project.token;n!=null&&(!i(n)||n.chainId!==m||typeof n.address!="string"||!A.test(n.address))&&g()}else(!i(e.data.window)||!w(e.data.window.from)||!w(e.data.window.to)||!i(e.data.shipped)||!k(e.data.shipped.ships)||!k(e.data.shipped.projects))&&g()}function R(e,t){(e.chain_id!==m||typeof e.contract_address!="string"||e.contract_address.toLowerCase()!==t||!C(e.project_link)||!p(e.hey_status_label)||!p(e.token_verification)||typeof e.activity_applies_to_token!="boolean"||typeof e.activity_measured!="boolean"||!k(e.meaningful_ships_30d)||!w(e.as_of)||!p(e.disclaimer)||e.token_verification==="MISMATCH"&&e.activity_applies_to_token!==!1)&&g()}function L(e){(e.chainId!==m||!Array.isArray(e.days)||e.days.length===0||!e.days.every(t=>i(t)&&typeof t.day=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t.day)&&k(t.ships)&&k(t.transactions)&&(t.chainObservedAt===null||w(t.chainObservedAt))))&&g()}var y=class extends d{constructor(n,r,s){super(s);this.status=n;this.code=r}status;code};function I(e,t){let n=i(t)?t.error:void 0,r=i(n)?n.code:n;if(e===400&&r==="ambiguous"){let c=(i(n)&&Array.isArray(n.candidates)?n.candidates:[]).flatMap(u=>i(u)&&typeof u.slug=="string"&&H.test(u.slug)?[u.slug]:[]);return new y(e,r,`The HEY query is ambiguous. Choose a project slug${c.length?`: ${c.join(", ")}`:" or use a contract address"}.`)}if(e===404&&r==="not_found"){let s=i(t)&&C(t.scan_url)?` See ${t.scan_url}.`:"";return new y(e,r,`HEY has not published a matching project. This describes its index, not the token.${s}`)}return new y(e,r,e===400?"HEY could not resolve this request. Check the project or token address.":`HEY returned HTTP ${e}. Please try again.`)}function Y(e){if(e!==null&&/^\d+(\.\d+)?$/.test(e)&&Number.isFinite(Number(e)))return Math.max(1e3,Number(e)*1e3);let t=e===null?NaN:Date.parse(e);return Number.isFinite(t)?Math.max(1e3,t-Date.now()):v}function O(e){let t=b.get(e.http);t||(t={cache:new Map,pending:new Map,requests:[],retryAt:0},b.set(e.http,t));let n=t;return async(r,s)=>{let c=Date.now();for(let[a,o]of n.cache)o.expires<=c&&n.cache.delete(a);let u=n.cache.get(r);if(u)return structuredClone(u.body);let l=n.pending.get(r);if(l)return structuredClone(await l);if(n.requests=n.requests.filter(a=>a>c-v),n.retryAt>c||n.requests.length>=N)throw new d("HEY received too many requests. Please try again later.");n.requests.push(c);let j=(async()=>{try{let a=await e.http(`${D}${r}`,{method:"GET",credentials:"omit",redirect:"error",headers:{accept:"application/json","x-hey-integration":"oak/1.0.0","user-agent":"oak/1.0.0"},signal:AbortSignal.timeout(1e4)}).catch(h=>{if(h instanceof E)return h.response;throw h});if(a.status===429)throw n.retryAt=Math.max(n.retryAt,Date.now()+Y(a.headers.get("retry-after"))),await a.body?.cancel(),new d("HEY received too many requests. Please try again later.");let o;try{o=await a.json()}catch{throw a.ok?new d("HEY returned malformed JSON. Please try again."):I(a.status,null)}if(!a.ok)throw I(a.status,o);return i(o)||g(),s(o),n.cache.set(r,{body:o,expires:Date.now()+v}),o}catch(a){throw a instanceof d?a:new d(M(a))}})();n.pending.set(r,j);try{return structuredClone(await j)}finally{n.pending.delete(r)}}}function P(e,t){if(!i(e)||Object.keys(e).some(n=>n!==t))throw new d(`Provide only ${t}; HEY reads are fixed to Robinhood Chain 4663.`)}var U=e=>{let t=O(e);return{tools:[{name:"heyresearch_research_project",inputSchema:{type:"object",additionalProperties:!1,required:["project"],properties:{project:{type:"string",minLength:1,maxLength:200,description:"A project slug, project name, ticker search, or token contract address on chain 4663."}}},async execute(n){if(P(n,"project"),!p(n.project)||n.project.trim().length>200)throw new d("Provide a project slug, name, ticker, or token contract address.");let r=n.project.trim();if(/^0x/i.test(r)&&!A.test(r))throw new d("Provide a full token contract address on Robinhood Chain 4663.");let s=A.test(r)?"address":H.test(r)?"project":"q",c=s==="address"?r.toLowerCase():r,u=f=>t(`/api/agent/research_project?${f}=${encodeURIComponent(c)}`,q=>$(q,"research_project")),l;try{l=await u(s)}catch(f){if(s!=="project"||!(f instanceof y)||f.status!==404||f.code!=="not_found")throw f;l=await u("q")}let j=l.subject.project,a=i(j.token)?j.token.address:void 0,o=s==="address"?c:a?.toLowerCase(),h=o?await t(`/api/v1/builder?chain=${m}&token=${o}&integration=oak/1.0.0`,f=>R(f,o)):null,_=h?.activity_applies_to_token===!1;s==="address"&&a&&a.toLowerCase()!==o&&!_&&g();let T=l.links;return{chainId:m,research:l,builder:h,attribution:{page:T.page,citation:l.citation,...h&&!_?{project_link:h.project_link}:{}},warnings:_?["This activity belongs to the project, not this token. The project names a different contract; do not link this token to the project."]:[],notAdvice:!0,disclaimer:S}}},{name:"heyresearch_chain_activity",inputSchema:{type:"object",additionalProperties:!1,properties:{days:{type:"integer",minimum:1,maximum:30,default:7,description:"UTC days of chain activity alongside the seven-day builder brief."}}},async execute(n){P(n,"days");let r=n.days===void 0?7:n.days;if(typeof r!="number"||!Number.isInteger(r)||r<1||r>30)throw new d("Provide a whole number of days from 1 to 30.");let s=await t("/api/agent/chain_brief",u=>$(u,"chain_brief")),c=await t(`/api/chain?days=${r}`,L);return{chainId:m,brief:s,activity:c,attribution:{page:s.links.page,citation:s.citation,activity:`${D}/api/chain?days=${r}`},notAdvice:!0,disclaimer:S}}}]}},J=e=>x("heyresearch",[U(e)]);export{J as createModule,U as createModulePart};
1
+ import{a as E}from"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import{b as x}from"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import{a as m}from"../../../chunks/5BP72XOA.js";import"../../../chunks/7I6TXFXR.js";import{a as d,d as M}from"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";var D="https://heyresearch.xyz",v=6e4,N=120,A=/^0x[0-9a-fA-F]{40}$/,H=/^[a-z0-9][a-z0-9-]{0,79}$/,b="HEY records public activity. These records are not investment advice, a buy or sell signal, or a safety verdict. Null means not measured.",S=new WeakMap;function i(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function p(e){return typeof e=="string"&&e.trim().length>0}function w(e){return p(e)&&Number.isFinite(Date.parse(e))}function k(e){return e===null||typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function C(e){if(!p(e))return!1;try{let t=new URL(e);return t.origin===D&&!t.username&&!t.password}catch{return!1}}function g(){throw new d("HEY returned an unexpected response. Please try again.")}function $(e,t){if((e.schema!=="hey.agent-intelligence-response"||e.schemaVersion!=="1"||e.capability!==t||e.status!=="ok"||!i(e.chain)||e.chain.chainId!==m||!i(e.data)||!i(e.links)||!C(e.links.page)||!i(e.citation)||!p(e.citation.text)||!w(e.citation.asOf)||!w(e.asOf))&&g(),t==="research_project"){(!i(e.subject)||!i(e.subject.project)||!p(e.subject.project.slug)||!i(e.data.builderState)||!p(e.data.builderState.activityStatus)||typeof e.data.builderState.activityMeasured!="boolean"||!k(e.data.builderState.meaningfulEvents30d))&&g();let n=e.subject.project.token;n!=null&&(!i(n)||n.chainId!==m||typeof n.address!="string"||!A.test(n.address))&&g()}else(!i(e.data.window)||!w(e.data.window.from)||!w(e.data.window.to)||!i(e.data.shipped)||!k(e.data.shipped.ships)||!k(e.data.shipped.projects))&&g()}function R(e,t){(e.chain_id!==m||typeof e.contract_address!="string"||e.contract_address.toLowerCase()!==t||!C(e.project_link)||!p(e.hey_status_label)||!p(e.token_verification)||typeof e.activity_applies_to_token!="boolean"||typeof e.activity_measured!="boolean"||!k(e.meaningful_ships_30d)||!w(e.as_of)||!p(e.disclaimer)||e.token_verification==="MISMATCH"&&e.activity_applies_to_token!==!1)&&g()}function L(e){(e.chainId!==m||!Array.isArray(e.days)||e.days.length===0||!e.days.every(t=>i(t)&&typeof t.day=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t.day)&&k(t.ships)&&k(t.transactions)&&(t.chainObservedAt===null||w(t.chainObservedAt))))&&g()}var y=class extends d{constructor(n,r,s){super(s);this.status=n;this.code=r}status;code};function I(e,t){let n=i(t)?t.error:void 0,r=i(n)?n.code:n;if(e===400&&r==="ambiguous"){let c=(i(n)&&Array.isArray(n.candidates)?n.candidates:[]).flatMap(u=>i(u)&&typeof u.slug=="string"&&H.test(u.slug)?[u.slug]:[]);return new y(e,r,`The HEY query is ambiguous. Choose a project slug${c.length?`: ${c.join(", ")}`:" or use a contract address"}.`)}if(e===404&&(r==="not_found"||r==="not_published")){let s=i(t)&&C(t.scan_url)?` See ${t.scan_url}.`:"";return new y(e,r,`HEY has not published a matching project. This describes its index, not the token.${s}`)}return new y(e,r,e===400?"HEY could not resolve this request. Check the project or token address.":`HEY returned HTTP ${e}. Please try again.`)}function Y(e){if(e!==null&&/^\d+(\.\d+)?$/.test(e)&&Number.isFinite(Number(e)))return Math.max(1e3,Number(e)*1e3);let t=e===null?NaN:Date.parse(e);return Number.isFinite(t)?Math.max(1e3,t-Date.now()):v}function O(e){let t=S.get(e.http);t||(t={cache:new Map,pending:new Map,requests:[],retryAt:0},S.set(e.http,t));let n=t;return async(r,s)=>{let c=Date.now();for(let[a,o]of n.cache)o.expires<=c&&n.cache.delete(a);let u=n.cache.get(r);if(u)return structuredClone(u.body);let l=n.pending.get(r);if(l)return structuredClone(await l);if(n.requests=n.requests.filter(a=>a>c-v),n.retryAt>c||n.requests.length>=N)throw new d("HEY received too many requests. Please try again later.");n.requests.push(c);let _=(async()=>{try{let a=await e.http(`${D}${r}`,{method:"GET",credentials:"omit",redirect:"error",headers:{accept:"application/json","x-hey-integration":"oak/1.0.0","user-agent":"oak/1.0.0"},signal:AbortSignal.timeout(1e4)}).catch(h=>{if(h instanceof E)return h.response;throw h});if(a.status===429)throw n.retryAt=Math.max(n.retryAt,Date.now()+Y(a.headers.get("retry-after"))),await a.body?.cancel(),new d("HEY received too many requests. Please try again later.");let o;try{o=await a.json()}catch{throw a.ok?new d("HEY returned malformed JSON. Please try again."):I(a.status,null)}if(!a.ok)throw I(a.status,o);return i(o)||g(),s(o),n.cache.set(r,{body:o,expires:Date.now()+v}),o}catch(a){throw a instanceof d?a:new d(M(a))}})();n.pending.set(r,_);try{return structuredClone(await _)}finally{n.pending.delete(r)}}}function P(e,t){if(!i(e)||Object.keys(e).some(n=>n!==t))throw new d(`Provide only ${t}; HEY reads are fixed to Robinhood Chain 4663.`)}var U=e=>{let t=O(e);return{tools:[{name:"heyresearch_research_project",inputSchema:{type:"object",additionalProperties:!1,required:["project"],properties:{project:{type:"string",minLength:1,maxLength:200,description:"A project slug, project name, ticker search, or token contract address on chain 4663."}}},async execute(n){if(P(n,"project"),!p(n.project)||n.project.trim().length>200)throw new d("Provide a project slug, name, ticker, or token contract address.");let r=n.project.trim();if(/^0x/i.test(r)&&!A.test(r))throw new d("Provide a full token contract address on Robinhood Chain 4663.");let s=A.test(r)?"address":H.test(r)?"project":"q",c=s==="address"?r.toLowerCase():r,u=f=>t(`/api/agent/research_project?${f}=${encodeURIComponent(c)}`,q=>$(q,"research_project")),l;try{l=await u(s)}catch(f){if(s!=="project"||!(f instanceof y)||f.status!==404||f.code!=="not_found")throw f;l=await u("q")}let _=l.subject.project,a=i(_.token)?_.token.address:void 0,o=s==="address"?c:a?.toLowerCase(),h=o?await t(`/api/v1/builder?chain=${m}&token=${o}&integration=oak/1.0.0`,f=>R(f,o)):null,j=h?.activity_applies_to_token===!1;s==="address"&&a&&a.toLowerCase()!==o&&!j&&g();let T=l.links;return{chainId:m,research:l,builder:h,attribution:{page:T.page,citation:l.citation,...h&&!j?{project_link:h.project_link}:{}},warnings:j?["This activity belongs to the project, not this token. The project names a different contract; do not link this token to the project."]:[],notAdvice:!0,disclaimer:b}}},{name:"heyresearch_chain_activity",inputSchema:{type:"object",additionalProperties:!1,properties:{days:{type:"integer",minimum:1,maximum:30,default:7,description:"UTC days of chain activity alongside the seven-day builder brief."}}},async execute(n){P(n,"days");let r=n.days===void 0?7:n.days;if(typeof r!="number"||!Number.isInteger(r)||r<1||r>30)throw new d("Provide a whole number of days from 1 to 30.");let s=await t("/api/agent/chain_brief",u=>$(u,"chain_brief")),c=await t(`/api/chain?days=${r}`,L);return{chainId:m,brief:s,activity:c,attribution:{page:s.links.page,citation:s.citation,activity:`${D}/api/chain?days=${r}`},notAdvice:!0,disclaimer:b}}}]}},J=e=>x("heyresearch",[U(e)]);export{J as createModule,U as createModulePart};
@@ -1 +1 @@
1
- import{b as E}from"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import{a as R}from"../../../chunks/VZWOWR6G.js";import{a as s,d as P,i as G,j as v}from"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import{a as r}from"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";import{encodeFunctionData as O,getAddress as W,keccak256 as Q,parseAbi as y,stringToHex as J,zeroAddress as N,zeroHash as j}from"viem";import{normalize as K}from"viem/ens";var $=G[s].hoodag,g=$.registrarController.address,x=$.universalResolver.address,F=$.registrar.address,b=y(["function valid(string) view returns (bool)","function available(string) view returns (bool)","function priceUSDG(string,uint256) view returns (uint256)","function registerManyUSDG(string[],address,uint256,address,(uint256,uint256,uint8,bytes32,bytes32))"]),z=y(["function resolve(string) view returns (address)","function reverse(address) view returns (string name,bool verified)"]),q=y(["function nameExpires(uint256) view returns (uint256)","function ownerOf(uint256) view returns (address)"]),X=y(["function setName(string) returns (bytes32)"]),Y={address:v,chainId:s,symbol:"USDG",decimals:P},V=(1n<<256n)-1n,T={type:"string",description:"A single .hood label or full name."},_={type:"string",pattern:"^[0-9]+$",default:"31536000",description:"Registration duration in whole seconds, as a decimal integer string. Minimum 2419200 seconds; defaults to one year."};function H(e){if(typeof e!="string"||!e.trim())throw new r("Provide a .hood name.");let n;try{n=K(e.trim().replace(/\.hood$/i,""))}catch{throw new r("Provide a valid .hood name.")}if(!n||n.includes("."))throw new r("Provide a single label, optionally ending in .hood.");return{label:n,name:`${n}.hood`}}function Z(e){let n=e===void 0?"31536000":e;if(typeof n!="string"||!/^\d+$/.test(n))throw new r("Duration must be a positive integer string in seconds.");let c=BigInt(n);if(c<=0n||c>V)throw new r("Duration must fit a positive uint256 number of seconds.");if(c<2419200n)throw new r("Duration must be at least 2419200 seconds.");return c}function p(e,n){if(typeof e!="string")throw new r(`Invalid ${n} address.`);if(R(e),e.toLowerCase()===N)throw new r(`Provide a non-zero ${n} address.`);return W(e)}function I(e,n){if(typeof e!="boolean")throw new r(`The ${n} read returned an invalid response.`);return e}function L(e,n){if(typeof e!="bigint"||e<0n||e>V)throw new r(`The ${n} read returned an invalid response.`);return e}function k(e,n,c,A,S,D={}){return{name:`hoodag_${n}`,inputSchema:{type:"object",properties:c,required:A,additionalProperties:!1,...D},execute:async(t,i)=>{try{if(!t||typeof t!="object"||Array.isArray(t))throw new r("Provide tool arguments as an object.");if(Object.keys(t).some(o=>!Object.hasOwn(c,o)))throw new r("Unsupported hood.ag argument.");return await S(t,i)}catch(o){throw new r(e.plainError(o))}}}}var ee=e=>{async function n(t){let{label:i,name:o}=H(t.name),u=Z(t.duration),a=e.clientFor(s);if(!I(await a.readContract({address:g,abi:b,functionName:"valid",args:[i]}),"label validity"))throw new r("This .hood label is not valid.");let m=I(await a.readContract({address:g,abi:b,functionName:"available",args:[i]}),"availability");return{label:i,name:o,duration:u,client:a,available:m}}async function c(t,i){let o=L(await e.clientFor(s).readContract({address:g,abi:b,functionName:"priceUSDG",args:[t,i]}),"USDG rent");if(o===0n)throw new r("The current USDG rent is zero; a registration quote is unavailable.");return{token:{...Y},amount:o.toString()}}let A=k(e,"register",{name:T,duration:_},["name"],async(t,i)=>{let o=p(i,"wallet"),{label:u,name:a,duration:d,available:m}=await n(t);if(!m)throw new r(`${a} is not available.`);let l=await c(u,d),h=[e.approval(v,g,l.amount,s),e.unsignedTx({to:g,chainId:s,value:"0",data:O({abi:b,functionName:"registerManyUSDG",args:[[u],o,d,N,[0n,0n,0,j,j]]}),description:`Register ${a} for ${d} seconds using ${l.amount} USDG base units (6 decimals).`}),e.unsignedTx({to:$.reverseRegistrar.address,chainId:s,value:"0",data:O({abi:X,functionName:"setName",args:[a]}),description:`Set ${a} as the wallet's primary reverse name.`})],f=await e.preview(h,o),M=f.changes.map(({token:w,amount:C})=>{let U=C.startsWith("-"),B=e.formatAmount(U?C.slice(1):C,w.decimals);return`${U?"-":"+"}${B} ${w.symbol} (${w.address}, chain ${w.chainId}, ${w.decimals} decimals)`});return{txs:h,rent:l,duration:d.toString(),preview:f,summary:`Prepare registration of ${a} for ${d} seconds, then set its primary reverse name. Quoted rent: ${l.amount} USDG base units (${v}, chain ${s}, ${P} decimals). ${f.summary}${M.length?` Token changes: ${M.join("; ")}.`:""}`}}),S=k(e,"resolve",{name:T,address:{type:"string",description:"Wallet address for reverse resolution."}},[],async t=>{if(t.name!==void 0==(t.address!==void 0))throw new r("Provide exactly one name or wallet address to resolve.");if(t.name!==void 0){let{name:a}=H(t.name),d=await e.clientFor(s).readContract({address:x,abi:z,functionName:"resolve",args:[a]});if(typeof d=="string"&&d.toLowerCase()===N)throw new r(`No address is set for ${a}.`);return{name:a,address:p(d,"resolved"),chainId:s}}let i=p(t.address,"wallet"),o=await e.clientFor(s).readContract({address:x,abi:z,functionName:"reverse",args:[i]});if(!Array.isArray(o)||o.length!==2||typeof o[0]!="string")throw new r("The reverse read returned an invalid response.");let u=I(o[1],"reverse verification");if(!o[0])throw new r("No reverse name is set for this wallet.");return{address:i,name:o[0],verified:u,chainId:s}},{oneOf:[{required:["name"]},{required:["address"]}]}),D=k(e,"name_info",{name:T,duration:_},["name"],async t=>{let{label:i,name:o,duration:u,available:a,client:d}=await n(t),m=await c(i,u),l=BigInt(Q(J(i))),h=L(await d.readContract({address:F,abi:q,functionName:"nameExpires",args:[l]}),"name expiry"),f=a?null:p(await d.readContract({address:F,abi:q,functionName:"ownerOf",args:[l]}),"name owner");return{name:o,label:i,chainId:s,available:a,tokenId:l.toString(),owner:f,expiresAt:h.toString(),duration:u.toString(),rent:m}});return{tools:[A,S,D]}},se=e=>E("hoodag",[ee(e)]);export{se as createModule,ee as createModulePart};
1
+ import{b as E}from"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import{a as R}from"../../../chunks/VBWJOG3N.js";import{a as s,d as P,i as G,j as v}from"../../../chunks/5BP72XOA.js";import"../../../chunks/7I6TXFXR.js";import{a as r}from"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";import{encodeFunctionData as O,getAddress as W,keccak256 as Q,parseAbi as y,stringToHex as J,zeroAddress as N,zeroHash as j}from"viem";import{normalize as K}from"viem/ens";var $=G[s].hoodag,g=$.registrarController.address,x=$.universalResolver.address,F=$.registrar.address,b=y(["function valid(string) view returns (bool)","function available(string) view returns (bool)","function priceUSDG(string,uint256) view returns (uint256)","function registerManyUSDG(string[],address,uint256,address,(uint256,uint256,uint8,bytes32,bytes32))"]),z=y(["function resolve(string) view returns (address)","function reverse(address) view returns (string name,bool verified)"]),q=y(["function nameExpires(uint256) view returns (uint256)","function ownerOf(uint256) view returns (address)"]),X=y(["function setName(string) returns (bytes32)"]),Y={address:v,chainId:s,symbol:"USDG",decimals:P},V=(1n<<256n)-1n,T={type:"string",description:"A single .hood label or full name."},_={type:"string",pattern:"^[0-9]+$",default:"31536000",description:"Registration duration in whole seconds, as a decimal integer string. Minimum 2419200 seconds; defaults to one year."};function H(e){if(typeof e!="string"||!e.trim())throw new r("Provide a .hood name.");let n;try{n=K(e.trim().replace(/\.hood$/i,""))}catch{throw new r("Provide a valid .hood name.")}if(!n||n.includes("."))throw new r("Provide a single label, optionally ending in .hood.");return{label:n,name:`${n}.hood`}}function Z(e){let n=e===void 0?"31536000":e;if(typeof n!="string"||!/^\d+$/.test(n))throw new r("Duration must be a positive integer string in seconds.");let c=BigInt(n);if(c<=0n||c>V)throw new r("Duration must fit a positive uint256 number of seconds.");if(c<2419200n)throw new r("Duration must be at least 2419200 seconds.");return c}function p(e,n){if(typeof e!="string")throw new r(`Invalid ${n} address.`);if(R(e),e.toLowerCase()===N)throw new r(`Provide a non-zero ${n} address.`);return W(e)}function I(e,n){if(typeof e!="boolean")throw new r(`The ${n} read returned an invalid response.`);return e}function L(e,n){if(typeof e!="bigint"||e<0n||e>V)throw new r(`The ${n} read returned an invalid response.`);return e}function k(e,n,c,A,S,D={}){return{name:`hoodag_${n}`,inputSchema:{type:"object",properties:c,required:A,additionalProperties:!1,...D},execute:async(t,i)=>{try{if(!t||typeof t!="object"||Array.isArray(t))throw new r("Provide tool arguments as an object.");if(Object.keys(t).some(o=>!Object.hasOwn(c,o)))throw new r("Unsupported hood.ag argument.");return await S(t,i)}catch(o){throw new r(e.plainError(o))}}}}var ee=e=>{async function n(t){let{label:i,name:o}=H(t.name),u=Z(t.duration),a=e.clientFor(s);if(!I(await a.readContract({address:g,abi:b,functionName:"valid",args:[i]}),"label validity"))throw new r("This .hood label is not valid.");let m=I(await a.readContract({address:g,abi:b,functionName:"available",args:[i]}),"availability");return{label:i,name:o,duration:u,client:a,available:m}}async function c(t,i){let o=L(await e.clientFor(s).readContract({address:g,abi:b,functionName:"priceUSDG",args:[t,i]}),"USDG rent");if(o===0n)throw new r("The current USDG rent is zero; a registration quote is unavailable.");return{token:{...Y},amount:o.toString()}}let A=k(e,"register",{name:T,duration:_},["name"],async(t,i)=>{let o=p(i,"wallet"),{label:u,name:a,duration:d,available:m}=await n(t);if(!m)throw new r(`${a} is not available.`);let l=await c(u,d),h=[e.approval(v,g,l.amount,s),e.unsignedTx({to:g,chainId:s,value:"0",data:O({abi:b,functionName:"registerManyUSDG",args:[[u],o,d,N,[0n,0n,0,j,j]]}),description:`Register ${a} for ${d} seconds using ${l.amount} USDG base units (6 decimals).`}),e.unsignedTx({to:$.reverseRegistrar.address,chainId:s,value:"0",data:O({abi:X,functionName:"setName",args:[a]}),description:`Set ${a} as the wallet's primary reverse name.`})],f=await e.preview(h,o),M=f.changes.map(({token:w,amount:C})=>{let U=C.startsWith("-"),B=e.formatAmount(U?C.slice(1):C,w.decimals);return`${U?"-":"+"}${B} ${w.symbol} (${w.address}, chain ${w.chainId}, ${w.decimals} decimals)`});return{txs:h,rent:l,duration:d.toString(),preview:f,summary:`Prepare registration of ${a} for ${d} seconds, then set its primary reverse name. Quoted rent: ${l.amount} USDG base units (${v}, chain ${s}, ${P} decimals). ${f.summary}${M.length?` Token changes: ${M.join("; ")}.`:""}`}}),S=k(e,"resolve",{name:T,address:{type:"string",description:"Wallet address for reverse resolution."}},[],async t=>{if(t.name!==void 0==(t.address!==void 0))throw new r("Provide exactly one name or wallet address to resolve.");if(t.name!==void 0){let{name:a}=H(t.name),d=await e.clientFor(s).readContract({address:x,abi:z,functionName:"resolve",args:[a]});if(typeof d=="string"&&d.toLowerCase()===N)throw new r(`No address is set for ${a}.`);return{name:a,address:p(d,"resolved"),chainId:s}}let i=p(t.address,"wallet"),o=await e.clientFor(s).readContract({address:x,abi:z,functionName:"reverse",args:[i]});if(!Array.isArray(o)||o.length!==2||typeof o[0]!="string")throw new r("The reverse read returned an invalid response.");let u=I(o[1],"reverse verification");if(!o[0])throw new r("No reverse name is set for this wallet.");return{address:i,name:o[0],verified:u,chainId:s}},{oneOf:[{required:["name"]},{required:["address"]}]}),D=k(e,"name_info",{name:T,duration:_},["name"],async t=>{let{label:i,name:o,duration:u,available:a,client:d}=await n(t),m=await c(i,u),l=BigInt(Q(J(i))),h=L(await d.readContract({address:F,abi:q,functionName:"nameExpires",args:[l]}),"name expiry"),f=a?null:p(await d.readContract({address:F,abi:q,functionName:"ownerOf",args:[l]}),"name owner");return{name:o,label:i,chainId:s,available:a,tokenId:l.toString(),owner:f,expiresAt:h.toString(),duration:u.toString(),rent:m}});return{tools:[A,S,D]}},se=e=>E("hoodag",[ee(e)]);export{se as createModule,ee as createModulePart};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"../../../chunks/LZK6C5LT.js";import"../../../chunks/YEE3KKTA.js";import"../../../chunks/KP7VSXIQ.js";import"../../../chunks/KFMNCJXJ.js";import"../../../chunks/6YU3JLQQ.js";import"../../../chunks/D45AODDL.js";import"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";export{h as DEFAULT_INCLUSION_MARGIN_SECONDS,a as ERC20_APPROVE_ABI,j as HOODLOCK_AIRDROP_ABI,c as HOODLOCK_AIRDROP_ADDRESS,d as HOODLOCK_API_BASE_URL,b as HOODLOCK_CHAIN_ID,e as MAX_CLAIMS_LIMIT,i as MAX_QUOTE_FEE,f as MAX_URI_BYTES,g as MIN_END_DELAY_SECONDS,l as airdropLeaf,o as buildAirdropTree,m as computeAirdropRootFromProof,q as createAirdropModulePart,r as createModulePart,k as formatSignedAmount,p as rebuildAirdropTreeFromList,n as verifyAirdropProof};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"../../../chunks/T4IYMYZD.js";import"../../../chunks/SXBGOGYQ.js";import"../../../chunks/UIJWIFGV.js";import"../../../chunks/B2LA6VVF.js";import"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/6YQ2RX5I.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/WFE3NXBF.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";export{h as DEFAULT_INCLUSION_MARGIN_SECONDS,a as ERC20_APPROVE_ABI,j as HOODLOCK_AIRDROP_ABI,c as HOODLOCK_AIRDROP_ADDRESS,d as HOODLOCK_API_BASE_URL,b as HOODLOCK_CHAIN_ID,e as MAX_CLAIMS_LIMIT,i as MAX_QUOTE_FEE,f as MAX_URI_BYTES,g as MIN_END_DELAY_SECONDS,l as airdropLeaf,o as buildAirdropTree,m as computeAirdropRootFromProof,q as createAirdropModulePart,r as createModulePart,k as formatSignedAmount,p as rebuildAirdropTreeFromList,n as verifyAirdropProof};
@@ -1 +1 @@
1
- import{a as S,b as P,c as H,d as M,e as y,f as E,g as i,h as m,i as I,j as C,k as N,l as T,m as B,n as f,o as K,p as j,q as r,r as U}from"../../../chunks/LZK6C5LT.js";import{a as d,b as k,c as u,d as L,e as p,f as A,g as D,i as a,j as n,k as R,l as _,m as s,n as O,o as l}from"../../../chunks/UZH4FQEL.js";import"../../../chunks/YEE3KKTA.js";import"../../../chunks/KP7VSXIQ.js";import"../../../chunks/KFMNCJXJ.js";import"../../../chunks/6YU3JLQQ.js";import"../../../chunks/D45AODDL.js";import"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import{b as c}from"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";function G(e,o){let t=o&&o.length>0?[...o]:[l(e)];return t.push(r(e)),c("hoodlock",t)}export{A as DEAD_ADDRESS,m as DEFAULT_INCLUSION_MARGIN_SECONDS,S as ERC20_APPROVE_ABI,C as HOODLOCK_AIRDROP_ABI,H as HOODLOCK_AIRDROP_ADDRESS,M as HOODLOCK_API_BASE_URL,k as HOODLOCK_BURNER_ADDRESS,P as HOODLOCK_CHAIN_ID,u as HOODLOCK_LIQUIDITY_LOCKER_ADDRESS,d as HOODLOCK_LOCKER_ADDRESS,y as MAX_CLAIMS_LIMIT,D as MAX_LOCK_DURATION_SECONDS,I as MAX_QUOTE_FEE,E as MAX_URI_BYTES,i as MIN_END_DELAY_SECONDS,L as UNISWAP_V3_POSITION_MANAGER_ADDRESS,p as UNISWAP_V4_POSITION_MANAGER_ADDRESS,T as airdropLeaf,K as buildAirdropTree,B as computeAirdropRootFromProof,r as createAirdropModulePart,n as createBurnTool,O as createHoodlockLocksBurnPart,R as createListLocksTool,a as createLockTool,l as createLocksBurnModulePart,s as createLocksBurnPart,G as createModule,U as createModulePart,N as formatSignedAmount,_ as readHoodlockPositions,j as rebuildAirdropTreeFromList,f as verifyAirdropProof};
1
+ import{a as S,b as P,c as H,d as M,e as y,f as E,g as i,h as m,i as I,j as C,k as N,l as T,m as B,n as f,o as K,p as j,q as r,r as U}from"../../../chunks/T4IYMYZD.js";import{a as d,b as k,c as u,d as L,e as p,f as A,g as D,i as a,j as n,k as R,l as _,m as s,n as O,o as l}from"../../../chunks/Y2SGXWFM.js";import"../../../chunks/SXBGOGYQ.js";import"../../../chunks/UIJWIFGV.js";import"../../../chunks/B2LA6VVF.js";import"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import{b as c}from"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/6YQ2RX5I.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/WFE3NXBF.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";function G(e,o){let t=o&&o.length>0?[...o]:[l(e)];return t.push(r(e)),c("hoodlock",t)}export{A as DEAD_ADDRESS,m as DEFAULT_INCLUSION_MARGIN_SECONDS,S as ERC20_APPROVE_ABI,C as HOODLOCK_AIRDROP_ABI,H as HOODLOCK_AIRDROP_ADDRESS,M as HOODLOCK_API_BASE_URL,k as HOODLOCK_BURNER_ADDRESS,P as HOODLOCK_CHAIN_ID,u as HOODLOCK_LIQUIDITY_LOCKER_ADDRESS,d as HOODLOCK_LOCKER_ADDRESS,y as MAX_CLAIMS_LIMIT,D as MAX_LOCK_DURATION_SECONDS,I as MAX_QUOTE_FEE,E as MAX_URI_BYTES,i as MIN_END_DELAY_SECONDS,L as UNISWAP_V3_POSITION_MANAGER_ADDRESS,p as UNISWAP_V4_POSITION_MANAGER_ADDRESS,T as airdropLeaf,K as buildAirdropTree,B as computeAirdropRootFromProof,r as createAirdropModulePart,n as createBurnTool,O as createHoodlockLocksBurnPart,R as createListLocksTool,a as createLockTool,l as createLocksBurnModulePart,s as createLocksBurnPart,G as createModule,U as createModulePart,N as formatSignedAmount,_ as readHoodlockPositions,j as rebuildAirdropTreeFromList,f as verifyAirdropProof};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../../../chunks/UZH4FQEL.js";import"../../../chunks/KFMNCJXJ.js";import"../../../chunks/6YU3JLQQ.js";import"../../../chunks/D45AODDL.js";import"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";export{f as DEAD_ADDRESS,b as HOODLOCK_BURNER_ADDRESS,c as HOODLOCK_LIQUIDITY_LOCKER_ADDRESS,a as HOODLOCK_LOCKER_ADDRESS,g as MAX_LOCK_DURATION_SECONDS,d as UNISWAP_V3_POSITION_MANAGER_ADDRESS,e as UNISWAP_V4_POSITION_MANAGER_ADDRESS,j as createBurnTool,n as createHoodlockLocksBurnPart,k as createListLocksTool,i as createLockTool,m as createLocksBurnPart,p as createModule,o as createModulePart,q as default,h as formatSignedAmount,l as readHoodlockPositions};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../../../chunks/Y2SGXWFM.js";import"../../../chunks/SXBGOGYQ.js";import"../../../chunks/UIJWIFGV.js";import"../../../chunks/B2LA6VVF.js";import"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";export{f as DEAD_ADDRESS,b as HOODLOCK_BURNER_ADDRESS,c as HOODLOCK_LIQUIDITY_LOCKER_ADDRESS,a as HOODLOCK_LOCKER_ADDRESS,g as MAX_LOCK_DURATION_SECONDS,d as UNISWAP_V3_POSITION_MANAGER_ADDRESS,e as UNISWAP_V4_POSITION_MANAGER_ADDRESS,j as createBurnTool,n as createHoodlockLocksBurnPart,k as createListLocksTool,i as createLockTool,m as createLocksBurnPart,p as createModule,o as createModulePart,q as default,h as formatSignedAmount,l as readHoodlockPositions};
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../../../chunks/47PKSOXA.js";import"../../../chunks/VZPFBWVH.js";import"../../../chunks/MGEJPRXP.js";import"../../../chunks/ZKOMJGNH.js";import"../../../chunks/YTHDLCHL.js";import"../../../chunks/KFMNCJXJ.js";import"../../../chunks/6YU3JLQQ.js";import"../../../chunks/D45AODDL.js";import"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";export{i as DEAD_ADDRESS,o as DEFAULT_BOUNTY_BPS,q as DEFAULT_FLAT_BOUNTY,j as DEFAULT_HOOKR_FEE,k as DEFAULT_HOOKR_TICK_SPACING,m as DEFAULT_LIFETIME_SECONDS,f as HOOKR_FORWARDER_ADDRESS,A as HOOKR_LIMIT_ORDERS_ABI,a as HOOKR_LIMIT_ORDERS_ADDRESS,g as HOOKR_POOL_MANAGER_ADDRESS,d as HOOKR_QUOTER_ADDRESS,e as HOOKR_REGISTRY_ADDRESS,b as HOOKR_ROOT_ADDRESS,c as HOOKR_ROUTER_ADDRESS,h as HOOKR_TOKEN_ADDRESS,p as MAX_BOUNTY_BPS,r as MAX_FLAT_BOUNTY,n as MAX_LIFETIME_SECONDS,s as MAX_ORDER_SCAN,l as MIN_LIFETIME_SECONDS,z as ORDER_CANCELLED_TOPIC0,y as ORDER_CREATED_TOPIC0,t as ORDER_SCAN_TIMEOUT_MS,x as ORDER_STATUS_CANCELLED,w as ORDER_STATUS_FILLED,u as ORDER_STATUS_NONE,v as ORDER_STATUS_OPEN,I as checkHookrDeployment,D as computePoolId,O as createCreateCancelPart,L as createHookrCancelTool,S as createHookrCreateCancelModule,P as createHookrCreateCancelPart,K as createHookrCreateTool,M as createHookrOrderPositions,R as createModulePart,Q as createPart,N as decodeHookrCalldata,H as decodeOrderCancelledFromReceipt,E as decodeOrderCreatedFromReceipt,T as default,B as formatSignedAmount,C as parseRoundedAmount,J as readHookrOrder,F as recoverOrderIdFromLogs,G as recoverOrderIdFromReceipt};
1
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../../../chunks/M643PYHO.js";import"../../../chunks/RYOVSHKO.js";import"../../../chunks/XKZOMGC3.js";import"../../../chunks/PQHU5A3U.js";import"../../../chunks/F3TOOLFQ.js";import"../../../chunks/SXBGOGYQ.js";import"../../../chunks/UIJWIFGV.js";import"../../../chunks/B2LA6VVF.js";import"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";export{i as DEAD_ADDRESS,o as DEFAULT_BOUNTY_BPS,q as DEFAULT_FLAT_BOUNTY,j as DEFAULT_HOOKR_FEE,k as DEFAULT_HOOKR_TICK_SPACING,m as DEFAULT_LIFETIME_SECONDS,f as HOOKR_FORWARDER_ADDRESS,A as HOOKR_LIMIT_ORDERS_ABI,a as HOOKR_LIMIT_ORDERS_ADDRESS,g as HOOKR_POOL_MANAGER_ADDRESS,d as HOOKR_QUOTER_ADDRESS,e as HOOKR_REGISTRY_ADDRESS,b as HOOKR_ROOT_ADDRESS,c as HOOKR_ROUTER_ADDRESS,h as HOOKR_TOKEN_ADDRESS,p as MAX_BOUNTY_BPS,r as MAX_FLAT_BOUNTY,n as MAX_LIFETIME_SECONDS,s as MAX_ORDER_SCAN,l as MIN_LIFETIME_SECONDS,z as ORDER_CANCELLED_TOPIC0,y as ORDER_CREATED_TOPIC0,t as ORDER_SCAN_TIMEOUT_MS,x as ORDER_STATUS_CANCELLED,w as ORDER_STATUS_FILLED,u as ORDER_STATUS_NONE,v as ORDER_STATUS_OPEN,I as checkHookrDeployment,D as computePoolId,O as createCreateCancelPart,L as createHookrCancelTool,S as createHookrCreateCancelModule,P as createHookrCreateCancelPart,K as createHookrCreateTool,M as createHookrOrderPositions,R as createModulePart,Q as createPart,N as decodeHookrCalldata,H as decodeOrderCancelledFromReceipt,E as decodeOrderCreatedFromReceipt,T as default,B as formatSignedAmount,C as parseRoundedAmount,J as readHookrOrder,F as recoverOrderIdFromLogs,G as recoverOrderIdFromReceipt};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../../../chunks/OOSNTGDJ.js";import"../../../chunks/KFMNCJXJ.js";import"../../../chunks/6YU3JLQQ.js";import"../../../chunks/D45AODDL.js";import"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";export{e as HOOKR_FORWARDER_ADDRESS,h as HOOKR_LIMIT_ORDERS_ABI,b as HOOKR_LIMIT_ORDERS_ADDRESS,a as HOOKR_MODULE_NAME,f as HOOKR_POOL_MANAGER_ADDRESS,c as HOOKR_ROOT_ADDRESS,d as HOOKR_ROUTER_ADDRESS,g as HOOKR_TOKEN_ADDRESS,n as createFillBountyPart,l as createHookrClaimBountyTool,o as createHookrFillBountyPart,k as createHookrFillTool,p as createModulePart,q as default,i as formatSignedAmount,j as parseRoundedAmount,m as readHookrBountyPositions};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../../../chunks/5B3UVWMV.js";import"../../../chunks/SXBGOGYQ.js";import"../../../chunks/UIJWIFGV.js";import"../../../chunks/B2LA6VVF.js";import"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";export{e as HOOKR_FORWARDER_ADDRESS,h as HOOKR_LIMIT_ORDERS_ABI,b as HOOKR_LIMIT_ORDERS_ADDRESS,a as HOOKR_MODULE_NAME,f as HOOKR_POOL_MANAGER_ADDRESS,c as HOOKR_ROOT_ADDRESS,d as HOOKR_ROUTER_ADDRESS,g as HOOKR_TOKEN_ADDRESS,n as createFillBountyPart,l as createHookrClaimBountyTool,o as createHookrFillBountyPart,k as createHookrFillTool,p as createModulePart,q as default,i as formatSignedAmount,j as parseRoundedAmount,m as readHookrBountyPositions};
@@ -1 +1 @@
1
- import{a as r,b as u,h as n,i as c,j as d,k as i,l as m,m as M,n as a,o as p}from"../../../chunks/OOSNTGDJ.js";import{R as t}from"../../../chunks/47PKSOXA.js";import"../../../chunks/VZPFBWVH.js";import"../../../chunks/MGEJPRXP.js";import"../../../chunks/ZKOMJGNH.js";import"../../../chunks/YTHDLCHL.js";import"../../../chunks/KFMNCJXJ.js";import"../../../chunks/6YU3JLQQ.js";import"../../../chunks/D45AODDL.js";import"../../../chunks/24JYIH53.js";import"../../../chunks/VBV366XQ.js";import"../../../chunks/S3YSJ7XH.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/P7Q6MJZH.js";import"../../../chunks/ZUAXW2ZD.js";import"../../../chunks/64EN6Y7E.js";import{b as e}from"../../../chunks/SGDWO7XI.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VZWOWR6G.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/UL2L7NHO.js";import"../../../chunks/25EOXUBI.js";import"../../../chunks/B5RZYFQC.js";import"../../../chunks/T5E4OJEU.js";import"../../../chunks/XN4WDN3O.js";function l(o){return e(r,[t(o),a(o)])}var _=l;var f=l;export{n as HOOKR_LIMIT_ORDERS_ABI,u as HOOKR_LIMIT_ORDERS_ADDRESS,r as HOOKR_MODULE_NAME,a as createFillBountyPart,m as createHookrClaimBountyTool,p as createHookrFillBountyPart,i as createHookrFillTool,_ as createHookrModule,l as createModule,f as default,c as formatSignedAmount,d as parseRoundedAmount,M as readHookrBountyPositions};
1
+ import{a as r,b as u,h as n,i as c,j as d,k as i,l as m,m as M,n as a,o as p}from"../../../chunks/5B3UVWMV.js";import{R as t}from"../../../chunks/M643PYHO.js";import"../../../chunks/RYOVSHKO.js";import"../../../chunks/XKZOMGC3.js";import"../../../chunks/PQHU5A3U.js";import"../../../chunks/F3TOOLFQ.js";import"../../../chunks/SXBGOGYQ.js";import"../../../chunks/UIJWIFGV.js";import"../../../chunks/B2LA6VVF.js";import"../../../chunks/NNJLMS7F.js";import"../../../chunks/XEN45QST.js";import"../../../chunks/Z53DADZ4.js";import"../../../chunks/LIUXNOLP.js";import"../../../chunks/MEZH7RPA.js";import"../../../chunks/TU3KHOZK.js";import"../../../chunks/74X7PXPR.js";import{b as e}from"../../../chunks/UB5U6SI2.js";import"../../../chunks/Z25UKUJF.js";import"../../../chunks/VBWJOG3N.js";import"../../../chunks/5HCXZWUH.js";import"../../../chunks/R5CBH2CR.js";import"../../../chunks/5BP72XOA.js";import"../../../chunks/XAB4OIE3.js";import"../../../chunks/7I6TXFXR.js";import"../../../chunks/Z3FZWNAJ.js";import"../../../chunks/XN4WDN3O.js";function l(o){return e(r,[t(o),a(o)])}var _=l;var f=l;export{n as HOOKR_LIMIT_ORDERS_ABI,u as HOOKR_LIMIT_ORDERS_ADDRESS,r as HOOKR_MODULE_NAME,a as createFillBountyPart,m as createHookrClaimBountyTool,p as createHookrFillBountyPart,i as createHookrFillTool,_ as createHookrModule,l as createModule,f as default,c as formatSignedAmount,d as parseRoundedAmount,M as readHookrBountyPositions};