@seedprotocol/eas 0.7.5 → 0.7.6-next.949.g73caafc
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.
- package/dist/{QueryClient-CeTbKOnt.js → QueryClient-BpCm3D1u.js} +2 -2
- package/dist/QueryClient-BpCm3D1u.js.map +1 -0
- package/dist/index.js +55 -55
- package/dist/index.js.map +1 -1
- package/dist/node.js +1 -1
- package/dist/stores/schemaUidCache.d.ts +2 -0
- package/dist/stores/schemaUidCache.d.ts.map +1 -1
- package/package.json +7 -2
- package/dist/QueryClient-CeTbKOnt.js.map +0 -1
|
@@ -7,7 +7,7 @@ function i() {
|
|
|
7
7
|
}
|
|
8
8
|
var a = class extends Error {
|
|
9
9
|
constructor() {
|
|
10
|
-
super("Two copies of @seedprotocol/eas are loaded, and EAS clients were registered on the other copy (e.g. by SeedClient). Reads through this copy would use different clients and a different chain. Make sure every @seedprotocol/* package is the same version and installed once (`npm ls @seedprotocol/eas`). With Vite,
|
|
10
|
+
super("Two copies of @seedprotocol/eas are loaded, and EAS clients were registered on the other copy (e.g. by SeedClient). Reads through this copy would use different clients and a different chain. Make sure every @seedprotocol/* package is the same version and installed once (`npm ls @seedprotocol/eas`). With Vite, keep @seedprotocol/* packages out of optimizeDeps.exclude so they are pre-bundled together, and dedupe them (seedVitePlugin does) when they are linked into the app."), this.name = "DuplicateEasModuleError";
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
function o() {
|
|
@@ -280,4 +280,4 @@ var I = class {
|
|
|
280
280
|
//#endregion
|
|
281
281
|
export { s as S, _, N as a, a as b, D as c, h as d, m as f, g, v as h, E as i, j as l, d as m, I as n, M as o, u as p, T as r, A as s, R as t, O as u, l as v, o as x, c as y };
|
|
282
282
|
|
|
283
|
-
//# sourceMappingURL=QueryClient-
|
|
283
|
+
//# sourceMappingURL=QueryClient-BpCm3D1u.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryClient-BpCm3D1u.js","names":["TanStackQueryClient","OWNER_KEY","thisCopy","markEasClientOwner","DuplicateEasModuleError","assertSingleEasModule","owner","resetEasClientOwnerForTests","BaseEasClient","impl","BaseQueryClient","OP_STACK_EAS_CONTRACT_ADDRESS","OP_STACK_SCHEMA_REGISTRY_ADDRESS","opStack","easscanSubdomain","easscan","origin","subdomain","EAS_CHAIN_DEPLOYMENTS","DEFAULT_EAS_CHAIN_ID","getEasChainDeployment","chainId","resolveEasChainDeployment","known","definedOverrides","overrides","v","merged","getEasAttestationExplorerUrl","deployment","uid","settings","expectedSources","settledListeners","warnedEnvOverride","readEnvEndpoint","windowEnv","readEnvChainId","raw","parsed","configureEasReadChain","setting","other","otherId","source","chainMismatchMessage","isEasReadChainSettled","listener","expectEasReadChain","isEasReadChainConfigured","whenEasReadChainSettled","done","timer","onSettled","resolve","settled","timeoutMs","ids","configured","resetEasReadChain","getEasReadChainId","getEasEndpoint","knownIndexer","env","envChainId","chainIdOfKnownIndexer","url","normalizeUrl","target","id","DefaultEasClient","GraphQLClient","scopeKey","endpoint","queryKey","DefaultQueryClient","client","QueryClient","networkMode","staleTime"],"sources":["../src/moduleOwner.ts","../src/EasClient/BaseEasClient.ts","../src/QueryClient/BaseQueryClient.ts","../src/chains.ts","../src/easEndpoint.ts","../src/default/EasClient.ts","../src/default/QueryClient.ts"],"sourcesContent":["/**\n * Detects a second copy of this package in one page or process. Each copy has its own\n * BaseEasClient / BaseQueryClient slots and its own chain settings, so code reading through\n * one copy would quietly miss the clients and chain registered on the other.\n *\n * Whichever copy last registered a client records itself under a global key that every copy\n * shares; {@link assertSingleEasModule} throws when that is not the caller's copy.\n */\nconst OWNER_KEY = Symbol.for('@seedprotocol/eas:clientOwner')\n\n/** Identity of this copy of the module. */\nconst thisCopy = Object.freeze({ package: '@seedprotocol/eas' })\n\ntype GlobalWithOwner = typeof globalThis & { [OWNER_KEY]?: object }\n\n/** @internal Called by BaseEasClient / BaseQueryClient when a client is registered. */\nexport function markEasClientOwner(): void {\n ;(globalThis as GlobalWithOwner)[OWNER_KEY] = thisCopy\n}\n\nexport class DuplicateEasModuleError extends Error {\n constructor() {\n super(\n 'Two copies of @seedprotocol/eas are loaded, and EAS clients were registered on the other copy ' +\n '(e.g. by SeedClient). Reads through this copy would use different clients and a different chain. ' +\n 'Make sure every @seedprotocol/* package is the same version and installed once (`npm ls @seedprotocol/eas`). ' +\n 'With Vite, keep @seedprotocol/* packages out of optimizeDeps.exclude so they are pre-bundled together, ' +\n 'and dedupe them (seedVitePlugin does) when they are linked into the app.',\n )\n this.name = 'DuplicateEasModuleError'\n }\n}\n\n/** Throws {@link DuplicateEasModuleError} when another copy of this package registered EAS clients. */\nexport function assertSingleEasModule(): void {\n const owner = (globalThis as GlobalWithOwner)[OWNER_KEY]\n if (owner !== undefined && owner !== thisCopy) throw new DuplicateEasModuleError()\n}\n\n/** @internal Tests that load fresh module copies (vi.resetModules) clear the shared marker. */\nexport function resetEasClientOwnerForTests(): void {\n delete (globalThis as GlobalWithOwner)[OWNER_KEY]\n}\n","import type { Attestation } from '../graphql/gql/graphql.js'\nimport type { GraphQLClient } from 'graphql-request'\nimport type { IEasClient } from './IEasClient.js'\nimport { markEasClientOwner } from '../moduleOwner.js'\n\nexport abstract class BaseEasClient {\n private static _impl: IEasClient | null = null\n\n static configure(impl: IEasClient): void {\n if (!impl) {\n throw new Error(\n 'Cannot configure EasClient with undefined or null. Ensure the platform-specific EasClient is properly created.',\n )\n }\n BaseEasClient._impl = impl\n markEasClientOwner()\n }\n\n /** True once a platform (SDK, Node bootstrap, host app) has registered an implementation. */\n static isConfigured(): boolean {\n return BaseEasClient._impl != null\n }\n\n private static requireImpl(): IEasClient {\n if (!BaseEasClient._impl) {\n throw new Error(\n 'EasClient not configured. Import from @seedprotocol/eas/node to register the Node.js implementation, or ensure SDK platform init has run.',\n )\n }\n return BaseEasClient._impl\n }\n\n static getEasClient(): GraphQLClient {\n return BaseEasClient.requireImpl().getEasClient()\n }\n\n /**\n * @deprecated Prefer getSeedsBySchemaName from @seedprotocol/eas api helpers.\n * Kept for API compatibility; not implemented by platform clients.\n */\n static async getSeedsBySchemaName(_schemaName: string): Promise<Attestation[]> {\n throw new Error(\n 'BaseEasClient.getSeedsBySchemaName is not implemented. Use getSeedsBySchemaName from @seedprotocol/eas instead.',\n )\n }\n}\n\nexport { BaseEasClient as EasClient }\n","import type { IQueryClient } from './IQueryClient.js'\nimport type { IQueryClientFactory } from './IQueryClientFactory.js'\nimport { markEasClientOwner } from '../moduleOwner.js'\n\nexport abstract class BaseQueryClient {\n private static _impl: IQueryClientFactory | null = null\n\n static configure(impl: IQueryClientFactory): void {\n if (!impl) {\n throw new Error(\n 'Cannot configure QueryClient with undefined or null. Ensure the platform-specific QueryClient is properly created.',\n )\n }\n BaseQueryClient._impl = impl\n markEasClientOwner()\n }\n\n /** True once a platform (SDK, Node bootstrap, host app) has registered an implementation. */\n static isConfigured(): boolean {\n return BaseQueryClient._impl != null\n }\n\n private static requireImpl(): IQueryClientFactory {\n if (!BaseQueryClient._impl) {\n throw new Error(\n 'QueryClient not configured. Import from @seedprotocol/eas/node to register the Node.js implementation.',\n )\n }\n return BaseQueryClient._impl\n }\n\n static getQueryClient(): IQueryClient {\n return BaseQueryClient.requireImpl().getQueryClient()\n }\n}\n","/**\n * EAS deployments per chain. Pure data (no viem / thirdweb) so read and write packages can share it.\n *\n * Addresses from https://github.com/ethereum-attestation-service/eas-contracts#deployments.\n * OP Stack chains use the predeploys 0x4200…0021 (EAS) and 0x4200…0020 (SchemaRegistry).\n */\n\nexport type HexAddress = `0x${string}`\n\nexport interface EasChainDeployment {\n chainId: number\n /** Human-readable chain name (used in error messages). */\n name: string\n easContractAddress: HexAddress\n schemaRegistryAddress: HexAddress\n /** EAS indexer GraphQL endpoint (easscan). */\n indexerUrl?: string\n /** EAS explorer origin; attestation pages live at `{explorerUrl}/attestation/view/{uid}`. */\n explorerUrl?: string\n testnet?: boolean\n}\n\nexport const OP_STACK_EAS_CONTRACT_ADDRESS: HexAddress = '0x4200000000000000000000000000000000000021'\nexport const OP_STACK_SCHEMA_REGISTRY_ADDRESS: HexAddress = '0x4200000000000000000000000000000000000020'\n\nfunction opStack(\n chainId: number,\n name: string,\n easscanSubdomain: string,\n testnet = false,\n): EasChainDeployment {\n return {\n chainId,\n name,\n easContractAddress: OP_STACK_EAS_CONTRACT_ADDRESS,\n schemaRegistryAddress: OP_STACK_SCHEMA_REGISTRY_ADDRESS,\n indexerUrl: `https://${easscanSubdomain}.easscan.org/graphql`,\n explorerUrl: `https://${easscanSubdomain}.easscan.org`,\n testnet,\n }\n}\n\nfunction easscan(subdomain: string | null) {\n const origin = subdomain ? `https://${subdomain}.easscan.org` : 'https://easscan.org'\n return { indexerUrl: `${origin}/graphql`, explorerUrl: origin }\n}\n\n/** Known EAS deployments keyed by chain id. */\nexport const EAS_CHAIN_DEPLOYMENTS: Readonly<Record<number, EasChainDeployment>> = {\n 1: {\n chainId: 1,\n name: 'Ethereum',\n easContractAddress: '0xA1207F3BBa224E2c9c3c6D5aF63D0eb1582Ce587',\n schemaRegistryAddress: '0xA7b39296258348C78294F95B872b282326A97BDF',\n ...easscan(null),\n },\n 11155111: {\n chainId: 11155111,\n name: 'Sepolia',\n easContractAddress: '0xC2679fBD37d54388Ce493F1DB75320D236e1815e',\n schemaRegistryAddress: '0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0',\n ...easscan('sepolia'),\n testnet: true,\n },\n 10: opStack(10, 'Optimism', 'optimism'),\n 11155420: opStack(11155420, 'Optimism Sepolia', 'optimism-sepolia', true),\n 8453: opStack(8453, 'Base', 'base'),\n 84532: opStack(84532, 'Base Sepolia', 'base-sepolia', true),\n 42161: {\n chainId: 42161,\n name: 'Arbitrum One',\n easContractAddress: '0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458',\n schemaRegistryAddress: '0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB',\n ...easscan('arbitrum'),\n },\n 421614: {\n chainId: 421614,\n name: 'Arbitrum Sepolia',\n easContractAddress: '0x2521021fc8BF070473E1e1801D3c7B4aB701E1dE',\n schemaRegistryAddress: '0x45CB6Fa0870a8Af06796Ac15915619a0f22cd475',\n // No public easscan indexer found for this chain; set SeedConfig.eas.indexerUrl.\n testnet: true,\n },\n 137: {\n chainId: 137,\n name: 'Polygon',\n easContractAddress: '0x5E634ef5355f45A855d02D66eCD687b1502AF790',\n schemaRegistryAddress: '0x7876EEF51A891E737AF8ba5A5E0f0Fd29073D5a7',\n ...easscan('polygon'),\n },\n 534352: {\n chainId: 534352,\n name: 'Scroll',\n easContractAddress: '0xC47300428b6AD2c7D03BB76D05A176058b47E6B0',\n schemaRegistryAddress: '0xD2CDF46556543316e7D34e8eDc4624e2bB95e3B6',\n ...easscan('scroll'),\n },\n 59144: {\n chainId: 59144,\n name: 'Linea',\n easContractAddress: '0xaEF4103A04090071165F78D45D83A0C0782c2B2a',\n schemaRegistryAddress: '0x55D26f9ae0203EF95494AE4C170eD35f4Cf77797',\n ...easscan('linea'),\n },\n}\n\n/** Chain id Seed Protocol uses when an app does not configure one. */\nexport const DEFAULT_EAS_CHAIN_ID = 11155420\n\nexport function getEasChainDeployment(chainId: number): EasChainDeployment | undefined {\n return EAS_CHAIN_DEPLOYMENTS[chainId]\n}\n\n/**\n * Merge a known deployment with app overrides. Throws when the chain is unknown and the\n * overrides do not supply both contract addresses.\n */\nexport function resolveEasChainDeployment(\n chainId: number,\n overrides: Partial<Omit<EasChainDeployment, 'chainId'>> = {},\n): EasChainDeployment {\n const known = getEasChainDeployment(chainId)\n const definedOverrides = Object.fromEntries(\n Object.entries(overrides).filter(([, v]) => v !== undefined),\n ) as Partial<EasChainDeployment>\n const merged = { ...known, ...definedOverrides, chainId } as Partial<EasChainDeployment>\n if (!merged.easContractAddress || !merged.schemaRegistryAddress) {\n throw new Error(\n `No known EAS deployment for chain ${chainId}. Pass easContractAddress and schemaRegistryAddress for this chain.`,\n )\n }\n return {\n ...merged,\n name: merged.name ?? `chain ${chainId}`,\n } as EasChainDeployment\n}\n\n/** Build `{explorerUrl}/attestation/view/{uid}`, or undefined when the chain has no explorer. */\nexport function getEasAttestationExplorerUrl(\n deployment: Pick<EasChainDeployment, 'explorerUrl'>,\n uid: string,\n): string | undefined {\n if (!deployment.explorerUrl) return undefined\n return `${deployment.explorerUrl.replace(/\\/+$/, '')}/attestation/view/${uid}`\n}\n","import { DEFAULT_EAS_CHAIN_ID, EAS_CHAIN_DEPLOYMENTS, getEasChainDeployment } from './chains.js'\n\n/**\n * Which EAS chain / indexer the read side (sync, schema lookups) talks to.\n *\n * Three sources can set it, each in its own slot so init order does not matter:\n * - `sdk`: `SeedConfig.eas`\n * - `publish`: `PublishConfig.chain`\n * - `localDb`: the chain the SDK's local database already holds data from (lowest priority;\n * lets reads start on the right chain before publish is initialized)\n * Conflicting chain ids throw instead of silently reading one chain while writing another.\n * Below those, the `EAS_CHAIN_ID` / `NEXT_PUBLIC_EAS_CHAIN_ID` env var sets the chain for\n * processes without SDK or publish config (e.g. a feed server); the default is Optimism Sepolia.\n *\n * Indexer URL precedence: SDK `indexerUrl` > `EAS_ENDPOINT` / `NEXT_PUBLIC_EAS_ENDPOINT` env >\n * the configured chain's known indexer > Optimism Sepolia. An env URL that is another chain's\n * known indexer throws, so a leftover env var cannot make reads follow the wrong chain.\n */\nexport type EasReadChainSource = 'sdk' | 'publish' | 'localDb'\n\nexport interface EasReadChainSetting {\n chainId?: number\n /** EAS indexer GraphQL endpoint. Required for chains without a known indexer. */\n indexerUrl?: string\n}\n\nconst settings: Record<EasReadChainSource, EasReadChainSetting> = { sdk: {}, publish: {}, localDb: {} }\n/** Sources that have announced they will configure a chain (e.g. publish, at import). */\nconst expectedSources = new Set<EasReadChainSource>()\nconst settledListeners = new Set<() => void>()\nlet warnedEnvOverride = false\n\nfunction readEnvEndpoint(): string | undefined {\n try {\n if (typeof process !== 'undefined' && process.env) {\n const v = process.env.NEXT_PUBLIC_EAS_ENDPOINT || process.env.EAS_ENDPOINT\n if (v) return v\n }\n } catch {\n // process.env access can throw in some bundler shims\n }\n const windowEnv = (globalThis as { window?: { env?: Record<string, string | undefined> } }).window?.env\n return windowEnv?.NEXT_PUBLIC_EAS_ENDPOINT || windowEnv?.EAS_ENDPOINT || undefined\n}\n\nfunction readEnvChainId(): number | undefined {\n let raw: string | undefined\n try {\n if (typeof process !== 'undefined' && process.env) {\n raw = process.env.NEXT_PUBLIC_EAS_CHAIN_ID || process.env.EAS_CHAIN_ID\n }\n } catch {\n // process.env access can throw in some bundler shims\n }\n const parsed = Number(raw)\n return raw && Number.isInteger(parsed) && parsed > 0 ? parsed : undefined\n}\n\n/**\n * Set the EAS read chain for one source. Throws when the other source already set a\n * different chain id; the previous setting is kept in that case.\n */\nexport function configureEasReadChain(source: EasReadChainSource, setting: EasReadChainSetting): void {\n const chainId = setting.chainId\n if (chainId !== undefined) {\n for (const other of Object.keys(settings) as EasReadChainSource[]) {\n const otherId = settings[other].chainId\n if (other !== source && otherId !== undefined && otherId !== chainId) {\n throw new Error(chainMismatchMessage({ [source]: chainId, [other]: otherId }))\n }\n }\n }\n settings[source] = { ...setting }\n if (isEasReadChainSettled()) {\n for (const listener of [...settledListeners]) listener()\n }\n}\n\n/**\n * Announce that `source` will configure the chain later (e.g. `@seedprotocol/publish` calls\n * this when loaded, before `initPublish` runs). Until it does, {@link isEasReadChainSettled}\n * is false unless a chain is otherwise known, so EAS sync waits instead of reading the default.\n */\nexport function expectEasReadChain(source: EasReadChainSource): void {\n expectedSources.add(source)\n}\n\n/**\n * True when reads can start: a chain was set explicitly (SDK config, publish or `EAS_CHAIN_ID`),\n * the local DB recorded one, or no source that announced itself is still pending.\n */\nexport function isEasReadChainSettled(): boolean {\n if (isEasReadChainConfigured() || settings.localDb.chainId !== undefined) return true\n for (const source of expectedSources) {\n if (settings[source].chainId === undefined) return false\n }\n return true\n}\n\n/**\n * Resolves once {@link isEasReadChainSettled} is true. Resolves `false` after `timeoutMs`\n * when it never settles (the caller then proceeds on the current chain).\n */\nexport function whenEasReadChainSettled(timeoutMs: number): Promise<boolean> {\n if (isEasReadChainSettled()) return Promise.resolve(true)\n return new Promise((resolve) => {\n const done = (settled: boolean) => {\n clearTimeout(timer)\n settledListeners.delete(onSettled)\n resolve(settled)\n }\n const onSettled = () => done(true)\n const timer = setTimeout(() => done(false), timeoutMs)\n settledListeners.add(onSettled)\n })\n}\n\nfunction chainMismatchMessage(ids: Partial<Record<EasReadChainSource, number>>): string {\n if (ids.localDb !== undefined) {\n const configured = ids.sdk ?? ids.publish\n return `Seed Protocol chain mismatch: the local database holds attestations from chain ${ids.localDb}, but the app is configured for chain ${configured}. Use a separate database per chain (SeedConfig.filesDir / dbConfig), clear the local database, or configure chain ${ids.localDb} again.`\n }\n return `Seed Protocol chain mismatch: the SDK reads EAS on chain ${ids.sdk} but @seedprotocol/publish writes to chain ${ids.publish}. Use the same chain in SeedConfig.eas.chainId and PublishConfig.chain.`\n}\n\n/**\n * True when a chain id was chosen explicitly (SDK, publish or `EAS_CHAIN_ID`), as opposed to\n * the default or the local DB's recorded chain.\n */\nexport function isEasReadChainConfigured(): boolean {\n return (\n settings.sdk.chainId !== undefined ||\n settings.publish.chainId !== undefined ||\n readEnvChainId() !== undefined\n )\n}\n\n/** @internal Reset all sources (tests). */\nexport function resetEasReadChain(): void {\n settings.sdk = {}\n settings.publish = {}\n settings.localDb = {}\n expectedSources.clear()\n settledListeners.clear()\n warnedEnvOverride = false\n}\n\n/** Chain id the read side follows (defaults to Optimism Sepolia). */\nexport function getEasReadChainId(): number {\n return (\n settings.sdk.chainId ??\n settings.publish.chainId ??\n settings.localDb.chainId ??\n readEnvChainId() ??\n DEFAULT_EAS_CHAIN_ID\n )\n}\n\n/** Resolved EAS indexer GraphQL endpoint. Throws when the chain has no known indexer. */\nexport function getEasEndpoint(): string {\n if (settings.sdk.indexerUrl) return settings.sdk.indexerUrl\n\n const chainId = getEasReadChainId()\n const knownIndexer = getEasChainDeployment(chainId)?.indexerUrl\n const env = readEnvEndpoint()\n if (env) {\n const envChainId = chainIdOfKnownIndexer(env)\n if (envChainId !== undefined && envChainId !== chainId) {\n throw new Error(\n `Seed Protocol chain mismatch: EAS_ENDPOINT / NEXT_PUBLIC_EAS_ENDPOINT (${env}) is the indexer for chain ${envChainId}, but Seed reads EAS on chain ${chainId}. Unset it, point it at chain ${chainId}'s indexer, or set SeedConfig.eas.indexerUrl.`,\n )\n }\n if (knownIndexer && knownIndexer !== env && chainId !== DEFAULT_EAS_CHAIN_ID && !warnedEnvOverride) {\n warnedEnvOverride = true\n console.warn(\n `[Seed Protocol] EAS_ENDPOINT (${env}) overrides the indexer for chain ${chainId} (${knownIndexer}). Make sure it indexes chain ${chainId}, or set SeedConfig.eas.indexerUrl.`,\n )\n }\n return env\n }\n\n const url = knownIndexer ?? settings.publish.indexerUrl\n if (!url) {\n throw new Error(\n `No EAS indexer is known for chain ${chainId}. Set SeedConfig.eas.indexerUrl (or the EAS_ENDPOINT env var).`,\n )\n }\n return url\n}\n\nfunction normalizeUrl(url: string): string {\n return url.trim().replace(/\\/+$/, '').toLowerCase()\n}\n\n/** Chain whose known easscan indexer is `url`, if any. */\nfunction chainIdOfKnownIndexer(url: string): number | undefined {\n const target = normalizeUrl(url)\n for (const [id, deployment] of Object.entries(EAS_CHAIN_DEPLOYMENTS)) {\n if (deployment.indexerUrl && normalizeUrl(deployment.indexerUrl) === target) return Number(id)\n }\n return undefined\n}\n","import type { IEasClient } from '../EasClient/IEasClient.js'\nimport { getEasEndpoint } from '../easEndpoint.js'\nimport { GraphQLClient } from 'graphql-request'\n\n/** Fetch-based EAS GraphQL client; works in Node and browsers. Registering it is up to the caller. */\nexport class DefaultEasClient implements IEasClient {\n private easClient: { url: string; client: GraphQLClient } | undefined\n\n /** Reads the endpoint per call so SDK / publish chain config applied after import takes effect. */\n getEasClient(): GraphQLClient {\n const url = getEasEndpoint()\n if (this.easClient?.url !== url) {\n this.easClient = { url, client: new GraphQLClient(url) }\n }\n return this.easClient.client\n }\n}\n","import { QueryClient as TanStackQueryClient } from '@tanstack/query-core'\nimport { getEasEndpoint } from '../easEndpoint.js'\nimport type { FetchQueryOptions, IQueryClient } from '../QueryClient/IQueryClient.js'\nimport type { IQueryClientFactory } from '../QueryClient/IQueryClientFactory.js'\n\n/**\n * Keys are scoped to the EAS endpoint (the chain), so a process that switches chains never shares\n * a request or a result between them.\n */\nconst scopeKey = (queryKey: readonly unknown[]): unknown[] => {\n let endpoint = ''\n try {\n endpoint = getEasEndpoint()\n } catch {\n // Misconfigured chain: the request itself will fail.\n }\n return [endpoint, ...queryKey]\n}\n\n/**\n * TanStack Query client with no UI or browser dependencies (Node, workers, pages without the SDK).\n * Registering it is up to the caller. Concurrent requests with the same key share one fetch.\n *\n * Results are not kept once a request settles (gcTime 0) unless the caller passes a `staleTime`,\n * in which case they are kept and reused for that long: a server process sees many distinct keys\n * (e.g. change checks keyed by time), and EAS data is otherwise always read fresh. No retries\n * (TanStack's default for imperative queries), no structural sharing (nothing to share with), and\n * no online detection (`networkMode: 'always'`).\n */\nexport class DefaultQueryClient implements IQueryClientFactory {\n private queryClient: IQueryClient | undefined\n\n getQueryClient(): IQueryClient {\n if (this.queryClient) return this.queryClient\n\n const client = new TanStackQueryClient({\n defaultOptions: {\n queries: {\n gcTime: 0,\n networkMode: 'always',\n structuralSharing: false,\n },\n },\n })\n\n this.queryClient = {\n fetchQuery: <T>({ queryKey, queryFn, networkMode, staleTime }: FetchQueryOptions<T>) =>\n client.query({\n queryKey: scopeKey(queryKey),\n queryFn,\n // IQueryClient's 'onlineOnly' is TanStack v5's 'online'.\n ...(networkMode ? { networkMode: networkMode === 'onlineOnly' ? 'online' : networkMode } : {}),\n ...(staleTime ? { staleTime, gcTime: staleTime } : {}),\n }) as Promise<T>,\n getQueryData: (queryKey) => client.getQueryData(scopeKey(queryKey)),\n removeQueries: async ({ queryKey }) => {\n client.removeQueries({ queryKey: scopeKey(queryKey) })\n },\n }\n return this.queryClient\n }\n}\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|
|
|
1
|
-
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as ee, n as te, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as d, x as ce, y as f } from "./QueryClient-
|
|
1
|
+
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as ee, n as te, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as d, x as ce, y as f } from "./QueryClient-BpCm3D1u.js";
|
|
2
2
|
import { keccak_256 as le } from "@noble/hashes/sha3";
|
|
3
3
|
import { bytesToHex as ue, utf8ToBytes as de } from "@noble/hashes/utils";
|
|
4
4
|
//#region src/keccak.ts
|
|
@@ -2758,10 +2758,10 @@ function ot(e) {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
//#endregion
|
|
2760
2760
|
//#region src/domainOwnership.ts
|
|
2761
|
-
function
|
|
2761
|
+
function P(e) {
|
|
2762
2762
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2763
2763
|
}
|
|
2764
|
-
async function
|
|
2764
|
+
async function st(e) {
|
|
2765
2765
|
let { toolAddresses: t, domains: n, claimers: r, schemaUid: i, excludeRevoked: a = !0 } = e;
|
|
2766
2766
|
if (!t.length) return [];
|
|
2767
2767
|
let o = t.map((e) => {
|
|
@@ -2784,13 +2784,13 @@ async function ct(e) {
|
|
|
2784
2784
|
a,
|
|
2785
2785
|
i ?? "seedprotocol.domainOwnership",
|
|
2786
2786
|
[...o].sort(),
|
|
2787
|
-
[...(n ?? []).map(
|
|
2787
|
+
[...(n ?? []).map(P)].sort(),
|
|
2788
2788
|
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2789
2789
|
],
|
|
2790
2790
|
queryFn: async () => l.request(he, { where: s })
|
|
2791
2791
|
});
|
|
2792
2792
|
if (!n?.length) return u;
|
|
2793
|
-
let ee = new Set(n.map(
|
|
2793
|
+
let ee = new Set(n.map(P));
|
|
2794
2794
|
return u.filter((e) => {
|
|
2795
2795
|
try {
|
|
2796
2796
|
let t = it(e.decodedDataJson ?? "[]");
|
|
@@ -2802,8 +2802,8 @@ async function ct(e) {
|
|
|
2802
2802
|
}
|
|
2803
2803
|
//#endregion
|
|
2804
2804
|
//#region src/publishAuthorizationHelpers.ts
|
|
2805
|
-
var
|
|
2806
|
-
function
|
|
2805
|
+
var ct = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", lt = "seedprotocol.publishAuthorization", ut = "publish,revoke", dt = 31536e3;
|
|
2806
|
+
function F(e) {
|
|
2807
2807
|
let t = e.trim();
|
|
2808
2808
|
try {
|
|
2809
2809
|
return h(t).toLowerCase();
|
|
@@ -2811,35 +2811,35 @@ function P(e) {
|
|
|
2811
2811
|
return t.toLowerCase();
|
|
2812
2812
|
}
|
|
2813
2813
|
}
|
|
2814
|
-
function
|
|
2814
|
+
function ft(e) {
|
|
2815
2815
|
return typeof e == "string" ? O(e) : e && typeof e == "object" && "hex" in e ? O(String(e.hex)) : O(String(e ?? ""));
|
|
2816
2816
|
}
|
|
2817
|
-
function
|
|
2817
|
+
function I(e) {
|
|
2818
2818
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2819
2819
|
}
|
|
2820
|
-
function
|
|
2820
|
+
function L(e) {
|
|
2821
2821
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2822
2822
|
if (typeof e == "bigint") return Number(e);
|
|
2823
2823
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2824
2824
|
let t = Number(e);
|
|
2825
2825
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2826
2826
|
}
|
|
2827
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2827
|
+
return e && typeof e == "object" && "value" in e ? L(e.value) : 0;
|
|
2828
2828
|
}
|
|
2829
|
-
function
|
|
2829
|
+
function pt(e) {
|
|
2830
2830
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2831
2831
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2832
2832
|
return {
|
|
2833
|
-
identity:
|
|
2834
|
-
sessionKey:
|
|
2835
|
-
app:
|
|
2836
|
-
scopes:
|
|
2837
|
-
grantedAt:
|
|
2838
|
-
expiresAt:
|
|
2839
|
-
permissionsHash:
|
|
2833
|
+
identity: F(I(n.get("identity")?.value)),
|
|
2834
|
+
sessionKey: F(I(n.get("sessionKey")?.value)),
|
|
2835
|
+
app: F(I(n.get("app")?.value)),
|
|
2836
|
+
scopes: I(n.get("scopes")?.value),
|
|
2837
|
+
grantedAt: L(n.get("grantedAt")?.value),
|
|
2838
|
+
expiresAt: L(n.get("expiresAt")?.value),
|
|
2839
|
+
permissionsHash: ft(n.get("permissionsHash")?.value)
|
|
2840
2840
|
};
|
|
2841
2841
|
}
|
|
2842
|
-
function
|
|
2842
|
+
function mt(e) {
|
|
2843
2843
|
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2844
2844
|
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2845
2845
|
status: "expired",
|
|
@@ -2855,14 +2855,14 @@ function ht(e) {
|
|
|
2855
2855
|
warnings: n
|
|
2856
2856
|
});
|
|
2857
2857
|
}
|
|
2858
|
-
function
|
|
2858
|
+
function ht(e) {
|
|
2859
2859
|
return "0x" + p(new TextEncoder().encode(e));
|
|
2860
2860
|
}
|
|
2861
2861
|
//#endregion
|
|
2862
2862
|
//#region src/publishAuthorization.ts
|
|
2863
|
-
async function
|
|
2863
|
+
async function gt(e = {}) {
|
|
2864
2864
|
let { identities: t, sessionKeys: n, apps: r, schemaUid: i, excludeRevoked: a = !0 } = e, o = {};
|
|
2865
|
-
i ? o.schemaId = { equals: i } : o.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2865
|
+
i ? o.schemaId = { equals: i } : o.schema = { is: { schemaNames: { some: { name: { equals: lt } } } } }, t?.length && (o.attester = { in: t.map((e) => {
|
|
2866
2866
|
try {
|
|
2867
2867
|
return h(e);
|
|
2868
2868
|
} catch {
|
|
@@ -2890,7 +2890,7 @@ async function _t(e = {}) {
|
|
|
2890
2890
|
let u = new Set(r.map((e) => e.toLowerCase()));
|
|
2891
2891
|
return l.filter((e) => {
|
|
2892
2892
|
try {
|
|
2893
|
-
let t =
|
|
2893
|
+
let t = pt(e.decodedDataJson ?? "[]");
|
|
2894
2894
|
return u.has(t.app.toLowerCase());
|
|
2895
2895
|
} catch {
|
|
2896
2896
|
return !1;
|
|
@@ -2899,29 +2899,29 @@ async function _t(e = {}) {
|
|
|
2899
2899
|
}
|
|
2900
2900
|
//#endregion
|
|
2901
2901
|
//#region src/easNames.ts
|
|
2902
|
-
var
|
|
2902
|
+
var R = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase(), _t = [
|
|
2903
2903
|
"exact",
|
|
2904
2904
|
"normalized",
|
|
2905
2905
|
"fuzzy"
|
|
2906
|
-
],
|
|
2906
|
+
], vt = (e) => typeof e == "string" && _t.includes(e), z = {
|
|
2907
2907
|
exact: 0,
|
|
2908
2908
|
normalized: 1,
|
|
2909
2909
|
fuzzy: 2
|
|
2910
|
-
},
|
|
2911
|
-
let n =
|
|
2910
|
+
}, yt = "fuzzy", B = (e) => e.toLowerCase().replace(/[^a-z0-9]/g, ""), V = (e, t = {}) => {
|
|
2911
|
+
let n = B(e);
|
|
2912
2912
|
return t.relation && (n.length > 3 && n.endsWith("ids") ? n = n.slice(0, -3) : n.length > 2 && n.endsWith("id") && (n = n.slice(0, -2))), n.length > 3 && n.endsWith("s") && !n.endsWith("ss") && (n = n.slice(0, -1)), n;
|
|
2913
2913
|
};
|
|
2914
|
-
function
|
|
2915
|
-
if (
|
|
2916
|
-
if (
|
|
2917
|
-
if (
|
|
2914
|
+
function H(e, t, n = {}) {
|
|
2915
|
+
if (R(e) === t) return "exact";
|
|
2916
|
+
if (B(e) === B(t)) return "normalized";
|
|
2917
|
+
if (V(e, n) === V(t, n)) return "fuzzy";
|
|
2918
2918
|
}
|
|
2919
|
-
var
|
|
2920
|
-
function
|
|
2919
|
+
var U = (e, t) => z[e] <= z[t], W = (e, t) => z[e] - z[t];
|
|
2920
|
+
function bt(e, t) {
|
|
2921
2921
|
let n, r = [];
|
|
2922
2922
|
for (let i of t) {
|
|
2923
|
-
let t =
|
|
2924
|
-
t &&
|
|
2923
|
+
let t = H(i.name, e, { relation: i.relation });
|
|
2924
|
+
t && U(t, i.level ?? "fuzzy") && (n === void 0 || W(t, n) < 0 ? (n = t, r = [i.value]) : t === n && r.push(i.value));
|
|
2925
2925
|
}
|
|
2926
2926
|
return n === void 0 ? { kind: "none" } : r.length > 1 ? {
|
|
2927
2927
|
kind: "ambiguous",
|
|
@@ -2933,36 +2933,36 @@ function xt(e, t) {
|
|
|
2933
2933
|
tier: n
|
|
2934
2934
|
};
|
|
2935
2935
|
}
|
|
2936
|
-
function
|
|
2936
|
+
function xt(e, t, n = {}) {
|
|
2937
2937
|
let r = typeof n.level == "function" ? n.level : () => n.level ?? "fuzzy", i, a = /* @__PURE__ */ new Set();
|
|
2938
2938
|
for (let o of t) {
|
|
2939
|
-
let t =
|
|
2940
|
-
t &&
|
|
2939
|
+
let t = H(o, e, { relation: n.relation });
|
|
2940
|
+
t && U(t, r(o)) && (i === void 0 || W(t, i) < 0 ? (i = t, a = /* @__PURE__ */ new Set([o])) : t === i && a.add(o));
|
|
2941
2941
|
}
|
|
2942
2942
|
return a;
|
|
2943
2943
|
}
|
|
2944
|
-
function
|
|
2944
|
+
function St(e) {
|
|
2945
2945
|
let t = e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
2946
2946
|
return [.../* @__PURE__ */ new Set([
|
|
2947
|
-
|
|
2947
|
+
R(e),
|
|
2948
2948
|
t,
|
|
2949
|
-
|
|
2949
|
+
B(e)
|
|
2950
2950
|
])];
|
|
2951
2951
|
}
|
|
2952
|
-
function
|
|
2953
|
-
if (t === "exact") return [
|
|
2954
|
-
let n = /* @__PURE__ */ new Set([...
|
|
2952
|
+
function Ct(e, t = yt) {
|
|
2953
|
+
if (t === "exact") return [R(e)];
|
|
2954
|
+
let n = /* @__PURE__ */ new Set([...St(e), e]);
|
|
2955
2955
|
if (t === "fuzzy") for (let e of [...n]) n.add(e.endsWith("s") ? e.slice(0, -1) : `${e}s`);
|
|
2956
2956
|
return [...n];
|
|
2957
2957
|
}
|
|
2958
2958
|
//#endregion
|
|
2959
2959
|
//#region src/easValues.ts
|
|
2960
|
-
var
|
|
2961
|
-
function
|
|
2960
|
+
var wt = /^-?\d+$/, Tt = /^(-?)0x([0-9a-f]+)$/i;
|
|
2961
|
+
function Et(e) {
|
|
2962
2962
|
return typeof e == "string" && /^u?int\d*$/.test(e);
|
|
2963
2963
|
}
|
|
2964
|
-
function
|
|
2965
|
-
let t =
|
|
2964
|
+
function Dt(e) {
|
|
2965
|
+
let t = Tt.exec(e.trim());
|
|
2966
2966
|
if (!t) return;
|
|
2967
2967
|
let n = BigInt("0x" + t[2]);
|
|
2968
2968
|
return (t[1] ? -n : n).toString();
|
|
@@ -2973,14 +2973,14 @@ function Ot(e) {
|
|
|
2973
2973
|
if (typeof e == "string") {
|
|
2974
2974
|
let t = e.trim();
|
|
2975
2975
|
if (!t) return;
|
|
2976
|
-
if (
|
|
2977
|
-
if (
|
|
2976
|
+
if (wt.test(t)) return BigInt(t).toString();
|
|
2977
|
+
if (Tt.test(t)) return Dt(t);
|
|
2978
2978
|
let n = Number(t);
|
|
2979
2979
|
return Number.isFinite(n) ? String(n) : void 0;
|
|
2980
2980
|
}
|
|
2981
2981
|
if (e && typeof e == "object") {
|
|
2982
2982
|
let t = e.hex ?? e._hex;
|
|
2983
|
-
if (typeof t == "string") return
|
|
2983
|
+
if (typeof t == "string") return Dt(t);
|
|
2984
2984
|
}
|
|
2985
2985
|
}
|
|
2986
2986
|
//#endregion
|
|
@@ -3078,7 +3078,7 @@ var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), Rt = 3e5, J =
|
|
|
3078
3078
|
K.set(m(e), t), $();
|
|
3079
3079
|
}, Ht = ({ modelName: e, schemaUid: t }) => {
|
|
3080
3080
|
q.set(e.toLowerCase(), t), $();
|
|
3081
|
-
}, Ut = (e) => q.get(e.toLowerCase()), Wt = async ({ schemaText: e }) => {
|
|
3081
|
+
}, Ut = (e) => q.get(e.toLowerCase()), Wt = (e) => K.get(m(e)), Gt = async ({ schemaText: e }) => {
|
|
3082
3082
|
let t = m(e);
|
|
3083
3083
|
if (!K.has(t)) {
|
|
3084
3084
|
let e;
|
|
@@ -3091,7 +3091,7 @@ var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), Rt = 3e5, J =
|
|
|
3091
3091
|
return e && K.set(t, e), e;
|
|
3092
3092
|
}
|
|
3093
3093
|
return K.get(t);
|
|
3094
|
-
},
|
|
3094
|
+
}, Kt = async (e) => {
|
|
3095
3095
|
let t = zt(e), n = J.get(t);
|
|
3096
3096
|
if (n) return n;
|
|
3097
3097
|
let r = d.getQueryClient(), i = f.getEasClient();
|
|
@@ -3106,6 +3106,6 @@ var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), Rt = 3e5, J =
|
|
|
3106
3106
|
return a && J.set(t, a), a;
|
|
3107
3107
|
};
|
|
3108
3108
|
//#endregion
|
|
3109
|
-
export { f as BaseEasClient, f as EasClient, d as BaseQueryClient, a as DEFAULT_EAS_CHAIN_ID,
|
|
3109
|
+
export { f as BaseEasClient, f as EasClient, d as BaseQueryClient, a as DEFAULT_EAS_CHAIN_ID, yt as DEFAULT_NAME_MATCH_LEVEL, Ye as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, Ze as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, Ge as DOMAIN_OWNERSHIP_METHOD, Ue as DOMAIN_OWNERSHIP_SCHEMA_DEF, We as DOMAIN_OWNERSHIP_SCHEMA_NAME, qe as DOMAIN_OWNERSHIP_SCOPE_HOSTNAME, Ke as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Xe as DOMAIN_OWNERSHIP_SOFT_STALE_MS, Je as DOMAIN_OWNERSHIP_TXT_LABEL, te as DefaultEasClient, oe as DefaultQueryClient, r as DuplicateEasModuleError, o as EAS_CHAIN_DEPLOYMENTS, Be as EAS_ENDPOINT, ye as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, Ce as GET_ATTESTATION_CHANGES, he as GET_DOMAIN_OWNERSHIPS, be as GET_FILES_METADATA, xe as GET_IMAGE_SEEDS, Se as GET_IMAGE_VERSIONS, ve as GET_PROPERTIES, x as GET_SCHEMAS, me as GET_SCHEMA_BY_NAME, S as GET_SEEDS, C as GET_SEEDS_LEAN, ge as GET_SEED_IDS, _e as GET_STORAGE_TRANSACTION_ID, w as GET_VERSIONS, _t as NAME_MATCH_LEVELS, re as OP_STACK_EAS_CONTRACT_ADDRESS, ee as OP_STACK_SCHEMA_REGISTRY_ADDRESS, kt as PUBLISHED_BY_SCHEMA_DEF, At as PUBLISHED_BY_SCHEMA_NAME, dt as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, ct as PUBLISH_AUTHORIZATION_SCHEMA_DEF, lt as PUBLISH_AUTHORIZATION_SCHEMA_NAME, ut as PUBLISH_AUTHORIZATION_SCOPES, Rt as SCHEMA_LOOKUP_MISS_TTL_MS, Le as ZERO_ADDRESS, Re as ZERO_BYTES, ze as ZERO_BYTES32, ce as assertSingleEasModule, ot as assessDomainOwnership, mt as assessPublishAuthorization, et as buildDomainOwnershipTxtValue, Q as cachedSchemaLookup, h as checksumAddress, $ as clearSchemaLookupMisses, W as compareNameMatchTiers, ie as configureEasReadChain, it as decodeDomainOwnershipData, Ot as decodeEasNumber, pt as decodePublishAuthorizationData, Ft as decodePublishedByData, $e as domainOwnershipTxtName, R as easName, St as easNameVariants, Ct as easNamesToFetch, Lt as ensureEasPlatform, l as expectEasReadChain, E as fetchEasSchemaUidBySchemaName, V as fuzzyNameKey, Fe as getAttestationChangesSince, Te as getCanonicalItemPropertiesFromEas, st as getDomainOwnershipFromEas, c as getEasAttestationExplorerUrl, s as getEasChainDeployment, n as getEasEndpoint, ne as getEasReadChainId, Ee as getEasSchemaUidBySchemaName, Kt as getEasSchemaUidForExactDefinition, Gt as getEasSchemaUidForSchemaDefinition, T as getItemPropertiesFromEas, we as getItemVersionsFromEas, gt as getPublishAuthorizationFromEas, It as getPublishedByFromEas, Me as getSchemaNamesBySchemaUids, Ut as getSchemaUidForModelFromCache, Wt as getSchemaUidForSchemaDefinitionFromCache, Ie as getSeedUidsBySchemaName, Oe as getSeedsBySchemaName, Ne as getSeedsByUidsFromEas, De as getSeedsFromSchemaUids, nt as hashDomainOwnershipChallenge, j as hashDomainRegistryFingerprint, ht as hashPublishAuthorizationMaterial, Mt as hashPublishedByBatch, ae as isEasReadChainConfigured, i as isEasReadChainSettled, U as isNameMatchAllowed, vt as isNameMatchLevel, Et as isNumericEasType, Ve as isPlaceholderUid, He as isValidEasAttestationUid, v as keepAttestationsFromRefAttester, xt as localNamesInBestMatchTier, bt as matchEasName, H as nameMatchTier, O as normalizeBytes32Hex, B as normalizedNameKey, tt as parseDomainOwnershipTxtValue, _ as partitionByRefAttester, g as pickLatestPropertyAttestationsByRefAndSchema, e as resetEasClientOwnerForTests, u as resetEasReadChain, je as resetSchemaNamesCache, Bt as resetSchemaUidCaches, t as resolveEasChainDeployment, Ht as setSchemaUidForModel, Vt as setSchemaUidForSchemaDefinition, m as toSnakeCase, Nt as verifyPublishedByBatch, se as whenEasReadChainSettled, y as withExcludeRevokedFilter };
|
|
3110
3110
|
|
|
3111
3111
|
//# sourceMappingURL=index.js.map
|