@openzeppelin/miden-multisig-client 0.15.2 → 0.16.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 +37 -1
- package/dist/account/builder.d.ts +2 -1
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +1 -0
- package/dist/account/builder.js.map +1 -1
- package/dist/account/builder.test.js +2 -2
- package/dist/account/builder.test.js.map +1 -1
- package/dist/client.d.ts +17 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -7
- package/dist/client.js.map +1 -1
- package/dist/client.test.js +46 -15
- package/dist/client.test.js.map +1 -1
- package/dist/connectivity.d.ts +38 -0
- package/dist/connectivity.d.ts.map +1 -0
- package/dist/connectivity.js +97 -0
- package/dist/connectivity.js.map +1 -0
- package/dist/connectivity.test.d.ts +2 -0
- package/dist/connectivity.test.d.ts.map +1 -0
- package/dist/connectivity.test.js +61 -0
- package/dist/connectivity.test.js.map +1 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/multisig.d.ts +130 -8
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +220 -24
- package/dist/multisig.js.map +1 -1
- package/dist/multisig.test.js +427 -89
- package/dist/multisig.test.js.map +1 -1
- package/dist/proposal/factory.d.ts.map +1 -1
- package/dist/proposal/factory.js +10 -0
- package/dist/proposal/factory.js.map +1 -1
- package/dist/proposal/factory.test.d.ts +2 -0
- package/dist/proposal/factory.test.d.ts.map +1 -0
- package/dist/proposal/factory.test.js +32 -0
- package/dist/proposal/factory.test.js.map +1 -0
- package/dist/proposal/metadata.d.ts.map +1 -1
- package/dist/proposal/metadata.js +12 -0
- package/dist/proposal/metadata.js.map +1 -1
- package/dist/proposal/metadata.test.js +49 -0
- package/dist/proposal/metadata.test.js.map +1 -1
- package/dist/prover/config.d.ts +16 -0
- package/dist/prover/config.d.ts.map +1 -0
- package/dist/prover/config.js +54 -0
- package/dist/prover/config.js.map +1 -0
- package/dist/prover/config.test.d.ts +2 -0
- package/dist/prover/config.test.d.ts.map +1 -0
- package/dist/prover/config.test.js +54 -0
- package/dist/prover/config.test.js.map +1 -0
- package/dist/prover/errors.d.ts +2 -0
- package/dist/prover/errors.d.ts.map +1 -0
- package/dist/prover/errors.js +158 -0
- package/dist/prover/errors.js.map +1 -0
- package/dist/prover/errors.test.d.ts +2 -0
- package/dist/prover/errors.test.d.ts.map +1 -0
- package/dist/prover/errors.test.js +24 -0
- package/dist/prover/errors.test.js.map +1 -0
- package/dist/prover/retry.d.ts +10 -0
- package/dist/prover/retry.d.ts.map +1 -0
- package/dist/prover/retry.js +32 -0
- package/dist/prover/retry.js.map +1 -0
- package/dist/prover/retry.test.d.ts +2 -0
- package/dist/prover/retry.test.d.ts.map +1 -0
- package/dist/prover/retry.test.js +20 -0
- package/dist/prover/retry.test.js.map +1 -0
- package/dist/prover/workflow.d.ts +11 -0
- package/dist/prover/workflow.d.ts.map +1 -0
- package/dist/prover/workflow.js +18 -0
- package/dist/prover/workflow.js.map +1 -0
- package/dist/prover/workflow.test.d.ts +2 -0
- package/dist/prover/workflow.test.d.ts.map +1 -0
- package/dist/prover/workflow.test.js +80 -0
- package/dist/prover/workflow.test.js.map +1 -0
- package/dist/raw-client.d.ts +2 -2
- package/dist/raw-client.d.ts.map +1 -1
- package/dist/raw-client.js +14 -4
- package/dist/raw-client.js.map +1 -1
- package/dist/raw-client.test.js +25 -3
- package/dist/raw-client.test.js.map +1 -1
- package/dist/transaction/consumeNotes.d.ts +6 -2
- package/dist/transaction/consumeNotes.d.ts.map +1 -1
- package/dist/transaction/consumeNotes.js +0 -4
- package/dist/transaction/consumeNotes.js.map +1 -1
- package/dist/transaction/options.d.ts +3 -0
- package/dist/transaction/options.d.ts.map +1 -1
- package/dist/transaction/p2id.d.ts +27 -2
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +56 -4
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/p2id.test.js +66 -6
- package/dist/transaction/p2id.test.js.map +1 -1
- package/dist/transaction/summary.d.ts +2 -1
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/updateGuardian.d.ts +6 -2
- package/dist/transaction/updateGuardian.d.ts.map +1 -1
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.d.ts +7 -2
- package/dist/transaction/updateProcedureThreshold.d.ts.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.d.ts +7 -2
- package/dist/transaction/updateSigners.d.ts.map +1 -1
- package/dist/transaction/updateSigners.js.map +1 -1
- package/dist/transaction.d.ts +1 -1
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +1 -1
- package/dist/transaction.js.map +1 -1
- package/dist/types/proposal.d.ts +5 -0
- package/dist/types/proposal.d.ts.map +1 -1
- package/dist/types/proposal.js +3 -0
- package/dist/types/proposal.js.map +1 -1
- package/package.json +3 -3
- package/src/account/builder.test.ts +19 -11
- package/src/account/builder.ts +2 -1
- package/src/client.test.ts +67 -15
- package/src/client.ts +35 -12
- package/src/connectivity.test.ts +67 -0
- package/src/connectivity.ts +111 -0
- package/src/index.ts +25 -1
- package/src/multisig.test.ts +526 -94
- package/src/multisig.ts +270 -25
- package/src/proposal/factory.test.ts +40 -0
- package/src/proposal/factory.ts +11 -1
- package/src/proposal/metadata.test.ts +60 -0
- package/src/proposal/metadata.ts +14 -0
- package/src/prover/config.test.ts +90 -0
- package/src/prover/config.ts +78 -0
- package/src/prover/errors.test.ts +53 -0
- package/src/prover/errors.ts +178 -0
- package/src/prover/retry.test.ts +38 -0
- package/src/prover/retry.ts +46 -0
- package/src/prover/test-node.d.ts +6 -0
- package/src/prover/workflow.test.ts +109 -0
- package/src/prover/workflow.ts +19 -0
- package/src/raw-client.test.ts +41 -3
- package/src/raw-client.ts +15 -5
- package/src/transaction/consumeNotes.ts +11 -1
- package/src/transaction/options.ts +4 -0
- package/src/transaction/p2id.test.ts +98 -8
- package/src/transaction/p2id.ts +91 -12
- package/src/transaction/summary.ts +12 -0
- package/src/transaction/updateGuardian.ts +11 -1
- package/src/transaction/updateProcedureThreshold.ts +13 -1
- package/src/transaction/updateSigners.ts +13 -1
- package/src/transaction.ts +4 -0
- package/src/types/proposal.ts +9 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification for codeless transport failures (feature
|
|
3
|
+
* `009-human-readable-errors`, User Story 3).
|
|
4
|
+
*
|
|
5
|
+
* When Guardian *is* reached, errors arrive as a {@link GuardianHttpError}
|
|
6
|
+
* carrying the server's stable `code` and user-safe `message` — use those.
|
|
7
|
+
* When Guardian is *not* reached (connection refused, DNS, timeout, TLS, or a
|
|
8
|
+
* proxy 5xx with no Guardian body) no error object exists, so the wallet-facing
|
|
9
|
+
* client must classify the failure and supply a friendly connectivity message
|
|
10
|
+
* rather than surfacing raw `"Failed to fetch"` / `"NetworkError"` text.
|
|
11
|
+
*
|
|
12
|
+
* The detection is intentionally string-matching, mirroring the 0xMiden/wallet
|
|
13
|
+
* `connectivity-classify.ts` heuristic: fetch / DOMException / TypeError each
|
|
14
|
+
* surface failures with different shapes, so the message string is the only
|
|
15
|
+
* stable join key.
|
|
16
|
+
*/
|
|
17
|
+
import { GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
18
|
+
const CONNECTIVITY_MESSAGE = "Can't reach Guardian right now. Check your connection and try again.";
|
|
19
|
+
const GENERIC_MESSAGE = 'Something went wrong. Please try again.';
|
|
20
|
+
/**
|
|
21
|
+
* `navigator.onLine` is unreliable as a positive signal, but a `false` means
|
|
22
|
+
* the browser/OS is certain there is no connectivity — categorize as
|
|
23
|
+
* `network` rather than `unreachable` (mirrors the wallet's
|
|
24
|
+
* `isDefinitelyOffline`). Guarded for non-browser (Node) contexts.
|
|
25
|
+
*/
|
|
26
|
+
function isDefinitelyOffline() {
|
|
27
|
+
if (typeof navigator === 'undefined')
|
|
28
|
+
return false;
|
|
29
|
+
if (typeof navigator.onLine !== 'boolean')
|
|
30
|
+
return false;
|
|
31
|
+
return navigator.onLine === false;
|
|
32
|
+
}
|
|
33
|
+
/** Classify a codeless transport failure into a {@link ConnectivityCategory}. */
|
|
34
|
+
function classifyTransportError(err) {
|
|
35
|
+
if (isDefinitelyOffline())
|
|
36
|
+
return 'network';
|
|
37
|
+
const message = err?.message ?? String(err ?? '');
|
|
38
|
+
const lower = message.toLowerCase();
|
|
39
|
+
if (lower.includes('timeout') || lower.includes('timed out') || lower.includes('abort')) {
|
|
40
|
+
return 'timeout';
|
|
41
|
+
}
|
|
42
|
+
return 'unreachable';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Does this error look like a codeless transport/connectivity failure (vs a
|
|
46
|
+
* semantic Guardian error)? String heuristic — see module docs.
|
|
47
|
+
*/
|
|
48
|
+
export function isLikelyNetworkError(err) {
|
|
49
|
+
const message = err?.message ?? String(err ?? '');
|
|
50
|
+
const lower = message.toLowerCase();
|
|
51
|
+
if (lower.includes('failed to fetch'))
|
|
52
|
+
return true;
|
|
53
|
+
if (lower.includes('networkerror'))
|
|
54
|
+
return true;
|
|
55
|
+
if (lower.includes('network error'))
|
|
56
|
+
return true;
|
|
57
|
+
if (lower.includes('load failed'))
|
|
58
|
+
return true;
|
|
59
|
+
if (lower.includes('abort'))
|
|
60
|
+
return true;
|
|
61
|
+
if (lower.includes('timeout') || lower.includes('timed out'))
|
|
62
|
+
return true;
|
|
63
|
+
if (lower.includes('connection'))
|
|
64
|
+
return true;
|
|
65
|
+
if (lower.includes('econnrefused') || lower.includes('enotfound'))
|
|
66
|
+
return true;
|
|
67
|
+
if (lower.includes('dns'))
|
|
68
|
+
return true;
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Normalize any error thrown by a Guardian call into a user-facing shape.
|
|
73
|
+
*
|
|
74
|
+
* - A {@link GuardianHttpError} with a parsed `{ code, message }` → the
|
|
75
|
+
* server's stable code + user-safe message (feature 009).
|
|
76
|
+
* - A reachable host that returned no Guardian error object (e.g. a proxy 5xx
|
|
77
|
+
* with an HTML body) → treated as a connectivity failure.
|
|
78
|
+
* - A codeless transport rejection (server never reached) → classified and
|
|
79
|
+
* given the generic connectivity message; the raw transport text is never
|
|
80
|
+
* surfaced as the primary message.
|
|
81
|
+
*/
|
|
82
|
+
export function toUserFacingError(err) {
|
|
83
|
+
if (err instanceof GuardianHttpError) {
|
|
84
|
+
if (err.code && err.userMessage) {
|
|
85
|
+
return { code: err.code, userMessage: err.userMessage, cause: err };
|
|
86
|
+
}
|
|
87
|
+
if (err.status >= 500) {
|
|
88
|
+
return { category: 'unreachable', userMessage: CONNECTIVITY_MESSAGE, cause: err };
|
|
89
|
+
}
|
|
90
|
+
return { userMessage: GENERIC_MESSAGE, cause: err };
|
|
91
|
+
}
|
|
92
|
+
if (isLikelyNetworkError(err)) {
|
|
93
|
+
return { category: classifyTransportError(err), userMessage: CONNECTIVITY_MESSAGE, cause: err };
|
|
94
|
+
}
|
|
95
|
+
return { userMessage: GENERIC_MESSAGE, cause: err };
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=connectivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectivity.js","sourceRoot":"","sources":["../src/connectivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAYlE,MAAM,oBAAoB,GAAG,sEAAsE,CAAC;AACpG,MAAM,eAAe,GAAG,yCAAyC,CAAC;AAElE;;;;;GAKG;AACH,SAAS,mBAAmB;IAC1B,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS;QAA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|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
3
|
+
import { isLikelyNetworkError, toUserFacingError } from './connectivity.js';
|
|
4
|
+
describe('isLikelyNetworkError', () => {
|
|
5
|
+
it('flags codeless transport failures', () => {
|
|
6
|
+
for (const m of [
|
|
7
|
+
'Failed to fetch',
|
|
8
|
+
'NetworkError when attempting to fetch resource',
|
|
9
|
+
'Load failed',
|
|
10
|
+
'The operation was aborted',
|
|
11
|
+
'request timed out',
|
|
12
|
+
'connection refused',
|
|
13
|
+
'getaddrinfo ENOTFOUND guardian.example',
|
|
14
|
+
]) {
|
|
15
|
+
expect(isLikelyNetworkError(new TypeError(m))).toBe(true);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
it('does not flag semantic errors', () => {
|
|
19
|
+
expect(isLikelyNetworkError(new Error('account is paused'))).toBe(false);
|
|
20
|
+
expect(isLikelyNetworkError(new Error('insufficient signatures'))).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('toUserFacingError', () => {
|
|
24
|
+
it('uses the server code + user-safe message when Guardian was reached', () => {
|
|
25
|
+
const body = JSON.stringify({
|
|
26
|
+
code: 'account_paused',
|
|
27
|
+
message: "This account is paused and can't approve transactions right now.",
|
|
28
|
+
meta: { retryable: false },
|
|
29
|
+
});
|
|
30
|
+
const result = toUserFacingError(new GuardianHttpError(409, 'Conflict', body));
|
|
31
|
+
expect(result.code).toBe('account_paused');
|
|
32
|
+
expect(result.userMessage).toContain('paused');
|
|
33
|
+
expect(result.category).toBeUndefined();
|
|
34
|
+
});
|
|
35
|
+
it('classifies a codeless transport failure as connectivity', () => {
|
|
36
|
+
const result = toUserFacingError(new TypeError('Failed to fetch'));
|
|
37
|
+
expect(result.code).toBeUndefined();
|
|
38
|
+
expect(result.category).toBe('unreachable');
|
|
39
|
+
expect(result.userMessage).toContain("Can't reach Guardian");
|
|
40
|
+
// The raw transport text is never the primary message.
|
|
41
|
+
expect(result.userMessage).not.toContain('Failed to fetch');
|
|
42
|
+
});
|
|
43
|
+
it('classifies timeouts and aborts as the timeout category', () => {
|
|
44
|
+
for (const m of ['request timed out', 'The operation was aborted']) {
|
|
45
|
+
const result = toUserFacingError(new Error(m));
|
|
46
|
+
expect(result.category).toBe('timeout');
|
|
47
|
+
expect(result.userMessage).toContain("Can't reach Guardian");
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
it('treats a reachable proxy 5xx with no Guardian body as connectivity', () => {
|
|
51
|
+
const result = toUserFacingError(new GuardianHttpError(502, 'Bad Gateway', '<html>nope</html>'));
|
|
52
|
+
expect(result.category).toBe('unreachable');
|
|
53
|
+
expect(result.userMessage).toContain("Can't reach Guardian");
|
|
54
|
+
});
|
|
55
|
+
it('falls back to a generic message for unknown non-Guardian errors', () => {
|
|
56
|
+
const result = toUserFacingError(new Error('totally unexpected'));
|
|
57
|
+
expect(result.userMessage).toBe('Something went wrong. Please try again.');
|
|
58
|
+
expect(result.userMessage).not.toContain('totally unexpected');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=connectivity.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectivity.test.js","sourceRoot":"","sources":["../src/connectivity.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,KAAK,MAAM,CAAC,IAAI;YACd,iBAAiB;YACjB,gDAAgD;YAChD,aAAa;YACb,2BAA2B;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AAI,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAClE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QAC3E,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,10 +20,15 @@
|
|
|
20
20
|
* // Create a signer
|
|
21
21
|
* const signer = new FalconSigner(secretKey);
|
|
22
22
|
*
|
|
23
|
-
* // Create multisig client
|
|
23
|
+
* // Create multisig client. Both endpoints are required; midenRpcEndpoint
|
|
24
|
+
* // must point at the same network as the injected MidenClient.
|
|
24
25
|
* const client = new MultisigClient(midenClient, {
|
|
25
26
|
* guardianEndpoint: 'http://localhost:3000',
|
|
26
27
|
* midenRpcEndpoint: 'https://rpc.devnet.miden.io',
|
|
28
|
+
* prover: {
|
|
29
|
+
* url: 'https://prover.example',
|
|
30
|
+
* retry: { maxAttempts: 4 },
|
|
31
|
+
* },
|
|
27
32
|
* });
|
|
28
33
|
*
|
|
29
34
|
* // Get GUARDIAN pubkey for config
|
|
@@ -39,17 +44,23 @@
|
|
|
39
44
|
* ```
|
|
40
45
|
*/
|
|
41
46
|
export { MultisigClient, type MultisigClientConfig, type RecoveredAccount, } from './client.js';
|
|
47
|
+
export type { ProverConfig, ProverRetryPolicy } from './prover/config.js';
|
|
42
48
|
export { lookupAuthDigest } from './lookupAuth.js';
|
|
43
49
|
export { Multisig, type AccountState } from './multisig.js';
|
|
44
50
|
export { AccountInspector, type DetectedMultisigConfig, type VaultBalance } from './inspector.js';
|
|
45
|
-
export { executeForSummary, buildUpdateSignersTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateGuardianTransactionRequest, buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, } from './transaction.js';
|
|
51
|
+
export { executeForSummary, buildUpdateSignersTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateGuardianTransactionRequest, buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, parseP2idNoteType, p2idNoteTypeToMetadata, type P2idTransactionOptions, } from './transaction.js';
|
|
46
52
|
export { GuardianHttpClient, GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
53
|
+
export type { GuardianErrorMeta } from '@openzeppelin/guardian-client';
|
|
54
|
+
export { GUARDIAN_ERROR_CODES, isGuardianErrorCode, normalizeGuardianErrorCode, } from '@openzeppelin/guardian-client';
|
|
55
|
+
export type { GuardianErrorCode } from '@openzeppelin/guardian-client';
|
|
56
|
+
export { isLikelyNetworkError, toUserFacingError } from './connectivity.js';
|
|
57
|
+
export type { ConnectivityCategory, UserFacingError } from './connectivity.js';
|
|
47
58
|
export { FalconSigner, EcdsaSigner, ParaSigner, MidenWalletSigner, type ParaSigningContext, type WalletSigningContext, } from './signer.js';
|
|
48
59
|
export { PublicKeyFormat } from './utils/key.js';
|
|
49
60
|
export { EcdsaFormat } from './utils/ecdsa.js';
|
|
50
61
|
export { tryComputeEcdsaCommitmentHex } from './utils/signature.js';
|
|
51
62
|
export { createMultisigAccount, validateMultisigConfig, buildMultisigStorageSlots, buildGuardianStorageSlots, storageLayoutBuilder, StorageLayoutBuilder, } from './account/index.js';
|
|
52
|
-
export { CONSUME_NOTES_METADATA_VERSION_V2, MAX_CONSUME_NOTES_METADATA_BYTES, isConsumeNotesV1, isConsumeNotesV2, } from './types/proposal.js';
|
|
63
|
+
export { CONSUME_NOTES_METADATA_VERSION_V2, MAX_CONSUME_NOTES_METADATA_BYTES, isConsumeNotesV1, isConsumeNotesV2, isP2idNoteVisibility, type P2idNoteVisibility, } from './types/proposal.js';
|
|
53
64
|
export { LEGACY_CONSUME_NOTES_ENABLED, } from './multisig/config.js';
|
|
54
65
|
export { type ConsumeNotesErrorCode, NoteBindingMismatchError, UnsupportedMetadataVersionError, ConsumeNotesMetadataOversizeError, LegacyConsumeNotesNoteMissingError, } from './multisig/consumeNotesErrors.js';
|
|
55
66
|
export { noteToBase64, noteFromBase64, } from './utils/encoding.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EACL,iBAAiB,EACjB,oCAAoC,EACpC,+CAA+C,EAC/C,qCAAqC,EACrC,mCAAmC,EACnC,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC5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,EAGf,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EAGjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,10 +20,15 @@
|
|
|
20
20
|
* // Create a signer
|
|
21
21
|
* const signer = new FalconSigner(secretKey);
|
|
22
22
|
*
|
|
23
|
-
* // Create multisig client
|
|
23
|
+
* // Create multisig client. Both endpoints are required; midenRpcEndpoint
|
|
24
|
+
* // must point at the same network as the injected MidenClient.
|
|
24
25
|
* const client = new MultisigClient(midenClient, {
|
|
25
26
|
* guardianEndpoint: 'http://localhost:3000',
|
|
26
27
|
* midenRpcEndpoint: 'https://rpc.devnet.miden.io',
|
|
28
|
+
* prover: {
|
|
29
|
+
* url: 'https://prover.example',
|
|
30
|
+
* retry: { maxAttempts: 4 },
|
|
31
|
+
* },
|
|
27
32
|
* });
|
|
28
33
|
*
|
|
29
34
|
* // Get GUARDIAN pubkey for config
|
|
@@ -42,14 +47,19 @@ export { MultisigClient, } from './client.js';
|
|
|
42
47
|
export { lookupAuthDigest } from './lookupAuth.js';
|
|
43
48
|
export { Multisig } from './multisig.js';
|
|
44
49
|
export { AccountInspector } from './inspector.js';
|
|
45
|
-
export { executeForSummary, buildUpdateSignersTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateGuardianTransactionRequest, buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, } from './transaction.js';
|
|
50
|
+
export { executeForSummary, buildUpdateSignersTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateGuardianTransactionRequest, buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, parseP2idNoteType, p2idNoteTypeToMetadata, } from './transaction.js';
|
|
46
51
|
export { GuardianHttpClient, GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
52
|
+
// Typed error-code vocabulary (issue #318): branch on GuardianErrorCode,
|
|
53
|
+
// never on message text; unknown wire codes surface via rawCode.
|
|
54
|
+
export { GUARDIAN_ERROR_CODES, isGuardianErrorCode, normalizeGuardianErrorCode, } from '@openzeppelin/guardian-client';
|
|
55
|
+
// Codeless transport-failure classification (feature 009, User Story 3).
|
|
56
|
+
export { isLikelyNetworkError, toUserFacingError } from './connectivity.js';
|
|
47
57
|
export { FalconSigner, EcdsaSigner, ParaSigner, MidenWalletSigner, } from './signer.js';
|
|
48
58
|
export { PublicKeyFormat } from './utils/key.js';
|
|
49
59
|
export { EcdsaFormat } from './utils/ecdsa.js';
|
|
50
60
|
export { tryComputeEcdsaCommitmentHex } from './utils/signature.js';
|
|
51
61
|
export { createMultisigAccount, validateMultisigConfig, buildMultisigStorageSlots, buildGuardianStorageSlots, storageLayoutBuilder, StorageLayoutBuilder, } from './account/index.js';
|
|
52
|
-
export { CONSUME_NOTES_METADATA_VERSION_V2, MAX_CONSUME_NOTES_METADATA_BYTES, isConsumeNotesV1, isConsumeNotesV2, } from './types/proposal.js';
|
|
62
|
+
export { CONSUME_NOTES_METADATA_VERSION_V2, MAX_CONSUME_NOTES_METADATA_BYTES, isConsumeNotesV1, isConsumeNotesV2, isP2idNoteVisibility, } from './types/proposal.js';
|
|
53
63
|
export { LEGACY_CONSUME_NOTES_ENABLED, } from './multisig/config.js';
|
|
54
64
|
export { NoteBindingMismatchError, UnsupportedMetadataVersionError, ConsumeNotesMetadataOversizeError, LegacyConsumeNotesNoteMissingError, } from './multisig/consumeNotesErrors.js';
|
|
55
65
|
export { noteToBase64, noteFromBase64, } from './utils/encoding.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAiC,EACjC,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAElB,MAAM,iBAAiB,CAAC"}
|
package/dist/multisig.d.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* This class wraps a Miden SDK Account and provides GUARDIAN integration
|
|
5
5
|
* for proposal management.
|
|
6
6
|
*/
|
|
7
|
-
import { GuardianHttpClient, type Signer } from '@openzeppelin/guardian-client';
|
|
7
|
+
import { GuardianHttpClient, type AbandonCandidateResponse, type AbandonStatus, type Signer } from '@openzeppelin/guardian-client';
|
|
8
8
|
import type { ConsumableNote, ExportedProposal, MultisigConfig, Proposal, ProposalMetadata, ProposalType } from './types.js';
|
|
9
9
|
import type { ProcedureName } from './procedures.js';
|
|
10
10
|
import type { MidenClient } from '@miden-sdk/miden-sdk';
|
|
11
|
-
import { Account, AdviceMap, TransactionRequest } from '@miden-sdk/miden-sdk';
|
|
11
|
+
import { Account, AdviceMap, NoteType, TransactionRequest } from '@miden-sdk/miden-sdk';
|
|
12
|
+
import { type ResolvedProverConfig } from './prover/config.js';
|
|
12
13
|
/**
|
|
13
14
|
* Result of fetching account state from GUARDIAN.
|
|
14
15
|
*/
|
|
@@ -38,11 +39,11 @@ export declare class Multisig {
|
|
|
38
39
|
private readonly signer;
|
|
39
40
|
private readonly midenClient;
|
|
40
41
|
private readonly rawClientPromise;
|
|
41
|
-
private readonly
|
|
42
|
+
private readonly proverWorkflow;
|
|
42
43
|
private readonly _accountId;
|
|
43
|
-
private readonly midenRpcEndpoint
|
|
44
|
+
private readonly midenRpcEndpoint;
|
|
44
45
|
private proposals;
|
|
45
|
-
constructor(account: Account, config: MultisigConfig, guardian: GuardianHttpClient, signer: Signer, midenClient: MidenClient, accountId
|
|
46
|
+
constructor(account: Account, config: MultisigConfig, guardian: GuardianHttpClient, signer: Signer, midenClient: MidenClient, accountId: string | undefined, midenRpcEndpoint: string, proverConfig?: ResolvedProverConfig);
|
|
46
47
|
private getMidenRpcEndpoint;
|
|
47
48
|
private getRawClient;
|
|
48
49
|
private proposalFactory;
|
|
@@ -51,6 +52,15 @@ export declare class Multisig {
|
|
|
51
52
|
get accountId(): string;
|
|
52
53
|
/** The signer's commitment */
|
|
53
54
|
get signerCommitment(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Resolve the account from the web client's store, falling back to the
|
|
57
|
+
* `account` snapshot when the store has no record.
|
|
58
|
+
*
|
|
59
|
+
* Transaction execution reads the store, and other flows (e.g. consume-notes
|
|
60
|
+
* finalize) update it without refreshing the snapshot, so vault lookups must
|
|
61
|
+
* source from the store to see the same state execution will.
|
|
62
|
+
*/
|
|
63
|
+
getStoreAccount(): Promise<Account>;
|
|
54
64
|
/**
|
|
55
65
|
* Maps a proposal type to the procedure that determines its threshold.
|
|
56
66
|
*/
|
|
@@ -79,11 +89,33 @@ export declare class Multisig {
|
|
|
79
89
|
* Sync account state from GUARDIAN into the local Miden client store.
|
|
80
90
|
*
|
|
81
91
|
* If the GUARDIAN commitment differs from the local commitment (or the account
|
|
82
|
-
* is missing locally)
|
|
92
|
+
* is missing locally) and the GUARDIAN state is safe to import, the local store
|
|
93
|
+
* is overwritten with the GUARDIAN state. When the GUARDIAN is merely *behind*
|
|
94
|
+
* local — e.g. the pushed execution delta has not been canonicalized yet
|
|
95
|
+
* (see OpenZeppelin/guardian#316) — the local state is already ahead and
|
|
96
|
+
* on-chain-verifiable, so it is kept as authoritative. Either way, config is
|
|
97
|
+
* refreshed from the resulting account so callers reading `Multisig.account`
|
|
98
|
+
* (e.g. the UI) observe the current state instead of a stale snapshot.
|
|
83
99
|
*/
|
|
84
100
|
syncState(): Promise<AccountState>;
|
|
85
101
|
verifyStateCommitment(): Promise<AccountStateVerificationResult>;
|
|
86
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Decide whether GUARDIAN-provided state may overwrite the local store.
|
|
104
|
+
*
|
|
105
|
+
* Returns `false` — rather than throwing — when the GUARDIAN state is simply
|
|
106
|
+
* *behind* local (lower nonce). That happens whenever the execution delta the
|
|
107
|
+
* client pushed has not been canonicalized by the GUARDIAN's background worker
|
|
108
|
+
* yet (see OpenZeppelin/guardian#316), or permanently if that candidate was
|
|
109
|
+
* discarded (#312 / #319). In that case the local account is already ahead and
|
|
110
|
+
* is independently verifiable against chain (`verifyStateCommitment`), so it is
|
|
111
|
+
* authoritative and must be kept, not clobbered; the caller keeps local and
|
|
112
|
+
* refreshes config from it.
|
|
113
|
+
*
|
|
114
|
+
* Still throws for genuine divergence: an incoming state at the *same* nonce as
|
|
115
|
+
* local but a different commitment, or an incoming state whose commitment does
|
|
116
|
+
* not match the on-chain commitment.
|
|
117
|
+
*/
|
|
118
|
+
private isSafeToOverwriteLocalState;
|
|
87
119
|
private getOnChainCommitment;
|
|
88
120
|
private refreshConfigFromAccount;
|
|
89
121
|
/**
|
|
@@ -157,8 +189,12 @@ export declare class Multisig {
|
|
|
157
189
|
* @param faucetId - Faucet/token account ID (hex string)
|
|
158
190
|
* @param amount - Amount to send
|
|
159
191
|
* @param nonce - Optional proposal nonce (defaults to Date.now())
|
|
192
|
+
* @param options - Optional settings; `noteType` selects the created note's
|
|
193
|
+
* visibility (defaults to `NoteType.Public`, issue #322)
|
|
160
194
|
*/
|
|
161
|
-
createP2idProposal(recipientId: string, faucetId: string, amount: bigint, nonce?: number
|
|
195
|
+
createP2idProposal(recipientId: string, faucetId: string, amount: bigint, nonce?: number, options?: {
|
|
196
|
+
noteType?: NoteType;
|
|
197
|
+
}): Promise<Proposal>;
|
|
162
198
|
/**
|
|
163
199
|
* Get notes that can be consumed by this multisig account.
|
|
164
200
|
*
|
|
@@ -166,6 +202,66 @@ export declare class Multisig {
|
|
|
166
202
|
* immediately by the multisig account.
|
|
167
203
|
*/
|
|
168
204
|
getConsumableNotes(): Promise<ConsumableNote[]>;
|
|
205
|
+
/**
|
|
206
|
+
* Export a note created by this multisig account as serialized note-file
|
|
207
|
+
* bytes for out-of-band delivery (issue #356).
|
|
208
|
+
*
|
|
209
|
+
* A private note publishes only its commitment on chain, so the recipient
|
|
210
|
+
* can never learn its contents via sync; the sender must hand them the
|
|
211
|
+
* bytes produced here, which they load with {@link importNoteFromBytes}.
|
|
212
|
+
*
|
|
213
|
+
* The note must be an output note of this client (created by a transaction
|
|
214
|
+
* this client executed). When the note's on-chain inclusion proof is
|
|
215
|
+
* already known (after a post-commit sync) the full note with proof is
|
|
216
|
+
* exported; otherwise the note details are exported and the importer's
|
|
217
|
+
* client tracks the note until it commits on chain.
|
|
218
|
+
*
|
|
219
|
+
* @param noteId - ID of the note to export (hex string)
|
|
220
|
+
* @returns Serialized note file bytes
|
|
221
|
+
*/
|
|
222
|
+
exportNoteToBytes(noteId: string): Promise<Uint8Array>;
|
|
223
|
+
/**
|
|
224
|
+
* Export a note created by this multisig account as a note file downloaded
|
|
225
|
+
* by the browser (issue #356). Browser-only convenience over
|
|
226
|
+
* {@link exportNoteToBytes}; use that method directly in non-DOM
|
|
227
|
+
* environments.
|
|
228
|
+
*
|
|
229
|
+
* @param noteId - ID of the note to export (hex string)
|
|
230
|
+
* @param filename - Download filename; defaults to `note_<id>.mno`
|
|
231
|
+
*/
|
|
232
|
+
exportNoteToFile(noteId: string, filename?: string): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Import a note file received out-of-band (issue #356) so the note can be
|
|
235
|
+
* consumed by this multisig account.
|
|
236
|
+
*
|
|
237
|
+
* Sync the Miden client with the network afterwards so the note's on-chain
|
|
238
|
+
* commitment is tracked and the note shows up in {@link getConsumableNotes};
|
|
239
|
+
* it can then be consumed via {@link createConsumeNotesProposal}.
|
|
240
|
+
*
|
|
241
|
+
* @param noteBytes - Serialized note file bytes produced by
|
|
242
|
+
* {@link exportNoteToBytes}
|
|
243
|
+
* @returns The note ID when the file carries one, or the note's details
|
|
244
|
+
* commitment for a details-only file
|
|
245
|
+
*/
|
|
246
|
+
importNoteFromBytes(noteBytes: Uint8Array): Promise<string>;
|
|
247
|
+
/**
|
|
248
|
+
* Import a note file received out-of-band (issue #356) from a browser
|
|
249
|
+
* `File`/`Blob` (e.g. a file-input selection). See
|
|
250
|
+
* {@link importNoteFromBytes} for the returned identifier semantics.
|
|
251
|
+
*/
|
|
252
|
+
importNoteFromFile(file: Blob): Promise<string>;
|
|
253
|
+
/**
|
|
254
|
+
* Compute the ID of the note a P2ID proposal will create when executed.
|
|
255
|
+
*
|
|
256
|
+
* The P2ID note is rebuilt deterministically from the proposal salt, so the
|
|
257
|
+
* ID is known ahead of execution. For a private P2ID this is the ID to pass
|
|
258
|
+
* to {@link exportNoteToBytes} after executing, so the note file can be delivered
|
|
259
|
+
* to the recipient out-of-band (issue #356).
|
|
260
|
+
*
|
|
261
|
+
* Call this before executing the proposal: the asset is derived from the
|
|
262
|
+
* current vault state, which execution itself changes.
|
|
263
|
+
*/
|
|
264
|
+
getP2idNoteId(proposal: Proposal): Promise<string>;
|
|
169
265
|
/**
|
|
170
266
|
* Sign a proposal.
|
|
171
267
|
*
|
|
@@ -174,6 +270,32 @@ export declare class Multisig {
|
|
|
174
270
|
*
|
|
175
271
|
* @param proposalId - The proposal commitment/ID (this is also what gets signed)
|
|
176
272
|
*/
|
|
273
|
+
/**
|
|
274
|
+
* Request abandonment of a pending canonicalization candidate whose
|
|
275
|
+
* transaction will never land on-chain (issue #319) — e.g. after an
|
|
276
|
+
* approved transaction died client-side (RPC submit failure, prover
|
|
277
|
+
* timeout, crash).
|
|
278
|
+
*
|
|
279
|
+
* Records an abandon *intent* on GUARDIAN: the account stays locked
|
|
280
|
+
* until the guardian's canonicalization worker confirms over a short
|
|
281
|
+
* quarantine (typically well under a minute) that the transaction did
|
|
282
|
+
* not land, then releases the account. Poll {@link abandonStatus} for
|
|
283
|
+
* the resolution.
|
|
284
|
+
*
|
|
285
|
+
* `nonce` pins the exact candidate to release; it is the nonce the
|
|
286
|
+
* proposal was pushed with. Retries are idempotent and preserve the
|
|
287
|
+
* original request timestamp. Refused with `GUARDIAN_CANDIDATE_LANDED`
|
|
288
|
+
* (409) when the transaction actually landed.
|
|
289
|
+
*/
|
|
290
|
+
abandonCandidate(nonce: number): Promise<AbandonCandidateResponse>;
|
|
291
|
+
/**
|
|
292
|
+
* Poll the resolution of an abandon request made with
|
|
293
|
+
* {@link abandonCandidate}: `'waiting'` while the quarantine runs,
|
|
294
|
+
* `'landed'` if the transaction landed after all, `'abandoned'` once
|
|
295
|
+
* the account is released, `'unexpected'` for any state no abandon
|
|
296
|
+
* flow produces.
|
|
297
|
+
*/
|
|
298
|
+
abandonStatus(nonce: number): Promise<AbandonStatus>;
|
|
177
299
|
signProposal(proposalId: string): Promise<Proposal>;
|
|
178
300
|
private getProposalForSigning;
|
|
179
301
|
createTransactionProposalRequest(proposalId: string): Promise<TransactionRequest>;
|
package/dist/multisig.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multisig.d.ts","sourceRoot":"","sources":["../src/multisig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAA4C,KAAK,MAAM,EAAqC,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"multisig.d.ts","sourceRoot":"","sources":["../src/multisig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,wBAAwB,EAAE,KAAK,aAAa,EAA4C,KAAK,MAAM,EAAqC,MAAM,+BAA+B,CAAC;AAChN,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EAEd,QAAQ,EACR,gBAAgB,EAEhB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,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