@zkproofport-app/sdk 0.4.1 → 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.
- package/README.md +31 -25
- package/dist/ProofportSDK.d.ts +4 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +20 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -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
package/dist/index.mjs
CHANGED
|
@@ -4916,6 +4916,17 @@ async function verifyProofOffChain(circuit, proof, publicInputs, options = {}) {
|
|
|
4916
4916
|
}
|
|
4917
4917
|
}
|
|
4918
4918
|
|
|
4919
|
+
/**
|
|
4920
|
+
* The statuses a relay request ends in, as a runtime list. `satisfies` keeps it
|
|
4921
|
+
* in step with the `RelayTerminalStatus` type in both directions: a status
|
|
4922
|
+
* added to the type and not here, or here and not in the type, fails to compile.
|
|
4923
|
+
*/
|
|
4924
|
+
const RELAY_TERMINAL_STATUSES = ['completed', 'error', 'failed', 'cancelled', 'expired'];
|
|
4925
|
+
/** True when `status` is one a relay request ends in. */
|
|
4926
|
+
function isTerminalRelayStatus(status) {
|
|
4927
|
+
return RELAY_TERMINAL_STATUSES.includes(status);
|
|
4928
|
+
}
|
|
4929
|
+
|
|
4919
4930
|
/**
|
|
4920
4931
|
* Proofport SDK - Main class
|
|
4921
4932
|
*/
|
|
@@ -6041,7 +6052,9 @@ class ProofportSDK {
|
|
|
6041
6052
|
return await response.json();
|
|
6042
6053
|
}
|
|
6043
6054
|
/**
|
|
6044
|
-
* Polls the relay until
|
|
6055
|
+
* Polls the relay until the request reaches a terminal status
|
|
6056
|
+
* (`completed`, `error`, `failed`, `cancelled` or `expired`), with
|
|
6057
|
+
* configurable interval and timeout. Branch on `result.status`.
|
|
6045
6058
|
*
|
|
6046
6059
|
* @param requestId - The relay-issued request ID
|
|
6047
6060
|
* @param options - Polling options
|
|
@@ -6062,7 +6075,10 @@ class ProofportSDK {
|
|
|
6062
6075
|
lastStatus = result.status;
|
|
6063
6076
|
options.onStatusChange?.(result);
|
|
6064
6077
|
}
|
|
6065
|
-
|
|
6078
|
+
// Every terminal status ends the wait, not only success: an app error,
|
|
6079
|
+
// a cancellation and a relay-side timeout are answers too, and polling
|
|
6080
|
+
// past them would only end in this method's own timeout.
|
|
6081
|
+
if (isTerminalRelayStatus(result.status)) {
|
|
6066
6082
|
return result;
|
|
6067
6083
|
}
|
|
6068
6084
|
await new Promise(resolve => setTimeout(resolve, interval));
|
|
@@ -6080,7 +6096,7 @@ class ProofportSDK {
|
|
|
6080
6096
|
* @param requestId - The relay-issued request ID to subscribe to
|
|
6081
6097
|
* @param callbacks - Event callbacks for status changes and results
|
|
6082
6098
|
* @param callbacks.onStatus - Called on status updates (pending, generating)
|
|
6083
|
-
* @param callbacks.onResult - Called
|
|
6099
|
+
* @param callbacks.onResult - Called once with the terminal result: completed, error, failed, cancelled or expired
|
|
6084
6100
|
* @param callbacks.onError - Called on errors
|
|
6085
6101
|
* @returns Unsubscribe function to clean up the connection
|
|
6086
6102
|
* @throws Error if relayUrl not set or socket.io-client not installed
|
|
@@ -6287,5 +6303,5 @@ class ProofportSDK {
|
|
|
6287
6303
|
}
|
|
6288
6304
|
}
|
|
6289
6305
|
|
|
6290
|
-
export { ALL_CIRCUIT_IDS, CIRCUIT_ACTION_BINDING, CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS, CIRCUIT_VK_PATHS, COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT, COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT, EXPERIMENTAL_CIRCUIT_IDS, MDL_KR_PUBLIC_INPUT_LAYOUT, OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT, PLANNED_CIRCUIT_IDS, ProofportSDK, SUPPORTED_CIRCUIT_IDS, circuitActionBinding, ProofportSDK as default, extractDomainFromPublicInputs, extractNullifierFromPublicInputs, extractScopeFromPublicInputs, getCircuitSupportStatus, isCircuitId, isSupportedCircuitId, parseTypedAction, validateTypedAction, verifyProofOffChain };
|
|
6306
|
+
export { ALL_CIRCUIT_IDS, CIRCUIT_ACTION_BINDING, CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS, CIRCUIT_VK_PATHS, COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT, COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT, EXPERIMENTAL_CIRCUIT_IDS, MDL_KR_PUBLIC_INPUT_LAYOUT, OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT, PLANNED_CIRCUIT_IDS, ProofportSDK, RELAY_TERMINAL_STATUSES, SUPPORTED_CIRCUIT_IDS, circuitActionBinding, ProofportSDK as default, extractDomainFromPublicInputs, extractNullifierFromPublicInputs, extractScopeFromPublicInputs, getCircuitSupportStatus, isCircuitId, isSupportedCircuitId, isTerminalRelayStatus, parseTypedAction, validateTypedAction, verifyProofOffChain };
|
|
6291
6307
|
//# sourceMappingURL=index.mjs.map
|