easctl 0.1.1 → 0.1.2

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/index.js CHANGED
@@ -31054,7 +31054,22 @@ var QUERIES = {
31054
31054
  }
31055
31055
  `,
31056
31056
  getSchemata: `
31057
- query GetSchemata($creator: String, $take: Int, $skip: Int) {
31057
+ query GetSchemata($take: Int, $skip: Int) {
31058
+ schemata(
31059
+ take: $take
31060
+ skip: $skip
31061
+ orderBy: [{ time: desc }]
31062
+ ) {
31063
+ id
31064
+ schema
31065
+ creator
31066
+ revocable
31067
+ time
31068
+ }
31069
+ }
31070
+ `,
31071
+ getSchemataByCreator: `
31072
+ query GetSchemataByCreator($creator: String!, $take: Int, $skip: Int) {
31058
31073
  schemata(
31059
31074
  where: { creator: { equals: $creator } }
31060
31075
  take: $take
@@ -31231,18 +31246,17 @@ var queryAttestationsCommand = new import_commander11.Command("query-attestation
31231
31246
 
31232
31247
  // src/commands/query-schemas.ts
31233
31248
  var import_commander12 = require("commander");
31234
- var querySchemasCommand = new import_commander12.Command("query-schemas").description("Query schemas by creator from the EAS GraphQL API").requiredOption("-a, --creator <address>", "Creator 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) => {
31249
+ var querySchemasCommand = new import_commander12.Command("query-schemas").description("Query latest schemas from the EAS GraphQL API, optionally filtered by creator").option("-a, --creator <address>", "Filter by creator 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) => {
31235
31250
  try {
31236
- validateAddress(opts.creator, "creator");
31251
+ if (opts.creator) validateAddress(opts.creator, "creator");
31237
31252
  const take = parseInt(opts.limit, 10);
31238
31253
  const skip = parseInt(opts.skip, 10);
31239
31254
  if (isNaN(take) || take < 1) throw new Error("--limit must be a positive integer");
31240
31255
  if (isNaN(skip) || skip < 0) throw new Error("--skip must be a non-negative integer");
31241
- const data = await graphqlQuery(opts.chain, QUERIES.getSchemata, {
31242
- creator: opts.creator,
31243
- take,
31244
- skip
31245
- });
31256
+ const query = opts.creator ? QUERIES.getSchemataByCreator : QUERIES.getSchemata;
31257
+ const variables = { take, skip };
31258
+ if (opts.creator) variables.creator = opts.creator;
31259
+ const data = await graphqlQuery(opts.chain, query, variables);
31246
31260
  const schemas = data.schemata || [];
31247
31261
  output({
31248
31262
  success: true,
@@ -31355,7 +31369,7 @@ var clearKeyCommand = new import_commander16.Command("clear-key").description("R
31355
31369
 
31356
31370
  // src/index.ts
31357
31371
  var program = new import_commander17.Command();
31358
- program.name("easctl").description("Ethereum Attestation Service CLI \u2014 create, revoke, and query attestations").version("0.1.0").option("--json", "Output results as JSON (useful for agents and scripting)").hook("preAction", (thisCommand, actionCommand) => {
31372
+ program.name("easctl").description("Ethereum Attestation Service CLI \u2014 create, revoke, and query attestations").version("0.1.2").option("--json", "Output results as JSON (useful for agents and scripting)").hook("preAction", (thisCommand, actionCommand) => {
31359
31373
  if (thisCommand.opts().json || actionCommand.opts().json) {
31360
31374
  setJsonMode(true);
31361
31375
  }