@seedprotocol/eas 0.5.1 → 0.5.3
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/constants-Ch1B4W2F.js.map +1 -1
- package/dist/domainOwnership.d.ts +22 -0
- package/dist/domainOwnership.d.ts.map +1 -0
- package/dist/domainOwnershipHelpers.d.ts +100 -0
- package/dist/domainOwnershipHelpers.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +280 -23
- package/dist/index.js.map +1 -1
- package/dist/publishAuthorization.d.ts +24 -0
- package/dist/publishAuthorization.d.ts.map +1 -0
- package/dist/publishAuthorizationHelpers.d.ts +46 -0
- package/dist/publishAuthorizationHelpers.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants-Ch1B4W2F.js","names":[],"sources":["../src/EasClient/BaseEasClient.ts","../src/QueryClient/BaseQueryClient.ts","../src/constants.ts"],"sourcesContent":["import type { Attestation } from '../graphql/gql/graphql.js'\nimport type { GraphQLClient } from 'graphql-request'\nimport type { IEasClient } from './IEasClient.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 }\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'\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 }\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","export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'\nexport const ZERO_BYTES = '0x'\nexport const ZERO_BYTES32 =\n '0x0000000000000000000000000000000000000000000000000000000000000000'\n\nexport const EAS_ENDPOINT =\n (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EAS_ENDPOINT) ||\n (typeof process !== 'undefined' && process.env?.EAS_ENDPOINT) ||\n 'https://optimism-sepolia.easscan.org/graphql'\n"],"mappings":";AAIA,IAAsB,IAAtB,MAAsB,EAAc;CAClC,OAAe,QAA2B;CAE1C,OAAO,UAAU,GAAwB;EACvC,IAAI,CAAC,GACH,MAAU,MACR,gHACF;EAEF,EAAc,QAAQ;CACxB;CAEA,OAAe,cAA0B;EACvC,IAAI,CAAC,EAAc,OACjB,MAAU,MACR,2IACF;EAEF,OAAO,EAAc;CACvB;CAEA,OAAO,eAA8B;EACnC,OAAO,EAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"constants-Ch1B4W2F.js","names":[],"sources":["../src/EasClient/BaseEasClient.ts","../src/QueryClient/BaseQueryClient.ts","../src/constants.ts"],"sourcesContent":["import type { Attestation } from '../graphql/gql/graphql.js'\nimport type { GraphQLClient } from 'graphql-request'\nimport type { IEasClient } from './IEasClient.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 }\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'\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 }\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","export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'\nexport const ZERO_BYTES = '0x'\nexport const ZERO_BYTES32 =\n '0x0000000000000000000000000000000000000000000000000000000000000000'\n\nexport const EAS_ENDPOINT =\n (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EAS_ENDPOINT) ||\n (typeof process !== 'undefined' && process.env?.EAS_ENDPOINT) ||\n 'https://optimism-sepolia.easscan.org/graphql'\n"],"mappings":";AAIA,IAAsB,IAAtB,MAAsB,EAAc;CAClC,OAAe,QAA2B;CAE1C,OAAO,UAAU,GAAwB;EACvC,IAAI,CAAC,GACH,MAAU,MACR,gHACF;EAEF,EAAc,QAAQ;CACxB;CAEA,OAAe,cAA0B;EACvC,IAAI,CAAC,EAAc,OACjB,MAAU,MACR,2IACF;EAEF,OAAO,EAAc;CACvB;CAEA,OAAO,eAA8B;EACnC,OAAO,EAAc,YAAY,CAAC,CAAC,aAAa;CAClD;CAMA,aAAa,qBAAqB,GAA6C;EAC7E,MAAU,MACR,iHACF;CACF;AACF,GCnCsB,IAAtB,MAAsB,EAAgB;CACpC,OAAe,QAAoC;CAEnD,OAAO,UAAU,GAAiC;EAChD,IAAI,CAAC,GACH,MAAU,MACR,oHACF;EAEF,EAAgB,QAAQ;CAC1B;CAEA,OAAe,cAAmC;EAChD,IAAI,CAAC,EAAgB,OACnB,MAAU,MACR,wGACF;EAEF,OAAO,EAAgB;CACzB;CAEA,OAAO,iBAA+B;EACpC,OAAO,EAAgB,YAAY,CAAC,CAAC,eAAe;CACtD;AACF,GC3Ba,IAAe,8CACf,IAAa,MACb,IACX,sEAEW,IACV,OAAO,UAAY,OAAe,QAAQ,KAAK,4BAC/C,OAAO,UAAY,OAAe,QAAQ,KAAK,gBAChD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Attestation } from './graphql/gql/graphql.js';
|
|
2
|
+
export type GetDomainOwnershipFromEasParams = {
|
|
3
|
+
/** Tool canonical wallet(s) that may have attested. */
|
|
4
|
+
toolAddresses: string[];
|
|
5
|
+
/** Optional domains to keep (matched against decoded `domain`, case-insensitive). */
|
|
6
|
+
domains?: string[];
|
|
7
|
+
/** Optional claimer addresses (EAS `recipient` filter). */
|
|
8
|
+
claimers?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* DomainOwnership schema UID. When omitted, filters by named schema
|
|
11
|
+
* {@link DOMAIN_OWNERSHIP_SCHEMA_NAME}.
|
|
12
|
+
*/
|
|
13
|
+
schemaUid?: string;
|
|
14
|
+
excludeRevoked?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Query DomainOwnership sidecar attestations by tool attester (and optional filters).
|
|
18
|
+
* Domain filters are applied client-side from `decodedDataJson`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDomainOwnershipFromEas(params: GetDomainOwnershipFromEasParams): Promise<Attestation[]>;
|
|
21
|
+
export * from './domainOwnershipHelpers.js';
|
|
22
|
+
//# sourceMappingURL=domainOwnership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainOwnership.d.ts","sourceRoot":"","sources":["../src/domainOwnership.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,uDAAuD;IACvD,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAMD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,WAAW,EAAE,CAAC,CAiFxB;AAED,cAAc,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** EAS schema definition for tool domain-ownership sidecar attestations (revocable). */
|
|
2
|
+
export declare const DOMAIN_OWNERSHIP_SCHEMA_DEF = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope";
|
|
3
|
+
/** Schema #1 display name for {@link DOMAIN_OWNERSHIP_SCHEMA_DEF}. */
|
|
4
|
+
export declare const DOMAIN_OWNERSHIP_SCHEMA_NAME = "seedprotocol.domainOwnership";
|
|
5
|
+
/** Challenge method stored on-chain. */
|
|
6
|
+
export declare const DOMAIN_OWNERSHIP_METHOD = "dns-txt-challenge";
|
|
7
|
+
/** Default scope: registrable domain (eTLD+1). */
|
|
8
|
+
export declare const DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE = "registrable";
|
|
9
|
+
/** Underscored DNS owner-name prefix (IETF domain control validation style). */
|
|
10
|
+
export declare const DOMAIN_OWNERSHIP_TXT_LABEL = "_seedprotocol-challenge";
|
|
11
|
+
/** Default challenge lifetime (72 hours). */
|
|
12
|
+
export declare const DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS: number;
|
|
13
|
+
/** Soft staleness window when no live registry snapshot is available (365 days). */
|
|
14
|
+
export declare const DOMAIN_OWNERSHIP_SOFT_STALE_MS: number;
|
|
15
|
+
/** Fallback EAS expiration when RDAP has no expirationDate (365 days from verifiedAt). */
|
|
16
|
+
export declare const DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS: number;
|
|
17
|
+
export type DomainOwnershipDecoded = {
|
|
18
|
+
domain: string;
|
|
19
|
+
claimer: string;
|
|
20
|
+
method: string;
|
|
21
|
+
challengeHash: `0x${string}`;
|
|
22
|
+
verifiedAt: number;
|
|
23
|
+
registryCreationDate: string;
|
|
24
|
+
registryExpirationDate: string;
|
|
25
|
+
registryFingerprint: `0x${string}`;
|
|
26
|
+
scope: string;
|
|
27
|
+
};
|
|
28
|
+
export type DomainOwnershipTxtParts = {
|
|
29
|
+
token: string;
|
|
30
|
+
claimer: string;
|
|
31
|
+
expiry: string;
|
|
32
|
+
};
|
|
33
|
+
export type DomainRegistryFingerprintInput = {
|
|
34
|
+
domain: string;
|
|
35
|
+
creationDate?: string | null;
|
|
36
|
+
registrarIanaId?: string | null;
|
|
37
|
+
};
|
|
38
|
+
export type DomainOwnershipAssessStatus = 'valid' | 'expired' | 'likely_transferred' | 'stale' | 'unknown';
|
|
39
|
+
export type DomainOwnershipAssessResult = {
|
|
40
|
+
status: DomainOwnershipAssessStatus;
|
|
41
|
+
warnings: string[];
|
|
42
|
+
};
|
|
43
|
+
type DecodedField = {
|
|
44
|
+
name?: string;
|
|
45
|
+
value?: unknown;
|
|
46
|
+
type?: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* DNS owner name for the challenge TXT record.
|
|
50
|
+
* Example: `_seedprotocol-challenge.example.com`
|
|
51
|
+
*/
|
|
52
|
+
export declare function domainOwnershipTxtName(domain: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Build IETF-style key=value TXT RDATA for a domain ownership challenge.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildDomainOwnershipTxtValue(params: {
|
|
57
|
+
token: string;
|
|
58
|
+
claimer: string;
|
|
59
|
+
expiry: string;
|
|
60
|
+
}): string;
|
|
61
|
+
/**
|
|
62
|
+
* Parse a domain ownership TXT RDATA value. Returns null when required keys are missing.
|
|
63
|
+
*/
|
|
64
|
+
export declare function parseDomainOwnershipTxtValue(value: string): DomainOwnershipTxtParts | null;
|
|
65
|
+
/**
|
|
66
|
+
* Deterministic challenge hash: keccak256 of canonical UTF-8 material.
|
|
67
|
+
* Material: `domain|claimer|token|scope` (lowercased domain/claimer).
|
|
68
|
+
*/
|
|
69
|
+
export declare function hashDomainOwnershipChallenge(params: {
|
|
70
|
+
domain: string;
|
|
71
|
+
claimer: string;
|
|
72
|
+
token: string;
|
|
73
|
+
scope?: string;
|
|
74
|
+
}): `0x${string}`;
|
|
75
|
+
/**
|
|
76
|
+
* Deterministic registry fingerprint from stable RDAP fields.
|
|
77
|
+
* Uses domain + creationDate + registrar IANA id (empty string when missing).
|
|
78
|
+
*/
|
|
79
|
+
export declare function hashDomainRegistryFingerprint(input: DomainRegistryFingerprintInput): `0x${string}`;
|
|
80
|
+
/**
|
|
81
|
+
* Decode DomainOwnership fields from EAS `decodedDataJson` or a JSON array of named fields.
|
|
82
|
+
*/
|
|
83
|
+
export declare function decodeDomainOwnershipData(data: string | DecodedField[]): DomainOwnershipDecoded;
|
|
84
|
+
/**
|
|
85
|
+
* Pure validity assessment for a decoded domain-ownership attestation.
|
|
86
|
+
*
|
|
87
|
+
* - `registrySnapshot === undefined`: no live recheck; may return `stale`
|
|
88
|
+
* - `registrySnapshot === null`: live lookup failed; returns `unknown` (unless expired)
|
|
89
|
+
* - object snapshot: compares fingerprint → `likely_transferred` on mismatch
|
|
90
|
+
*/
|
|
91
|
+
export declare function assessDomainOwnership(params: {
|
|
92
|
+
decoded: DomainOwnershipDecoded;
|
|
93
|
+
/** EAS on-chain expirationTime (unix seconds), when known. */
|
|
94
|
+
expirationTime?: number | null;
|
|
95
|
+
now?: number;
|
|
96
|
+
registrySnapshot?: DomainRegistryFingerprintInput | null;
|
|
97
|
+
softStaleMs?: number;
|
|
98
|
+
}): DomainOwnershipAssessResult;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=domainOwnershipHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainOwnershipHelpers.d.ts","sourceRoot":"","sources":["../src/domainOwnershipHelpers.ts"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,2LACkJ,CAAA;AAE1L,sEAAsE;AACtE,eAAO,MAAM,4BAA4B,iCAAiC,CAAA;AAE1E,wCAAwC;AACxC,eAAO,MAAM,uBAAuB,sBAAsB,CAAA;AAE1D,kDAAkD;AAClD,eAAO,MAAM,kCAAkC,gBAAgB,CAAA;AAE/D,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,4BAA4B,CAAA;AAEnE,6CAA6C;AAC7C,eAAO,MAAM,iCAAiC,QAAsB,CAAA;AAEpE,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,QAA4B,CAAA;AAEvE,0FAA0F;AAC1F,eAAO,MAAM,wCAAwC,QAAqB,CAAA;AAE1E,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,KAAK,MAAM,EAAE,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,mBAAmB,EAAE,KAAK,MAAM,EAAE,CAAA;IAClC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,2BAA2B,GACnC,OAAO,GACP,SAAS,GACT,oBAAoB,GACpB,OAAO,GACP,SAAS,CAAA;AAEb,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,2BAA2B,CAAA;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAmBD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,MAAM,CAGT;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAe1F;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,KAAK,MAAM,EAAE,CAMhB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,8BAA8B,GACpC,KAAK,MAAM,EAAE,CAOf;AA+BD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,GAC5B,sBAAsB,CAmBxB;AASD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,sBAAsB,CAAA;IAC/B,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,8BAA8B,GAAG,IAAI,CAAA;IACxD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,2BAA2B,CA+C9B"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,cAAc,kCAAkC,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACpF,cAAc,4BAA4B,CAAA;AAC1C,YAAY,EACV,WAAW,EACX,MAAM,IAAI,SAAS,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,cAAc,kCAAkC,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACpF,cAAc,4BAA4B,CAAA;AAC1C,YAAY,EACV,WAAW,EACX,MAAM,IAAI,SAAS,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2097,27 +2097,27 @@ function f(e) {
|
|
|
2097
2097
|
}
|
|
2098
2098
|
//#endregion
|
|
2099
2099
|
//#region src/queries.ts
|
|
2100
|
-
var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), m = f("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), h = f("\n query GetSeeds($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), g = f("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"),
|
|
2100
|
+
var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), m = f("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), h = f("\n query GetSeeds($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), g = f("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), ee = f("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), _ = f("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), v = f("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), te = f("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), y = f("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), b = f("\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n }\n"), x = f("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ne = async ({ seedUids: t, excludeRevoked: n = !0 }) => {
|
|
2101
2101
|
let i = e.getQueryClient(), a = r.getEasClient(), o = n ? u({ refUID: { in: t } }) : { refUID: { in: t } }, { itemVersions: s } = await i.fetchQuery({
|
|
2102
2102
|
queryKey: [
|
|
2103
2103
|
"getVersionsForAllModels",
|
|
2104
2104
|
[...t].sort(),
|
|
2105
2105
|
n
|
|
2106
2106
|
],
|
|
2107
|
-
queryFn: async () => a.request(
|
|
2107
|
+
queryFn: async () => a.request(_, { where: o })
|
|
2108
2108
|
});
|
|
2109
2109
|
return s;
|
|
2110
|
-
},
|
|
2110
|
+
}, S = async ({ versionUids: t, excludeRevoked: n = !0 }) => {
|
|
2111
2111
|
let i = e.getQueryClient(), a = r.getEasClient(), o = n ? u({ refUID: { in: t } }) : { refUID: { in: t } }, { itemProperties: s } = await i.fetchQuery({
|
|
2112
2112
|
queryKey: [
|
|
2113
2113
|
"getPropertiesForAllModels",
|
|
2114
2114
|
[...t].sort(),
|
|
2115
2115
|
n
|
|
2116
2116
|
],
|
|
2117
|
-
queryFn: async () => a.request(
|
|
2117
|
+
queryFn: async () => a.request(v, { where: o })
|
|
2118
2118
|
});
|
|
2119
2119
|
return s;
|
|
2120
|
-
},
|
|
2120
|
+
}, re = async (e) => l(await S(e)), C = async ({ schemaName: t }) => {
|
|
2121
2121
|
try {
|
|
2122
2122
|
let n = e.getQueryClient(), i = r.getEasClient();
|
|
2123
2123
|
if (!n || !i) return;
|
|
@@ -2130,7 +2130,7 @@ var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2130
2130
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
2131
2131
|
return;
|
|
2132
2132
|
}
|
|
2133
|
-
},
|
|
2133
|
+
}, w = async ({ schemaUids: t, addresses: n, excludeRevoked: i = !0 }) => {
|
|
2134
2134
|
let a = {
|
|
2135
2135
|
attester: { in: n.map((e) => {
|
|
2136
2136
|
try {
|
|
@@ -2152,7 +2152,7 @@ var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2152
2152
|
queryFn: async () => s.request(h, { where: a })
|
|
2153
2153
|
});
|
|
2154
2154
|
return l;
|
|
2155
|
-
},
|
|
2155
|
+
}, T = async (t, n = 10, i) => {
|
|
2156
2156
|
let a = i ?? 0, o = {
|
|
2157
2157
|
where: u({ schema: { is: { schemaNames: { some: { name: { equals: t } } } } } }),
|
|
2158
2158
|
take: n,
|
|
@@ -2167,44 +2167,301 @@ var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2167
2167
|
queryFn: async () => c.request(h, o)
|
|
2168
2168
|
});
|
|
2169
2169
|
return l;
|
|
2170
|
-
},
|
|
2170
|
+
}, E = async (e, t = 10) => (await T(e, t)).map((e) => e.id);
|
|
2171
2171
|
//#endregion
|
|
2172
2172
|
//#region src/easUid.ts
|
|
2173
|
-
function
|
|
2173
|
+
function D(e) {
|
|
2174
2174
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2175
2175
|
let t = e.trim();
|
|
2176
2176
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2177
2177
|
}
|
|
2178
|
-
function
|
|
2179
|
-
if (
|
|
2178
|
+
function O(e) {
|
|
2179
|
+
if (D(e)) return !1;
|
|
2180
2180
|
let t = String(e).trim();
|
|
2181
2181
|
if (!/^0x/i.test(t)) return !1;
|
|
2182
2182
|
let n = t.slice(2);
|
|
2183
|
-
return n.length === 64
|
|
2183
|
+
return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2185
|
+
function k(e) {
|
|
2186
2186
|
if (e == null || e === "") return "";
|
|
2187
2187
|
let t = String(e).trim();
|
|
2188
2188
|
return ("0x" + (t.startsWith("0x") || t.startsWith("0X") ? t.slice(2) : t).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
|
|
2189
2189
|
}
|
|
2190
2190
|
//#endregion
|
|
2191
|
+
//#region src/domainOwnershipHelpers.ts
|
|
2192
|
+
var ie = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", A = "seedprotocol.domainOwnership", ae = "dns-txt-challenge", oe = "registrable", j = "_seedprotocol-challenge", se = 2592e5, ce = 31536e6, le = 31536e3;
|
|
2193
|
+
function M(e) {
|
|
2194
|
+
return new TextEncoder().encode(e);
|
|
2195
|
+
}
|
|
2196
|
+
function N(e) {
|
|
2197
|
+
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2198
|
+
}
|
|
2199
|
+
function P(e) {
|
|
2200
|
+
let t = e.trim();
|
|
2201
|
+
try {
|
|
2202
|
+
return c(t).toLowerCase();
|
|
2203
|
+
} catch {
|
|
2204
|
+
return t.toLowerCase();
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
function F(e) {
|
|
2208
|
+
return `${j}.${N(e)}`;
|
|
2209
|
+
}
|
|
2210
|
+
function I(e) {
|
|
2211
|
+
let t = P(e.claimer);
|
|
2212
|
+
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2213
|
+
}
|
|
2214
|
+
function L(e) {
|
|
2215
|
+
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2216
|
+
for (let e of t.split(",")) {
|
|
2217
|
+
let t = e.indexOf("=");
|
|
2218
|
+
if (t <= 0) continue;
|
|
2219
|
+
let r = e.slice(0, t).trim(), i = e.slice(t + 1).trim();
|
|
2220
|
+
r && n.set(r, i);
|
|
2221
|
+
}
|
|
2222
|
+
let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
|
|
2223
|
+
return !r || !i || !a ? null : {
|
|
2224
|
+
token: r,
|
|
2225
|
+
claimer: P(i),
|
|
2226
|
+
expiry: a
|
|
2227
|
+
};
|
|
2228
|
+
}
|
|
2229
|
+
function R(e) {
|
|
2230
|
+
let t = N(e.domain), n = P(e.claimer), r = (e.scope ?? "registrable").trim(), i = `${t}|${n}|${e.token}|${r}`;
|
|
2231
|
+
return "0x" + o(M(i));
|
|
2232
|
+
}
|
|
2233
|
+
function z(e) {
|
|
2234
|
+
let t = {
|
|
2235
|
+
domain: N(e.domain),
|
|
2236
|
+
creationDate: (e.creationDate ?? "").trim(),
|
|
2237
|
+
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2238
|
+
};
|
|
2239
|
+
return "0x" + o(M(JSON.stringify(t)));
|
|
2240
|
+
}
|
|
2241
|
+
function B(e) {
|
|
2242
|
+
return typeof e == "string" ? k(e) : e && typeof e == "object" && "hex" in e ? k(String(e.hex)) : k(String(e ?? ""));
|
|
2243
|
+
}
|
|
2244
|
+
function V(e) {
|
|
2245
|
+
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2246
|
+
}
|
|
2247
|
+
function H(e) {
|
|
2248
|
+
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2249
|
+
if (typeof e == "bigint") return Number(e);
|
|
2250
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
2251
|
+
let t = Number(e);
|
|
2252
|
+
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2253
|
+
}
|
|
2254
|
+
return e && typeof e == "object" && "value" in e ? H(e.value) : 0;
|
|
2255
|
+
}
|
|
2256
|
+
function U(e) {
|
|
2257
|
+
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2258
|
+
for (let e of t) e?.name && n.set(e.name, e);
|
|
2259
|
+
return {
|
|
2260
|
+
domain: N(V(n.get("domain")?.value)),
|
|
2261
|
+
claimer: P(V(n.get("claimer")?.value)),
|
|
2262
|
+
method: V(n.get("method")?.value),
|
|
2263
|
+
challengeHash: B(n.get("challengeHash")?.value),
|
|
2264
|
+
verifiedAt: H(n.get("verifiedAt")?.value),
|
|
2265
|
+
registryCreationDate: V(n.get("registryCreationDate")?.value),
|
|
2266
|
+
registryExpirationDate: V(n.get("registryExpirationDate")?.value),
|
|
2267
|
+
registryFingerprint: B(n.get("registryFingerprint")?.value),
|
|
2268
|
+
scope: V(n.get("scope")?.value)
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
function ue(e) {
|
|
2272
|
+
if (!e?.trim()) return null;
|
|
2273
|
+
let t = Date.parse(e);
|
|
2274
|
+
return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
|
|
2275
|
+
}
|
|
2276
|
+
function de(e) {
|
|
2277
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = ue(e.decoded.registryExpirationDate);
|
|
2278
|
+
if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
|
|
2279
|
+
status: "expired",
|
|
2280
|
+
warnings: n
|
|
2281
|
+
};
|
|
2282
|
+
if (e.registrySnapshot === null) return n.push("Registry lookup unavailable; ownership status is unknown"), {
|
|
2283
|
+
status: "unknown",
|
|
2284
|
+
warnings: n
|
|
2285
|
+
};
|
|
2286
|
+
if (e.registrySnapshot !== void 0) return k(z({
|
|
2287
|
+
domain: e.decoded.domain,
|
|
2288
|
+
creationDate: e.registrySnapshot.creationDate,
|
|
2289
|
+
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
2290
|
+
})) === k(e.decoded.registryFingerprint) ? {
|
|
2291
|
+
status: "valid",
|
|
2292
|
+
warnings: n
|
|
2293
|
+
} : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
|
|
2294
|
+
status: "likely_transferred",
|
|
2295
|
+
warnings: n
|
|
2296
|
+
});
|
|
2297
|
+
let o = e.now ?? Date.now(), s = e.decoded.verifiedAt * 1e3;
|
|
2298
|
+
return Number.isFinite(s) && s > 0 && o - s > r ? (n.push("Attestation is older than the soft staleness window and was not rechecked against the registry"), {
|
|
2299
|
+
status: "stale",
|
|
2300
|
+
warnings: n
|
|
2301
|
+
}) : {
|
|
2302
|
+
status: "valid",
|
|
2303
|
+
warnings: n
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
//#endregion
|
|
2307
|
+
//#region src/domainOwnership.ts
|
|
2308
|
+
function W(e) {
|
|
2309
|
+
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2310
|
+
}
|
|
2311
|
+
async function fe(t) {
|
|
2312
|
+
let { toolAddresses: n, domains: i, claimers: a, schemaUid: o, excludeRevoked: s = !0 } = t;
|
|
2313
|
+
if (!n.length) return [];
|
|
2314
|
+
let l = n.map((e) => {
|
|
2315
|
+
try {
|
|
2316
|
+
return c(e);
|
|
2317
|
+
} catch {
|
|
2318
|
+
return e;
|
|
2319
|
+
}
|
|
2320
|
+
}), d = { attester: { in: l } };
|
|
2321
|
+
o ? d.schemaId = { equals: o } : d.schema = { is: { schemaNames: { some: { name: { equals: A } } } } }, a?.length && (d.recipient = { in: a.map((e) => {
|
|
2322
|
+
try {
|
|
2323
|
+
return c(e);
|
|
2324
|
+
} catch {
|
|
2325
|
+
return e;
|
|
2326
|
+
}
|
|
2327
|
+
}) }), s && (d = u(d));
|
|
2328
|
+
let f = e.getQueryClient(), p = r.getEasClient(), { itemSeeds: m } = await f.fetchQuery({
|
|
2329
|
+
queryKey: [
|
|
2330
|
+
"getDomainOwnershipFromEas",
|
|
2331
|
+
s,
|
|
2332
|
+
o ?? "seedprotocol.domainOwnership",
|
|
2333
|
+
[...l].sort(),
|
|
2334
|
+
[...(i ?? []).map(W)].sort(),
|
|
2335
|
+
[...a ?? []].map((e) => e.toLowerCase()).sort()
|
|
2336
|
+
],
|
|
2337
|
+
queryFn: async () => p.request(h, { where: d })
|
|
2338
|
+
});
|
|
2339
|
+
if (!i?.length) return m;
|
|
2340
|
+
let g = new Set(i.map(W));
|
|
2341
|
+
return m.filter((e) => {
|
|
2342
|
+
try {
|
|
2343
|
+
let t = U(e.decodedDataJson ?? "[]");
|
|
2344
|
+
return g.has(t.domain);
|
|
2345
|
+
} catch {
|
|
2346
|
+
return !1;
|
|
2347
|
+
}
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
//#endregion
|
|
2351
|
+
//#region src/publishAuthorizationHelpers.ts
|
|
2352
|
+
var pe = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", G = "seedprotocol.publishAuthorization", me = "publish,revoke", he = 31536e3;
|
|
2353
|
+
function K(e) {
|
|
2354
|
+
let t = e.trim();
|
|
2355
|
+
try {
|
|
2356
|
+
return c(t).toLowerCase();
|
|
2357
|
+
} catch {
|
|
2358
|
+
return t.toLowerCase();
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
function ge(e) {
|
|
2362
|
+
return typeof e == "string" ? k(e) : e && typeof e == "object" && "hex" in e ? k(String(e.hex)) : k(String(e ?? ""));
|
|
2363
|
+
}
|
|
2364
|
+
function q(e) {
|
|
2365
|
+
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2366
|
+
}
|
|
2367
|
+
function J(e) {
|
|
2368
|
+
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2369
|
+
if (typeof e == "bigint") return Number(e);
|
|
2370
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
2371
|
+
let t = Number(e);
|
|
2372
|
+
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2373
|
+
}
|
|
2374
|
+
return e && typeof e == "object" && "value" in e ? J(e.value) : 0;
|
|
2375
|
+
}
|
|
2376
|
+
function Y(e) {
|
|
2377
|
+
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2378
|
+
for (let e of t) e?.name && n.set(e.name, e);
|
|
2379
|
+
return {
|
|
2380
|
+
identity: K(q(n.get("identity")?.value)),
|
|
2381
|
+
sessionKey: K(q(n.get("sessionKey")?.value)),
|
|
2382
|
+
app: K(q(n.get("app")?.value)),
|
|
2383
|
+
scopes: q(n.get("scopes")?.value),
|
|
2384
|
+
grantedAt: J(n.get("grantedAt")?.value),
|
|
2385
|
+
expiresAt: J(n.get("expiresAt")?.value),
|
|
2386
|
+
permissionsHash: ge(n.get("permissionsHash")?.value)
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
function X(e) {
|
|
2390
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2391
|
+
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2392
|
+
status: "expired",
|
|
2393
|
+
warnings: n
|
|
2394
|
+
} : e.decoded.scopes.trim() === r.trim() ? !e.decoded.identity || !e.decoded.sessionKey ? (n.push("Missing identity or sessionKey"), {
|
|
2395
|
+
status: "unknown",
|
|
2396
|
+
warnings: n
|
|
2397
|
+
}) : {
|
|
2398
|
+
status: "valid",
|
|
2399
|
+
warnings: n
|
|
2400
|
+
} : (n.push(`Unexpected scopes "${e.decoded.scopes}"; expected "${r}"`), {
|
|
2401
|
+
status: "scope_mismatch",
|
|
2402
|
+
warnings: n
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
function _e(e) {
|
|
2406
|
+
return "0x" + o(new TextEncoder().encode(e));
|
|
2407
|
+
}
|
|
2408
|
+
//#endregion
|
|
2409
|
+
//#region src/publishAuthorization.ts
|
|
2410
|
+
async function ve(t = {}) {
|
|
2411
|
+
let { identities: n, sessionKeys: i, apps: a, schemaUid: o, excludeRevoked: s = !0 } = t, l = {};
|
|
2412
|
+
o ? l.schemaId = { equals: o } : l.schema = { is: { schemaNames: { some: { name: { equals: G } } } } }, n?.length && (l.attester = { in: n.map((e) => {
|
|
2413
|
+
try {
|
|
2414
|
+
return c(e);
|
|
2415
|
+
} catch {
|
|
2416
|
+
return e;
|
|
2417
|
+
}
|
|
2418
|
+
}) }), i?.length && (l.recipient = { in: i.map((e) => {
|
|
2419
|
+
try {
|
|
2420
|
+
return c(e);
|
|
2421
|
+
} catch {
|
|
2422
|
+
return e;
|
|
2423
|
+
}
|
|
2424
|
+
}) }), s && (l = u(l));
|
|
2425
|
+
let d = e.getQueryClient(), f = r.getEasClient(), { itemSeeds: p } = await d.fetchQuery({
|
|
2426
|
+
queryKey: [
|
|
2427
|
+
"getPublishAuthorizationFromEas",
|
|
2428
|
+
s,
|
|
2429
|
+
o ?? "seedprotocol.publishAuthorization",
|
|
2430
|
+
[...n ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2431
|
+
[...i ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2432
|
+
[...a ?? []].map((e) => e.toLowerCase()).sort()
|
|
2433
|
+
],
|
|
2434
|
+
queryFn: async () => f.request(h, { where: l })
|
|
2435
|
+
});
|
|
2436
|
+
if (!a?.length) return p;
|
|
2437
|
+
let m = new Set(a.map((e) => e.toLowerCase()));
|
|
2438
|
+
return p.filter((e) => {
|
|
2439
|
+
try {
|
|
2440
|
+
let t = Y(e.decodedDataJson ?? "[]");
|
|
2441
|
+
return m.has(t.app.toLowerCase());
|
|
2442
|
+
} catch {
|
|
2443
|
+
return !1;
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
}
|
|
2447
|
+
//#endregion
|
|
2191
2448
|
//#region src/stores/schemaUidCache.ts
|
|
2192
|
-
var
|
|
2193
|
-
|
|
2194
|
-
},
|
|
2195
|
-
|
|
2196
|
-
},
|
|
2449
|
+
var Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = ({ text: e, schemaUid: t }) => {
|
|
2450
|
+
Z.set(s(e), t);
|
|
2451
|
+
}, ye = ({ modelName: e, schemaUid: t }) => {
|
|
2452
|
+
Q.set(e.toLowerCase(), t);
|
|
2453
|
+
}, be = (e) => Q.get(e.toLowerCase()), xe = async ({ schemaText: e }) => {
|
|
2197
2454
|
let t = s(e);
|
|
2198
|
-
if (!
|
|
2199
|
-
let e = await
|
|
2200
|
-
return e &&
|
|
2455
|
+
if (!Z.has(t)) {
|
|
2456
|
+
let e = await C({ schemaName: t });
|
|
2457
|
+
return e && $({
|
|
2201
2458
|
text: t,
|
|
2202
2459
|
schemaUid: e
|
|
2203
2460
|
}), e;
|
|
2204
2461
|
}
|
|
2205
|
-
return
|
|
2462
|
+
return Z.get(t);
|
|
2206
2463
|
};
|
|
2207
2464
|
//#endregion
|
|
2208
|
-
export { r as BaseEasClient, r as EasClient, e as BaseQueryClient, a as EAS_ENDPOINT,
|
|
2465
|
+
export { r as BaseEasClient, r as EasClient, e as BaseQueryClient, se as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, le as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, ae as DOMAIN_OWNERSHIP_METHOD, ie as DOMAIN_OWNERSHIP_SCHEMA_DEF, A as DOMAIN_OWNERSHIP_SCHEMA_NAME, oe as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, ce as DOMAIN_OWNERSHIP_SOFT_STALE_MS, j as DOMAIN_OWNERSHIP_TXT_LABEL, a as EAS_ENDPOINT, te as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, y as GET_FILES_METADATA, b as GET_IMAGE_SEEDS, x as GET_IMAGE_VERSIONS, v as GET_PROPERTIES, p as GET_SCHEMAS, m as GET_SCHEMA_BY_NAME, h as GET_SEEDS, g as GET_SEED_IDS, ee as GET_STORAGE_TRANSACTION_ID, _ as GET_VERSIONS, he as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, pe as PUBLISH_AUTHORIZATION_SCHEMA_DEF, G as PUBLISH_AUTHORIZATION_SCHEMA_NAME, me as PUBLISH_AUTHORIZATION_SCOPES, n as ZERO_ADDRESS, i as ZERO_BYTES, t as ZERO_BYTES32, de as assessDomainOwnership, X as assessPublishAuthorization, I as buildDomainOwnershipTxtValue, c as checksumAddress, U as decodeDomainOwnershipData, Y as decodePublishAuthorizationData, F as domainOwnershipTxtName, re as getCanonicalItemPropertiesFromEas, fe as getDomainOwnershipFromEas, C as getEasSchemaUidBySchemaName, xe as getEasSchemaUidForSchemaDefinition, S as getItemPropertiesFromEas, ne as getItemVersionsFromEas, ve as getPublishAuthorizationFromEas, be as getSchemaUidForModelFromCache, E as getSeedUidsBySchemaName, T as getSeedsBySchemaName, w as getSeedsFromSchemaUids, R as hashDomainOwnershipChallenge, z as hashDomainRegistryFingerprint, _e as hashPublishAuthorizationMaterial, D as isPlaceholderUid, O as isValidEasAttestationUid, k as normalizeBytes32Hex, L as parseDomainOwnershipTxtValue, l as pickLatestPropertyAttestationsByRefAndSchema, ye as setSchemaUidForModel, $ as setSchemaUidForSchemaDefinition, s as toSnakeCase, u as withExcludeRevokedFilter };
|
|
2209
2466
|
|
|
2210
2467
|
//# sourceMappingURL=index.js.map
|