@openzeppelin/miden-multisig-client 0.17.0-rc.2 → 0.17.0
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 +172 -47
- package/dist/account/builder.d.ts +2 -2
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +49 -24
- package/dist/account/builder.js.map +1 -1
- package/dist/connectivity.d.ts +2 -0
- package/dist/connectivity.d.ts.map +1 -1
- package/dist/connectivity.js +7 -4
- package/dist/connectivity.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/multisig/authArgErrors.d.ts +59 -0
- package/dist/multisig/authArgErrors.d.ts.map +1 -0
- package/dist/multisig/authArgErrors.js +115 -0
- package/dist/multisig/authArgErrors.js.map +1 -0
- package/dist/multisig/helpers.d.ts +5 -0
- package/dist/multisig/helpers.d.ts.map +1 -1
- package/dist/multisig/helpers.js +7 -2
- package/dist/multisig/helpers.js.map +1 -1
- package/dist/multisig.d.ts +140 -0
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +419 -12
- package/dist/multisig.js.map +1 -1
- package/dist/procedures.d.ts +1 -1
- package/dist/procedures.js +1 -1
- package/dist/recovery/proposalNoteImport.d.ts +173 -0
- package/dist/recovery/proposalNoteImport.d.ts.map +1 -0
- package/dist/recovery/proposalNoteImport.js +411 -0
- package/dist/recovery/proposalNoteImport.js.map +1 -0
- package/dist/recovery/publicNoteBackfill.d.ts +168 -0
- package/dist/recovery/publicNoteBackfill.d.ts.map +1 -0
- package/dist/recovery/publicNoteBackfill.js +368 -0
- package/dist/recovery/publicNoteBackfill.js.map +1 -0
- package/dist/recovery/recoverNotes.d.ts +147 -0
- package/dist/recovery/recoverNotes.d.ts.map +1 -0
- package/dist/recovery/recoverNotes.js +163 -0
- package/dist/recovery/recoverNotes.js.map +1 -0
- package/dist/recovery/transportDrain.d.ts +124 -0
- package/dist/recovery/transportDrain.d.ts.map +1 -0
- package/dist/recovery/transportDrain.js +262 -0
- package/dist/recovery/transportDrain.js.map +1 -0
- package/dist/transaction/consumeNotes.d.ts.map +1 -1
- package/dist/transaction/consumeNotes.js +4 -1
- package/dist/transaction/consumeNotes.js.map +1 -1
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +4 -1
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/summary.d.ts +10 -4
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js +13 -7
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/updateGuardian.js +4 -1
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js +4 -1
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.js +4 -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/package.json +14 -10
- package/src/account/builder.ts +87 -35
- package/src/connectivity.ts +9 -4
- package/src/index.ts +34 -1
- package/src/multisig/authArgErrors.ts +138 -0
- package/src/multisig/helpers.ts +7 -2
- package/src/multisig.ts +513 -20
- package/src/procedures.ts +1 -1
- package/src/recovery/proposalNoteImport.ts +548 -0
- package/src/recovery/publicNoteBackfill.ts +502 -0
- package/src/recovery/recoverNotes.ts +288 -0
- package/src/recovery/transportDrain.ts +330 -0
- package/src/transaction/consumeNotes.ts +4 -1
- package/src/transaction/p2id.ts +4 -1
- package/src/transaction/summary.ts +13 -7
- package/src/transaction/updateGuardian.ts +4 -1
- package/src/transaction/updateProcedureThreshold.ts +4 -1
- package/src/transaction/updateSigners.ts +4 -1
- package/src/transaction.ts +1 -1
- package/dist/account/builder.test.d.ts +0 -2
- package/dist/account/builder.test.d.ts.map +0 -1
- package/dist/account/builder.test.js +0 -166
- package/dist/account/builder.test.js.map +0 -1
- package/dist/account/masm/account-components/auth.d.ts +0 -2
- package/dist/account/masm/account-components/auth.d.ts.map +0 -1
- package/dist/account/masm/account-components/auth.js +0 -46
- package/dist/account/masm/account-components/auth.js.map +0 -1
- package/dist/account/masm/index.d.ts +0 -2
- package/dist/account/masm/index.d.ts.map +0 -1
- package/dist/account/masm/index.js +0 -4
- package/dist/account/masm/index.js.map +0 -1
- package/dist/account/masm.d.ts +0 -2
- package/dist/account/masm.d.ts.map +0 -1
- package/dist/account/masm.js +0 -4
- package/dist/account/masm.js.map +0 -1
- package/dist/account/storage.test.d.ts +0 -2
- package/dist/account/storage.test.d.ts.map +0 -1
- package/dist/account/storage.test.js +0 -73
- package/dist/account/storage.test.js.map +0 -1
- package/dist/client.test.d.ts +0 -2
- package/dist/client.test.d.ts.map +0 -1
- package/dist/client.test.js +0 -380
- package/dist/client.test.js.map +0 -1
- package/dist/connectivity.test.d.ts +0 -2
- package/dist/connectivity.test.d.ts.map +0 -1
- package/dist/connectivity.test.js +0 -61
- package/dist/connectivity.test.js.map +0 -1
- package/dist/inspector.test.d.ts +0 -2
- package/dist/inspector.test.d.ts.map +0 -1
- package/dist/inspector.test.js +0 -425
- package/dist/inspector.test.js.map +0 -1
- package/dist/lookupAuth.test.d.ts +0 -2
- package/dist/lookupAuth.test.d.ts.map +0 -1
- package/dist/lookupAuth.test.js +0 -138
- package/dist/lookupAuth.test.js.map +0 -1
- package/dist/multisig/consumeNotesErrors.test.d.ts +0 -2
- package/dist/multisig/consumeNotesErrors.test.d.ts.map +0 -1
- package/dist/multisig/consumeNotesErrors.test.js +0 -28
- package/dist/multisig/consumeNotesErrors.test.js.map +0 -1
- package/dist/multisig/helpers.test.d.ts +0 -2
- package/dist/multisig/helpers.test.d.ts.map +0 -1
- package/dist/multisig/helpers.test.js +0 -94
- package/dist/multisig/helpers.test.js.map +0 -1
- package/dist/multisig.test.d.ts +0 -2
- package/dist/multisig.test.d.ts.map +0 -1
- package/dist/multisig.test.js +0 -4112
- package/dist/multisig.test.js.map +0 -1
- package/dist/proposal/factory.test.d.ts +0 -2
- package/dist/proposal/factory.test.d.ts.map +0 -1
- package/dist/proposal/factory.test.js +0 -32
- package/dist/proposal/factory.test.js.map +0 -1
- package/dist/proposal/metadata.test.d.ts +0 -2
- package/dist/proposal/metadata.test.d.ts.map +0 -1
- package/dist/proposal/metadata.test.js +0 -193
- package/dist/proposal/metadata.test.js.map +0 -1
- package/dist/prover/config.test.d.ts +0 -2
- package/dist/prover/config.test.d.ts.map +0 -1
- package/dist/prover/config.test.js +0 -54
- package/dist/prover/config.test.js.map +0 -1
- package/dist/prover/errors.test.d.ts +0 -2
- package/dist/prover/errors.test.d.ts.map +0 -1
- package/dist/prover/errors.test.js +0 -29
- package/dist/prover/errors.test.js.map +0 -1
- package/dist/prover/retry.test.d.ts +0 -2
- package/dist/prover/retry.test.d.ts.map +0 -1
- package/dist/prover/retry.test.js +0 -20
- package/dist/prover/retry.test.js.map +0 -1
- package/dist/prover/workflow.test.d.ts +0 -2
- package/dist/prover/workflow.test.d.ts.map +0 -1
- package/dist/prover/workflow.test.js +0 -105
- package/dist/prover/workflow.test.js.map +0 -1
- package/dist/raw-client.test.d.ts +0 -2
- package/dist/raw-client.test.d.ts.map +0 -1
- package/dist/raw-client.test.js +0 -111
- package/dist/raw-client.test.js.map +0 -1
- package/dist/rpc/config.test.d.ts +0 -2
- package/dist/rpc/config.test.d.ts.map +0 -1
- package/dist/rpc/config.test.js +0 -24
- package/dist/rpc/config.test.js.map +0 -1
- package/dist/rpc/errors.test.d.ts +0 -2
- package/dist/rpc/errors.test.d.ts.map +0 -1
- package/dist/rpc/errors.test.js +0 -34
- package/dist/rpc/errors.test.js.map +0 -1
- package/dist/rpc/retry.test.d.ts +0 -2
- package/dist/rpc/retry.test.d.ts.map +0 -1
- package/dist/rpc/retry.test.js +0 -98
- package/dist/rpc/retry.test.js.map +0 -1
- package/dist/signers/ecdsa.test.d.ts +0 -2
- package/dist/signers/ecdsa.test.d.ts.map +0 -1
- package/dist/signers/ecdsa.test.js +0 -88
- package/dist/signers/ecdsa.test.js.map +0 -1
- package/dist/signers/falcon.test.d.ts +0 -2
- package/dist/signers/falcon.test.d.ts.map +0 -1
- package/dist/signers/falcon.test.js +0 -161
- package/dist/signers/falcon.test.js.map +0 -1
- package/dist/signers/miden-wallet.ecdsa-recovery.test.d.ts +0 -2
- package/dist/signers/miden-wallet.ecdsa-recovery.test.d.ts.map +0 -1
- package/dist/signers/miden-wallet.ecdsa-recovery.test.js +0 -148
- package/dist/signers/miden-wallet.ecdsa-recovery.test.js.map +0 -1
- package/dist/signers/miden-wallet.test.d.ts +0 -2
- package/dist/signers/miden-wallet.test.d.ts.map +0 -1
- package/dist/signers/miden-wallet.test.js +0 -164
- package/dist/signers/miden-wallet.test.js.map +0 -1
- package/dist/signers/para.test.d.ts +0 -2
- package/dist/signers/para.test.d.ts.map +0 -1
- package/dist/signers/para.test.js +0 -146
- package/dist/signers/para.test.js.map +0 -1
- package/dist/transaction/index.d.ts +0 -8
- package/dist/transaction/index.d.ts.map +0 -1
- package/dist/transaction/index.js +0 -7
- package/dist/transaction/index.js.map +0 -1
- package/dist/transaction/p2id.test.d.ts +0 -2
- package/dist/transaction/p2id.test.d.ts.map +0 -1
- package/dist/transaction/p2id.test.js +0 -246
- package/dist/transaction/p2id.test.js.map +0 -1
- package/dist/transaction/rpoRandomCoin.test.d.ts +0 -2
- package/dist/transaction/rpoRandomCoin.test.d.ts.map +0 -1
- package/dist/transaction/rpoRandomCoin.test.js +0 -52
- package/dist/transaction/rpoRandomCoin.test.js.map +0 -1
- package/dist/transaction/summary.test.d.ts +0 -2
- package/dist/transaction/summary.test.d.ts.map +0 -1
- package/dist/transaction/summary.test.js +0 -26
- package/dist/transaction/summary.test.js.map +0 -1
- package/dist/transaction.test.d.ts +0 -2
- package/dist/transaction.test.d.ts.map +0 -1
- package/dist/transaction.test.js +0 -122
- package/dist/transaction.test.js.map +0 -1
- package/dist/types/proposal.test.d.ts +0 -2
- package/dist/types/proposal.test.d.ts.map +0 -1
- package/dist/types/proposal.test.js +0 -56
- package/dist/types/proposal.test.js.map +0 -1
- package/dist/utils/digest.test.d.ts +0 -2
- package/dist/utils/digest.test.d.ts.map +0 -1
- package/dist/utils/digest.test.js +0 -48
- package/dist/utils/digest.test.js.map +0 -1
- package/dist/utils/ecdsa.test.d.ts +0 -2
- package/dist/utils/ecdsa.test.d.ts.map +0 -1
- package/dist/utils/ecdsa.test.js +0 -131
- package/dist/utils/ecdsa.test.js.map +0 -1
- package/dist/utils/encoding.test.d.ts +0 -2
- package/dist/utils/encoding.test.d.ts.map +0 -1
- package/dist/utils/encoding.test.js +0 -185
- package/dist/utils/encoding.test.js.map +0 -1
- package/dist/utils/key.test.d.ts +0 -2
- package/dist/utils/key.test.d.ts.map +0 -1
- package/dist/utils/key.test.js +0 -82
- package/dist/utils/key.test.js.map +0 -1
- package/dist/utils/signature.test.d.ts +0 -2
- package/dist/utils/signature.test.d.ts.map +0 -1
- package/dist/utils/signature.test.js +0 -164
- package/dist/utils/signature.test.js.map +0 -1
- package/dist/utils/word.test.d.ts +0 -2
- package/dist/utils/word.test.d.ts.map +0 -1
- package/dist/utils/word.test.js +0 -54
- package/dist/utils/word.test.js.map +0 -1
- package/masm/account_components/auth/guarded_multisig.masm +0 -42
- package/src/account/builder.test.ts +0 -238
- package/src/account/masm/account-components/auth.ts +0 -46
- package/src/account/masm/index.ts +0 -4
- package/src/account/masm.ts +0 -4
- package/src/account/storage.test.ts +0 -90
- package/src/client.test.ts +0 -473
- package/src/connectivity.test.ts +0 -67
- package/src/inspector.test.ts +0 -542
- package/src/lookupAuth.test.ts +0 -185
- package/src/multisig/consumeNotesErrors.test.ts +0 -43
- package/src/multisig/helpers.test.ts +0 -114
- package/src/multisig.test.ts +0 -5008
- package/src/proposal/factory.test.ts +0 -40
- package/src/proposal/metadata.test.ts +0 -235
- package/src/prover/config.test.ts +0 -90
- package/src/prover/errors.test.ts +0 -61
- package/src/prover/retry.test.ts +0 -38
- package/src/prover/workflow.test.ts +0 -145
- package/src/raw-client.test.ts +0 -171
- package/src/rpc/config.test.ts +0 -45
- package/src/rpc/errors.test.ts +0 -69
- package/src/rpc/retry.test.ts +0 -144
- package/src/signers/ecdsa.test.ts +0 -111
- package/src/signers/falcon.test.ts +0 -197
- package/src/signers/miden-wallet.ecdsa-recovery.test.ts +0 -201
- package/src/signers/miden-wallet.test.ts +0 -206
- package/src/signers/para.test.ts +0 -186
- package/src/transaction/index.ts +0 -13
- package/src/transaction/p2id.test.ts +0 -371
- package/src/transaction/rpoRandomCoin.test.ts +0 -64
- package/src/transaction/summary.test.ts +0 -32
- package/src/transaction.test.ts +0 -142
- package/src/types/proposal.test.ts +0 -68
- package/src/utils/digest.test.ts +0 -55
- package/src/utils/ecdsa.test.ts +0 -164
- package/src/utils/encoding.test.ts +0 -233
- package/src/utils/key.test.ts +0 -91
- package/src/utils/signature.test.ts +0 -210
- package/src/utils/word.test.ts +0 -64
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
//! Typed failures for auth-arg recovery.
|
|
2
|
+
//!
|
|
3
|
+
//! The surface lands here deliberately ahead of the code that raises it: nothing in this
|
|
4
|
+
//! change constructs these, and the proposal paths that do arrive in the PR that commits
|
|
5
|
+
//! the anchored fee faucet. Landing the codes first keeps them out of that PR's diff and
|
|
6
|
+
//! lets a caller pin `code` before the raiser exists — `public-api.test.ts` covers the
|
|
7
|
+
//! barrel so a dropped re-export is caught either way.
|
|
8
|
+
|
|
9
|
+
/** Stable error identifiers for auth-arg recovery failures. */
|
|
10
|
+
export type AuthArgErrorCode =
|
|
11
|
+
| 'proposal_auth_arg_unresolvable'
|
|
12
|
+
| 'proposal_salt_malformed'
|
|
13
|
+
| 'fee_faucet_anchor_mismatch';
|
|
14
|
+
|
|
15
|
+
/** How much of an untrusted value an error message will quote. */
|
|
16
|
+
const MAX_QUOTED_CHARS = 80;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Quotes a GUARDIAN-served value without letting an unbounded string into the
|
|
20
|
+
* message. Control characters would otherwise reach a log verbatim.
|
|
21
|
+
*
|
|
22
|
+
* Applied to every served field these errors interpolate, not only the salt:
|
|
23
|
+
* proposal ids, auth args, faucet ids and the reason text all arrive in the same
|
|
24
|
+
* unvalidated JSON, so sanitising one and not the rest only narrows the hole.
|
|
25
|
+
*
|
|
26
|
+
* The value is whatever GUARDIAN served, so it is not necessarily a string and
|
|
27
|
+
* its own `toString` may throw; a value that cannot even be described must not
|
|
28
|
+
* take the error's place, because this error is the one a `switch_guardian`
|
|
29
|
+
* recovers from.
|
|
30
|
+
*
|
|
31
|
+
* Truncation happens before the control characters are stripped, so an
|
|
32
|
+
* oversized value is never copied at full length just to render 80 characters
|
|
33
|
+
* of it.
|
|
34
|
+
*/
|
|
35
|
+
function quoteUntrusted(value: unknown): string {
|
|
36
|
+
const asString = coerceForMessage(value);
|
|
37
|
+
const printable = (chunk: string) => chunk.replace(/[^\x20-\x7e]/g, '.');
|
|
38
|
+
return asString.length > MAX_QUOTED_CHARS
|
|
39
|
+
? `${printable(asString.slice(0, MAX_QUOTED_CHARS))}... (${asString.length} code units)`
|
|
40
|
+
: printable(asString);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function coerceForMessage(value: unknown): string {
|
|
44
|
+
if (typeof value === 'string') {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
return String(value);
|
|
50
|
+
} catch {
|
|
51
|
+
return `<undescribable ${typeof value}>`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A proposal's recorded salt is not a readable 32-byte word, so no rebuild can
|
|
57
|
+
* use it.
|
|
58
|
+
*
|
|
59
|
+
* Coded for the same reason as {@link ProposalAuthArgUnresolvableError}, and
|
|
60
|
+
* recoverable in the same one place: a `switch_guardian`'s salt is served by the
|
|
61
|
+
* GUARDIAN being switched away from, which can make it unreadable as easily as
|
|
62
|
+
* it can make it wrong. Treating only the latter as recoverable would leave that
|
|
63
|
+
* GUARDIAN able to strand a fully signed switch.
|
|
64
|
+
*/
|
|
65
|
+
export class ProposalSaltMalformedError extends Error {
|
|
66
|
+
readonly code: AuthArgErrorCode = 'proposal_salt_malformed';
|
|
67
|
+
readonly proposalId: string;
|
|
68
|
+
/**
|
|
69
|
+
* Exactly what GUARDIAN served, so not necessarily a string and not
|
|
70
|
+
* necessarily bounded. Non-enumerable, because the default logging paths
|
|
71
|
+
* (`util.inspect`, `JSON.stringify`) would otherwise re-expose the unbounded
|
|
72
|
+
* value the message deliberately truncates. The message quotes it already.
|
|
73
|
+
*/
|
|
74
|
+
readonly saltHex: unknown;
|
|
75
|
+
|
|
76
|
+
constructor(details: { proposalId: string; saltHex: unknown; reason: string; cause?: unknown }) {
|
|
77
|
+
super(
|
|
78
|
+
`Proposal ${quoteUntrusted(details.proposalId)} has a malformed metadata salt ` +
|
|
79
|
+
`'${quoteUntrusted(details.saltHex)}': ${quoteUntrusted(details.reason)}`,
|
|
80
|
+
details.cause === undefined ? undefined : { cause: details.cause },
|
|
81
|
+
);
|
|
82
|
+
this.name = 'ProposalSaltMalformedError';
|
|
83
|
+
this.proposalId = details.proposalId;
|
|
84
|
+
Object.defineProperty(this, 'saltHex', {
|
|
85
|
+
value: details.saltHex,
|
|
86
|
+
enumerable: false,
|
|
87
|
+
writable: false,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A proposal's signed auth arg is not the fee-conversion commitment its recorded
|
|
94
|
+
* salt and anchored fee faucet derive, so no reconstruction from that salt
|
|
95
|
+
* succeeds. Raised before the rebuild, so the proposal fails on the value that is
|
|
96
|
+
* actually wrong rather than on an `ERR_FEE_CONVERSION_INFO_MISSING` abort at
|
|
97
|
+
* proving.
|
|
98
|
+
*
|
|
99
|
+
* `switch_guardian` is the exception, and deliberately so: it rebuilds from the
|
|
100
|
+
* summary's own auth arg, which reproduces the signed word but not the fee
|
|
101
|
+
* preimage behind it, so it executes only on a zero-fee chain.
|
|
102
|
+
*
|
|
103
|
+
* Coded because one caller acts on it rather than reporting it:
|
|
104
|
+
* `switch_guardian` recovery falls back to the summary's own auth arg when it
|
|
105
|
+
* sees this or {@link ProposalSaltMalformedError}, and must not extend that
|
|
106
|
+
* treatment to an unreadable anchor or a WASM failure.
|
|
107
|
+
*/
|
|
108
|
+
export class ProposalAuthArgUnresolvableError extends Error {
|
|
109
|
+
readonly code: AuthArgErrorCode = 'proposal_auth_arg_unresolvable';
|
|
110
|
+
readonly proposalId: string;
|
|
111
|
+
readonly signedAuthArgHex: string;
|
|
112
|
+
readonly saltHex: string;
|
|
113
|
+
readonly feeFaucetIdHex: string;
|
|
114
|
+
|
|
115
|
+
constructor(details: {
|
|
116
|
+
proposalId: string;
|
|
117
|
+
signedAuthArgHex: string;
|
|
118
|
+
saltHex: string;
|
|
119
|
+
feeFaucetIdHex: string;
|
|
120
|
+
}) {
|
|
121
|
+
super(
|
|
122
|
+
`Proposal ${quoteUntrusted(details.proposalId)} auth arg ` +
|
|
123
|
+
`${quoteUntrusted(details.signedAuthArgHex)} is not the fee-conversion commitment to ` +
|
|
124
|
+
`its metadata salt ${quoteUntrusted(details.saltHex)} under fee faucet ` +
|
|
125
|
+
`${quoteUntrusted(details.feeFaucetIdHex)}, so the signed transaction summary cannot ` +
|
|
126
|
+
`be reproduced ` +
|
|
127
|
+
'from that salt, and the proposal cannot be executed. Recreate the proposal and ' +
|
|
128
|
+
'collect signatures again, and have the original dropped server-side — while ' +
|
|
129
|
+
'GUARDIAN keeps serving it, syncing this account keeps failing on it',
|
|
130
|
+
);
|
|
131
|
+
this.name = 'ProposalAuthArgUnresolvableError';
|
|
132
|
+
this.proposalId = details.proposalId;
|
|
133
|
+
this.signedAuthArgHex = details.signedAuthArgHex;
|
|
134
|
+
this.saltHex = details.saltHex;
|
|
135
|
+
this.feeFaucetIdHex = details.feeFaucetIdHex;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
package/src/multisig/helpers.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Account, TransactionSummary, Word } from '@miden-sdk/miden-sdk';
|
|
2
|
-
import { base64ToUint8Array } from '../utils/encoding.js';
|
|
2
|
+
import { base64ToUint8Array, normalizeHexWord } from '../utils/encoding.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Recompute a proposal's id from its serialized transaction summary. Returns
|
|
6
|
+
* normalized hex (lowercase, 0x-prefixed, zero-padded) so the result compares
|
|
7
|
+
* equal to `ExportedProposal.commitment` / `Proposal.id` directly.
|
|
8
|
+
*/
|
|
4
9
|
export function computeCommitmentFromTxSummary(txSummaryBase64: string): string {
|
|
5
10
|
const bytes = base64ToUint8Array(txSummaryBase64);
|
|
6
11
|
const summary = TransactionSummary.deserialize(bytes);
|
|
7
12
|
const commitment = summary.toCommitment();
|
|
8
|
-
return commitment.toHex();
|
|
13
|
+
return normalizeHexWord(commitment.toHex());
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
export function accountIdToHex(account: Account): string {
|