easctl 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/commands/query-attestations.test.ts +15 -0
- package/src/__tests__/integration/graphql-live.test.ts +10 -0
- package/src/commands/query-attestations.ts +11 -3
- package/src/graphql.ts +18 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Command-line interface for the [Ethereum Attestation Service](https://attest.org). Built on [EAS SDK v2](https://github.com/ethereum-attestation-service/eas-sdk-v2) and [ethers](https://docs.ethers.org).
|
|
4
4
|
|
|
5
|
-
All commands support `--json` for structured output
|
|
5
|
+
All commands support `--json` for structured output, `--dry-run` for gas estimation, and popular schema names (e.g. `--schema make-a-statement`) instead of raw UIDs.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -88,8 +88,24 @@ easctl schema-register --schema "uint256 score, string comment" --chain sepolia
|
|
|
88
88
|
|
|
89
89
|
# Get a schema by UID (read-only)
|
|
90
90
|
easctl schema-get --uid 0xSchemaUID --chain sepolia
|
|
91
|
+
|
|
92
|
+
# Browse popular schemas
|
|
93
|
+
easctl popular-schemas
|
|
94
|
+
easctl popular-schemas --category social
|
|
95
|
+
easctl popular-schemas --json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Popular Schema Names
|
|
99
|
+
|
|
100
|
+
Instead of raw UIDs, you can use popular schema names anywhere a schema UID is accepted:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
easctl attest --schema make-a-statement --data '[{"name":"statement","type":"string","value":"Hello EAS"}]'
|
|
104
|
+
easctl query-attestations --schema is-a-friend --chain base
|
|
91
105
|
```
|
|
92
106
|
|
|
107
|
+
Run `easctl popular-schemas` to see all available names.
|
|
108
|
+
|
|
93
109
|
### Timestamps
|
|
94
110
|
|
|
95
111
|
```bash
|
|
@@ -122,6 +138,10 @@ easctl query-schemas --creator 0xAddress --limit 20 --chain sepolia
|
|
|
122
138
|
### Utility
|
|
123
139
|
|
|
124
140
|
```bash
|
|
141
|
+
# Show wallet, chain, and contract configuration
|
|
142
|
+
easctl status
|
|
143
|
+
easctl status --chain base
|
|
144
|
+
|
|
125
145
|
# List supported chains
|
|
126
146
|
easctl chains
|
|
127
147
|
```
|
package/dist/index.js
CHANGED
|
@@ -31164,6 +31164,24 @@ var QUERIES = {
|
|
|
31164
31164
|
}
|
|
31165
31165
|
}
|
|
31166
31166
|
`,
|
|
31167
|
+
getAttestationsByRecipient: `
|
|
31168
|
+
query GetAttestationsByRecipient($recipient: String!, $take: Int, $skip: Int) {
|
|
31169
|
+
attestations(
|
|
31170
|
+
where: { recipient: { equals: $recipient } }
|
|
31171
|
+
take: $take
|
|
31172
|
+
skip: $skip
|
|
31173
|
+
orderBy: [{ time: desc }]
|
|
31174
|
+
) {
|
|
31175
|
+
id
|
|
31176
|
+
attester
|
|
31177
|
+
schemaId
|
|
31178
|
+
time
|
|
31179
|
+
revoked
|
|
31180
|
+
decodedDataJson
|
|
31181
|
+
isOffchain
|
|
31182
|
+
}
|
|
31183
|
+
}
|
|
31184
|
+
`,
|
|
31167
31185
|
getSchemata: `
|
|
31168
31186
|
query GetSchemata($take: Int, $skip: Int) {
|
|
31169
31187
|
schemata(
|
|
@@ -31312,13 +31330,14 @@ var queryAttestationCommand = new import_commander10.Command("query-attestation"
|
|
|
31312
31330
|
|
|
31313
31331
|
// src/commands/query-attestations.ts
|
|
31314
31332
|
var import_commander11 = require("commander");
|
|
31315
|
-
var queryAttestationsCommand = new import_commander11.Command("query-attestations").description("Query attestations by schema or attester from the EAS GraphQL API").option("-s, --schema <uid>", "Filter by schema UID or popular schema name").option("-a, --attester <address>", "Filter by attester address").option("-n, --limit <number>", "Max results to return", "10").option("--skip <number>", "Number of results to skip (for pagination)", "0").option("-c, --chain <name>", "Chain name", "ethereum").action(async (opts) => {
|
|
31333
|
+
var queryAttestationsCommand = new import_commander11.Command("query-attestations").description("Query attestations by schema or attester from the EAS GraphQL API").option("-s, --schema <uid>", "Filter by schema UID or popular schema name").option("-a, --attester <address>", "Filter by attester address").option("-r, --recipient <address>", "Filter by recipient address").option("-n, --limit <number>", "Max results to return", "10").option("--skip <number>", "Number of results to skip (for pagination)", "0").option("-c, --chain <name>", "Chain name", "ethereum").action(async (opts) => {
|
|
31316
31334
|
try {
|
|
31317
|
-
if (!opts.schema && !opts.attester) {
|
|
31318
|
-
throw new Error("Provide at least one filter: --schema or --
|
|
31335
|
+
if (!opts.schema && !opts.attester && !opts.recipient) {
|
|
31336
|
+
throw new Error("Provide at least one filter: --schema, --attester, or --recipient");
|
|
31319
31337
|
}
|
|
31320
31338
|
if (opts.schema) opts.schema = resolveAndValidateSchemaUID(opts.schema, "schema UID");
|
|
31321
31339
|
if (opts.attester) validateAddress(opts.attester, "attester");
|
|
31340
|
+
if (opts.recipient) validateAddress(opts.recipient, "recipient");
|
|
31322
31341
|
const take = parseInt(opts.limit, 10);
|
|
31323
31342
|
const skip = parseInt(opts.skip, 10);
|
|
31324
31343
|
if (isNaN(take) || take < 1) throw new Error("--limit must be a positive integer");
|
|
@@ -31330,12 +31349,18 @@ var queryAttestationsCommand = new import_commander11.Command("query-attestation
|
|
|
31330
31349
|
take,
|
|
31331
31350
|
skip
|
|
31332
31351
|
});
|
|
31333
|
-
} else {
|
|
31352
|
+
} else if (opts.attester) {
|
|
31334
31353
|
data = await graphqlQuery(opts.chain, QUERIES.getAttestationsByAttester, {
|
|
31335
31354
|
attester: opts.attester,
|
|
31336
31355
|
take,
|
|
31337
31356
|
skip
|
|
31338
31357
|
});
|
|
31358
|
+
} else {
|
|
31359
|
+
data = await graphqlQuery(opts.chain, QUERIES.getAttestationsByRecipient, {
|
|
31360
|
+
recipient: opts.recipient,
|
|
31361
|
+
take,
|
|
31362
|
+
skip
|
|
31363
|
+
});
|
|
31339
31364
|
}
|
|
31340
31365
|
const attestations = data.attestations || [];
|
|
31341
31366
|
for (const att of attestations) {
|
|
@@ -31555,7 +31580,7 @@ var statusCommand = new import_commander18.Command("status").description("Show c
|
|
|
31555
31580
|
|
|
31556
31581
|
// src/index.ts
|
|
31557
31582
|
var program = new import_commander19.Command();
|
|
31558
|
-
program.name("easctl").description("Ethereum Attestation Service CLI \u2014 create, revoke, and query attestations").version("0.2.
|
|
31583
|
+
program.name("easctl").description("Ethereum Attestation Service CLI \u2014 create, revoke, and query attestations").version("0.2.1").option("--json", "Output results as JSON (useful for agents and scripting)").hook("preAction", (thisCommand, actionCommand) => {
|
|
31559
31584
|
if (thisCommand.opts().json || actionCommand.opts().json) {
|
|
31560
31585
|
setJsonMode(true);
|
|
31561
31586
|
}
|