@openzeppelin/miden-multisig-client 0.13.3 → 0.14.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 +10 -13
- package/dist/account/builder.d.ts +3 -3
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +10 -10
- package/dist/account/builder.js.map +1 -1
- package/dist/account/builder.test.js +16 -14
- package/dist/account/builder.test.js.map +1 -1
- package/dist/account/masm/account-components/auth.d.ts +4 -4
- package/dist/account/masm/account-components/auth.d.ts.map +1 -1
- package/dist/account/masm/account-components/auth.js +8 -12
- package/dist/account/masm/account-components/auth.js.map +1 -1
- package/dist/account/masm/auth.d.ts +4 -4
- package/dist/account/masm/auth.d.ts.map +1 -1
- package/dist/account/masm/auth.js +226 -124
- package/dist/account/masm/auth.js.map +1 -1
- package/dist/account/storage.d.ts.map +1 -1
- package/dist/account/storage.js +24 -6
- package/dist/account/storage.js.map +1 -1
- package/dist/account/storage.test.d.ts +2 -0
- package/dist/account/storage.test.d.ts.map +1 -0
- package/dist/account/storage.test.js +73 -0
- package/dist/account/storage.test.js.map +1 -0
- package/dist/client.d.ts +9 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +24 -14
- package/dist/client.js.map +1 -1
- package/dist/client.test.js +45 -8
- package/dist/client.test.js.map +1 -1
- package/dist/index.d.ts +6 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -12
- package/dist/index.js.map +1 -1
- package/dist/multisig/proposal/execution.d.ts +3 -2
- package/dist/multisig/proposal/execution.d.ts.map +1 -1
- package/dist/multisig/proposal/execution.js +8 -12
- package/dist/multisig/proposal/execution.js.map +1 -1
- package/dist/multisig.d.ts +10 -4
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +97 -71
- package/dist/multisig.js.map +1 -1
- package/dist/multisig.test.js +481 -29
- package/dist/multisig.test.js.map +1 -1
- package/dist/procedures.d.ts +8 -8
- package/dist/procedures.js +8 -8
- package/dist/raw-client.d.ts +13 -0
- package/dist/raw-client.d.ts.map +1 -0
- package/dist/raw-client.js +42 -0
- package/dist/raw-client.js.map +1 -0
- package/dist/raw-client.test.d.ts +2 -0
- package/dist/raw-client.test.d.ts.map +1 -0
- package/dist/raw-client.test.js +89 -0
- package/dist/raw-client.test.js.map +1 -0
- package/dist/signers/ecdsa.d.ts +3 -1
- package/dist/signers/ecdsa.d.ts.map +1 -1
- package/dist/signers/ecdsa.js +15 -1
- package/dist/signers/ecdsa.js.map +1 -1
- package/dist/signers/ecdsa.test.js +27 -4
- package/dist/signers/ecdsa.test.js.map +1 -1
- package/dist/signers/falcon.d.ts +3 -1
- package/dist/signers/falcon.d.ts.map +1 -1
- package/dist/signers/falcon.js +15 -1
- package/dist/signers/falcon.js.map +1 -1
- package/dist/signers/falcon.test.js +39 -3
- package/dist/signers/falcon.test.js.map +1 -1
- package/dist/transaction/consumeNotes.d.ts +2 -2
- package/dist/transaction/consumeNotes.d.ts.map +1 -1
- package/dist/transaction/consumeNotes.js +5 -4
- package/dist/transaction/consumeNotes.js.map +1 -1
- package/dist/transaction/options.d.ts +1 -0
- package/dist/transaction/options.d.ts.map +1 -1
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +7 -10
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/p2id.test.js +19 -9
- package/dist/transaction/p2id.test.js.map +1 -1
- package/dist/transaction/summary.d.ts +2 -2
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js +4 -2
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/updateGuardian.d.ts +2 -2
- package/dist/transaction/updateGuardian.d.ts.map +1 -1
- package/dist/transaction/updateGuardian.js +8 -11
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.d.ts +2 -2
- package/dist/transaction/updateProcedureThreshold.d.ts.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js +8 -10
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.d.ts +2 -2
- package/dist/transaction/updateSigners.d.ts.map +1 -1
- package/dist/transaction/updateSigners.js +8 -10
- package/dist/transaction/updateSigners.js.map +1 -1
- package/dist/transaction.test.js +6 -6
- package/dist/transaction.test.js.map +1 -1
- package/dist/utils/key.d.ts.map +1 -1
- package/dist/utils/key.js +3 -3
- package/dist/utils/key.js.map +1 -1
- package/dist/utils/key.test.js +4 -2
- package/dist/utils/key.test.js.map +1 -1
- package/dist/utils/signature.d.ts +2 -0
- package/dist/utils/signature.d.ts.map +1 -1
- package/dist/utils/signature.js +10 -5
- package/dist/utils/signature.js.map +1 -1
- package/dist/utils/signature.test.js +9 -9
- package/dist/utils/signature.test.js.map +1 -1
- package/masm/account_components/auth/multisig.masm +2 -3
- package/masm/account_components/auth/multisig_ecdsa.masm +2 -3
- package/masm/account_components/auth/multisig_guardian.masm +2 -3
- package/masm/account_components/auth/multisig_guardian_ecdsa.masm +2 -3
- package/masm/auth/guardian.masm +30 -8
- package/masm/auth/guardian_ecdsa.masm +24 -7
- package/masm/auth/multisig.masm +86 -55
- package/masm/auth/multisig_ecdsa.masm +86 -54
- package/package.json +3 -3
- package/src/account/builder.test.ts +16 -14
- package/src/account/builder.ts +13 -12
- package/src/account/masm/account-components/auth.ts +8 -12
- package/src/account/masm/auth.ts +226 -124
- package/src/account/storage.test.ts +90 -0
- package/src/account/storage.ts +27 -6
- package/src/client.test.ts +52 -8
- package/src/client.ts +39 -16
- package/src/index.ts +6 -12
- package/src/multisig/proposal/execution.ts +18 -14
- package/src/multisig.test.ts +572 -29
- package/src/multisig.ts +121 -83
- package/src/procedures.ts +8 -8
- package/src/raw-client.test.ts +133 -0
- package/src/raw-client.ts +75 -0
- package/src/signers/ecdsa.test.ts +35 -4
- package/src/signers/ecdsa.ts +18 -2
- package/src/signers/falcon.test.ts +50 -3
- package/src/signers/falcon.ts +18 -2
- package/src/transaction/consumeNotes.ts +16 -5
- package/src/transaction/options.ts +1 -0
- package/src/transaction/p2id.test.ts +19 -9
- package/src/transaction/p2id.ts +8 -13
- package/src/transaction/summary.ts +11 -4
- package/src/transaction/updateGuardian.ts +22 -14
- package/src/transaction/updateProcedureThreshold.ts +20 -15
- package/src/transaction/updateSigners.ts +22 -14
- package/src/transaction.test.ts +6 -6
- package/src/utils/key.test.ts +4 -2
- package/src/utils/key.ts +7 -3
- package/src/utils/signature.test.ts +10 -10
- package/src/utils/signature.ts +12 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdviceMap, FeltArray, Signature, TransactionSummary, Word, } from '@miden-sdk/miden-sdk';
|
|
2
2
|
import { buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, buildUpdateGuardianTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateSignersTransactionRequest, } from '../../transaction.js';
|
|
3
3
|
import { base64ToUint8Array, normalizeHexWord } from '../../utils/encoding.js';
|
|
4
4
|
import { buildSignatureAdviceEntry, signatureHexToBytes, tryComputeEcdsaCommitmentHex, } from '../../utils/signature.js';
|
|
@@ -13,7 +13,7 @@ export async function executeProposalWorkflow(params) {
|
|
|
13
13
|
await appendGuardianAckAdvice(params.guardian, executionSource.delta, params.guardianCommitment, params.guardianPublicKey, params.signatureScheme, executionData.txCommitmentHex, adviceMap);
|
|
14
14
|
}
|
|
15
15
|
const finalRequest = await buildFinalRequest(params, executionData.saltHex, adviceMap);
|
|
16
|
-
await submitTransaction(params.
|
|
16
|
+
await submitTransaction(params.midenClient, params.accountId, finalRequest);
|
|
17
17
|
}
|
|
18
18
|
export async function createTransactionProposalRequest(params) {
|
|
19
19
|
ensureProposalReady(params.proposal, params.threshold, params.getEffectiveThreshold);
|
|
@@ -118,14 +118,14 @@ async function buildFinalRequest(params, saltHex, adviceMap) {
|
|
|
118
118
|
if (!metadata.noteIds || metadata.noteIds.length === 0) {
|
|
119
119
|
throw new Error('Proposal missing noteIds. Was it created with createConsumeNotesProposal?');
|
|
120
120
|
}
|
|
121
|
-
const { request } = await buildConsumeNotesTransactionRequest(params.
|
|
121
|
+
const { request } = await buildConsumeNotesTransactionRequest(params.midenClient, metadata.noteIds, { salt: normalizedSalt, signatureAdviceMap: adviceMap });
|
|
122
122
|
return request;
|
|
123
123
|
}
|
|
124
124
|
case 'switch_guardian': {
|
|
125
125
|
if (!metadata.newGuardianPubkey) {
|
|
126
126
|
throw new Error('Proposal missing newGuardianPubkey. Was it created with createSwitchGuardianProposal?');
|
|
127
127
|
}
|
|
128
|
-
const { request } = await buildUpdateGuardianTransactionRequest(params.
|
|
128
|
+
const { request } = await buildUpdateGuardianTransactionRequest(params.midenClient, metadata.newGuardianPubkey, {
|
|
129
129
|
salt: normalizedSalt,
|
|
130
130
|
signatureAdviceMap: adviceMap,
|
|
131
131
|
signatureScheme: params.signatureScheme,
|
|
@@ -133,7 +133,7 @@ async function buildFinalRequest(params, saltHex, adviceMap) {
|
|
|
133
133
|
return request;
|
|
134
134
|
}
|
|
135
135
|
case 'update_procedure_threshold': {
|
|
136
|
-
const { request } = await buildUpdateProcedureThresholdTransactionRequest(params.
|
|
136
|
+
const { request } = await buildUpdateProcedureThresholdTransactionRequest(params.midenClient, metadata.targetProcedure, metadata.targetThreshold, {
|
|
137
137
|
salt: normalizedSalt,
|
|
138
138
|
signatureAdviceMap: adviceMap,
|
|
139
139
|
signatureScheme: params.signatureScheme,
|
|
@@ -150,7 +150,7 @@ async function buildFinalRequest(params, saltHex, adviceMap) {
|
|
|
150
150
|
case 'unknown':
|
|
151
151
|
throw new Error('Cannot execute proposal with unknown type. The proposal must have been imported without proper metadata.');
|
|
152
152
|
default: {
|
|
153
|
-
const { request } = await buildUpdateSignersTransactionRequest(params.
|
|
153
|
+
const { request } = await buildUpdateSignersTransactionRequest(params.midenClient, metadata.targetThreshold, metadata.targetSignerCommitments, {
|
|
154
154
|
salt: normalizedSalt,
|
|
155
155
|
signatureAdviceMap: adviceMap,
|
|
156
156
|
signatureScheme: params.signatureScheme,
|
|
@@ -159,11 +159,7 @@ async function buildFinalRequest(params, saltHex, adviceMap) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
async function submitTransaction(
|
|
163
|
-
|
|
164
|
-
const result = await webClient.executeTransaction(accountId, request);
|
|
165
|
-
const proven = await webClient.proveTransaction(result, null);
|
|
166
|
-
const submissionHeight = await webClient.submitProvenTransaction(proven, result);
|
|
167
|
-
await webClient.applyTransaction(result, submissionHeight);
|
|
162
|
+
async function submitTransaction(midenClient, accountIdHex, request) {
|
|
163
|
+
await midenClient.transactions.submit(accountIdHex, request);
|
|
168
164
|
}
|
|
169
165
|
//# sourceMappingURL=execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../../src/multisig/proposal/execution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../../src/multisig/proposal/execution.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,IAAI,GACL,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mCAAmC,EACnC,2BAA2B,EAC3B,qCAAqC,EACrC,+CAA+C,EAC/C,oCAAoC,GACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AA2B/D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAqC;IAErC,mBAAmB,CACjB,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,qBAAqB,CAC7B,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAA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xB,QAAQ,CAAC,uBAAuB,EAChC;gBACE,IAAI,EAAE,cAAc;gBACpB,kBAAkB,EAAE,SAAS;gBAC7B,eAAe,EAAE,MAAM,CAAC,eAAe;aACxC,CACF,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC9B,WAAwB,EACxB,YAAoB,EACpB,OAA2B;IAE3B,MAAM,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC"}
|
package/dist/multisig.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { GuardianHttpClient, 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
|
-
import type {
|
|
10
|
+
import type { MidenClient, TransactionRequest } from '@miden-sdk/miden-sdk';
|
|
11
11
|
import { Account } from '@miden-sdk/miden-sdk';
|
|
12
12
|
/**
|
|
13
13
|
* Result of fetching account state from GUARDIAN.
|
|
@@ -39,12 +39,15 @@ export declare class Multisig {
|
|
|
39
39
|
guardianPublicKey?: string;
|
|
40
40
|
private guardian;
|
|
41
41
|
private readonly signer;
|
|
42
|
-
private readonly
|
|
42
|
+
private readonly midenClient;
|
|
43
|
+
private readonly rawClientPromise;
|
|
44
|
+
private readonly transactionProver;
|
|
43
45
|
private readonly _accountId;
|
|
44
46
|
private readonly midenRpcEndpoint?;
|
|
45
47
|
private proposals;
|
|
46
|
-
constructor(account: Account, config: MultisigConfig, guardian: GuardianHttpClient, signer: Signer,
|
|
48
|
+
constructor(account: Account, config: MultisigConfig, guardian: GuardianHttpClient, signer: Signer, midenClient: MidenClient, accountId?: string, midenRpcEndpoint?: string);
|
|
47
49
|
private getMidenRpcEndpoint;
|
|
50
|
+
private getRawClient;
|
|
48
51
|
private proposalFactory;
|
|
49
52
|
private verifyGuardianEndpointCommitment;
|
|
50
53
|
/** The account ID as a string */
|
|
@@ -76,7 +79,7 @@ export declare class Multisig {
|
|
|
76
79
|
*/
|
|
77
80
|
fetchState(): Promise<AccountState>;
|
|
78
81
|
/**
|
|
79
|
-
* Sync account state from GUARDIAN into the local
|
|
82
|
+
* Sync account state from GUARDIAN into the local Miden client store.
|
|
80
83
|
*
|
|
81
84
|
* If the GUARDIAN commitment differs from the local commitment (or the account
|
|
82
85
|
* is missing locally), the local store is overwritten with the GUARDIAN state.
|
|
@@ -176,12 +179,15 @@ export declare class Multisig {
|
|
|
176
179
|
*/
|
|
177
180
|
signProposal(proposalId: string): Promise<Proposal>;
|
|
178
181
|
private getProposalForSigning;
|
|
182
|
+
createTransactionProposalRequest(proposalId: string): Promise<TransactionRequest>;
|
|
179
183
|
/**
|
|
180
184
|
* Execute a proposal that has enough signatures.
|
|
181
185
|
*
|
|
182
186
|
* @param proposalId - The proposal commitment/ID
|
|
183
187
|
*/
|
|
184
188
|
executeProposal(proposalId: string): Promise<void>;
|
|
189
|
+
private getLocalProposal;
|
|
190
|
+
private prepareProposalExecution;
|
|
185
191
|
/**
|
|
186
192
|
* Export a proposal for offline signing
|
|
187
193
|
*/
|
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;AAC7J,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EAEd,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"multisig.d.ts","sourceRo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,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKvF;;;;OAIG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCxD,OAAO,CAAC,gBAAgB;YAKV,wBAAwB;IAwJtC;;OAEG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA+BnE;;;;;OAKG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAwBhD;;;;;OAKG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAcrD;;;;;OAKG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4D9D,OAAO,CAAC,sCAAsC;YAahC,6BAA6B;YAuB7B,mCAAmC;CA2DlD"}
|
package/dist/multisig.js
CHANGED
|
@@ -15,6 +15,7 @@ import { AccountInspector } from './inspector.js';
|
|
|
15
15
|
import { ProposalFactory } from './proposal/factory.js';
|
|
16
16
|
import { ProposalMetadataCodec } from './proposal/metadata.js';
|
|
17
17
|
import { ProposalSignatures } from './proposal/signatures.js';
|
|
18
|
+
import { getRawMidenClient, getTransactionProver } from './raw-client.js';
|
|
18
19
|
/**
|
|
19
20
|
* Represents a multisig account with GUARDIAN integration.
|
|
20
21
|
*/
|
|
@@ -27,11 +28,13 @@ export class Multisig {
|
|
|
27
28
|
guardianPublicKey;
|
|
28
29
|
guardian;
|
|
29
30
|
signer;
|
|
30
|
-
|
|
31
|
+
midenClient;
|
|
32
|
+
rawClientPromise;
|
|
33
|
+
transactionProver;
|
|
31
34
|
_accountId;
|
|
32
35
|
midenRpcEndpoint;
|
|
33
36
|
proposals = new Map();
|
|
34
|
-
constructor(account, config, guardian, signer,
|
|
37
|
+
constructor(account, config, guardian, signer, midenClient, accountId, midenRpcEndpoint) {
|
|
35
38
|
this.account = account;
|
|
36
39
|
this.threshold = config.threshold;
|
|
37
40
|
this.signerCommitments = config.signerCommitments;
|
|
@@ -40,9 +43,11 @@ export class Multisig {
|
|
|
40
43
|
this.procedureThresholds = new Map((config.procedureThresholds ?? []).map((pt) => [pt.procedure, pt.threshold]));
|
|
41
44
|
this.guardian = guardian;
|
|
42
45
|
this.signer = signer;
|
|
43
|
-
this.
|
|
46
|
+
this.midenClient = midenClient;
|
|
44
47
|
this._accountId = accountId ?? (account ? accountIdToHex(account) : '');
|
|
45
48
|
this.midenRpcEndpoint = midenRpcEndpoint;
|
|
49
|
+
this.rawClientPromise = getRawMidenClient(midenClient, midenRpcEndpoint);
|
|
50
|
+
this.transactionProver = getTransactionProver(midenClient);
|
|
46
51
|
}
|
|
47
52
|
getMidenRpcEndpoint() {
|
|
48
53
|
if (!this.midenRpcEndpoint) {
|
|
@@ -50,6 +55,9 @@ export class Multisig {
|
|
|
50
55
|
}
|
|
51
56
|
return this.midenRpcEndpoint;
|
|
52
57
|
}
|
|
58
|
+
async getRawClient() {
|
|
59
|
+
return this.rawClientPromise;
|
|
60
|
+
}
|
|
53
61
|
proposalFactory() {
|
|
54
62
|
return new ProposalFactory({
|
|
55
63
|
accountId: this._accountId,
|
|
@@ -140,7 +148,7 @@ export class Multisig {
|
|
|
140
148
|
};
|
|
141
149
|
}
|
|
142
150
|
/**
|
|
143
|
-
* Sync account state from GUARDIAN into the local
|
|
151
|
+
* Sync account state from GUARDIAN into the local Miden client store.
|
|
144
152
|
*
|
|
145
153
|
* If the GUARDIAN commitment differs from the local commitment (or the account
|
|
146
154
|
* is missing locally), the local store is overwritten with the GUARDIAN state.
|
|
@@ -148,17 +156,18 @@ export class Multisig {
|
|
|
148
156
|
async syncState() {
|
|
149
157
|
const state = await this.fetchState();
|
|
150
158
|
const accountId = AccountId.fromHex(this._accountId);
|
|
151
|
-
const
|
|
159
|
+
const webClient = await this.getRawClient();
|
|
160
|
+
const localAccount = await webClient.getAccount(accountId);
|
|
152
161
|
let accountForConfigRefresh = localAccount ?? null;
|
|
153
162
|
const guardianCommitment = normalizeHexWord(state.commitment);
|
|
154
163
|
const localCommitment = localAccount
|
|
155
|
-
? normalizeHexWord(localAccount.
|
|
164
|
+
? normalizeHexWord(localAccount.to_commitment().toHex())
|
|
156
165
|
: null;
|
|
157
166
|
if (!localAccount || localCommitment !== guardianCommitment) {
|
|
158
167
|
const accountBytes = base64ToUint8Array(state.stateDataBase64);
|
|
159
168
|
const incomingAccount = Account.deserialize(accountBytes);
|
|
160
169
|
await this.ensureSafeToOverwriteLocalState(incomingAccount, localAccount);
|
|
161
|
-
await
|
|
170
|
+
await webClient.newAccount(incomingAccount, true);
|
|
162
171
|
accountForConfigRefresh = incomingAccount;
|
|
163
172
|
}
|
|
164
173
|
this.refreshConfigFromAccount(accountForConfigRefresh);
|
|
@@ -166,11 +175,12 @@ export class Multisig {
|
|
|
166
175
|
}
|
|
167
176
|
async verifyStateCommitment() {
|
|
168
177
|
const accountId = AccountId.fromHex(this._accountId);
|
|
169
|
-
const
|
|
178
|
+
const webClient = await this.getRawClient();
|
|
179
|
+
const localAccount = await webClient.getAccount(accountId);
|
|
170
180
|
if (!localAccount) {
|
|
171
181
|
throw new Error(`Local account state not found for account ${this._accountId}. Sync the account before verifying.`);
|
|
172
182
|
}
|
|
173
|
-
const localCommitment = normalizeHexWord(localAccount.
|
|
183
|
+
const localCommitment = normalizeHexWord(localAccount.to_commitment().toHex());
|
|
174
184
|
const onChainCommitment = await this.getOnChainCommitment(accountId);
|
|
175
185
|
if (!onChainCommitment) {
|
|
176
186
|
throw new Error(`On-chain account details not found for account ${this._accountId}`);
|
|
@@ -197,7 +207,7 @@ export class Multisig {
|
|
|
197
207
|
if (!onChainCommitment) {
|
|
198
208
|
return;
|
|
199
209
|
}
|
|
200
|
-
const incomingCommitment = normalizeHexWord(incomingAccount.
|
|
210
|
+
const incomingCommitment = normalizeHexWord(incomingAccount.to_commitment().toHex());
|
|
201
211
|
if (incomingCommitment !== onChainCommitment) {
|
|
202
212
|
throw new Error(`Refusing to overwrite local state: incoming commitment does not match on-chain commitment for account ${this._accountId}`);
|
|
203
213
|
}
|
|
@@ -328,10 +338,11 @@ export class Multisig {
|
|
|
328
338
|
* @param newThreshold - Optional new threshold (defaults to current threshold)
|
|
329
339
|
*/
|
|
330
340
|
async createAddSignerProposal(newCommitment, nonce, newThreshold) {
|
|
341
|
+
const webClient = await this.getRawClient();
|
|
331
342
|
const targetThreshold = newThreshold ?? this.threshold;
|
|
332
343
|
const targetSignerCommitments = [...this.signerCommitments, newCommitment];
|
|
333
|
-
const { request, salt } = await buildUpdateSignersTransactionRequest(
|
|
334
|
-
const summary = await executeForSummary(
|
|
344
|
+
const { request, salt } = await buildUpdateSignersTransactionRequest(webClient, targetThreshold, targetSignerCommitments, { signatureScheme: this.signer.scheme });
|
|
345
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
335
346
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
336
347
|
const proposalNonce = nonce ?? Date.now();
|
|
337
348
|
const metadata = {
|
|
@@ -352,6 +363,7 @@ export class Multisig {
|
|
|
352
363
|
* @param newThreshold - Optional new threshold (defaults to min of current threshold and new signer count)
|
|
353
364
|
*/
|
|
354
365
|
async createRemoveSignerProposal(signerToRemove, nonce, newThreshold) {
|
|
366
|
+
const webClient = await this.getRawClient();
|
|
355
367
|
const normalizedRemove = signerToRemove.toLowerCase();
|
|
356
368
|
const targetSignerCommitments = this.signerCommitments.filter((c) => c.toLowerCase() !== normalizedRemove);
|
|
357
369
|
if (targetSignerCommitments.length === this.signerCommitments.length) {
|
|
@@ -364,8 +376,8 @@ export class Multisig {
|
|
|
364
376
|
if (targetThreshold < 1 || targetThreshold > targetSignerCommitments.length) {
|
|
365
377
|
throw new Error(`Invalid threshold ${targetThreshold}. Must be between 1 and ${targetSignerCommitments.length}`);
|
|
366
378
|
}
|
|
367
|
-
const { request, salt } = await buildUpdateSignersTransactionRequest(
|
|
368
|
-
const summary = await executeForSummary(
|
|
379
|
+
const { request, salt } = await buildUpdateSignersTransactionRequest(webClient, targetThreshold, targetSignerCommitments, { signatureScheme: this.signer.scheme });
|
|
380
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
369
381
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
370
382
|
const proposalNonce = nonce ?? Date.now();
|
|
371
383
|
const metadata = {
|
|
@@ -385,14 +397,15 @@ export class Multisig {
|
|
|
385
397
|
* @param nonce - Optional proposal nonce (defaults to Date.now())
|
|
386
398
|
*/
|
|
387
399
|
async createChangeThresholdProposal(newThreshold, nonce) {
|
|
400
|
+
const webClient = await this.getRawClient();
|
|
388
401
|
if (newThreshold < 1 || newThreshold > this.signerCommitments.length) {
|
|
389
402
|
throw new Error(`Invalid threshold ${newThreshold}. Must be between 1 and ${this.signerCommitments.length}`);
|
|
390
403
|
}
|
|
391
404
|
if (newThreshold === this.threshold) {
|
|
392
405
|
throw new Error('New threshold is the same as current threshold');
|
|
393
406
|
}
|
|
394
|
-
const { request, salt } = await buildUpdateSignersTransactionRequest(
|
|
395
|
-
const summary = await executeForSummary(
|
|
407
|
+
const { request, salt } = await buildUpdateSignersTransactionRequest(webClient, newThreshold, this.signerCommitments, { signatureScheme: this.signer.scheme });
|
|
408
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
396
409
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
397
410
|
const proposalNonce = nonce ?? Date.now();
|
|
398
411
|
const metadata = {
|
|
@@ -406,6 +419,7 @@ export class Multisig {
|
|
|
406
419
|
return this.createProposal(proposalNonce, summaryBase64, metadata);
|
|
407
420
|
}
|
|
408
421
|
async createUpdateProcedureThresholdProposal(targetProcedure, targetThreshold, nonce) {
|
|
422
|
+
const webClient = await this.getRawClient();
|
|
409
423
|
if (targetThreshold < 0 || targetThreshold > this.signerCommitments.length) {
|
|
410
424
|
throw new Error(`Invalid threshold ${targetThreshold}. Must be between 0 and ${this.signerCommitments.length}`);
|
|
411
425
|
}
|
|
@@ -416,8 +430,8 @@ export class Multisig {
|
|
|
416
430
|
if (currentOverride !== undefined && currentOverride === targetThreshold) {
|
|
417
431
|
throw new Error(`Procedure ${targetProcedure} already has threshold override ${targetThreshold}`);
|
|
418
432
|
}
|
|
419
|
-
const { request, salt } = await buildUpdateProcedureThresholdTransactionRequest(
|
|
420
|
-
const summary = await executeForSummary(
|
|
433
|
+
const { request, salt } = await buildUpdateProcedureThresholdTransactionRequest(webClient, targetProcedure, targetThreshold, { signatureScheme: this.signer.scheme });
|
|
434
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
421
435
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
422
436
|
const proposalNonce = nonce ?? Date.now();
|
|
423
437
|
const action = targetThreshold === 0
|
|
@@ -441,9 +455,10 @@ export class Multisig {
|
|
|
441
455
|
* @param nonce - Optional proposal nonce (defaults to Date.now())
|
|
442
456
|
*/
|
|
443
457
|
async createSwitchGuardianProposal(newGuardianEndpoint, newGuardianPubkey, nonce) {
|
|
458
|
+
const webClient = await this.getRawClient();
|
|
444
459
|
await this.verifyGuardianEndpointCommitment(newGuardianEndpoint, newGuardianPubkey);
|
|
445
|
-
const { request, salt } = await buildUpdateGuardianTransactionRequest(
|
|
446
|
-
const summary = await executeForSummary(
|
|
460
|
+
const { request, salt } = await buildUpdateGuardianTransactionRequest(webClient, newGuardianPubkey, { signatureScheme: this.signer.scheme });
|
|
461
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
447
462
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
448
463
|
const proposalNonce = nonce ?? Date.now();
|
|
449
464
|
const metadata = {
|
|
@@ -474,11 +489,12 @@ export class Multisig {
|
|
|
474
489
|
* @param nonce - Optional proposal nonce (defaults to Date.now())
|
|
475
490
|
*/
|
|
476
491
|
async createConsumeNotesProposal(noteIds, nonce) {
|
|
492
|
+
const webClient = await this.getRawClient();
|
|
477
493
|
if (noteIds.length === 0) {
|
|
478
494
|
throw new Error('At least one note ID is required');
|
|
479
495
|
}
|
|
480
|
-
const { request, salt } = await buildConsumeNotesTransactionRequest(
|
|
481
|
-
const summary = await executeForSummary(
|
|
496
|
+
const { request, salt } = await buildConsumeNotesTransactionRequest(webClient, noteIds);
|
|
497
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
482
498
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
483
499
|
const proposalNonce = nonce ?? Date.now();
|
|
484
500
|
const metadata = {
|
|
@@ -499,11 +515,12 @@ export class Multisig {
|
|
|
499
515
|
* @param nonce - Optional proposal nonce (defaults to Date.now())
|
|
500
516
|
*/
|
|
501
517
|
async createP2idProposal(recipientId, faucetId, amount, nonce) {
|
|
518
|
+
const webClient = await this.getRawClient();
|
|
502
519
|
if (amount <= 0n) {
|
|
503
520
|
throw new Error('Amount must be greater than 0');
|
|
504
521
|
}
|
|
505
522
|
const { request, salt } = buildP2idTransactionRequest(this._accountId, recipientId, faucetId, amount);
|
|
506
|
-
const summary = await executeForSummary(
|
|
523
|
+
const summary = await executeForSummary(webClient, this._accountId, request);
|
|
507
524
|
const summaryBase64 = uint8ArrayToBase64(summary.serialize());
|
|
508
525
|
const proposalNonce = nonce ?? Date.now();
|
|
509
526
|
const metadata = {
|
|
@@ -525,8 +542,9 @@ export class Multisig {
|
|
|
525
542
|
*/
|
|
526
543
|
async getConsumableNotes() {
|
|
527
544
|
const accountId = AccountId.fromHex(this._accountId);
|
|
545
|
+
const webClient = await this.getRawClient();
|
|
528
546
|
// Get consumable notes for this account
|
|
529
|
-
const consumableRecords = await
|
|
547
|
+
const consumableRecords = await webClient.getConsumableNotes(accountId);
|
|
530
548
|
// Convert to our simplified ConsumableNote type
|
|
531
549
|
const notes = [];
|
|
532
550
|
for (const record of consumableRecords) {
|
|
@@ -589,43 +607,81 @@ export class Multisig {
|
|
|
589
607
|
await this.syncProposals();
|
|
590
608
|
return this.proposals.get(proposalId) ?? this.proposals.get(normalizedProposalId);
|
|
591
609
|
}
|
|
610
|
+
async createTransactionProposalRequest(proposalId) {
|
|
611
|
+
const { finalRequest } = await this.prepareProposalExecution(proposalId);
|
|
612
|
+
return finalRequest;
|
|
613
|
+
}
|
|
592
614
|
/**
|
|
593
615
|
* Execute a proposal that has enough signatures.
|
|
594
616
|
*
|
|
595
617
|
* @param proposalId - The proposal commitment/ID
|
|
596
618
|
*/
|
|
597
619
|
async executeProposal(proposalId) {
|
|
598
|
-
const proposal = this.
|
|
620
|
+
const { metadata, finalRequest, proposal } = await this.prepareProposalExecution(proposalId);
|
|
621
|
+
const accountId = AccountId.fromHex(this._accountId);
|
|
622
|
+
await this.midenClient.transactions.submit(accountId, finalRequest);
|
|
623
|
+
if (metadata.proposalType === 'switch_guardian') {
|
|
624
|
+
if (!metadata.newGuardianEndpoint || !metadata.newGuardianPubkey) {
|
|
625
|
+
throw new Error('Switch GUARDIAN proposal metadata is incomplete after execution');
|
|
626
|
+
}
|
|
627
|
+
try {
|
|
628
|
+
const webClient = await this.getRawClient();
|
|
629
|
+
await webClient.syncState();
|
|
630
|
+
const updatedAccount = await webClient.getAccount(accountId);
|
|
631
|
+
if (!updatedAccount) {
|
|
632
|
+
throw new Error(`Updated account ${this._accountId} is missing from local client`);
|
|
633
|
+
}
|
|
634
|
+
const updatedStateBase64 = uint8ArrayToBase64(updatedAccount.serialize());
|
|
635
|
+
const nextGuardian = new GuardianHttpClient(metadata.newGuardianEndpoint);
|
|
636
|
+
this.setGuardianClient(nextGuardian);
|
|
637
|
+
this.guardianPublicKey = metadata.newGuardianPubkey;
|
|
638
|
+
await this.registerOnGuardian(updatedStateBase64);
|
|
639
|
+
}
|
|
640
|
+
catch (error) {
|
|
641
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
642
|
+
throw new Error(`Transaction executed successfully but failed to register on new GUARDIAN: ${message}`);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
proposal.status = 'finalized';
|
|
646
|
+
}
|
|
647
|
+
getLocalProposal(proposalId) {
|
|
648
|
+
const normalizedProposalId = normalizeHexWord(proposalId);
|
|
649
|
+
return this.proposals.get(proposalId) ?? this.proposals.get(normalizedProposalId);
|
|
650
|
+
}
|
|
651
|
+
async prepareProposalExecution(proposalId) {
|
|
652
|
+
const proposal = this.getLocalProposal(proposalId);
|
|
599
653
|
if (!proposal) {
|
|
600
654
|
throw new Error(`Proposal not found: ${proposalId}`);
|
|
601
655
|
}
|
|
656
|
+
this.proposalFactory().assertAccountId(proposal.accountId);
|
|
602
657
|
await this.verifyProposalMetadataBinding(proposal);
|
|
603
|
-
const
|
|
604
|
-
const effectiveThreshold = proposalType
|
|
605
|
-
? this.getEffectiveThreshold(proposalType)
|
|
606
|
-
: this.threshold;
|
|
658
|
+
const metadata = proposal.metadata;
|
|
659
|
+
const effectiveThreshold = this.getEffectiveThreshold(metadata.proposalType);
|
|
607
660
|
const signatureContext = `Invalid proposal signatures for ${proposalId}`;
|
|
608
661
|
const signaturesForExecution = new ProposalSignatures(proposal.signatures, this.signerCommitments, signatureContext).entries();
|
|
609
662
|
if (signaturesForExecution.length < effectiveThreshold) {
|
|
610
663
|
throw new Error('Proposal is not ready for execution. Still pending signatures.');
|
|
611
664
|
}
|
|
612
|
-
const isSwitchGuardian = proposalType === 'switch_guardian';
|
|
665
|
+
const isSwitchGuardian = metadata.proposalType === 'switch_guardian';
|
|
666
|
+
const normalizedProposalId = normalizeHexWord(proposal.id);
|
|
613
667
|
let txSummaryBase64;
|
|
614
668
|
let delta;
|
|
615
669
|
if (isSwitchGuardian) {
|
|
616
670
|
txSummaryBase64 = proposal.txSummary;
|
|
617
671
|
}
|
|
618
672
|
else {
|
|
619
|
-
delta = await this.guardian.getDeltaProposal(this._accountId,
|
|
673
|
+
delta = await this.guardian.getDeltaProposal(this._accountId, normalizedProposalId);
|
|
620
674
|
txSummaryBase64 = delta.deltaPayload.txSummary.data;
|
|
621
675
|
}
|
|
622
676
|
const txSummaryBytes = base64ToUint8Array(txSummaryBase64);
|
|
623
677
|
const txSummary = TransactionSummary.deserialize(txSummaryBytes);
|
|
624
678
|
const saltHex = txSummary.salt().toHex();
|
|
625
679
|
const txCommitmentHex = txSummary.toCommitment().toHex();
|
|
680
|
+
const normalizedTxCommitmentHex = normalizeHexWord(txCommitmentHex);
|
|
626
681
|
const normalizedSignerCommitments = new Set(this.signerCommitments.map((commitment) => normalizeHexWord(commitment)));
|
|
627
682
|
const adviceMap = new AdviceMap();
|
|
628
683
|
const adviceMapKeys = new Set();
|
|
684
|
+
const createTxCommitmentWord = () => Word.fromHex(normalizedTxCommitmentHex);
|
|
629
685
|
for (const cosignerSig of signaturesForExecution) {
|
|
630
686
|
let signerCommitmentHex = normalizeHexWord(cosignerSig.signerId);
|
|
631
687
|
const ecdsaPublicKey = cosignerSig.signature.scheme === 'ecdsa'
|
|
@@ -646,8 +702,7 @@ export class Multisig {
|
|
|
646
702
|
const signerCommitment = Word.fromHex(signerCommitmentHex);
|
|
647
703
|
const sigBytes = signatureHexToBytes(cosignerSig.signature.signature, cosignerSig.signature.scheme);
|
|
648
704
|
const signature = Signature.deserialize(sigBytes);
|
|
649
|
-
const
|
|
650
|
-
const { key, values } = buildSignatureAdviceEntry(signerCommitment, txCommitment, signature, ecdsaPublicKey, cosignerSig.signature.scheme === 'ecdsa'
|
|
705
|
+
const { key, values } = buildSignatureAdviceEntry(signerCommitment, createTxCommitmentWord(), signature, ecdsaPublicKey, cosignerSig.signature.scheme === 'ecdsa'
|
|
651
706
|
? cosignerSig.signature.signature
|
|
652
707
|
: undefined);
|
|
653
708
|
const keyHex = normalizeHexWord(key.toHex());
|
|
@@ -681,8 +736,7 @@ export class Multisig {
|
|
|
681
736
|
}
|
|
682
737
|
const ackSigBytes = signatureHexToBytes(ackSigHex, ackScheme);
|
|
683
738
|
const ackSignature = Signature.deserialize(ackSigBytes);
|
|
684
|
-
const
|
|
685
|
-
const { key: ackKey, values: ackValues } = buildSignatureAdviceEntry(guardianCommitment, txCommitmentForAck, ackSignature, ackScheme === 'ecdsa' ? ackPubkey : undefined, ackScheme === 'ecdsa' ? ackSigHex : undefined);
|
|
739
|
+
const { key: ackKey, values: ackValues } = buildSignatureAdviceEntry(guardianCommitment, createTxCommitmentWord(), ackSignature, ackScheme === 'ecdsa' ? ackPubkey : undefined, ackScheme === 'ecdsa' ? ackSigHex : undefined);
|
|
686
740
|
const ackKeyHex = normalizeHexWord(ackKey.toHex());
|
|
687
741
|
if (adviceMapKeys.has(ackKeyHex)) {
|
|
688
742
|
throw new Error(`Duplicate advice-map key detected for GUARDIAN acknowledgment in proposal ${proposalId}`);
|
|
@@ -690,42 +744,12 @@ export class Multisig {
|
|
|
690
744
|
adviceMapKeys.add(ackKeyHex);
|
|
691
745
|
adviceMap.insert(ackKey, new FeltArray(ackValues));
|
|
692
746
|
}
|
|
693
|
-
const metadata = proposal.metadata;
|
|
694
|
-
if (!metadata) {
|
|
695
|
-
throw new Error('Proposal missing metadata');
|
|
696
|
-
}
|
|
697
747
|
if (metadata.proposalType === 'switch_guardian') {
|
|
698
748
|
await this.verifyGuardianEndpointCommitment(metadata.newGuardianEndpoint, metadata.newGuardianPubkey);
|
|
699
749
|
}
|
|
700
750
|
const executionSalt = Word.fromHex(normalizeHexWord(saltHex));
|
|
701
751
|
const finalRequest = await this.buildTransactionRequestFromMetadata(metadata, executionSalt, adviceMap);
|
|
702
|
-
|
|
703
|
-
const result = await this.webClient.executeTransaction(accountId, finalRequest);
|
|
704
|
-
const proven = await this.webClient.proveTransaction(result, null);
|
|
705
|
-
const submissionHeight = await this.webClient.submitProvenTransaction(proven, result);
|
|
706
|
-
await this.webClient.applyTransaction(result, submissionHeight);
|
|
707
|
-
if (metadata.proposalType === 'switch_guardian') {
|
|
708
|
-
if (!metadata.newGuardianEndpoint || !metadata.newGuardianPubkey) {
|
|
709
|
-
throw new Error('Switch GUARDIAN proposal metadata is incomplete after execution');
|
|
710
|
-
}
|
|
711
|
-
try {
|
|
712
|
-
await this.webClient.syncState();
|
|
713
|
-
const updatedAccount = await this.webClient.getAccount(accountId);
|
|
714
|
-
if (!updatedAccount) {
|
|
715
|
-
throw new Error(`Updated account ${this._accountId} is missing from local client`);
|
|
716
|
-
}
|
|
717
|
-
const updatedStateBase64 = uint8ArrayToBase64(updatedAccount.serialize());
|
|
718
|
-
const nextGuardian = new GuardianHttpClient(metadata.newGuardianEndpoint);
|
|
719
|
-
this.setGuardianClient(nextGuardian);
|
|
720
|
-
this.guardianPublicKey = metadata.newGuardianPubkey;
|
|
721
|
-
await this.registerOnGuardian(updatedStateBase64);
|
|
722
|
-
}
|
|
723
|
-
catch (error) {
|
|
724
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
725
|
-
throw new Error(`Transaction executed successfully but failed to register on new GUARDIAN: ${message}`);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
proposal.status = 'finalized';
|
|
752
|
+
return { finalRequest, metadata, proposal };
|
|
729
753
|
}
|
|
730
754
|
/**
|
|
731
755
|
* Export a proposal for offline signing
|
|
@@ -864,7 +888,8 @@ export class Multisig {
|
|
|
864
888
|
? Word.fromHex(normalizeHexWord(proposal.metadata.saltHex))
|
|
865
889
|
: summary.salt();
|
|
866
890
|
const request = await this.buildTransactionRequestFromMetadata(proposal.metadata, salt);
|
|
867
|
-
const
|
|
891
|
+
const webClient = await this.getRawClient();
|
|
892
|
+
const reconstructed = await executeForSummary(webClient, this._accountId, request);
|
|
868
893
|
const reconstructedCommitment = normalizeHexWord(reconstructed.toCommitment().toHex());
|
|
869
894
|
if (reconstructedCommitment !== txSummaryCommitment) {
|
|
870
895
|
throw new Error(`Invalid proposal: metadata does not match tx_summary for ${proposal.id}`);
|
|
@@ -872,23 +897,24 @@ export class Multisig {
|
|
|
872
897
|
return txSummaryCommitment;
|
|
873
898
|
}
|
|
874
899
|
async buildTransactionRequestFromMetadata(metadata, salt, signatureAdviceMap) {
|
|
900
|
+
const webClient = await this.getRawClient();
|
|
875
901
|
switch (metadata.proposalType) {
|
|
876
902
|
case 'add_signer':
|
|
877
903
|
case 'remove_signer':
|
|
878
904
|
case 'change_threshold': {
|
|
879
|
-
const { request } = await buildUpdateSignersTransactionRequest(
|
|
905
|
+
const { request } = await buildUpdateSignersTransactionRequest(webClient, metadata.targetThreshold, metadata.targetSignerCommitments, { salt, signatureAdviceMap, signatureScheme: this.signer.scheme });
|
|
880
906
|
return request;
|
|
881
907
|
}
|
|
882
908
|
case 'switch_guardian': {
|
|
883
|
-
const { request } = await buildUpdateGuardianTransactionRequest(
|
|
909
|
+
const { request } = await buildUpdateGuardianTransactionRequest(webClient, metadata.newGuardianPubkey, { salt, signatureAdviceMap, signatureScheme: this.signer.scheme });
|
|
884
910
|
return request;
|
|
885
911
|
}
|
|
886
912
|
case 'update_procedure_threshold': {
|
|
887
|
-
const { request } = await buildUpdateProcedureThresholdTransactionRequest(
|
|
913
|
+
const { request } = await buildUpdateProcedureThresholdTransactionRequest(webClient, metadata.targetProcedure, metadata.targetThreshold, { salt, signatureAdviceMap, signatureScheme: this.signer.scheme });
|
|
888
914
|
return request;
|
|
889
915
|
}
|
|
890
916
|
case 'consume_notes': {
|
|
891
|
-
const { request } = await buildConsumeNotesTransactionRequest(
|
|
917
|
+
const { request } = await buildConsumeNotesTransactionRequest(webClient, metadata.noteIds, { salt, signatureAdviceMap });
|
|
892
918
|
return request;
|
|
893
919
|
}
|
|
894
920
|
case 'p2id': {
|