@openzeppelin/miden-multisig-client 0.17.0 → 0.18.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -46
- package/dist/account/builder.d.ts +4 -4
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +17 -7
- package/dist/account/builder.js.map +1 -1
- package/dist/account/layout.d.ts +5 -5
- package/dist/account/layout.d.ts.map +1 -1
- package/dist/account/layout.js +5 -5
- package/dist/account/layout.js.map +1 -1
- package/dist/client.d.ts +18 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +79 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/multisig/authArgErrors.d.ts +28 -31
- package/dist/multisig/authArgErrors.d.ts.map +1 -1
- package/dist/multisig/authArgErrors.js +42 -46
- package/dist/multisig/authArgErrors.js.map +1 -1
- package/dist/multisig/consumeNotesErrors.d.ts +13 -1
- package/dist/multisig/consumeNotesErrors.d.ts.map +1 -1
- package/dist/multisig/consumeNotesErrors.js +17 -0
- package/dist/multisig/consumeNotesErrors.js.map +1 -1
- package/dist/multisig/signing.d.ts +1 -1
- package/dist/multisig/signing.d.ts.map +1 -1
- package/dist/multisig/signing.js +8 -3
- package/dist/multisig/signing.js.map +1 -1
- package/dist/multisig.d.ts +145 -18
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +493 -162
- package/dist/multisig.js.map +1 -1
- package/dist/procedures.d.ts +7 -7
- package/dist/procedures.js +7 -7
- package/dist/proposal/factory.d.ts.map +1 -1
- package/dist/proposal/factory.js +7 -0
- package/dist/proposal/factory.js.map +1 -1
- package/dist/prover/workflow.d.ts +7 -3
- package/dist/prover/workflow.d.ts.map +1 -1
- package/dist/prover/workflow.js +7 -5
- package/dist/prover/workflow.js.map +1 -1
- package/dist/raw-client.d.ts +1 -0
- package/dist/raw-client.d.ts.map +1 -1
- package/dist/raw-client.js +10 -2
- package/dist/raw-client.js.map +1 -1
- package/dist/recovery/publicNoteBackfill.js +1 -1
- package/dist/recovery/publicNoteBackfill.js.map +1 -1
- package/dist/retry/classify.d.ts +3 -0
- package/dist/retry/classify.d.ts.map +1 -1
- package/dist/retry/classify.js +2 -2
- package/dist/retry/classify.js.map +1 -1
- package/dist/signer.d.ts +1 -0
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +1 -0
- package/dist/signer.js.map +1 -1
- package/dist/signers/index.d.ts +1 -0
- package/dist/signers/index.d.ts.map +1 -1
- package/dist/signers/index.js +1 -0
- package/dist/signers/index.js.map +1 -1
- package/dist/signers/ledger.d.ts +25 -0
- package/dist/signers/ledger.d.ts.map +1 -0
- package/dist/signers/ledger.js +96 -0
- package/dist/signers/ledger.js.map +1 -0
- package/dist/state/adopt.d.ts +45 -0
- package/dist/state/adopt.d.ts.map +1 -0
- package/dist/state/adopt.js +101 -0
- package/dist/state/adopt.js.map +1 -0
- package/dist/transaction/authArgs.d.ts +57 -0
- package/dist/transaction/authArgs.d.ts.map +1 -0
- package/dist/transaction/authArgs.js +108 -0
- package/dist/transaction/authArgs.js.map +1 -0
- package/dist/transaction/consumeNotes.d.ts +9 -5
- package/dist/transaction/consumeNotes.d.ts.map +1 -1
- package/dist/transaction/consumeNotes.js +8 -23
- package/dist/transaction/consumeNotes.js.map +1 -1
- package/dist/transaction/noteAuthentication.d.ts +39 -0
- package/dist/transaction/noteAuthentication.d.ts.map +1 -0
- package/dist/transaction/noteAuthentication.js +94 -0
- package/dist/transaction/noteAuthentication.js.map +1 -0
- package/dist/transaction/options.d.ts +25 -0
- package/dist/transaction/options.d.ts.map +1 -1
- package/dist/transaction/p2id.d.ts +3 -2
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +36 -27
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/summary.d.ts +126 -22
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js +164 -22
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/updateGuardian.d.ts +3 -3
- package/dist/transaction/updateGuardian.d.ts.map +1 -1
- package/dist/transaction/updateGuardian.js +5 -16
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.d.ts +3 -3
- package/dist/transaction/updateProcedureThreshold.d.ts.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js +6 -16
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.d.ts +3 -3
- package/dist/transaction/updateSigners.d.ts.map +1 -1
- package/dist/transaction/updateSigners.js +9 -16
- package/dist/transaction/updateSigners.js.map +1 -1
- package/dist/transaction.d.ts +3 -2
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +3 -2
- package/dist/transaction.js.map +1 -1
- package/dist/types/proposal.d.ts +37 -5
- package/dist/types/proposal.d.ts.map +1 -1
- package/dist/types/proposal.js +8 -0
- package/dist/types/proposal.js.map +1 -1
- package/dist/utils/eip712.d.ts +80 -0
- package/dist/utils/eip712.d.ts.map +1 -0
- package/dist/utils/eip712.js +49 -0
- package/dist/utils/eip712.js.map +1 -0
- package/dist/utils/signature.d.ts +4 -0
- package/dist/utils/signature.d.ts.map +1 -1
- package/dist/utils/signature.js +49 -1
- package/dist/utils/signature.js.map +1 -1
- package/package.json +11 -6
- package/src/account/builder.ts +18 -7
- package/src/account/layout.ts +5 -5
- package/src/client.ts +94 -6
- package/src/index.ts +24 -3
- package/src/multisig/authArgErrors.ts +47 -53
- package/src/multisig/consumeNotesErrors.ts +20 -1
- package/src/multisig/signing.ts +8 -2
- package/src/multisig.ts +614 -205
- package/src/procedures.ts +7 -7
- package/src/proposal/factory.ts +7 -0
- package/src/prover/workflow.ts +7 -10
- package/src/raw-client.ts +11 -7
- package/src/recovery/publicNoteBackfill.ts +1 -1
- package/src/retry/classify.ts +3 -3
- package/src/signer.ts +1 -0
- package/src/signers/index.ts +1 -0
- package/src/signers/ledger.ts +122 -0
- package/src/state/adopt.ts +132 -0
- package/src/transaction/authArgs.ts +142 -0
- package/src/transaction/consumeNotes.ts +23 -30
- package/src/transaction/noteAuthentication.ts +136 -0
- package/src/transaction/options.ts +27 -0
- package/src/transaction/p2id.ts +45 -34
- package/src/transaction/summary.ts +239 -30
- package/src/transaction/updateGuardian.ts +8 -22
- package/src/transaction/updateProcedureThreshold.ts +8 -20
- package/src/transaction/updateSigners.ts +11 -22
- package/src/transaction.ts +18 -1
- package/src/types/proposal.ts +36 -5
- package/src/utils/eip712.ts +57 -0
- package/src/utils/signature.ts +57 -0
- package/src/prover/test-node.d.ts +0 -6
|
@@ -1,19 +1,142 @@
|
|
|
1
1
|
import { AccountId, ChainAnchor, Word } from '@miden-sdk/miden-sdk';
|
|
2
|
+
import { BoundBlockNotDeclaredError } from '../multisig/authArgErrors.js';
|
|
2
3
|
import { getRawMidenClient } from '../raw-client.js';
|
|
3
|
-
import { base64ToUint8Array, uint8ArrayToBase64 } from '../utils/encoding.js';
|
|
4
|
+
import { base64ToUint8Array, normalizeHexWord, uint8ArrayToBase64 } from '../utils/encoding.js';
|
|
5
|
+
import { requestBoundBlockNum } from './authArgs.js';
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* Layout of the six user params a multisig auth component binds into the
|
|
8
|
+
* transaction summary since protocol 0.17: the approval expiration block (or
|
|
9
|
+
* zero for an approval that never expires), a zero, then the four salt felts.
|
|
8
10
|
*/
|
|
9
|
-
const
|
|
11
|
+
const APPROVAL_EXPIRATION_USER_PARAM_INDEX = 0;
|
|
12
|
+
const SALT_USER_PARAM_OFFSET = 2;
|
|
13
|
+
/**
|
|
14
|
+
* The summary binds the block the request's auth args name, and the anchor
|
|
15
|
+
* the store's sync height at capture. A sync landing between the build and the
|
|
16
|
+
* capture leaves them one block apart, and every cosigner's anchor check would
|
|
17
|
+
* then fail on a proposal nothing else is wrong with. Caught here, before the
|
|
18
|
+
* proposal is pushed, so the proposer rebuilds instead.
|
|
19
|
+
*/
|
|
20
|
+
export class SummaryAnchorMismatchError extends Error {
|
|
21
|
+
retryable = true;
|
|
22
|
+
constructor(details) {
|
|
23
|
+
super(`the transaction summary binds block commitment ${details.summaryBlockCommitmentHex} but ` +
|
|
24
|
+
`the captured chain anchor is ${details.anchorCommitmentHex}; a sync landed between ` +
|
|
25
|
+
'building the request and capturing its anchor, so rebuild the request and retry');
|
|
26
|
+
this.name = 'SummaryAnchorMismatchError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The Miden client synced and its node still has not produced the block a
|
|
31
|
+
* proposal binds, so the proposal cannot execute at this client's tip yet.
|
|
32
|
+
* Worth retrying once the node catches up.
|
|
33
|
+
*/
|
|
34
|
+
export class ChainBehindBoundBlockError extends Error {
|
|
35
|
+
retryable = true;
|
|
36
|
+
syncHeight;
|
|
37
|
+
boundBlockNum;
|
|
38
|
+
constructor(details) {
|
|
39
|
+
super(`the Miden client synced to block ${details.syncHeight}, below block ` +
|
|
40
|
+
`${details.boundBlockNum} the proposal binds; its node has not reached that block yet`);
|
|
41
|
+
this.name = 'ChainBehindBoundBlockError';
|
|
42
|
+
this.syncHeight = details.syncHeight;
|
|
43
|
+
this.boundBlockNum = details.boundBlockNum;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Whether a failed re-execution came from chain state this client can catch up
|
|
48
|
+
* with rather than from the proposal itself: a node that has not reached the
|
|
49
|
+
* bound block yet, or account state the node pruned because this client had
|
|
50
|
+
* not synced recently. Either clears on a later attempt, which syncs first.
|
|
51
|
+
*/
|
|
52
|
+
export function isStaleChainError(error) {
|
|
53
|
+
if (error instanceof ChainBehindBoundBlockError) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
return message.includes('has been pruned');
|
|
58
|
+
}
|
|
10
59
|
export async function executeForSummary(client, accountId, txRequest, midenRpcEndpoint) {
|
|
11
|
-
const acc = AccountId.fromHex(accountId);
|
|
12
60
|
const rawClient = await getRawMidenClient(client, midenRpcEndpoint);
|
|
13
61
|
const anchor = await rawClient.chainAnchorForRequest(txRequest);
|
|
14
|
-
|
|
62
|
+
let summary;
|
|
63
|
+
try {
|
|
64
|
+
summary = await executeForSummaryAtTip(rawClient, accountId, txRequest);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
anchor.free();
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
const anchorCommitment = anchor.commitment();
|
|
71
|
+
const summaryBlockCommitment = summary.blockCommitment();
|
|
72
|
+
const anchorCommitmentHex = normalizeHexWord(anchorCommitment.toHex());
|
|
73
|
+
const summaryBlockCommitmentHex = normalizeHexWord(summaryBlockCommitment.toHex());
|
|
74
|
+
anchorCommitment.free?.();
|
|
75
|
+
summaryBlockCommitment.free?.();
|
|
76
|
+
if (anchorCommitmentHex !== summaryBlockCommitmentHex) {
|
|
77
|
+
anchor.free();
|
|
78
|
+
throw new SummaryAnchorMismatchError({ anchorCommitmentHex, summaryBlockCommitmentHex });
|
|
79
|
+
}
|
|
15
80
|
return { summary, anchor };
|
|
16
81
|
}
|
|
82
|
+
export async function executeForSummaryAtTip(client, accountId, txRequest, midenRpcEndpoint) {
|
|
83
|
+
const rawClient = await getRawMidenClient(client, midenRpcEndpoint);
|
|
84
|
+
await prepareTipExecution(rawClient, txRequest);
|
|
85
|
+
return rawClient.executeForSummary(AccountId.fromHex(accountId), txRequest);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets `client` ready to execute `request` at the chain tip: checks the
|
|
89
|
+
* request declares the block its multisig auth args bind, and syncs to that
|
|
90
|
+
* block (see {@link syncToBoundBlock}).
|
|
91
|
+
*
|
|
92
|
+
* @throws BoundBlockNotDeclaredError when the request binds a block in its
|
|
93
|
+
* multisig auth args without declaring it.
|
|
94
|
+
*/
|
|
95
|
+
export async function prepareTipExecution(client, request, syncState) {
|
|
96
|
+
const boundBlockNum = requireDeclaredBoundBlock(request);
|
|
97
|
+
if (boundBlockNum !== undefined) {
|
|
98
|
+
await syncToBoundBlock(client, boundBlockNum, syncState);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The block `request`'s multisig auth args bind, after checking the request
|
|
103
|
+
* declares it. `undefined` for a request without multisig auth args, which
|
|
104
|
+
* has no bound block to declare.
|
|
105
|
+
*
|
|
106
|
+
* @throws BoundBlockNotDeclaredError when the block is bound but not declared.
|
|
107
|
+
*/
|
|
108
|
+
export function requireDeclaredBoundBlock(request) {
|
|
109
|
+
const boundBlockNum = requestBoundBlockNum(request);
|
|
110
|
+
if (boundBlockNum !== undefined && !request.blockNumbers().includes(boundBlockNum)) {
|
|
111
|
+
throw new BoundBlockNotDeclaredError(boundBlockNum);
|
|
112
|
+
}
|
|
113
|
+
return boundBlockNum;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Syncs `client` once when its sync height is below `blockNum`, the block a
|
|
117
|
+
* proposal binds. Execution at a tip below it fails with "requested block N is
|
|
118
|
+
* after transaction reference block M", and a store that has never synced (a
|
|
119
|
+
* cosigner that has only just loaded the account) holds no header to rebuild
|
|
120
|
+
* the request from. `syncState` lets a caller wrap the sync in its own retry
|
|
121
|
+
* policy.
|
|
122
|
+
*
|
|
123
|
+
* This does not make a store that is already past the bound block current. An
|
|
124
|
+
* execution loads foreign accounts, the fee faucet among them, at the store's
|
|
125
|
+
* sync height, which a node prunes about 50 blocks later, so the multisig
|
|
126
|
+
* entry points that re-execute a proposal sync the chain first.
|
|
127
|
+
*
|
|
128
|
+
* @throws ChainBehindBoundBlockError when the node has not reached the block.
|
|
129
|
+
*/
|
|
130
|
+
export async function syncToBoundBlock(client, blockNum, syncState = () => client.syncState()) {
|
|
131
|
+
if ((await client.getSyncHeight()) >= blockNum) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
await syncState();
|
|
135
|
+
const syncHeight = await client.getSyncHeight();
|
|
136
|
+
if (syncHeight < blockNum) {
|
|
137
|
+
throw new ChainBehindBoundBlockError({ syncHeight, boundBlockNum: blockNum });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
17
140
|
export async function executeForSummaryAt(client, accountId, txRequest, anchor, midenRpcEndpoint) {
|
|
18
141
|
const acc = AccountId.fromHex(accountId);
|
|
19
142
|
const rawClient = await getRawMidenClient(client, midenRpcEndpoint);
|
|
@@ -29,26 +152,45 @@ export function chainAnchorToBase64(anchor) {
|
|
|
29
152
|
* Deserializes a `ChainAnchor` from its base64 wire form. `ChainAnchor`
|
|
30
153
|
* deserialization validates the header/chain consistency internally, so a
|
|
31
154
|
* decoded anchor only needs its block commitment checked against the signed
|
|
32
|
-
* transaction summary before it is
|
|
155
|
+
* transaction summary before the block it names is taken as the one the
|
|
156
|
+
* summary binds.
|
|
33
157
|
*/
|
|
34
158
|
export function chainAnchorFromBase64(anchorBase64) {
|
|
35
159
|
return ChainAnchor.deserialize(base64ToUint8Array(anchorBase64));
|
|
36
160
|
}
|
|
37
161
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
162
|
+
* The block a proposal's `chainAnchor` names, which is the block its summary
|
|
163
|
+
* binds: a custom producer rebuilds its request at this block. Decodes the
|
|
164
|
+
* anchor for the one number and frees it.
|
|
165
|
+
*/
|
|
166
|
+
export function chainAnchorBlockNum(anchorBase64) {
|
|
167
|
+
const anchor = chainAnchorFromBase64(anchorBase64);
|
|
168
|
+
try {
|
|
169
|
+
return anchor.blockNum();
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
anchor.free();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Reads the salt a multisig transaction summary binds.
|
|
44
177
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
export function
|
|
52
|
-
return Word.newFromFelts(summary.userParams().slice(
|
|
178
|
+
* Since protocol 0.17 the multisig auth components bind the salt itself into
|
|
179
|
+
* the summary's user params rather than a commitment derived from it, so the
|
|
180
|
+
* value cosigners signed over is readable again. A proposal still carries the
|
|
181
|
+
* salt in its metadata, because a request has to be rebuilt before any summary
|
|
182
|
+
* exists; this reader is the cross-check that the two agree.
|
|
183
|
+
*/
|
|
184
|
+
export function summarySalt(summary) {
|
|
185
|
+
return Word.newFromFelts(summary.userParams().slice(SALT_USER_PARAM_OFFSET, SALT_USER_PARAM_OFFSET + 4));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Reads the block at which the approvers' signatures stop authorizing the
|
|
189
|
+
* transaction, or `undefined` for an approval that never expires, which is
|
|
190
|
+
* what this package's builders produce.
|
|
191
|
+
*/
|
|
192
|
+
export function summaryApprovalExpirationBlockNum(summary) {
|
|
193
|
+
const value = summary.userParams()[APPROVAL_EXPIRATION_USER_PARAM_INDEX].asInt();
|
|
194
|
+
return value === 0n ? undefined : Number(value);
|
|
53
195
|
}
|
|
54
196
|
//# sourceMappingURL=summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/transaction/summary.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/transaction/summary.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,M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sB,GAAG,CAAC,CAAC,CAC/E,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAAC,OAA2B;IAC3E,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,oCAAoC,CAAC,CAAC,KAAK,EAAE,CAAC;IACjF,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type MidenClient, TransactionRequest, type WasmWebClient, Word } from '@miden-sdk/miden-sdk';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function buildUpdateGuardianTransactionRequest(client: MidenClient, newGuardianPubkey: string, options:
|
|
2
|
+
import type { MidenClientMultisigRequestOptions, MultisigRequestOptions } from './options.js';
|
|
3
|
+
export declare function buildUpdateGuardianTransactionRequest(client: MidenClient, newGuardianPubkey: string, options: MidenClientMultisigRequestOptions): Promise<{
|
|
4
4
|
request: TransactionRequest;
|
|
5
5
|
salt: Word;
|
|
6
6
|
}>;
|
|
7
|
-
export declare function buildUpdateGuardianTransactionRequest(client: WasmWebClient, newGuardianPubkey: string, options
|
|
7
|
+
export declare function buildUpdateGuardianTransactionRequest(client: WasmWebClient, newGuardianPubkey: string, options: MultisigRequestOptions): Promise<{
|
|
8
8
|
request: TransactionRequest;
|
|
9
9
|
salt: Word;
|
|
10
10
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateGuardian.d.ts","sourceRoot":"","sources":["../../src/transaction/updateGuardian.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"updateGuardian.d.ts","sourceRoot":"","sources":["../../src/transaction/updateGuardian.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,kBAAkB,EAElB,KAAK,aAAa,EAClB,IAAI,EACL,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AA8B9F,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,WAAW,EACnB,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AACxD,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { TransactionRequestBuilder, Word as WordType, } from '@miden-sdk/miden-sdk';
|
|
2
1
|
import { compileTxScript } from '../raw-client.js';
|
|
3
2
|
import { normalizeHexWord } from '../utils/encoding.js';
|
|
4
|
-
import { randomWord } from '../utils/random.js';
|
|
5
3
|
import { authSchemeId } from '../utils/signature.js';
|
|
4
|
+
import { buildMultisigRequest, multisigRequestBuilder } from './authArgs.js';
|
|
6
5
|
async function buildUpdateGuardianScript(client, newGuardianPubkey, signatureScheme, midenRpcEndpoint) {
|
|
7
6
|
// A word literal preserves the key's element order on the operand stack.
|
|
8
7
|
const keyLiteral = normalizeHexWord(newGuardianPubkey);
|
|
@@ -22,24 +21,14 @@ end
|
|
|
22
21
|
`;
|
|
23
22
|
return compileTxScript(client, scriptSource, [], midenRpcEndpoint);
|
|
24
23
|
}
|
|
25
|
-
export async function buildUpdateGuardianTransactionRequest(client, newGuardianPubkey, options
|
|
24
|
+
export async function buildUpdateGuardianTransactionRequest(client, newGuardianPubkey, options) {
|
|
26
25
|
const signatureScheme = options.signatureScheme ?? 'falcon';
|
|
27
26
|
const script = await buildUpdateGuardianScript(client, newGuardianPubkey, signatureScheme, options.midenRpcEndpoint);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
let txBuilder = new TransactionRequestBuilder();
|
|
31
|
-
txBuilder = txBuilder.withCustomScript(script);
|
|
32
|
-
txBuilder = txBuilder.withFeeConversionSalt(authSaltForBuilder);
|
|
33
|
-
// Borrows rather than consumes: the glue passes `__wbg_ptr` without taking it,
|
|
34
|
-
// so the handle stays ours to release once the builder has read it.
|
|
35
|
-
authSaltForBuilder.free?.();
|
|
27
|
+
const { builder, saltHex } = await multisigRequestBuilder(client, options);
|
|
28
|
+
let txBuilder = builder.withCustomScript(script);
|
|
36
29
|
if (options.signatureAdviceMap) {
|
|
37
30
|
txBuilder = txBuilder.extendAdviceMap(options.signatureAdviceMap);
|
|
38
31
|
}
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
request: txBuilder.build(),
|
|
42
|
-
salt: authSaltForReturn,
|
|
43
|
-
};
|
|
32
|
+
return buildMultisigRequest(txBuilder, saltHex, options.accountId);
|
|
44
33
|
}
|
|
45
34
|
//# sourceMappingURL=updateGuardian.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateGuardian.js","sourceRoot":"","sources":["../../src/transaction/updateGuardian.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateGuardian.js","sourceRoot":"","sources":["../../src/transaction/updateGuardian.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAI7E,KAAK,UAAU,yBAAyB,CACtC,MAAmC,EACnC,iBAAyB,EACzB,eAAgC,EAChC,gBAAyB;IAEzB,yEAAyE;IACzE,MAAM,UAAU,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;IAE/C,qFAAqF;IACrF,MAAM,YAAY,GAAG;;;;;WAKZ,UAAU;WACV,QAAQ;;;;;GAKhB,CAAC;IAEF,OAAO,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,gBAAgB,CAAC,CAAC;AACrE,CAAC;AAYD,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,MAAmC,EACnC,iBAAyB,EACzB,OAA+B;IAE/B,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,QAAQ,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAC5C,MAAM,EACN,iBAAiB,EACjB,eAAe,EACf,OAAO,CAAC,gBAAgB,CACzB,CAAC;IAEF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3E,IAAI,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC/B,SAAS,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type MidenClient, TransactionRequest, type WasmWebClient, Word } from '@miden-sdk/miden-sdk';
|
|
2
2
|
import { type ProcedureName } from '../procedures.js';
|
|
3
|
-
import type {
|
|
4
|
-
export declare function buildUpdateProcedureThresholdTransactionRequest(client: MidenClient, procedure: ProcedureName, threshold: number, options:
|
|
3
|
+
import type { MidenClientMultisigRequestOptions, MultisigRequestOptions } from './options.js';
|
|
4
|
+
export declare function buildUpdateProcedureThresholdTransactionRequest(client: MidenClient, procedure: ProcedureName, threshold: number, options: MidenClientMultisigRequestOptions): Promise<{
|
|
5
5
|
request: TransactionRequest;
|
|
6
6
|
salt: Word;
|
|
7
7
|
configHash: Word;
|
|
8
8
|
}>;
|
|
9
|
-
export declare function buildUpdateProcedureThresholdTransactionRequest(client: WasmWebClient, procedure: ProcedureName, threshold: number, options
|
|
9
|
+
export declare function buildUpdateProcedureThresholdTransactionRequest(client: WasmWebClient, procedure: ProcedureName, threshold: number, options: MultisigRequestOptions): Promise<{
|
|
10
10
|
request: TransactionRequest;
|
|
11
11
|
salt: Word;
|
|
12
12
|
configHash: Word;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateProcedureThreshold.d.ts","sourceRoot":"","sources":["../../src/transaction/updateProcedureThreshold.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEhB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"updateProcedureThreshold.d.ts","sourceRoot":"","sources":["../../src/transaction/updateProcedureThreshold.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEhB,kBAAkB,EAElB,KAAK,aAAa,EAClB,IAAI,EAEL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIxE,OAAO,KAAK,EAAE,iCAAiC,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAgD9F,wBAAgB,+CAA+C,CAC7D,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAC1E,wBAAgB,+CAA+C,CAC7D,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Felt, FeltArray, Poseidon2,
|
|
1
|
+
import { Felt, FeltArray, Poseidon2, Word as WordType, } from '@miden-sdk/miden-sdk';
|
|
2
2
|
import { getProcedureRoot } from '../procedures.js';
|
|
3
3
|
import { compileTxScript } from '../raw-client.js';
|
|
4
4
|
import { normalizeHexWord } from '../utils/encoding.js';
|
|
5
|
-
import {
|
|
5
|
+
import { buildMultisigRequest, multisigRequestBuilder } from './authArgs.js';
|
|
6
6
|
function buildProcedureThresholdFelts(procedure, threshold) {
|
|
7
7
|
const procedureRoot = WordType.fromHex(normalizeHexWord(getProcedureRoot(procedure)));
|
|
8
8
|
return [
|
|
@@ -37,24 +37,14 @@ end
|
|
|
37
37
|
`;
|
|
38
38
|
return compileTxScript(client, scriptSource, [], midenRpcEndpoint);
|
|
39
39
|
}
|
|
40
|
-
export async function buildUpdateProcedureThresholdTransactionRequest(client, procedure, threshold, options
|
|
40
|
+
export async function buildUpdateProcedureThresholdTransactionRequest(client, procedure, threshold, options) {
|
|
41
41
|
const configHash = buildProcedureThresholdConfigHash(procedure, threshold);
|
|
42
42
|
const script = await buildUpdateProcedureThresholdScript(client, procedure, threshold, options.midenRpcEndpoint);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
let txBuilder = new TransactionRequestBuilder();
|
|
46
|
-
txBuilder = txBuilder.withCustomScript(script);
|
|
47
|
-
txBuilder = txBuilder.withFeeConversionSalt(authSalt);
|
|
48
|
-
// Borrows rather than consumes: the glue passes `__wbg_ptr` without taking it,
|
|
49
|
-
// so the handle stays ours to release once the builder has read it.
|
|
50
|
-
authSalt.free?.();
|
|
43
|
+
const { builder, saltHex } = await multisigRequestBuilder(client, options);
|
|
44
|
+
let txBuilder = builder.withCustomScript(script);
|
|
51
45
|
if (options.signatureAdviceMap) {
|
|
52
46
|
txBuilder = txBuilder.extendAdviceMap(options.signatureAdviceMap);
|
|
53
47
|
}
|
|
54
|
-
return {
|
|
55
|
-
request: txBuilder.build(),
|
|
56
|
-
salt: WordType.fromHex(normalizeHexWord(authSaltHex)),
|
|
57
|
-
configHash,
|
|
58
|
-
};
|
|
48
|
+
return { ...buildMultisigRequest(txBuilder, saltHex, options.accountId), configHash };
|
|
59
49
|
}
|
|
60
50
|
//# sourceMappingURL=updateProcedureThreshold.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateProcedureThreshold.js","sourceRoot":"","sources":["../../src/transaction/updateProcedureThreshold.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EAET,SAAS,
|
|
1
|
+
{"version":3,"file":"updateProcedureThreshold.js","sourceRoot":"","sources":["../../src/transaction/updateProcedureThreshold.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EAET,SAAS,EAKT,IAAI,IAAI,QAAQ,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAG7E,SAAS,4BAA4B,CAAC,SAAwB,EAAE,SAAiB;IAC/E,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtF,OAAO;QACL,GAAG,aAAa,CAAC,OAAO,EAAE;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,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E,GAAG,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC;AACxF,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { FeltArray, type MidenClient, TransactionRequest, type WasmWebClient, Word } from '@miden-sdk/miden-sdk';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MidenClientMultisigRequestOptions, MultisigRequestOptions } from './options.js';
|
|
3
3
|
import type { SignatureScheme } from '../types.js';
|
|
4
4
|
export declare function buildMultisigConfigAdvice(threshold: number, signerCommitments: string[], signatureScheme: SignatureScheme): {
|
|
5
5
|
configHash: Word;
|
|
6
6
|
payload: FeltArray;
|
|
7
7
|
};
|
|
8
|
-
export declare function buildUpdateSignersTransactionRequest(client: MidenClient, threshold: number, signerCommitments: string[], options:
|
|
8
|
+
export declare function buildUpdateSignersTransactionRequest(client: MidenClient, threshold: number, signerCommitments: string[], options: MidenClientMultisigRequestOptions): Promise<{
|
|
9
9
|
request: TransactionRequest;
|
|
10
10
|
salt: Word;
|
|
11
11
|
configHash: Word;
|
|
12
12
|
}>;
|
|
13
|
-
export declare function buildUpdateSignersTransactionRequest(client: WasmWebClient, threshold: number, signerCommitments: string[], options
|
|
13
|
+
export declare function buildUpdateSignersTransactionRequest(client: WasmWebClient, threshold: number, signerCommitments: string[], options: MultisigRequestOptions): Promise<{
|
|
14
14
|
request: TransactionRequest;
|
|
15
15
|
salt: Word;
|
|
16
16
|
configHash: Word;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateSigners.d.ts","sourceRoot":"","sources":["../../src/transaction/updateSigners.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EACT,KAAK,WAAW,EAEhB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"updateSigners.d.ts","sourceRoot":"","sources":["../../src/transaction/updateSigners.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EACT,KAAK,WAAW,EAEhB,kBAAkB,EAElB,KAAK,aAAa,EAClB,IAAI,EAEL,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAwBnD,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EAAE,EAC3B,eAAe,EAAE,eAAe,GAC/B;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAW1C;AAkBD,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EAAE,EAC3B,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAC1E,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EAAE,EAC3B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AdviceMap, Felt, FeltArray, Poseidon2,
|
|
1
|
+
import { AdviceMap, Felt, FeltArray, Poseidon2, Word as WordType, } from '@miden-sdk/miden-sdk';
|
|
2
2
|
import { compileTxScript } from '../raw-client.js';
|
|
3
3
|
import { normalizeHexWord } from '../utils/encoding.js';
|
|
4
|
-
import { randomWord } from '../utils/random.js';
|
|
5
4
|
import { authSchemeId } from '../utils/signature.js';
|
|
5
|
+
import { buildMultisigRequest, multisigRequestBuilder } from './authArgs.js';
|
|
6
6
|
function buildMultisigConfigFelts(threshold, signerCommitments, signatureScheme) {
|
|
7
7
|
const numApprovers = signerCommitments.length;
|
|
8
8
|
const schemeId = authSchemeId(signatureScheme);
|
|
@@ -39,7 +39,7 @@ end
|
|
|
39
39
|
`;
|
|
40
40
|
return compileTxScript(client, scriptSource, [], midenRpcEndpoint);
|
|
41
41
|
}
|
|
42
|
-
export async function buildUpdateSignersTransactionRequest(client, threshold, signerCommitments, options
|
|
42
|
+
export async function buildUpdateSignersTransactionRequest(client, threshold, signerCommitments, options) {
|
|
43
43
|
const signatureScheme = options.signatureScheme ?? 'falcon';
|
|
44
44
|
const { configHash: configHashForAdvice, payload } = buildMultisigConfigAdvice(threshold, signerCommitments, signatureScheme);
|
|
45
45
|
const { configHash: configHashForScript } = buildMultisigConfigAdvice(threshold, signerCommitments, signatureScheme);
|
|
@@ -47,23 +47,16 @@ export async function buildUpdateSignersTransactionRequest(client, threshold, si
|
|
|
47
47
|
const advice = new AdviceMap();
|
|
48
48
|
advice.insert(configHashForAdvice, payload);
|
|
49
49
|
const script = await buildUpdateSignersScript(client, options.midenRpcEndpoint);
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
txBuilder = txBuilder.extendAdviceMap(advice);
|
|
56
|
-
txBuilder = txBuilder.withFeeConversionSalt(authSaltForBuilder);
|
|
57
|
-
// Borrows rather than consumes: the glue passes `__wbg_ptr` without taking it,
|
|
58
|
-
// so the handle stays ours to release once the builder has read it.
|
|
59
|
-
authSaltForBuilder.free?.();
|
|
50
|
+
const { builder, saltHex } = await multisigRequestBuilder(client, options);
|
|
51
|
+
let txBuilder = builder
|
|
52
|
+
.withCustomScript(script)
|
|
53
|
+
.withScriptArg(configHashForScript)
|
|
54
|
+
.extendAdviceMap(advice);
|
|
60
55
|
if (options.signatureAdviceMap) {
|
|
61
56
|
txBuilder = txBuilder.extendAdviceMap(options.signatureAdviceMap);
|
|
62
57
|
}
|
|
63
|
-
const authSaltForReturn = WordType.fromHex(normalizeHexWord(authSaltHex));
|
|
64
58
|
return {
|
|
65
|
-
|
|
66
|
-
salt: authSaltForReturn,
|
|
59
|
+
...buildMultisigRequest(txBuilder, saltHex, options.accountId),
|
|
67
60
|
configHash: configHashForReturn,
|
|
68
61
|
};
|
|
69
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateSigners.js","sourceRoot":"","sources":["../../src/transaction/updateSigners.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EAET,SAAS,
|
|
1
|
+
{"version":3,"file":"updateSigners.js","sourceRoot":"","sources":["../../src/transaction/updateSigners.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EAET,SAAS,EAKT,IAAI,IAAI,QAAQ,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAI7E,SAAS,wBAAwB,CAC/B,SAAiB,EACjB,iBAA2B,EAC3B,eAAgC;IAEhC,MAAM,YAAY,GAAG,iBAAiB,CAAC,MAAM,CAAC;IAC9C,MAAM,QAAQ,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAW;QACpB,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,EAAE,CAAC;QACZ,IAAI,IAAI,CAAC,EAAE,CAAC;KACb,CAAC;IACF,wEAAwE;IACxE,KAAK,MAA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AAQ,CAAC;IAC5D,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,OAAO,EAAE,GAAG,yBAAyB,CAC5E,SAAS,EACT,iBAAiB,EACjB,eAAe,CAChB,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,yBAAyB,CACnE,SAAS,EACT,iBAAiB,EACjB,eAAe,CAChB,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,yBAAyB,CACnE,SAAS,EACT,iBAAiB,EACjB,eAAe,CAChB,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAC/B,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEhF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3E,IAAI,SAAS,GAAG,OAAO;SACpB,gBAAgB,CAAC,MAAM,CAAC;SACxB,aAAa,CAAC,mBAAmB,CAAC;SAClC,eAAe,CAAC,MAAM,CAAC,CAAC;IAE3B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC/B,SAAS,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpE,CAAC;IAED,OAAO;QACL,GAAG,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;QAC9D,UAAU,EAAE,mBAAmB;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/transaction.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { MAX_APPROVAL_EXPIRATION_DELTA, buildMultisigRequest, multisigRequestBuilder, requestBoundBlockNum, requestSaltHex, } from './transaction/authArgs.js';
|
|
2
|
+
export { buildConsumeNotesTransactionRequest, buildConsumeNotesTransactionRequestFromNotes, } from './transaction/consumeNotes.js';
|
|
3
|
+
export { ChainBehindBoundBlockError, chainAnchorBlockNum, chainAnchorFromBase64, chainAnchorToBase64, executeForSummary, executeForSummaryAt, executeForSummaryAtTip, prepareTipExecution, isStaleChainError, requireDeclaredBoundBlock, syncToBoundBlock, summaryApprovalExpirationBlockNum, summarySalt, SummaryAnchorMismatchError, } from './transaction/summary.js';
|
|
3
4
|
export { buildP2idNoteFromMetadata, buildP2idTransactionRequest, parseP2idNoteType, p2idNoteTypeToMetadata, type P2idTransactionOptions, type P2ideHeightOptions, } from './transaction/p2id.js';
|
|
4
5
|
export { buildUpdateGuardianTransactionRequest, } from './transaction/updateGuardian.js';
|
|
5
6
|
export { buildUpdateProcedureThresholdTransactionRequest, } from './transaction/updateProcedureThreshold.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,EACnC,4CAA4C,GAC7C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,iCAAiC,EACjC,WAAW,EACX,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qCAAqC,GACtC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+CAA+C,GAChD,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,oCAAoC,GACrC,MAAM,gCAAgC,CAAC"}
|
package/dist/transaction.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { MAX_APPROVAL_EXPIRATION_DELTA, buildMultisigRequest, multisigRequestBuilder, requestBoundBlockNum, requestSaltHex, } from './transaction/authArgs.js';
|
|
2
|
+
export { buildConsumeNotesTransactionRequest, buildConsumeNotesTransactionRequestFromNotes, } from './transaction/consumeNotes.js';
|
|
3
|
+
export { ChainBehindBoundBlockError, chainAnchorBlockNum, chainAnchorFromBase64, chainAnchorToBase64, executeForSummary, executeForSummaryAt, executeForSummaryAtTip, prepareTipExecution, isStaleChainError, requireDeclaredBoundBlock, syncToBoundBlock, summaryApprovalExpirationBlockNum, summarySalt, SummaryAnchorMismatchError, } from './transaction/summary.js';
|
|
3
4
|
export { buildP2idNoteFromMetadata, buildP2idTransactionRequest, parseP2idNoteType, p2idNoteTypeToMetadata, } from './transaction/p2id.js';
|
|
4
5
|
export { buildUpdateGuardianTransactionRequest, } from './transaction/updateGuardian.js';
|
|
5
6
|
export { buildUpdateProcedureThresholdTransactionRequest, } from './transaction/updateProcedureThreshold.js';
|
package/dist/transaction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,EACnC,4CAA4C,GAC7C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,iCAAiC,EACjC,WAAW,EACX,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,GAGvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qCAAqC,GACtC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+CAA+C,GAChD,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,oCAAoC,GACrC,MAAM,gCAAgC,CAAC"}
|
package/dist/types/proposal.d.ts
CHANGED
|
@@ -30,11 +30,11 @@ interface BaseProposalMetadata {
|
|
|
30
30
|
saltHex?: string;
|
|
31
31
|
requiredSignatures?: number;
|
|
32
32
|
/**
|
|
33
|
-
* Base64-serialized Miden `ChainAnchor`
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
33
|
+
* Base64-serialized Miden `ChainAnchor` at the block the proposal's
|
|
34
|
+
* transaction summary binds, the proposer's sync height when it built the
|
|
35
|
+
* request. Required, and checked against the summary's block commitment: a
|
|
36
|
+
* rebuild binds the block it names. The proposal executes at the chain tip,
|
|
37
|
+
* not at the anchor; 0.18.0-rc.1 clients still re-execute at it.
|
|
38
38
|
*/
|
|
39
39
|
chainAnchor?: string;
|
|
40
40
|
}
|
|
@@ -113,7 +113,38 @@ export interface Proposal {
|
|
|
113
113
|
txSummary: string;
|
|
114
114
|
signatures: ProposalSignatureEntry[];
|
|
115
115
|
metadata: ProposalMetadata;
|
|
116
|
+
/**
|
|
117
|
+
* Result of the last summary-binding check on this value. Only the check
|
|
118
|
+
* itself writes `verified`; a freshly parsed or imported proposal is
|
|
119
|
+
* `unchecked`. `syncProposals` surfaces failed proposals instead of
|
|
120
|
+
* failing wholesale (issue #462); `signProposal` and `executeProposal`
|
|
121
|
+
* re-verify and refuse them.
|
|
122
|
+
*/
|
|
123
|
+
verification: ProposalVerification;
|
|
116
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Outcome of checking a proposal's metadata against its signed summary.
|
|
127
|
+
* `failed.retryable` is true when the failure came from a transient node or
|
|
128
|
+
* RPC error, or from chain state this client had not caught up with, so the
|
|
129
|
+
* same proposal may verify on a later sync; false when the proposal itself
|
|
130
|
+
* cannot be reproduced (tampered metadata, for example) and it has to be
|
|
131
|
+
* re-proposed.
|
|
132
|
+
*/
|
|
133
|
+
export type ProposalVerification = {
|
|
134
|
+
status: 'unchecked';
|
|
135
|
+
} | {
|
|
136
|
+
status: 'verified';
|
|
137
|
+
} | {
|
|
138
|
+
status: 'failed';
|
|
139
|
+
retryable: boolean;
|
|
140
|
+
message: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* True when the proposal is both verified and has met its signature
|
|
144
|
+
* threshold, i.e. it can be executed. `status` alone keeps meaning
|
|
145
|
+
* "threshold met": a fully signed proposal can still be dead.
|
|
146
|
+
*/
|
|
147
|
+
export declare function isProposalActionable(proposal: Proposal): boolean;
|
|
117
148
|
export interface TransactionProposal {
|
|
118
149
|
id: string;
|
|
119
150
|
commitment: string;
|
|
@@ -134,6 +165,7 @@ export interface ExportedProposal {
|
|
|
134
165
|
signatureHex: string;
|
|
135
166
|
scheme?: SignatureScheme;
|
|
136
167
|
publicKey?: string;
|
|
168
|
+
messageFormat?: 'eip712';
|
|
137
169
|
timestamp?: string;
|
|
138
170
|
}>;
|
|
139
171
|
metadata: ProposalMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal.d.ts","sourceR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AAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,eAAe,CAAC;QACzB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,QAAQ,CAAC;QACzB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B"}
|
package/dist/types/proposal.js
CHANGED
|
@@ -29,4 +29,12 @@ export function parseP2ideHeight(field, value) {
|
|
|
29
29
|
}
|
|
30
30
|
return value;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* True when the proposal is both verified and has met its signature
|
|
34
|
+
* threshold, i.e. it can be executed. `status` alone keeps meaning
|
|
35
|
+
* "threshold met": a fully signed proposal can still be dead.
|
|
36
|
+
*/
|
|
37
|
+
export function isProposalActionable(proposal) {
|
|
38
|
+
return proposal.verification.status === 'verified' && proposal.status === 'ready';
|
|
39
|
+
}
|
|
32
40
|
//# sourceMappingURL=proposal.js.map
|