@seedprotocol/eas 0.7.4 → 0.7.5-next.850.g9ab585b
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/README.md +81 -0
- package/dist/api.d.ts +9 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/easNames.d.ts +16 -5
- package/dist/easNames.d.ts.map +1 -1
- package/dist/easValues.d.ts +19 -0
- package/dist/easValues.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +232 -182
- package/dist/index.js.map +1 -1
- package/package.json +17 -2
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @seedprotocol/eas
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@seedprotocol/eas)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Read-side [Ethereum Attestation Service (EAS)](https://attest.sh) client and helpers for [Seed Protocol](https://seedprotocol.io). It queries an EAS indexer (easscan GraphQL) for Seed, Version and property attestations, resolves which chain and indexer to read from, ships known EAS deployments per chain, and decodes Seed Protocol sidecar attestations (PublishedBy, PublishAuthorization, DomainOwnership). It does not write to chain; attesting and revoking live in `@seedprotocol/publish`.
|
|
7
|
+
|
|
8
|
+
This is a lean building block. [`@seedprotocol/sdk`](https://www.npmjs.com/package/@seedprotocol/sdk) depends on it and registers the platform clients during init, so **app developers should use the SDK**. Install this package directly for servers, scripts or tools (feeds, indexers, verifiers) that read Seed attestations without the full SDK.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @seedprotocol/eas
|
|
14
|
+
# or
|
|
15
|
+
bun add @seedprotocol/eas
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
The read helpers go through two process-wide clients (`EasClient` for GraphQL, `BaseQueryClient` for request de-duplication) that need a platform implementation. In Node.js, import the `/node` subpath, which registers both on import (`registerNodeEasPlatform()` does the same explicitly):
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import '@seedprotocol/eas/node'
|
|
24
|
+
import {
|
|
25
|
+
getSeedsBySchemaName,
|
|
26
|
+
getItemVersionsFromEas,
|
|
27
|
+
getCanonicalItemPropertiesFromEas,
|
|
28
|
+
} from '@seedprotocol/eas'
|
|
29
|
+
|
|
30
|
+
// Newest seeds for an EAS schema name, revoked ones excluded
|
|
31
|
+
const seeds = await getSeedsBySchemaName('post', 20)
|
|
32
|
+
|
|
33
|
+
// Versions of those seeds, then the newest live property attestation per (version, schema)
|
|
34
|
+
const versions = await getItemVersionsFromEas({ seedUids: seeds.map((s) => s.id) })
|
|
35
|
+
const properties = await getCanonicalItemPropertiesFromEas({
|
|
36
|
+
versionUids: versions.map((v) => v.id),
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Revoked attestations are excluded by default (`excludeRevoked: true`). See [ATTESTATION_REVOCATION.md](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/docs/ATTESTATION_REVOCATION.md).
|
|
41
|
+
|
|
42
|
+
### Choosing the chain
|
|
43
|
+
|
|
44
|
+
Reads default to Optimism Sepolia (`11155420`). Without SDK or publish config, set the chain with `EAS_CHAIN_ID` (or `NEXT_PUBLIC_EAS_CHAIN_ID`); override the indexer with `EAS_ENDPOINT` / `NEXT_PUBLIC_EAS_ENDPOINT`. The SDK and `@seedprotocol/publish` set it through `configureEasReadChain`, and a conflicting chain id throws rather than reading one chain while writing another.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { getEasReadChainId, getEasEndpoint, getEasChainDeployment } from '@seedprotocol/eas'
|
|
48
|
+
|
|
49
|
+
getEasReadChainId() // e.g. 8453 when EAS_CHAIN_ID=8453
|
|
50
|
+
getEasEndpoint() // https://base.easscan.org/graphql
|
|
51
|
+
getEasChainDeployment(8453) // { name: 'Base', easContractAddress, indexerUrl, explorerUrl, ... }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Exports
|
|
55
|
+
|
|
56
|
+
| Entry | Main exports |
|
|
57
|
+
|-------|--------------|
|
|
58
|
+
| `@seedprotocol/eas` | Seeds / Versions / properties: `getSeedsBySchemaName`, `getSeedsByUidsFromEas`, `getSeedsFromSchemaUids`, `getSeedUidsBySchemaName`, `getItemVersionsFromEas`, `getItemPropertiesFromEas`, `getCanonicalItemPropertiesFromEas`, `getAttestationChangesSince` |
|
|
59
|
+
| | Schemas: `getEasSchemaUidBySchemaName`, `fetchEasSchemaUidBySchemaName`, `getSchemaNamesBySchemaUids`, schema UID cache (`cachedSchemaLookup`, `getEasSchemaUidForSchemaDefinition`, `setSchemaUidForModel`, …) |
|
|
60
|
+
| | Chain config: `configureEasReadChain`, `getEasReadChainId`, `getEasEndpoint`, `whenEasReadChainSettled`, `EAS_CHAIN_DEPLOYMENTS`, `DEFAULT_EAS_CHAIN_ID`, `getEasChainDeployment`, `resolveEasChainDeployment`, `getEasAttestationExplorerUrl` |
|
|
61
|
+
| | Canonicalization / filters: `pickLatestPropertyAttestationsByRefAndSchema`, `withExcludeRevokedFilter`, `isValidEasAttestationUid`, `normalizeBytes32Hex` |
|
|
62
|
+
| | Sidecars: `getPublishedByFromEas`, `decodePublishedByData`, `verifyPublishedByBatch`; `getPublishAuthorizationFromEas`, `assessPublishAuthorization`; `getDomainOwnershipFromEas`, `assessDomainOwnership`, plus their `*_SCHEMA_NAME` / `*_SCHEMA_DEF` constants |
|
|
63
|
+
| | Clients: `EasClient` / `BaseEasClient`, `BaseQueryClient`, `IEasClient`, `IQueryClient`; GraphQL documents (`GET_SEEDS`, `GET_VERSIONS`, `GET_PROPERTIES`, …); types `Attestation`, `EASSchema` |
|
|
64
|
+
| `@seedprotocol/eas/node` | `registerNodeEasPlatform()`, `NodeEasClient`, `NodeQueryClient` (a `@tanstack/query-core` client: concurrent identical requests share one fetch) |
|
|
65
|
+
|
|
66
|
+
Sidecar details: [PUBLISHING.md](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/docs/PUBLISHING.md) (PublishedBy), [PUBLISH_AUTOMATION.md](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/docs/PUBLISH_AUTOMATION.md) (PublishAuthorization), [DOMAIN_OWNERSHIP.md](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/docs/DOMAIN_OWNERSHIP.md).
|
|
67
|
+
|
|
68
|
+
## Related packages
|
|
69
|
+
|
|
70
|
+
- [`@seedprotocol/sdk`](https://www.npmjs.com/package/@seedprotocol/sdk) — the full local-first SDK (uses this package for EAS sync)
|
|
71
|
+
- [`@seedprotocol/query`](https://www.npmjs.com/package/@seedprotocol/query) — assembled Seed JSON (`getSeed`, `queryBySchema`) built on these reads
|
|
72
|
+
- [`@seedprotocol/arweave`](https://www.npmjs.com/package/@seedprotocol/arweave) — Arweave gateway client
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
- [seedprotocol.io](https://seedprotocol.io)
|
|
77
|
+
- [Changelog](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/packages/eas/CHANGELOG.md)
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|
package/dist/api.d.ts
CHANGED
|
@@ -9,13 +9,18 @@ export declare const getItemPropertiesFromEas: ({ versionUids, excludeRevoked, }
|
|
|
9
9
|
excludeRevoked?: boolean;
|
|
10
10
|
}) => Promise<Attestation[]>;
|
|
11
11
|
/**
|
|
12
|
-
* Canonical properties of the given versions
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Canonical properties of the given versions: the newest per version and property schema.
|
|
13
|
+
*
|
|
14
|
+
* By default only attestations from the right accounts count (easRefAttester.ts): a version must
|
|
15
|
+
* be attested by its seed's attester, and a property by its version's. Anyone can attest with any
|
|
16
|
+
* refUID, so without this another account's newer property would win. That costs two more
|
|
17
|
+
* requests (the versions and their seeds); pass `checkAttesters: false` when the versions are
|
|
18
|
+
* already known to be trusted.
|
|
15
19
|
*/
|
|
16
|
-
export declare const getCanonicalItemPropertiesFromEas: (
|
|
20
|
+
export declare const getCanonicalItemPropertiesFromEas: ({ versionUids, excludeRevoked, checkAttesters, }: {
|
|
17
21
|
versionUids: string[];
|
|
18
22
|
excludeRevoked?: boolean;
|
|
23
|
+
checkAttesters?: boolean;
|
|
19
24
|
}) => Promise<Attestation[]>;
|
|
20
25
|
/**
|
|
21
26
|
* UID of the first EAS schema whose definition ends with `schemaName`, or undefined when there is
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,0BAA0B,CAAA;AAEhF,YAAY,EAAE,WAAW,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEhF,eAAO,MAAM,sBAAsB,GAAU,+BAG1C;IACD,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,KAAG,OAAO,CAAC,WAAW,EAAE,CAiBxB,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,kCAG5C;IACD,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,KAAG,OAAO,CAAC,WAAW,EAAE,CAiBxB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,GAAU,kDAIrD;IACD,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,KAAG,OAAO,CAAC,WAAW,EAAE,CA6BxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,6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CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,KAAG,OAAO,CAAC,iBAAiB,EAAE,CA8B9B,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAU,YAAY,MAAM,EAAE,QAAO,MAAW,sBAGnF,CAAA"}
|
package/dist/easNames.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Reading: an EAS name is never turned back into a local name. It is matched against the local
|
|
9
9
|
* candidates by key, at a {@link NameMatchLevel}:
|
|
10
10
|
*
|
|
11
|
-
* - `exact`: `easName(local)
|
|
11
|
+
* - `exact`: the EAS name is exactly `easName(local)`, what this SDK publishes.
|
|
12
12
|
* - `normalized`: lowercase alphanumerics only. `html_page`, `htmlpage`, `HTMLPage` and
|
|
13
13
|
* `html-page` are the same; this finds seeds published under older SDKs' names.
|
|
14
14
|
* - `fuzzy`: the normalized key without a trailing plural `s`, and for relations without a
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
*/
|
|
26
26
|
export declare const easName: (name: string) => string;
|
|
27
27
|
export type NameMatchLevel = 'exact' | 'normalized' | 'fuzzy';
|
|
28
|
+
/** The levels, tightest first. */
|
|
29
|
+
export declare const NAME_MATCH_LEVELS: readonly NameMatchLevel[];
|
|
30
|
+
export declare const isNameMatchLevel: (value: unknown) => value is NameMatchLevel;
|
|
28
31
|
/** How closely two names matched: the tightest level that accepts them. */
|
|
29
32
|
export type NameMatchTier = NameMatchLevel;
|
|
30
33
|
/** The default level (ADR 0008 and the nameMatch design): fuzzy. */
|
|
@@ -72,13 +75,14 @@ export type NameMatchResult<T> = {
|
|
|
72
75
|
*/
|
|
73
76
|
export declare function matchEasName<T>(name: string, candidates: readonly NameMatchCandidate<T>[]): NameMatchResult<T>;
|
|
74
77
|
/**
|
|
75
|
-
* The local names an EAS name matches in the tightest tier that has any (each name at `level
|
|
76
|
-
* Several names can share a tier, e.g. `New model` and
|
|
77
|
-
* decides whether that's ambiguous (models in different
|
|
78
|
+
* The local names an EAS name matches in the tightest tier that has any (each name at `level`, or
|
|
79
|
+
* at the level `level(localName)` returns). Several names can share a tier, e.g. `New model` and
|
|
80
|
+
* `NewModel` for `new_model`: the caller decides whether that's ambiguous (models in different
|
|
81
|
+
* schemas) or the same thing.
|
|
78
82
|
*/
|
|
79
83
|
export declare function localNamesInBestMatchTier(name: string, localNames: Iterable<string>, options?: {
|
|
80
84
|
relation?: boolean;
|
|
81
|
-
level?: NameMatchLevel;
|
|
85
|
+
level?: NameMatchLevel | ((localName: string) => NameMatchLevel);
|
|
82
86
|
}): Set<string>;
|
|
83
87
|
/**
|
|
84
88
|
* Names that can match `name` at the normalized level and that an SDK may have written: its EAS
|
|
@@ -86,4 +90,11 @@ export declare function localNamesInBestMatchTier(name: string, localNames: Iter
|
|
|
86
90
|
* fetching schemas by name; the results are then filtered with {@link matchEasName}.
|
|
87
91
|
*/
|
|
88
92
|
export declare function easNameVariants(name: string): string[];
|
|
93
|
+
/**
|
|
94
|
+
* The EAS names to fetch schemas under for a local model name at `level`: at `exact` its EAS name
|
|
95
|
+
* only; at `normalized` also {@link easNameVariants} and the name as written; at `fuzzy` also a
|
|
96
|
+
* plural or singular form of each. Fetching is a superset: results are still filtered with
|
|
97
|
+
* {@link matchEasName}.
|
|
98
|
+
*/
|
|
99
|
+
export declare function easNamesToFetch(name: string, level?: NameMatchLevel): string[];
|
|
89
100
|
//# sourceMappingURL=easNames.d.ts.map
|
package/dist/easNames.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easNames.d.ts","sourceRoot":"","sources":["../src/easNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAMrB,CAAA;AAElB,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,CAAA;AAE7D,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;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5
|
+
* string, and a wide one (`uint256`) as `{ type: 'BigNumber', hex }`. Seed publishes Number as a
|
|
6
|
+
* decimal string and Date as `uint256` Unix seconds. {@link decodeEasNumber} reads all of these.
|
|
7
|
+
*/
|
|
8
|
+
/** `uint8` … `uint256`, `int8` … `int256`, and the bare `uint`/`int`. */
|
|
9
|
+
export declare function isNumericEasType(easType: string | undefined | null): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The decimal string for a numeric EAS value, or undefined when it isn't numeric.
|
|
12
|
+
*
|
|
13
|
+
* Accepts a finite JSON number, a bigint, a decimal or `0x` hex string, and an ethers v5
|
|
14
|
+
* `{ type: 'BigNumber', hex }` (or `{ _hex }`). Integer strings stay exact (`'9007199254740993'`);
|
|
15
|
+
* other numbers come back as `String(Number(value))` (`'1.5'`, `'1e+21'`). Publish uses the same
|
|
16
|
+
* function for the value it attests, so what is written and what is read agree.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodeEasNumber(value: unknown): string | undefined;
|
|
19
|
+
//# sourceMappingURL=easValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easValues.d.ts","sourceRoot":"","sources":["../src/easValues.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAE5E;AASD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgBlE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './publishAuthorization.js';
|
|
|
7
7
|
export * from './easPropertyCanonical.js';
|
|
8
8
|
export * from './easRefAttester.js';
|
|
9
9
|
export * from './easNames.js';
|
|
10
|
+
export * from './easValues.js';
|
|
10
11
|
export * from './easRevokedFilter.js';
|
|
11
12
|
export * from './easUid.js';
|
|
12
13
|
export * from './publishedBy.js';
|
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,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,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,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAA;AACzB,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,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAA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