@rhinestone/sdk 2.6.0 → 2.8.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/dist/src/accounts/adapters/kernel.d.ts +0 -1
- package/dist/src/accounts/adapters/kernel.d.ts.map +1 -1
- package/dist/src/accounts/adapters/kernel.js +1 -13
- package/dist/src/accounts/kernel-signing.d.ts +3 -0
- package/dist/src/accounts/kernel-signing.d.ts.map +1 -0
- package/dist/src/accounts/kernel-signing.js +13 -0
- package/dist/src/api/direct-signing.d.ts.map +1 -1
- package/dist/src/api/direct-signing.js +11 -6
- package/dist/src/api/signer-selection.js +11 -0
- package/dist/src/chains/caip2.d.ts.map +1 -1
- package/dist/src/chains/caip2.js +2 -1
- package/dist/src/chains/non-evm.d.ts +5 -3
- package/dist/src/chains/non-evm.d.ts.map +1 -1
- package/dist/src/chains/non-evm.js +12 -2
- package/dist/src/clients/orchestrator/client.js +1 -1
- package/dist/src/config/account.d.ts +23 -2
- package/dist/src/config/account.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/modules/validators/capabilities.d.ts.map +1 -1
- package/dist/src/modules/validators/capabilities.js +33 -10
- package/dist/src/modules/validators/contribution.d.ts.map +1 -1
- package/dist/src/modules/validators/contribution.js +12 -0
- package/dist/src/modules/validators/definition.d.ts.map +1 -1
- package/dist/src/modules/validators/definition.js +18 -0
- package/dist/src/modules/validators/quorum.d.ts +66 -0
- package/dist/src/modules/validators/quorum.d.ts.map +1 -0
- package/dist/src/modules/validators/quorum.js +231 -0
- package/dist/src/modules/validators/resolve.d.ts.map +1 -1
- package/dist/src/modules/validators/resolve.js +5 -0
- package/dist/src/modules/validators/types.d.ts +26 -3
- package/dist/src/modules/validators/types.d.ts.map +1 -1
- package/dist/src/signing/hash.d.ts +9 -0
- package/dist/src/signing/hash.d.ts.map +1 -0
- package/dist/src/signing/hash.js +15 -0
- package/dist/src/signing/intent-plans/assemble.d.ts.map +1 -1
- package/dist/src/signing/intent-plans/assemble.js +10 -0
- package/dist/src/signing/intent-plans/independent.d.ts.map +1 -1
- package/dist/src/signing/intent-plans/independent.js +5 -1
- package/dist/src/signing/plan.d.ts.map +1 -1
- package/dist/src/signing/plan.js +14 -1
- package/dist/src/signing/quorum.d.ts +77 -0
- package/dist/src/signing/quorum.d.ts.map +1 -0
- package/dist/src/signing/quorum.js +52 -0
- package/dist/src/signing/signers/ecdsa.d.ts +1 -1
- package/dist/src/signing/signers/ecdsa.d.ts.map +1 -1
- package/dist/src/signing/signers/ecdsa.js +8 -0
- package/dist/src/signing/typed-data.d.ts +12 -6
- package/dist/src/signing/typed-data.d.ts.map +1 -1
- package/dist/src/signing/typed-data.js +9 -4
- package/dist/src/signing/types.d.ts +8 -0
- package/dist/src/signing/types.d.ts.map +1 -1
- package/dist/src/transactions/intents/sign-transaction.d.ts.map +1 -1
- package/dist/src/transactions/intents/sign-transaction.js +161 -47
- package/dist/src/transactions/user-operations/prepare.d.ts.map +1 -1
- package/dist/src/transactions/user-operations/prepare.js +3 -1
- package/dist/src/transactions/user-operations/validator-account.d.ts.map +1 -1
- package/dist/src/transactions/user-operations/validator-account.js +4 -0
- package/package.json +5 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
|
+
import type { ResolvedModule } from '../types.js';
|
|
3
|
+
import type { AtomicValidatorDefinition, ValidatorContributionInput } from './types.js';
|
|
4
|
+
/** Bind an ERC-1271 digest to its Quorum module, chain, and smart account. */
|
|
5
|
+
export declare function getQuorumSignableHash(input: {
|
|
6
|
+
readonly validator: Address;
|
|
7
|
+
readonly chainId: number;
|
|
8
|
+
readonly account: Address;
|
|
9
|
+
readonly hash: Hex;
|
|
10
|
+
}): Hex;
|
|
11
|
+
export interface QuorumMerkleProof {
|
|
12
|
+
readonly root: Hex;
|
|
13
|
+
readonly proof: readonly Hex[];
|
|
14
|
+
}
|
|
15
|
+
export interface QuorumMerkleOperation extends QuorumMerkleProof {
|
|
16
|
+
readonly account: Address;
|
|
17
|
+
readonly digest: Hex;
|
|
18
|
+
readonly leaf: Hex;
|
|
19
|
+
}
|
|
20
|
+
/** Build account-bound leaves and Solady-compatible sorted-pair proofs. */
|
|
21
|
+
export declare function buildQuorumMerkleTree(operations: readonly {
|
|
22
|
+
readonly account: Address;
|
|
23
|
+
readonly digest: Hex;
|
|
24
|
+
}[]): {
|
|
25
|
+
readonly root: Hex;
|
|
26
|
+
readonly operations: readonly QuorumMerkleOperation[];
|
|
27
|
+
};
|
|
28
|
+
/** Hash the chain-agnostic EIP-712 root message signed by every owner. */
|
|
29
|
+
export declare function getQuorumMerkleRootSignableHash(input: {
|
|
30
|
+
readonly validator: Address;
|
|
31
|
+
readonly root: Hex;
|
|
32
|
+
}): Hex;
|
|
33
|
+
/** Resolve Quorum Signer installation data from a weighted owner definition. */
|
|
34
|
+
export declare function resolveQuorumValidator(definition: AtomicValidatorDefinition): ResolvedModule;
|
|
35
|
+
/** Encode a regular Quorum Signer envelope from owner signature contributions. */
|
|
36
|
+
export declare function encodeQuorumValidatorContribution(input: {
|
|
37
|
+
readonly owners: readonly {
|
|
38
|
+
readonly ownerId: string;
|
|
39
|
+
readonly signer: Address;
|
|
40
|
+
readonly weight: bigint;
|
|
41
|
+
}[];
|
|
42
|
+
readonly thresholdWeight: bigint;
|
|
43
|
+
readonly contributions: readonly Extract<ValidatorContributionInput, {
|
|
44
|
+
readonly kind: 'ecdsa';
|
|
45
|
+
}>[];
|
|
46
|
+
}): Hex;
|
|
47
|
+
/** Encode one Merkle proof with an already packed weighted quorum. */
|
|
48
|
+
export declare function encodeQuorumMerkleEnvelope(input: {
|
|
49
|
+
readonly proof: QuorumMerkleProof;
|
|
50
|
+
readonly signatures: Hex;
|
|
51
|
+
}): Hex;
|
|
52
|
+
/** Encode weighted entries without the regular or Merkle envelope prefix. */
|
|
53
|
+
export declare function encodeQuorumWeightedSignatures(input: {
|
|
54
|
+
readonly owners: readonly {
|
|
55
|
+
readonly ownerId: string;
|
|
56
|
+
readonly signer: Address;
|
|
57
|
+
readonly weight: bigint;
|
|
58
|
+
}[];
|
|
59
|
+
readonly thresholdWeight: bigint;
|
|
60
|
+
readonly contributions: readonly Extract<ValidatorContributionInput, {
|
|
61
|
+
readonly kind: 'ecdsa';
|
|
62
|
+
}>[];
|
|
63
|
+
}): Hex;
|
|
64
|
+
/** Build a structurally valid maximum-cost signature for bundler gas estimation. */
|
|
65
|
+
export declare function encodeQuorumMockSignature(definition: AtomicValidatorDefinition): Hex;
|
|
66
|
+
//# sourceMappingURL=quorum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../../../../modules/validators/quorum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,GAAG,EAKT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,SAAS,CAAA;AAUhB,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAA;CACnB,GAAG,GAAG,CAmBN;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAA;IAClB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,G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B,CAAC,KAAK,EAAE;IACpD,QAAQ,CAAC,MAAM,EAAE,SAAS;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;QACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KACxB,EAAE,CAAA;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,SAAS,OAAO,CACtC,0BAA0B,EAC1B;QAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAC3B,EAAE,CAAA;CACJ,GAAG,GAAG,CAEN;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,yBAAyB,GACpC,GAAG,CAcL"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { concat, encodeAbiParameters, hashTypedData, keccak256, size, toHex, } from 'viem';
|
|
2
|
+
import { compareHexValues } from './ordering.js';
|
|
3
|
+
const MAX_QUORUM_OWNERS = 32;
|
|
4
|
+
const MAX_UINT96 = (1n << 96n) - 1n;
|
|
5
|
+
const QUORUM_MESSAGE_TYPEHASH = keccak256(toHex('WeightedOwnableValidatorMessage(address validator,uint256 chainId,address account,bytes32 hash)'));
|
|
6
|
+
/** Bind an ERC-1271 digest to its Quorum module, chain, and smart account. */
|
|
7
|
+
export function getQuorumSignableHash(input) {
|
|
8
|
+
return keccak256(encodeAbiParameters([
|
|
9
|
+
{ type: 'bytes32' },
|
|
10
|
+
{ type: 'address' },
|
|
11
|
+
{ type: 'uint256' },
|
|
12
|
+
{ type: 'address' },
|
|
13
|
+
{ type: 'bytes32' },
|
|
14
|
+
], [
|
|
15
|
+
QUORUM_MESSAGE_TYPEHASH,
|
|
16
|
+
input.validator,
|
|
17
|
+
BigInt(input.chainId),
|
|
18
|
+
input.account,
|
|
19
|
+
input.hash,
|
|
20
|
+
]));
|
|
21
|
+
}
|
|
22
|
+
/** Build account-bound leaves and Solady-compatible sorted-pair proofs. */
|
|
23
|
+
export function buildQuorumMerkleTree(operations) {
|
|
24
|
+
if (operations.length < 2) {
|
|
25
|
+
throw new Error('Quorum Merkle signing requires at least two operations');
|
|
26
|
+
}
|
|
27
|
+
const leaves = operations.map(({ account, digest }) => keccak256(encodeAbiParameters([{ type: 'address' }, { type: 'bytes32' }], [account, digest])));
|
|
28
|
+
const layers = [leaves];
|
|
29
|
+
while (layers.at(-1).length > 1) {
|
|
30
|
+
const current = layers.at(-1);
|
|
31
|
+
const next = [];
|
|
32
|
+
for (let index = 0; index < current.length; index += 2) {
|
|
33
|
+
next.push(index + 1 < current.length
|
|
34
|
+
? hashQuorumMerklePair(current[index], current[index + 1])
|
|
35
|
+
: current[index]);
|
|
36
|
+
}
|
|
37
|
+
layers.push(next);
|
|
38
|
+
}
|
|
39
|
+
const root = layers.at(-1)[0];
|
|
40
|
+
return {
|
|
41
|
+
root,
|
|
42
|
+
operations: operations.map(({ account, digest }, leafIndex) => {
|
|
43
|
+
const proof = [];
|
|
44
|
+
let index = leafIndex;
|
|
45
|
+
for (const layer of layers.slice(0, -1)) {
|
|
46
|
+
const siblingIndex = index % 2 === 0 ? index + 1 : index - 1;
|
|
47
|
+
if (siblingIndex < layer.length)
|
|
48
|
+
proof.push(layer[siblingIndex]);
|
|
49
|
+
index = Math.floor(index / 2);
|
|
50
|
+
}
|
|
51
|
+
return { account, digest, leaf: leaves[leafIndex], root, proof };
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Hash the chain-agnostic EIP-712 root message signed by every owner. */
|
|
56
|
+
export function getQuorumMerkleRootSignableHash(input) {
|
|
57
|
+
return hashTypedData({
|
|
58
|
+
domain: {
|
|
59
|
+
name: 'Quorum Signer',
|
|
60
|
+
version: '1',
|
|
61
|
+
verifyingContract: input.validator,
|
|
62
|
+
},
|
|
63
|
+
types: {
|
|
64
|
+
WeightedMerkleRoot: [{ name: 'root', type: 'bytes32' }],
|
|
65
|
+
},
|
|
66
|
+
primaryType: 'WeightedMerkleRoot',
|
|
67
|
+
message: { root: input.root },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function hashQuorumMerklePair(left, right) {
|
|
71
|
+
return compareHexValues(left, right) < 0
|
|
72
|
+
? keccak256(concat([left, right]))
|
|
73
|
+
: keccak256(concat([right, left]));
|
|
74
|
+
}
|
|
75
|
+
const MAX_SIGNATURE_LENGTH = 65_535;
|
|
76
|
+
const QUORUM_MOCK_SIGNATURE = `0x${'00'.repeat(64)}1b`;
|
|
77
|
+
/** Resolve Quorum Signer installation data from a weighted owner definition. */
|
|
78
|
+
export function resolveQuorumValidator(definition) {
|
|
79
|
+
if (definition.kind !== 'quorum') {
|
|
80
|
+
throw new Error('Quorum resolver received a non-quorum validator');
|
|
81
|
+
}
|
|
82
|
+
const owners = resolveOwners(definition).sort((left, right) => compareHexValues(left.signer, right.signer));
|
|
83
|
+
const thresholdWeight = requireThresholdWeight(definition);
|
|
84
|
+
validateQuorumConfig(owners, thresholdWeight);
|
|
85
|
+
if (definition.module.source !== 'explicit') {
|
|
86
|
+
throw new Error('Quorum validator requires a deployed module address');
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
kind: 'validator',
|
|
90
|
+
address: definition.module.address,
|
|
91
|
+
initData: encodeAbiParameters([
|
|
92
|
+
{ name: 'thresholdWeight', type: 'uint256' },
|
|
93
|
+
{
|
|
94
|
+
name: 'owners',
|
|
95
|
+
type: 'tuple[]',
|
|
96
|
+
components: [
|
|
97
|
+
{ name: 'addr', type: 'address' },
|
|
98
|
+
{ name: 'weight', type: 'uint96' },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
], [
|
|
102
|
+
thresholdWeight,
|
|
103
|
+
owners.map(({ signer, weight }) => ({ addr: signer, weight })),
|
|
104
|
+
]),
|
|
105
|
+
deInitData: '0x',
|
|
106
|
+
additionalContext: '0x',
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Encode a regular Quorum Signer envelope from owner signature contributions. */
|
|
110
|
+
export function encodeQuorumValidatorContribution(input) {
|
|
111
|
+
return concat(['0x00', encodeSelectedQuorumSignatures(input)]);
|
|
112
|
+
}
|
|
113
|
+
function encodeSelectedQuorumSignatures(input) {
|
|
114
|
+
validateQuorumConfig(input.owners, input.thresholdWeight);
|
|
115
|
+
const configured = new Map(input.owners.map((owner) => [owner.ownerId, owner]));
|
|
116
|
+
const contributions = new Map();
|
|
117
|
+
for (const contribution of input.contributions) {
|
|
118
|
+
if (!configured.has(contribution.ownerId)) {
|
|
119
|
+
throw new Error(`Unknown validator owner ${contribution.ownerId}`);
|
|
120
|
+
}
|
|
121
|
+
if (contributions.has(contribution.ownerId)) {
|
|
122
|
+
throw new Error(`Duplicate validator owner ${contribution.ownerId}`);
|
|
123
|
+
}
|
|
124
|
+
contributions.set(contribution.ownerId, contribution.signature);
|
|
125
|
+
}
|
|
126
|
+
const selected = input.owners
|
|
127
|
+
.filter((owner) => contributions.has(owner.ownerId))
|
|
128
|
+
.sort((left, right) => compareAddresses(left.signer, right.signer));
|
|
129
|
+
const signedWeight = selected.reduce((sum, owner) => sum + owner.weight, 0n);
|
|
130
|
+
if (signedWeight < input.thresholdWeight) {
|
|
131
|
+
throw new Error(`Insufficient validator contribution weight: required ${input.thresholdWeight}, received ${signedWeight}`);
|
|
132
|
+
}
|
|
133
|
+
return encodeQuorumEntries(selected.map((owner) => ({
|
|
134
|
+
signer: owner.signer,
|
|
135
|
+
signature: contributions.get(owner.ownerId),
|
|
136
|
+
})));
|
|
137
|
+
}
|
|
138
|
+
/** Encode one Merkle proof with an already packed weighted quorum. */
|
|
139
|
+
export function encodeQuorumMerkleEnvelope(input) {
|
|
140
|
+
if (input.proof.proof.length < 1 || input.proof.proof.length > 32) {
|
|
141
|
+
throw new Error('Quorum Merkle proof length must be between 1 and 32');
|
|
142
|
+
}
|
|
143
|
+
if (input.signatures === '0x') {
|
|
144
|
+
throw new Error('Quorum Merkle signatures must not be empty');
|
|
145
|
+
}
|
|
146
|
+
return concat([
|
|
147
|
+
toHex(input.proof.proof.length, { size: 1 }),
|
|
148
|
+
input.proof.root,
|
|
149
|
+
...input.proof.proof,
|
|
150
|
+
input.signatures,
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
153
|
+
/** Encode weighted entries without the regular or Merkle envelope prefix. */
|
|
154
|
+
export function encodeQuorumWeightedSignatures(input) {
|
|
155
|
+
return encodeSelectedQuorumSignatures(input);
|
|
156
|
+
}
|
|
157
|
+
/** Build a structurally valid maximum-cost signature for bundler gas estimation. */
|
|
158
|
+
export function encodeQuorumMockSignature(definition) {
|
|
159
|
+
if (definition.kind !== 'quorum') {
|
|
160
|
+
throw new Error('Quorum mock signature requires a quorum validator');
|
|
161
|
+
}
|
|
162
|
+
const owners = resolveOwners(definition);
|
|
163
|
+
validateQuorumConfig(owners, requireThresholdWeight(definition));
|
|
164
|
+
return concat([
|
|
165
|
+
'0x00',
|
|
166
|
+
encodeQuorumEntries(owners
|
|
167
|
+
.map(({ signer }) => ({ signer, signature: QUORUM_MOCK_SIGNATURE }))
|
|
168
|
+
.sort((left, right) => compareAddresses(left.signer, right.signer))),
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
function encodeQuorumEntries(entries) {
|
|
172
|
+
if (entries.length === 0)
|
|
173
|
+
throw new Error('Quorum signature must not be empty');
|
|
174
|
+
let previous;
|
|
175
|
+
const packed = entries.map(({ signer, signature }) => {
|
|
176
|
+
if (previous && compareAddresses(previous, signer) >= 0) {
|
|
177
|
+
throw new Error('Quorum signer addresses must be strictly sorted and unique');
|
|
178
|
+
}
|
|
179
|
+
previous = signer;
|
|
180
|
+
const signatureLength = size(signature);
|
|
181
|
+
if (signatureLength > MAX_SIGNATURE_LENGTH) {
|
|
182
|
+
throw new Error(`Quorum inner signature exceeds ${MAX_SIGNATURE_LENGTH} bytes`);
|
|
183
|
+
}
|
|
184
|
+
return concat([signer, toHex(signatureLength, { size: 2 }), signature]);
|
|
185
|
+
});
|
|
186
|
+
return concat(packed);
|
|
187
|
+
}
|
|
188
|
+
function resolveOwners(definition) {
|
|
189
|
+
return definition.owners.map((owner) => {
|
|
190
|
+
if (owner.kind === 'webauthn' || owner.weight === undefined) {
|
|
191
|
+
throw new Error('Quorum validator requires weighted ECDSA owners');
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
ownerId: owner.id,
|
|
195
|
+
signer: owner.account.address,
|
|
196
|
+
weight: owner.weight,
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function requireThresholdWeight(definition) {
|
|
201
|
+
if (definition.thresholdWeight === undefined) {
|
|
202
|
+
throw new Error('Quorum validator threshold weight is missing');
|
|
203
|
+
}
|
|
204
|
+
return definition.thresholdWeight;
|
|
205
|
+
}
|
|
206
|
+
function validateQuorumConfig(owners, thresholdWeight) {
|
|
207
|
+
if (owners.length < 1 || owners.length > MAX_QUORUM_OWNERS) {
|
|
208
|
+
throw new Error(`Quorum owners length must be between 1 and ${MAX_QUORUM_OWNERS}`);
|
|
209
|
+
}
|
|
210
|
+
const seen = new Set();
|
|
211
|
+
let totalWeight = 0n;
|
|
212
|
+
for (const [index, owner] of owners.entries()) {
|
|
213
|
+
const signer = owner.signer.toLowerCase();
|
|
214
|
+
if (signer === '0x0000000000000000000000000000000000000000') {
|
|
215
|
+
throw new Error(`Quorum owner ${index} cannot be the zero address`);
|
|
216
|
+
}
|
|
217
|
+
if (seen.has(signer))
|
|
218
|
+
throw new Error(`Duplicate quorum owner ${owner.signer}`);
|
|
219
|
+
seen.add(signer);
|
|
220
|
+
if (owner.weight <= 0n || owner.weight > MAX_UINT96) {
|
|
221
|
+
throw new Error(`Quorum owner ${owner.signer} weight must fit uint96 and be non-zero`);
|
|
222
|
+
}
|
|
223
|
+
totalWeight += owner.weight;
|
|
224
|
+
}
|
|
225
|
+
if (thresholdWeight <= 0n || thresholdWeight > totalWeight) {
|
|
226
|
+
throw new Error(`Quorum threshold weight must be between 1 and total owner weight ${totalWeight}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function compareAddresses(left, right) {
|
|
230
|
+
return compareHexValues(left, right);
|
|
231
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../modules/validators/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../modules/validators/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAK9C,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,SAAS,CAAA;AAChB,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,YAAY,CAAA;AAEnB,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,yBAAyB,EACrC,gBAAgB,CAAC,EAAE,0BAA0B,GAC5C,cAAc,CAchB;AAKD,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,yBAAyB,GACpC,GAAG,CAgBL;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,yBAAyB;;;EAMtC;AAKD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,2BAA2B,EACvC,gBAAgB,CAAC,EAAE,0BAA0B,GAC5C,cAAc,CAIhB"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { encodeEnsStatelessData, resolveEnsValidator } from './ens.js';
|
|
2
2
|
import { resolveMultiFactorValidator } from './multi-factor.js';
|
|
3
3
|
import { resolveOwnableStatelessData, resolveOwnableValidator } from './ownable.js';
|
|
4
|
+
import { resolveQuorumValidator } from './quorum.js';
|
|
4
5
|
import { resolveWebauthnStatelessData, resolveWebauthnValidator, } from './webauthn.js';
|
|
5
6
|
export function resolveAtomicValidator(definition, webauthnOrdering) {
|
|
6
7
|
switch (definition.kind) {
|
|
7
8
|
case 'ecdsa':
|
|
8
9
|
return resolveOwnableValidator(definition);
|
|
10
|
+
case 'quorum':
|
|
11
|
+
return resolveQuorumValidator(definition);
|
|
9
12
|
case 'ens':
|
|
10
13
|
return resolveEnsValidator(definition);
|
|
11
14
|
case 'passkey':
|
|
@@ -26,6 +29,8 @@ export function resolveAtomicValidatorStatelessData(definition) {
|
|
|
26
29
|
return encodeEnsStatelessData(definition);
|
|
27
30
|
case 'passkey':
|
|
28
31
|
return resolveWebauthnStatelessData(definition);
|
|
32
|
+
case 'quorum':
|
|
33
|
+
throw new Error('Validator quorum cannot be used as a multi-factor factor');
|
|
29
34
|
case 'k1':
|
|
30
35
|
case 'smart-session':
|
|
31
36
|
throw new Error(`Validator ${definition.kind} requires feature input`);
|
|
@@ -2,7 +2,7 @@ import type { Account, Address, Hex } from 'viem';
|
|
|
2
2
|
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
3
|
import type { ModuleId } from '../types.js';
|
|
4
4
|
import type { SmartSessionEnableContributionData } from './smart-session-signature-types.js';
|
|
5
|
-
export type ValidatorKind = 'ecdsa' | 'ens' | 'passkey' | 'multi-factor' | 'k1' | 'smart-session';
|
|
5
|
+
export type ValidatorKind = 'ecdsa' | 'quorum' | 'ens' | 'passkey' | 'multi-factor' | 'k1' | 'smart-session';
|
|
6
6
|
export type ValidatorPayloadKind = 'message' | 'typed-data' | 'intent' | 'user-operation' | 'session-enable';
|
|
7
7
|
export type ValidatorSigningPurpose = 'erc1271' | 'intent' | 'user-operation' | 'session-enable';
|
|
8
8
|
export interface OwnableValidatorConfig {
|
|
@@ -11,6 +11,18 @@ export interface OwnableValidatorConfig {
|
|
|
11
11
|
threshold?: number;
|
|
12
12
|
module?: Address;
|
|
13
13
|
}
|
|
14
|
+
/** One Quorum Signer owner and its non-zero voting weight. */
|
|
15
|
+
export interface QuorumOwner {
|
|
16
|
+
account: Account;
|
|
17
|
+
weight: bigint;
|
|
18
|
+
}
|
|
19
|
+
/** Weighted owner configuration for a deployed Quorum Signer validator. */
|
|
20
|
+
export interface QuorumValidatorConfig {
|
|
21
|
+
type: 'quorum';
|
|
22
|
+
owners: QuorumOwner[];
|
|
23
|
+
thresholdWeight: bigint;
|
|
24
|
+
module: Address;
|
|
25
|
+
}
|
|
14
26
|
export interface ENSValidatorConfig {
|
|
15
27
|
type: 'ens';
|
|
16
28
|
owners: {
|
|
@@ -31,8 +43,8 @@ export interface MultiFactorValidatorConfig {
|
|
|
31
43
|
threshold?: number;
|
|
32
44
|
module?: Address;
|
|
33
45
|
}
|
|
34
|
-
export type OwnerSet = OwnableValidatorConfig | ENSValidatorConfig | WebauthnValidatorConfig | MultiFactorValidatorConfig;
|
|
35
|
-
export type AtomicValidatorInput = OwnableValidatorConfig | ENSValidatorConfig | WebauthnValidatorConfig;
|
|
46
|
+
export type OwnerSet = OwnableValidatorConfig | QuorumValidatorConfig | ENSValidatorConfig | WebauthnValidatorConfig | MultiFactorValidatorConfig;
|
|
47
|
+
export type AtomicValidatorInput = OwnableValidatorConfig | QuorumValidatorConfig | ENSValidatorConfig | WebauthnValidatorConfig;
|
|
36
48
|
export type MultiFactorValidatorInput = MultiFactorValidatorConfig;
|
|
37
49
|
export type ValidatorInput = OwnerSet;
|
|
38
50
|
export type ValidatorModuleSelection = {
|
|
@@ -48,6 +60,7 @@ export type ValidatorOwner = {
|
|
|
48
60
|
readonly signerId: string;
|
|
49
61
|
readonly account: Account;
|
|
50
62
|
readonly expiration?: Date;
|
|
63
|
+
readonly weight?: bigint;
|
|
51
64
|
} | {
|
|
52
65
|
readonly kind: 'webauthn';
|
|
53
66
|
readonly id: string;
|
|
@@ -61,6 +74,7 @@ export interface AtomicValidatorDefinition {
|
|
|
61
74
|
readonly module: ValidatorModuleSelection;
|
|
62
75
|
readonly owners: readonly ValidatorOwner[];
|
|
63
76
|
readonly threshold: number;
|
|
77
|
+
readonly thresholdWeight?: bigint;
|
|
64
78
|
}
|
|
65
79
|
export interface MultiFactorValidatorDefinition {
|
|
66
80
|
readonly kind: 'multi-factor';
|
|
@@ -86,6 +100,15 @@ export type ValidatorContributionCodec = {
|
|
|
86
100
|
readonly publicKey: Hex;
|
|
87
101
|
}[];
|
|
88
102
|
};
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: 'weighted-quorum';
|
|
105
|
+
readonly validator: ModuleId;
|
|
106
|
+
readonly owners: readonly {
|
|
107
|
+
readonly ownerId: string;
|
|
108
|
+
readonly signer: Address;
|
|
109
|
+
readonly weight: bigint;
|
|
110
|
+
}[];
|
|
111
|
+
readonly thresholdWeight: bigint;
|
|
89
112
|
} | {
|
|
90
113
|
readonly kind: 'nested-threshold';
|
|
91
114
|
readonly validator: ModuleId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../modules/validators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAA;AAEzF,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,KAAK,GACL,SAAS,GACT,cAAc,GACd,IAAI,GACJ,eAAe,CAAA;AAEnB,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,gBAAgB,GAChB,gBAAgB,CAAA;AAEpB,MAAM,MAAM,uBAAuB,GAC/B,SAAS,GACT,QAAQ,GACR,gBAAgB,GAChB,gBAAgB,CAAA;AAEpB,MAAM,WAAW,sBAAsB;IACrC,I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AQ,CAAC,cAAc,EAAE,QAAQ,GAAG,WAAW,GAAG,kBAAkB,CAAA;IACpE,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAA;IAC5C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAA;IACrC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC,QAAQ,CAAC,gBAAgB,EAAE,UAAU,GAAG,oBAAoB,CAAA;IAC5D,QAAQ,CAAC,iBAAiB,EAAE,0BAA0B,CAAA;CACvD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { EvmChainReference } from '../chains/types.js';
|
|
3
|
+
import type { SigningContext } from './context.js';
|
|
4
|
+
export declare function resolveAccountValidatorSignableHash(input: {
|
|
5
|
+
readonly hash: Hex;
|
|
6
|
+
readonly chain: EvmChainReference;
|
|
7
|
+
readonly context: SigningContext;
|
|
8
|
+
}): Hex;
|
|
9
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../signing/hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,wBAAgB,mCAAmC,CAAC,KAAK,EAAE;IACzD,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAA;IAClB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CACjC,GAAG,GAAG,CAcN"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { wrapKernelMessageHash } from '../accounts/kernel-signing.js';
|
|
2
|
+
import { getQuorumSignableHash } from '../modules/validators/quorum.js';
|
|
3
|
+
export function resolveAccountValidatorSignableHash(input) {
|
|
4
|
+
const accountHash = input.context.account.definition.kind === 'kernel'
|
|
5
|
+
? wrapKernelMessageHash(input.hash, input.context.account.address)
|
|
6
|
+
: input.hash;
|
|
7
|
+
return input.context.validator.kind === 'quorum'
|
|
8
|
+
? getQuorumSignableHash({
|
|
9
|
+
validator: input.context.validatorCapabilities.compatibilityKey.moduleAddress,
|
|
10
|
+
chainId: input.chain.id,
|
|
11
|
+
account: input.context.account.address,
|
|
12
|
+
hash: accountHash,
|
|
13
|
+
})
|
|
14
|
+
: accountHash;
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../signing/intent-plans/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../signing/intent-plans/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAErE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,yBAAyB,EAChC,OAAO,EAAE,cAAc,GACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAsB3C;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,CAAA;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;QAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KACzB,CAAA;CACF,GAAG,GAAG,CAmDN"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { encodeQuorumMerkleEnvelope } from '../../modules/validators/quorum.js';
|
|
1
2
|
import { encodePlannedValidatorContribution } from '../contribution.js';
|
|
2
3
|
import { runSigningStep } from '../error.js';
|
|
3
4
|
import { wrapErc7739TypedDataSignature } from '../protocols/erc7739.js';
|
|
@@ -39,6 +40,15 @@ export function assembleIntentValidatorArtifact(input) {
|
|
|
39
40
|
})
|
|
40
41
|
: operation();
|
|
41
42
|
let contribution = input.validatorContribution;
|
|
43
|
+
if (input.artifact.quorumMerkleProof) {
|
|
44
|
+
if (!contribution.startsWith('0x00')) {
|
|
45
|
+
throw new Error('Quorum Merkle contribution has no regular envelope prefix');
|
|
46
|
+
}
|
|
47
|
+
contribution = step('validator-encode', () => encodeQuorumMerkleEnvelope({
|
|
48
|
+
proof: input.artifact.quorumMerkleProof,
|
|
49
|
+
signatures: `0x${contribution.slice(4)}`,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
42
52
|
const erc7739 = input.artifact.erc7739;
|
|
43
53
|
if (erc7739.kind === 'wrap-typed-data') {
|
|
44
54
|
contribution = step('protocol-operation', () => wrapErc7739TypedDataSignature({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"independent.d.ts","sourceRoot":"","sources":["../../../../signing/intent-plans/independent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAY/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,o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O,EAAE,cAAc,CAAA;CACjC,GAAG,GAAG,CA+BN;AAoLD,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,eAAe,CAAA"}
|
|
@@ -15,7 +15,11 @@ export function assembleIndependentIntentArtifact(input) {
|
|
|
15
15
|
throw new Error('Smart Session state cannot be signed independently');
|
|
16
16
|
}
|
|
17
17
|
const validatorContribution = input.artifact.validatorFactors
|
|
18
|
-
?
|
|
18
|
+
? codec.kind !== 'nested-threshold'
|
|
19
|
+
? (() => {
|
|
20
|
+
throw new Error('Independent factor signing requires a nested codec');
|
|
21
|
+
})()
|
|
22
|
+
: encodeIndependentFactors(codec, input.artifact.validatorFactors, contributions)
|
|
19
23
|
: encodeAtomicContributions(codec, contributions.map(({ contribution }) => contribution));
|
|
20
24
|
return assembleIntentValidatorArtifact({
|
|
21
25
|
artifact: input.artifact,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../signing/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAE9E,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EAEtB,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAiO3D;AAUD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC7C,QAAQ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;IAC7C,QAAQ,CAAC,SAAS,EAAE,SAAS,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,OAAO,CAAC,EAAE,CAAA;CAC/E,GAAG,WAAW,CAiDd;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAA;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CACjC,MAAM,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE,eAAe,CAAC,CAClD,CAAA;IACD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,oBAAoB,GAAG,uBAAuB,CAAA;IACxE,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,GAAG,0BAA0B,CAAA;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,eAAe,CAAA;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC/C,GAAG,SAAS,kBAAkB,EAAE,CAwDhC;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,2BAA2B,EACtC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GACpC;IACD,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAA;IACxD,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAA;CACtD,CA8BA"}
|
package/dist/src/signing/plan.js
CHANGED
|
@@ -211,6 +211,7 @@ export function createValidatorSigningTasks(input) {
|
|
|
211
211
|
if (!signer)
|
|
212
212
|
throw new Error(`Signer reference ${owner.signerId} is missing`);
|
|
213
213
|
const webauthn = owner.kind === 'webauthn';
|
|
214
|
+
const quorum = input.validator.kind === 'quorum';
|
|
214
215
|
return [
|
|
215
216
|
{
|
|
216
217
|
id: `${input.taskPrefix}:${owner.id}`,
|
|
@@ -218,7 +219,9 @@ export function createValidatorSigningTasks(input) {
|
|
|
218
219
|
role: input.role ?? (factor.factorId ? 'factor' : 'owner'),
|
|
219
220
|
invocationKind: webauthn
|
|
220
221
|
? input.webauthnInvocation
|
|
221
|
-
:
|
|
222
|
+
: quorum
|
|
223
|
+
? 'ecdsa-sign-hash'
|
|
224
|
+
: input.ecdsaInvocation,
|
|
222
225
|
contribution: webauthn
|
|
223
226
|
? {
|
|
224
227
|
kind: 'webauthn',
|
|
@@ -291,6 +294,16 @@ function materializeTask(template, input) {
|
|
|
291
294
|
message: material.message,
|
|
292
295
|
},
|
|
293
296
|
};
|
|
297
|
+
case 'ecdsa-sign-hash':
|
|
298
|
+
requireMaterial(template, material, 'message');
|
|
299
|
+
return {
|
|
300
|
+
...template,
|
|
301
|
+
invocation: {
|
|
302
|
+
kind: 'ecdsa-sign-hash',
|
|
303
|
+
...(chain ? { chain } : {}),
|
|
304
|
+
hash: material.message.raw,
|
|
305
|
+
},
|
|
306
|
+
};
|
|
294
307
|
case 'ecdsa-sign-typed-data':
|
|
295
308
|
requireMaterial(template, material, 'typed-data');
|
|
296
309
|
return {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
import type { AccountType } from '../accounts/types.js';
|
|
3
|
+
import { type QuorumMerkleOperation } from '../modules/validators/quorum.js';
|
|
4
|
+
/** One Quorum Signer owner used to assemble a weighted signature. */
|
|
5
|
+
export interface QuorumSigningOwner {
|
|
6
|
+
/** Stable owner identifier used to associate an independently collected signature. */
|
|
7
|
+
ownerId: string;
|
|
8
|
+
/** EOA or EIP-1271 signer address configured in the Quorum validator. */
|
|
9
|
+
signer: Address;
|
|
10
|
+
/** Weight contributed when this owner's signature validates. */
|
|
11
|
+
weight: bigint;
|
|
12
|
+
}
|
|
13
|
+
/** One independently collected signature over a Quorum signing digest. */
|
|
14
|
+
export interface QuorumOwnerSignature {
|
|
15
|
+
/** Identifier matching one configured {@link QuorumSigningOwner}. */
|
|
16
|
+
ownerId: string;
|
|
17
|
+
/** Raw ECDSA or EIP-1271 signature bytes. */
|
|
18
|
+
signature: Hex;
|
|
19
|
+
}
|
|
20
|
+
/** Account-bound operation included in a Quorum Merkle signing batch. */
|
|
21
|
+
export interface QuorumMerkleSigningOperation {
|
|
22
|
+
/** Smart account that will validate this operation. */
|
|
23
|
+
account: Address;
|
|
24
|
+
/** Validator-specific operation digest placed in the account-bound Merkle leaf. */
|
|
25
|
+
digest: Hex;
|
|
26
|
+
}
|
|
27
|
+
/** Merkle root and one proof-bearing result for every input operation. */
|
|
28
|
+
export interface QuorumMerkleSigningTree {
|
|
29
|
+
/** Shared root signed by the owner quorum. */
|
|
30
|
+
root: Hex;
|
|
31
|
+
/** Proofs in the same order as the input operations. */
|
|
32
|
+
operations: readonly QuorumMerkleOperation[];
|
|
33
|
+
}
|
|
34
|
+
/** Bind an ERC-1271 application hash to one Quorum validator, chain, and account. */
|
|
35
|
+
export declare function getQuorumErc1271SignableHash(input: {
|
|
36
|
+
/** Deployed Quorum Signer validator address. */
|
|
37
|
+
validator: Address;
|
|
38
|
+
/** Chain on which ERC-1271 validation will execute. */
|
|
39
|
+
chainId: number;
|
|
40
|
+
/** Smart account that will call the validator. */
|
|
41
|
+
account: Address;
|
|
42
|
+
/** Application hash passed to the smart account's ERC-1271 entry point. */
|
|
43
|
+
hash: Hex;
|
|
44
|
+
/** Smart account implementation, when it transforms ERC-1271 hashes. */
|
|
45
|
+
accountType?: AccountType;
|
|
46
|
+
}): Hex;
|
|
47
|
+
/** Build account-bound Merkle leaves and proofs for a Quorum signing batch. */
|
|
48
|
+
export declare function buildQuorumSigningTree(operations: readonly QuorumMerkleSigningOperation[]): QuorumMerkleSigningTree;
|
|
49
|
+
/** Derive the chain-agnostic EIP-712 digest owners sign for a Quorum Merkle root. */
|
|
50
|
+
export declare function getQuorumSigningTreeHash(input: {
|
|
51
|
+
/** Deployed Quorum Signer validator address shared by the target chains. */
|
|
52
|
+
validator: Address;
|
|
53
|
+
/** Root returned by {@link buildQuorumSigningTree}. */
|
|
54
|
+
root: Hex;
|
|
55
|
+
}): Hex;
|
|
56
|
+
/** Pack weighted owner signatures without selecting a regular or Merkle envelope. */
|
|
57
|
+
export declare function encodeQuorumOwnerSignatures(input: {
|
|
58
|
+
/** Complete configured owner policy, including weights. */
|
|
59
|
+
owners: readonly QuorumSigningOwner[];
|
|
60
|
+
/** Minimum aggregate weight required by the validator. */
|
|
61
|
+
thresholdWeight: bigint;
|
|
62
|
+
/** Independently collected signatures over one common Quorum digest. */
|
|
63
|
+
signatures: readonly QuorumOwnerSignature[];
|
|
64
|
+
}): Hex;
|
|
65
|
+
/** Pack a regular ERC-1271 Quorum signature for one operation digest. */
|
|
66
|
+
export declare function encodeQuorumErc1271Signature(input: {
|
|
67
|
+
/** Weighted owner entries returned by {@link encodeQuorumOwnerSignatures}. */
|
|
68
|
+
signatures: Hex;
|
|
69
|
+
}): Hex;
|
|
70
|
+
/** Pack one operation's Merkle proof and shared weighted owner signatures. */
|
|
71
|
+
export declare function encodeQuorumMerkleSignature(input: {
|
|
72
|
+
/** Operation result returned by {@link buildQuorumSigningTree}. */
|
|
73
|
+
operation: QuorumMerkleOperation;
|
|
74
|
+
/** Weighted owner entries returned by {@link encodeQuorumOwnerSignatures}. */
|
|
75
|
+
signatures: Hex;
|
|
76
|
+
}): Hex;
|
|
77
|
+
//# sourceMappingURL=quorum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../../../signing/quorum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAA;AACrC,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,sFAAsF;IACtF,OAAO,EAAE,MAAM,CAAA;IACf,yEAAyE;IACzE,MAAM,EAAE,OAAO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