@zkproofport-app/sdk 0.4.1 → 0.4.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/README.md +33 -25
- package/dist/ProofportSDK.d.ts +4 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +27 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- package/dist/index.mjs.map +1 -1
- package/dist/relayStatus.d.ts +9 -0
- package/dist/types.d.ts +20 -4
- package/package.json +1 -1
|
@@ -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
|
@@ -499,17 +499,31 @@ export interface RelayProofRequest {
|
|
|
499
499
|
requestId: string;
|
|
500
500
|
/** Deep link URL to open ZKProofport app (built by relay) */
|
|
501
501
|
deepLink: string;
|
|
502
|
-
/** Relay status: pending
|
|
502
|
+
/** Relay status at creation: always 'pending' */
|
|
503
503
|
status: string;
|
|
504
504
|
/** Relative poll URL for checking proof status (e.g., /api/v1/proof/{requestId}) */
|
|
505
505
|
pollUrl: string;
|
|
506
506
|
}
|
|
507
507
|
/**
|
|
508
|
-
*
|
|
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.
|
|
509
523
|
*/
|
|
510
524
|
export interface RelayProofResult {
|
|
511
525
|
requestId: string;
|
|
512
|
-
status:
|
|
526
|
+
status: RelayProofStatus;
|
|
513
527
|
deepLink?: string;
|
|
514
528
|
createdAt?: string;
|
|
515
529
|
updatedAt?: string;
|
|
@@ -519,6 +533,8 @@ export interface RelayProofResult {
|
|
|
519
533
|
verifierAddress?: string;
|
|
520
534
|
chainId?: number;
|
|
521
535
|
circuit?: string;
|
|
522
|
-
/**
|
|
536
|
+
/** Human-readable reason, present when status is 'error', 'failed' or 'expired' */
|
|
523
537
|
error?: string;
|
|
538
|
+
/** The app's error code (`E` + four digits, e.g. `E2007`), present on some 'error' results */
|
|
539
|
+
errorCode?: string;
|
|
524
540
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkproofport-app/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
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",
|