@zkproofport-app/sdk 0.4.0 → 0.4.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.
@@ -0,0 +1,9 @@
1
+ import type { RelayTerminalStatus } from './types';
2
+ /**
3
+ * The statuses a relay request ends in, as a runtime list. `satisfies` keeps it
4
+ * in step with the `RelayTerminalStatus` type in both directions: a status
5
+ * added to the type and not here, or here and not in the type, fails to compile.
6
+ */
7
+ export declare const RELAY_TERMINAL_STATUSES: readonly ["completed", "error", "failed", "cancelled", "expired"];
8
+ /** True when `status` is one a relay request ends in. */
9
+ export declare function isTerminalRelayStatus(status: string): status is RelayTerminalStatus;
package/dist/types.d.ts CHANGED
@@ -236,6 +236,8 @@ export interface ActionBoundInputs {
236
236
  }
237
237
  /** The same shape, for the circuit whose action is optional. */
238
238
  export type GiwaAttestationInputs = ActionBoundInputs;
239
+ /** Dojang Playground takes the same shape: its action is optional too. */
240
+ export type DojangPlaygroundInputs = ActionBoundInputs;
239
241
  /**
240
242
  * Union type of all circuit-specific input types.
241
243
  * Each circuit type has a corresponding input interface.
@@ -497,17 +499,31 @@ export interface RelayProofRequest {
497
499
  requestId: string;
498
500
  /** Deep link URL to open ZKProofport app (built by relay) */
499
501
  deepLink: string;
500
- /** Relay status: pending, completed, failed */
502
+ /** Relay status at creation: always 'pending' */
501
503
  status: string;
502
504
  /** Relative poll URL for checking proof status (e.g., /api/v1/proof/{requestId}) */
503
505
  pollUrl: string;
504
506
  }
505
507
  /**
506
- * Proof result retrieved from relay polling.
508
+ * The states a relay request ends in (see `RELAY_TERMINAL_STATUSES`). Once reached, the status never changes
509
+ * and `waitForProof()` / `waitForResult()` resolve with it.
510
+ *
511
+ * - `completed` — a proof came back.
512
+ * - `error` — the app could not produce a proof; `error` says why, `errorCode`
513
+ * (e.g. `E2007`) names the cause when the app sent one.
514
+ * - `failed` — the older name for `error`, still sent by older app versions.
515
+ * - `cancelled` — the user declined in the ZKProofport app.
516
+ * - `expired` — the app did not answer in time, so the relay answered for it.
517
+ */
518
+ export type RelayTerminalStatus = 'completed' | 'error' | 'failed' | 'cancelled' | 'expired';
519
+ /** Every status a relay request can report: `pending`, `generating` while the app works, then a terminal one. */
520
+ export type RelayProofStatus = 'pending' | 'generating' | RelayTerminalStatus;
521
+ /**
522
+ * Proof result retrieved from the relay, by polling or over the socket.
507
523
  */
508
524
  export interface RelayProofResult {
509
525
  requestId: string;
510
- status: 'pending' | 'completed' | 'failed';
526
+ status: RelayProofStatus;
511
527
  deepLink?: string;
512
528
  createdAt?: string;
513
529
  updatedAt?: string;
@@ -517,6 +533,8 @@ export interface RelayProofResult {
517
533
  verifierAddress?: string;
518
534
  chainId?: number;
519
535
  circuit?: string;
520
- /** Present when status is 'failed' */
536
+ /** Human-readable reason, present when status is 'error', 'failed' or 'expired' */
521
537
  error?: string;
538
+ /** The app's error code (`E` + four digits, e.g. `E2007`), present on some 'error' results */
539
+ errorCode?: string;
522
540
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkproofport-app/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "ZKProofport SDK for requesting zero-knowledge proofs from the ZKProofport mobile app and verifying them on-chain",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",